GNU Radio 3.4.2 C++ API
|
Read and write ethernet frames. More...
#include <ethernet.h>
Public Member Functions | |
ethernet () | |
~ethernet () | |
bool | open (std::string ifname, int protocol) |
bool | close () |
bool | attach_pktfilter (pktfilter *pf) |
attach packet filter to socket to restrict which packets read sees. | |
const uint8_t * | mac () const |
return 6 byte string containing our MAC address | |
int | fd () const |
Return file descriptor associated with socket. | |
int | read_packet (void *buf, int buflen) |
Read packet from interface. | |
int | read_packet_dont_block (void *buf, int buflen) |
Read packet from interface, but don't block waiting. | |
int | write_packet (const void *buf, int buflen) |
int | write_packetv (const eth_iovec *iov, size_t iovlen) |
Static Public Attributes | |
static const int | MAX_PKTLEN = 1512 |
static const int | MIN_PKTLEN = 64 |
Read and write ethernet frames.
This provides a low level interface to hardware that communicates via raw (non-IP) ethernet frames.
usrp2::ethernet::ethernet | ( | ) |
usrp2::ethernet::~ethernet | ( | ) |
attach packet filter to socket to restrict which packets read sees.
pf | the packet filter |
bool usrp2::ethernet::close | ( | ) |
int usrp2::ethernet::fd | ( | ) | const [inline] |
Return file descriptor associated with socket.
const uint8_t* usrp2::ethernet::mac | ( | ) | const [inline] |
return 6 byte string containing our MAC address
bool usrp2::ethernet::open | ( | std::string | ifname, |
int | protocol | ||
) |
ifname | ethernet interface name, e.g., "eth0" |
protocol | is the ethertype protocol number in network order. Use 0 to receive all protocols. |
int usrp2::ethernet::read_packet | ( | void * | buf, |
int | buflen | ||
) |
Read packet from interface.
buf | where to put the packet |
buflen | maximum length of packet in bytes (should be >= 1528) |
Returned packet includes 14-byte ethhdr
int usrp2::ethernet::read_packet_dont_block | ( | void * | buf, |
int | buflen | ||
) |
Read packet from interface, but don't block waiting.
buf | where to put the packet |
buflen | maximum length of packet in bytes (should be >= 1528) |
Returned packet includes 14-byte ethhdr
int usrp2::ethernet::write_packet | ( | const void * | buf, |
int | buflen | ||
) |
int usrp2::ethernet::write_packetv | ( | const eth_iovec * | iov, |
size_t | iovlen | ||
) |
const int usrp2::ethernet::MAX_PKTLEN = 1512 [static] |
const int usrp2::ethernet::MIN_PKTLEN = 64 [static] |