next up previous contents index
Next: Usage Rules Up: Participant Library Previous: Participant List Operations

Relative Protocol Numbers

 

Participant lists are used for passing addressing information between protocols. An additional problem is how a high-level protocol identifies itself to a low-level protocol. In most conventional protocols, a low-level protocol uses a relative protocol number to identify the protocols above it; e.g., IP identifies UDP with protocol number 17 and TCP as protocol number 6. However, protocols that have been especially designed to use the x-kernel use an absolute addressing scheme.

The x-kernel reconciles these two approaches by maintaining a table of relative protocol numbers. (See Section 12.3 for the format of this table.) Rather than embed protocol numbers in the protocol source code, protocols learn the protocol numbers of protocols above them by querying this table using the following operation.

ProtId relProtNum(Protl hlp, Protl llp)

This operation returns the protocol number of the high-level protocol relative to the low-level protocol, or -1 if no such binding has been configured in the protocol tables. This number will have to be cast into the appropriate type; e.g., an unsigned short by the ETH protocol and an unsigned char by IP.

Two other operations provide an alternate query interface. The operation

ProtId protTblGetId(char *protocolName)

returns the protocol ID number for the named protocol. This ID number can be used with

ProtId relProtNumById(ProtId hlpId, Protl llp)

which has the same semantics as relProtNum, except that the high-level protocol is identified by its ID number rather than by the Protl object itself. This interface can be useful when you need to determine relative protocol numbers, but do not have the appropriate Protl objects in scope.



Larry Peterson
Tue Jul 1 14:50:34 MST 1997