Commit Graph
63 Commits
Author SHA1 Message Date
obgm 03cc5791c5 Merge pull request #417 from mrdeep1/coap_run_once_fds
coap_io.c: Add in additional FD checking support for coap_run_once()
2019-12-20 17:47:35 +01:00
Jon Shallow 543581d1ae coap-server: Add in support for SNI to change PKI certificates
examples/client.c:

Update to send SNI if coaps, but certs/PSK not defined.

examples/coap-server.c:

Add in -S option to support changing certificate/ca if there is as SNI match.

man/coap-server.txt.in:

Update man page with new -S option.
2019-12-16 15:16:45 +00:00
Jon Shallow c6a1d2ad8c Update documentation for new _psk2() functions
doc/main.md:

Correct copyright date

man/Makefile.am:

Update A2X_EXTRA_PAGES to include man pages that have digits in the name

man/coap_context.txt.in:
man/coap_encryption.txt.in:
man/coap_handler.txt.in:
man/coap_logging.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:

Update with _psk2() information.
Update examples to remove compiler warnings

man/coap-client.txt.in:
man/coap-rd.txt.in:
man/coap-server.txt.in:

Add in documentation on additional support for using / testing out the new
_psk2() functionality
2019-12-09 09:49:44 +00:00
Jon Shallow 02923e7ffb Update resource documentation
man/coap_resource.txt.in:

Add in coap_resource_set_userdata() and coap_resource_get_userdata()
documentation

include/coap2/resource.h:

Re-organize order and put into appropriate doxygen groups

include/coap2/subscribe.h:

Fix Doxygen title case
2019-11-28 16:19:18 +00:00
Jon Shallow 5d01cf3139 OpenSSL: Update ciphers
src/coap_openssl.c:

Remove NULL as a valid cipher from the cipher list.

Add in TLSv1.3 ciphers if OpenSSL 1.1.1 (they are already included in
TLSv1.2 definition, but this is to document this is happening).

Remove the TLSv1.0 deprecated ciphers.

Cipher strings can now be overridden during compilation by
using -DCOAP_OPENSSL_CIPHERS=xxx compiler option where xxx is the
cipher string as defined in
https://www.openssl.org/docs/man1.1.0/man1/ciphers.html

Explicit PSK cipher strings can now be overridden during compilation
by using -DCOAP_OPENSSL_PSK_CIPHERS=xxx compiler option where xxx is the
cipher string.

Log the client ciphers presented, and the cipher chosen.

include/coap2/coap_debug.h:
src/coap_debug.c:

Add in COAP_LOG_CIPHERS as a debug level (value 9) which matches getting the
cipher information reported in GnuTLS, and is now used for OpenSSL.

man/coap-client.txt.in:
man/coap-rd.txt.in:
man/coap-server.txt.in:

Include OpenSSL for verbosity > 7.
2019-11-05 10:19:45 +00:00
Jon Shallow 039826b83e coap_io.c: Add in additional FD checking support for coap_run_once()
coap_write() and coap_read() are really internal functions that are called
from within coap_run_once() separated by a select() to wait for i/o and
ideally should not be used in applications.

However, currently, coap_write() and coap_read() are needed instead of
coap_run_once() if there is no epoll support in libcoap so that if additional
non libcoap FDs need to be set up and monitored by the select() call they
then can be processed accordingly if the non libcoap FDs are set in the
select() response.

coap_io_process_with_fds() is a new function extending coap_run_once() that
allows non libcoap FDs to be monitored in the coap_run_once() internal
select() call and can then be tested by the caller of
coap_io_process_with_fds().

coap_run_once() now calls coap_io_process_with_fds() with readfds, writefds,
exceptfds set to NULL and nfds set to 0.

Note: nfds, readfds, writefds and exceptfds are ignored if there is underlying
epoll support in libcoap as epoll functions are used, not select().  Use
coap_context_get_coap_fd() to get a single FD that covers all the libcoap
FDs that can be used in the application along with other non-libcoap FDs
when there is epoll support.  See coap_io(3) for further information.

include/coap2/net.h:
libcoap-2.map:
libcoap-2.sym:
man/coap_io.txt.in:
src/coap_io.c:

Include and document the new coap_io_process_with_fds() function.
2019-11-04 17:16:16 +00:00
Jon Shallow 209c8a9267 Revert out changes to make 1 byte enums
include/coap2/coap_dtls.h
include/coap2/coap_session.h
include/coap2/pdu.h
man/coap_encryption.txt.in
src/net.c

Revert out all the #define -> enum in #386 that require the enum to be
one byte long.
2019-09-09 09:59:44 +01:00
Jon Shallow 0e02d751da Add in internal epoll support to expose a monitor-able file descriptor
If epoll is available, use it within libcoap to speed things up, as well as
present to applications a file descriptor that can be used in a select() or
returned as an event in a epoll_wait() call.

Whenever coap_new_context() is called. set up a new epoll infrastructure with
epoll_create() and destroy it with coap_free_context().

For each new endpoint or session, add the socket fd to epoll.  When the socket
is closed, remove the socket fd from epoll.

Whenever a socket wants a write, the appropriate epoll event gets EPOLLOUT
added and when the write happens reset the event back to just EPOLLIN.

As there may be a packet retry event sometime in the future, a timerfd is
created and added to the epoll structure (done in coap_new_context) which gets
freed off in coap_free_context. If coap_run_once() determines that there is
a future retry, timerfd is informed of when the event is to occur.  When
timerfd times out, the application file descriptor will indicate a read is
available.

A new function coap_context_get_coap_fd(ctx) returns the application file
descriptor.  The only other API change is that if wait_ms is set to 1 for
coap_run_once(ctx, wait_ms), there is no waiting for a new packet to arrive.

coap_run_once() is called, whether epoll support is available or not, to
process all the underlying required i/o.

If there is no epoll support, coap_run_once() continues to use the old
select() method, otherwise it will use epoll_wait(). If there is epoll
support, a modified version of coap_read() (coap_io_do_events()) is
used instead.

Makefile.am:

Do not expose coap_epoll_ctl_mod() and coap_io_do_events() to applications.

configure.ac:

Test for the presence of sys/epoll.h and sys/timerfd.h and if so setup
COAP_EPOLL_SUPPORT to be used for #ifdef testing.
Include new man page coap_io.txt.

examples/coap-server.c:

Include support for using this new exposed file descriptor.

include/coap2/coap_io.h:

Define COAP_MAX_EPOLL_EVENTS (to limit the number of events processed at once)
and include coap_endpoint_t and coap_session_t in coap_socket_t.
Include (internal) definition for coap_epoll_ctl_mod()

include/coap2/net.h:

Add epfd and eptimerfd to coap_context_t.
Define coap_context_get_coap_fd() for applications to use.
Include (internal) definition for coap_io_do_events().
Define COAP_RUN_BLOCK and COAP_RUN_NONBLOCK.

libcoap-2.map:
libcoap-2.sym:

Include coap_context_get_coap_fd.

configure.ac:
man/Makefile.am:
man/coap.txt.in:
man/coap_io.txt.in: (New)

Include the new coap_in(3) man page that documents coap_run_once() and
coap_context_get_coap_fd().

src/coap_io.c:
src/coap_openssl.c:
src/coap_session.c:
src/net.c:

Add in the epoll support.

src/net.c:

Add in coap_context_get_coap_fd() function.
2019-08-30 11:51:15 +01:00
Jon Shallow 6e3e65f128 coap_handler.txt.in: Add in clarification notes for handler parameters
Document why certain parameters may be NULL.
2019-08-22 14:15:29 +01:00
Jon Shallow 49c6b57cba Convert #define to enum where possible
As suggested in #292, several lists of #define could easily be defined
as enum instead - which allows for extra compiler checking.

The challenge was for where the (#define/enum) parameter defined in a
structure was one byte in size.  Doxygen was picky and got confused, not
maintaining the fact that it was an enum if macros were used to differentiate
between using Microsoft or GCC when changing the enum size default from that
of an int.

include/coap2/coap_dtls.h:
include/coap2/coap_session.h:
include/coap2/pdu.h:

Use enums instead of #define where practical.

src/net.c:

Handle all the enum cases.

man/coap_encryption.txt.in:
man/coap_tls_library.txt.in:

Update man documentation.
2019-08-09 17:30:26 +02:00
Jon Shallow c46e6a6748 Update documentation for coap-client -O option
examples/client.c
man/coap-client.txt.in

Update information for the -O option to indicate that a leading 0x causes
the hex text to be included as binary data.
2019-07-26 12:17:53 +02:00
Jon Shallow 54d52221ba Split COAP_NACK_RST into COAP_NACK_RST and COAP_NACK_ICMP_ISSUE
As COAP_NACK_RST is used for
1. ICMP Port Unreachable message is received
2. CoAP reply RST message.
there needs to be a way to differentiate between these conditions.

If there is detected to be an ICMP response issue to sending a UDP
packet, report this as COAP_NACK_ICMP_ISSUE instead of COAP_NACK_RST.

If the reported issue to coap_session_disconnected() is COAP_NACK_ICMP_ISSUE,
then make sure that the packet (plain or DTLS) gets re-transmitted.

As hinted in #131 discussion, retry of the packet should be attempted,
(as per https://tools.ietf.org/html/rfc7252#section-4.2 ICMP Unreachable)
this fix will cause the plain packet to get retransmitted up to the maximum
retry count if type CON.

Likewise, DTLS will get restarted up to the maximum retry count if type CON.

examples/client.c:

Include COAP_NACK_ICMP_ISSUE in the nack_handler.

include/coap2/coap_io.h:

Add in COAP_NACK_ICMP_ISSUE to coap_nack_reason_t.

src/coap_session.c:

Update coap_session_disconnected() so that plain/DTLS can restart.

src/net.c:

Fix coap_wait_ack() to exponentially back off the re-transmit times.

Update coap_read_session() to report COAP_NACK_ICMP_ISSUE instead of
COAP_NACK_RST.

man/coap_handler.txt.in:

Update documentation
2019-07-19 12:35:49 +02:00
Jon Shallow 55aeaa6cc1 Update Keepalive support to include unreliable sessions
Add in support for both reliable and unreliable sessions when calling
coap_context_set_keepalive().

include/coap2/coap_session.h:

Track the last ping mid in coap_session_t.

src/coap_io.c:
src/coap_session.c:

Support both reliable and unreliable sending of pings in coap_write().

src/net.c:

Determine whether RST packet response is associated with a CoAP Empty Ping
that was sent and handle accordingly.

configure.ac:
examples/client.c:
include/coap2/net.h:
man/Makefile.am:
man/coap-client.txt.in:
man/coap.txt.in:
man/coap_handler.txt.in:
man/coap_keepalive.txt.in: (New)
man/coap_observe.txt.in:

Add in a new man page (coap_keepalive).
Update documentation to remove references to TCP and reliable only.
2019-07-11 11:14:15 +02:00
Jon Shallow fda991f541 Fix mcast registrations when using TCP
As coap-server now sets up 2 (or 4) endpoints, UDP and TCP based, all
subsequent endpoints are pre-pended to the ctx->endpoint list. Thus
ctx->endpoint will always be TCP based.  Setting IPV6_JOIN_GROUP on a TCP
socket is a no-no.

As join() is complex function, it should be within libcoap so as to not require
detailed knowledge of how internal structures work (which really should be
opaque to the application writer).

include/coap2/net.h:
src/net.c:
libcoap-2.map:
libcoap-2.sym:
Create coap_join_mcast_group() in src/net.c (as it is a network layer
function using the (fixed) join() code. (Iterate through the ctx->endpoint list
looking for UDP based endpoints and only do the IPV6_JOIN_GROUP on them.)
There is no support for WITH_CONTIKI or WITH_LWIP at this point (returns -1).

examples/coap-server.c:
Remove join() code and replace call to join() with coap_join_mcast_group()

examples/coap-rd.c:
Remove join() code and replace call to join() with coap_join_mcast_group()

man/coap-rd.txt.in:
Correct a typo in the coap-ed man page
2019-04-12 13:54:50 +01:00
Jon Shallow 9028574ee3 Fix GNU make extension complaint in man/Makefile.am
Currently the following complaint is in the build logs

man/Makefile.am:56: warning: ':='-style assignments are not portable
man/Makefile.am:56: warning: shell for fil in $(TXT3: non-POSIX variable name
man/Makefile.am:56: (probably a GNU make extension)

Correct issue by using

configure.ac:
AC_SUBST([DOLLAR_SIGN],[$])

man/Makefile.am:
to substiture for $ as in $(shell ...
and replace := with =
2019-03-31 14:55:19 +01:00
Jon Shallow cdcec53a88 Fix 'make distcheck' by removing the manpage additional generated .3 files
Part Three:

man/Makefile.am:

Determine additional man pages created by a2x with A2X_EXTRA_PAGES.
Set EXTRA_PAGES for the hand crafted additional man pages.
Clean out the additional installed coap_*.3 man pages using uninstall-man:
in man/Makefile.am
2019-03-04 11:43:14 +00:00
Jon Shallow d8f4eda569 Fix 'make distcheck' by removing the manpage additional generated .3 files
Part Two:

man/coap_context.txt.in:

Remove spurious reference to coap_endpoint_str
2019-03-04 11:41:36 +00:00
Carsten Schoenert aa802b3789 spelling: fix funtion -> function 2019-02-10 14:47:23 +01:00
Carsten Schoenert a54cd26c85 spelling: fix Addtional -> Additional 2019-02-10 14:47:20 +01:00
Jon Shallow 037fd4395e coap-server: Make requirement for clients to have certificates configurable
Add in -n option to support making require_peer_cert configurable, by default
it is enabled unless -n is set.

examples/coap-server.c:
Code changes.

man/coap-server.txt.in
Update documentation
2019-02-07 12:03:09 +00:00
Jon Shallow 164eef538b Clarify coap_add_data_blocked_response() usage
include/coap2/block.h
man/coap_pdu_setup.txt.in

Update documentation on coap_add_data_blocked_response() usage.
2019-01-11 16:39:02 +00:00
Jon Shallow 26a045ba3d coap-client/coap-server help documentation splitting out PSK and PKI options
Re-organize usage() and man pages to seperate out the PSK and PKI options
for clarity - as they may not be available for all TLS library versions

examples/client.c
examples/coap-server.c
man/coap-client.txt.in
man/coap-server.txt.in
2018-12-12 11:23:49 +00:00
Jon Shallow 3e8071f011 Update man pages with GnuTLS support
man/coap-client.txt.in
man/coap-rd.txt.in
man/coap-server.txt.in

Document usage over -v7 for extra GnuTLS library output.

man/coap_attribute.txt.in
man/coap_context.txt.in
man/coap_encryption.txt.in
man/coap_handler.txt.in
man/coap_logging.txt.in
man/coap_observe.txt.in
man/coap_pdu_setup.txt.in
man/coap_recovery.txt.in
man/coap_resource.txt.in
man/coap_session.txt.in
man/coap_tls_library.txt.in

Include new -lcoap-@LIBCOAP_API_VERSION@-gnutls option.
Remove trailing spaces at end of line

man/coap_encryption.txt.in

Update with GnuTLS information

man/coap_logging.txt.in

Update with more information about logging levels.

man/coap_tls_library.txt.in

Include new functions coap_show_tls_version() and coap_string_tls_version()
2018-11-27 15:33:43 +00:00
Carsten Schoenert ea29a48fd7 spelling: fix whith -> with 2018-11-24 13:59:54 +01:00
Carsten Schoenert 1d1eb455d6 spelling: fix seperate -> separate 2018-11-24 13:59:47 +01:00
Carsten Schoenert df6c2529f9 spelling: fix outputing -> outputting 2018-11-24 13:59:41 +01:00
Carsten Schoenert 32eea645b1 spelling: fix compatability -> compatibility 2018-11-24 13:59:34 +01:00
Carsten Schoenert 637a09cfbd spelling: fix bandwith -> bandwidth 2018-11-24 13:58:44 +01:00
Carsten Schoenert 55d359d259 spelling: fix apropriate -> appropriate 2018-11-24 13:57:14 +01:00
Jon Shallow 4c95c50528 Clarify coap_resource_unknown_init() usage documentation
include/coap2/resource.h
man/coap_resource.txt.in
modified:   src/net.c (comment only)
2018-10-29 09:27:04 +00:00
c.schoenert@t-online.de 327b6cd435 man: add $(LIBCOAP_API_VERSION) to header inclusion
Adding the version of the API to the include directive on the examples
to fulfill the correct information within the man pages related to the
changes made to the library source if API version related modifications
are done.
2018-10-04 12:36:26 +02:00
obgm 531408244e Merge pull request #257 from mrdeep1/ccoap_typo
man/coap_handler.txt.in: fix ccoap typo
2018-10-04 08:31:29 +02:00
Jon Shallow 0fe449685a man/coap_handler.txt.in: fix ccoap typo 2018-09-28 17:55:17 +01:00
Jon Shallow f5367ef3de Delete trailing spaces from files, replace TAB with 8*SPACE
"git diff -w" shows no differences

TAB left alone in files that are not C based files or documentation
2018-09-28 17:34:07 +01:00
obgm ee5cee6e6b Merge pull request #248 from mrdeep1/block2
BLOCK option support in coap-server
2018-09-28 18:24:24 +02:00
obgm 6ea51c8a03 Merge pull request #242 from mrdeep1/tls13
Add in support for OpenSSL 1.1.1 to support TLS1.3 (RFC8446)
2018-09-28 17:47:33 +02:00
Jon Shallow 469357b824 BLOCK option support in coap-server
hashkey.[ch] files restored (now prefixed with coap_)
LWIP and Contiki builds now include these files

block.[ch]:
New function coap_add_data_blocked_response() to simplify GET
responses and handle adding in BLOCK2 options as appropriate.
Needs coap_hash() to generate ETag option.

net.c:
Determine if Block2 is in use, and add to coap_add_observer().

resource.[ch]:
Include Block2 request in coap_add_observer().

subscribe.h:
Include Block2 definition in coap_subscriber_t for using during
observe responses.

pdu.h:
Update comment.

coap-client.c:
No longer causes duplicate calls to coap_show_pdu()
(one in library, one in coap-client for the same PDU).

If a block'ed response received and observing, now observing continues.
(Fixes #166).

Send Observe Cancel with Block2 option if -b defined

coap-server.c:
Replaced all option setting, data addition etc. with new
coap_add_data_blocked_response() function in the GET handlers.
(Fixes #246 Issue 2).

Support PUT with BLOCK1.
(Fixes #246 Issue 1).

Add in -N option to send observe responses as non-confirmable.

Handle small wait_ms values correctly (after being decremented) for testing
whether observe should be triggered or not.

Refresh time every second by making COAP_RESOURCE_CHECK_TIME 1

Manuals:
Add in new function coap_add_data_blocked_response()
Update coap_observe with coap_delete_observer(s) functions

Correct example typo and use new function in hnd_get_time().

Add in -N option to coap-server(5)

Be more specific about COAP_RESOURCE_FLAGS_NOTIFY_NON and
COAP_RESOURCE_FLAGS_NOTIFY_CON usage for observe.

Files:
Makefile.am
Makefile.libcoap
examples/client.c
examples/coap-server.c
examples/lwip/Makefile
include/coap/block.h
include/coap/coap_hashkey.h
include/coap/pdu.h
include/coap/resource.h
include/coap/subscribe.h
libcoap-2.map
libcoap-2.sym
man/Makefile.am
man/coap-server.txt.in
man/coap_handler.txt.in
man/coap_observe.txt.in
man/coap_pdu_setup.txt.in
man/coap_resource.txt.in
src/block.c
src/coap_hashkey.c
src/net.c
src/resource.c
2018-09-24 20:49:57 +01:00
Jon Shallow 8238f628b9 Include man pages into Doxygen. Add landing page for Doxygen
Added in a new landing page for Main Page
 doc/main.md (new)

Enabled Tree View of whats available
Disable Related Pages TAB as it fills up with the man pages
 - updated doc/Doxyfile.in

Get a2x to also generate html man pages which are then included.  These
html files are updated to correct the lowercasing of NAME and SYNOPSIS.
The SEE ALSO references to other man pages are made hyper links.
 - done by doc/build_man_files.sh (new)

Created a new TAB Manual Pages
Created a new TAB Depricated Items
 - done by modifing DoxygenLayout.xml file using doc/build_man_files.sh

Updated .gitignore to ignore additional files and autogen.sh to clean them up

man/coap*txt.in updated to display as expected in Doxygen.

This only updates documentation

.gitignore
Makefile.am
autogen.sh
doc/Doxyfile.in
doc/Makefile.am
doc/build_man_files.sh (New)
doc/main.md            (New)
include/coap/debug.h
include/coap/encode.h
include/coap/option.h
include/coap/pdu.h
include/coap/prng.h
man/Makefile.am
man/coap.txt.in
man/coap_attribute.txt.in
man/coap_context.txt.in
man/coap_encryption.txt.in
man/coap_handler.txt.in
man/coap_logging.txt.in
man/coap_observe.txt.in
man/coap_pdu_setup.txt.in
man/coap_recovery.txt.in
man/coap_resource.txt.in
man/coap_session.txt.in
man/coap_tls_library.txt.in
2018-09-24 16:46:42 +01:00
obgm 395815e26d Merge pull request #236 from mrdeep1/dtls_event
openssl.c: Global dtls_event variable causing confusion when events happen
2018-09-24 16:28:19 +02:00
Jean-Claude Michelou ecfcd37f0c client: Sort options alphabetically, ping is TCP only. 2018-09-24 15:55:57 +02:00
Jon Shallow 2466853075 openssl.c: Global dtls_event variable causing confusion when events happen
dtls_event is a static variable, declared outside of all the functions which
tracks (D)TLS errors for generating events etc.

If there are multiple SSL sessions being set up to the same server (as per
Happy Eyeballs for the DOTS protocol) it is possible to asynchronously get
dtls_event updated and the wrong SSL session then acts on it.

Make dtls_event a part of coap_session_t to maintain seperation.

Preset dtls_event to -1 in coap_make_session().

Update coap_event_handler() to have the 3rd parameter as
coap_session_t *session instead of void *arg as the parameter is always session.
Updated coap_event_handler_t to have session as the 3rd parameter.

Add in new registration handler coap_register_event_handler() to be consistent
with all the other coap_register_XXX_handler()s.
Consequently, coap_set_event_handler() and coap_clear_enent_handler() are
deprecated.

Update coap_handler(3) to include new coap_register_event_handler().
(PR #183 event definitions are included presumptive on #183 getting merged)
2018-08-28 13:32:05 +01:00
Jon Shallow 45731f1c0e Add in support for OpenSSL 1.1.1 to support TLS1.3 (RFC8446)
OpenSSL 1.1.0 has support for making decisions during receipt of
the Client Hello - the call back function is set up using
SSL_CTX_set_tlsext_servername_callback() which is called later in the
Client Hello processing - but called every Client Hello.
Certificates and Preshared Keys have to be set up in the SSL CTX before
SSL_Accept() is called, making the code messy to decide whether this is a
PKI or PSK incoming request to handle things accordingly if both are
defined.  SNI has to create a new SSL CTX to handle different server names
with different crtificates.

OpenSSL 1.1.1 introduces a new function SSL_CTX_set_client_hello_cb().
The call back is invoked early on in the Client Hello processing giving
the ability to easily use different Preshared Keys, Certificates etc.
Certificates do not have to be set up in the SSL CTX before SSL_Accept is
called.
Later in the Client Hello code, the callback for
SSL_CTX_set_tlsext_servername_callback() is still called, but only if SNI
is being used by the client, so cannot be used for doing things the
OpenSSL 1.1.0 way.

OpenSSL 1.1.1 supports TLS1.3.

Consequently, this code has to have compile time options to include /
exclude code based on whether compiled against 1.1.0 or 1.1.1, as well as
have additional run time checks.

Updated:
examples/client.c
examples/coap-server.c
include/coap/coap_dtls.h
man/coap_context.txt.in
man/coap_encryption.txt.in
man/coap_session.txt.in
src/coap_openssl.c

In addition, the callback app_override_tls_setup_call_back has been removed
from coap_dtls_pki_t and replaced with additional_tls_setup_call_back
as app_override_tls_setup_call_back became very messy with 2 versions
of OpenSSL.  If the application now wants to make additional checks/
changes etc., app_override_tls_setup_call_back will get invoked after
the defined configuration checks are done.

SNI has been added into coap-client for testing / demonstration
2018-08-21 11:09:59 +01:00
Jon Shallow 06f57978de Replace str with coap_string_t. Make tokens coap_binary_t
New struct coap_binary_t - same as coap_string_t, used for tokens

Deprecate struct str with the intent of removing it downstream as it
polutes namespace.

Make end of coap_string_t data a NUL.

Updated coap_make_str_const(), removing .length= and .s= to keep upstream
compilers happy.

Update Doxygen for str.h

Files:
examples/client.c
examples/coap-rd.c
examples/coap-server.c
examples/contiki/server.c
examples/etsi_iot_01.c
include/coap/resource.h
include/coap/str.h
include/coap/subscribe.h
man/coap_observe.txt.in
src/net.c
src/resource.c
src/str.c
src/uri.c
tests/test_options.c

Update
2018-07-26 15:45:38 +01:00
obgm e1491dee77 Merge pull request #226 from mrdeep1/logging-doc
New coap_logging(3) and updated Doxygen comments for logging
2018-07-26 14:08:25 +02:00
Jon Shallow 224153c206 coap-server: Support for being able to create dynamic resources on the fly
Add in -d max option, which then causes coap_resource_unknown_init() to get
called.

Number of dynamic resoures is limited by 'max'.  The current set of resources
can be determined by using .well-known/core

If max is reached, 4.06 is returned.

Fixed typo in man coap_resource(3) in example for unknown resources
2018-07-25 10:12:14 +01:00
Jon Shallow c695dea7cd New coap_logging(3) and updated Doxygen comments for logging
Documentation changes/updates only - no code changes.

configure.ac
include/coap/coap_dtls.h
include/coap/coap_session.h
include/coap/debug.h
man/Makefile.am
man/coap.txt.in
man/coap_context.txt.in
man/coap_logging.txt.in (new)
2018-07-25 09:48:02 +01:00
Jon Shallow 9a1f0ab475 man pages: New coap_encryption(3) and coap_session(3)
Split out old coap_context(3) into coap_context(3), coap_encryption(3) and
coap_session(3) with coap_encryption(3) primarily updated to reflect the
updated PKI configuration options.

coap-client.txt.in
coap-server.txt.in

Update with new options making use of updated PKI interface
2018-07-24 14:49:04 +01:00
Jon Shallow bf5dd5a82f coap-{client|server}: Add in PKI Support. Tidy up Usage output
examples/client.c

Add in support for using PKI certificates

examples/coap-server.c

Add in support for using PKI certificates
remove default PSK key
Add in '-h hint' option

Make Usage reflect actual options available to use

man/coap-client.txt.in

Include the missing options
Update -A option to be a single entity
Sort the options into ascending order as reported by Usage

man/coap-server.txt.in

Include the missing options
Add in '-h hint' option
2018-07-03 15:06:17 +01:00
Jon Shallow c7e9359f02 Make coap_encode_var_bytes() by replacing with coap_encode_var_safe()
Update code / examples / man pages with the updated function.

include/coap/libcoap.h:
Add in new define COAP_DEPRECATED to generate compiler warnings when used

include/coap/encode.h
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.

Make coap_encode_var_bytes() a wrapper for coap_encode_var_safe() and
mark it as COAP_DEPRECATED for backwards compatability

src/encode.c:
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.

examples/coap-server.c:
examples/contiki/server.c:
Make the ticks resource consistent in case
2018-06-05 09:41:58 +01:00
Jon Shallow 9fa448e439 options: Fix subtle memory leak in coap_add_optlist_pdu()
coap_add_optlist_pdu() sorted the options for insertion, but did not update
the coap_optlist_t head (whch may then no longer point to the first entry in the
sorted chain) and so when coap_delete_optlist() was called, the first few
entries of the sorted chain may not get deleted.
Fixed by making it
 coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t** optlist_chain)
instead of
 coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t* optlist_chain)

Additionally deleted options_start() and options_next() as they are not
required - Issue #184.

examples/client.c:
Fix coap_add_optlist_pdu() call

include/coap/options.h:
Fix coap_add_optlist_pdu() call

libcoap-2.{map|sym}:
Delete options_start()

man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:

Update docmentation

src/option.c:
Update coap_add_optlist_pdu()

tests/test_pdu.c:
New tests for checkout out coap_insert_optlist() and coap_add_optlist_pdu()
functions
2018-05-30 11:38:50 +01:00