libcoap 4.3.5-develop-19cef11

Internal API for handling CoAP proxies. More...

+ Collaboration diagram for Support:

Data Structures

struct  coap_proxy_req_t
 
struct  coap_proxy_list_t
 

Typedefs

typedef struct coap_proxy_req_t coap_proxy_req_t
 

Functions

void coap_proxy_cleanup (coap_context_t *context)
 Close down proxy tracking, releasing any memory used. More...
 
int coap_proxy_check_timeouts (coap_context_t *context, coap_tick_t now, coap_tick_t *tim_rem)
 Idle timeout inactive proxy sessions as well as return in tim_rem the time to remaining to timeout the inactive proxy. More...
 
void coap_proxy_remove_association (coap_session_t *session, int send_failure)
 
int coap_proxy_forward_request_lkd (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_proxy_forward_response_lkd (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...
 

Detailed Description

Internal API for handling CoAP proxies.

Typedef Documentation

◆ coap_proxy_req_t

Function Documentation

◆ coap_proxy_check_timeouts()

int coap_proxy_check_timeouts ( coap_context_t context,
coap_tick_t  now,
coap_tick_t tim_rem 
)

Idle timeout inactive proxy sessions as well as return in tim_rem the time to remaining to timeout the inactive proxy.

Parameters
contextContext to check against.
nowCurrent time in ticks.
tim_remWhere to update timeout time to the next expiry.
Returns
Return 1 if there is a future expire time, else 0.
+ Here is the caller graph for this function:

◆ coap_proxy_cleanup()

void coap_proxy_cleanup ( coap_context_t context)

Close down proxy tracking, releasing any memory used.

Parameters
contextThe current CoAP context.
+ Here is the caller graph for this function:

◆ coap_proxy_forward_request_lkd()

int coap_proxy_forward_request_lkd ( 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.

Note: This function must be called in the locked state,

Parameters
sessionThe client session.
requestThe client's request PDU.
responseThe response PDU that will get sent back to the client.
resourceThe resource associated with this request.
cache_keyA cache key generated from the request PDU or NULL.
server_listThe upstream server list to connect to.
Returns
1 if success, or 0 if failure (response code set to appropriate value).

◆ coap_proxy_forward_response_lkd()

coap_response_t coap_proxy_forward_response_lkd ( coap_session_t session,
const coap_pdu_t received,
coap_cache_key_t **  cache_key 
)

Forward the returning response back to the appropriate client.

Note: This function must be called in the locked state,

Parameters
sessionThe session handling the response.
receivedThe received PDU.
cache_keyUpdated with the cache key pointer provided to coap_proxy_forward_request_lkd(). The caller should delete this cach key (unless the client request set up an Observe and there will be unsolicited responses).
Returns
One of COAP_RESPONSE_FAIL or COAP_RESPONSE_OK.

◆ coap_proxy_remove_association()

void coap_proxy_remove_association ( coap_session_t session,
int  send_failure 
)
+ Here is the caller graph for this function: