Commit Graph
10 Commits
Author SHA1 Message Date
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
Jon Shallow 9612b50c5f libraries: Rename libcoap-x to libcoap-x-notls and make libcoap-x default linker
Make the old installed libcoap-2.{so,la,a,pc} libcoap-2-notls.{so,la,a,pc}, and
make the installed libcoap-2.{so,la,a,pc} be a set of soft links to installed
libcoap-2.{tlstype}.{so,la,a,pc}.

Thus installed libcoap-2.{so,la,a,pc} will be based on the latest (D)TLS
library build.

Update the linking documentation.
2021-04-08 16:40:17 +01:00
obgm 7906bcf2a3 Merge pull request #613 from mrdeep1/message_id
message id: clean up documentation usage of transaction which is message id
2021-03-18 13:52:10 +01:00
Jon Shallow 7b8bd139d0 General: Fix minor issues
src/coap_tinydtls.c:

Replace UNUSED with COAP_UNUSED that got missed from a merge.

man/examples-code-check.c:
src/pdu.c:
tests/oss-fuzz/pdu_parse_target.c:

Fix trailing white space.

win32/libcoap.vcxproj:
win32/testdriver/testdriver.vcxproj:

Correct include/coap2 paths.
2021-03-15 16:01:21 +00:00
Jon Shallow 48ae6b0fdc message id: clean up documentation usage of transaction which is message id
CoAP transaction id was formerly defined as a hash of the remote address and
message id of the CoAP PDU.  It now only refers to, and is used as, the
message id.

Replace occurences of 'transaction id' with 'message id' to reflect naming in
RFC7252.

Correct the definition of coap_tid_t to what it actually represents.

Replace occurrences of coap_tid_t with coap_mid_t.

Replace uses of tid with mid

Remove unused function coap_find_transaction().
2021-03-08 18:49:30 +00:00
Jon Shallow c8ab318e48 Ubuntu 20.4: Fix builds as Ubuntu 20.4 will be used by github workflows
.github/workflows/main.yml:

Build all the cmake TLS variants.

CMakeLists.txt:

Add in missing file.

examples/tiny.c:
include/coap2/encode.h:

Move COAP_PSEUDOFP_ENCODE_8_4 functions from encode.h to tiny.c.
Fix COAP_PSEUDOFP_ENCODE_8_4_DOWN 'ls' ordering complaint.

man/examples-code-check.c:

Fix compile warning, allow 'Unused but set variables' in examples and set
-Werror when compling the examples.

examples/lwip/Makefile:

Remove  compilation option -fpack-struct
2021-03-01 15:47:55 +00:00
Jon Shallow b2233810c2 examples-code-check.c: Add in function checking as well
Build dummy functions based on the SYNOPSIS definitions for further checking.
Note: COAP_STATIC_INLINE functions have to be excepted.
2021-02-26 08:59:42 +00:00
Jon Shallow cb8c7bffc9 Cygwin: Add in compiler support
See https://sourceforge.net/p/libcoap/mailman/message/37039434/

Works for

Computer: Windows 10 64 bit & CYGWIN_NT-10.0 x86_64
Cygwin: 3.1.5-1
OpenSSL: 1.1.1g
gcc:9.3.0

and gcc-10.2.0 + openssl1.1.1f

configure.ac:

Support cygwin build environment.  If so, set -D_CYGWIN_ENV in CFLAGS.

libtool: warning: undefined symbols not allowed in x86_64-pc-cygwin shared libraries; building static only
still to be fixed.

.gitignore:

Ignore *.exe filenames

src/coap_io.c:

define ipi_spec_dst as ipi_addr if _CYGWIN_ENV

examples/client.c:
examples/coap-rd.c:
examples/coap-server.c:
examples/etsi_iot_01.c
man/examples-code-check.c:
src/coap_io.c:
src/coap_tcp.c:

Fix compiler warnings.

sizeof(socklen_t) != sizeof(size_t) [-Wsign-compare]
isdigit() etc. complain about byte size array subscripts [-Wchar-subscripts]
snprintf size checks [-Wformat-truncation=]

Update
2020-11-13 16:12:24 +00:00
Olaf Bergmann da38169b42 examples-code-check.c: add NULL pointer check before closing file
This fixes CID 1495717.
2020-06-19 16:07:37 +02:00
Jon Shallow 7812efb1eb Man examples: Add in support to check that the man example's code compiles
There needs to be an easy way to validate that the examples provided in the
man pages compile without errors.

This PR provides a new executable examples-code-check that can be run against
the .txt.in files that are in the man directory.  It abstracts the code for
each example and then runs the compiler against that stub code reporting errors
and warnings as appropriate for subsequent fixing in the man page.

.gitignore:

Ignore the new executable and the files it generates.

Makefile.am:
configure.ac:

Remove MAN_DIR and hard code in the man directory so that examples-code-check
is always built.

autogen.sh:

Make sure that all the temporary stub code files are cleaned up.

man/Makefile.am:

Support building and clean-up of the new examples-code-check.

man/examples-code-check.c: (new)

The code that parses the man pages, looking for examples and the gets
the examples compiled, testing for errors.
The function definitions in the SYNOPSIS section are also included in the
compilation of the examples.

scripts/build.sh:

If WITH_TESTS is set, check that the man page examples compile.

man/coap_encryption.txt.in:
man/coap_io.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:

Correct the SYNOPSIS function definitions.
2020-05-04 14:47:36 +01:00