libSNAP v1.0.0
Open source C/C++ library for the Scaleable Node Address Protocol (SNAP)
|
Function-like macros defined just for user convenience. Most of them are wrappers for functions and other macros. More...
Get frame content | |
#define | snap_getSync() (SNAP_SYNC) |
Get the value of the sync byte. | |
#define | snap_getHdb2(pFrame) (SNAP_HDB2((pFrame)->buffer)) |
Get the HDB2 byte of a frame. More... | |
#define | snap_getHdb1(pFrame) (SNAP_HDB1((pFrame)->buffer)) |
Get the HDB1 byte of a frame. More... | |
#define | snap_getDab(pFrame) (SNAP_HDB2_DAB((pFrame)->buffer)) |
Get the DAB bits of a frame. More... | |
#define | snap_getSab(pFrame) (SNAP_HDB2_SAB((pFrame)->buffer)) |
Get the SAB bits of a frame. More... | |
#define | snap_getPfb(pFrame) (SNAP_HDB2_PFB((pFrame)->buffer)) |
Get the PFB bits of a frame. More... | |
#define | snap_getAck(pFrame) (SNAP_HDB2_ACK((pFrame)->buffer)) |
Get the ACK bits of a frame. More... | |
#define | snap_getCmd(pFrame) (SNAP_HDB1_CMD((pFrame)->buffer)) |
Get the CMD bit of a frame. More... | |
#define | snap_getEdm(pFrame) (SNAP_HDB1_EDM((pFrame)->buffer)) |
Get the EDM bits of a frame. More... | |
#define | snap_getNdb(pFrame) (SNAP_HDB1_NDB((pFrame)->buffer)) |
Get the NDB bits of a frame. More... | |
#define | snap_getHeader(pFrame, pHeader) (snap_getField(pFrame, pHeader, SNAP_FIELD_HEADER)) |
Get the header of a frame. More... | |
#define | snap_getDestAddress(pFrame, pDestAddr) (snap_getField(pFrame, pDestAddr, SNAP_FIELD_DEST_ADDRESS)) |
Get the destination address of a frame. More... | |
#define | snap_getSourceAddress(pFrame, pSourceAddr) (snap_getField(pFrame, pSourceAddr, SNAP_FIELD_SOURCE_ADDRESS)) |
Get the source address of a frame. More... | |
#define | snap_getProtocolFlags(pFrame, pFlags) (snap_getField(pFrame, pFlags, SNAP_FIELD_PROTOCOL_FLAGS)) |
Get the protocol flags of a frame. More... | |
#define | snap_getData(pFrame, pData) (snap_getField(pFrame, pData, SNAP_FIELD_DATA)) |
Get the data bytes of a frame. More... | |
#define | snap_getHash(pFrame, pHash) (snap_getField(pFrame, pHash, SNAP_FIELD_HASH)) |
Get the hash value of a frame. More... | |
#define | snap_getDataPtr(pFrame) ((pFrame)->buffer + SNAP_INDEX_DATA((pFrame)->buffer)) |
Get the pointer to the first data byte of a frame. More... | |
#define | snap_getBufferPtr(pFrame) ((pFrame)->buffer) |
Get the pointer to the first byte of a frame. More... | |
#define | snap_getStatus(pFrame) ((pFrame)->status) |
Get the frame status (it can be any value from snap_status_t). More... | |
Get field indexes | |
#define | snap_getSyncIndex() (SNAP_INDEX_SYNC) |
Get the index of the sync byte. | |
#define | snap_getHdb2Index() (SNAP_INDEX_HDB2) |
Get the index of the HDB2 byte. | |
#define | snap_getHdb1Index() (SNAP_INDEX_HDB1) |
Get the index of the HDB1 byte. | |
#define | snap_getHeaderIndex() (SNAP_INDEX_HDB2) |
Get the index of the first header byte (HDB2). | |
#define | snap_getDestAddrIndex() (SNAP_INDEX_DAB) |
Get the index of the first (MSB) destination address byte (if there are any). | |
#define | snap_getSourceAddrIndex(pFrame) (SNAP_INDEX_SAB((pFrame)->buffer)) |
Get the index of the first (MSB) source address byte (if there are any). More... | |
#define | snap_getProtFlagsIndex(pFrame) (SNAP_INDEX_PFB((pFrame)->buffer)) |
Get the index of the first (MSB) protocol flags byte (if there are any). More... | |
#define | snap_getDataIndex(pFrame) (SNAP_INDEX_DATA((pFrame)->buffer)) |
Get the index of the first data byte (if there are any). More... | |
#define | snap_getHashIndex(pFrame) (SNAP_INDEX_HASH((pFrame)->buffer)) |
Get the index of the first (MSB) data byte (if there are any). More... | |
Get frame and field sizes | |
#define | snap_getSyncSize() (SNAP_SIZE_SYNC) |
Get the size of the sync field. | |
#define | snap_getHdb2Size() (SNAP_SIZE_HDB2) |
Get the size of the HDB2 field. | |
#define | snap_getHdb1Size() (SNAP_SIZE_HDB1) |
Get the size of the HDB1 field. | |
#define | snap_getHeaderSize() (SNAP_SIZE_HEADER) |
Get the size of the header field. | |
#define | snap_getDestAddrSize(pFrame) (SNAP_HDB2_DAB((pFrame)->buffer)) |
Get the size of the destination address. More... | |
#define | snap_getSourceAddrSize(pFrame) (SNAP_HDB2_SAB((pFrame)->buffer)) |
Get the size of the source address. More... | |
#define | snap_getProtFlagsSize(pFrame) (SNAP_HDB2_PFB((pFrame)->buffer)) |
Get the size of the protocol flags. More... | |
#define | snap_getDataSize(pFrame) (SNAP_SIZE_DATA((pFrame)->buffer)) |
Get the size of the data field. More... | |
#define | snap_getHashSize(pFrame) (SNAP_SIZE_HASH((pFrame)->buffer)) |
Get the size of the hash field. More... | |
#define | snap_getFrameSize(pFrame) ((pFrame)->size) |
Get the current size of a frame (it may be incomplete). More... | |
#define | snap_getBufferSize(pFrame) ((pFrame)->maxSize) |
Get the maximum number of bytes that can be stored in the buffer. More... | |
#define | snap_getFullFrameSize(pFrame) (SNAP_INDEX_HASH((pFrame)->buffer) + SNAP_SIZE_HASH((pFrame)->buffer)) |
Get the size of a frame as if it were complete (based on the header). More... | |
Function-like macros defined just for user convenience. Most of them are wrappers for functions and other macros.
#define snap_getHdb2 | ( | pFrame | ) | (SNAP_HDB2((pFrame)->buffer)) |
Get the HDB2 byte of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getHdb1 | ( | pFrame | ) | (SNAP_HDB1((pFrame)->buffer)) |
Get the HDB1 byte of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getDab | ( | pFrame | ) | (SNAP_HDB2_DAB((pFrame)->buffer)) |
Get the DAB bits of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getSab | ( | pFrame | ) | (SNAP_HDB2_SAB((pFrame)->buffer)) |
Get the SAB bits of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getPfb | ( | pFrame | ) | (SNAP_HDB2_PFB((pFrame)->buffer)) |
Get the PFB bits of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getAck | ( | pFrame | ) | (SNAP_HDB2_ACK((pFrame)->buffer)) |
Get the ACK bits of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getCmd | ( | pFrame | ) | (SNAP_HDB1_CMD((pFrame)->buffer)) |
Get the CMD bit of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getEdm | ( | pFrame | ) | (SNAP_HDB1_EDM((pFrame)->buffer)) |
Get the EDM bits of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getNdb | ( | pFrame | ) | (SNAP_HDB1_NDB((pFrame)->buffer)) |
Get the NDB bits of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getHeader | ( | pFrame, | |
pHeader | |||
) | (snap_getField(pFrame, pHeader, SNAP_FIELD_HEADER)) |
Get the header of a frame.
pFrame | Pointer to the frame structure (*snap_frame_t*). |
pHeader | Pointer to the variable that will store the header (snap_header_t*). |
#define snap_getDestAddress | ( | pFrame, | |
pDestAddr | |||
) | (snap_getField(pFrame, pDestAddr, SNAP_FIELD_DEST_ADDRESS)) |
Get the destination address of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
pDestAddr | Pointer to the variable that will store the address (uint32_t*). |
#define snap_getSourceAddress | ( | pFrame, | |
pSourceAddr | |||
) | (snap_getField(pFrame, pSourceAddr, SNAP_FIELD_SOURCE_ADDRESS)) |
Get the source address of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
pSourceAddr | Pointer to the variable that will store the address (uint32_t*). |
#define snap_getProtocolFlags | ( | pFrame, | |
pFlags | |||
) | (snap_getField(pFrame, pFlags, SNAP_FIELD_PROTOCOL_FLAGS)) |
Get the protocol flags of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
pFlags | Pointer to the variable that will store the flags (uint32_t*). |
#define snap_getData | ( | pFrame, | |
pData | |||
) | (snap_getField(pFrame, pData, SNAP_FIELD_DATA)) |
Get the data bytes of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
pData | Pointer to the byte array that will store the data (uint8_t*). |
#define snap_getHash | ( | pFrame, | |
pHash | |||
) | (snap_getField(pFrame, pHash, SNAP_FIELD_HASH)) |
Get the hash value of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
pHash | Pointer to the variable that will store the hash value (uint32_t*). |
#define snap_getDataPtr | ( | pFrame | ) | ((pFrame)->buffer + SNAP_INDEX_DATA((pFrame)->buffer)) |
Get the pointer to the first data byte of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getBufferPtr | ( | pFrame | ) | ((pFrame)->buffer) |
Get the pointer to the first byte of a frame.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getStatus | ( | pFrame | ) | ((pFrame)->status) |
Get the frame status (it can be any value from snap_status_t).
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getSourceAddrIndex | ( | pFrame | ) | (SNAP_INDEX_SAB((pFrame)->buffer)) |
Get the index of the first (MSB) source address byte (if there are any).
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getProtFlagsIndex | ( | pFrame | ) | (SNAP_INDEX_PFB((pFrame)->buffer)) |
Get the index of the first (MSB) protocol flags byte (if there are any).
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getDataIndex | ( | pFrame | ) | (SNAP_INDEX_DATA((pFrame)->buffer)) |
Get the index of the first data byte (if there are any).
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getHashIndex | ( | pFrame | ) | (SNAP_INDEX_HASH((pFrame)->buffer)) |
Get the index of the first (MSB) data byte (if there are any).
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getDestAddrSize | ( | pFrame | ) | (SNAP_HDB2_DAB((pFrame)->buffer)) |
Get the size of the destination address.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getSourceAddrSize | ( | pFrame | ) | (SNAP_HDB2_SAB((pFrame)->buffer)) |
Get the size of the source address.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getProtFlagsSize | ( | pFrame | ) | (SNAP_HDB2_PFB((pFrame)->buffer)) |
Get the size of the protocol flags.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getDataSize | ( | pFrame | ) | (SNAP_SIZE_DATA((pFrame)->buffer)) |
Get the size of the data field.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getHashSize | ( | pFrame | ) | (SNAP_SIZE_HASH((pFrame)->buffer)) |
Get the size of the hash field.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getFrameSize | ( | pFrame | ) | ((pFrame)->size) |
Get the current size of a frame (it may be incomplete).
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getBufferSize | ( | pFrame | ) | ((pFrame)->maxSize) |
Get the maximum number of bytes that can be stored in the buffer.
pFrame | Pointer to the frame structure (snap_frame_t*). |
#define snap_getFullFrameSize | ( | pFrame | ) | (SNAP_INDEX_HASH((pFrame)->buffer) + SNAP_SIZE_HASH((pFrame)->buffer)) |
Get the size of a frame as if it were complete (based on the header).
pFrame | Pointer to the frame structure (snap_frame_t*). |