-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sys/net/application_layer/gcoap/include: add internal proxy header
- Loading branch information
Showing
1 changed file
with
90 additions
and
0 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
sys/net/application_layer/gcoap/include/forward_proxy_internal.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright (C) 2024 ML!PA Consulting GmbH | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser General | ||
* Public License v2.1. See the file LICENSE in the top level directory for | ||
* more details. | ||
*/ | ||
|
||
/** | ||
* @defgroup net_gcoap_forward_proxy_thread GCoAP Forward Proxy Thread | ||
* @ingroup net_gcoap | ||
* @brief Forward proxy thread implementation for GCoAP | ||
* | ||
* @{ | ||
* | ||
* @file | ||
* @brief Definitions for the GCoAP forward proxy internal communication | ||
* | ||
* @author Mariem Charrada <[email protected]> | ||
*/ | ||
|
||
#ifndef NET_GCOAP_FORWARD_PROXY_INTERNAL_H | ||
#define NET_GCOAP_FORWARD_PROXY_INTERNAL_H | ||
|
||
#include <stdint.h> | ||
#include "net/coap.h" | ||
Check failure on line 26 in sys/net/application_layer/gcoap/include/forward_proxy_internal.h GitHub Actions / static-tests
|
||
#include "net/gcoap.h" | ||
#include "net/sock/udp.h" | ||
#include "ztimer.h" | ||
#include "event.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief client ep structure | ||
*/ | ||
typedef struct { | ||
coap_pkt_t pdu; /**< forward CoAP PDU */ | ||
sock_udp_ep_t server_ep; /**< forward Server endpoint */ | ||
sock_udp_ep_t ep; /**< client endpoint */ | ||
uint16_t mid; /**< message ID */ | ||
uint8_t flags; /**< client flags */ | ||
#if IS_USED(MODULE_NANOCOAP_CACHE) | ||
uint8_t req_etag[COAP_ETAG_LENGTH_MAX]; /**< request ETag */ | ||
#endif | ||
ztimer_t empty_ack_timer; /**< empty ACK timer */ | ||
event_t event; /**< client event */ | ||
} client_ep_t; | ||
|
||
/** | ||
* @brief Stack size for the forward proxy thread | ||
* | ||
*/ | ||
#ifndef GCOAP_PROXY_STACK_SIZE | ||
#define GCOAP_PROXY_STACK_SIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE \ | ||
+ sizeof(coap_pkt_t) + GCOAP_DTLS_EXTRA_STACKSIZE) | ||
#endif | ||
|
||
/** | ||
* @brief Definition of forward proxy thread msgs. | ||
*/ | ||
enum { | ||
GCOAP_FORWARD_PROXY_MSG_SEND, | ||
}; | ||
|
||
/** | ||
* @brief Initialize the forward proxy thread | ||
*/ | ||
void gcoap_forward_proxy_thread_init(void); | ||
|
||
/** | ||
* @brief Forward the CoAP request to the server | ||
* The client endpoint is passed as an argument | ||
* and freed if the send failed. | ||
* | ||
* @param[in] cep client endpoint | ||
* @return @ref gcoap_req_send | ||
*/ | ||
int gcoap_forward_proxy_req_send(client_ep_t *cep); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* NET_GCOAP_FORWARD_PROXY_INTERNAL_H */ | ||
/** | ||
* @} | ||
*/ | ||
Check failure on line 90 in sys/net/application_layer/gcoap/include/forward_proxy_internal.h GitHub Actions / static-tests
|