Back to home page

Enduro/X

 
 

    


0001 Enduro/X Machine Independent network cluster protocol
0002 =====================================================
0003 :doctype: book
0004 
0005 == About manual
0006 
0007 This document describes the network data encoding protocol used for connecting
0008 Enduro/X instances between machines of different architectures. Enduro/X is
0009 operating with the same type of machine architectures and operating systems, then
0010 native format network protocol is recommended to be used, which is sending direct
0011 C structures between the Enduro/X instances.
0012 
0013 How ever in cases when Enduro/X application is run on different type of machines
0014 and cluster link is needed between those instances, machine independent format
0015 shall be used. This format can activated by setting flag "-f" in *tpbridge(8)*
0016 command line arguments for both end points.
0017 
0018 Protocol is constructed as Tag Length Value (TLV) encoded data, where Tag and Length
0019 has fixed length. Data part may be encoded as Binary Coded Decimal (BCD), ASCII
0020 or Binary data.
0021 
0022 Protocol by it self operates in asynchronous fashion and is loosely coupled with
0023 the call semantics (i.e. when the reply is required, etc), it is out of the scope
0024 for protocol it self. How ever this document will present basic work flows for
0025 the messaging sessions.
0026 
0027 Currently over the one server:port end-point only one TCP/IP socket is handled.
0028 Each end-point represents a node in Enduro/X cluster with configured / unique 
0029 within cluster Node ID.
0030 
0031 == Abbreviations
0032 
0033 .Used Abbreviations
0034 [options="header"]
0035 |=========================================================
0036 |Abbreviation |Description
0037 |BCD | Binary Coded Decimal. The way how numbers are encoded. The decimal number
0038 is encoded in hex representation. It is more compact than ASCII, but still
0039 manageable to debug in hex dump.
0040 |TLV | Tag Length value
0041 |=========================================================
0042 
0043 == Physical network connection
0044 
0045 To establish physical network connection with Enduro/X application server, asynchronous
0046 socket shall be used. Each message sent in socket is prefixed with 4 bytes length
0047 indicator. The length bytes does not include length bytes by it self, but it indicates
0048 the number of bytes that are part of the incoming message. After the length indicator
0049 bytes the data bytes follows. Length bytes are order in network order, which is 
0050 big-endian. Thus if message length without length bytes are in decimal is 15888, 
0051 then following frame bytes shall be sent: 0x00, 0x00, 0x10, 0x3e.
0052 
0053 For keep-a-live, zero length messages are supported. Thus Enduro/X bridge periodically
0054 may be configured to emit the zero length messages. If configured so, bridge will
0055 wait corresponding idle messages too. If not received in configured time, the
0056 connection is restarted.
0057 
0058 == General message flow
0059 
0060 1. TCP/IP Connection is being established
0061 
0062 2. Each node sends it's local monotonic clock to other node with *TIMESYNC* message 
0063 (see <<message-timesync>>) and periodically continues to resynchronize.
0064 
0065 3. Each at start and later periodically sends service table updates to other node 
0066 with *REFRESH* messages (see <<message-refresh>>).
0067 
0068 4. Nodes start to send XATMI IPC data with *TPCALL* messages (see <<message-tpcall>>)
0069 or *TPNOTIF* messages (see <<message-tpnotif>>).
0070 
0071 == Message TLV Encoding rules
0072 
0073 Messages are encoded with:
0074 
0075 - Two byte TAG which identifies simple data type or complex data structure. Bytes
0076 are encoded in network order big-endian.
0077 
0078 - 4 byte (unsigned) data length identifier, also encoded in network order of
0079 big-endian. Length specifies number of is used by data.
0080 
0081 - Data block which corresponds to the TAG meaning.
0082 
0083 Data alignment is not used for encoded message. When parsing a protocol, any 
0084 un-recognized tags shall be ignored.
0085 
0086 == General structures data layout
0087 
0088 All the exchanged messages within protocol as is based on the structures principles.
0089 Where we can look on structure like a complex data type. Each structure may
0090 consist of basic data types or complex data types. Which makes messages a
0091 hierarchical tree of the structures. Where leaf structures always consists of
0092 basic data types. This document uses term "block", "complex data typed block", "message blocks" 
0093 and "structures" with the same meaning.
0094 
0095 Basically network messages consists of the message blocks. These message blocks
0096 then are constructed basic data types and complex data type blocks.
0097 
0098 
0099 Typical message layout would be:
0100 
0101 image:ex_netproto_msgexample.png[caption="Figure 1: ", title="tpcall() message layout"]
0102 
0103 == Basic Data type encoding
0104 
0105 This section lists data types used in message protocol and their specifics.
0106 
0107 
0108 [[numbers-anchor]]
0109 === Numbers
0110 
0111 Numbers in messages are encoded as binary coded decimals. Binary coded decimal
0112 means that value is encoded in ASCII representation of hex value. Thus when analyzing
0113 the message dumps in hex format, the encoded values can be clearly seen. For example
0114 if value of unsigned integer 43219 needs to be transmitted over the protocol,
0115 the number will be encoded in 3 bytes as follows: 0x04,0x32,0x19.
0116 
0117 If the number is signed, then last in left-to-right order char encodes the sign. 
0118 "0" is positive or  zero, "1" is negative number. For example having Signed Integer 
0119 type value -717711, it will be encoded as 0x07, 0x17, 0x71, 0x11.
0120 
0121 *Floats* and *doubles* are encoded with fixed implied resolution. For Floats 5 digits
0122 decimal fraction is encoded in BCD value. For Doubles 6 digits are encoded in
0123 trailer. So for example, having Double value 654.999812, would be encoded in
0124 BCD as following bytes:x65, x49, x99, 0x81, 0x20 (note as number
0125 is not negative, it is terminated with 0).
0126 
0127 Enduro/X may run on 32bit (LP32) and 64bit (LP64) platforms. Some data types differ between
0128 these platforms, particularity *long* and *unsigned long* as they corresponds
0129 to platform bits. Internally Enduro/X uses values which in case
0130 of longs does not go over 32bit values, but user application for example may
0131 send in UBF field 64bit long value. In that particular case C function sscanf()
0132 may overflow if maximum 64bit value is sent to 32bit value. End result is value
0133 which was returned by sscanf().
0134 
0135 
0136 === Strings and blobs (Carray)
0137 
0138 Strings and blobs are encoded as generic byte array. String data may not contain
0139 0x00 byte, where carray can. The length is encoded in TLV Length component.
0140 
0141 
0142 [[time-anchor]]
0143 === Enduro/X time field
0144 
0145 Enduro/X internally uses *NTIMER* data type which represents transportation
0146 of number of seconds (20 digits) and number of nanoseconds (20 digits). Thus
0147 Total length of the field is 40 digits, which in BCD is 20 bytes. The "time since"
0148 is relate and exact start time source is specified with the particular field
0149 use.
0150 
0151 
0152 === Legend of all data type presentation
0153 
0154 For numeric types variable length fields length is specified logical digits. 
0155 For signed numeric types this does not include sign digit. Numeric type length 
0156 does not include zero prefix for BCD in case if odd number of digits are present 
0157 in final BCD representation. 
0158 
0159 Field length for strings, blobs (carrays) and sub-structures is specified in
0160 number of bytes.
0161 
0162 .List of basic data types
0163 [options="header"]
0164 |=========================================================
0165 |Type name |Description
0166 |<Type>..X | Field length (range) form 0 to X.
0167 |<Type>X..Y |  Field length (range) from X to Y.
0168 |<Type>X | Fixed field length (range) X.
0169 |SHORT | Signed short field. 16bit value.
0170 |LONG | Signed long field. 32bit or 64bit value. Depending on platform.
0171 In case if range is specified and upper value is greater than *10*, then
0172 for 32bit platforms this is defaulted to *10*.
0173 |CHAR | One byte ASCII char. Shall not contain 0x00 terminator byte. In that
0174 case field TLV length shall be 0.
0175 |FLOAT | Floating point value. See <<numbers-anchor>> for encoding rules.
0176 |DOUBLE | Double precision value. See <<numbers-anchor>> for encoding rules.
0177 |STRING | String value. May contains all ASCII characters, except 0x00 byte.
0178 |CARRAY | This is blob type, may contain any bytes.
0179 |INT | Signed integer type, 32bit type.
0180 |ULONG | Unsigned long. 32 or 64 bit value. . Depending on platform.
0181 In case if range is specified and upper value is greater than *10*, then
0182 for 32bit platforms this is defaulted to *10*.
0183 |UINT | 32bit usinged integer.
0184 |NTIMER | Time field. seconds and nano-seconds. See <<time-anchor>>. Field is
0185 fixed length of 40 digits.
0186 |USHORT | 16bit unsigned value.
0187 |=========================================================
0188 
0189 
0190 === Legend of constants
0191 
0192 This section lists any constants used in the document.
0193 
0194 .List of basic data types
0195 [options="header"]
0196 |=========================================================
0197 |Const name |Description
0198 |PMSGMAX | This is constant number and represents maximum message length. For
0199 Enduro/X it is configured in *NDRX_MSGSIZEMAX* env variable.
0200 |=========================================================
0201 
0202 == Complex data type blocks
0203 
0204 This section list complex data type blocks which are later incorporated in the
0205 message blocks.
0206 
0207 === Network call block
0208 
0209 [[block-netcall]]
0210 *Type code: NETCALL*
0211 
0212 All messages sent via protocol starts with this block.
0213 
0214 .Network call block
0215 [options="header"]
0216 |=========================================================
0217 |TLV TAG | Name | Format | Cond | Default value | Description
0218 |0x1005 |br_magic |LONG10 |Mand |N/A |Network protocol identifier constant. Hex
0219 value is *0x6A12CC51L* which corresponds to decimal value *1779616849* actually
0220 present in message (encoded in BCD)
0221 |0x100F |msg_type |CHAR |MAND |N/A |Network message type. Following values
0222 are supported:
0223 
0224 
0225 *N* - XATMI Notification message (i.e. call of *tpnotify(3)* or *tpbroadcast(3)*.
0226 
0227 *A* - Any other XATMI message (e.g. *tpcall(3)* or reply from *tpreturn(3)*, etc.).
0228 
0229 *X* - Administrative message from *ndrxd(8)* or other parts. (i.e. clock sync, 
0230 service table update).
0231 
0232 
0233 |0x1019 |command_id |INT1..5 |Mand |N/A |Command code within the message type.
0234 
0235 Commands of 'msg_type' = *A*:
0236 
0237 *1* - tpcall/tpacall message. Message type code *TPCALL*, see <<message-tpcall>>
0238 
0239 *2* - tpreturn message. Message type code *TPCALL*, see <<message-tpcall>>
0240 
0241 *3* - tpforward message. Message type code *TPCALL*, see <<message-tpcall>>
0242 
0243 *4* - tpconnect message. Message type code *TPCALL*, see <<message-tpcall>>
0244 
0245 *5* - conversational data. Message type code *TPCALL*, see <<message-tpcall>>
0246 
0247 *6* - tpconnect accept reply message from server. Message type code *TPCALL*, see <<message-tpcall>>
0248 
0249 *7* - tpdiscon message. Message type code *TPCALL*, see <<message-tpcall>>
0250 
0251 Commands for 'msg_type' = *N*:
0252 
0253 *13* tpnotify message. Message type code *TPNOTIF*, see <<message-tpnotif>>
0254 
0255 *14* tpbroadcast message. Message type code *TPNOTIF*, see <<message-tpnotif>>
0256 
0257 Commands for 'msg_type' = *X*:
0258 
0259 *46* Service table exchange message. Message type code *REFRESH*, see <<message-refresh>>
0260 
0261 *48* bridge, monotonic clock exchange, request. Message type code *TIMESYNC*, see <<message-timesync>>
0262 
0263 |0x102D |buf |MESSAGE0..PMSGMAX |Mand |N/A | Message data block which corresponds to msg_type / command_id.
0264 Body described in <<message-anchor>> section.
0265 |=========================================================
0266 
0267 === Standard call block
0268 
0269 *Type code: STDHDR*
0270 
0271 All messages includes field "stdhdr" where similarly as with network call header
0272 generic details about message is kept.
0273 
0274 .Standard call header block
0275 [options="header"]
0276 |=========================================================
0277 |TLV TAG | Name | Format | Cond | Default value | Description
0278 |0x1037 |command_id |SHORT1..4 |Mand |N/A | The same value as in <<block-netcall>> tag 0x1019 ('command_id')
0279 |0x1041 |proto_ver |CARRAY4 |Mand |N/A | Fixed bytes: *0x00*, *0x00*, *0x00*, *0x00*.
0280 |0x104B |proto_magic |INT1 |Mand |N/A | Fixed value: *0*
0281 |=========================================================
0282 
0283 === Command call block
0284 
0285 *Type code: CMDCALL*
0286 
0287 This block is used for non XATMI messages, i.e. *0x100F* of <<block-netcall> is *X*.
0288 
0289 .Command call header
0290 [options="header"]
0291 |=========================================================
0292 |TLV TAG | Name | Format | Cond | Default value | Description
0293 |0x1055 |stdhdr         |STDHDR1..PMSGMAX |Mand| N/A| Standard call header
0294 |0x105F |magic          |ULONG10    |Mand |N/A| Command call magic: 
0295 Hex value *0x62327700* which corresponds to *1647474432*.
0296 |0x1069 |command        |INT1..2    |Mand | N/A| The same value as in <<block-netcall>> tag 0x1019 ('command_id')
0297 |0x1073 |msg_type       |SHORT1..2  |Mand | N/A| Message type code:
0298 
0299 *12* - Bridge services, used for *REFRESH* messages.
0300 
0301 *13* - Bridge clock info, used for *TIMESYNC* messages.
0302 
0303 |0x107D |msg_src        |SHORT1     |Mand | N/A| Message source:
0304 
0305 *0* - Call source is daemon.
0306 
0307 *1* - Call source is administrative command line utility.
0308 
0309 *2* - Call source is administrative command line utility.
0310 
0311 |0x1087 |reply_queue    |STRING1..128|Mand | N/A| Reply queue string (local queue id)
0312 |0x1091 |flags          |INT1..10   |Mand | N/A|Bitwise flags combined value in decimal.
0313 Encodes following flags:
0314 
0315 *0* - no flags set.
0316 
0317 *0x0001* - Reply queue is dead.
0318 
0319 *0x0002* - Second call from caller.
0320 
0321 *0x0004* - have more message.
0322 
0323 As part of the network messages, no flags are used. And always shall set to *0*.
0324 
0325 
0326 |0x109B |caller_nodeid  |INT1..3    |Mand | N/A| Enduro/X cluster node id on which
0327 message was initiated.
0328 |=========================================================
0329 
0330 === Service block (array of)
0331 
0332 *Type code: SERVICE*
0333 
0334 Service block consists of series of repeated following blocks:
0335 
0336 .SERVICE block
0337 [options="header"]
0338 |=========================================================
0339 |TLV TAG | Name | Format | Cond | Default value | Description
0340 |0x10B9 |mode         |CHAR         |Mand| N/A| Mode *D* - differential, *F* - full replace
0341 |0x10C3 |svc_nm       |STRING1..30  |Mand |N/A| XATMI service name
0342 |0x10CD |count        |INT1..6      |Mand |N/A| Signed count. For diff mode might be with minus
0343 sign (number of service server instances added or reduced).
0344 |=========================================================
0345 
0346 === Multi-buffer block (array of) for XATMI call data transport (MBUF)
0347 
0348 *Type code: MBUF*
0349 
0350 *Complex type block code: MBUF*
0351 
0352 As Enduro/X may send several buffers with one request, for reasons of call info
0353 data UBF buffer is used. UBF buffer might have embedded VIEW, UBF objects or UBF might contain pointer to other buffers. Thus multiple XATMI
0354 buffers are serialized.
0355 
0356 Multi-buffer block is array of 0..N XATMI buffer typed blocks. Each Multi-buffer
0357 block encodes MBUF tag. Which by it self holds the information about what type
0358 of XATMI buffer it represents. And any additional flags, such as is this Multi-buffer
0359 block a call info. Or is it Primary buffer, or a UBF pointer to buffer (i.e.
0360 virtual pointer).
0361 
0362 Layout of the block is following:
0363 
0364 image:ex_netproto_multibuf.png[caption="Figure 2: ", title="Multi-buffer array"]
0365 
0366 .Multi-buffer block
0367 [options="header"]
0368 |=========================================================
0369 |TLV TAG | Name | Format | Condition | Default value | Description
0370 |0x132F | tag | UINT1..10 | Mand | N/A | This is Multi-buffer tag. Not to confuse with
0371 TLV tag. This tag is used to identify the particular Multi-buffer. The tag
0372 consists of first 26 bits of this 32bit unsigned-integer. If bit No *27.* is set
0373 to *1*. This means that particular buffer is *tpsetcallinfo(3)* associated data
0374 associated with primary buffer. The call info bit must be set only for tag *0*. If call
0375 info bit is set, then call primary buffer is at tag *1*. If call info bit 27 is
0376 not set, then primary buffer is at tag *0*. Any other tags are virtual pointer,
0377 i.e. primary buffer in that case must be *UBF* typed and it must hold a *BFLD_PTR*
0378 with references to these tags. Buffer type is by it self is encoded at bits 28..32.
0379 Currently following buffer types are supported: *0* - *UBF* buffer, *2* - *TPINIT*
0380 buffer, *3* - *NULL* buffer, *4* - *STRING* buffer, *5* - *CARRAY* buffer, *6* - 
0381 *JSON* buffer, *7* - *VIEW* buffer.
0382 |0x1343 | data | XATMIBUF0..PMSGMAX | Mand | N/A |This is actual XATMI buffer data. Encoded
0383 according to data type specified at bits 28..32 in* 0x132F* tag value (mbuf tag field name).
0384 |=========================================================
0385 
0386 
0387 === XATMI buffer (XATMIBUF)
0388 
0389 *Abstract type code: XATMIBUF*
0390 
0391 Enduro/X supports different data types which are the "body" of the XATMI IPC
0392 calls. Data types are complex ones like UBF which is hash of arrays, VIEW data
0393 which "managed" are C structures. And basic data types such as strings and blobs
0394 (carray).
0395 
0396 ==== UBF data (array of)
0397 
0398 UBF data is encoded as array of Compiled 32bit FLDID UBF field id and corresponding
0399 value. UBF field may include another UBF buffer or it may include VIEW data.
0400 Fields in the message must be presented in growing order of the field types and 
0401 field IDs. Which basically makes that all UBF fields in protocol message must
0402 be present in sorted by compiled filed id from smallest ID till the biggest ID.
0403 If the order is not complied with, the message conversation fails and message
0404 will be dropped.
0405 
0406 Field id is generated by *mkfldhdr(8)* program.
0407 
0408 .UBF Buffer type block
0409 [options="header"]
0410 |=========================================================
0411 |TLV TAG | Name | Format | Cond | Default value | Description
0412 |0x10FF |bfldid |UINT1..9 |Mand |N/A |Compiled UBF field id (for *BFLD_SHORT* type).
0413 |0x1113 |short |SHORT1..6 |C1 |N/A |Short value for bfldid (for *BFLD_LONG* type).
0414 |0x111D |long |LONG1..20 |C1 |N/A |Long value for bfldid (for *BFLD_CHAR* type).
0415 |0x1127 |char |CHAR |C 1|N/A |Char value for bfldid (for *BFLD_CHAR* type).
0416 |0x1131 |float |FLOAT1..40 |C1 |N/A |Float value for bfldid (for *BFLD_FLOAT* type).
0417 |0x113B |double |DOUBLE1..40 |C1 |N/A |Double precision value for bfldid (for *BFLD_DOUBLE* type).
0418 |0x1145 |string |STRING0..PMSGMAX |C1 |N/A |String value for bfldid (for *BFLD_STRING* type).
0419 |0x114F |carray |CARRAY0..PMSGMAX |C1 |N/A |Blob value for bfldid (for *BFLD_CARRAY* type).
0420 |0x1152 |ptr |LONG1..20 |C1 |N/A  |Virtual pointer to MBUF tag (without type 
0421 bits and call info bits) (for *BFLD_PTR* type).
0422 |0x1153 |ubf |XATMIBUF0..PMSGMAX |C1 |N/A |Embedded UBF (for *BFLD_UBF* type).
0423 |0x1154 |view |XATMIBUF1..PMSGMAX |C1 |N/A |Embedded VIEW (for *BFLD_VIEW* type).
0424 |=========================================================
0425 
0426 C1 - Only one field is present from all with C1. Field must correspond the field 
0427 type for which corresponds the encoded data type in 'bfldid' (i.e. bits 26..32).
0428 
0429 
0430 UBF field id bits 26+ meaning:
0431 
0432 .UBF Type numbers
0433 [options="header"]
0434 |=========================================================
0435 |Type name       | Type number
0436 |BFLD_SHORT      |0
0437 |BFLD_LONG       |1
0438 |BFLD_CHAR       |2
0439 |BFLD_FLOAT      |3
0440 |BFLD_DOUBLE     |4
0441 |BFLD_STRING     |5
0442 |BFLD_CARRAY     |6
0443 |BFLD_PTR        |9 
0444 |BFLD_UBF        |10
0445 |BFLD_VIEW       |11
0446 |=========================================================
0447 
0448 
0449 ===== Example data block
0450 
0451 Having UBF buffer as:
0452 
0453 --------------------------------------------------------------------------------
0454 
0455 T_LONG_3_FLD    0
0456 T_LONG_3_FLD    0
0457 T_LONG_3_FLD    0
0458 T_LONG_3_FLD    889991
0459 T_DOUBLE_FLD    3.141590
0460 T_STRING_7_FLD  
0461 T_STRING_7_FLD  
0462 T_STRING_7_FLD  ANOTHER UB
0463 T_STRING_9_FLD  
0464 T_STRING_9_FLD  
0465 T_STRING_9_FLD  
0466 T_STRING_9_FLD  HELLO WORLD UB
0467 
0468 --------------------------------------------------------------------------------
0469 
0470 With field IDs defined as:
0471 
0472 
0473 --------------------------------------------------------------------------------
0474 *base 1000
0475 T_LONG_3_FLD            33      long    - 1 Long test field 3
0476 T_DOUBLE_FLD            51      double  - 1 Double test field 1
0477 T_STRING_7_FLD          67      string  - 1 String test field 7
0478 T_STRING_9_FLD          69      string  - 1 String test field 9
0479 --------------------------------------------------------------------------------
0480 
0481 
0482 The serialized data would look like:
0483 
0484 --------------------------------------------------------------------------------
0485   0370                                               10                 .
0486   0380  ff 00 00 00 05 01 67 77 32 29 11 45 00 00 00 00  ......gw2).E....
0487   0390  10 ff 00 00 00 05 01 67 77 32 29 11 45 00 00 00  .......gw2).E...
0488   03a0  00 10 ff 00 00 00 05 01 67 77 32 29 11 45 00 00  ........gw2).E..
0489   03b0  00 00 10 ff 00 00 00 05 01 67 77 32 29 11 45 00  .........gw2).E.
0490   03c0  00 00 0e 48 45 4c 4c 4f 20 57 4f 52 4c 44 20 55  ...HELLO WORLD U
0491   03d0  42
0492 --------------------------------------------------------------------------------
0493 
0494 
0495 ==== View Data (array of)
0496 
0497 VIEW buffer data is encoded as array. But with exception VIEW meta data
0498 must follow first and only once. 
0499 
0500 .VIEW metadata type block
0501 [options="header"]
0502 |=========================================================
0503 |TLV TAG | Name | Format | Cond | Default value | Description
0504 |0x13B1 |vname |STRING0..33 |Mand |N/A | View name. Might be empty string
0505 For "emtpy" occurrences when embedded in UBF sub-field
0506 |0x13BB |vflags |UINT1 |Mand |0 |View flags. Not used and must be sent as *0*
0507 |=========================================================
0508 
0509 Following block repeats with each of the view field occurrence:
0510 
0511 .VIEW Buffer type block (array of)
0512 [options="header"]
0513 |=========================================================
0514 |TLV TAG | Name | Format | Cond | Default value | Description
0515 |0x134D |cname |STRING1..256    |Mand |N/A |View field name
0516 |0x1360 |short |SHORT1..6       |C1 |N/A |Short value
0517 |0x1361 |long |LONG1..20        |C1 |N/A |Long value
0518 |0x1362 |char |CHAR             |C1 |N/A |ASCII char byte
0519 |0x1363 |float |FLOAT1..40      |C1 |N/A |Float value
0520 |0x1364 |double |DOUBLE1..40    |C1 |N/A |Double
0521 |0x1365 |string |STRING0..PMSGMAX   |C1 |N/A |String value
0522 |0x1366 |carray |CARRAY0..PMSGMAX   |C1 |N/A |Carray (blob) value
0523 |0x1367 |int |INT1..12              |C1 |N/A |Integer value
0524 |=========================================================
0525 
0526 C1 - One of the fields must be present according to view field type.
0527 
0528 ===== Example data block
0529 
0530 Having VIEW C struct as:
0531 
0532 --------------------------------------------------------------------------------
0533 
0534 struct UBTESTVIEW2 {
0535     short   tshort1;
0536     long    tlong1;
0537     char    tchar1;
0538     float   tfloat1;
0539     double  tdouble1;
0540     char    tstring1[15];
0541     char    tcarray1[10];
0542 };
0543 
0544 --------------------------------------------------------------------------------
0545 
0546 The VIEW is serialized in the following XATMI buffer block:
0547 
0548 --------------------------------------------------------------------------------
0549 
0550   0330  13 b1 00 00 00 0b 55 42 54 45 53 54 56 49 45 57  ......UBTESTVIEW
0551   0340  32 13 bb 00 00 00 01 00 13 4d 00 00 00 07 74 73  2........M....ts
0552   0350  68 6f 72 74 31 13 60 00 00 00 02 10 00 13 4d 00  hort1.`.......M.
0553   0360  00 00 06 74 6c 6f 6e 67 31 13 61 00 00 00 02 20  ...tlong1.a.... 
0554   0370  00 13 4d 00 00 00 06 74 63 68 61 72 31 13 62 00  ..M....tchar1.b.
0555   0380  00 00 01 47 13 4d 00 00 00 07 74 66 6c 6f 61 74  ...G.M....tfloat
0556   0390  31 13 63 00 00 00 05 04 00 00 00 00 13 4d 00 00  1.c..........M..
0557   03a0  00 08 74 64 6f 75 62 6c 65 31 13 64 00 00 00 05  ..tdouble1.d....
0558   03b0  50 00 00 00 00 13 4d 00 00 00 08 74 73 74 72 69  P.....M....tstri
0559   03c0  6e 67 31 13 65 00 00 00 03 36 58 58 13 4d 00 00  ng1.e....6XX.M..
0560   03d0  00 08 74 63 61 72 72 61 79 31 13 66 00 00 00 0a  ..tcarray1.f....
0561   03e0  37 58 58 00 00 00 00 00 00 10                    7XX.............
0562 
0563 --------------------------------------------------------------------------------
0564 
0565 ==== Other data buffers
0566 
0567 Other buffers basically includes generic byte array of data.
0568 
0569 ===== String data
0570 
0571 String buffer data normally does not include 0x00 terminating EOS symbol. Empty
0572 strings or string termination is identified by TLV length component.
0573 
0574 ===== JSON data
0575 
0576 JSON buffer data is processed in the same way as string buffer data.
0577 
0578 ===== NULL buffer
0579 
0580 For null buffers TLV length component always contains 0. And no data follows.
0581 
0582 == Message blocks
0583 
0584 [[message-anchor]]
0585 *Abstract type code: MESSAGE*
0586 
0587 Message blocks are actual business messages which are used for exchanging the
0588 information between cluster instances. Message blocks uses basic and complex data
0589 type blocks previously described to construct the messages.
0590 
0591 image:ex_netproto_envelope.png[caption="Figure 3: ", title="Standard message layout (envelope)"]
0592 
0593 
0594 === Time adjustment exchange block
0595 
0596 [[message-timesync]]
0597 
0598 *Type code: TIMESYNC*
0599 
0600 When bridge establishes connection between cluster each node sends to other node
0601 it's monotonic clock value. Each bridge end-point remembers this value and performs
0602 any adjustments on *TPCALL* message, tag 0x11E5 (timer). The value when *TPCALL*
0603 message is received, is adjusted to make the time field to appear to be relevant
0604 to local monotonic clock.
0605 
0606 Message starts with *NETCALL*. NETCALL tag '0x1019' ('command_id') is set to *48*.
0607 Tag '0x100F' ('msg_type') is set to *X*.
0608 Under the tag '0x102D' (buf) follows the time sync message:
0609 
0610 .Time sync message
0611 [options="header"]
0612 |=========================================================
0613 |TLV TAG | Name | Format | Cond | Default value | Description
0614 |0x10A5 |call |CMDCALL1..PMSGMAX |Mand |N/A | Generic call information with following specifics:
0615 
0616 - STDHDR tag 0x1037 (command_id) is set to *48*
0617 
0618 - CMDCALL tag 0x1069 (command) is set to *48*
0619 
0620 - CMDCALL tag 0x1073 (msg_type) is set to *13*
0621 
0622 |0x10AF |time |NTIMER |Mand |N/A |Local monotonic time.
0623 |0x10B0|mode|INT1|Mand|N/A|Following values possible:
0624 
0625 *1* - Async clock data, used at connection establishment.
0626 
0627 *2* - Synchronous clock data request.
0628 
0629 *3* - Synchronous Reply on clock data request for incoming mode *2* message.
0630 
0631 |0x10B1|seq|LONG1..20|Mand|N/A|Call sequence number. In case if *mode* tag is *2*,
0632 the value must be echo in message of *mode* *3*.
0633 |0x10B2|orig_nodeid|INT1..3|Mand|N/A|Message originating node id. In case of *mode* *3*
0634 message, it must be echo from mode *2* message.
0635 |0x10B3|orig_timestamp|LONG1..20|Mand|N/A|Message originating unix epoch timestamp
0636 in seconds. In case of *mode* *3* message, it must be echo from mode *2* message.
0637 |=========================================================
0638 
0639 
0640 image:ex_netproto_timesync.png[caption="Figure 4: ", title="TIMESYNC sequence diagram",  alt="TIMESYNC sequence diagram"]
0641 
0642 
0643 System can be configured so that during the idle time (no traffic is sent overt
0644 the bridges, a time sync messages are delivered periodically).
0645 
0646 ==== Example message
0647 
0648 --------------------------------------------------------------------------------
0649 
0650 0000  10 05 00 00 00 06 01 77 96 16 84 90 10 0f 00 00  .......w........
0651 0010  00 01 58 10 19 00 00 00 02 04 80 10 2d 00 00 00  ..X.........-...
0652 0020  95 10 a5 00 00 00 75 10 55 00 00 00 19 10 37 00  ......u.U.....7.
0653 0030  00 00 02 04 80 10 41 00 00 00 04 00 00 00 00 10  ......A.........
0654 0040  4b 00 00 00 01 00 10 5f 00 00 00 05 16 47 47 44  K......_.....GGD
0655 0050  32 10 69 00 00 00 02 04 80 10 73 00 00 00 02 01  2.i.......s.....
0656 0060  30 10 7d 00 00 00 01 30 10 87 00 00 00 20 2f 64  0.}....0..... /d
0657 0070  6f 6d 31 2c 63 6c 74 2c 72 65 70 6c 79 2c 74 70  om1,clt,reply,tp
0658 0080  62 72 69 64 67 65 2c 31 33 35 37 31 2c 37 10 91  bridge,13571,7..
0659 0090  00 00 00 01 00 10 9b 00 00 00 01 10 10 af 00 00  ................
0660 00a0  00 14 00 00 00 00 00 00 00 15 07 21 00 00 00 00  ...........!....
0661 00b0  00 07 55 67 18 84                                ..Ug..
0662 
0663 --------------------------------------------------------------------------------
0664 
0665 === Service table refresh block
0666 
0667 [[message-refresh]]
0668 *Type code: REFRESH*
0669 
0670 Service table refresh messages are used to notify other cluster node with the
0671 XATMI services locally advertised. Service tables are send periodically and
0672 asynchronously. Messages includes two modes - *FULL* mode, where full service
0673 tables is sent, or *DIFFERENTIAL* service table is sent, which only holds the
0674 updates about services number of instances add / removed.
0675 
0676 Message starts with *NETCALL*. NETCALL tag '0x1019' ('command_id') is set to *46*.
0677 Tag '0x100F' ('msg_type') is set to *X*.
0678 Under the tag '0x102D' (buf) follows the service table refresh message:
0679 
0680 .Service tables refresh messages
0681 [options="header"]
0682 |=========================================================
0683 |TLV TAG | Name | Format | Cond | Default value | Description
0684 |0x10A5 |call |CMDCALL1..PMSGMAX |Mand |N/A | Generic call information with following specifics:
0685 
0686 - STDHDR tag 0x1037 (command_id) is set to *46*
0687 
0688 - CMDCALL tag 0x1069 (command) is set to *46*
0689 
0690 - CMDCALL tag 0x1073 (msg_type) is set to *12*
0691 
0692 |0x10E1 |mode |CHAR |Mand |N/A |*F* - full, *D* - differential.
0693 |0x10EB |count |INT1..6 |Mand |N/A |Number of SERVICE blocks in *0x10F5*(svcs) field
0694 |0x10F5 |svcs |SERVICE0..PMSGMAX |Mand |N/A |Services block (array of)
0695 |=========================================================
0696 
0697 Messages are sent asynchronously and each site can decide at what frequency send
0698 the messages. Normally full service tables are sent when link is established and
0699 periodically at configured interval. Differential service tables are sent to 
0700 other node, when locally in service table listings changes hash happened.
0701 
0702 image:ex_netproto_refresh.png[caption="Figure 5: ", title="REFRESH sequence diagram",  alt="REFRESH sequence diagram"]
0703 
0704 
0705 ==== Example message
0706 
0707 --------------------------------------------------------------------------------
0708 
0709 0000  10 05 00 00 00 06 01 77 96 16 84 90 10 0f 00 00  .......w........
0710 0010  00 01 58 10 19 00 00 00 02 04 60 10 2d 00 00 01  ..X.......`.-...
0711 0020  42 10 d7 00 00 00 66 10 55 00 00 00 18 10 37 00  B.....f.U.....7.
0712 0030  00 00 01 00 10 41 00 00 00 04 00 00 00 00 10 4b  .....A.........K
0713 0040  00 00 00 01 00 10 5f 00 00 00 05 16 47 47 44 32  ......_.....GGD2
0714 0050  10 69 00 00 00 02 04 60 10 73 00 00 00 02 01 20  .i.....`.s..... 
0715 0060  10 7d 00 00 00 01 10 10 87 00 00 00 12 2f 64 6f  .}.........../do
0716 0070  6d 32 2c 73 79 73 2c 62 67 2c 6e 64 72 78 64 10  m2,sys,bg,ndrxd.
0717 0080  91 00 00 00 01 00 10 9b 00 00 00 01 20 10 e1 00  ............ ...
0718 0090  00 00 01 46 10 eb 00 00 00 01 60 10 f5 00 00 00  ...F......`.....
0719 00a0  1d 10 b9 00 00 00 01 46 10 c3 00 00 00 09 54 49  .......F......TI
0720 00b0  4d 45 4f 55 54 53 56 10 cd 00 00 00 01 10 10 f5  MEOUTSV.........
0721 00c0  00 00 00 1a 10 b9 00 00 00 01 46 10 c3 00 00 00  ..........F.....
0722 00d0  06 54 45 53 54 53 56 10 cd 00 00 00 01 10 10 f5  .TESTSV.........
0723 00e0  00 00 00 1a 10 b9 00 00 00 01 46 10 c3 00 00 00  ..........F.....
0724 00f0  06 4e 55 4c 4c 53 56 10 cd 00 00 00 01 10 10 f5  .NULLSV.........
0725 0100  00 00 00 18 10 b9 00 00 00 01 46 10 c3 00 00 00  ..........F.....
0726 0110  04 45 43 48 4f 10 cd 00 00 00 01 10 10 f5 00 00  .ECHO...........
0727 0120  00 1f 10 b9 00 00 00 01 46 10 c3 00 00 00 0b 52  ........F......R
0728 0130  45 54 53 4f 4d 45 44 41 54 41 10 cd 00 00 00 01  ETSOMEDATA......
0729 0140  10 10 f5 00 00 00 1c 10 b9 00 00 00 01 46 10 c3  .............F..
0730 0150  00 00 00 08 53 4f 46 54 54 4f 55 54 10 cd 00 00  ....SOFTTOUT....
0731 0160  00 01 10                                         ...
0732 
0733 --------------------------------------------------------------------------------
0734 
0735 
0736 === TP Call / TP Reply message block
0737 
0738 [[message-tpcall]]
0739 *Type code: TPCALL*
0740 
0741 Tpcall message block is used for lot of XATMI messaging purposes. It services
0742 as call for *tpcall(3)*, *tpacall(3)*, Message starts with *NETCALL*. 
0743 NETCALL tag '0x1019' ('command_id') is set to value in range from *1* - *7*. 
0744 Tag '0x100F' ('msg_type') is set to *A*.
0745 
0746 .XATMI call
0747 [options="header"]
0748 |=========================================================
0749 |TLV TAG | Name | Format | Cond | Default value | Applicable command_id | Description
0750 |0x1055 |stdhdr        |STDHDR1..PMSGMAX |Mand| N/A| Any|Contains *command_id*:
0751 
0752 *1* - tpcall/tpacall message.
0753 
0754 *2* - tpreturn message.
0755 
0756 *3* - tpforward message (RFU, forwards are received as *command_id* *1*).
0757 
0758 *4* - tpconnect message.
0759 
0760 *5* - conversational data.
0761 
0762 *6* - tpconnect reply message from server (accept/reject).
0763 
0764 *7* - tpdiscon message.
0765 
0766 |0x116D |name          |STRING0..30    |Mand |N/A| 1,3,4 |Service name to be called.
0767 
0768 |0x1177 |reply_to      |STRING0..30    |Mand |N/A| 1,2,3,4,6,7 | Caller queue identifier.
0769 
0770 For *command_id* *1*, *2*, *3*, *4*, *7* - call originator queue name.
0771  
0772 For *command_id* *5*, *7* - for conversational data, this field indicates the queue
0773 to which data shall be sent (local recipient on destination node).
0774 
0775 |0x1181 |callstack     |STRING0..32    |Mand |N/A|Any|From left to right. Each byte
0776 indicates the Enduro/X cluster node ide from which message was forwarded to next node.
0777 When tpcall()/tpforward() or tpconnect() is made from one node to another, the source node
0778 number (*NDRX_NODEID*) is appended to callstack. When reply message is processed (e.g. tpreturn),
0779 the closest to the left connected node of the current node is used to deliver reply back.
0780 
0781 |0x118B|my_id|STRING1..96|Mand|N/A|Any|Process identifier in message originating node.
0782 See bellow myid field format.
0783 
0784 Mandatory for *command_id*: *1*,*4*. For other commands, it is optional/empty field.
0785 
0786 |0x1195|sysflags|LONG1..20|Mand|0|Any|Bitwise ORed flags of:
0787 
0788 *0x00000001* - internal system error. Used in *command_id* value *2* (tpreturn). If flag
0789 is set tag *0x11B3* is loaded with XATMI error code that shall be returned to the caller,
0790 i.e. value becomes a *tperrno* result. This value maybe sent also in *command_id* *5*, when
0791 server for *tpconnect(3)* did not accept the connection.
0792 
0793 *0x00000002* - used by *command_id* *2*, to indicate that server has performed return from
0794 the conversation.
0795 
0796 *0x00000100* - marking that auto-transaction is started, and call receiver (*command_id* *1*)
0797 becomes auto-transaction owner.
0798 
0799 |0x119F|cd|INT1..5|Mand|0|1,2,4,5,7|This is connection id. Used as correlator to link
0800 request with reply or identify conversational session. For tpcall commands used
0801 only if tag *0x12DF* does not contain *0x00000004* (*TPNOREPLY*) flag. 
0802 
0803 - For *command_id* *1* (tpcall) and *2* (tpreturn) minimum is *1* and maximum is *16384*.
0804 
0805 - For conversational data minimum is *0* and maximums is *9*.
0806 
0807 |0x11A9|rval/usr1|INT1..10|Mand|0|Any|For tpreturn command used to transport
0808 *rval* (values of *TPSUCCESS* (*0x00000002*), *TPFAIL* (*0x00000001*)), 
0809 for other commands used as optional *user data 1*. Currently is used
0810 by Enduro/X cache events (e.g. microseconds for cache data).
0811 
0812 |0x11B3|rcode/usr2|LONG1..20|Mand|0|Any|For tpreturn command used to transport
0813 *rcode*. For other messages functions as custom *user data 2*. Currently is used
0814 by Enduro/X smart cache events (e.g. epoch seconds for cache data).
0815 |0x11B4|user3|INT1..10|Mand|0|Any|Custom data associated with the message.
0816 
0817 - For smart cache reset events indicates *tperrno* to be saved.
0818 
0819 |0x11B5|user4|LONG1..20|Mand|0|Any|Custom user data assoicated with the message.
0820 
0821 - For smart cache events indicates the *tpurcode* to be cached.
0822 
0823 |0x11B6|clttout|INT1..10|Mand|N/A|1,4|Indicates number of seconds in which 
0824 XATMI client (caller) will generate *TPETIME* error. This flag is used only in
0825 case if flag *0x00000020* (*TPNOTIME*) is not set in tag *0x11C7*.
0826 |0x11BD|extradata|STRING0..41|Mand|Empty|Any|Extra call data. Currently Enduro/X uses
0827 this for:
0828 
0829 - Event delivery (*tppost(3)* - contains eventname).
0830 |0x11C7|flags|LONG1..20|Mand|0|Any|Call flags e.g. *TPTRAN*, etc.
0831 see xatmi.h for details.
0832 |0x11D1|timestamp|LONG1..20|Mand|N/A|Any|Unix epoch time stamp in seconds. For original
0833 messages (i.e. *command_id* *1* (except kept original if doing forward), *4*) 
0834 it is set by caller. For reply and related messages (*command_id* *2*, *5*, *6* and *7*)
0835 it is set to original request value.
0836 
0837 Field is used for matching request with reply.
0838 
0839 |0x11DB|callseq|UINT1..10|Mand|N/A|Any|Call sequence number (is incremented by calling process
0840 for each of the new requests, overlapping). Field is used for request and reply matching. I.e. in
0841 requests it is set for *command_id* *1* (except if doing forward), *4*. In reply
0842 and related messages (*command_id* *2*, *5*, *6* and *7*) it set to to request value.
0843 Value must be in range of 0..4294967295.
0844 |0x11DC|msgseq|UINT1..10|Mand|N/A|4,5,6,7|Message sequence number for conversational data. As tpbridge
0845 process is is multi-threaded, message reordering might happen. In each conversational
0846 data direction this keeps counter keeps to increment (by overlapping to 0).
0847 Value must be in range of 0..4294967295.
0848 |0x11E5|timer|NTIMER|Mand|N/A|Any|Local monotonic time when the call was prepared/sent from
0849 the node to other node.
0850 |0x11F9|data|MUBF|Mand|N/A|Any|Associated XATMI data buffer with the call. In case if
0851 data is not used, NULL typed buffer must be sent
0852 |0x1203|tmxid|STRING0..48|Mand|Empty|Any|Global Tx: Global transaction ID (if value is not empty). This is base64
0853 encoded transaction identifier. See bellow section for the XID format.
0854 |0x120D|tmrmid|SHORT1..5|Mand|0|Any|Global Tx: Resource manager ID (RMID) which started the global
0855 transaction.
0856 |0x1217|tmnodeid|SHORT1..5|Mand|0|Any|Global Tx: Cluster Node ID which started the transaction.
0857 |0x1221|tmsrvid|SHORT1..5|Mand|0|Any|Global Tx: XATMI server id which started the transaction
0858 on particular cluster node.
0859 |0x122B|tmknownrms|STRING0..32|Mand|Empty|Any|Global Tx: List (filled from left to right) identifies
0860 the RMIDs which are involed in this global transaction.
0861 
0862 |0x1235|tmtxflags|SHORT1..5|Mand|0|Any|Global Tx: Transaction flags (bitwise). Currently supported values:
0863 
0864 - *0x0001* - Gloal transaction is marked for abort only.
0865 |=========================================================
0866 
0867 Fields for non applicable commands/messages shall be empty string or 0 integer.
0868 
0869 
0870 ==== MYID field format
0871 
0872 .Identifier formats
0873 [options="header"]
0874 |=========================================================
0875 |Type|Format|Example
0876 |Client|clt,<binary name>,<pid>,<context id>,<node id>|clt,atmiclt3,109966,1,1
0877 |Server|srv,<binary name>,<server id>,<pid>,<contextid>,<nodeid>|srv,atmisv3,10,109930,1,2
0878 |=========================================================
0879 
0880 ==== Global Transaction XID format
0881 
0882 The XID transported over the bridge protocol is encoded base64 data:
0883 
0884 .Serialized XID format
0885 [options="header"]
0886 |=========================================================
0887 |Bytes|Data
0888 |0-3|Format ID, constant: *0x6194f7a1* or *0xa1f79461* depending
0889 on the source platform endianess.
0890 |4|global transaction identifier length, const *64*
0891 |5|branch qualifier length, const *64*
0892 |6-21|GUID of transaction
0893 |22|Resource manager ID (RMID)
0894 |23-24|Enduro/X cluster node id, network order
0895 |24-25|Enduro/X TMSRV server id on cluster node which manages the
0896 transaction.
0897 |=========================================================
0898 
0899 ==== Workflows
0900 
0901 This section describes typical XATMI workflows.
0902 
0903 ===== Synchronous tpcall()
0904 
0905 1. Bridge sends *command_id* *1* to Node 2.
0906 
0907 2. Node 2. sends reply back with *command_id* *2*. 
0908 
0909 
0910 ===== Asynchronous call
0911 
0912 1. Node 1. sends *command_id* *1* to Node 2. Tag 0x11C7 (flags) contains flag *0x00000004*
0913 so that that reply is not required back.
0914 
0915 ===== Conversational session
0916 
0917 Sequence of steps for typical conversational session:
0918 
0919 1. Node 1. sends *command_id* *4* (tpconnect()) to Node 2. The *0x1177* (*reply_to*)
0920 tag is filled with the client's conversation queue name.
0921 
0922 2. Node 2. sends *command_id* *6* accept message to Node 1. The MBUF reply buffer
0923 contains *STRING* buffer which contains local queue name which server has
0924 created for this particular conversation.  If the Node 2. decides to reject the conversation 
0925 for some reason, the *command_id* *6* must be sent back with 
0926 tag *0x1195* (*sysflags*) containging the flag *0x00000001* (system error).
0927 
0928 3. Node 1. (or Node 2.) depending on *flags* *TPRECVONLY* flag sends the data to other node
0929 with  *command_id* *5*. Tag *0x1177* (*reply_to*) contains the destination conversation queue
0930 name with the XATMI data loaded into *0x11F9*.
0931 
0932 4. If client has control it may terminate the conversation by sending 
0933 *command_id* *7* to the server.
0934 
0935 5. The server may terminate the conversation with *command_id* *2*, with
0936 the *rval* either set to *TPSUCCESS* or *TPFAIL*, to indicate the status.
0937 
0938 Example client connects, sends a data to server, then server sends a data back to client and server returns:
0939 
0940 image:ex_netproto_conv.png[caption="Figure 6: ", title="Conversation session example"]
0941 
0942 ===== Events
0943 
0944 Events are distributed to nodes, as single call. The *command_id* is set to *1*
0945 and reply of *command_id* *2* is required and tag *0x11B3* (*rcode*) shall be loaded with
0946 number of dispatched messages to the subscribed servers.
0947 
0948 The service which shall be called on the destination node is *TPEVDOPOST<%03hd - nodeid>*
0949 which is responsible for dispatching events locally on the node.
0950 
0951 Event name is loaded into tag *0x11BD* (extradata).
0952 
0953 ==== Example message
0954 
0955 tpcall() request, "EXBENCH" service request
0956 
0957 --------------------------------------------------------------------------------
0958   0000  10 05 00 00 00 06 01 77 96 16 84 90 10 0f 00 00  .......w........
0959   0010  00 01 41 10 19 00 00 00 01 10 10 2d 00 00 01 29  ..A........-...)
0960   0020  11 59 00 00 00 18 10 37 00 00 00 01 10 10 41 00  .Y.....7......A.
0961   0030  00 00 04 00 00 00 00 10 4b 00 00 00 01 00 11 6d  ........K......m
0962   0040  00 00 00 07 45 58 42 45 4e 43 48 11 77 00 00 00  ....EXBENCH.w...
0963   0050  23 2f 74 65 73 74 31 2c 63 6c 74 2c 72 65 70 6c  #/test1,clt,repl
0964   0060  79 2c 65 78 62 65 6e 63 68 63 6c 2c 31 30 33 39  y,exbenchcl,1039
0965   0070  34 38 2c 32 11 81 00 00 00 00 11 8b 00 00 00 18  48,2............
0966   0080  63 6c 74 2c 65 78 62 65 6e 63 68 63 6c 2c 31 30  clt,exbenchcl,10
0967   0090  33 39 34 38 2c 32 2c 31 11 95 00 00 00 01 00 11  3948,2,1........
0968   00a0  9f 00 00 00 03 16 38 20 11 a9 00 00 00 01 00 11  ......8 ........
0969   00b0  b3 00 00 00 01 00 11 b4 00 00 00 01 00 11 b5 00  ................
0970   00c0  00 00 01 00 11 b6 00 00 00 03 09 99 90 11 bd 00  ................
0971   00d0  00 00 00 11 c7 00 00 00 01 00 11 d1 00 00 00 06  ................
0972   00e0  01 63 37 74 46 90 11 db 00 00 00 01 01 11 dc 00  .c7tF...........
0973   00f0  00 00 01 00 11 e5 00 00 00 14 00 00 00 00 00 00  ................
0974   0100  00 07 99 57 00 00 00 00 00 00 94 81 31 74 11 f9  ...W........1t..
0975   0110  00 00 00 0d 13 2f 00 00 00 01 00 13 43 00 00 00  ...../......C...
0976   0120  00 12 03 00 00 00 00 12 0d 00 00 00 01 00 12 17  ................
0977   0130  00 00 00 01 00 12 21 00 00 00 01 00 12 2b 00 00  ......!......+..
0978   0140  00 00 12 35 00 00 00 01 00                       ...5.....
0979 
0980 --------------------------------------------------------------------------------
0981 
0982 
0983 tpcall() request, "EXBENCH" service return (echo the same data back in UBF)
0984 
0985 
0986 --------------------------------------------------------------------------------
0987   0000  10 05 00 00 00 06 01 77 96 16 84 90 10 0f 00 00  .......w........
0988   0010  00 01 41 10 19 00 00 00 01 20 10 2d 00 00 01 0a  ..A...... .-....
0989   0020  11 59 00 00 00 18 10 37 00 00 00 01 20 10 41 00  .Y.....7.... .A.
0990   0030  00 00 04 00 00 00 00 10 4b 00 00 00 01 00 11 6d  ........K......m
0991   0040  00 00 00 00 11 77 00 00 00 23 2f 74 65 73 74 31  .....w...#/test1
0992   0050  2c 63 6c 74 2c 72 65 70 6c 79 2c 65 78 62 65 6e  ,clt,reply,exben
0993   0060  63 68 63 6c 2c 31 30 33 39 34 38 2c 32 11 81 00  chcl,103948,2...
0994   0070  00 00 00 11 8b 00 00 00 00 11 95 00 00 00 01 00  ................
0995   0080  11 9f 00 00 00 03 16 38 20 11 a9 00 00 00 01 20  .......8 ...... 
0996   0090  11 b3 00 00 00 01 00 11 b4 00 00 00 01 00 11 b5  ................
0997   00a0  00 00 00 01 00 11 b6 00 00 00 03 09 99 90 11 bd  ................
0998   00b0  00 00 00 00 11 c7 00 00 00 01 00 11 d1 00 00 00  ................
0999   00c0  06 01 63 37 74 46 90 11 db 00 00 00 01 01 11 dc  ..c7tF..........
1000   00d0  00 00 00 01 00 11 e5 00 00 00 14 00 00 00 00 00  ................
1001   00e0  00 00 07 99 57 00 00 00 00 00 00 94 81 31 74 11  ....W........1t.
1002   00f0  f9 00 00 00 0d 13 2f 00 00 00 01 00 13 43 00 00  ....../......C..
1003   0100  00 00 12 03 00 00 00 00 12 0d 00 00 00 01 00 12  ................
1004   0110  17 00 00 00 01 00 12 21 00 00 00 01 00 12 2b 00  .......!......+.
1005   0120  00 00 00 12 35 00 00 00 01 00                    ....5.....
1006 
1007 --------------------------------------------------------------------------------
1008 
1009 
1010 === TP Notify / TP Broadcast message block
1011 
1012 [[message-tpnotif]]
1013 *Type code: TPNOTIF*
1014 
1015 Call is used to distribute broadcast and notification messages over the bridge
1016 connection. This message is utilized for *tpnotify(3)* and *tpbroadcast(3)* XATMI
1017 calls.
1018 
1019 Message starts with *NETCALL*.  NETCALL tag '0x1019' ('command_id') is set to
1020 value in range from *13* - *14*. Tag '0x100F' ('msg_type') is set to *N*.
1021 
1022 .TPNOTIF call
1023 [options="header"]
1024 |=========================================================
1025 |TLV TAG | Name | Format | Cond | Default value | Applicable command_id | Description
1026 |0x123F |stdhdr        |STDHDR1..PMSGMAX |Mand| N/A| Any|Contains *command_id*:
1027 
1028 *13* - *tpnotify(3)* message.
1029 
1030 *14* - *tpbroadcast(3)* message.
1031 
1032 |0x1249 |destclient         |STRING0..96    |Mand |N/A| 13 |Client myid to which deliver
1033 the notification. 
1034 |0x1253|nodeid|STRING0..60|Mand|Empty|14|Cluster node id ('lmid' argument of *tpbroadcast(3)*).
1035 |0x125D|nodeid_isnull|INT1|Mand|0|14|If set to *1*, indicates that nodeid is 
1036 part of brodcast matching. If no matching is used, value *0* must be used.
1037 |0x1267|usrname|STRING0..60|Mand|Empty|14| Target username used for broadcast.
1038 Currently not used, and shall be empty.
1039 |0x1271|usrname_isnull|INT1|Mand|0|14|If set to *1*, Indicates that *usrname* is 
1040 part of broadcast destination matching. If no matching is used, value *0* must be used.
1041 This is reserved for future use and shall be set to *0*.
1042 |0x127B|cltname|STRING0..60|Mand|Empty|14|Client binary name used for broadcast matching.
1043 |0x1285|cltname_isnull|INT1|Mand|9|14|If set to *1* indicates that recipients shall
1044 be matched by process name. If set to *0* *cltname* matching is not used.
1045 |0x1299|reply_to|STRING0..128|Mand|N/A|Any|Caller queue identifier.
1046 |0x12A3|callstack|STRING0..32    |Mand |N/A|Any|From left to right. Each byte
1047 indicates the Enduro/X cluster node ide from which message was forwarded to next node.
1048 When tpcall()/tpforward() or tpconnect() is made from one node to another, the source node
1049 number (*NDRX_NODEID*) is appended to callstack. When reply message is processed (e.g. tpreturn),
1050 the closest to the left connected node of the current node is used to deliver reply back.
1051 |0x12AD|my_id|STRING0..96|Mand|N/A|Any|Call originator MYID
1052 |0x12B7|sysflags|LONG1..20|Mand|0|Any|RFU, System bitwise flags.
1053 Shall be set to *0*.
1054 |0x12C1|cd|INT1..5|Mand|0|Any|RFU, Call Descriptor. Shall be set to *0*.
1055 |0x12CB|rval|INT1..10|Mand|0|Any|RFU, return value. Shall be set to *0*.
1056 |0x12D5|rcode|LONG1..20|Mand|0|Any|RFU, return code. Shall be set to *0*.
1057 |0x12DF|flags|LONG1..20|Mand|0|Any|API bitwise flags used by 
1058 *tpnotify(3)* and *tpbroadcast(3)*, such as *TPNOBLOCK*, *TPNOTIME*,
1059 *TPSIGRSTRT*, *TPACK*, *TPREGEXMATCH*. See API descritpions and
1060 xatmi.h for constants.
1061 |0x12E9|timestamp|LONG1..20|Mand|N/A|Any|Unix epoch time stamp
1062 indicating when message was prepared.
1063 |0x12F3|callseq|UINT1..10|Mand|0|Any|RFU. *0* shall be used.
1064 |0x12FD|msgseq|UINT1..10|Mand|0|Any|RFU. *0* shall be used.
1065 |0x1307|timer|NTIMER|Mand|0|Any|Local monotonic time when the call was prepared/sent from
1066 the node to other node.
1067 |0x131B|data|MUBF|Mand|N/A|Any|Associated XATMI data buffer with the call. In case if
1068 data is not used, NULL typed buffer must be sent
1069 |0x1325|destnodeid|LONG1..20|Mand|N/A|Any|Destination cluster node id.
1070 |=========================================================
1071 
1072 Fields for non applicable commands/messages shall be empty string or 0 integer.
1073 
1074 ==== Workflows
1075 
1076 This secion descirbes core message flow using for notifications.
1077 
1078 ===== Notify
1079 
1080 The notifications are delivered in asyncrhous way, no reply is required. The
1081 *command_id* shall be set to *13*.
1082 
1083 ===== Broadcast
1084 
1085 The notifications are delivered in asyncrhous way, no reply is required. The
1086 *command_id* shall be set to *14*.
1087 
1088 ==== Example message
1089 
1090 *tpbroadcast(3)*  message example
1091 
1092 --------------------------------------------------------------------------------
1093 
1094   0000  10 05 00 00 00 06 01 77 96 16 84 90 10 0f 00 00  .......w........
1095   0010  00 01 4e 10 19 00 00 00 02 01 40 10 2d 00 00 01  ..N.......@.-...
1096   0020  35 12 3f 00 00 00 19 10 37 00 00 00 02 01 40 10  5.?.....7.....@.
1097   0030  41 00 00 00 04 00 00 00 00 10 4b 00 00 00 01 00  A.........K.....
1098   0040  12 49 00 00 00 00 12 53 00 00 00 00 12 5d 00 00  .I.....S.....]..
1099   0050  00 01 10 12 67 00 00 00 00 12 71 00 00 00 01 10  ....g.....q.....
1100   0060  12 7b 00 00 00 0a 61 74 6d 69 63 6c 74 41 33 39  .{....atmicltA39
1101   0070  12 85 00 00 00 01 00 12 99 00 00 00 23 2f 64 6f  ............#/do
1102   0080  6d 31 2c 63 6c 74 2c 72 65 70 6c 79 2c 61 74 6d  m1,clt,reply,atm
1103   0090  69 63 6c 74 41 33 39 2c 31 33 30 31 33 37 2c 31  icltA39,130137,1
1104   00a0  12 a3 00 00 00 00 12 ad 00 00 00 19 63 6c 74 2c  ............clt,
1105   00b0  61 74 6d 69 63 6c 74 41 33 39 2c 31 33 30 31 33  atmicltA39,13013
1106   00c0  37 2c 31 2c 31 12 b7 00 00 00 01 00 12 c1 00 00  7,1,1...........
1107   00d0  00 01 00 12 cb 00 00 00 01 00 12 d5 00 00 00 01  ................
1108   00e0  00 12 df 00 00 00 04 83 88 60 80 12 e9 00 00 00  .........`......
1109   00f0  06 01 63 35 62 07 80 12 f3 00 00 00 01 00 12 fd  ..c5b...........
1110   0100  00 00 00 01 00 13 07 00 00 00 14 00 00 00 00 00  ................
1111   0110  00 00 02 50 88 00 00 00 00 00 02 97 15 27 08 13  ...P.........'..
1112   0120  1b 00 00 00 2a 13 2f 00 00 00 01 00 13 43 00 00  ....*./......C..
1113   0130  00 1d 10 ff 00 00 00 05 01 67 77 32 21 11 45 00  .........gw2!.E.
1114   0140  00 00 0c 41 41 30 31 30 30 30 30 30 30 30 31 13  ...AA0100000001.
1115   0150  25 00 00 00 01 20                                %.... 
1116 
1117 --------------------------------------------------------------------------------
1118 
1119 ////////////////////////////////////////////////////////////////
1120 The index is normally left completely empty, it's contents being
1121 generated automatically by the DocBook toolchain.
1122 ////////////////////////////////////////////////////////////////