SatCat5
net_address.h
Go to the documentation of this file.
1 // Copyright 2023-2024 The Aerospace Corporation.
3 // This file is a part of SatCat5, licensed under CERN-OHL-W v2 or later.
8 
9 #pragma once
10 
11 #include <satcat5/types.h>
12 
13 namespace satcat5 {
14  namespace net {
30  class Address {
31  public:
34  virtual satcat5::net::Dispatch* iface() const = 0;
35 
39  virtual satcat5::io::Writeable* open_write(unsigned len) = 0;
40 
43  virtual void close() = 0;
44 
47  virtual bool ready() const = 0;
48 
52  virtual void retry() {} // GCOVR_EXCL_LINE
53 
56  virtual bool is_multicast() const = 0;
57 
62  virtual bool matches_reply_address() const = 0;
63 
67  virtual bool reply_is_multicast() const = 0;
68 
72  virtual void save_reply_address() = 0;
73 
77  bool write_packet(unsigned nbytes, const void* data);
78  };
79  }
80 }
Abstract API for writing byte-streams and packets.
Definition: io_writeable.h:24
Defines a generic API for sending data to a specific destination, such as a MAC address,...
Definition: net_address.h:30
virtual bool reply_is_multicast() const =0
Was the parent interface's incoming message sent to a multicast address? (i.e., Could that message ha...
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,...
Definition: net_address.h:52
virtual bool matches_reply_address() const =0
Does this Address object match the parent interface's current reply address? Multicast destinations s...
virtual satcat5::net::Dispatch * iface() const =0
Fetch a pointer to the underlying interface.
virtual void save_reply_address()=0
Bind this Address object to the parent interface's current reply address, as provided in net::Dispatc...
virtual satcat5::io::Writeable * open_write(unsigned len)=0
Open a new frame to the designated address and type.
virtual void close()=0
Close any open connections and revert to idle.
virtual bool is_multicast() const =0
Is the destination a broadcast or multicast address? Child MUST override these method.
bool write_packet(unsigned nbytes, const void *data)
All-in-one call that writes an entire packet.
Definition: net_address.cc:11
The "Dispatch" is a generic interface that knows how to read a designated protocol layer and sort inc...
Definition: net_dispatch.h:36
Basic type aliases and prototypes used throughout SatCat5.