The Header Section

/* Internet Protocol version 4. Copyright 2000-2016 Teledyne LeCroy. All rights reserved. */ "IPv4" 0x7f000401

A decoder module normally starts with a comment that:

  • References the protocol specification document used (Internet Protocol version 4)

  • Names the author (Teledyne LeCroy)

  • And usually includes a copyright notice (Copyright 2000-2001 All right reserved)

These three comments are optional as indeed are all comments. However, we highly recommend using comments as they may later serve as a reference source for you or other engineers who may use your decoder.

The syntax of a comment matches that used by the C++ programming language. There are two types of comments. One opens with a slash and an asterisk and closes with an asterisk and a slash; in each case, the pair of characters must be written together with no intervening space. Such a comment may extend over several lines. The other type of comment starts with two slashes and ends at the end of the line. Comments may appear anywhere.

The first required statement in the header identifies the protocol by name and id number. The protocol name, "IPv4" is the general name of the protocol typically expressed here in an abbreviated form. This name appears in the Protocol Stack Wizard and in the Decode Pane to indicate the protocol layer, so it is appropriate to choose a form that is suitable for these contexts.

The protocol name is followed by the decoder ID, 0x7f000401. Every protocol must have a unique id. Such IDs are expressed as hexadecimal numbers by convention, but can also be expressed in decimal. When expressed in hex, a "0x" is required before the number and must contain a minimum of 4 hex digits

Within a statement, items are always separated by spaces, never by commas or any other character. The protocol-identification statement has an optional third item which specifies the data order. Multi-byte fields within a protocol are interpreted in either network data order or host data order. The default data order for the decoder may be selected by including either "HOST_DATA_ORDER " or "NETWORK_DATA_ORDER ". Whichever is selected may be overridden as necessary on a per-field basis. If you omit the third item in the protocol-id statement then the default is "NETWORK_DATA_ORDER ".