Infrasctucture Mo Function Reference
Mo
The Message Object layer provides a way to transmitt data, as an opaque object, between different program entities.
The next layer up is the Msg layer and combines both Mo and Io.
A Message Object should be considered as a Write Once, Read Many device, almost like a serial device.
Once space is allocated to a field, only minor changes may be done in data fields that use the same space (same field data size).
There are moChgI and moChgS functions that replace existing field data with different content.
Note: mo STRING FIELD LENGTHS always include the NULL at the end of the string, in other words they are strlen() +1.
The function prefix for this layer is "mo".
A message object field has a name and value.
The internal representation is determined when the field is inserted into the mo and is either integer, string, or binary.
A field stored as a string may be retrieved as an integer and vice versa.
There are some limitations on the retrieval of binary fields.
The first record in an mo is always record number one.
| | |
|
int
|
moCatS( char* mp, char* fldNam, char* fmt, ... elipsis )
|
Concatenate to the field named "fldNam" in mo "mp" the formatted string specified by fmt and args.
| | |
|
int
|
moChgI( char* msg, char* fldNam, int* data )
|
Change the content of field "fldName" in mo "mp" to value "value".
| | |
|
int
|
moChgS( char* msg, char* fldNam, char* data )
|
Change the content of field "fldName" in mo "mp" to value "value". Not that the original strng field must have been created to some application standard length and that the new string, including NULL terminator, must not exceed this length. Returns OK, ERR (string too long?), or NOTFND (field name doesn't exist).
| | |
|
char*
|
moCreate( int size )
|
Create a message object of size "size" and return it's pointer. This allocates space and resets the headers inside. Note this is NOT for use in IO, you must do and ioMakMsg then an moRst().
| | |
|
int
|
moCpy( char* dest, char* src )
|
Copy the message object pointed to by "src" to the ascii buffer pointed to by "dest".
| | |
|
int
|
moCurDat( char* mp, void* data )
|
Copy the data of the current field into the space pointed to by "dat". This can be INT, STR, or BIN, but YOU must be sure what type using somnething like moNxtFld().
Free a message object created by moCreate().
| | |
|
int
|
moGetB( char* msg, char* fldNam, void* data, int dataLen )
|
Copy binary data from the field named "fldNam" into variable "var" (buffer of varLen).
| | |
|
int
|
moGetI( char* msg, char* fldNam, int* data )
|
Copy the contents of field "fldName" in mo "msg" into the buffer at "var".
| | |
|
int
|
moGetI16( char* msg, char* fldNam, short* data )
|
Copy the contents of field "fldName" in mo "msg" into the buffer at "var".
| | |
|
int
|
moGetS( char* msg, char* fldNam, char* data )
|
Copy the contents of field "fldName" in mo "msg" into the buffer at "var".
| | |
|
int
|
moGetFldInfo( char* mp, char* name, int* fLen )
|
The name of the current field is copied into the buffer pointed to by "name" and the data length is copied into the integer "fLen". Returns the field type (MO_INT, MO_STR, MO_BIN).
| | |
|
int
|
moGetDupFld( char* msg, char* fldNam, int* type, void* data )
|
Find the next field named "fldName" in MO "msg" of type "type" and copy it's data into the buffer pointed to by "data". Returns the field length. This must be used when field names are duplicated in the same record.
| | |
|
int
|
moGetNxtFld( char* msg, char* fldNam, void* data, int* dataLen )
|
Move the the next field in the MO "msg", then copy it's name to the buffer pointed to by "fldName", the data is copied to buffer "data", and length is placed in *enP". Returns field type.
| | |
|
int
|
moGetRcnt( char* mp )
|
Return the record count of the Mo pointed to by "mp".
Return the current total byte count of the MO pointed to by "mp".
Return the maximum allowable space that can be occupied by MO "mp".
Convert the MO internals from host order to network Order.
Convert the MO internals from network order to host order.
| | |
|
int
|
moPnt( char* out, char* mp )
|
Print on field of the MO "mp" to the output buffer. If this is called immediately after a moRew(), moPnt starts at the first field in the first record. Returns OK, ERR, or NOTFND at end.
| | |
|
int
|
moPutI( char* msg, char* fldNam, int* data )
|
Add an integer field ("var") named "fldName" into the MO "msg". Return OK, MO_FULL, else ERR.
| | |
|
int
|
moPutI16( char* msg, char* fldNam, short* data )
|
Add an short integer field ("var") named "fldName" into the MO "msg". Return OK, MO_FULL, else ERR.
| | |
|
int
|
moPutS( char* msg, char* fldNam, char* data )
|
Add an string field ("var") named "fldName" into the MO "msg". Return OK, MO_FULL, else ERR.
| | |
|
int
|
moPutB( char* msg, char* fldNam, int* data, int dataLen )
|
Add an binary field ("var") named "fldName" and of length "len" into the MO "msg". Return OK, MO_FULL, else ERR.
| | |
|
int
|
moPutFmt( char* msg, char* fldNam, char fmt, ... elipsis )
|
Add a string field ("var") named "fldName" into the MO "msg". The data is the result of formatting. Return OK, MO_FULL, else ERR.
| | |
|
int
|
moRcd( char* msg, int rcdNbr )
|
Change current record in the MO. If "rcdNbr" is zero go to the next record, else the record number requested. Return OK or ERR else NOTFND.
Rewind the internal MO conditions to the initial state (rcd: 1, no field selected).
| | |
|
int
|
moRst( char* msg, int len )
|
Reset all internal pointers & flags to initial state ready for writing new fields.
You must supply the maximum message space (can be obtained using moGetMax()).
For reusing a recv'd message as a response.
| | |
|
int
|
moSetFlg( char* msg, int flag )
|
Set MO flags. This is used for message tracing and Data To Follow in multi packet situations.
| | |
|
int
|
moSetFldFlg( char* msg, char* fldNam, int flag )
|
Set MO field flags. This is used by the msg layer to mark BigFields which usually span multiple packets. There are room for 15 additional flags, but none are defined now.
| | |
|
int
|
moTstFlg( char* msg, int flag )
|
Text MO flags. This is used for message tracing and Data To Follow in multi packet situations.
| | |
|
int
|
moTstFldFlg( char* msg, char* fldNam, int flag )
|
Test MO field flags. This is used by the msg layer to mark BigFields which usually span multiple packets. Returns TRUE if flag was set, else FALSE.