Initializes an IPv6 routing header buffer.
Format
#include <in6.h>
void *inet6_rth_init ( void *bp, int bp_len, int type, int
segments );
1 – Arguments
bp
Points to a buffer that is to contain an IPv6 routing header.
bp_len
Specifies the length, in bytes, of the buffer.
type
Specifies the type of routing header. The valid value is IPV6_
RTHDR_TYPE_0 for IPv6 routing header type 0.
segments
Specifies the number of segments or addresses that are to be
included in the routing header. The valid value is from 0 to 127,
inclusive.
2 – Description
This function initializes a buffer and buffer data for an IPv6
routing header. The function sets the ip6r0_segleft, ip6r0_nxt,
and ip6r0_reserved members in the ip6_rthdr0 structure to zero.
In addition, it sets the ip6r0_type member to type and sets the
ip6r0_len member based on the segments argument. The ip6_rthdr0
structure is defined in the IP6.H header file.
The application must allocate the buffer. Use the inet6_rth_
space() function to determine the buffer size.
Use the returned pointer as the first argument to the inet6_rth_
add() function.
3 – Return Values
x Upon successful completion, the inet6_rth_
init() function returns a pointer to the
buffer that is to contain the routing header.
NULL pointer Failure. If the type is not supported, the bp
is a null, or the number of bp_len is invalid.