Commit Graph
404 Commits
Author SHA1 Message Date
Jon Shallow a7f53b4d6b coap_debug.h: Allow <syslog.h> to be included before and after <coap3/coap.h>
The syslog LOG_ definitions are defined in <syslog.h> and can be defined in
coap_debug.h (wrapped by a HAVE_SYSLOG_H wrapper to prevent duplicaton).

However, the coding order of
  include <coap3/coap.h>
  include <stdio.h
works, but
  include <stdio.h
  include <coap3/coap.h>
but fails if the application build environment does not define HAVE_SYSLOG_H
(as is the case of the examples in the examples/ directory).

The former "just" happens to work as the values of the variables are the same.

This fix is to remove the coap_log_t enum and replace it by simple #define
if LOG_ALERT etc. is not already defined.

Make coap_log_t int to remove Visual Studio compile warnings.
2021-09-28 12:10:04 +01:00
obgm 0061b3fe07 Merge pull request #739 from mrdeep1/coap_can_exit
doc: Document the coap_can_exit() function
2021-09-28 12:54:54 +02:00
Olaf Bergmann ca44071b8a net.h: do not include sys/select.h in Windows builds
Windows apparently has no select.h header, therefore it is not
included for Windows builds.
2021-09-01 09:50:45 +02:00
Olaf Bergmann e984f38b8f [DTLS] make buffer sizes for psk and psk_identity configurable
The pre-processor values COAP_DTLS_MAX_PSK and
COAP_DTLS_MAX_PSK_IDENTITY now can be set at build time. Both values
default to 64. Static buffer sizes in the TLS library wrappers are
adjusted accordingly.
2021-09-01 09:35:38 +02:00
Olaf Bergmann 54dbc3eeb8 [RIOT] coap_time.h: fix COAP_TICKS_PER_SECOND for undefined XTIMER_HZ
With ztimer usage, XTIMER_HZ is not defined anymore in xtimer.h. As a
workaround, XTIMER_HZ_BASE is used.
2021-09-01 09:34:47 +02:00
Olaf Bergmann 05e7f12d7c net.h: Include sys/select.h for fd_set 2021-09-01 09:34:47 +02:00
Jon Shallow a5c0d12354 doc: Document the coap_can_exit() function 2021-08-04 14:14:37 +01:00
Jon Shallow 8ce139d349 coap_event.h: Make coap_event_t an enum
examples/coap-client.c:
examples/coap-server.c:

Explicitly define each enum case to remove complier warnings.
2021-07-31 17:08:10 +01:00
Jon Shallow c61748f4dd RFC7959: session->lg_xmit not being released for a server
Following transmission of a large body by a server using BLOCK2,
session->lg_xmit is not getting released. It does get released when the session
is freed off.

A client doing transmission of a large body idoes release session->lg_xmit.

Timeout lg_xmit after 4 * ACK_TIMEOUT seconds after final block is transmitted.
2021-07-07 15:27:06 +01:00
Jon Shallow d52986f004 coap_resource_init: Leading '/' is not required for uri_path
Remind users in the documentation that the full path defining the resource in
the uri_path parameter does not normally need a leading '/'.

E.g. It should be "full/path/for/resource", not "/full/path/for/resource".
2021-06-30 14:05:22 +01:00
Jon Shallow 60c69557f3 pdu.h: Remove unassigned response code COAP_RESPONSE_CODE_OK 2021-06-30 12:11:54 +01:00
Olaf Bergmann 1da37b9abb Bump version to 4.3.0 2021-06-21 10:39:42 +02:00
Olaf Bergmann 64505862d1 update release version to rc4 in configuration 2021-06-15 10:27:25 +02:00
Olaf Bergmann 60421db0a5 Add SPDX-License-Identifier to source files
This change adds 'SPDX-License-Identifier: BSD-2-Clause' [1] to
the source code files that originate in the libcoap project.

Note that not all files are tagged because they are pulled in
from other sources and thus may fall under a different license.
More information about these is contained in the LICENSE file.

[1] https://spdx.org/licenses/BSD-2-Clause.html
2021-06-08 18:14:03 +02:00
Olaf Bergmann 677b0c8330 coap.h.windows{,.in}: Remove bits.h 2021-06-08 15:53:23 +02:00
Olaf Bergmann db79086c67 Cleanup: Remove unused header file bits.h
The functions in bits.h have not been used anymore and can be removed.
2021-06-08 15:26:52 +02:00
Olaf Bergmann 44075adb52 uthash: Update URIs to uthash homepage
* Update uthash.h and utlist.h from upstream. These files now include
  the fixed URI to the uthash homepage.
* Update uthash URI in the LICENSE file.
2021-06-08 14:57:16 +02:00
Jon Shallow 8d73044579 coap_send(): Consolidate coap_send() and coap_send_large() for applications
As it is not that intuitive when to use coap_send() or coap_send_large()
in applications, rename libcoap usage of coap_send() to coap_send_internal()
and then all usages of coap_send_large() to coap_send() so that only
coap_send() is required in applications.

Documentation updated accordingly.
2021-05-29 14:08:00 +01:00
Jon Shallow 58fca65ceb net.c: coap_option_check_critical() not updating 'unknown' by ref
'unknown' is updated by coap_option_check_critical if there is a critical
option, but as it is not passed in by reference, any caller does not see
any change to 'unknown'.

Pass in 'unknown' by reference.

Issue got missed in change e2e7830
2021-05-26 14:57:48 +01:00
Jon Shallow f726d0460a Observe: Support FETCH with data for triggered responses
The original requesting PDU is now kept with the Observe request along with
its data and used whenever an additional response needs to be generated.

Abstracted information from the requesting PDU is no longer kept in
coap_subscription_t as it can be obtained from the kept PDU.

No longer any need to check for request PDU in request handlers as it is now
always provided.

coap_resource_notify_observers() now ignores the query parameter, as a
cache_key is now used for request matching.
2021-05-21 13:08:11 +01:00
Jon Shallow aaf4d874d4 TLS Support: Move common TLS support descriptions into libcoap
Added new function coap_string_tls_support() for outputting what key types the
TLS library supports to remove duplicated code out of the examples.
2021-05-12 18:02:37 +01:00
Olaf Bergmann 4214760117 update release version to rc3 in configuration 2021-04-30 09:46:10 +02:00
Olaf Bergmann 2cae4ff662 coap_resource_internal.h: include uthash.h 2021-04-29 12:41:33 +02:00
Olaf Bergmann 07ac47ae73 resource.h: remove uthash from public API
As the uthash macros have been moved to coap_resource_internal.h by
PR #582 [1], see commit da18643, the convenience macros and uthash.h
inclusion can be removed from resource.h

[1] https://github.com/obgm/libcoap/pull/582
2021-04-29 12:41:33 +02:00
Jon Shallow 14cf0fe9e5 struct: Remove struct prefix for structures that are typedef'd 2021-04-26 16:52:14 +01:00
obgm 8c4a566313 Merge pull request #661 from mrdeep1/const_pdu
net.h: Make request PDUs const in functions
2021-04-26 17:32:48 +02:00
Jon Shallow 17b7c13435 net.h: Make request PDUs const in functions
Now that coap_method_handler_t passes in the request PDU as const, make
functions that have request PDUs as a parameter const for that parameter.
2021-04-26 08:00:26 +01:00
Jon Shallow f436961084 coap_session.c: Correct coap_session_get_max_retransmit() name
Make things consistent.
2021-04-23 09:11:19 +01:00
Jon Shallow 23f8a531b1 Nits: Fix documentation
Remove a duplicate definition.
2021-04-22 16:47:35 +01:00
Jon Shallow 5bcd89da01 handlers: Make parameters const where appropriate
Also remove the unneeded parameters which can easily be derived - e.g context
and token.
2021-04-22 07:18:47 +01:00
Olaf Bergmann 2e54ca5252 pdu.[hc]: make token argument const in coap_pdu_duplicate() 2021-04-21 14:38:54 +02:00
Olaf Bergmann 3f7ba0afc8 Bump API version to 3, release candidate 2 2021-04-21 14:38:54 +02:00
Jon Shallow 84a69c7436 tls: Update coap_session_get_tls() to return actual TLS information 2021-04-21 09:25:57 +01:00
obgm 75a41b7aed Merge pull request #650 from mrdeep1/lwip_warnings
lwip: Fix compiler warnings
2021-04-21 09:52:11 +02:00
Jon Shallow ac7ad8cd46 lwip: Fix compiler warnings
There still is a #warning for inet_ntop().
2021-04-20 20:08:03 +01:00
Jon Shallow ab78bc8254 coap_dtls.h: Move internal structures and functions int coap_dtls_internal.h
This removes the functions etc. being available in the standard header files,
but not available in the dynamic library.
2021-04-20 17:05:38 +01:00
obgm 04c641f7f0 Merge pull request #639 from mrdeep1/obf_pdu_t
coap_pdu_t: Obfuscate coap_pdu_t for applications
2021-04-20 15:22:08 +02:00
Olaf Bergmann 9e3ba503ec coap_dtls.h: Fix doxygen warning
This change removes a doxygen comment starter because doxygen is
getting confused otherwise because of the immediately preceding
documentation group start.
2021-04-20 14:15:51 +02:00
Jon Shallow e4e067e5fb coap_pdu_t: Obfuscate coap_pdu_t for applications
Move coap_pdu_t to coap_pdu_internal.h.

Move internal PDU based function definitions to coap_pdu_internal.h.

Replace most references to "struct coap_pdu_t" with "coap_pdu_t".

Create new enum coap_pdu_type_t, enum coap_pdu_code_t and coap_option_num_t,
using them where appropriate for clarity of documentation.

Provide new functions to allow applications to access/update parts of
coap_pdu_t as appropriate and document as appropriate.

Update examples to use these new access functions where appropriate.
2021-04-20 10:31:14 +01:00
Olaf Bergmann fd5ecf5697 Add in configuration option for async (separate responses)
The new configuration option --disable-async now allows to switch
of support for asynchronous operations.

The new function coap_async_is_supported() can be used to check
if the library was built with async support.
2021-04-20 10:36:48 +02:00
obgm b9989ef485 Merge pull request #645 from mrdeep1/mcast_delay
Multicast: Add in response delay
2021-04-20 10:31:57 +02:00
Jon Shallow e008d905fd Multicast: Add in response delay
See https://tools.ietf.org/html/rfc7252#section-8.2

Also updated coap_find_async() to search on token instead of mid as
mid is not used in reliable transports.
2021-04-19 11:09:19 +01:00
Jon Shallow 028b3062f6 internal structs: Obfuscate coap_packet_t and coap_socket_t for applications
Move coap_socket_t and coap_packet_t to coap_io_internal.h.

Move internal io based function definitions to coap_io_internal.h.

Replace most references to "struct coap_socket_t" with "coap_socket_t" and
references to "struct coap_packet_t" with "coap_packet_t".
2021-04-16 22:08:10 +01:00
obgm d9ff2f0ff7 Merge pull request #630 from mrdeep1/obf_async_t
coap_async_state_t: Obfuscate coap_async_state_t for applications
2021-04-16 20:13:23 +02:00
Olaf Bergmann 1b15bf244f coap_net_internal.h: add missing doxygen group end marker 2021-04-16 18:27:55 +02:00
Jon Shallow dc1ca3c001 coap_async_state_t: Obfuscate coap_async_state_t for applications
Move coap_async_state_t to coap_async_internal.h and rename to coap_async_t
as it no longer has any state.

Refactor the async logic to simplify usage and provide libcoap based delay
functionality support for request/response traffic such as multicast.  Let
libcoap decide when the delayed response is to be sent.

Move internal async based function definitions to coap_async_internal.h.

Replace most references to "struct coap_async_state_t" with
"coap_async_t".

Provide new functions to allow applications to access parts of
coap_async_t as appropriate.

Update examples to use these new access functions where appropriate.

Add in new man page.
2021-04-16 14:29:52 +01:00
Jon Shallow f8d9af4b93 coap_context_t: Obfuscate coap_context_t for applications
Move coap_context_t and coap_queue_t to coap_net_internal.h.

Move internal context and queue based function definitions to
coap_net_internal.h.

Replace most references to "struct coap_context_t" with "coap_context_t".

Provide new functions to allow applications to access parts of coap_context_t
as appropriate and document these functions.

Update examples to use these new access functions where appropriate.

For the man documentation, move the server session setup functions to (new)
coap_endpoint_server(3) and update coap_context(3) with all the context access
functions as these are common to both the client and server.
2021-04-15 17:27:02 +01:00
Jon Shallow 0c3928f536 coap_session_t: Obfuscate coap_session_t for applications
Move coap_session_t and coap_addr_hash_t to coap_session_internal.h.

Move internal session based function definitions to coap_session_internal.h.

Replace most references to "struct coap_session_t" with "coap_session_t".

Provide new functions to allow applications to access parts of coap_session_t
as appropriate and document these functions.

Update examples to use these new access functions where appropriate.

For the man documentation, move the client session setup functions to (new)
coap_endpoint_client(3) and update coap_session(3) with all the session access
functions as these are common to both the client and server.
[coap_endpoint_server(3) will be created when coap_context_t is obfuscated.]
2021-04-09 13:13:46 +01:00
obgm 4426fa2a69 Merge pull request #624 from mrdeep1/versioning
versioning: Include api version in non-posix coap_config.h/coap.h .in…
2021-04-08 14:29:14 +02:00
Jon Shallow 91737ccb46 versioning: Include api version in non-posix coap_config.h/coap.h .in files
Add in some new .in files, but still keep original files in distribution
files.

Essentially, use coap@LIBCOAP_API_VERSION@ (or equivalent) instead of
coap2. so resultant files have the correct value.

coap_config.h.lwip.in: (new)
coap_config.h.riot.in: (new)
include/coap2/coap.h.windows.in: (new)

As per https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html, many of the
coap2/ prefixes are not required for #include, so these have been removed.

Make sure that the test suite accesses the latest source version of
coap@LIBCOAP_API_VERSION@/coap.h by creating a tests/test_common.h.in that
makes the correct tests/test_common.h which is included in all of the test
suite files.
2021-04-07 13:01:42 +01:00