Commit Graph
650 Commits
Author SHA1 Message Date
Jon Shallow 2a48f44fe4 coap-rd: Fix windows build
Define S_ISDIR if needed for Windows.
2020-01-16 15:36:28 +00:00
Olaf Bergmann b43907ef2b Conditionally disable TCP
The pre-processor flag COAP_DISABLE_TCP controls if TCP support is
compiled into the library. If set to 1, some bytes can be saved
by omitting TCP-specific code. By default, this flag is set to 0.

The new configure option '--disable-tcp' will set this flag to 1.
2020-01-16 13:37:24 +00:00
Jon Shallow 2d6c50e041 coap-server: Add in support for using/testing COAP_PKI_KEY_PEM_BUF
Add in -m option to enable using COAP_PKI_KEY_PEM_BUF instead of
COAP_PKI_KEY_PEM when defining certificates.  This is done by reading in
the contents of the file into a temporary buffer and the buffer is
passed in instead of the filename to the PKI logic.
2020-01-16 09:40:44 +00:00
Jon Shallow da41a91a11 coap-rd: Add in (D)TLS support
Add in basic (D)TLS support using code and options from coap-server.

Closes #435
2020-01-15 17:29:10 +00:00
obgm 0a5bf521b4 Merge pull request #440 from mrdeep1/coap-server-doc
coap-server: Correct man and help documentation
2020-01-15 17:52:35 +01:00
Jon Shallow ba7089994d coap-server: Correct man and help documentation
Found when updating the coap-rd documentation.
2019-12-28 16:58:51 +00:00
Jon Shallow 82a68f4457 Windows: Update code to build on Windows
Add in specific _WIN32 definitions for the missing functionality from
recent PR updates.

R_OK (used by access())
strndup()
strcasecmp()
2019-12-26 20:55:53 +00:00
Jon Shallow 0be55e96ed client.c: Fix ordering of encryption selection to fix PSK
PR #338 broke the PKI/PSK selection order for the encryption type
to use when trying to include the SNI even if PSK or PKI had not
been configured - even though coaps or coaps+tcp was in use. If
PSK had been defined, then it failed.

This fix puts the creation of the correct type of session into a separate function
which is then called from 2 places.
2019-12-18 17:06:41 +00: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 1c8dce06b9 Update coap-client and coap-server to use new _psk2 functions
examples/client.c:

Update code to use the new coap_new_client_session_psk2() function, adding
the new Identity Hint callback.

Add in new option -h to define a file containing new PSK information if
Identity Hint is matched.

examples/coap-server.c:

Update code to use the new coap_context_set_psk2() function, adding
the new Identity and SNI callbacks.

Add in new option -i to define a file containing new Pre-Shared Key
if Hint and Identity is matched.
Add in new option -s to define a file containing new PSK information if
SNI is matched.
2019-12-09 09:35:30 +00:00
Olaf Bergmann d6c25a9a07 coap-server.c: Fix warnings on 32-bit architectures
Casting an unsigned long to void * caused a compiler warning
on 32-bit architectures. This change uses unsigned int as
this has a sufficient range for the respective calculation
and introduces a union to avoid the explicit type cast.
2019-11-08 11:17:54 +01:00
Jon Shallow 8faa8c28ff Add --disable-assert support for the library
Let configure enable (the default) or disable assert() code.

configure.ac:

Add in --enable-assert (the default) / --disable-assert support in libcoap.
Previously this was always enabled unless -DNDEBUG was passed in as a compiler
option.  Now NDEBUG is set or unset as appropriate in coap_config.h
This does not affect how assert()s work within the examples etc., only in the
library.

TODO:

HAVE_ASSERT_H is now cleaned up, so remove entry.

include/coap2/coap_internal.h:

Include assert.h for the library.

include/coap2/coap_io.h:
include/coap2/net.h:
include/coap2/resource.h:
src/address.c:
src/block.c:
src/coap_debug.c:
src/encode.c:
src/mem.c:
src/option.c:
src/pdu.c:
src/subscribe.c:
src/uri.c:

Remove un-needed '#include <assert.h>'
Note: address.h and utlist.h still include assert.h as there are assert()
within the header files.

examples/client.c:
src/coap_io.c:
src/coap_session.c:
src/net.c:
src/pdu.c:
src/resource.c:
src/str.c:

Remove any '#ifndef NDEBUG' wrappers for coap_log() output as they were true
before, but may not be now.
2019-09-20 13:09:56 +01:00
Jon Shallow 9f9a197e95 Fix -Winline compiler warnings about inlining failed
This is compiler version dependent when doing static inline expansions.

examples/client.c:

Make hex2char() just static.

examples/etsi_iot_01.c:

Make coap_add_payload() just static.

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

Make coap_address_init() an actual function.

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

Expose coap_address_init() as a function.

Makefile.libcoap:

Include address.c as one of the libcoap files for Contiki.

examples/lwip/Makefile:

Include address.o as one of the libcoap files for LwIP.
2019-09-05 13:54:05 +01:00
Jon Shallow 2900f72a64 Make coap_subscription_t and coap_endpoint_t opaque to applications
include/coap2/coap_subscribe_internal.h and
include/coap2/coap_session_internal.h contain the information not exposed
to applications.

This internal information was moved out of the respective
include/coap2/subscribe.h and include/coap2/coap_session.h files comprising of
the coap_subscription_t and coap_endpoint_t definitions.

To ease inter .h file dependencies, a new file
include/coap2/coap_forward_decls.h is added to include forward declarations
for both libcoap and applications.

Makefile.am:

Include include/coap2/coap_*internal.h as files for distribution, but not
installed for applications to use.
Include include/coap2/coap_forward_decls.h, so it is installed for
applications.

include/coap2/coap.h.in:

Include "coap_forward_decls.h"

include/coap2/coap_forward_decls.h: (New)

Forward declare structures and typedef the structures defined in
coap_internal.h.

include/coap2/coap_internal.h: (New)

Includes all the required #include files that libcoap internally needs.

include/coap2/coap_session_internal.h: (New)

Include the coap_endpoint_t information taken from
include/coap2/coap_session.h.

include/coap2/coap_session.h:

Remove coap_endpoint_t definition.

include/coap2/lwippools.h:

Add in coap_forward_decls.h and coap_internal.h to handle the LwIP memory
allocations.

include/coap2/resource.h:

Add in "block.h" to allow things to build.

include/coap2/coap_subscribe_internal.h: (New)

Include the coap_subscription_t information taken from
include/coap2/subscribe.h.

include/coap2/subscribe.h:

Remove coap_subscription_t definition.

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

Updated, removing coap_subscription_init().

src/address.c:
src/asyn.c:
src/block.c:
src/coap_debug.c:
src/coap_event.c:
src/coap_gnutls.c:
src/coap_hashkey.c:
src/coap_io.c:
src/coap_io_lwip.c:
src/coap_notls.c:
src/coap_openssl.c:
src/coap_session.c:
src/coap_time.c:
src/coap_tinydtls.c:
src/encode.c:
src/mem.c:
src/net.c:
src/option.c:
src/pdu.c:
src/resource.c:
src/str.c:
src/subscribe.c:
src/uri.c:

Add in '#include "coap_internal.h"' to the source files.
Remove other libcoap #include files.

win32/libcoap.vcxproj:
win32/libcoap.vcxproj.filters:

Update for Windows build (not tested).

examples/contiki/server.c:
src/coap_io.c:

Remove knowledge of endpoint from the server and update Contiki's
version of coap_run_once() to do the work instead.

====
Other structures (plus some internal required #defines) will follow as
separate PRs.
2019-09-03 11:59:07 +01:00
obgm 34c5e52029 Merge pull request #347 from mrdeep1/epoll
Add in internal epoll support to expose a monitor-able file descriptor
2019-08-30 14:34:56 +02: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 5d32ffe920 str.h: Fix coap_make_str_const() for C++
As pointed out in issue #368 [1], C++ officially forbids aggregate
initialization for non-aggegrates. This change therefore introduces
an alternative version (which works for both C and C++) to provide
the required functionality.

str.c:
str.h:

Make coap_make_str_const() a function.

examples/coap-server.c:

Fix parameter type in coap_add_attr() call.

src/resource.c:

Static variables can no longer make use of coap_make_str_const().

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

Make coap_make_str_const() appication visible.

Fixes #368.

[1] https://github.com/obgm/libcoap/issues/368

Update
2019-08-30 10:29:17 +01:00
Jon Shallow 003b64ab3f Fix SIGPIPE causing unexpected exit of example applications
examples/client.c:
examples/coap-rd.c:
examples/coap-server.c:
examples/etsi_iot_01.c:
examples/tiny.c:

Make the applications ignore SIGPIPE.

examples/coap-rd.c:

Support clean exit for SIGTERM / SIGQUIT for valgrind testing.
2019-08-29 12:58:15 +01:00
Ken Bannister f76e5d9062 Client example show payload on block1 completion 2019-08-25 08:29:24 -04:00
obgm 88e81f59c2 Merge pull request #380 from mrdeep1/0hex_doc
Update documentation for coap-client -O option
2019-07-26 15:25:25 +02:00
Olaf Bergmann 3ec6dffbf1 coap-server.c: Fix memory leak in hnd_put()
hnd_put() creates a new string object for the request's URI path.
When the permittwed number of dynamic resources was exceeded, this
object must be released manually.

This fixed CID 1483553 reported by Coverity scan.
2019-07-26 12:45:59 +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
obgm 4f91bce186 Merge pull request #357 from mrdeep1/icmp_unreachable
Split COAP_NACK_RST into COAP_NACK_RST and COAP_NACK_ICMP_ISSUE
2019-07-25 13:41:49 +02:00
obgm b1266898c6 Merge pull request #378 from mrdeep1/session_lookup
Make sessions list hashed to make lookups faster
2019-07-25 11:14:53 +02:00
Jon Shallow f06172d71e Make sessions list hashed to make lookups faster
Make endpoint->sessions and context->sessions a hashed chain of sessions
based on a key comprising of local and remote addresses and ports instead of
a linked list that has to be linearly searched.

include/coap2/coap_io.h:
include/coap2/coap_session.h:

Create a new struct coap_addr_tuple_t for the local and remote addresses/ports
to be used as the hash key.  Update coap_packet_t and coap_session_t
appropriately.

Create SESSIONS_* macros to Add, Delete, Find and Iterate through the hashed
chain.

examples/coap-rd.c:
src/coap_io.c:
src/coap_io_lwip.c:
src/coap_openssl.c:
src/coap_session.c:
src/coap_tinydtls.c:
src/net.c:
src/resource.c:

Update with the new struct element names and replace the LL_* functions with
SESSIONS_* as appropriate.

Update coap_endpoint_get_session() to use SESSIONS_FIND() for fast lookup.

Future work is to review all the SESSIONS_ITER* and see if they can be sped up
as well.
2019-07-24 14:25:38 +02:00
Olaf Bergmann c8c46f1660 client.c: Allow hex-encoded generic option values
This change enables option values to be entered as byte sequences in
hexadecimal encoding. The value string is interpreted a hex sequence
when prefixed with "0x", e.g.:

    -O 23,0x0004

Will set the option Block1 (23) to { 0x00, 0x04 }.

Fixes #377. [1]

[1] https://github.com/obgm/libcoap/issues/377
2019-07-24 13:32:46 +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 453f46b543 coap-server.c: Trigger observers only when dynamic resource is updated
examples/coap-server.c:

Only call coap_resource_notify() whenever a PUT is done to a created dynamic
resource, instead of once a second.

Issue found by Andy Ryan.
2019-06-28 11:54:36 +01:00
obgm d1642c3e68 Merge pull request #361 from mrdeep1/block2_well-known_core
Fix final data size in last BLOCK2 response for .well-known/core
2019-06-27 15:32:36 +02:00
Jon Shallow 21f16515b5 Add SIZE1 Option when sending BLOCK1 Option in packets
As per https://tools.ietf.org/html/rfc7959#section-4
...
Implementation Notes:

   o  As a quality of implementation consideration, block-wise transfers
      for which the total size considerably exceeds the size of one
      block are expected to include size indications, whenever those can
      be provided without undue effort (preferably with the first block
      exchanged)
...

examples/client.c:

Include SIZE1 Option when sending data using BLOCK1 Option.
2019-06-24 16:21:30 +01:00
Jon Shallow d84ac69b67 Fix final data size in last BLOCK2 response for .well-known/core
src/net.c:

Corect the length for the final block size.

Add in an ETAG and SIZE2 option into the response as suggested by RFC7959.

examples/client.c:

Warn if URI path is too long for internal buffer (found when testing that
a large WellKnown response triggered sending BLOCK2 correctly).

Increase internal buffersize to allow longer URIs.

To reproduce issue

coap-client -b 256 coap://127.0.0.1/.well-known/core

As reported by Zafi Ramarosandratana.  See #360 which this fixes.
2019-06-20 12:35:57 +01:00
Olaf Bergmann a5ffdf323d coap-server.c: Fix NULL pointer dereferencing in hnd_get()
As the field value in struct dynamic_resource_t may be NULL,
hnd_get() must check before accessing resource_entry->value->length
and resource_entry->value->s.

This bug was detected by Andy Ryan doing a GET after a PUT with
an empty payload to unknown_put/something.
2019-06-06 10:12:34 +02:00
obgm b1cd797269 Merge pull request #339 from mrdeep1/client_tcp_b_issue
coap-client: Fix using -b NN with TCP connections
2019-06-04 14:33:01 +02:00
Jon Shallow b1ebb503b4 Fix handling ICMP Port Unreachable messages
Once a ICMP Port Unreachable message is received, the session is
disconnected by a call to coap_session_disconnect().  However if the session
is of type CON,  the logic currently tries to retransmit the packet, but
nothing gets sent out.

src/coap_session.c:

Make sure that any entries on the context->sendqueue for the disconnected
session are removed.

examples/client.c:

Add in a Nack handler so that the client immediately exits on the session
disconnect.  Additionally this also tidies up the exit after transmission
retries.
2019-06-03 20:58:08 +01:00
Jon Shallow 422faa4fef coap-client: Fix using -b NN with TCP connections
Issue reproducable with (coap-server also running)

coap-client -b32 coap+tcp://[::1]

and note the partial response.

examples/client.c:

Set doing_getting_block if processing Block2 responses.
Add in a doing_getting_block test to not break out of the main while(){} loop.

[coap_can_exit() always returns 1 for TCP connections as there is nothing on
the session->delayqueue]
2019-04-24 15:19:45 +01:00
obgm 1d484849e8 Merge pull request #312 from mrdeep1/group_reg
Fix mcast registrations when using TCP
2019-04-12 15:09:20 +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 10b1b17aec server (lwip & contiki) run out of sessions
As a server, idle sessions are left around in case the client wants to do
further work using the same 5 tuple IP information.
With constrained systems, the number of sessions is limited, and so it is
easy to run out of sessions.

src/coap_session.c:

If there is an idle session, context->max_idle_sessions is not set and
a new session cannot be created, free off the oldest session and retry
the creation again.

examples/contiki/README:
examples/lwip/README:

Tidy up the documentation
2019-04-05 14:30:12 +01:00
Jean-Claude Michelou 34679ff5cb client.c, coap-server.c: use signal instead of sigaction on win32 2019-03-02 22:10:07 +01:00
Olaf Bergmann 9e365770cb client.c: updated year in runtime copyright message 2019-03-02 11:57:35 +01:00
Olaf Bergmann 2922c19970 updated copyright information
Touched dates in files where significant changes occurred in 2019.
2019-03-02 11:43:59 +01:00
Jon Shallow 13f935e289 coap-client: Clean exit on detection of DTLS closure
If there is an issue during DTLS setup, the coap-client will keep on retrying
and then getting the same failure.

examples/client.c:

This fix introduces using coap events into coap-client, and on detection of
a close event, the coap-client closes down
2019-02-26 16:32:48 +00:00
Jon Shallow 829145cbba coap-client: Support using CA or Root CAs, but not Cert files
By defining the CA file or Root CAs in the client, the server's certificate
can be validated by the options in coap_dtls_pki_t parameter even if the client
does not define a certificate.
[The server must be configured not to require a Client Cert]

examples/client.c:

Add in the support to the coap-client to allow any of Root CA, CA and Cert
to be defined to set up PKI checking.

src/coap_gnutls.c:
src/coap_openssl.c:

Remove the checks in the OpenSSL and GnuTLS underlying support that previously
used to enforce that both CA and Cert had to be set in the client.

Correct some of the PKI setup error messages to relect whether the failure is
on the client or the server.

include/coap2/coap_dtls.h:
src/coap_gnutls.c:
src/coap_notls.c:
src/coap_openssl.c:
src/coap_tinydtls.c:

Convert COAP_DTLS_ROLE_SERVER and COAP_DTLS_ROLE_CLIENT to enum
coap_dtls_role_t and use as appropriate to differentiate between the roles
in the different DTLS libraries
2019-02-15 18:00:52 +00: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 55d579449c Reserved Identifier fixes
include/coap2/libcoap.h
_LIBCOAP_H_ to COAP_LIBCOAP_H_
src/coap_session.c
_COAP_SESSION_H_ to COAP_SESSION_C_
include/coap2/coap_session.h
_SESSION_H_ to COAP_SESSION_H_

otherwise, all #define _COAP_xxxxx wrappers are now COAP_xxxxx

Fixes #291
2019-01-29 15:30:42 +00:00
Olaf Bergmann c0ab893666 coap-server.c: add ct to description of new resources
When a new resource is created with PUT, the given Content-Format is
stored as parameter ct with the resource description.

This change is based on a fix provided by Peter van der Stok.
2019-01-18 15:05:15 +01:00
Olaf Bergmann 29d62a2e3f examples/contiki/coap-observer.c: do not include debug.h explicitly 2019-01-07 10:04:59 +01:00
Olaf Bergmann 50c892fc81 lwip/Makefile: renamed debug.c to coap_debug.c 2019-01-07 09:56:12 +01:00
Olaf Bergmann 23c60dee6f client.c: remove trailing newline from output for '-o -'
The CLI option '-o file' redirects the received payload into the
given file, where '-' denotes stdout. As the function close_output()
used to append a newline to the end of the output, certain tools
such as cbor2pretty.rb have failed, complaining about the trailing
character.

This change now writes the newline if only if option '-o' was not
specified.
2018-12-20 17:57:16 +01:00