![]() |
Software > OpenVMS Systems > Documentation > 731final > tcprn ![]() HP OpenVMS Systems Documentation |
![]() |
>
Compaq TCP/IP Services for OpenVMS
|
Previous | Contents |
The socket calls that are used to build and examine IPv6 option headers are:
Returns the length of an IPv6 extension header with a new option and appends the option.
#include <netinet/ip6.h> int inet6_opt_apppend(void *extbuf, size_t extlen, int prevlen, uint8_t type, size_t len, uint_t align, void **databufp ); |
The inet6_opt_append() function, when called with extbuf as a NULL pointer and extlen as 0, returns the updated number of bytes in an extension header.
If you specify extbuf as a valid pointer and valid extlen and align parameters, the function returns the same information as in the previous case, but also inserts the pad option, initializes the type and length fields, and returns a pointer to the location for the option content.
After you call inet6_opt_append() , you can then use the data buffer directly or call inet6_optt_set_val() to specify the option contents.
Upon successful completion, the inet6_opt_append() function returns the updated number of bytes in an extension header.
Upon failure, it returns a -1.
Finds a specific option in an extension header.
#include <netinet/ip6.h> int inet6_opt_find( void *extbuf, size_t extlen, int prevlen, uint8_t type, size_t *lenp, void **databufp ); |
The inet6_opt_find() function searches a received option extension header for an option specified by type. If it finds the specified option, it returns the option length and a pointer to the option data. In addition, it returns an offset to the next option that you specify in the prevlen parameter to subsequent calls to inet6_opt_next() in order to search for additional occurrences of the same option type.
Upon successful completion, the inet6_opt_find() function returns an offset from which you can begin the next search in the data buffer.
Upon failure, it returns a -1.
Returns the total length of an IPv6 extension header, including padding, and initializes the option.
#include <netinet/ip6.h> int inet6_opt_finish( void *extbuf, size_t extlen, int prevlen ); |
The inet6_opt_finish() function when called with extbuf as a NULL pointer and extlen as 0, returns the total number of bytes in an extension header, including final padding.
If you specify extbuf as a valid pointer and a valid extlen parameter, the function returns the same information as in the previous case, increments the buffer pointer, and verifies that the buffer is large enough to hold the header.
Upon successful completion, the inet6_opt_finish() function returns the total number of bytes in an extension header, including padding.
Upon failure, it returns a -1.
Extracts data items from the data portion of an IPv6 option.
#include <netinet/ip6.h> int inet6_opt_get_val( void *databuf, size_t offset, void *val, int vallen ); |
The inet6_opt_get_val() function copies data items from data buffer databuf beginning at offset to the location val . In addition, it returns the offset for the next data field to assist you in extracting option content that has multiple fields.
Make sure that each field is aligned on its natural boundaries.
Upon successful completion, the inet6_opt_get_val() unction returns the offset for the next field in the data buffer.
Upon failure, it returns a -1.
Returns the length of an IPv6 extension header with no options and initializes the header.
#include <netinet/ip6.h> int inet6_opt_innit( void *extbuf, size_t extlen ); |
The socket call used to build and examine IPv6 routing headers are:
Adds an IPv6 address to the routing header under construction.
#include <netinet/ip6.h> int inet6_rth_add( void *bp, const struct in6_addr *addr ); |
The inet6_rth_add() function adds IPv6 address to the end of the routing header under construction. The address pointed to by addr cannot be either an IPv6 V4-mapped address or an IPv6 multicast address.
The function increments the ip60r_segleft member in the ip6_rthdr0 structure . The ip6_rthdr0 structure is defined in netinet/ip6.h .
Only routing header type 0 is supported.
Upon successful completion, the inet6_rth_add() function returns 0 (zero).
Upon failure, it returns a -1.
Retrieves an address for an index from an IPv6 routing header.
#include <netinet/ip6.h> struct in6_addr *inet6_rth_getaddr( const void *bp,int index ); |
The inet6_rth_getaddr() function uses a specified index value and retrieves a pointer to an address in a Routing header specified by bp . Call inet6_rth_segments() before calling this function in order to determine the number of segments (addresses) in the routing header.
Upon successful completion, the inet6_rth_getaddr() function returns a pointer to an address.
Upon failure, it returns a NULL pointer.
Initializes an IPv6 routing header buffer.
#include <netinet/ip6.h> void inet6_rth_init( void *bp, int bp_len, int type, int segments ); |
The inet6_rth_init() function initializes a buffer and buffer data for an IPv6 routing header. The function sets the ip60r_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 in the segments parameter. (See RFC 2460 for a description of the actual value.) The ip6_rthdr0 structure is defined in netinet/ip6.h .
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.
Upon successful completion, the inet6_rth_init() function returns a pointer to the buffer that is to contain the routing header.
If the type is not supported, the bp is a null, or the number of bp_len is invalid, the function returns a NULL pointer.
Reverses the order of addresses in an IPv6 routing header.
#include <netinet/ip6.h> int inet6_rth_reverse( const void *in, void *out ); |
The inet6_rth_reverse() function reads an IPv6 routing header and writes a new routing header, reversing the order of addresses in the new header. The in and out parameters can point to the same buffer.
The function sets the ip60r_segleft member in the ip6_rthdr0 structure to the number of segments (addresses) in the new header.
The ip6_rthdr0 structure is defined in netinet/ip6.h .
Upon successful completion, the inet6_rth_reverse() function returns 0.
Upon failure, it returns a -1.
Returns the number of segments (addresses) in an IPv6 routing header.
#include <netinet/ip6.h> int inet6_rth_segments( const void *bp ); |
The inet6_rth_segments() function returns the number of segments (or addresses) in an IPv6 routing header.
Upon successful completion, the inet6_rth_segments() function returns the number of segments, 0 (zero) or greater than 0.
Upon failure, it returns a -1.
Returns the number of bytes required for an IPv6 routing header.
#include <netinet/ip6.h> size_t inet6_rth_space( int type, int segments ); |
The inet6_rth_space() function determines the amount of space, in bytes, required for a routing header. Although the function returns the amount of space required, it does not allocate buffer space. This enables the application to allocate a larger buffer.
If the application uses ancillary data, it must pass the returned length to CMSG_LEN() to determine the amount of memory required for the ancillary data object, including the cmsghdr structure.
If an appli
|