diff --git a/sys/include/net/gcoap.h b/sys/include/net/gcoap.h index fad13ff047ae72af8ba985bc77d70593f32634a4..ea47afd97287aabbc67101841f9b87bac27e8640 100644 --- a/sys/include/net/gcoap.h +++ b/sys/include/net/gcoap.h @@ -214,11 +214,9 @@ #define NET_GCOAP_H #include <stdint.h> -#include <stdatomic.h> #include "net/ipv6/addr.h" #include "net/sock/udp.h" -#include "mutex.h" #include "net/nanocoap.h" #include "xtimer.h" @@ -478,28 +476,6 @@ typedef struct { unsigned token_len; /**< Actual length of token attribute */ } gcoap_observe_memo_t; -/** - * @brief Container for the state of gcoap itself - */ -typedef struct { - mutex_t lock; /**< Shares state attributes safely */ - gcoap_listener_t *listeners; /**< List of registered listeners */ - gcoap_request_memo_t open_reqs[GCOAP_REQ_WAITING_MAX]; - /**< Storage for open requests; if first - byte of an entry is zero, the entry - is available */ - atomic_uint next_message_id; /**< Next message ID to use */ - sock_udp_ep_t observers[GCOAP_OBS_CLIENTS_MAX]; - /**< Observe clients; allows reuse for - observe memos */ - gcoap_observe_memo_t observe_memos[GCOAP_OBS_REGISTRATIONS_MAX]; - /**< Observed resource registrations */ - uint8_t resend_bufs[GCOAP_RESEND_BUFS_MAX][GCOAP_PDU_BUF_SIZE]; - /**< Buffers for PDU for request resends; - if first byte of an entry is zero, - the entry is available */ -} gcoap_state_t; - /** * @brief Initializes the gcoap thread and device * diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index 168a9de5661b4e9e4b2dd9f1af482448a8772694..2487c44d5c3409bd8f006ab9c8294d229101d521 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -19,7 +19,11 @@ */ #include <errno.h> +#include <stdint.h> +#include <stdatomic.h> + #include "net/gcoap.h" +#include "mutex.h" #include "random.h" #include "thread.h" @@ -57,6 +61,26 @@ static gcoap_listener_t _default_listener = { NULL }; +/* Container for the state of gcoap itself */ +typedef struct { + mutex_t lock; /* Shares state attributes safely */ + gcoap_listener_t *listeners; /* List of registered listeners */ + gcoap_request_memo_t open_reqs[GCOAP_REQ_WAITING_MAX]; + /* Storage for open requests; if first + byte of an entry is zero, the entry + is available */ + atomic_uint next_message_id; /* Next message ID to use */ + sock_udp_ep_t observers[GCOAP_OBS_CLIENTS_MAX]; + /* Observe clients; allows reuse for + observe memos */ + gcoap_observe_memo_t observe_memos[GCOAP_OBS_REGISTRATIONS_MAX]; + /* Observed resource registrations */ + uint8_t resend_bufs[GCOAP_RESEND_BUFS_MAX][GCOAP_PDU_BUF_SIZE]; + /* Buffers for PDU for request resends; + if first byte of an entry is zero, + the entry is available */ +} gcoap_state_t; + static gcoap_state_t _coap_state = { .listeners = &_default_listener, };