mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
nanocoap: don't hide coap_request_ctx_t content
This commit is contained in:
parent
fd42f72b20
commit
8a11ca2f87
@ -239,11 +239,6 @@ typedef struct {
|
||||
/**
|
||||
* @brief Forward declaration of internal CoAP resource request handler context
|
||||
*/
|
||||
struct _coap_request_ctx;
|
||||
|
||||
/**
|
||||
* @brief CoAP resource request handler context
|
||||
*/
|
||||
typedef struct _coap_request_ctx coap_request_ctx_t;
|
||||
|
||||
/**
|
||||
@ -322,33 +317,32 @@ typedef const struct {
|
||||
const size_t resources_numof; /**< number of entries in array */
|
||||
} coap_resource_subtree_t;
|
||||
|
||||
/**
|
||||
* @brief Size of the CoAP request context struct
|
||||
*/
|
||||
#define COAP_REQUEST_CTX_SIZE (2 * sizeof(void *) + \
|
||||
IS_USED(MODULE_GCOAP) * sizeof(uint32_t))
|
||||
|
||||
/**
|
||||
* @brief Define and initialize CoAP request context struct
|
||||
*
|
||||
* @param[in] ctx Name of the request context variable
|
||||
* @param[in] remote Remote endpoint that made the request
|
||||
*/
|
||||
#define COAP_REQUEST_CTX_INIT(ctx, remote) \
|
||||
uint8_t ctx ## _buffer[COAP_REQUEST_CTX_SIZE]; \
|
||||
coap_request_ctx_t *ctx = (void *)ctx ## _buffer; \
|
||||
coap_request_ctx_init(ctx, remote)
|
||||
|
||||
/**
|
||||
* @brief Initialize CoAP request context
|
||||
* Called by @ref COAP_REQUEST_CTX_INIT
|
||||
* @internal
|
||||
*
|
||||
* @param[in] ctx Pointer to the request context to initialize
|
||||
* @param[in] remote Remote endpoint that made the request
|
||||
*/
|
||||
void coap_request_ctx_init(coap_request_ctx_t *ctx, sock_udp_ep_t *remote);
|
||||
|
||||
/**
|
||||
* @brief CoAP resource request handler context
|
||||
* @internal
|
||||
*/
|
||||
struct _coap_request_ctx {
|
||||
const coap_resource_t *resource; /**< resource of the request */
|
||||
sock_udp_ep_t *remote; /**< remote endpoint of the request */
|
||||
#if defined(MODULE_GCOAP) || DOXYGEN
|
||||
/**
|
||||
* @brief transport the packet was received over
|
||||
* @see @ref gcoap_socket_type_t for values.
|
||||
* @note @ref gcoap_socket_type_t can not be used, as this would
|
||||
* cyclically include the @ref net_gcoap header.
|
||||
*/
|
||||
uint32_t tl_type;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Get resource path associated with a CoAP request
|
||||
*
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "net/coap.h"
|
||||
#include "net/gcoap.h"
|
||||
#include "net/gcoap/forward_proxy.h"
|
||||
#include "nanocoap_internal.h"
|
||||
#include "net/nanocoap/cache.h"
|
||||
#include "net/sock/async/event.h"
|
||||
#include "net/sock/util.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bitarithm.h"
|
||||
#include "nanocoap_internal.h"
|
||||
#include "net/nanocoap.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
@ -1262,9 +1262,6 @@ unsigned coap_get_len(coap_pkt_t *pkt)
|
||||
|
||||
void coap_request_ctx_init(coap_request_ctx_t *ctx, sock_udp_ep_t *remote)
|
||||
{
|
||||
static_assert(COAP_REQUEST_CTX_SIZE == sizeof(coap_request_ctx_t),
|
||||
"COAP_REQUEST_CTX_SIZE define does not match actual size");
|
||||
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
ctx->remote = remote;
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup net_nanocoap
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief NanoCoAP internals
|
||||
*
|
||||
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
|
||||
*/
|
||||
|
||||
#ifndef NANOCOAP_INTERNAL_H
|
||||
#define NANOCOAP_INTERNAL_H
|
||||
|
||||
#include "net/nanocoap.h"
|
||||
#if defined(MODULE_SOCK_UDP) || defined(DOXYGEN)
|
||||
#include "net/sock/udp.h"
|
||||
#else
|
||||
typedef void sock_udp_ep_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Internal CoAP resource request handler context
|
||||
*/
|
||||
struct _coap_request_ctx {
|
||||
const coap_resource_t *resource; /**< resource of the request */
|
||||
sock_udp_ep_t *remote; /**< remote endpoint of the request */
|
||||
#if defined(MODULE_GCOAP) || DOXYGEN
|
||||
/**
|
||||
* @brief transport the packet was received over
|
||||
* @see @ref gcoap_socket_type_t for values.
|
||||
* @note @ref gcoap_socket_type_t can not be used, as this would
|
||||
* cyclically include the @ref net_gcoap header.
|
||||
*/
|
||||
uint32_t tl_type;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* NANOCOAP_INTERNAL_H */
|
||||
/** @} */
|
@ -26,7 +26,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "atomic_utils.h"
|
||||
#include "nanocoap_internal.h"
|
||||
#include "net/nanocoap_sock.h"
|
||||
#include "net/sock/util.h"
|
||||
#include "net/sock/udp.h"
|
||||
|
Loading…
Reference in New Issue
Block a user