Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RFC8768: Add in support and update Proxy-Uri Support
Add in support for RFC8768 Hop Limit and add in code to better support the Proxy-Uri CoAP Option. README.md: Add in RFC8768 is supported by libcoap. examples/client.c: Add in the -H hoplimit option. Make sure that the Proxy-Uri: option is added (if set) when clearing down an observation (fixes obgm#112). Check that Proxy-Uri: option has a maximum data length of 1034 bytes. Always add in Hop-Limit: CoAP option if Proxy-Uri: is in use. Handle user defined Proxy-Scheme: option correctly. Update -P option to include scheme to be used when connecting to the proxy. examples/coap-server.c: Add in hnd_proxy_uri() handler function. This has support for a direct or ongoing proxy connection for the coap* protocols. The ongoing connection is set up as a different CoAP session. Internal functions taken from client.c are used where appropriate. Proxy support code has a SERVER_CAN_PROXY wrapper, so footprint can easily be reduced if required. New -P and -u options added to support ongoing connections. include/coap2/net.h: Add in tracking the proxy uri handler into coap_context_t. 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 and R flags. include/coap2/resource.h: Track whether a resource definition is for Proxy-Uri:. Define the coap_resource_proxy_uri_init() function for handling the Proxy-Uri: option or Proxy-Scheme: option in an incoming request. include/coap2/uri.h: Add in COAP_URI_SCHEME_HTTP and COAP_URI_SCHEME_HTTPS as valid Proxy-Uri: schemes. Define the coap_split_proxy_uri() function (similar to coap_split_uri() but supports the proxy extras. Both now use a common sub function internally. libcoap-2.map: libcoap-2.sym: Expose the new coap_resource_proxy_uri_init() and coap_split_proxy_uri() functions. man/Makefile.am: Handle coap_resource_get_userdata(3) being over the 10 definition limit in man/coap_resource.txt.in. man/coap-client.txt.in: Document the new -H hoplimit option. Update documentation for the -P option. man/coap-server.txt.in: Document the new -P proxy option. Document the new -u user option. man/coap.txt.in: Include the new RFC8768. man/coap_resource.txt.in: Include documentation for coap_resource_proxy_uri_init(). Update documentation for the CoAP options. src/coap_debug.c: Add in support for printing out COAP_OPTION_HOP_LIMIT. Output the Proxy-Scheme: Option as text. src/net.c: Make sure that COAP_OPTION_HOP_LIMIT is not returned in an error response. Sanity check and handle COAP_OPTION_PROXY_URI and COAP_OPTION_PROXY_SCHEME in handle_request(). src/pdu.c: Report on CoAP options that are repeated, but not defined as repeatable. Define new (5.08) Hop Limit Reached error response. src/resource.c: Add in coap_resource_proxy_uri_init() function. Handle the addition of a proxy uri handler in coap_add_resource(). src/uri.c: Rename coap_split_uri() to coap_split_uri_sub() and add in extra proxy handling support based on input parameters. Create new coap_split_uri() and coap_split_proxy_uri() which call coap_split_uri_sub() appropriately.
- Loading branch information