libcoap 4.3.5-develop-3afff2d
Loading...
Searching...
No Matches
coap_proxy_internal.h
Go to the documentation of this file.
1/*
2 * coap_proxy_internal.h -- Proxy functions for libcoap
3 *
4 * Copyright (C) 2024-2025 Jon Shallow <supjps-libcoap@jpshallow.com>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see README for terms
9 * of use.
10 */
11
17#ifndef COAP_PROXY_INTERNAL_H_
18#define COAP_PROXY_INTERNAL_H_
19
20#include "coap_internal.h"
21
36
49
56
68 coap_tick_t *tim_rem);
69
78int coap_proxy_remove_association(coap_session_t *session, int send_failure);
79
106 const coap_pdu_t *request,
107 coap_pdu_t *response,
108 coap_resource_t *resource,
109 coap_cache_key_t *cache_key,
110 coap_proxy_server_list_t *server_list);
111
127 const coap_pdu_t *received,
128 coap_cache_key_t **cache_key);
129
152 coap_proxy_server_list_t *server_list);
153
154/*
155 * coap_proxy_local_write() is used to send the PDU for a session created by
156 * coap_new_client_session_proxy() into the proxy logic for onward transmittion.
157 *
158 * @param session The coap_new_client_session_proxy() generated session.
159 * @param pdu The PDU presented to libcoap by coap_send().
160 *
161 * @return The MID used for the transmission, else COAP_INVALID_MID on failure.
162 */
164
165/*
166 * coap_proxy_map_outgoing_request() takes the upstream proxy client session and
167 * maps it back to the incoming request.
168 *
169 * @param ongoing The upstream proxy client session.
170 * @param received The received PDU from hte upstream server.
171 * @param proxy_entry Updated with the proxy server entry definition if not NULL.
172 *
173 * @return The proxy request information, or NULL on mapping failure.
174 */
176 const coap_pdu_t *received,
177 coap_proxy_list_t **proxy_entry);
180#endif /* COAP_PROXY_INTERNAL_H_ */
Pulls together all the internal only header files.
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 th...
int coap_proxy_remove_association(coap_session_t *session, int send_failure)
Remove the upstream proxy connection from list for session.
coap_session_t * coap_new_client_session_proxy_lkd(coap_context_t *context, coap_proxy_server_list_t *server_list)
Creates a new client session to use the proxy logic going to the defined upstream server.
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.
coap_mid_t coap_proxy_local_write(coap_session_t *session, coap_pdu_t *pdu)
void coap_proxy_cleanup(coap_context_t *context)
Close down proxy tracking, releasing any memory used.
struct coap_proxy_req_t * coap_proxy_map_outgoing_request(coap_session_t *ongoing, const coap_pdu_t *received, coap_proxy_list_t **proxy_entry)
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.
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition coap_time.h:143
coap_response_t
Definition coap_net.h:48
int coap_mid_t
coap_mid_t is used to store the CoAP Message ID of a CoAP PDU.
Definition coap_pdu.h:263
CoAP binary data definition with const data.
Definition coap_str.h:64
The CoAP stack's global state is stored in a coap_context_t object.
structure for CoAP PDUs
coap_tick_t idle_timeout_ticks
Idle timeout (0 == no timeout).
coap_session_t * incoming
Incoming session (used if client tracking(.
uint8_t * uri_host_keep
memory for uri.host
coap_proxy_req_t * req_list
Incoming list of request info.
coap_tick_t last_used
Last time entry was used.
coap_uri_t uri
URI info for connection.
coap_session_t * ongoing
Ongoing session.
size_t req_count
Count of incoming request info.
coap_bin_const_t * token_used
coap_cache_key_t * cache_key
coap_session_t * incoming
coap_resource_t * resource
Abstraction of resource that can be attached to coap_context_t.
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
Representation of parsed URI.
Definition coap_uri.h:68