inet6_rth_init()--Initialize Buffer Data for the IPv6 Routing Header
Syntax
#include <netinet/in.h>
void *inet6_rth_init(void *routing_buffer,
int routing_buffer_length,
int header_type,
int segments)
Service Program Name: QSOSRV1IP6
Default Public Authority: *USE
Threadsafe: Yes
The inet6_rth_init() functions initializes the buffer pointed to by the routing_buffer parameter to contain a routing extension header of
type header_type and sets the ip6r_len within the routing extension
header struct ip6_rthdr based on the segments parameter.
Parameters
routing_buffer
(I/O) Pointer to the buffer to store the routing extension header.
routing_buffer_length
(Input) Length, in bytes, of the buffer to contain the routing extension header.
This value is used to verify that the buffer is large enough to contain the routing extension header.
header_type
(Input) Type of routing extension header that is to be built.
segments
(Input) Total number of segments (addresses) to be included in the routing extension header.
Authorities
No authorization is required.
Return Value
inet6_rth_init() returns a pointer. Possible values are:
NULL (unsuccessful)
n (successful), where n is a pointer to the buffer, routing_buffer
Error Conditions
When inet6_rth_init() fails, errno can be set to one of the following:
[EFAULT]
Bad address.
The system detected an address that was not valid while attempting to
access the buffer pointed to by the routing_buffer parameter.
[EINVAL]
Parameter not valid.
This error code indicates one of the following:
The routing_buffer_length field contains a value that is not valid.
The header_type field is not supported.
The segments field contains a value that is not valid for the
specified header_type.
Usage Notes
The following fields in the ip6_rthdr structure will be initialized:
ip6r_segleft initialized to 0
ip6r_nxt initialized to 0
ip6r_type set to the value of the header_type parameter
ip6r_len set to the value of the segments parameter
The caller must allocate the buffer, routing_buffer. Use the inet6_rth_space() function
to determine the size of buffer to allocate.
The pointer returned from inet6_rth_init() can be used as the first argument
to the first call to the inet6_rth_add() function.
IPV6_RTHDR_TYPE_0 is the only supported routing extension header type.
The number of segments for IPV6_RTHDR_TYPE_0 must be in the range 0 to 127, inclusive.
Related Information
inet6_rth_add()--Add an IPv6 Address to the IPv6 Routing Header