SatCat5
satcat5::eth::SwitchLogReader Class Referenceabstract

Detailed Description

Read packet-logs from an input stream or network interface.

In buffered mode, the input may be any io::Readable object, either packetized or an undifferentiated byte-stream. In network mode, the input may be any net::Dispatch object. The user specifies the filter value (i.e., EtherType, UDP port, etc.)

Definition at line 264 of file eth_sw_log.h.

#include <eth_sw_log.h>

Inheritance diagram for satcat5::eth::SwitchLogReader:
[legend]
Collaboration diagram for satcat5::eth::SwitchLogReader:
[legend]

Public Member Functions

void set_polling_interval (unsigned msec)
 Set polling interval, in milliseconds. More...
 

Protected Member Functions

 SwitchLogReader (satcat5::io::Readable *src)
 Constructor for buffered mode. More...
 
 SwitchLogReader (satcat5::net::Dispatch *iface, satcat5::net::Type filter)
 Constructor for network mode. More...
 
virtual void log_event (const satcat5::eth::SwitchLogMessage &msg)=0
 The child class MUST override this method. More...
 
void data_rcvd (satcat5::io::Readable *src) override
 The data_rcvd() callback is polled whenever data is available. More...
 
void data_unlink (satcat5::io::Readable *src) override
 Unlink this EventListener from the designated source, because the designated Readable object is being destroyed. More...
 
void frame_rcvd (satcat5::io::LimitedRead &src) override
 Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value. More...
 
void timer_event () override
 Child class MUST override this method.
 
void timer_once (unsigned msec)
 Configure a one-time notification after X milliseconds.
 
void timer_every (unsigned msec)
 Configure a repeating notification every X milliseconds.
 
void timer_stop ()
 Stop all future notifications.
 
unsigned timer_interval () const
 Accessor for recurring timer interval, if one is set.
 
unsigned timer_remaining () const
 Accessor for time to next event, if one is set.
 

Static Protected Member Functions

static unsigned count_timer ()
 Count all objects of this type, including idle timers.
 

Protected Attributes

satcat5::io::Readablem_src
 
satcat5::net::Dispatch *const m_iface
 
satcat5::net::Type m_filter
 Incoming packet filter.
 

Private Member Functions

void query (unsigned elapsed_msec)
 

Private Attributes

satcat5::net::Protocolm_next
 Linked list of Protocols.
 
unsigned m_trem
 
unsigned m_tnext
 

Constructor & Destructor Documentation

◆ SwitchLogReader() [1/2]

SwitchLogReader::SwitchLogReader ( satcat5::io::Readable src)
explicitprotected

Constructor for buffered mode.

Only children should create or destroy the base class.

Definition at line 244 of file eth_sw_log.cc.

◆ SwitchLogReader() [2/2]

SwitchLogReader::SwitchLogReader ( satcat5::net::Dispatch iface,
satcat5::net::Type  filter 
)
protected

Constructor for network mode.

Only children should create or destroy the base class.

Definition at line 252 of file eth_sw_log.cc.

Member Function Documentation

◆ data_rcvd()

void SwitchLogReader::data_rcvd ( satcat5::io::Readable src)
overrideprotectedvirtual

The data_rcvd() callback is polled whenever data is available.

A pointer is provided to assist handlers with multiple sources. Child objects of io::EventListener MUST override this method.

Implements satcat5::io::EventListener.

Definition at line 278 of file eth_sw_log.cc.

◆ data_unlink()

void SwitchLogReader::data_unlink ( satcat5::io::Readable src)
overrideprotectedvirtual

Unlink this EventListener from the designated source, because the designated Readable object is being destroyed.

Child objects of io::EventListener MAY override this method if action is required.

Reimplemented from satcat5::io::EventListener.

Definition at line 286 of file eth_sw_log.cc.

◆ frame_rcvd()

void SwitchLogReader::frame_rcvd ( satcat5::io::LimitedRead src)
overrideprotectedvirtual

Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.

The child class SHOULD read the frame contents from the provided "src" object, which is only valid until the function returns.

To send a reply:

  • Call m_iface->open_reply() to obtain a Writable object. (This also writes out any applicable frame headers.)
  • Write frame contents, then call write_finalize().

The child class MUST override this method.

Implements satcat5::net::Protocol.

Definition at line 288 of file eth_sw_log.cc.

◆ log_event()

virtual void satcat5::eth::SwitchLogReader::log_event ( const satcat5::eth::SwitchLogMessage msg)
protectedpure virtual

The child class MUST override this method.

This callback is notified for each parsed log message.

Implemented in satcat5::eth::SwitchLogToPort, and satcat5::eth::SwitchLogFormatter.

◆ set_polling_interval()

void SwitchLogReader::set_polling_interval ( unsigned  msec)

Set polling interval, in milliseconds.

This method applies to buffered sources only. By default (interval = zero), log descriptors are read and processed immediately. To rate-limit outgoing messages, set the desired polling interval in milliseconds.

Definition at line 267 of file eth_sw_log.cc.


The documentation for this class was generated from the following files: