|
SatCat5
|
CoAP endpoint (i.e., client, server, or combined client+server).
This class implements a user-extensible endpoint (i.e., a client or server or both) for the Constrained Applications Protocol (CoAP): https://www.rfc-editor.org/rfc/rfc7252
As defined in RFC7252, CoAP endpoints are a "client" whenever they issue a request, or a "server" whenever they respond to one. In practical terms, either requires a coap::Connection object for each open transaction. That object automatically handles retransmission and timeouts to ensure reliable delivery of requests and responses.
This file defines the coap::Endpoint base class. This class binds the shared port for incoming connection(s) and forwards them to the appropriate coap::Connection object. User-defined CoAP systems must inherit from this class, override the "coap_*" methods, and allocate one or more coap::Connection objects.
All Connection objects must be the same type (i.e., ConnectionSpp or ConnectionUdp), mixed types are not allowed. To add the appropriate connect() method, inherit from ManageSpp or ManageUdp.
Endpoints (and associatec coap::Connection objects) can be connected over UDP (coap::EndpointUdp) or over CCSDS-SPP (coap::EndpointSpp). For cross-protocol forwarding, see coap::EndpointSppFwd.
Definition at line 41 of file coap_endpoint.h.
#include <coap_endpoint.h>
Public Member Functions | |
| satcat5::net::Dispatch * | iface () const |
| Fetch the associated network interface. | |
| satcat5::udp::Port | srcport () const |
| For UDP only, query the local port number. | |
| Connection * | find_token (u32 token) const |
| Scan connections for a matching proxy-ID. More... | |
| satcat5::coap::Connection * | get_idle_connection () const |
| Get the first idle connection, or null if all are busy. | |
| void | set_connection (satcat5::coap::Connection *obj) |
| Set the preferred connection for outgoing requests. More... | |
| void | set_filter (const satcat5::net::Type &filter) |
| Set network interface filter. More... | |
Protected Member Functions | |
| Endpoint (satcat5::net::Dispatch *iface) | |
| Constructor is only accessible to the child object. | |
| 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 | add_connection (Connection *item) |
| void | remove_connection (Connection *item) |
| bool | reply (u8 type, const satcat5::coap::ReadHeader *msg) |
| virtual void | coap_request (Connection *obj, Reader *msg) |
| The Child class overrides these event-handlers: More... | |
| virtual void | coap_response (Connection *obj, Reader *msg) |
| The Child class overrides these event-handlers: More... | |
| virtual void | coap_reqwait (Connection *obj, Reader *msg) |
| The Child class overrides these event-handlers: More... | |
| virtual void | coap_separate (Connection *obj, Reader *msg) |
| The Child class overrides these event-handlers: More... | |
| virtual void | coap_error (Connection *obj) |
| The Child class overrides these event-handlers: More... | |
| virtual void | coap_ping (const Reader *msg) |
| The Child class overrides these event-handlers: More... | |
| virtual void | coap_timeout (Connection *obj) |
| The Child class overrides these event-handlers: More... | |
Protected Attributes | |
| satcat5::net::Dispatch *const | m_iface |
| satcat5::util::List< satcat5::coap::Connection > | m_list |
| satcat5::coap::Connection * | m_prefer |
| satcat5::coap::Endpoint * | m_aux_ep |
| satcat5::net::Type | m_filter |
| Incoming packet filter. | |
Private Attributes | |
| satcat5::net::Protocol * | m_next |
| Linked list of Protocols. | |
|
inlineprotectedvirtual |
The Child class overrides these event-handlers:
Reimplemented in satcat5::coap::ProxyServer, and satcat5::coap::EndpointSppFwd.
Definition at line 106 of file coap_endpoint.h.
|
inlineprotectedvirtual |
The Child class overrides these event-handlers:
Reimplemented in satcat5::coap::EndpointSppFwd.
Definition at line 107 of file coap_endpoint.h.
|
inlineprotectedvirtual |
The Child class overrides these event-handlers:
Reimplemented in satcat5::coap::ResourceServer, and satcat5::coap::EndpointSppFwd.
Definition at line 101 of file coap_endpoint.h.
|
inlineprotectedvirtual |
The Child class overrides these event-handlers:
Reimplemented in satcat5::coap::ProxyServer.
Definition at line 104 of file coap_endpoint.h.
|
inlineprotectedvirtual |
The Child class overrides these event-handlers:
Reimplemented in satcat5::coap::SimpleClient, satcat5::coap::ProxyServer, and satcat5::coap::EndpointSppFwd.
Definition at line 103 of file coap_endpoint.h.
|
inlineprotectedvirtual |
The Child class overrides these event-handlers:
Reimplemented in satcat5::coap::ProxyServer.
Definition at line 105 of file coap_endpoint.h.
|
inlineprotectedvirtual |
The Child class overrides these event-handlers:
Definition at line 108 of file coap_endpoint.h.
| Connection * Endpoint::find_token | ( | u32 | token | ) | const |
Scan connections for a matching proxy-ID.
Definition at line 40 of file coap_endpoint.cc.
|
overrideprotectedvirtual |
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 56 of file coap_endpoint.cc.
|
inline |
Set the preferred connection for outgoing requests.
Usually called indirectly through ManageSpp or ManageUdp.
Definition at line 58 of file coap_endpoint.h.
|
inline |
Set network interface filter.
Usually called indirectly through ManageSpp or ManageUdp.
Definition at line 63 of file coap_endpoint.h.