|
SatCat5
|
Forward binary packet logs to a network interface.
When used with a software SwitchPort, this class accesses the egress buffer directly, bypassing the switch logic and the normal IP/UDP stack. This avoids creating log messages about forwarded log messages.
When used with a hardware port, duplicates are unavoidable. However, consolidating consecutive messages into a single packet reduces the impact of such overhead.
The recipient can use eth::Socket to receive log packets, then decode the contents using any SwitchLogReader.
Definition at line 342 of file eth_sw_log.h.
#include <eth_sw_log.h>
Public Member Functions | |
| SwitchLogToPort (satcat5::io::Readable *src, satcat5::eth::SwitchPort *dst, satcat5::udp::Dispatch *iface) | |
| Bind this object to a software egress port. More... | |
| SwitchLogToPort (satcat5::io::Readable *src, satcat5::io::Writeable *dst, satcat5::udp::Dispatch *iface) | |
| Bind this object to a hardware egress port. More... | |
| void | connect (const satcat5::eth::MacAddr &addr, const satcat5::eth::MacType &type=satcat5::eth::ETYPE_SWITCH_LOG, const satcat5::eth::VlanTag &vtag=satcat5::eth::VTAG_NONE) |
| Connect to a designated raw-Ethernet address. | |
| void | connect (const satcat5::udp::Addr &addr, const satcat5::udp::Port &port=satcat5::udp::PORT_SWITCH_LOG, const satcat5::eth::VlanTag &vtag=satcat5::eth::VTAG_NONE) |
| Connect to a designated IP/UDP address. | |
| void | close () |
| Close the connection and stop log forwarding. | |
| bool | ready () const |
| Is this connection currently active? | |
| void | log_event (const satcat5::eth::SwitchLogMessage &msg) override |
| Implement the SwitchLogReader callback. | |
| void | set_polling_interval (unsigned msec) |
| Set polling interval, in milliseconds. More... | |
Protected Member Functions | |
| 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::MultiWriterBypass | m_dst_port |
| satcat5::io::Writeable *const | m_dst_raw |
| satcat5::eth::Address | m_eth |
| satcat5::udp::Address | m_udp |
| bool | m_first |
| satcat5::io::Readable * | m_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::Protocol * | m_next |
| Linked list of Protocols. | |
| unsigned | m_trem |
| unsigned | m_tnext |
| SwitchLogToPort::SwitchLogToPort | ( | satcat5::io::Readable * | src, |
| satcat5::eth::SwitchPort * | dst, | ||
| satcat5::udp::Dispatch * | iface | ||
| ) |
Bind this object to a software egress port.
Call connect to start forwarding log packets.
Definition at line 320 of file eth_sw_log.cc.
| SwitchLogToPort::SwitchLogToPort | ( | satcat5::io::Readable * | src, |
| satcat5::io::Writeable * | dst, | ||
| satcat5::udp::Dispatch * | iface | ||
| ) |
Bind this object to a hardware egress port.
Call connect to start forwarding log packets.
Definition at line 334 of file eth_sw_log.cc.
|
overrideprotectedvirtualinherited |
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.
|
overrideprotectedvirtualinherited |
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.
|
overrideprotectedvirtualinherited |
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:
The child class MUST override this method.
Implements satcat5::net::Protocol.
Definition at line 288 of file eth_sw_log.cc.
|
inherited |
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.