SatCat5
net_socket.h
Go to the documentation of this file.
1 // Copyright 2021-2025 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/io_buffer.h>
12 #include <satcat5/net_core.h>
13 
14 namespace satcat5 {
15  namespace net {
21  class SocketCore
23  , public satcat5::net::Protocol
24  {
25  public:
27  void close();
28 
30  bool ready_tx() const;
31 
33  bool ready_rx() const;
34 
35  protected:
41  SocketCore(
43  u8* txbuff, unsigned txbytes, unsigned txpkt,
44  u8* rxbuff, unsigned rxbytes, unsigned rxpkt);
45 
47  ~SocketCore() SATCAT5_OPTIONAL_DTOR;
48 
49  private:
52  void data_rcvd(satcat5::io::Readable* src) override;
53  void frame_rcvd(satcat5::io::LimitedRead& src) override;
55 
58  };
59  }
60 }
Extensible transmit and receive buffer.
Definition: io_buffer.h:42
Limited read of next N bytes.
Definition: io_readable.h:255
Abstract API for reading byte-streams and packets.
Definition: io_readable.h:68
Defines a generic API for sending data to a specific destination, such as a MAC address,...
Definition: net_address.h:30
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
Definition: net_protocol.h:28
Buffered I/O for sending and receiving messages over a network.
Definition: net_socket.h:24
bool ready_tx() const
Ready to transmit data?
Definition: net_socket.cc:36
SocketCore(satcat5::net::Address *addr, u8 *txbuff, unsigned txbytes, unsigned txpkt, u8 *rxbuff, unsigned rxbytes, unsigned rxpkt)
Constructs a SocketCore from a saved net::Address and buffer(s).
Definition: net_socket.cc:12
satcat5::net::Address *const m_addr_ptr
Generic handler for a specific protocol and address.
Definition: net_socket.h:57
~SocketCore() SATCAT5_OPTIONAL_DTOR
Constructor and destructor are only accessible to child class.
Definition: net_socket.cc:26
void frame_rcvd(satcat5::io::LimitedRead &src) override
Required event handlers.
Definition: net_socket.cc:61
bool ready_rx() const
Ready to receive data?
Definition: net_socket.cc:40
void close()
Close any open connections.
Definition: net_socket.cc:31
void data_rcvd(satcat5::io::Readable *src) override
Required event handlers.
Definition: net_socket.cc:44
Buffered I/O wrappers for PacketBuffer.
Generic network Dispatch API.