Files
libcoap/man/Makefile.am
T
Jon Shallow 9083189f95 Proxy: Update Proxy support for Proxy-Uri: CoAP option
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 #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
2020-11-11 17:46:17 +00:00

113 lines
3.6 KiB
Makefile

# man/Makefile.am
#
# Copyright (C) 2018-2020 Jon Shallow <supjps-libcoap@jpshallow.com>
#
# This file is part of the CoAP C library libcoap. Please see README and
# COPYING for terms of use.
# picking up the default warning CFLAGS into AM_CFLAGS
AM_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_srcdir)/include/coap$(LIBCOAP_API_VERSION) \
$(WARNING_CFLAGS) $(DTLS_CFLAGS) -std=c99
# Build, not install
noinst_PROGRAMS = examples-code-check
# build manuals only if 'BUILD_MANPAGES' is defined
if BUILD_MANPAGES
# building the manpages
TXT3 = coap_attribute.txt \
coap_cache.txt \
coap_context.txt \
coap_encryption.txt \
coap_handler.txt \
coap_io.txt \
coap_keepalive.txt \
coap_logging.txt \
coap_observe.txt \
coap_pdu_setup.txt \
coap_recovery.txt \
coap_resource.txt \
coap_session.txt \
coap_string.txt \
coap_tls_library.txt
MAN3 = $(TXT3:%.txt=%.3)
man3_MANS = $(MAN3)
TXT5 = coap-client.txt \
coap-rd.txt \
coap-server.txt
MAN5 = $(TXT5:%.txt=%.5)
man5_MANS = $(MAN5)
TXT7 = coap.txt
MAN7 = $(TXT7:%.txt=%.7)
man7_MANS = $(MAN7)
.txt.3:
$(A2X) --doctype manpage --format manpage $<
$(A2X) --doctype manpage --format xhtml $<
.txt.5:
$(A2X) --doctype manpage --format manpage $<
$(A2X) --doctype manpage --format xhtml $<
.txt.7:
$(A2X) --doctype manpage --format manpage $<
$(A2X) --doctype manpage --format xhtml $<
# Man pages built by a2x based on the NAMES section of the .txt file.
# Note - this list includes all the defined entries, but a2x only builds the first 10.
A2X_EXTRA_PAGES = @DOLLAR_SIGN@(shell for fil in $(TXT3) ; do sed -ne '/^NAME/,/^SYNOPSIS/p;/^SYNOPSIS/q' $${fil} | \
sed -ne '/coap_/{ s/ *, */\n/g; p }' | sed -ne 's/^\(coap_[a-zA-Z_0-9]\+\).*$$/\1.3/p' ; done)
# a2x builds alternative .3 files up to a limit of 10 names from the
# NAME section, so that 'man' works against the alternative different
# function names.
#
# However, if there are more alternative names, they need to be defined
# as per below
#
# Then all the alternative names as well as the extras defined below need
# to be cleaned up in a 'make unistall'.
install-man: install-man3 install-man5 install-man7
@echo ".so man3/coap_cache.3" > coap_cache_get_app_data.3
@echo ".so man3/coap_cache.3" > coap_cache_set_app_data.3
@echo ".so man3/coap_context.3" > coap_context_set_pki_root_cas.3
@echo ".so man3/coap_pdu_setup.3" > coap_add_data_blocked_response.3
@echo ".so man3/coap_pdu_setup.3" > coap_encode_var_safe.3
@echo ".so man3/coap_pdu_setup.3" > coap_encode_var_safe8.3
@echo ".so man3/coap_pdu_setup.3" > coap_split_path.3
@echo ".so man3/coap_pdu_setup.3" > coap_split_query.3
@echo ".so man3/coap_resource.3" > coap_resource_get_userdata.3
@echo ".so man3/coap_session.3" > coap_session_get_app_data.3
@echo ".so man3/coap_session.3" > coap_session_set_app_data.3
@echo ".so man3/coap_session.3" > coap_tcp_is_supported.3
@echo ".so man3/coap_string.3" > coap_delete_bin_const.3
@echo ".so man3/coap_string.3" > coap_make_str_const.3
@echo ".so man3/coap_string.3" > coap_string_equal.3
@echo ".so man3/coap_string.3" > coap_binary_equal.3
@echo ".so man3/coap_logging.3" > coap_endpoint_str.3
@echo ".so man3/coap_logging.3" > coap_session_str.3
$(INSTALL_DATA) $(A2X_EXTRA_PAGES) "$(DESTDIR)$(man3dir)"
# As well as removing the base 'man' pages, remove other .3 files built by
# a2x, as well as build by install-man specials.
uninstall-man: uninstall-man3 uninstall-man5 uninstall-man7
-(cd $(DESTDIR)$(man3dir) ; rm -f $(A2X_EXTRA_PAGES) )
endif # BUILD_MANPAGES
CLEANFILES = *.3 *.5 *.7 *.xml *.html docbook-xsl.css *.o examples-code-check
clean-local:
-rm -rf tmp