DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications over TCP/IP using TLI

Transport provider option management

The last area in which TLI leaves things to be defined by a particular transport provider is the area of option management. ``Option management'' refers to the control of the behavior of the transport provider with regard to one or more optional features that might be supported by a given transport provider.

The TCP/IP protocol options, defined in tcp(ADMP) and ip(ADMP), may be manipulated using the TLI options management function, t_optmgmt. For complete documentation on this function, see t_optmgmt(NET).

To specify TCP/IP options, use the opthdr structure to pass required information to the transport provider. This information consists of the option identifier (name), the option's length (len), and the ``level'' at which the option is to be processed.

The opthdr structure's definition may be found in <sys/socket.h>. It is defined as

   struct opthdr {
   	long	level;     /* protocol level affected */
   	long	name;      /* option to retrieve or modify */
   	long	len;       /* length of option value */
   };
The option length must be specified as a multiple of sizeof(long). The OPTLEN macro defined in <sys/socket.h> can be used to perform this calculation easily.

The option value must follow the opthdr structure in the options buffer. The OPTVAL macro can be used to determine this offset. If called with a pointer to an opthdr structure, it will return the memory address following the structure.

Multiple options can be processed simultaneously. In this case, the option buffer will contain n pairs of opthdr structures and option values. The transport provider will process each option in turn. Each option will be processed at its specified level.

Processing multiple options is not recommended, due to the difficulty of handling errors. There is no way to determine which option was in error.

The option level identifies the kernel component that should process the options management request. Generic options are processed at the SOL_SOCKET level. Driver-specific options are processed at the level of the particular driver (for example, IPPROTO_TCP).

Generic identifiers are defined in <sys/socket.h>. Driver-specific identifiers are defined in a driver header file. See the driver manual page for details.


Next topic: Example
Previous topic: Transport addresses

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003