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:


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

  1. The following fields in the ip6_rthdr structure will be initialized:
  2. The caller must allocate the buffer, routing_buffer. Use the inet6_rth_space() function to determine the size of buffer to allocate.
  3. The pointer returned from inet6_rth_init() can be used as the first argument to the first call to the inet6_rth_add() function.
  4. 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




API introduced: V6R1

[ Back to top | UNIX-Type APIs | APIs by category ]