SatCat5
posix_utils.h File Reference

Detailed Description

Miscellaneous POSIX wrappers (e.g., heap allocation, log to console...)

For compatibility with microcontrollers, classes in the main "satcat5" folder use a restricted subset of the C/C++ standard library and avoid allocating memory on the heap. As a result, those classes are sometimes less convenient to use. This file defines wrappers and extensions for ease of use on platforms that do not require such limitations. It is compatible with both Linux and Windows platforms.

Definition in file posix_utils.h.

#include <satcat5/eth_switch.h>
#include <satcat5/io_buffer.h>
#include <satcat5/io_core.h>
#include <satcat5/log.h>
#include <satcat5/multi_buffer.h>
#include <satcat5/pkt_buffer.h>
#include <satcat5/timeref.h>
#include <list>
#include <string>
#include <vector>
Include dependency graph for posix_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  satcat5::util::HeapAllocator
 Helper object for heap allocation. More...
 
class  satcat5::eth::SwitchCoreHeap
 Heap-allocated variant of eth::SwitchCore. More...
 
class  satcat5::io::BufferedTee
 BufferedTee copies incoming data to any number of destinations. More...
 
class  satcat5::io::BufferedWriterHeap
 BufferedWriter with heap allocation. More...
 
class  satcat5::io::KeyboardStream
 Stream keyboard input to a Writeable interface. More...
 
class  satcat5::io::MultiBufferHeap
 MultiBuffer with heap allocation. More...
 
class  satcat5::io::PacketBufferHeap
 PacketBuffer with heap allocation (in packet mode). More...
 
class  satcat5::io::PacketBufferTee
 PacketBuffer with optional wiretap(s). More...
 
class  satcat5::io::StreamBufferHeap
 PacketBuffer with heap allocation (in stream mode). More...
 
class  satcat5::io::StreamBufferTee
 PacketBuffer with optional wiretap(s). More...
 
class  satcat5::util::PosixTimer
 Timer object using ctime::clock(). More...
 
class  satcat5::util::PosixTimekeeper
 Link a PosixTimer to the main polling timekeeper. More...
 
class  satcat5::log::ToConsole
 Helper object that prints log::Log messages to console. More...
 

Macros

#define SATCAT5_WIN32   0
 

Functions

std::string satcat5::io::read_str (satcat5::io::Readable *src)
 Read contents of a SatCat5 buffer as a string.
 
void satcat5::util::sleep_msec (unsigned msec)
 Cross-platform wrapper for sleep()/Sleep()/etc.
 
void satcat5::util::service_msec (unsigned total_msec, unsigned msec_per_iter=10)
 Alternate between sleep_msec() and poll::service_all().
 
std::string satcat5::log::format (const satcat5::eth::MacAddr &addr)
 Human-readable formatting for an Ethernet address.
 
std::string satcat5::log::format (const satcat5::ip::Addr &addr)
 Human-readable formatting for an IPv4 address.