next up previous contents index
Next: Message Library Up: Uniform Protocol Interface Previous: Usage Rules

Default Operations

 

Since many protocols' UPI operations look very similar, the x-kernel provides some library operations that do much of the standard work of some of the operations. Many protocols can call these default operations, or at the very least, these default routines can serve as a template for writing the corresponding protocol-specific routine.

defaultOpenEnable

 

Binds key to an Enable object with hlp and hlpType. If a previous binding exists for the given key and protocols, the reference count of that Enable object will be increased. defaultOpenEnable will fail if a previous binding exists for this key that does not match the protocols.

XkReturn defaultOpenEnable(Map map, Protl hlp, Protl hlpType, void *key)

defaultOpenDisable

 

Undoes the effect of a previous defaultOpenEnable. Returns failure if no appropriate Enable object exists (e.g., if nothing exists for the given key or if the protocols don't match the saved values in the Enable object).

XkReturn defaultOpenDisable(Map map, Protl hlp, Protl hlpType, void *key)

defaultOpenDisableAll

 

Removes all Enable objects bound in map with protocol hlp. If func is non-zero, it is called with the (key, Enable *) pair for each Enable object in the map before it is removed.

XkReturn defaultOpenDisableAll(Map map, Protl hlp, DisableAllFunc func)

typedef void (*DisableAllFunc)(void *key, Enable *e)

defaultVirtualOpenEnable

 

Designed to be used by virtual protocols. In addition to the binding performed by defaultOpenEnable, an xOpenEnable is performed on each lower protocol in the null-terminated array llp (using participants), causing the lower protocols to deliver packets for hlpType to the virtual protocol self. If any of these xOpenEnables fail, defaultVirtualOpenEnable backs out of the entire operation. Assumes that the passive map is keyed on hlpType.

 
XkReturn defaultVirtualOpenEnable(Protl self, Map map, Protl hlp,
Protl hlpType, Protl *llp,

Part *participants)

defaultVirtualOpenDisable

 

Undoes the effect of a previous defaultVirtualOpenEnable.

 
XkReturn defaultVirtualOpenDisable(Protl self, Map map, Protl hlp,
Protl hlpType, Protl *llp,

Part *participants)

Usage

 

Figure 1 illustrates an example of how a protocol might simplify its enable/disable routines using these operations.

 
Figure 1: Using default routines  



next up previous contents index
Next: Message Library Up: Uniform Protocol Interface Previous: Usage Rules



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