libcoap 4.3.5-develop-19cef11
|
API for Proxies. More...
Data Structures | |
struct | coap_proxy_server_t |
struct | coap_proxy_server_list_t |
Typedefs | |
typedef struct coap_proxy_server_t | coap_proxy_server_t |
typedef struct coap_proxy_server_list_t | coap_proxy_server_list_t |
Enumerations | |
enum | coap_proxy_t { COAP_PROXY_REVERSE , COAP_PROXY_REVERSE_STRIP , COAP_PROXY_FORWARD , COAP_PROXY_FORWARD_STRIP , COAP_PROXY_DIRECT , COAP_PROXY_DIRECT_STRIP } |
Functions | |
int | coap_verify_proxy_scheme_supported (coap_uri_scheme_t scheme) |
Verify that the CoAP Scheme is supported for an ongoing proxy connection. More... | |
int COAP_API | coap_proxy_forward_request (coap_session_t *session, const coap_pdu_t *request, coap_pdu_t *response, coap_resource_t *resource, coap_cache_key_t *cache_key, coap_proxy_server_list_t *server_list) |
Forward incoming request upstream to the next proxy/server. More... | |
coap_response_t COAP_API | coap_proxy_forward_response (coap_session_t *session, const coap_pdu_t *received, coap_cache_key_t **cache_key) |
Forward the returning response back to the appropriate client. More... | |
API for Proxies.
typedef struct coap_proxy_server_list_t coap_proxy_server_list_t |
typedef struct coap_proxy_server_t coap_proxy_server_t |
enum coap_proxy_t |
Definition at line 27 of file coap_proxy.h.
int COAP_API coap_proxy_forward_request | ( | coap_session_t * | session, |
const coap_pdu_t * | request, | ||
coap_pdu_t * | response, | ||
coap_resource_t * | resource, | ||
coap_cache_key_t * | cache_key, | ||
coap_proxy_server_list_t * | server_list | ||
) |
Forward incoming request upstream to the next proxy/server.
Possible scenarios: Acting as a reverse proxy - connect to internal server (possibly round robin load balancing over multiple servers). Acting as a forward proxy - connect to host defined in Proxy-Uri or Proxy-Scheme with Uri-Host (and maybe Uri-Port). Acting as a relay proxy - connect to defined upstream server (possibly round robin load balancing over multiple servers).
A request that should go direct to this server is not supported here.
session | The client session. |
request | The client's request PDU. |
response | The response PDU that will get sent back to the client. |
resource | The resource associated with this request. |
cache_key | A cache key generated from the request PDU or NULL. |
server_list | The upstream server list to connect to. |
1
if success, or 0
if failure (response
code set to appropriate value). Definition at line 886 of file coap_proxy.c.
coap_response_t COAP_API coap_proxy_forward_response | ( | coap_session_t * | session, |
const coap_pdu_t * | received, | ||
coap_cache_key_t ** | cache_key | ||
) |
Forward the returning response back to the appropriate client.
session | The session handling the response. |
received | The received PDU. |
cache_key | Updated with the cache key pointer provided to coap_proxy_forward_request(). The caller should delete this cach key (unless the client request set up an Observe and there will be unsolicited responses). |
Definition at line 902 of file coap_proxy.c.
int coap_verify_proxy_scheme_supported | ( | coap_uri_scheme_t | scheme | ) |
Verify that the CoAP Scheme is supported for an ongoing proxy connection.
scheme | The CoAP scheme to check. |
1
if supported, or 0
if not supported. Definition at line 912 of file coap_proxy.c.