<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>inet6_rthdr_space</TITLE
|
>inet6_rthdr_space</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos Reference Manual"
|
TITLE="eCos Reference Manual"
|
HREF="ecos-ref.html"><LINK
|
HREF="ecos-ref.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="TCP/IP Library Reference"
|
TITLE="TCP/IP Library Reference"
|
HREF="tcpip-library-reference.html"><LINK
|
HREF="tcpip-library-reference.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="inet6_option_space"
|
TITLE="inet6_option_space"
|
HREF="net-common-tcpip-manpages-inet6-option-space.html"><LINK
|
HREF="net-common-tcpip-manpages-inet6-option-space.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="inet_net"
|
TITLE="inet_net"
|
HREF="net-common-tcpip-manpages-inet-net.html"></HEAD
|
HREF="net-common-tcpip-manpages-inet-net.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="SECT1"
|
CLASS="SECT1"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos Reference Manual</TH
|
>eCos Reference Manual</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="net-common-tcpip-manpages-inet6-option-space.html"
|
HREF="net-common-tcpip-manpages-inet6-option-space.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
>Chapter 38. TCP/IP Library Reference</TD
|
>Chapter 38. TCP/IP Library Reference</TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="net-common-tcpip-manpages-inet-net.html"
|
HREF="net-common-tcpip-manpages-inet-net.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><DIV
|
><DIV
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><H1
|
><H1
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><A
|
><A
|
NAME="NET-COMMON-TCPIP-MANPAGES-INET6-RTHDR-SPACE">inet6_rthdr_space</H1
|
NAME="NET-COMMON-TCPIP-MANPAGES-INET6-RTHDR-SPACE">inet6_rthdr_space</H1
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
>INET6_RTHDR_SPACE(3) System Library Functions Manual INET6_RTHDR_SPACE(3)
|
>INET6_RTHDR_SPACE(3) System Library Functions Manual INET6_RTHDR_SPACE(3)
|
|
|
NAME
|
NAME
|
inet6_rthdr_space, inet6_rthdr_init, inet6_rthdr_add,
|
inet6_rthdr_space, inet6_rthdr_init, inet6_rthdr_add,
|
inet6_rthdr_lasthop, inet6_rthdr_reverse, inet6_rthdr_segments,
|
inet6_rthdr_lasthop, inet6_rthdr_reverse, inet6_rthdr_segments,
|
inet6_rthdr_getaddr, inet6_rthdr_getflags - IPv6 Routing Header Options
|
inet6_rthdr_getaddr, inet6_rthdr_getflags - IPv6 Routing Header Options
|
manipulation
|
manipulation
|
|
|
SYNOPSIS
|
SYNOPSIS
|
#include <netinet/in.h>
|
#include <netinet/in.h>
|
|
|
size_t
|
size_t
|
inet6_rthdr_space(int type, int segments);
|
inet6_rthdr_space(int type, int segments);
|
|
|
struct cmsghdr *
|
struct cmsghdr *
|
inet6_rthdr_init(void *bp, int type);
|
inet6_rthdr_init(void *bp, int type);
|
|
|
int
|
int
|
inet6_rthdr_add(struct cmsghdr *cmsg, const struct in6_addr *addr,
|
inet6_rthdr_add(struct cmsghdr *cmsg, const struct in6_addr *addr,
|
unsigned int flags);
|
unsigned int flags);
|
|
|
int
|
int
|
inet6_rthdr_lasthop(struct cmsghdr *cmsg, unsigned int flags);
|
inet6_rthdr_lasthop(struct cmsghdr *cmsg, unsigned int flags);
|
|
|
int
|
int
|
inet6_rthdr_reverse(const struct cmsghdr *in, struct cmsghdr *out);
|
inet6_rthdr_reverse(const struct cmsghdr *in, struct cmsghdr *out);
|
|
|
int
|
int
|
inet6_rthdr_segments(const struct cmsghdr *cmsg);
|
inet6_rthdr_segments(const struct cmsghdr *cmsg);
|
|
|
struct in6_addr *
|
struct in6_addr *
|
inet6_rthdr_getaddr(struct cmsghdr *cmsg, int index);
|
inet6_rthdr_getaddr(struct cmsghdr *cmsg, int index);
|
|
|
int
|
int
|
inet6_rthdr_getflags(const struct cmsghdr *cmsg, int index);
|
inet6_rthdr_getflags(const struct cmsghdr *cmsg, int index);
|
|
|
DESCRIPTION
|
DESCRIPTION
|
RFC2292 IPv6 advanced API defines eight functions that the application
|
RFC2292 IPv6 advanced API defines eight functions that the application
|
calls to build and examine a Routing header. Four functions build a
|
calls to build and examine a Routing header. Four functions build a
|
Routing header:
|
Routing header:
|
|
|
inet6_rthdr_space() return #bytes required for ancillary data
|
inet6_rthdr_space() return #bytes required for ancillary data
|
|
|
inet6_rthdr_init() initialize ancillary data for Routing header
|
inet6_rthdr_init() initialize ancillary data for Routing header
|
|
|
inet6_rthdr_add() add IPv6 address & flags to Routing header
|
inet6_rthdr_add() add IPv6 address & flags to Routing header
|
|
|
inet6_rthdr_lasthop() specify the flags for the final hop
|
inet6_rthdr_lasthop() specify the flags for the final hop
|
|
|
Four functions deal with a returned Routing header:
|
Four functions deal with a returned Routing header:
|
|
|
inet6_rthdr_reverse() reverse a Routing header
|
inet6_rthdr_reverse() reverse a Routing header
|
|
|
inet6_rthdr_segments() return #segments in a Routing header
|
inet6_rthdr_segments() return #segments in a Routing header
|
|
|
inet6_rthdr_getaddr() fetch one address from a Routing header
|
inet6_rthdr_getaddr() fetch one address from a Routing header
|
|
|
inet6_rthdr_getflags() fetch one flag from a Routing header
|
inet6_rthdr_getflags() fetch one flag from a Routing header
|
|
|
The function prototypes for these functions are all in the <netinet/in.h>
|
The function prototypes for these functions are all in the <netinet/in.h>
|
header.
|
header.
|
|
|
inet6_rthdr_space
|
inet6_rthdr_space
|
This function returns the number of bytes required to hold a Routing
|
This function returns the number of bytes required to hold a Routing
|
header of the specified type containing the specified number of segments
|
header of the specified type containing the specified number of segments
|
(addresses). For an IPv6 Type 0 Routing header, the number of segments
|
(addresses). For an IPv6 Type 0 Routing header, the number of segments
|
must be between 1 and 23, inclusive. The return value includes the size
|
must be between 1 and 23, inclusive. The return value includes the size
|
of the cmsghdr structure that precedes the Routing header, and any
|
of the cmsghdr structure that precedes the Routing header, and any
|
required padding.
|
required padding.
|
|
|
If the return value is 0, then either the type of the Routing header is
|
If the return value is 0, then either the type of the Routing header is
|
not supported by this implementation or the number of segments is invalid
|
not supported by this implementation or the number of segments is invalid
|
for this type of Routing header.
|
for this type of Routing header.
|
|
|
Note: This function returns the size but does not allocate the space
|
Note: This function returns the size but does not allocate the space
|
required for the ancillary data. This allows an application to allocate
|
required for the ancillary data. This allows an application to allocate
|
a larger buffer, if other ancillary data objects are desired, since all
|
a larger buffer, if other ancillary data objects are desired, since all
|
the ancillary data objects must be specified to sendmsg(2) as a single
|
the ancillary data objects must be specified to sendmsg(2) as a single
|
msg_control buffer.
|
msg_control buffer.
|
|
|
inet6_rthdr_init
|
inet6_rthdr_init
|
This function initializes the buffer pointed to by bp to contain a
|
This function initializes the buffer pointed to by bp to contain a
|
cmsghdr structure followed by a Routing header of the specified type.
|
cmsghdr structure followed by a Routing header of the specified type.
|
The cmsg_len member of the cmsghdr structure is initialized to the size
|
The cmsg_len member of the cmsghdr structure is initialized to the size
|
of the structure plus the amount of space required by the Routing header.
|
of the structure plus the amount of space required by the Routing header.
|
The cmsg_level and cmsg_type members are also initialized as required.
|
The cmsg_level and cmsg_type members are also initialized as required.
|
|
|
The caller must allocate the buffer and its size can be determined by
|
The caller must allocate the buffer and its size can be determined by
|
calling inet6_rthdr_space().
|
calling inet6_rthdr_space().
|
|
|
Upon success the return value is the pointer to the cmsghdr structure,
|
Upon success the return value is the pointer to the cmsghdr structure,
|
and this is then used as the first argument to the next two functions.
|
and this is then used as the first argument to the next two functions.
|
Upon an error the return value is NULL.
|
Upon an error the return value is NULL.
|
|
|
inet6_rthdr_add
|
inet6_rthdr_add
|
This function adds the address pointed to by addr to the end of the Rout-
|
This function adds the address pointed to by addr to the end of the Rout-
|
ing header being constructed and sets the type of this hop to the value
|
ing header being constructed and sets the type of this hop to the value
|
of flags. For an IPv6 Type 0 Routing header, flags must be either
|
of flags. For an IPv6 Type 0 Routing header, flags must be either
|
IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.
|
IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.
|
|
|
If successful, the cmsg_len member of the cmsghdr structure is updated to
|
If successful, the cmsg_len member of the cmsghdr structure is updated to
|
account for the new address in the Routing header and the return value of
|
account for the new address in the Routing header and the return value of
|
the function is 0. Upon an error the return value of the function is -1.
|
the function is 0. Upon an error the return value of the function is -1.
|
|
|
inet6_rthdr_lasthop
|
inet6_rthdr_lasthop
|
This function specifies the Strict/Loose flag for the final hop of a
|
This function specifies the Strict/Loose flag for the final hop of a
|
Routing header. For an IPv6 Type 0 Routing header, flags must be either
|
Routing header. For an IPv6 Type 0 Routing header, flags must be either
|
IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.
|
IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.
|
|
|
The return value of the function is 0 upon success, or -1 upon an error.
|
The return value of the function is 0 upon success, or -1 upon an error.
|
|
|
Notice that a Routing header specifying N intermediate nodes requires N+1
|
Notice that a Routing header specifying N intermediate nodes requires N+1
|
Strict/Loose flags. This requires N calls to inet6_rthdr_add() followed
|
Strict/Loose flags. This requires N calls to inet6_rthdr_add() followed
|
by one call to inet6_rthdr_lasthop().
|
by one call to inet6_rthdr_lasthop().
|
|
|
inet6_rthdr_reverse
|
inet6_rthdr_reverse
|
This function takes a Routing header that was received as ancillary data
|
This function takes a Routing header that was received as ancillary data
|
(pointed to by the first argument, in) and writes a new Routing header
|
(pointed to by the first argument, in) and writes a new Routing header
|
that sends datagrams along the reverse of that route. Both arguments are
|
that sends datagrams along the reverse of that route. Both arguments are
|
allowed to point to the same buffer (that is, the reversal can occur in
|
allowed to point to the same buffer (that is, the reversal can occur in
|
place).
|
place).
|
|
|
The return value of the function is 0 on success, or -1 upon an error.
|
The return value of the function is 0 on success, or -1 upon an error.
|
|
|
inet6_rthdr_segments
|
inet6_rthdr_segments
|
This function returns the number of segments (addresses) contained in the
|
This function returns the number of segments (addresses) contained in the
|
Routing header described by cmsg. On success the return value is between
|
Routing header described by cmsg. On success the return value is between
|
1 and 23, inclusive. The return value of the function is -1 upon an
|
1 and 23, inclusive. The return value of the function is -1 upon an
|
error.
|
error.
|
|
|
inet6_rthdr_getaddr
|
inet6_rthdr_getaddr
|
This function returns a pointer to the IPv6 address specified by index
|
This function returns a pointer to the IPv6 address specified by index
|
(which must have a value between 1 and the value returned by
|
(which must have a value between 1 and the value returned by
|
inet6_rthdr_segments()) in the Routing header described by cmsg. An
|
inet6_rthdr_segments()) in the Routing header described by cmsg. An
|
application should first call inet6_rthdr_segments() to obtain the number
|
application should first call inet6_rthdr_segments() to obtain the number
|
of segments in the Routing header.
|
of segments in the Routing header.
|
|
|
Upon an error the return value of the function is NULL.
|
Upon an error the return value of the function is NULL.
|
|
|
inet6_rthdr_getflags
|
inet6_rthdr_getflags
|
This function returns the flags value specified by index (which must have
|
This function returns the flags value specified by index (which must have
|
a value between 0 and the value returned by inet6_rthdr_segments()) in
|
a value between 0 and the value returned by inet6_rthdr_segments()) in
|
the Routing header described by cmsg. For an IPv6 Type 0 Routing header
|
the Routing header described by cmsg. For an IPv6 Type 0 Routing header
|
the return value will be either IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.
|
the return value will be either IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.
|
|
|
Upon an error the return value of the function is -1.
|
Upon an error the return value of the function is -1.
|
|
|
Note: Addresses are indexed starting at 1, and flags starting at 0, to
|
Note: Addresses are indexed starting at 1, and flags starting at 0, to
|
maintain consistency with the terminology and figures in RFC2460.
|
maintain consistency with the terminology and figures in RFC2460.
|
|
|
DIAGNOSTICS
|
DIAGNOSTICS
|
inet6_rthdr_space() returns 0 on errors.
|
inet6_rthdr_space() returns 0 on errors.
|
|
|
inet6_rthdr_add(), inet6_rthdr_lasthop() and inet6_rthdr_reverse() return
|
inet6_rthdr_add(), inet6_rthdr_lasthop() and inet6_rthdr_reverse() return
|
0 on success, and returns -1 on error.
|
0 on success, and returns -1 on error.
|
|
|
inet6_rthdr_init() and inet6_rthdr_getaddr() return NULL on error.
|
inet6_rthdr_init() and inet6_rthdr_getaddr() return NULL on error.
|
|
|
inet6_rthdr_segments() and inet6_rthdr_getflags() return -1 on error.
|
inet6_rthdr_segments() and inet6_rthdr_getflags() return -1 on error.
|
|
|
EXAMPLES
|
EXAMPLES
|
RFC2292 gives comprehensive examples in chapter 8.
|
RFC2292 gives comprehensive examples in chapter 8.
|
|
|
SEE ALSO
|
SEE ALSO
|
W. Stevens and M. Thomas, Advanced Sockets API for IPv6, RFC2292,
|
W. Stevens and M. Thomas, Advanced Sockets API for IPv6, RFC2292,
|
February 1998.
|
February 1998.
|
|
|
S. Deering and R. Hinden, Internet Protocol, Version 6 (IPv6)
|
S. Deering and R. Hinden, Internet Protocol, Version 6 (IPv6)
|
Specification, RFC2460, December 1998.
|
Specification, RFC2460, December 1998.
|
|
|
HISTORY
|
HISTORY
|
The implementation first appeared in KAME advanced networking kit.
|
The implementation first appeared in KAME advanced networking kit.
|
|
|
STANDARDS
|
STANDARDS
|
The functions are documented in ``Advanced Sockets API for IPv6''
|
The functions are documented in ``Advanced Sockets API for IPv6''
|
(RFC2292).
|
(RFC2292).
|
|
|
BUGS
|
BUGS
|
The text was shamelessly copied from RFC2292.
|
The text was shamelessly copied from RFC2292.
|
|
|
inet6_rthdr_reverse() is not implemented yet.
|
inet6_rthdr_reverse() is not implemented yet.
|
|
|
BSD December 10, 1999 BSD
|
BSD December 10, 1999 BSD
|
</PRE
|
</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-common-tcpip-manpages-inet6-option-space.html"
|
HREF="net-common-tcpip-manpages-inet6-option-space.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-ref.html"
|
HREF="ecos-ref.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="net-common-tcpip-manpages-inet-net.html"
|
HREF="net-common-tcpip-manpages-inet-net.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>inet6_option_space</TD
|
>inet6_option_space</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="tcpip-library-reference.html"
|
HREF="tcpip-library-reference.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>inet_net</TD
|
>inet_net</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|