mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20374 from benpicco/coap_resources_numof-remove
always use nanocoap_resources instead of manually assembling coap_resources[]
This commit is contained in:
commit
597b2ad907
@ -38,6 +38,7 @@ QUIET ?= 1
|
||||
#
|
||||
|
||||
USEMODULE += suit suit_transport_coap
|
||||
USEMODULE += nanocoap_resources
|
||||
|
||||
# enable VFS transport (only works on boards with external storage)
|
||||
USEMODULE += suit_transport_vfs
|
||||
|
@ -22,13 +22,8 @@ static ssize_t _riot_board_handler(coap_pkt_t *pkt, uint8_t *buf, size_t len,
|
||||
COAP_FORMAT_TEXT, (uint8_t*)RIOT_BOARD, strlen(RIOT_BOARD));
|
||||
}
|
||||
|
||||
/* must be sorted by path (ASCII order) */
|
||||
const coap_resource_t coap_resources[] = {
|
||||
COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER,
|
||||
{ "/riot/board", COAP_GET, _riot_board_handler, NULL },
|
||||
|
||||
/* this line adds the whole "/suit"-subtree */
|
||||
SUIT_COAP_SUBTREE,
|
||||
NANOCOAP_RESOURCE(board) {
|
||||
.path = "/riot/board", .methods = COAP_GET, .handler = _riot_board_handler,
|
||||
};
|
||||
|
||||
const unsigned coap_resources_numof = ARRAY_SIZE(coap_resources);
|
||||
NANOCOAP_RESOURCE(suit) SUIT_COAP_SUBTREE;
|
||||
|
@ -26,6 +26,7 @@ USEMODULE += sock_udp
|
||||
# Additional networking modules that can be dropped if not needed
|
||||
USEMODULE += gnrc_icmpv6_echo
|
||||
USEMODULE += nanocoap_sock
|
||||
USEMODULE += nanocoap_resources
|
||||
|
||||
# include this for printing IP addresses
|
||||
USEMODULE += shell_cmds_default
|
||||
|
@ -98,14 +98,10 @@ ssize_t _edhoc_handler(coap_pkt_t *pkt, uint8_t *buf, size_t len, coap_request_c
|
||||
return msg_len;
|
||||
}
|
||||
|
||||
/* must be sorted by path (ASCII order) */
|
||||
const coap_resource_t coap_resources[] = {
|
||||
COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER,
|
||||
{ "/.well-known/edhoc", COAP_POST, _edhoc_handler, NULL },
|
||||
NANOCOAP_RESOURCE(edhoc) {
|
||||
.path = "/.well-known/edhoc", .methods = COAP_POST, .handler = _edhoc_handler
|
||||
};
|
||||
|
||||
const unsigned coap_resources_numof = ARRAY_SIZE(coap_resources);
|
||||
|
||||
int responder_cmd(int argc, char **argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
|
@ -13,6 +13,7 @@ USEMODULE += gnrc_icmpv6_echo
|
||||
|
||||
# Required for nanocoap server
|
||||
USEMODULE += nanocoap_sock
|
||||
USEMODULE += nanocoap_resources
|
||||
|
||||
# include this for printing IP addresses
|
||||
USEMODULE += shell_cmds_default
|
||||
|
@ -78,10 +78,9 @@ ssize_t _flashwrite_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_requ
|
||||
return pkt_pos - (uint8_t*)pkt->hdr;
|
||||
}
|
||||
|
||||
/* must be sorted by path (ASCII order) */
|
||||
const coap_resource_t coap_resources[] = {
|
||||
COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER,
|
||||
{ "/flashwrite", COAP_POST, _flashwrite_handler, &_writer },
|
||||
NANOCOAP_RESOURCE(flashwrite) {
|
||||
.path = "/flashwrite",
|
||||
.methods = COAP_POST,
|
||||
.handler = _flashwrite_handler,
|
||||
.context = &_writer
|
||||
};
|
||||
|
||||
const unsigned coap_resources_numof = ARRAY_SIZE(coap_resources);
|
||||
|
Loading…
Reference in New Issue
Block a user