next up previous contents
Next: Adding and Stripping Up: x-kernel Tutorial Previous: Process Models for

Message Library

 

We now turn our attention from how protocols invoke operations on each other, and consider what goes on inside a particular protocol. One of the most common things that a protocol does is manipulate messages. For example, they add headers to, and strip headers from, messages. Another common way in which protocols manipulate messages is to break a single message into multiple fragments, and later to join these multiple fragments back into a single message. This is necessary because most network links allow messages of only a certain size to be transmitted. Thus, a protocol that uses such a link to transmit a large message must first fragment the message on the source node, and then reassemble the fragments back into the original message on the destination node. We will see examples of protocols that fragment and reassemble messages in later sections.

Because manipulating messages is a basic part of all protocols, the x-kernel defines an abstract data type---called message and given by the C type definition Msg---that includes an interface for performing these common operations. This section presents the x-kernel's message abstraction. (See [2] for a detailed description of how the message library is implemented.)

The message abstraction can best be viewed as a byte string of some length. For the purpose of this discussion, we use the term ``message'' to refer to the abstract object and we use the term ``data'' to refer to the actual byte string contained in a message. For example, message m schematically depicted in Figure 6 contains the data ``abcdefg''.

  
Figure 6: Message object containing a byte string.

In effect, the operations on the message object can be viewed as string manipulations. For example, while processing an outgoing message, each of several protocols may add a header to the message (i.e., two strings are concatenated) and fragment the message into two or more packets (i.e., a string is divided into two substrings). Similarly, while processing an incoming message, each of several protocols may strip headers from the message (i.e., a string is removed from the front of another string) and reassemble message fragments (i.e., two strings are concatenated). In addition, each of several protocols may save references to portions of a message for future use, e.g., to retransmit in the event of an error in the network. Thus, any given byte may be attached to several different strings, removed from several different strings, and referenced by several different protocols.





next up previous contents
Next: Adding and Stripping Up: x-kernel Tutorial Previous: Process Models for



Larry Peterson
Wed Feb 21 13:58:06 MST 1996