inet6_rth_init Subroutine

Purpose

Initializes a buffer to contain a Routing header.

Syntax

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

Description

The inet6_rth_init subroutine 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. bp_len is only used to verify that the buffer is large enough. The ip6r_segleft field is set to 0; inet6_rth_add() increments it.

When the application uses ancillary data, the application must initialize any cmsghdr fields. The caller must allocate the buffer, and the size of the buffer can be determined by calling inet6_rth_space().

Parameters

Item Description
bp Points to the buffer to be initialized.
bp_len Size of the buffer pointed to by bp.
type Specifies the type of Routing header to be held.
segments Specifies the number of addresses within the Routing header.

Return Values

Upon success, the return value is the pointer to the buffer (bp), and this is then used as the first argument to the inet6_rth_add() function.

Item Description
NULL The buffer could not be initialized.