The header contains the identifier, two version fields, a flag field, a type field and a length field. openUTM expects the protocol described on the input side. This has the following structure:
Identifier | Major | Minor | Flags 1 byte | MsgType 1 byte | MsgSize 4 bytes | Data Max. 31988 bytes |
| | | | | | | | | | | |
Explanation
Identifier
The identification field must always the contain the ASCII string "UTMS" (=0x55544D53) for openUTM.
Major version
The major version field must always contain the value 0x01.
Minor version
The minor version field must always contain the value 0x01.
Flags
The flag field is an information field. Only bit 0x02 is evaluated: if it is set, the message is followed by another fragment. If it is not set, it is not followed by a fragment. All the other bits are reserved for future versions.
MsgType
The type field can contain the values 0x00, 0x01 or 0x07:
Receive messages from the client:
In the case of unfragmented messages, the client sets the value 0x00 forMsgType
. In the case of fragmented messages, the client sets the value 0x00 forMsgTyp
when the first fragment is received (bit 0x02 is set in the flag field). For the fragments that follow, the value 0x07 is set forMsgType
(bit 0x02 remains set). Bit 0x02 is not set for the last of these fragments.Send messages to the client:
In the case a USP header is created (e.g. with USP-HDR=ALL), openUTM sets the value 0x01 forMsgType
when the first fragment is sent and the value 0x07 for fragments that follow.
MsgSize
The length field MsgSize
contains the length of the message or message segment, including the header. This length must not exceed 32000 bytes on the input side and 32767 bytes on the output side. The message length is transferred in network byte order (big endian). The C functions htonl
(host to network long) and ntohl
(network to host long) can be used to carry out conversions between the local view and the network view.
Examples
The client sends messages to openUTM, see the sample source file SOCBSP.C shipped with the product:
The client sends one message (without fragmentation)
The client sends two message segments
The client sends three message segments
Number of
message
segmentsIdentifier
Major
versionMinor
versionFlag
MsgType
Size
1 whole message
55544D53
01
01
00
00
0000nnnn
2 segments
segment 1
55544D53
01
01
02
00
0000nnnn
segment 2
55544D53
01
01
00
07
0000mmmm
3 segments
segment 1
55544D53
01
01
02
00
0000kkkk
segment 2
55544D53
01
01
02
07
0000nnnn
segment 3
55544D53
01
01
00
07
0000mmmm
The server sends messages to the client (USP header is created):
one whole message (without fragmentation)
three message segments
Number of
message
segmentsIdentifier
Major
versionMinor
versionFlag
MsgType
Size
1 whole message
55544D53
01
01
00
01
0000nnnn
3 segments
segment 1
55544D53
01
01
02
01
0000kkkk
segment 2
55544D53
01
01
02
07
0000nnnn
segment 3
55544D53
01
01
00
07
0000mmmm
kkkk, nnnn, mmmm are the lengths of the different message segments.