#include "stdint.h"
Go to the source code of this file.
|
enum | packet_error_t {
PACKET_NO_ERROR = 0,
PACKET_NOMEMORY_ERROR,
PACKET_BADBUFFER_ERROR,
PACKET_XMIT_ERROR,
PACKET_IFLOOKUP_ERROR,
PACKET_IFNOTFOUND_ERROR,
PACKET_CREATEMUTEX_ERROR,
PACKET_GETMUTEX_ERROR,
PACKET_RLSMUTEX_ERROR,
PACKET_RECVTIMEOUT_ERROR,
PACKET_RECVFAILED_ERROR,
PACKET_BIND_ERROR
} |
|
|
packet_error_t | mallocPacketHandle (pfhandle_t *pfhandle_r) |
| Allocate memory for the packet handle. More...
|
|
void | freePacketHandle (pfhandle_t pfhandle) |
| Close the packet handle. More...
|
|
packet_error_t | openInterfaceByAddr (pfhandle_t pfhandle, packet_addr_t *addr, int timeout) |
| Opens the interface by link layer address. Uses libpcap. More...
|
|
void | closeInterface (pfhandle_t pfhandle) |
| Close the interface. More...
|
|
packet_error_t | sendFrame (pfhandle_t pfhandle, packet_addr_t *addr, uint16_t ethertype, uint8_t *payload, size_t length) |
| Sends a frame through an interface using libpcap. More...
|
|
packet_error_t | recvFrame (pfhandle_t pfhandle, packet_addr_t *addr, uint8_t *payload, size_t &length) |
| Receives a frame. More...
|
|
packet_error_t | packetBind (struct packet_handle *handle, uint16_t ethertype) |
| Set filters for packet handler. More...
|
|
#define ETHER_ADDR_OCTETS 6 |
Link layer number of octets
#define PACKET_HDR_LENGTH 14 |
Packet header length in bytes
Packet error enumeration. Possible values are:
- PACKET_NO_ERROR;
- PACKET_NOMEMORY_ERROR;
- PACKET_BADBUFFER_ERROR;
- PACKET_XMIT_ERROR;
- PACKET_IFLOOKUP_ERROR;
- PACKET_IFNOTFOUND_ERROR;
- PACKET_CREATEMUTEX_ERROR;
- PACKET_GETMUTEX_ERROR;
- PACKET_RLSMUTEX_ERROR;
- PACKET_RECVTIMEOUT_ERROR;
- PACKET_RECVFAILED_ERROR;
- PACKET_BIND_ERROR;
Close the interface.
- Parameters
-
pfhandle | [in] Packet interface handler |
- Returns
- void
Close the packet handle.
- Parameters
-
pfhandle | [in] Packet handler |
- Returns
- void
Allocate memory for the packet handle.
- Parameters
-
pfhandle_r | [inout] Packet handle type |
- Returns
- void
Opens the interface by link layer address. Uses libpcap.
- Parameters
-
pfhandle | [in] Packet interface handler |
addr | Link layer address |
timeout | Timeout |
- Returns
- Type packet_error_t with the error code
packet_error_t packetBind |
( |
struct packet_handle * |
handle, |
|
|
uint16_t |
ethertype |
|
) |
| |
Set filters for packet handler.
- Parameters
-
handle | [in] packet interface handler |
ethertype | Ethertype |
- Returns
- packet_error_t error codes
Receives a frame.
- Parameters
-
pfhandle | Packet interface handler |
addr | Link layer address |
payload | [out] Data buffer |
length | [out] Data length |
- Returns
- packet_error_t error codes
Sends a frame through an interface using libpcap.
- Parameters
-
pfhandle | Packet Inteface handler |
addr | [in] Link layer address |
ethertype | Ethertype |
payload | [in] Data buffer |
length | Data length |
- Returns
- packet_error_t error codes