Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking With Open Transport / Part 2 - Open Transport Reference
Chapter 29 - TCP/IP Services Reference / Options


IP Options

You can use the options in this section with a protocol level of INET_IP. The IP_OPTIONS and IP_TOS options are association-related; the other IP options are not. The IP_REUSEADDR option may be negotiated in all endpoint states except T_UNINIT. The other options may be negotiated in all endpoint states except T_UNBND and T_UNINIT. They are read-only in state T_UNBND. A request for any of these options is an absolute requirement.

#define IP_OPTIONS         0x01  
#define IP_TOS             0x02  
#define IP_TTL             0x03  
#define IP_REUSEADDR       0x04  
#define IP_DONTROUTE       0x10  
#define IP_BROADCAST       0x20  
#define IP_HDRINCL         0x1002
#define IP_RCVOPTS         0x1005
#define IP_RCVDSTADDR      0x1007
#define IP_MULTICAST_IF    0x1010 
#define IP_MULTICAST_TTL   0x1011 
#define IP_MULTICAST_LOOP  0x1012 
#define IP_ADD_MEMBERSHIP  0x1013 
#define IP_DROP_MEMBERSHIP 0x1014 /
#define IP_BROADCAST_IF    0x1015
#define IP_RCVIFADDR       0x1016
Constants for use with the IP_TOS precedence level are as follows:


enum {
   T_ROUTINE        = 0,
   T_PRIORITY       = 1,
   T_IMMEDIATE      = 2,
   T_FLASH          = 3,
   T_OVERRIDEFLASH  = 4,
   T_CRITIC_ECP     = 5,
   T_INETCONTROL    = 6,
   T_NETCONTROL     = 7
};
Constants for use with the IP_TOS type of service are as follows:

/* IP_TOS type of service */
enum {
   T_NOTOS        = 0x0,
   T_LDELAY       = (1<<4),
   T_HITHRPT      = (1<<3),
   T_HIREL        = (1<<2)
};
Option descriptions

IP_OPTIONS
Set the value of the Options field in the header of each outgoing IP datagram, or receive the Options field of each incoming IP datagram. (UInt8[])

This option is intended for use by network debugging and control programs; most applications do not need this option.

The value for this option consists of a string of bytes whose formats follow the definitions of IP options in the current RFCs with one exception: If you specify a source routing option, the first address in the list of routers (as returned by OTInetGetInterfaceInfo) must be for the first-hop router. Open Transport extracts the first-hop router address from the option list and adjusts the size of the list before transmitting the packet. The Options field can contain up to 40 bytes.

To disable this option, specify an option header only with no option values. This option is enabled by default any time you use an Open Transport option-management function or a configuration string to set an IP option that must be negotiated.

If you enable IP_OPTIONS, the function OTOptionManagement with the T_CURRENT action flag set returns the list of IP options that are currently being sent with outgoing IP datagrams.

The functions OTConnect (in synchronous mode only), OTListen, OTRcvConnect, and OTRcvUData return this option for the received IP datagram. The OTRcvUDErr function returns this option for the previously sent datagram that caused the error.

IP_TOS
Set the Type of Service field of each outgoing IP datagram, or receive the Type of Service field of each incoming IP datagram. (UInt8)

Open Transport hosts and routers ignore the Type of Service field, but you can set this value for use with other networks if you so desire. The data for this option is any combination of a Precedence flag and a Type of Service flag. Use the SET_TOS macro to construct this option. The possible values for these flags are shown at the beginning of this section.

If you enable IP_TOS, the function OTOptionManagement with the T_CURRENT action flag set returns the Type of Service flags that are currently being sent with outgoing IP datagrams.

The functions OTConnect (in synchronous mode only), OTListen, OTRcvConnect, and OTRcvUData return this option for the received IP datagram. The function OTRcvUDErr returns the Type of Service field of the previously sent datagram that caused the error.

IP_TTL
Set the Time to Live field of each outgoing IP datagram. Specify the number of hops as an unsigned char. (UInt8)

Each router that processes the datagram decrements the Time to Live field and discards the datagram if the value reaches 0. The default value for this field is 255. Because this is not an association-related option, there is no way to get the Time to Live field of an incoming datagram.

IP_REUSEADDR
Allow multiple addresses with the same port number. (UInt32)

Set this option to T_YES to allow TCP to bind a transport endpoint to a kOTAnyFreeAddress that includes a port number plus bind one or more additional endpoints to distinct fully specified internet addresses that include the same port number. If this option is set to T_NO (the default), TCP cannot bind two or more transport endpoints to addresses that include the same port number.

IP_DONTROUTE
Use addresses on connected subnets only. (UInt32)

Set this option to T_YES to cause outgoing messages to be delivered to the local network only and not to go through any routers. (This options sets the time-to-live value to 1.) This option is intended for testing and development purposes. Specify T_NO to disable this option. This option is disabled by default.

IP_BROADCAST
Request permission to send broadcast datagrams. (UInt32)

Set this option to T_YES to request permission to send broadcast datagrams. Specify T_NO to disable this option. This option is disabled by default.

IP_HDRINCL
Include the IP header with received data. (UInt32)

Set this option to T_YES to cause RawIP to include the IP header when you read data. Set the option to T_NO (the default) to receive only the data without the header. This option works with the RawIP interface only. See "Using RawIP" for more information.

IP_RCVOPTS
Include IP-level options when you call the OTRcvUData function. (UInt32)

If you set this option to T_YES (the default), the OTRcvUData function returns IP-level options along with the UDP options when you are receiving UDP data. If you set this option to T_NO, you receive only UDP options.

IP_RCVDSTADDR
For multihomed systems, include with received data the address of the interface on which a message was received. (UInt32)

If you specify T_YES for this option, the OTRcvUData function includes the address of the interface. If you specify T_NO (the default) for this option, you receive only the data.

IP_MULTICAST_IF
Specify the TCP/IP interface to use for outgoing multicast IP datagrams, or retrieve the interface this option is set to. (UInt32)

Specify the interface as an "InetHost". This option and the other multicast options can be used with UDP and RawIP only. In the case that a host is multihomed, this option lets you specify which network interface to use for multicasts. Whereas only one network interface can be used at a time for multicast transmissions, an application can join the same multicast group address on more than one network interface. If you joined the same multicast address on more than one network, this option lets you determine over which network the datagram arrived.

IP_MULTICAST_TTL
Set the Time to Live field or the number of hops permitted for outgoing multicast IP datagrams, or retrieve the Time to Live field set for an interface. (UInt8)

Each router that processes the datagram decrements the Time to Live field and discards the datagram if the value reaches 0. Specify the time to live as an unsigned char. To avoid unneccessary network traffic, you should set this value as low as possible. The default value is 1.

IP_MULTICAST_LOOP
Enable loopbacks for outgoing multicast IP datagrams. (UInt32)

Set this option to T_YES to cause an outgoing multicast datagram to be delivered to yourself; set this option to T_NO to disable loopbacks. Loopbacks are enabled by default.

IP_ADD_MEMBERSHIP
Add a membership in an IP multicast group. (SizeOf(TIPAddMulticast)).

You use a TIPAddMulticast structure to specify the address and network interface of the group you wish to join. The TIPAddMulticast structure is described in "IP Multicast Address Structure".

IP_DROP_MEMBERSHIP
Drop membership in an IP multicast group.

(SizeOf(TIPAddMulticast)).
You use a TIPAddMulticast structure to specify the address and network interface of the group you wish to leave.

IP_BROADCAST_IF
Reserved.

IP_RCVIFADDR
Reserved.

The following IP-level options are reserved for use by Apple Computer, Inc.

#define  DVMRP_INIT     0x64
#define  DVMRP_DONE     0x65
#define  DVMRP_ADD_VIF  0x66
#define  DVMRP_DEL_VIF  0x67
#define  DVMRP_ADD_LGRP 0x68
#define  DVMRP_DEL_LGRP 0x69
#define  DVMRP_ADD_MRT  0x6A
#define  DVMRP_DEL_MRT  0x6B 

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998