next up previous contents
Next: Byte String (BS_): Up: OPEN C PLATFORM Previous: Execution Scheduler (SCH_)   Contents

Byte Ordering (BO_)

    #include "bo.h"

    Void BO_put1(netPtr, cpuValue)	
    Octet *netPtr;		/* OUT */
    Byte cpuValue;		
    
    Void BO_get1(cpuValue, netPtr)	/* MACRO */
    Octet *netPtr;
    Byte cpuValue;		/* OUT, VALUE EFFECTED */	

    BO_put2(netPtr, cpuValue)	
    Octet *netPtr;		/* OUT */
    MdUns cpuValue;	
    
    BO_get2(cpuValue, netPtr)	/* MACRO */
    Octet *netPtr;	
    MdUns cpuValue;		/* OUT, VALUE EFFECTED */

    BO_put4(netPtr, cpuValue)	
    Octet *netPtr;		/* OUT */
    LgUns cpuValue;	

    BO_get4(cpuValue, netPtr)	/* MACRO */
    Octet *netPtr;	
    LgUns cpuValue;		/* OUT, VALUE EFFECTED */

    BO_putN(netPtr, cpuPtr, n)
    Octet *netPtr;		/* OUT */
    Byte *cpuPtr;		
    Int n;		

    BO_getN(cpuValue, netPtr, n)
    Octet *netPtr;	
    Byte *cpuPtr;		/* OUT */
    Int n;

BO_ facilities provide primitive abstract data presentation facilities for simple types of values.

BO_ facilities convert CPU presentation of values to a machine independent byte ordering and vice versa. 8 bit values, 16 bit values, 32 bit values, and octet string types are converted to an abstract presentation commonly used by the lower layer protocols. This abstract presentation is expressed through a sequence of octets. Octets at the lower address always contain the most significant byte of the value. Least Significant Byte of the value is always at the higher address.

netPtr points to where the machine independent presentation value should be stored. Upon completion of all BO_ facilities netPtr is incremented by the appropriate value so that it can be used in subsequent BO_ operations. cpuValue is the machine dependent presentation of a value.

Get and Put verbs in BO_get/BO_put are with respect to the abstract presentation (the network). BO_get always converts the abstract presentation of contents of netPtr into a machine dependent value (cpuValue). Note that since cpuValue is an out put value and is not passed as a pointer BO_get facility must be implemented as a MACRO. BO_put always converts the machine dependent presentation of a value into an abstract presentation. netPtr is always incremented.


next up previous contents
Next: Byte String (BS_): Up: OPEN C PLATFORM Previous: Execution Scheduler (SCH_)   Contents