Skip to content

Commit

Permalink
Merge pull request #2888 from arurke/aru/allow-disabling-coap-well-known
Browse files Browse the repository at this point in the history
Allow disabling CoAP well known resource
  • Loading branch information
nfi committed May 9, 2024
2 parents 92c2cfb + c97ac50 commit 733876e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions os/net/app-layer/coap/coap-conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,10 @@
#define COAP_OBSERVER_URL_LEN 20
#endif

/* Enable the well-known resource (well-known/core) by default */
#ifndef COAP_WELL_KNOWN_RESOURCE_ENABLED
#define COAP_WELL_KNOWN_RESOURCE_ENABLED 1
#endif

#endif /* COAP_CONF_H_ */
/** @} */
6 changes: 5 additions & 1 deletion os/net/app-layer/coap/coap-engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ call_service(coap_message_t *request, coap_message_t *response,
/*- Server Part -------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

/* the discover resource is automatically included for CoAP */
#if COAP_WELL_KNOWN_RESOURCE_ENABLED
/* The discover resource is included by default for CoAP */
extern coap_resource_t res_well_known_core;
#endif

/*---------------------------------------------------------------------------*/
/*- Internal API ------------------------------------------------------------*/
Expand Down Expand Up @@ -380,7 +382,9 @@ coap_engine_init(void)
list_init(coap_handlers);
list_init(coap_resource_services);

#if COAP_WELL_KNOWN_RESOURCE_ENABLED
coap_activate_resource(&res_well_known_core, ".well-known/core");
#endif

coap_transport_init();
coap_init_connection();
Expand Down

0 comments on commit 733876e

Please sign in to comment.