43 #include <satcat5/coap_connection.h>
61 const char* local_uri,
64 const char* fwd_uri =
nullptr);
87 const char*
const m_fwd_uri;
CoAP request/response handling for a single client-server connection.
Variant of coap::Connection for UDP connections.
satcat5::udp::Dispatch * udp() const
Pointer to the parent's network interface.
Define a reverse-proxy CoAP resource.
bool request_get(Connection *obj, Reader *msg) override
Forward GET, POST, PUT, and DELETE requests.
ProxyResource(satcat5::coap::ProxyServer *server, const char *local_uri, const satcat5::ip::Addr &fwd_addr, const satcat5::udp::Port &fwd_port, const char *fwd_uri=nullptr)
Constructor sets the URI path for the resource.
bool request_any(Connection *obj, Reader *msg)
Event handler for all incoming requests.
bool request_delete(Connection *obj, Reader *msg) override
Forward GET, POST, PUT, and DELETE requests.
bool request_put(Connection *obj, Reader *msg) override
Forward GET, POST, PUT, and DELETE requests.
bool request_post(Connection *obj, Reader *msg) override
Forward GET, POST, PUT, and DELETE requests.
CoAP server with a mix of local and reverse-proxy resources.
void coap_response(Connection *obj, Reader *msg) override
The Child class overrides these event-handlers:
u16 m_msgid
Counter for outgoing message-IDs.
void proxy_response(Connection *client, Reader *msg)
Internal handler for proxy responses.
u32 next_token()
Unique transaction tokens match client and server.
Connection * find_client(u32 token) const
Given a token, find associated client connection.
void coap_reqwait(Connection *obj, Reader *msg) override
The Child class overrides these event-handlers:
u32 m_token
Counter for client/server tokens.
ProxyServer(satcat5::udp::Dispatch *udp, satcat5::udp::Port port=satcat5::udp::PORT_COAP)
Constructor. By default, bind this server to port 5683.
virtual void local_response(Connection *obj, Reader *msg)
Event handler for non-proxy responses.
ConnectionUdp * find_server(u32 token) const
Given a token, find associated server connection.
satcat5::coap::ConnectionUdp m_extra_connection
Proxy operation requires at least two ConnectionUdp objects.
void coap_error(Connection *obj) override
The Child class overrides these event-handlers:
void coap_separate(Connection *obj, Reader *msg) override
The Child class overrides these event-handlers:
u16 next_msgid()
Outgoing messages are numbered sequentially.
Base-class for parsing CoAP message headers and options.
Define a single CoAP resource.
Manager for several Resource objects available on an Endpoint.
Dispatcher sorts incoming UDP messages by port index.
CoAP resource handler definition and resource server creation.
IPv4 address is a 32-bit unsigned integer.
UDP and TCP ports are both 16-bit unsigned integers.
Miscellaneous mathematical utility functions.