Understanding network protocol specifications

1

I would like to understand the typical format table of a network communication message, in the specification of any protocol.

For example ( link ):

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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Type      |R|A|    Reserved     |Prefix Sz|   Hop Count   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Destination IP address                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                  Destination Sequence Number                  |

What does each column mean? Is it a byte? A bit?

And, what puzzles me even more, I do not know how to interpret the rows. It is assumed that a message is linear, one bit after another, so I do not understand how to interpret the rows.

I would also appreciate if you could show me an example of how to implement it in any programming language.

    
asked by Saúl Ortega 08.04.2017 в 03:11
source

1 answer

1

In the case that you show each column represents one bit. That is also obvious if you check what types of data the fields contain - a 32-bit IP makes a lot of sense, an IP with 32 bytes would be a bit exaggerated;)

The data is linear - the second row is bit 32-63, the third 64-95 etc.

In the case of the RREP, it means:

  • type: 1 byte, value 2
  • flags: 2 byte of that 1 bit flag repair, 1 bit flag ACK, ultimpos 5 bit prefix
  • hops: 1 byte (the maximum of the jumps to the peer
  • Destination IP: 4 byte
  • ...
answered by 08.04.2017 / 03:22
source