SatCat5
coap_posix.h
1 // Copyright 2024-2025 The Aerospace Corporation.
3 // This file is a part of SatCat5, licensed under CERN-OHL-W v2 or later.
5 // CoAP client/server implementations that require POSIX features.
6 
7 #pragma once
8 #include <satcat5/coap_client.h>
9 #include <satcat5/coap_endpoint.h>
10 #include <vector>
11 
12 namespace satcat5 {
13  namespace coap {
16  public:
19  ManageUdpHeap(satcat5::coap::Endpoint* coap, unsigned size);
20  ~ManageUdpHeap();
21 
23  inline ConnectionUdp* connection(unsigned idx)
24  { return m_connections[idx]; }
25 
26  protected:
28  std::vector<ConnectionUdp*> m_connections;
29  };
30 
36  protected:
40  ~EndpointUdpHeap() {}
41  };
42  }
43 };
Variant of coap::Connection for UDP connections.
CoAP endpoint (i.e., client, server, or combined client+server).
Definition: coap_endpoint.h:41
CoAP client/server implementation that requires POSIX features.
Definition: coap_posix.h:35
EndpointUdpHeap(satcat5::udp::Dispatch *udp, unsigned size)
Constructor binds to the specified UDP interface and immediately allocates each requested Connection ...
Definition: coap_posix.cc:25
Variant of ManageUdp using heap-allocated Connection objects.
Definition: coap_posix.h:15
std::vector< ConnectionUdp * > m_connections
Pointers to heap-allocated Connection objects.
Definition: coap_posix.h:28
ManageUdpHeap(satcat5::coap::Endpoint *coap, unsigned size)
Constructor binds to the specified UDP interface and immediately allocates each requested Connection ...
Definition: coap_posix.cc:12
ConnectionUdp * connection(unsigned idx)
Fetch connection object by index.
Definition: coap_posix.h:23
Connection manager for CoAP endpoints using UDP.
satcat5::udp::Dispatch * udp() const
Pointer to the parent's network interface.
Dispatcher sorts incoming UDP messages by port index.
Definition: udp_dispatch.h:20