START_BIT, StartBitMethod

If we need to move the pointer to get it pointing to the field to be decoded then we include a START_BIT clause. We put the START_BIT keyword after the field name plus a call to a suitable method. Here is an example:

FIELD start_again START_BIT (FromStart 0 Bytes)

This is used to reposition the pointer to the start of the layer in the midst of a decode when we have a need to reprocess certain fields. Note that, as the name here implies, we must give a new name to a field that we reprocess in this way. Several methods are provided for repositioning the pointer. The one used here selects a position relative to the start of the layer expressed, as usual, as a count plus a unit specifier. Similarly the method FromEnd allows us to reposition relative to the end of frame. The Move method moves a fixed number of bits or bytes forward or backward from the current position. And the MoveToField method repositions to a named field.