[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP TCP/IP Services for OpenVMS
Sockets API and System Services Programming


Previous Contents Index


inet6_opt_find()

Finds a specific option in an extension header.


Format

#include <in6.h>

int inet6_opt_find ( void *extbuf, size_t extlen, int offset, uint8_t type, size_t *lenp, void **databufp );


Arguments

extbuf

Points to a buffer that contains an extension header.

extlen

Specifies the length, in bytes, of the extension header.

offset

Specifies the location in the extension header of an option. Valid values are either 0 (zero) for the first option or the length returned from a previous call to either inet6_opt_next() or inet6_opt_find() .

type

Specifies the type of option to find.

lenp

Points to the length of the option found.

databufp

Points to the option data.

Description

This 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. It also returns an offset to the next option, which you can specify in the offset argument to subsequent calls to inet6_opt_next() in order to search for additional occurrences of the same option type.

Return Values

x Upon successful completion, the inet6_opt_find() function returns an offset from which you can begin the next search in the data buffer.
-1 Failure

inet6_opt_finish()

Returns the total length of an IPv6 extension header, including padding, and initializes the option.


Format

#include <in6.h>

int inet6_opt_finish ( void *extbuf, size_t extlen, int offset );


Arguments

extbuf

Points to a buffer that contains an extension header. This is either a valid pointer or a NULL pointer.

extlen

Specifies the length of the extension header to finish initializing. A valid value is any number greater than or equal to 0.

offset

Specifies the length of the existing extension header. Obtain this value from a prior call to inet6_opt_init() or inet6_opt_append() .

Description

This 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 argument, 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.


Return Values

x Upon successful completion, the inet6_opt_finish() function returns the total number of bytes in an extension header, including padding.
-1 Failure

inet6_opt_get_val()

Extracts data items from the data portion of an IPv6 option.


Format

#include <in6.h>

int inet6_opt_get_val ( void *databuf, size_t offset, void *val, int vallen );


Arguments

databuf

Points to a buffer that contains an extension header. This is a pointer returned by a call to inet6_opt_find() or inet6_opt_next() .

offset

Specifies the location in the data portion of the option from which to extract the data. You can access the first byte after the option type and length by specifying the offset of 0.

val

Points to a destination for the extracted data.

vallen

Specifies the length of the data, in bytes, to be extracted.


Description

This 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.


Return Values

x Upon successful completion, the inet6_opt_get_val() function returns the offset for the next field in the data buffer.
-1 Failure

inet6_opt_init()

Returns the length of an IPv6 extension header with no options and initializes the header.


Format

#include <in6.h>

int inet6_opt_init ( void *extbuf, size_t extlen );


Arguments

extbuf

Points to a buffer that contains an extension header. This is either a valid pointer or a NULL pointer.

extlen

Specifies the length of the extension header to initialize. Valid values are 0 and any number that is a multiple of 8.

Description

This function, when called with extbuf as a NULL pointer and extlen as 0, returns the number of bytes in an extension header that has no options.

If you specify extbuf as a valid pointer and extlen as a number that is a multiple of 8, the function returns the same information as in the previous case, initializes the extension header, and sets the length field.


Return Values

x Upon successful completion, the inet6_opt_init() function returns the number of bytes in an extension header with no options.
-1 Failure

inet6_opt_next()

Parses received option extension headers.


Format

#include <in6.h>

int inet6_opt_next ( void *extbuf, size_t extlen, int offset, uint8_t *typep, size_t *lenp, void **databufp );


Arguments

extbuf

Points to a buffer that contains an extension header.

extlen

Specifies the length, in bytes, of the extension header.

offset

Specifies the location in the extension header of an option. Valid values are either 0 for the first option or the length returned from a previous call to either inet6_opt_next() or inet6_opt_find() .

typep

Points to the type of the option found.

lenp

Points to the length of the option found.

databufp

Points to the option data.

Description

This function parses a received option extension header and returns the next option. In addition, it returns an offset to the next option that you specify in the offset parameter to subsequent calls to inet6_opt_next() .

This function does not return any PAD1 or PADN options.


Return Values

x Upon successful completion, the inet6_opt_next() function returns the offset for the next option in the data buffer.
-1 Failure

inet6_opt_set_val()

Adds one component of the option content to the options header.


Format

#include <in6.h>

int inet6_opt_set_val ( void *databuf, size_t offset, void *val int vallen );


Arguments

databuf

Points to a buffer that contains an extension header. This is a pointer returned by a call to inet6_opt_append() .

offset

Specifies the location in the data portion of the option into which to insert the data. You can access the first byte after the option type and length by specifying the offset of 0 (zero).

val

Points to the data to be inserted.

vallen

Specifies the length of the data, in bytes, to be inserted.

Description

This function copies data items at the location val into a data buffer databuf beginning at offset. In addition, it returns the offset for the next data field to assist you in composing content that has multiple fields.

Make sure that each field is aligned on its natural boundaries.


Return Values

x Upon successful completion, the inet6_opt_set_val() function returns the offset for the next field in the data buffer.
-1 Failure

inet6_rth_add()

Adds an IPv6 address to the routing header under construction.


Format

#include <in6.h>

int inet6_rth_add ( void *bp, const struct in6_addr *addr );


Arguments

bp

Points to a buffer that is to contain an IPv6 routing header.

addr

Points to an IPv6 address to add to the routing header.

Description

This function adds an IPv6 address to the end of the routing header under construction. The address pointed to by addr cannot be an IPv6 V4-mapped address or an IPv6 multicast address.

The function increments the ip6r0_segleft member in the ip6_rthdr0 structure . The ip6_rthdr0 structure is defined in the IP6.H header file.

Only routing header type 0 is supported.


Return Values

x Upon successful completion, the inet6_rth_add() function returns 0 (zero).
-1 Failure

inet6_rth_getaddr()

Retrieves an address for an index from an IPv6 routing header.


Format

#include <in6.h>

struct in6_addr *inet6_rth_getaddr ( const void *bp, int index );


Arguments

bp

Points to a buffer that contains an IPv6 routing header.

index

Specifies a value that identifies a position in a routing header for a specific address. Valid values range from 0 to the return value from inet6_rth_segments() minus 1.

Description

This 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.

Return Values

x Upon successful completion, the inet6_rth_getaddr() function returns a pointer to an address.
NULL pointer Failure

inet6_rth_init()

Initializes an IPv6 routing header buffer.


Format

#include <in6.h>

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


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.

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.


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.

inet6_rth_reverse()

Reverses the order of addresses in an IPv6 routing header.


Format

#include <in6.h>

int inet6_rth_reverse ( const void *in, void *out );


Arguments

in

Points to a buffer that contains an IPv6 routing header.

out

Points to a buffer that is to contain the routing header with the reversed addresses. This parameter can point to the same buffer specified by the in parameter.

Description

This 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 ip6r0_segleft member in the ip6_rthdr0 structure to the number of segments (addresses) in the new header.

The ip6_rthdr0 structure is defined in the IP6.H header file.


Return Values

0 (zero) Success
-1 Failure

inet6_rth_segments()

Returns the number of segments (addresses) in an IPv6 routing header.


Format

#include <in6.h>

int inet6_rth_segments ( const void *bp );


Arguments

bp

Points to a buffer that contains an IPv6 routing header.

Description

This function returns the number of segments (or addresses) in an IPv6 routing header.

Return Values

x Upon successful completion, the inet6_rth_segments() function returns the number of segments, 0 (zero) or greater than 0.
-1 Failure

inet6_rth_space()

Returns the number of bytes required for an IPv6 routing header.


Format

#include <in6.h>

size_t inet6_rth_space ( int type, int segments );


Arguments

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.

Description

This 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.

Note

If an application wants to send other ancillary data objects, it must specify them to sendmsg() as a single msg_control buffer.

Return Values

x Upon successful completion, the inet6_rth_space() function returns the length, in bytes, of the routing header and the specified number of segments.
0 (zero) Failure, if the type is not supported or the number of segments is invalid for the type of routing header.

inet_aton()

Converts an IP address in the standard dotted-decimal format to its numeric binary form, in network byte order. Replaces the inet_addr() function.

Format

#include <inet.h>

int inet_aton ( const char *cp, struct in_addr *in);


Argument

cp

A pointer to a null-terminated character string containing an internet address in the standard internet dotted-decimal format.

in

A pointer to a buffer that is to contain the numeric internet address in network byte order.

Description

This function returns a numeric internet address in network byte order that represents the internet address supplied in standard dotted-decimal format as its argument.

Internet addresses specified with the dotted-decimal format take one of the following forms:


a.b.c.d
a.b.c
a.b
a

When four parts are specified, each is interpreted as a byte of data and assigned, from left to right, to the 4 bytes of an internet address. Note that when an internet address is viewed as a 32-bit integer quantity on an OpenVMS system, the bytes appear in binary as d.c.b.a . That is, OpenVMS bytes are ordered from least significant to most significant.

When only one part is given, the value is stored directly in the network address without any byte rearrangement.

All numbers supplied as parts in a dotted-decimal address can be decimal, octal, or hexadecimal, as specified in the C language. (That is, a leading 0x or 0X implies hexadecimal; a leading 0 implies octal; otherwise, the number is interpreted as decimal.)

Note

The 64-bit return from OpenVMS Alpha and I64 systems has zero-extended bits in the high 32 bits of R0.

Return Value

1 Indicates success.
0 Indicates failure.

inet_lnaof()

Returns the local network address portion of an IP address.

Format

#include <in.h>

#include <inet.h>

int inet_lnaof ( struct in_addr in );


Argument

in

An IP address.

Description

This function returns the local network address portion of a full IP address.

Note

The 64-bit return from OpenVMS Alpha and I64 systems has zero-extended bits in the high 32 bits of R0.

Return Value

x The local network address portion of an IP address, in host byte order.

inet_makeaddr()

Returns an IP address based on a particular local address and a network.

Format

#include <in.h>

#include <inet.h>

struct in_addr inet_makeaddr ( int net, int lna );


Arguments

net

An IP network address in host byte order.

lna

A local network address on network net in host byte order.

Description

This function combines the net and lna arguments into a single IP address.

Note

The 64-bit return from OpenVMS Alpha and I64 systems has zero-extended bits in the high 32 bits of R0.

Return Value

x An IP address in network byte order.


Previous Next Contents Index