|
SatCat5
|
Helper object for writing capture files with multiple sources.
PCAP-NG files can interleave packets from different network interfaces. This class represents one such interface, passing metadata to the io::WritePcap class as needed.
Once loaded into Wireshark, packets from all interfaces will be interleaved. Use display filters to select a specific interface, e.g., frame.interface_id==1 or frame.interface_name=="eth0".
Definition at line 143 of file file_pcap.h.
#include <file_pcap.h>
Public Member Functions | |
| WritePcapInterface (satcat5::io::WritePcap *pcap, const char *label, u16 type=LINKTYPE_ETHERNET) | |
| Constructor adds a new interface to a packet-capture. More... | |
| bool | write_finalize () override |
| Override end-of-packet handling. | |
| unsigned | get_write_space () const override |
| How many bytes can be written without blocking? More... | |
| void | write_abort () override |
| If possible, abort the current partially-written packet. More... | |
| void | write_bytes (unsigned nbytes, const void *src) override |
| Write 0 or more bytes from a buffer. More... | |
| void | write_u8 (u8 data) |
| One of many functions for writing integer/floating point values, see details. More... | |
| void | write_str (const char *str) |
| Write the contents of a null-terminated string. More... | |
| template<class T > | |
| void | write_obj (const T &obj) |
Templated wrapper for any object with the following method: void write_to(satcat5::io::Writeable* wr) const; | |
Protected Member Functions | |
| void | write_next (u8 data) override |
| Write the next byte to the underlying buffer or device. More... | |
| void | write_overflow () override |
| Optional error handling for write overflow. More... | |
| void | write_dst (satcat5::io::Writeable *dst) |
Protected Attributes | |
| satcat5::io::WritePcap *const | m_pcap |
| const u32 | m_id |
| friend | WriteableRedirect |
| friend | LimitedWrite |
| friend | WriteableBroadcast |
Private Attributes | |
| satcat5::io::Writeable * | m_dst |
| WritePcapInterface::WritePcapInterface | ( | satcat5::io::WritePcap * | pcap, |
| const char * | label, | ||
| u16 | type = LINKTYPE_ETHERNET |
||
| ) |
Constructor adds a new interface to a packet-capture.
The WritePcap object MUST be opened in "PCAPNG" mode.
Definition at line 394 of file file_pcap.cc.
|
overridevirtualinherited |
How many bytes can be written without blocking?
Child objects of io::Writeable MUST override this method.
Implements satcat5::io::Writeable.
Definition at line 236 of file io_writeable.cc.
|
overridevirtualinherited |
If possible, abort the current partially-written packet.
Child objects of io::Writeable SHOULD override this method if it is practical to prevent in-progress data from being relayed downstream.
Reimplemented from satcat5::io::Writeable.
Definition at line 239 of file io_writeable.cc.
|
overridevirtualinherited |
Write 0 or more bytes from a buffer.
Child objects of io::Writeable MAY override write_bytes as needed for performance.
Reimplemented from satcat5::io::Writeable.
Definition at line 242 of file io_writeable.cc.
|
overrideprotectedvirtualinherited |
Write the next byte to the underlying buffer or device.
Child objects of io::Writeable MUST override this method.
Implements satcat5::io::Writeable.
Definition at line 248 of file io_writeable.cc.
|
overrideprotectedvirtualinherited |
Optional error handling for write overflow.
Child objects of io::Writeable MAY override this method for error handling.
Reimplemented from satcat5::io::Writeable.
Definition at line 251 of file io_writeable.cc.
|
inherited |
Write the contents of a null-terminated string.
Note: Null-termination is not copied to the output.
Definition at line 180 of file io_writeable.cc.
|
inherited |
One of many functions for writing integer/floating point values, see details.
Several functions are provided for reading and writing scalar types to/from io::Readable and io::Writeable instances. Since there are many of these that are frequently inherited, they are hidden from documentation. These functions follow a shared template:
read_ or write_ prefix.u for unsigned, s for signed, f for floating-point.l suffix if little-endian, no suffix if big-endian.Example: write_s48l is "Write 48 bits (6 bytes) to this
io::Writeable as a signed value in little-endian order".
Definition at line 20 of file io_writeable.cc.