Typedefs of enums and structs visible to all files that include the library header file.
More...
|
struct | snap_header_t |
| Bit field that stores every field of the frame header. It defines the format of the frame. More...
|
|
struct | snap_fields_t |
| Structure that stores every data necessary to build a new frame (i.e. every field value and size, except the hash bytes). More...
|
|
struct | snap_frame_t |
| This is the main structure of the library, used in frame decoding, encapsulation, and decapsulation. More...
|
|
|
enum | snap_fieldType_t {
SNAP_FIELD_HEADER = 0
, SNAP_FIELD_DEST_ADDRESS = 1
, SNAP_FIELD_SOURCE_ADDRESS = 2
, SNAP_FIELD_PROTOCOL_FLAGS = 3
,
SNAP_FIELD_DATA = 4
, SNAP_FIELD_HASH = 5
} |
| Values that identify each field of a frame. More...
|
|
enum | snap_hdb2_dab_t { SNAP_HDB2_DAB_NO_DEST_ADDRESS = 0
, SNAP_HDB2_DAB_1BYTE_DEST_ADDRESS = 1
, SNAP_HDB2_DAB_2BYTE_DEST_ADDRESS = 2
, SNAP_HDB2_DAB_3BYTE_DEST_ADDRESS = 3
} |
| Values for the DAB field of the HDB2 header byte. It defines the number of destination address bytes. More...
|
|
enum | snap_hdb2_sab_t { SNAP_HDB2_SAB_NO_SOURCE_ADDRESS = 0
, SNAP_HDB2_SAB_1BYTE_SOURCE_ADDRESS = 1
, SNAP_HDB2_SAB_2BYTE_SOURCE_ADDRESS = 2
, SNAP_HDB2_SAB_3BYTE_SOURCE_ADDRESS = 3
} |
| Values for the SAB field of the HDB2 header byte. It defines the number of source address bytes. More...
|
|
enum | snap_hdb2_pfb_t { SNAP_HDB2_PFB_NO_PROTOCOL_FLAGS = 0
, SNAP_HDB2_PFB_1BYTE_PROTOCOL_FLAGS = 1
, SNAP_HDB2_PFB_2BYTE_PROTOCOL_FLAGS = 2
, SNAP_HDB2_PFB_3BYTE_PROTOCOL_FLAGS = 3
} |
| Values for the PFB field of the HDB2 header byte. It defines the number of protocol specific flags bytes. More...
|
|
enum | snap_hdb2_ack_t { SNAP_HDB2_ACK_NOT_REQUESTED = 0
, SNAP_HDB2_ACK_REQUESTED = 1
, SNAP_HDB2_ACK_RESPONSE_ACK = 2
, SNAP_HDB2_ACK_RESPONSE_NACK = 3
} |
| Values for the ACK field of the HDB2 header byte. It defines if the sending node requests an ACK/NACK packet in return. It also acts as the actual ACK/NACK response sent from the receiving node. More...
|
|
enum | snap_hdb1_cmd_t { SNAP_HDB1_CMD_MODE_DISABLED = 0
, SNAP_HDB1_CMD_MODE_ENABLED = 1
} |
| Values for the CMD field of the HDB1 header byte. It indicates whether the command mode is enabled or not. More...
|
|
enum | snap_hdb1_edm_t {
SNAP_HDB1_EDM_NO_ERROR_DETECTION = 0
, SNAP_HDB1_EDM_3_RETRANSMISSION = 1
, SNAP_HDB1_EDM_8BIT_CHECKSUM = 2
, SNAP_HDB1_EDM_8BIT_CRC = 3
,
SNAP_HDB1_EDM_16BIT_CRC = 4
, SNAP_HDB1_EDM_32BIT_CRC = 5
, SNAP_HDB1_EDM_FEC = 6
, SNAP_HDB1_EDM_USER_SPECIFIED = 7
} |
| Values for the EDM field of the HDB1 header byte. It defines the error detection method used on the frame. More...
|
|
enum | snap_hdb1_ndb_t {
SNAP_HDB1_NDB_NO_DATA = 0
, SNAP_HDB1_NDB_1BYTE_DATA = 1
, SNAP_HDB1_NDB_2BYTE_DATA = 2
, SNAP_HDB1_NDB_3BYTE_DATA = 3
,
SNAP_HDB1_NDB_4BYTE_DATA = 4
, SNAP_HDB1_NDB_5BYTE_DATA = 5
, SNAP_HDB1_NDB_6BYTE_DATA = 6
, SNAP_HDB1_NDB_7BYTE_DATA = 7
,
SNAP_HDB1_NDB_8BYTE_DATA = 8
, SNAP_HDB1_NDB_16BYTE_DATA = 9
, SNAP_HDB1_NDB_32BYTE_DATA = 10
, SNAP_HDB1_NDB_64BYTE_DATA = 11
,
SNAP_HDB1_NDB_128BYTE_DATA = 12
, SNAP_HDB1_NDB_256BYTE_DATA = 13
, SNAP_HDB1_NDB_512BYTE_DATA = 14
, SNAP_HDB1_NDB_USER_SPECIFIED = 15
} |
| Values for the NDB field of the HDB1 header byte. It defines the number of data/payload bytes. More...
|
|
enum | snap_status_t {
SNAP_STATUS_IDLE = 0
, SNAP_STATUS_INCOMPLETE = 1
, SNAP_STATUS_VALID = 2
, SNAP_STATUS_ERROR_HASH = -1
,
SNAP_STATUS_ERROR_OVERFLOW = -2
} |
| Values for the frame status. The frame structure will always be in one of these states. More...
|
|
Typedefs of enums and structs visible to all files that include the library header file.
◆ snap_fieldType_t
Values that identify each field of a frame.
Enumerator |
---|
SNAP_FIELD_HEADER | Header (HDB2 and HDB1 bytes).
|
SNAP_FIELD_DEST_ADDRESS | Destination address.
|
SNAP_FIELD_SOURCE_ADDRESS | Source address.
|
SNAP_FIELD_PROTOCOL_FLAGS | Protocol specific flags.
|
SNAP_FIELD_DATA | Data (payload).
|
SNAP_FIELD_HASH | Hash value (checksum, CRC-8, CRC-16, etc).
|
◆ snap_hdb2_dab_t
Values for the DAB field of the HDB2 header byte. It defines the number of destination address bytes.
Enumerator |
---|
SNAP_HDB2_DAB_NO_DEST_ADDRESS | Frame has no destination address.
|
SNAP_HDB2_DAB_1BYTE_DEST_ADDRESS | Frame has a 1-byte destination address.
|
SNAP_HDB2_DAB_2BYTE_DEST_ADDRESS | Frame has a 2-byte destination address.
|
SNAP_HDB2_DAB_3BYTE_DEST_ADDRESS | Frame has a 3-byte destination address.
|
◆ snap_hdb2_sab_t
Values for the SAB field of the HDB2 header byte. It defines the number of source address bytes.
Enumerator |
---|
SNAP_HDB2_SAB_NO_SOURCE_ADDRESS | Frame has no source address.
|
SNAP_HDB2_SAB_1BYTE_SOURCE_ADDRESS | Frame has a 1-byte source address.
|
SNAP_HDB2_SAB_2BYTE_SOURCE_ADDRESS | Frame has a 2-byte source address.
|
SNAP_HDB2_SAB_3BYTE_SOURCE_ADDRESS | Frame has a 3-byte source address.
|
◆ snap_hdb2_pfb_t
Values for the PFB field of the HDB2 header byte. It defines the number of protocol specific flags bytes.
Enumerator |
---|
SNAP_HDB2_PFB_NO_PROTOCOL_FLAGS | Frame has no protocol specific flags.
|
SNAP_HDB2_PFB_1BYTE_PROTOCOL_FLAGS | Frame has 1 byte of protocol specific flags.
|
SNAP_HDB2_PFB_2BYTE_PROTOCOL_FLAGS | Frame has 2 bytes of protocol specific flags.
|
SNAP_HDB2_PFB_3BYTE_PROTOCOL_FLAGS | Frame has 3 bytes of protocol specific flags.
|
◆ snap_hdb2_ack_t
Values for the ACK field of the HDB2 header byte. It defines if the sending node requests an ACK/NACK packet in return. It also acts as the actual ACK/NACK response sent from the receiving node.
Enumerator |
---|
SNAP_HDB2_ACK_NOT_REQUESTED | Sending node does not request an ACK/NACK packet in return.
|
SNAP_HDB2_ACK_REQUESTED | Sending node requests an ACK/NACK packet in return.
|
SNAP_HDB2_ACK_RESPONSE_ACK | Receiving node sends an ACK response.
|
SNAP_HDB2_ACK_RESPONSE_NACK | Receiving node sends an NACK response.
|
◆ snap_hdb1_cmd_t
Values for the CMD field of the HDB1 header byte. It indicates whether the command mode is enabled or not.
A node that implements this functionality can respond to requests from other nodes, even when it does not support the format of the received packet. If the command mode is enabled, the first data byte contains a command byte (request or response). Commands in the range 0~127 are requests, and commands in the range 128~255 are responses. The commands 0/128 are for discovering if the node supports the command mode. The commands 1/129 are for discovering the preferred packet structure of the node. The other command values are reserved but not yet defined.
Enumerator |
---|
SNAP_HDB1_CMD_MODE_DISABLED | Command mode is disabled.
|
SNAP_HDB1_CMD_MODE_ENABLED | Command mode is enabled.
|
◆ snap_hdb1_edm_t
Values for the EDM field of the HDB1 header byte. It defines the error detection method used on the frame.
- Note
- Some options are not fully supported by this library (see the notes).
Enumerator |
---|
SNAP_HDB1_EDM_NO_ERROR_DETECTION | Frame does not contain any information about error detection/correction.
|
SNAP_HDB1_EDM_3_RETRANSMISSION | The sending node must send the same frame 3 times, and the receiving node should compare the frames in order to detect errors. - Note
- Not supported by this library. It produces the same result as EDM = 0.
|
SNAP_HDB1_EDM_8BIT_CHECKSUM | Frame has an 8-bit checksum at the end.
|
SNAP_HDB1_EDM_8BIT_CRC | Frame has an 8-bit CRC at the end.
|
SNAP_HDB1_EDM_16BIT_CRC | Frame has a 16-bit CRC at the end.
|
SNAP_HDB1_EDM_32BIT_CRC | Frame has a 32-bit CRC at the end.
|
SNAP_HDB1_EDM_FEC | Specific FEC (Forward Error Correction) standard to be determined. - Note
- Not supported by this library. It produces the same result as EDM = 0.
|
SNAP_HDB1_EDM_USER_SPECIFIED | Error detection method defined by the user. - Note
- This library only supports methods that append a hash value of up to 4 bytes into the end of the frame (like the CRC options). The user can only define the hash function (by overriding snap_calculateUserHash()) and the hash value size (by overriding SNAP_SIZE_USER_HASH).
|
◆ snap_hdb1_ndb_t
Values for the NDB field of the HDB1 header byte. It defines the number of data/payload bytes.
Enumerator |
---|
SNAP_HDB1_NDB_NO_DATA | Frame has no data bytes.
|
SNAP_HDB1_NDB_1BYTE_DATA | Frame has 1 data byte.
|
SNAP_HDB1_NDB_2BYTE_DATA | Frame has 2 data bytes.
|
SNAP_HDB1_NDB_3BYTE_DATA | Frame has 3 data bytes.
|
SNAP_HDB1_NDB_4BYTE_DATA | Frame has 4 data bytes.
|
SNAP_HDB1_NDB_5BYTE_DATA | Frame has 5 data bytes.
|
SNAP_HDB1_NDB_6BYTE_DATA | Frame has 6 data bytes.
|
SNAP_HDB1_NDB_7BYTE_DATA | Frame has 7 data bytes.
|
SNAP_HDB1_NDB_8BYTE_DATA | Frame has 8 data bytes.
|
SNAP_HDB1_NDB_16BYTE_DATA | Frame has 16 data bytes (it might contain padding bytes).
|
SNAP_HDB1_NDB_32BYTE_DATA | Frame has 32 data bytes (it might contain padding bytes).
|
SNAP_HDB1_NDB_64BYTE_DATA | Frame has 64 data bytes (it might contain padding bytes).
|
SNAP_HDB1_NDB_128BYTE_DATA | Frame has 128 data bytes (it might contain padding bytes).
|
SNAP_HDB1_NDB_256BYTE_DATA | Frame has 256 data bytes (it might contain padding bytes).
|
SNAP_HDB1_NDB_512BYTE_DATA | Frame has 512 data bytes (it might contain padding bytes).
|
SNAP_HDB1_NDB_USER_SPECIFIED | Number of data bytes is defined by the user. - Note
- Not supported by this library. It produces the same result as NDB = 0.
|
◆ snap_status_t
Values for the frame status. The frame structure will always be in one of these states.
Enumerator |
---|
SNAP_STATUS_IDLE | Frame is considered empty (it has not received the sync byte yet). The frame structure must be in this state before decoding a new frame.
|
SNAP_STATUS_INCOMPLETE | Frame has received the sync byte, but it is not complete yet. This state is used only during the decoding process.
|
SNAP_STATUS_VALID | Frame buffer contains a complete and valid frame.
|
SNAP_STATUS_ERROR_HASH | The hash value received does not match the value calculated. This state is used only during the decoding process.
|
SNAP_STATUS_ERROR_OVERFLOW | Frame buffer does not have enough space to store the complete frame.
|