Difference between revisions of "Serial/HDLC"

From TinyOS Wiki
Jump to: navigation, search
(New page: The following table shows several representation formats: {| class="wikitable" border="2" |+ blah blah blah |- ! header 1 !! Header 2 !! Header 3 |- | row 1, cell 1 | row 1, cell 2 | row ...)
 
Line 1: Line 1:
The following table shows several representation formats:
+
{| class="wikitable" style="text-align:center" border="2"
 
+
|+Low Level Serial Packet Format
{| class="wikitable" border="2"
 
|+ blah blah blah
 
|-
 
! header 1 !! Header 2 !! Header 3
 
|-
 
| row 1, cell 1
 
| row 1, cell 2
 
| row 1, cell 3
 
|-
 
| row 2, cell 1
 
| row 2, cell 2
 
| row 2, cell3
 
|-
 
| Dotted decimal
 
| 192.0.2.235
 
| N/A
 
|-
 
| Dotted hexadecimal
 
| 0xC0.0x00.0x02.0xEB
 
| Each octet is individually converted to hexadecimal form
 
 
|-
 
|-
| Dotted octal
+
! style="border-bottom:none; border-right:none;"|
| 0300.0000.0002.0353
+
! style="border-left:none;"| Octet
| Each octet is individually converted into octal
 
|-
 
| Hexadecimal
 
| 0xC00002EB
 
| Concatenation of the octets from the dotted hexadecimal
 
|-
 
| Decimal
 
| 3221226219
 
| The 32-bit number expressed in decimal
 
|-
 
| Octal
 
| 030000001353
 
| The 32-bit number expressed in octal
 
|}
 
 
 
 
 
 
 
 
 
{| class="wikitable" style="text-align:center" border="3"
 
|+IPv4 Header Format
 
|-
 
! style="border-bottom:none; border-right:none;"| ''Offsets''
 
! style="border-left:none;"| [[Octet (computing)|Octet]]
 
 
! colspan="8" | 0
 
! colspan="8" | 0
 
! colspan="8" | 1
 
! colspan="8" | 1
Line 52: Line 9:
 
! colspan="8" | 3
 
! colspan="8" | 3
 
|-
 
|-
! style="border-top: none" | [[Octet (computing)|Octet]]
+
! style="border-top: none" | Octet
! [[Bit]]
+
! Bit
 
! style="width:2.6%;"| 0
 
! style="width:2.6%;"| 0
 
! style="width:2.6%;"| 1
 
! style="width:2.6%;"| 1
Line 89: Line 46:
 
! 0
 
! 0
 
! 0
 
! 0
| colspan="4"|''Version''
+
| colspan="8"| HDLC Flag
| colspan="4"|''IHL''
+
| colspan="8"| Addr (Ser_Proto)
| colspan="6"|''DSCP''
+
| colspan="8"| Ctrl (Seq_Num)
| colspan="2"|''ECN''
+
| colspan="8"| Protocol (dispatch)
| colspan="16"|''Total Length''
 
 
|-
 
|-
 
! 4
 
! 4
 
! 32
 
! 32
| colspan="16"|''Identification''
+
| colspan="32" style="background:#ffd0d0;" | o o o
| colspan="3"|''Flags''
 
| colspan="13"|''Fragment Offset''
 
 
|-
 
|-
! 8
+
! ...
! 64
+
! ...
| colspan="8"|''Time To Live''
+
| colspan="32" style="background:#ffd0d0;" | payload
| colspan="8"|''Protocol''
 
| colspan="16"|''Header Checksum''
 
 
|-
 
|-
! 12
+
! ...
! 96
+
! ...
| colspan="32"|''Source IP Address''
+
| colspan="32" style="background:#ffd0d0;" | o o o
 
|-
 
|-
! 16
+
! ...
! 128
+
! ...
| colspan="32"|''Destination IP Address''
+
| colspan="16" | CRC
 
|-
 
|-
! 20
+
! ...
! 160
+
! ...
| colspan="32" rowspan="4" style="background:#ffd0d0;"|''Options (if IHL > 5)''
+
| colspan="8" | HDLC Flag
 
|}
 
|}
  
; Version : The first header field in an IP [[packet (information technology)|packet]] is the four-bit version field. For IPv4, this has a value of 4 (hence the name IPv4).
 
  
; Internet Header Length (IHL) : The second field (4 bits) is the Internet Header Length (IHL), which is the number of 32-bit [[Word (data type)|words]] in the header. Since an IPv4 header may contain a variable number of options, this field specifies the size of the header (this also coincides with the offset to the data). The minimum value for this field is 5 (RFC 791), which is a length of 5×32 = 160 bits = 20 bytes. Being a 4-bit value, the maximum length is 15 words (15×32 bits) or 480 bits = 60 bytes.
+
See RFC 1662 for more details.
 +
 
 +
 
 +
; HDLC Flag : (framing) 0x7E, HDLC framing byte.  Indicates start of packet.
 +
 
 +
; Addr (Ser_Proto) : HDLC Address byte.   Used to indicate low level serial protocol.
 +
 
 +
; Ctrl (Seq_Num): HDLC Control byte. Used for sequence number.
  
; Differentiated Services Code Point (DSCP)
+
; Protocol (dispatch): HDLC Protocol byte. Used to indicate payload type.
:Originally defined as the [[Type of Service]] field, this field is now defined by RFC 2474 for [[Differentiated services]] (DiffServ). New technologies are emerging that require real-time data streaming and therefore make use of the DSCP field. An example is [[Voice over IP]] (VoIP), which is used for interactive data voice exchange.
 

Revision as of 02:36, 22 October 2012

Low Level Serial Packet Format
Octet 0 1 2 3
Octet Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0 0 HDLC Flag Addr (Ser_Proto) Ctrl (Seq_Num) Protocol (dispatch)
4 32 o o o
... ... payload
... ... o o o
... ... CRC
... ... HDLC Flag


See RFC 1662 for more details.


HDLC Flag 
(framing) 0x7E, HDLC framing byte. Indicates start of packet.
Addr (Ser_Proto) 
HDLC Address byte. Used to indicate low level serial protocol.
Ctrl (Seq_Num)
HDLC Control byte. Used for sequence number.
Protocol (dispatch)
HDLC Protocol byte. Used to indicate payload type.