SatCat5
satcat5::net::Address Class Referenceabstract

Detailed Description

Defines a generic API for sending data to a specific destination, such as a MAC address, IP, or Port.

Each Address object wraps a particular net::Dispatch + net::Address + net::Type, to provide an open_write() method for generic net::Protocols. Every net::Dispatch implementation SHOULD provide a net::Address wrapper.

Implementations are available for sending data to a:

Implementations MUST derive from this class. The child class also maintains any required state for opening and closing connections.

Definition at line 30 of file net_address.h.

#include <net_address.h>

Inheritance diagram for satcat5::net::Address:
[legend]

Public Member Functions

virtual satcat5::net::Dispatchiface () const =0
 Fetch a pointer to the underlying interface. More...
 
virtual satcat5::io::Writeableopen_write (unsigned len)=0
 Open a new frame to the designated address and type. More...
 
virtual void close ()=0
 Close any open connections and revert to idle. More...
 
virtual bool ready () const =0
 Is this address object ready for use? Child MUST override this method.
 
virtual void retry ()
 If this Address is not in the ready() state, reattempt any steps required to do so, such as MAC address resolution. More...
 
virtual bool is_multicast () const =0
 Is the destination a broadcast or multicast address? Child MUST override these method.
 
virtual bool matches_reply_address () const =0
 Does this Address object match the parent interface's current reply address? Multicast destinations should match any source address expected to receive the multicast message. More...
 
virtual bool reply_is_multicast () const =0
 Was the parent interface's incoming message sent to a multicast address? (i.e., Could that message have many other recipients?) Child MUST override this method.
 
virtual void save_reply_address ()=0
 Bind this Address object to the parent interface's current reply address, as provided in net::Dispatch::open_reply(). More...
 
bool write_packet (unsigned nbytes, const void *data)
 All-in-one call that writes an entire packet. More...
 

Member Function Documentation

◆ close()

virtual void satcat5::net::Address::close ( )
pure virtual

Close any open connections and revert to idle.

Child MUST override this method.

Implemented in satcat5::udp::Address, satcat5::ip::Address, satcat5::eth::Address, satcat5::ccsds_spp::Address, and satcat5::test::DebugAddress.

◆ iface()

virtual satcat5::net::Dispatch* satcat5::net::Address::iface ( ) const
pure virtual

Fetch a pointer to the underlying interface.

Child MUST override this method.

Implemented in satcat5::udp::Address, satcat5::ip::Address, satcat5::eth::Address, satcat5::ccsds_spp::Address, and satcat5::test::DebugAddress.

◆ matches_reply_address()

virtual bool satcat5::net::Address::matches_reply_address ( ) const
pure virtual

Does this Address object match the parent interface's current reply address? Multicast destinations should match any source address expected to receive the multicast message.

Child MUST override this method.

Implemented in satcat5::udp::Address, satcat5::ip::Address, satcat5::eth::Address, and satcat5::ccsds_spp::Address.

◆ open_write()

virtual satcat5::io::Writeable* satcat5::net::Address::open_write ( unsigned  len)
pure virtual

Open a new frame to the designated address and type.

Child MUST override this method.

Returns
Zero if sending a frame is not currently possible.

Implemented in satcat5::udp::Address, satcat5::ip::Address, satcat5::eth::Address, satcat5::ccsds_spp::Address, and satcat5::test::DebugAddress.

◆ retry()

virtual void satcat5::net::Address::retry ( )
inlinevirtual

If this Address is not in the ready() state, reattempt any steps required to do so, such as MAC address resolution.

Child SHOULD override this method if applicable.

Reimplemented in satcat5::udp::Address, and satcat5::ip::Address.

Definition at line 52 of file net_address.h.

◆ save_reply_address()

virtual void satcat5::net::Address::save_reply_address ( )
pure virtual

Bind this Address object to the parent interface's current reply address, as provided in net::Dispatch::open_reply().

Child MUST override this method.

Implemented in satcat5::udp::Address, satcat5::ip::Address, satcat5::eth::Address, and satcat5::ccsds_spp::Address.

◆ write_packet()

bool Address::write_packet ( unsigned  nbytes,
const void *  data 
)

All-in-one call that writes an entire packet.

Equivalent to open_write(), io::Writeable::write_bytes(), io::Writeable::write_finalize().

Definition at line 11 of file net_address.cc.


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