next up previous contents
Next: Operations on Session Up: Protocols and Sessions Previous: Configuring a Protocol

Operations on Protocol Objects

 

The primary operation exported by a protocol object allows a higher level entity to open a channel to its peer. The return value from an open operation is a session object. Details about the session object are discussed in the following subsection. For now, think of a session as a convenient object for gaining access to the channel; the module that opened the session object can send and receive messages using the session object. An object that lets us gain access to something abstract is sometimes called a handle---you can think of it as the thing that makes it easy to grab something that is otherwise quite slippery. Thus, a session object provides a handle on a channel.

In the following discussion, we need a generic way to refer to the entity that opens a channel, since sometimes it is an application program, and sometimes its another protocol. We use the term participant for this purpose. That is, we think in terms of a pair of participants at level i communicating over a channel implemented by a protocol at level i-1 (where the level number decreases as you move down the stack).

Opening a channel is an asymmetric activity. Generally, one participant initiates the channel (we call it the client). This local participant is therefore able to identify the remote participant, and is said to do an active open. In contrast, the other participant accepts the channel (we call it the server). This participant does not know what clients might try to talk to it until one of them actually makes contact. The server, therefore, does a passive open---it says to the lower level protocol that it is willing to accept a channel, but does not say with whom the channel will be.

Thus, the exact form of the open operation depends on whether the higher level entity is doing an active open or a passive open. In the case of an active open, the operation is:

Sessn xOpen(Protl hlp, Protl hlpType, Protl llp, Part *participants)

This operation says that high-level protocol hlp is opening low-level protocol llp so as to establish a channel with the specified participants. For a typical channel between a pair of participants, this last argument would contain both the local participant's address and the remote participant's address. The low-level protocol does whatever is necessary to establish the channel, which quite often implies opening a channel on a still lower-level protocol. Notice that Protl and Sessn are the C type definitions for protocol and session objects, respectively.

The hlpType argument to xOpen is a bit subtle. What is really happening is that hlp is opening a session associated with llp on behalf of high-level protocol hlpType. Typically, hlp and hlpType refer to the same protocol, although as we will see in Section 9.5, there are some cases in which hlp and hlpType are not equivalent.

A high-level protocol passively opens a low-level protocol with a pair of operations:

XkReturn xOpenEnable(Protl hlp, Protl hlpType, Protl llp, Part *participant)

XkReturn xOpenDone(Protl hlp, Protl llp, Sessn session, Part *participants)

xOpenEnable is used by high-level protocol hlp to inform low-level protocol llp that it is willing to accept a connection. (Argument hlpType has the same meaning as in xOpen.) In this case, the high-level protocol usually specifies only a single participant---itself. The xOpenEnable operation returns immediately; it does not block waiting for a remote site to try to connect to it. The low-level protocol remembers this enabling; when some remote participant subsequently connects to the low-level protocol, llp calls the high-level protocol's xOpenDone operation to inform it of this event. The low-level protocol llp passes the newly created session as an argument to high-level protocol hlp, along with the complete set of participants, thereby informing the high-level protocol of the address for the remote entity that just connected to it. XkReturn is the return value of all the uniform protocol interface operations presented here except for xOpen and xPush; it indicates whether the operation was successful ( XK_SUCCESS) or not ( XK_FAILURE).

In addition to these operations for opening a connection, x-kernel protocol objects also support an operation for demultiplexing incoming messages to the appropriate channel (session). In this case, a low-level session invokes this operation on the high-level protocol that at some earlier time had opened it. The operation is:

XkReturn xDemux(Protl hlp, Sessn lls, Msg *message)

It will be easier to understand how this operation is used after we look at session objects in more detail.



next up previous contents
Next: Operations on Session Up: Protocols and Sessions Previous: Configuring a Protocol



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