Comtrol eCos User Manual

Page 543

Advertising
background image

Chapter 38. TCP/IP Library Reference

Upon success the return value is the pointer to the cmsghdr structure,

and this is then used as the first argument to the next two functions.

Upon an error the return value is NULL.

inet6_rthdr_add

This function adds the address pointed to by addr to the end of the Rout-

ing header being constructed and sets the type of this hop to the value

of flags.

For an IPv6 Type 0 Routing header, flags must be either

IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.

If successful, the cmsg_len member of the cmsghdr structure is updated to

account for the new address in the Routing header and the return value of

the function is 0.

Upon an error the return value of the function is -1.

inet6_rthdr_lasthop

This function specifies the Strict/Loose flag for the final hop of a

Routing header.

For an IPv6 Type 0 Routing header, flags must be either

IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.

The return value of the function is 0 upon success, or -1 upon an error.

Notice that a Routing header specifying N intermediate nodes requires N+1

Strict/Loose flags.

This requires N calls to inet6_rthdr_add() followed

by one call to inet6_rthdr_lasthop().

inet6_rthdr_reverse

This function takes a Routing header that was received as ancillary data

(pointed to by the first argument, in) and writes a new Routing header

that sends datagrams along the reverse of that route.

Both arguments are

allowed to point to the same buffer (that is, the reversal can occur in

place).

The return value of the function is 0 on success, or -1 upon an error.

inet6_rthdr_segments

This function returns the number of segments (addresses) contained in the

Routing header described by cmsg.

On success the return value is between

1 and 23, inclusive.

The return value of the function is -1 upon an

error.

inet6_rthdr_getaddr

This function returns a pointer to the IPv6 address specified by index

(which must have a value between 1 and the value returned by

inet6_rthdr_segments()) in the Routing header described by cmsg.

An

application should first call inet6_rthdr_segments() to obtain the number

of segments in the Routing header.

Upon an error the return value of the function is NULL.

inet6_rthdr_getflags

This function returns the flags value specified by index (which must have

a value between 0 and the value returned by inet6_rthdr_segments()) in

the Routing header described by cmsg.

For an IPv6 Type 0 Routing header

the return value will be either IPV6_RTHDR_LOOSE or IPV6_RTHDR_STRICT.

439

Advertising