bRAWcap 1.0.1
b-plus Technologies - Ethernet Performance Transmitter Receiver
|
Types and functions for operating with bRAWcap packets. More...
Macros | |
#define | BRAWCAP_PACKET_SIZE_MAX 9018 |
The maximum supported (byte) size for a single packet payload. | |
#define | BRAWCAP_PACKET_SIZE_MIN 14 |
The minimum required (byte) size for a single packet payload. | |
Typedefs | |
typedef UINT16 | brawcap_packet_size_t |
Type for handling the number of payload bytes per packet. | |
typedef struct _brawcap_packet | brawcap_packet_t |
bRAWcap packet object. | |
Functions | |
brawcap_status_t | brawcap_packet_create (brawcap_packet_t **const pPacket, const brawcap_packet_size_t maxSize) |
Creates a new packet. | |
brawcap_status_t | brawcap_packet_free (brawcap_packet_t *pPacket) |
Frees the specified packet. When this function is called the specified packet becomes invalid and it´s memory is released. | |
brawcap_status_t | brawcap_packet_status_get (brawcap_packet_t *const pPacket, brawcap_status_t *const pStatus) |
Reads out the status for the specified packet. The status will be set updated during reception/transmission. It indicates the status of the packet depending on the operation. | |
brawcap_status_t | brawcap_packet_timestamp_get (brawcap_packet_t *const pPacket, brawcap_timestamp_t **const pTimestamp) |
Reads out the timestamp object for the specified packet. | |
brawcap_status_t | brawcap_packet_length_on_wire_get (brawcap_packet_t *const pPacket, brawcap_packet_size_t *const pLengthOnWire) |
Reads out the length on wire of the specified packet. This value is especially useful for received packets. It indicates the total packet payload byte size of the packet on wire. This may not equal to the captured payload byte size. Because the payload byte size depends on the configured filter and it´s bytes to capture parameters. | |
brawcap_status_t | brawcap_packet_payload_max_size_get (brawcap_packet_t *const pPacket, brawcap_packet_size_t *const pMaxPayloadSize) |
Reads out the max supported payload byte size of the specified packet. This value was set during packet creation (or buffer creation if it´s a buffered packet). | |
brawcap_status_t | brawcap_packet_payload_size_get (brawcap_packet_t *const pPacket, brawcap_packet_size_t *const pLength) |
Reads out the captured payload byte size of the specified packet. This indicates the total byte size of the (captured - if received) packet payload. | |
brawcap_status_t | brawcap_packet_payload_get (brawcap_packet_t *const pPacket, const char **const pPayload, brawcap_packet_size_t *const pLength) |
Reads out the payload of the specified packet. | |
brawcap_status_t | brawcap_packet_payload_set (brawcap_packet_t *const pPacket, const char *const pPayload, const brawcap_packet_size_t length) |
Sets the packet payload of the specified packet. | |
Types and functions for operating with bRAWcap packets.
To create a packet use brawcap_packet_create. If a packet is not required anymore it shall be deleted with brawcap_packet_free.
List of examples:
#define BRAWCAP_PACKET_SIZE_MAX 9018 |
#include <brawcap_types_shared.h>
The maximum supported (byte) size for a single packet payload.
This value corresponds to jumbo frame size (9000 Bytes) + Ethernet header (14 Bytes) + single VLAN header (4 Bytes).
#define BRAWCAP_PACKET_SIZE_MIN 14 |
#include <brawcap_types_shared.h>
The minimum required (byte) size for a single packet payload.
This corresponds to Ethernet header size.
typedef UINT16 brawcap_packet_size_t |
#include <brawcap_types_shared.h>
Type for handling the number of payload bytes per packet.
Typically the packet payload size is set to the adapters max transmission unit (MTU) size + Ethernet header size and maybe a single VLAN header. Packet payload sizes have to be between BRAWCAP_PACKET_SIZE_MIN and BRAWCAP_PACKET_SIZE_MAX, values below/beyond are not accepted.
typedef struct _brawcap_packet brawcap_packet_t |
#include <brawcap_types_shared.h>
bRAWcap packet object.
The packet object has to be used for each packet module function. Packet objects can be created and freed or retrieved from a packet buffer.
brawcap_status_t brawcap_packet_create | ( | brawcap_packet_t **const | pPacket, |
const brawcap_packet_size_t | maxSize | ||
) |
#include <brawcap.h>
Creates a new packet.
A packet can be used for receiving (single packet based) or transmitting (also single packet based).
If a packet is not required anymore it should be freed.
[out] | pPacket | Will contain the new created packet, afterwards. |
[in] | maxSize | The maximum supported byte size for the packet payload. This value cannot be changed after packet creation and determines how much memory is required for the packet. The packet can only contain payloads up to this value. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | Packet payload byte size to low/high. |
BRAWCAP_STATUS_ERROR_FAILED | System error occurred (e.g. out of memory). |
brawcap_status_t brawcap_packet_free | ( | brawcap_packet_t * | pPacket | ) |
#include <brawcap.h>
Frees the specified packet. When this function is called the specified packet becomes invalid and it´s memory is released.
[in] | pPacket | The packet to be freed. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
brawcap_status_t brawcap_packet_status_get | ( | brawcap_packet_t *const | pPacket, |
brawcap_status_t *const | pStatus | ||
) |
#include <brawcap.h>
Reads out the status for the specified packet. The status will be set updated during reception/transmission. It indicates the status of the packet depending on the operation.
[in] | pPacket | The packet to read from. |
[out] | pStatus | Will contain the packet status, afterwards. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
brawcap_status_t brawcap_packet_timestamp_get | ( | brawcap_packet_t *const | pPacket, |
brawcap_timestamp_t **const | pTimestamp | ||
) |
#include <brawcap.h>
Reads out the timestamp object for the specified packet.
[in] | pPacket | The packet to read from. |
[out] | pTimestamp | Will contain the timestamp object of the packet, afterwards. This object can be used by the Timestamp module. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
brawcap_status_t brawcap_packet_length_on_wire_get | ( | brawcap_packet_t *const | pPacket, |
brawcap_packet_size_t *const | pLengthOnWire | ||
) |
#include <brawcap.h>
Reads out the length on wire of the specified packet. This value is especially useful for received packets. It indicates the total packet payload byte size of the packet on wire. This may not equal to the captured payload byte size. Because the payload byte size depends on the configured filter and it´s bytes to capture parameters.
[in] | pPacket | The packet to read from. |
[out] | pLengthOnWire | Will contain the payload byte length on wire, afterwards. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
brawcap_status_t brawcap_packet_payload_max_size_get | ( | brawcap_packet_t *const | pPacket, |
brawcap_packet_size_t *const | pMaxPayloadSize | ||
) |
#include <brawcap.h>
Reads out the max supported payload byte size of the specified packet. This value was set during packet creation (or buffer creation if it´s a buffered packet).
[in] | pPacket | The packet to read from. |
[out] | pMaxPayloadSize | Will contain the max packet payload byte size, afterwards. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
brawcap_status_t brawcap_packet_payload_size_get | ( | brawcap_packet_t *const | pPacket, |
brawcap_packet_size_t *const | pLength | ||
) |
#include <brawcap.h>
Reads out the captured payload byte size of the specified packet. This indicates the total byte size of the (captured - if received) packet payload.
[in] | pPacket | The packet to read from. |
[out] | pLength | Will contain the captured payload byte size, afterwards. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
brawcap_status_t brawcap_packet_payload_get | ( | brawcap_packet_t *const | pPacket, |
const char **const | pPayload, | ||
brawcap_packet_size_t *const | pLength | ||
) |
#include <brawcap.h>
Reads out the payload of the specified packet.
The function returns a pointer to the beginning of the packet payload.
[in] | pPacket | The packet to read from. |
[out] | pPayload | Will contain a pointer to the beginning of the packet payload, afterwards. |
[out] | pLength | Will contain the total length of the packet payload, afterwards. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
brawcap_status_t brawcap_packet_payload_set | ( | brawcap_packet_t *const | pPacket, |
const char *const | pPayload, | ||
const brawcap_packet_size_t | length | ||
) |
#include <brawcap.h>
Sets the packet payload of the specified packet.
[in] | pPacket | The packet to be modified. |
[in] | pPayload | Pointer to the beginning of the payload to set. |
[in] | length | Total byte size of the payload to set. |
Status | Description |
---|---|
BRAWCAP_STATUS_SUCCESS | Success. |
BRAWCAP_STATUS_ERROR_INVALID_POINTER | At least one of the pointer parameters was invalid. |
BRAWCAP_STATUS_ERROR_PARAM_OUT_OF_RANGE | The specified payload size exceeds the packet max payload size. |