1.. zephyr:code-sample:: coap-server 2 :name: CoAP service 3 :relevant-api: coap coap_service 4 5 Use the CoAP server subsystem to register CoAP resources. 6 7Overview 8******** 9 10This sample shows how to register CoAP resources to a main CoAP service. 11The CoAP server implementation expects all services and resources to be 12available at compile time, as they are put into dedicated sections. 13 14The resource is placed into the correct linker section based on the owning 15service's name. A linker file is required, see ``sections-ram.ld`` for an example. 16 17This demo assumes that the platform of choice has networking support, 18some adjustments to the configuration may be needed. 19 20The sample will listen for requests in the CoAP UDP port (5683) in the 21site-local IPv6 multicast address reserved for CoAP nodes. 22 23The sample exports the following resources: 24 25.. code-block:: none 26 27 /test 28 /seg1/seg2/seg3 29 /query 30 /separate 31 /large 32 /location-query 33 /large-update 34 35These resources allow a good part of the ETSI test cases to be run 36against coap-server. 37 38Building And Running 39******************** 40 41This project has no output in case of success, the correct 42functionality can be verified by using some external tool such as tcpdump 43or wireshark. 44 45See the `net-tools`_ project for more details 46 47This sample can be built and executed on QEMU or native_sim board as 48described in :ref:`networking_with_host`. 49 50Use this command on the host to run the `libcoap`_ implementation of 51the ETSI test cases: 52 53.. code-block:: console 54 55 sudo ./examples/etsi_coaptest.sh -i tap0 2001:db8::1 56 57To build the version supporting the TI CC2520 radio, use the supplied 58prj_cc2520.conf configuration file enabling IEEE 802.15.4. 59 60.. _`net-tools`: https://github.com/zephyrproject-rtos/net-tools 61 62.. _`libcoap`: https://github.com/obgm/libcoap 63 64Wi-Fi 65===== 66 67The IPv4 Wi-Fi support can be enabled in the sample with 68:ref:`Wi-Fi snippet <snippet-wifi-ipv4>`. 69