inet6_rth_init() — Initialize an IPv6 routing header buffer

Standards

Standards / Extensions C or C++ Dependencies

RFC3542

both z/OS® V1R7

Format

#define _OPEN_SYS_SOCK_IPV6
#include <netinet/in.h>

void *inet6_rth_init(void *bp, socklen_t bp_len,
                     int type, int segments);

General description

inet6_rth_init() initializes the buffer pointed to by bp to contain a routing header of the specified type and sets ip6r_len based on the segments parameter.

Returned value

When successful, inet6_rth_init() returns the pointer to the buffer, bp. This is then used as the first argument to the inet6_rth_add() function.

Upon failure, returns NULL and errno is set to one of the following:

EINVAL If one of the following is true::

  • bp is NULL;
  • type indicates an unsupported header type;
  • segments is not valid for the type;
  • the buffer is not large enough, bp_len is too small.

Usage notes

  1. The caller must allocate the buffer; its size can be determined by calling inet6_rth_space().
  2. Any cmsghdr fields must be initialized when the application uses ancillary data.

Related information