Upx file format
This part describes the format of an UPX file. The UPX is the format used by all RMUs in MOON to store the traffic towards the CMS. An UPX starts with a header part and then contains all records sequentially.
The arrays on the next page show the structure of all blocks of an UPX file. For each field of the file the arrays give a variable name, a type, a size and a description. The variable name is purely indicative and is just here to give a vocabulary when speaking about the UPX format. The type is the type of the field; all types are explained later in this document. The size is the size in bits of the field. The description tries to explain the goal of the field. The UPX file contains several offset and length. The unit of an offset or a length is always the byte. In the UPX format, an offset is the position of the first bit from the beginning of the current block.
UPX format type and size
- unsigned char : An unsigned number on 8 bits
- unsigned short : An unsigned number on 16 bits
- unsigned int : An unsigned number on 32 bits
- float : a floating number on 32 bits as defined by the IEEE 754.
- timestamp: A date representation on 64 bits. This structure corresponds exactly to the “timeval" structure defined by the GNU C library.
- bitstream : a sequence of one or more contiguous bits. A bitstream is often used for representing a sequence of boolean values. By convention a bit set to 0 means false while 1 means true.
- {XXX}: A block of data. THis block is identified by its name XXX and is explained in another place of the document.
- {XXX}+: A series of 1 to n block of {XXX}
- xxx[n]: The type of the field is an array containing n elements of the type xxx.
Sizes:
- x : The field occupied x bits of memory
- {x}*: The field occupied a multiple of x bits in memory. This could be 0 bits.
- {x}?: This field is optional and so occupied 0 or x bits depending of its presence.
- WARNING: For each field, the byte order is little endian, which means that the least significant byte is written first, then the second least significant etc. For example when the decimal number 4660 (0x1234 in hexadecimal notation) is written in the file, when we read the file as usual byte by byte from left to right, we will read first 0x34 and then 0x12.
Blocks description
The UPX_FILE block is represent the UPX file itself. An upx file has a header followed by the list of all records
UPX_FILE | |||
Name | Type | Size(in bit) | Description |
---|---|---|---|
header | {UPX_HEADER} | 88 | The header of the file containing its properties |
records | {UPX_RECORD}+ | n | A set of records |
An UPX header contains all information specific to the file like the file version, the source which has generated this file etc. The header, and so the UPX file, always start with the string “PDAT”.
UPX_HEADER | |||
Name | Type | Size(in bit) | Description |
---|---|---|---|
ufi | unsigned char[4] | 32 | Unique File Identifier. Value must be \"PDAT\" |
f_ver | unsigned char | 8 | file version number, reserved for future use, default value is 1 |
p_ver | unsigned char | 8 | Protocol data record version, reserved for future use, default value is 1 |
source_id| | unsigned short| | 16 | source identifiers : |
- UNKNOWN 0x0000 | |||
- TELERAD_9000 0x0001 | |||
- HONEYWELL_CMU 0x0002 | |||
- ROCKWELL_CMU 0x0003 | |||
- SITA_VGS 0x0004 | |||
- SELEX_DTR100 0x0005 | |||
- RESERVED1 0x0006 | |||
- ARINC_VGS 0x0007 | |||
- HARRIS 0x0008 | |||
- PARKAIR_T6 0x0009 | |||
- RS_4200 0x000A | |||
- AIRBUS_CMU 0x000B | |||
- HONEYWELL_VDR 0x000C | |||
- COLLINS_VDR 0x000D | |||
- RESERVED2 0x000E | |||
- RESERVED3 0x000F | |||
pseq_off | unsigned short | 16 | Protocol data records sequence offset, in bytes from start of structure |
is_stat | bitstream | 1 | Not used. Set value to 1. |
opt_resv | bitstream | 7 | Reserved for future use |
The UPX_RECORD block represents an UPX record which can be either a PDU or a CU record. A record can contain other blocks which are explained later. The position of each blocks can be found thanks to their offset. An offset indicates the position of the first byte of a block relative to the start position of the record. There’s no padding in an UPX file, so the start of a block is always the end of the previous one.
UPX_RECORD | |||
Name | Type | Size(in bit) | Description |
---|---|---|---|
timestamp | timestamp | 64 | The date when the record has been received. The format of the date is defined by the “timeval\" structure defined by the GNU C library. |
proto_id| | unsigned short| | 16 | Protocol identifier : |
-UNKNOWN 0x0000 | |||
- ACARS 0x0001 | |||
- VDL2 0x0002 | |||
- CLNP 0x0003 | |||
- ESIS 0x0004 | |||
- A750 0x0005 | |||
pspo_off | unsigned short | 16 | Protocol specific options offset, in bytes from structure start. This offset marks the end of the protocol independent option block too. |
meta_off | unsigned short | 16 | Metdata offset, in bytes from start of structure |
data_off | unsigned short | 16 | Protocol Data offset, in bytes from start of structure |
data_len | unsigned int | 32 | Protocol Data length , in bytes (0 when no data field present). |
pino_resv | bitstream | 2 | Reserved for future use, guarantees last option byte alignment |
is_trunc | bitstream | 1 | protocol data field field truncated, original length in metadata as u_int32_t |
has_check | bitstream | 1 | Data check field (BCS, CRC ...) present in protocol data field |
has_cu | bitstream | 1 | Channel utilisation field present, 1 byte uchar |
has_sqp | bitstream | 1 | Signal Quality field present, 1 byte uchar |
has_freq | bitstream | 1 | Frequency field present, 4 bytes float |
is_valid | bitstream | 1 | Data has a valid CRC, implies data_len != 0 |
pino_block | {PINO_BLOCK} | delete | Protocol independent options block |
pspo_block | {PSPO_BLOCK} | delete | Protocol specific options block |
meta_block | {META_BLOCK} | delete | Metadata block |
data_block | {DATA_BLOCK} | delete | data block |
The PINO_BLOCK is the block which can contain some data independent from the protocol. This block has no predefined structure. The implementer of the UPX format is free to put there anything he wants. The PSPO_BLOCK is the block which can contain some data specific to the protocol. This block has no predefined structure. The implementer of the UPX format is free to put there anything he wants. The META_BLOCK contains metadata of the record like the frequency, the sqp, the cu and the size before truncation. The presence of each field is indicated by the bitstream field in the fixed size part of the record.
META_BLOCK | |||
Name | Type | Size(in bit) | Description |
---|---|---|---|
freq | float | {32}? | The frequency of the channel (optionnal) |
sqp | char | {8}? | signal qulity parameter (optionnal) |
cu | char | {8}? | Channel Utilization (optionnal) |
trunc | int | {32}? | The size before truncation (optionnal} |
The data block contains the data of the PDU. This bloc is empty if the record is a CU. At the end of the datablock we can find a crc value corresponding to the original crc value received. The presence of the crc value is indicated by the bitstream field in the fixed size part of the record.
DATA_BLOCK | |||
Name | Type | Size(in bit) | Description |
---|---|---|---|
data | char | {8}* | PDU data |
crc | char | {16}? | CRC Value (optionnal) |
cu | char | {8}? | Channel Utilization (optionnal) |
trunc | int | {32}? | The size before truncation (optionnal} |