HDLC header

From RtpBridge
Jump to: navigation, search

The article HDLC-UDP describes the sense and the Command syntax Description of the HDLC-to-UDP connections. HDLC/SS7 frames coming from some TDM E1/T1 timeslot over UDP transport could have an HDLC header. By default the HDLC header is enabled. This header could be turned on or off with the command:

 hdlcheader <on|off>

that whould be typed before creating of the HDLC-to-UDP connections. For example:

> connect hdlc:li0:ts1 udp:192.168.1.10:12001:4001
> hdlcheader off
> connect hdlc:li0:ts2 udp:192.168.1.10:12002:4002
> hdlcheader on
> connect hdlc:li0:ts3 udp:192.168.1.10:12003:4003
> list
1. hdlc:li0:ts1 udp:192.168.1.10:12001:4001
2. hdlc:li0:ts2 udp:192.168.1.10:12002:4002
3. hdlc:li0:ts3 udp:192.168.1.10:12003:4003

In this example the packets sent with the connections #1 and #3 will have HDLC header, and the packets sent with the connection #2 will have no HDLC header.

HDLC header format

Format of the HDLC header is shown below.

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   0 |    Version    |     Flags     |          Frame Length         |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  32 |                            Link ID                            |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  64 |                        Sequence Number                        |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  96 |                         Frame End Code                        |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 128 |                                                               |
     +                           Timestamp                           +
 160 |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 192 |                                                               |
     +                              Data                             +
 ... |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |      Data     |        CRC16 (optional)       |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Note that each tick mark represents one bit position.

Fields

Version: 8 bits
The Version field indicates the format of the HDLC header. This document describes version 1.
Flags: 8 bits
Various Control Flags.
Bit 0: (SM) 0 = Not SS7 Mode, 1 = SS7 Mode.
Bit 1: (CA) 0 = No CRC16 appended, 1 = CRC16 appended.
See CRC16.
Bits 2-7: reserved, must be zero.
  0   1   2   3   4   5   6   7 
+---+---+---+---+---+---+---+---+
| S | C |   |   |   |   |   |   |
| M | A |   |   |   |   |   |   |
+---+---+---+---+---+---+---+---+
Frame Length: 16 bits
Frame Length is the length of the Data and CRC16 fields, measured in octets.
Link ID: 32 bits
Identifier of the link.
Bits 0-15: Channel ID.
Sets the Identifier of the Channel. Really is the value that is equal: nTs + nLi*32 for the HDLC-to-UDP connection
Bits 16-31: Bridge ID.
Sets the identifier for the RtpBridge instance. To set Bridge ID use rtpbridge command line argument: -i (or --id). For example, the command:

 /opt/rtpbridge/rtpbridge --id 12

sets the identifier for the RtpBridge instance to 12.
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Channel ID          |           Bridge ID           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Sequence Number: 32 bits
The sequence number increments by one for each HDLC/SS7 data packet sent for the certain Link ID, and may be used by the receiver to detect packet loss and to restore packet sequence. The initial value of the sequence number is 1.
Frame End Code: 32 bits
Frame End Code for HDLC frames. Specifies whether the frame is a good or faulty frame. If the frame is a faulty, then this bit mask provides further indications of the cause of the fault.
Bits 0-1: reserved, must be zero.
Bit 2: (T) 0 = Not truncated, 1 = Truncated:
The received frame was too long for the buffer in the driver.
Bit 3: (A) 0 = Not aborted, 1 = Aborted:
The received frame was aborted.
Bit 4: reserved, must be zero.
Bit 5: (B) 0 = No bad CRC, 1 = Bad CRC:
The frame failed the CRC check.
Bit 6: (O) 0 = No overflow, 1 = Overflow:
Receive Data Overflow. The host is not servicing the receive FIFO fast enough.
Bit 7: (I) 0 = Not invalid, 1 = Invalid:
Invalid frame; Either not a multiple of 8 bits, or a short frame.
Bits 8-31: reserved, must be zero.
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |T|A| |B|O|I| | | | | | | | | | | | | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
If no bits are set, then the frame is a good HDLC frame. No faults.
Timestamp: 64 bits
Timestamp of the HDLC/SS7 frame. Absolute time in 100 nanosecond increments since midnight Jan 1, 1601, often used for time stamps.
Data
The HDLC/SS7 frame.
CRC16: 16 bits
Checksum. This field is optional. By default, CRC16 is not appended, in that case CA flag is not set (see Flags). To leave CRC16 in the packets use the command:

 hdlc leave crc <on|off|yes|no>

that whould be typed before creating of the HDLC-to-UDP connections.