Skip to content

Commit

Permalink
sys/net/application_layer/gcoap/include: add internal proxy header
Browse files Browse the repository at this point in the history
  • Loading branch information
mariemC committed Apr 25, 2024
1 parent a07a21b commit f2d4cd5
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions sys/net/application_layer/gcoap/include/forward_proxy_internal.h
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

View workflow job for this annotation

GitHub Actions / static-tests

Wrong header guard format: --- sys/net/application_layer/gcoap/include/forward_proxy_internal.h +++ sys/net/application_layer/gcoap/include/forward_proxy_internal.h @@ -19,8 +19,8 @@ * @author Mariem Charrada <[email protected]> */ -#ifndef NET_GCOAP_FORWARD_PROXY_INTERNAL_H -#define NET_GCOAP_FORWARD_PROXY_INTERNAL_H +#ifndef FORWARD_PROXY_INTERNAL_H +#define FORWARD_PROXY_INTERNAL_H #include <stdint.h> #include "net/coap.h"
#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

View workflow job for this annotation

GitHub Actions / static-tests

Wrong header guard format: --- sys/net/application_layer/gcoap/include/forward_proxy_internal.h +++ sys/net/application_layer/gcoap/include/forward_proxy_internal.h @@ -84,7 +84,7 @@ } #endif -#endif /* NET_GCOAP_FORWARD_PROXY_INTERNAL_H */ +#endif /* FORWARD_PROXY_INTERNAL_H */ /** * @} */

0 comments on commit f2d4cd5

Please sign in to comment.