Commit Graph
17 Commits
Author SHA1 Message Date
Jon Shallow 98805f70a5 Documentation tidy up
Add in codespell to pre-commit to help fix documentation errors.
2026-08-08 12:05:03 +01:00
Jon Shallow 152f6a8a58 Includes: Remove unnecessary include files
Include common system header files in coap_internal.h based on HAVE_*H
definitions.

Remove these system header files from include/*/*.h.

Add in system header files where appropriate in various apps.
2026-02-02 10:09:17 +00:00
Jon Shallow c9135b6b26 Copyright: Update to 2026 2026-01-05 10:37:26 +00:00
Jon Shallow ea01661faf Zephyr: Support C++ builds
Some of the Zephyr include files need to be C++, not C based. The 'extern "C"'
wrapper in include/coap3/coap.h means that all #include are treated as being C.

Remove 'extern "C"' wrapper from include/coap3/coap.h and add wrapper to
include files after #include and before any function / structure definitions.

Add in a C++ build test for CI.
2025-08-21 12:17:41 +01:00
Jon Shallow fada39dcba coap_cache.h: Fix documentation @return error 2025-04-14 17:15:56 +01:00
Jon Shallow 0ba446d788 App Data: Provide new set of storing app data in various structures
New functions
 coap_async_set_app_data2()
 coap_cache_set_app_data2()
 coap_context_set_app_data2()
 coap_session_set_app_data2()
that, multi-thread safe, store an application data pointer and return the
previous data pointer (if any). There is an optional callback that will
be called when the respective storage object is released that can free
off as appropriate the data that was stored.

These replace the existing coap_*_set_app_data() functions and
coap_*_get_app_data() can be used to get the stored data pointer.
2025-03-18 16:57:52 +00:00
Jon Shallow 4289cb072d Copyright: Update to 2025 where appropriate 2025-02-17 09:37:55 +00:00
Jon Shallow 91d8fad663 locking: Simplify maintenance / debugging /documentation
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.

Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.

Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.

Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.

Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]

Work in progress for all the functions that need to be multi-thread safe.
2024-05-22 11:40:44 +01:00
Jon Shallow 8237c1d801 Copyright: Update to 2024 2024-01-02 08:45:59 +00:00
Jon Shallow 8f068c0bbf pre-commit: Include re-styled include files to checks 2023-07-11 20:17:10 +01:00
Jon Shallow 3552b53be4 Copyright: Update copyright date to end 2023 as appropriate 2023-01-02 11:45:10 +00:00
Jon Shallow 7aa003bbe7 RFC links: Provide consistency for links to RFCs
Use https://rfc-editor.org/rfc/rfc.... instead of
https://tools.ietf.org/html/rfc.... for the RFC links.

Use https://rfc-editor.org/rfc/rfc.... instead of
https://datatracker.ietf.org/doc/html/rfc.... for the RFC links.
2022-12-20 20:36:53 +00:00
Jon Shallow 415fbdb7cd RFC9175: Add in support for the Echo and Request-Tag options
A unique Request-Tag is added to any PUT/POST/FETCH request that contains
a large body.  The server is then able to differentiate between concurrent
sending of large data using the same session.

If a server responds with a 4.01 and includes an Echo option, then the libcoap
client retransmits the request adding in the received Echo option with the same
value.

If the server responds normally with an Echo option, then the next request
from the libcoap client (internally added by libcoap) will contain that Echo
option.

It is the responsibility of the server application to add in the Echo
option if required and validate the next request unless the Echo is triggered
by OSCORE (RFC8613 Appendix B.1.2).
2022-06-22 15:08:47 +02:00
Jon Shallow 0aeb0d6247 doxygen: Tidy up Modules and Files tab information
doc/module_api_wrap.h: New

Used to split modules into Application and Internal only.

include/coap/*.h:

Module (@defgroup) description put into group application_api or internal_api
as appropriate.

Add in @file information if missing.

src/*.c

Add in @file information.
2021-09-30 16:59:04 +01: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
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
Olaf Bergmann 3f7ba0afc8 Bump API version to 3, release candidate 2 2021-04-21 14:38:54 +02:00