Files
libcoap/README.md
T
Jon Shallow 7033555d29 RFC8768: Add in support for CoAP Option Hop Limit loop detection
All this is handled by libcoap with coap-client having the ability to define
an initial Hop Count value for testing. No other application support is
required.

Incoming requests are checked for the Hop Limit option - if found, the value
is decremented in the PDU before passing it up to the application. If it
decrements to 0, a 5.08 response is generated.

coap_add_option() checks if this is a Proxy option for a request. If so, and
Hop Limit option does not exist, then the Hop Limit option is inserted into
the PDU with the default value (16).

coap_send() checks if it is a 5.08 response and if so, prepends the diagnostic
data with the IP address of the transmitting interface. If the IP address
already exists, then the PDU is dropped as the return path for the 5.08 response
is looping.  An alternative method for return path looping check is also
used by initially setting, then testing and then decrementing the Hop Limit
value as response packets pass back through the proxies.  If a proxy does not
copy the Hop Limit options when returning the 5.08 response, then the IP address
duplication is used.

Makefile.am:

Hide the coap_insert_option(), coap_update_option and coap_pdu_check_resize()
function from applications.

README.md:

Add in RFC8768 is supported by libcoap.

examples/client.c:

Add in the -H hoplimit option.

include/coap2/pdu.h:

Add in the default Hop-Limit: option COAP_OPTION_HOP_LIMIT.
Re-organize the COAP_OPTION_ descriptions to include
the C, U, N, R, E, I and U flags.
Expose the internal coap_pdu_check_resize() function so src/net.c can use it.
Define the two new internal functions coap_insert_option() and
coap_update_option() and expose them so that the test suites can use them.

man/coap-client.txt.in:

Document the new -H hoplimit option.

man/coap.txt.in:

Include the new RFC8768.

man/coap_pdu_setup.txt.in:

Update documentation for the CoAP options.

src/coap_debug.c:

Add in support for printing out COAP_OPTION_HOP_LIMIT.

src/net.c:

Make sure that COAP_OPTION_HOP_LIMIT is not returned in an error response.
Decrement received Hop-limit in handle_request() and generate 5.08 response
if appropriate.
Update coap_send() to prepend IP in 5.08 response.
Support COAP_OPTION_HOP_LIMIT being used in the 5.08 response message.

src/pdu.c:

Report on CoAP options that are repeated, but not defined as repeatable.
Define new (5.08) Hop Limit Reached error response.

Add in new internal coap_insert_option() function. This now means that
callers of coap_add_option() no longer have to have the options in the
correct order.

Add in new internal coap_update_option() function that updates the value of
an option.

Make coap_pdu_check_resize() non-static.

tests/test_pdu.c:

Check that options are getting inserted in the correct order when using
coap_insert_option(), even though they are provided in a random order.

Test the coap_update_option() function.
2020-09-07 12:34:04 +01:00

3.1 KiB

libcoap: A C implementation of the Constrained Application Protocol (RFC 7252)

Build Status: master Build Status: develop Static Analysis Fuzzing Status CMake

Copyright (C) 2010—2020 by Olaf Bergmann bergmann@tzi.org and others

ABOUT LIBCOAP

libcoap is a C implementation of a lightweight application-protocol for devices that are constrained their resources such as computing power, RF range, memory, bandwidth, or network packet sizes. This protocol, CoAP, is standardized by the IETF as RFC 7252. For further information related to CoAP, see http://coap.technology.

You might want to check out libcoap-minimal for usage examples.

DOCUMENTATION

Documentation and further information can be found at https://libcoap.net.

PACKAGE CONTENTS

This package contains a protocol parser and basic networking functions for platforms with support for malloc() and BSD-style sockets. In addition, there is support for Contiki, LwIP and Espressif/ESP-IDF hosted environments.

The following RFCs are supported

  • RFC7252: The Constrained Application Protocol (CoAP)

  • RFC7641: Observing Resources in the Constrained Application Protocol (CoAP)

  • RFC7959: Block-Wise Transfers in the Constrained Application Protocol (CoAP)

  • RFC7967: Constrained Application Protocol (CoAP) Option for No Server Response

  • RFC8132: PATCH and FETCH Methods for the Constrained Application Protocol (CoAP)

  • RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets [No WebSockets support]

  • RFC8768: Constrained Application Protocol (CoAP) Hop-Limit Option

There is (D)TLS support for the following libraries

  • OpenSSL (Minimum version 1.1.0)

  • GnuTLS (Minimum version 3.3.0)

  • MbedTLS (Minimum version 2.7.10) [Currently only DTLS]

  • TinyDTLS [DTLS Only]

The examples directory contain a CoAP client, CoAP Resource Directory server and a CoAP server to demonstrate the use of this library.

BUILDING

Further information can be found at https://libcoap.net/install.html and BUILDING.

LICENSE INFORMATION

This library is published as open-source software without any warranty of any kind. Use is permitted under the terms of the simplified BSD license. It includes public domain software. libcoap binaries may also include open-source software with their respective licensing terms. Please refer to LICENSE for further details.