SatCat5
hal_pcap.h File Reference

Detailed Description

Wrapper for PCAP / NPCAP socket library and supporting functions.

PCAP is a cross-platform API for sending and receiving raw Ethernet frames. To use these utilities, install the library for your host operating system:

This file defines a class that converts a PCAP Layer-2 socket to a SatCat5 Writeable/Readable stream, which can be used to send and receive Ethernet frames. It also defines functions for listing and selecting an interface from the list provided by the PCAP API.

Note: Use of these tools may require root/admin privileges.

Definition in file hal_pcap.h.

#include <deque>
#include <string>
#include <satcat5/ethernet.h>
#include <satcat5/io_buffer.h>
#include <satcat5/polling.h>
Include dependency graph for hal_pcap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  satcat5::pcap::Socket
 Adapter for a PCAP Layer-2 socket. More...
 
struct  satcat5::pcap::Descriptor
 Structure for holding a device-name and user-readable description. More...
 

Typedefs

typedef std::deque< satcat5::pcap::Descriptorsatcat5::pcap::DescriptorList
 

Functions

satcat5::pcap::DescriptorList satcat5::pcap::list_all_devices ()
 Fetch a list of Ethernet device descriptors. More...
 
bool satcat5::pcap::is_device (const char *ifname)
 Check if a given name is on the list from list_all_devices.
 
std::string satcat5::pcap::prompt_for_ifname ()
 Print a list of Ethernet devices, and select by index. More...
 

Function Documentation

◆ list_all_devices()

spcap::DescriptorList satcat5::pcap::list_all_devices ( )

Fetch a list of Ethernet device descriptors.

See also
hal_pcap.h, pcap::Socket, prompt_for_ifname

Definition at line 103 of file hal_pcap.cc.

◆ prompt_for_ifname()

std::string satcat5::pcap::prompt_for_ifname ( )

Print a list of Ethernet devices, and select by index.

Returns the "name" field from the selected Descriptor.

See also
hal_pcap.h, pcap::Socket, list_all_devices

Definition at line 131 of file hal_pcap.cc.