Skip to content

Commit

Permalink
Proxy: Update Proxy support for Proxy-Uri: CoAP option
Browse files Browse the repository at this point in the history
Add code to better support the Proxy-Uri: and Proxy-Scheme: CoAP Options.

examples/client.c:

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.
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 and is assocated with the incoming session for relaying
requests / responses.

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/resource.h:

Track whether a resource definition is for Proxy-Uri:/Proxy-Scheme:.
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) now being over the 10 definition limit
in man/coap_resource.txt.in.

man/coap-client.txt.in:

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_resource.txt.in:

Include documentation for coap_resource_proxy_uri_init().

src/coap_debug.c:

Output the Proxy-Scheme: Option as text.

src/net.c:

Sanity check and handle COAP_OPTION_PROXY_URI and COAP_OPTION_PROXY_SCHEME
in handle_request().

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.

TODO:

Remove reference to Proxy support required

src/coap_gnutls.c:

Fix a double deallocate found during testing
  • Loading branch information
mrdeep1 committed Nov 4, 2020
1 parent 5c23771 commit 2ecd908
Show file tree
Hide file tree
Showing 17 changed files with 1,358 additions and 219 deletions.
2 changes: 0 additions & 2 deletions TODO
Expand Up @@ -11,8 +11,6 @@ Classification of issues:
=================
* CRITICAL ISSUES
=================
-> Proxy functionality
-> A coap-server should be able to act as proxy server

================
* SERIOUS ISSUES
Expand Down

0 comments on commit 2ecd908

Please sign in to comment.