Commit Graph
1881 Commits
Author SHA1 Message Date
obgm fdffe5387a Merge pull request #502 from mrdeep1/cmake_windows
CMakeLists.txt: Fix COAP_DISABLE_TCP
2020-05-06 16:02:16 +02:00
obgm ad6c1c23a1 Merge pull request #496 from mrdeep1/disable_tcp
TCP_DISABLE: reduce more of the dead code when --disable-tcp is in used
2020-05-06 16:01:34 +02:00
obgm 7f9315ffef Merge pull request #503 from mrdeep1/cmake_lib_name
CMakeLists.txt: Make library name libcoap-2 to match name in man pages
2020-05-06 14:55:01 +02:00
Jon Shallow 80275f6515 CMakeLists.txt: Make library name libcoap-2 to match name in man pages 2020-05-06 11:39:16 +01:00
Jon Shallow f08f9ea86e TCP_DISABLE: reduce more of the dead code when --disable-tcp is in used
src/coap_session.c:
src/net.c:

Wrap more code with #if !COAP_DISABLE_TCP

include/coap2/coap_tcp_internal.h:

Wrap function definitions with #if !COAP_DISABLE_TCP to force compiler
warnings if there still is reference to TCP functions and COAP_DISABLE_TCP
is set.
2020-05-06 10:26:37 +01:00
obgm 9040a05690 Merge pull request #501 from mrdeep1/tidy_man_pages
man pages: Tidy up
2020-05-06 10:54:01 +02:00
Jon Shallow 3b60827d9a man pages: Tidy up
man/coap_attribute.txt.in:
man/coap_context.txt.in:
man/coap_encryption.txt.in:
man/coap_handler.txt.in:
man/coap_io.txt.in:
man/coap_keepalive.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:

Make sure the full list is defined in the NAME section
[Gives a2x warnings that there are more than 10 entries, but this is OK]

Update where BUGS can be reported to.

man/Makefile.am:

Remove EXTRA_PAGES as all the names are now defined A2X_EXTRA_PAGES.
2020-05-06 09:33:31 +01:00
Jon Shallow 59b7843b9a CMakeLists.txt: Fix COAP_DISABLE_TCP
Windows testing highlighted that COAP_DISABLED_TCP was not being correctly
set from ENABLE_TCP.

Also sorted some of the lists for ease of maintenance.
2020-05-05 21:27:44 +01:00
Olaf Bergmann 81d41b88e8 mem.c: fix compiler warning for re-definition of assert
Commit 8faa8c28f has moved the inclusion of assert.h to
coap_internal.h. This change therefore removes the definition of
assert to avoid warnings due to multiple definitions.
2020-05-05 19:19:44 +02:00
Olaf Bergmann 0e55b42fd3 [RIOT] coap_io_riot.c: Update to coap_io_ functions
This change replaces calls to the deprecated functions coap_write()
and coap_read() with coap_io_prepare_io() and coap_io_do_io().
2020-05-05 14:25:40 +02:00
obgm 8b31d1415a Merge pull request #488 from mrdeep1/riot_base
Merge in riot/posix_sockets branch
2020-05-05 14:25:07 +02:00
obgm 2d2c14d061 Merge pull request #454 from biodranik/custom-dtls-algorithms-and-groups
Support custom (D)TLS signature_algorithms and supported_groups
2020-05-04 18:33:19 +02:00
obgm 4c299ddc95 Merge pull request #444 from mrdeep1/sign-conversion
Windows C4267 errors: Fix size_t conversion warnings in windows builds
2020-05-04 17:49:45 +02:00
obgm 3758a424bd Merge pull request #498 from mrdeep1/observe_delete_404
resource.c: Send out a 4.04 to any observer when deleting resource
2020-05-04 17:48:35 +02:00
Jon Shallow 3989ca5dba resource.c: Send out a 4.04 to any observer when deleting resource
As per RFC7641:

However, in the event that the state of a resource changes in
a way that would cause a normal GET request at that time to return a
non-2.xx response (for example, when the resource is deleted), the
server SHOULD notify the client by sending a notification with an
appropriate response code (such as 4.04 Not Found) and subsequently
MUST remove the associated entry from the list of observers of the
resource.

src/resource.c:

Send out a 4.04 response to all observers of a resource when deleting it.
2020-05-04 16:24:36 +01:00
obgm 708b577e5c Merge pull request #480 from mrdeep1/get_observe
net.c: Restrict subscriptions to only GET/FETCH requests
2020-05-04 16:53:31 +02:00
Olaf Bergmann 4d7f047f29 configure.ac: increase micro version to beta
In preparation of release 4.3.0, the micro version suffix has been
changed from alpha to beta.
2020-05-04 16:49:37 +02:00
obgm 6212bd3c7f Merge pull request #442 from mrdeep1/examples_code_check
Man examples: Add in support to check that the man example's code compiles
2020-05-04 16:48:06 +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
obgm 1e9900de60 Merge pull request #443 from mrdeep1/man_fix
Remove man page coap_session_str definition duplications
2020-05-04 13:40:30 +02:00
Olaf Bergmann 35b16cef5a README: added CMake status badge
The status badge refers to the default branch (= develop).
2020-05-04 12:41:54 +02:00
obgm 9f604e7006 Merge pull request #441 from mrdeep1/observe_fix
coap-server: Make sure observe updates are sent off asap
2020-05-04 12:40:55 +02:00
Jon Shallow 21e045bb8f coap-server: Make sure observe updates are sent off asap
examples/coap-server.c:

Track time spent in the epoll branch for the select() and coap_io_process()
calls to correctly adjust wait_ms.

Adjust wait_ms to be the remaining amount in the current second, so that
any 'time' observers get the updated time just after the new second starts.

include/coap2/net.h:

Add in support to track that an observe is pending transmission - primarily
a saving of needing to look up if a observe needs to be sent.

include/coap2/resource.h:

Add in support to track the context that 'owns' a resource.

src/resource.c:

Track the context that 'owns' a resource in coap_add_resource().

Track the fact that when we are making a resource partially dirty by recording
that an observe is pending in coap_notify_observers().

In the epoll case, make sure that timerfd triggers immediately when a pending
observe is set so that the application will return immediately from any select()
etc. call to process the libcoap outstanding activity (in particular pending
observes) in coap_resource_notify_observers().

Only call coap_notify_observers() in coap_check_notify if there are any
observes pending.

man/coap_observe.txt.in:

Minor clarifications in the examples.
2020-05-04 11:04:23 +01:00
obgm 3ba85d51c1 Merge pull request #497 from mrdeep1/fix_travis_builds
travis: Fix cmake builds
2020-05-04 11:59:39 +02:00
Jon Shallow ef0903adce travis: Fix cmake builds
Make sure that "apt-get update" is called before "apt-get install".
2020-05-04 10:29:49 +01:00
obgm df13ff7e0f Merge pull request #492 from mrdeep1/user_friendly
Report on old usage of COAP_RUN_BLOCK and COAP_RUN_NO_BLOCK
2020-04-29 16:36:37 +02:00
Jon Shallow 893b5626e1 Report on old usage of COAP_RUN_BLOCK and COAP_RUN_NO_BLOCK
Give a hint in the compiler error message about using deprecated
COAP_RUN_BLOCK and COAP_RUN_NO_BLOCK and what they are replaced with.
2020-04-29 08:41:59 +01:00
Olaf Bergmann 0fccf2e713 LICENSE: Include information on uthash and MbedTLS 2020-04-28 09:09:01 +02:00
Jon Shallow 8c0bdc5065 [RIOT] Bring up to current develop spec 2020-04-24 20:40:26 +01:00
Olaf Bergmann b7411a7b10 [RIOT] coap_io_riot.c: Fix session iteration 2020-04-24 20:16:11 +01:00
Olaf Bergmann efd9b7456d [RIOT] coap_io_riot.c: Use coap_addr_tuple in network I/O functions 2020-04-24 20:16:11 +01:00
Olaf Bergmann 2505283561 [Contiki] coap_io.c: Use Contiki-specific sendto() 2020-04-24 20:16:11 +01:00
Olaf Bergmann dce6ecd5fd [RIOT] coap_io_riot.c: Include coap_internal.h 2020-04-24 20:16:11 +01:00
Olaf Bergmann 8a5ec5b458 [RIOT] Reserve space for options in optlist_t arena 2020-04-24 20:16:11 +01:00
Olaf Bergmann f49b7a7e33 [RIOT] coap_config.h.riot: Added RIOT configuration
This file is used by the RIOT libcoap pkg Makefile as the build
system does not run configure.
2020-04-24 20:16:11 +01:00
Olaf Bergmann 235b715dd5 [RIOT] coap_io_riot.c: Check destination of incoming packets
In coap_run_once(), incoming packets are checked if they are UDP
datagrams with a destination address and port that match either
one of the existing sessions or the bind address of an endpoint.

Packets that do not match these criteria are dropped.
2020-04-24 20:16:11 +01:00
Olaf Bergmann 618de3dc9f [RIOT] coap_io.c: Disable SO_REUSEADDR
Setsockopt SO_REUSEADDR is not available on platform RIOT.
2020-04-24 20:16:11 +01:00
Olaf Bergmann e9a4311631 [RIOT] net.c: disable coap_join_mcast_group()
IPV6_JOIN_GROUP is not available on RIOT, therefore
coap_join_mcast_group() is disabled for now.
2020-04-24 20:16:10 +01:00
Olaf Bergmann 842c2467c0 address.[hc]: Add convenience functions to get/set port
The layout of struct coap_address_t is platform-dependent. This
change introduces getter/setter functions to retrieve and modify
the port component:

   uint16_t coap_address_get_port(const coap_address_t *addr)
   void coap_address_set_port(coap_address_t *addr, uint16_t port)

The respective port is given in host byte order and will be
converted to/from network byte order automatically.
2020-04-24 20:16:10 +01:00
Olaf Bergmann 391e198ab5 net.c: call coap_memory_init() from coap_startup()
To ensure that the arenas for static memory allocation are initialized
properly, coap_memory_init() now is called directly from
coap_startup() for all platforms.
2020-04-24 20:16:10 +01:00
Olaf Bergmann 5593d190d5 [RIOT] mem.c: static memory allocator
coap_malloc_type() and coap_free_type() now use static memarray_t
arenas on RIOT when module memarray is in use. Otherwise, these
functions are mapped to malloc() and free(), respectively.
2020-04-24 20:16:10 +01:00
Olaf Bergmann 9a9b69a58f [RIOT] coap_io.c: coap_run_once() for RIOT now in coap_io_riot.c 2020-04-24 20:16:10 +01:00
Olaf Bergmann 5d930d8683 Makefile.am: Added new file coap_riot.h
The new header file is required by RIOT applications to execute
thread-specific startup code.
2020-04-24 20:16:10 +01:00
Olaf Bergmann 648d8b9a33 coap_io.c, coap_io_riot.c: RIOT-specific coap_network_send()
The RIOT-specific version of coap_network_send() has been moved
to coap_io_riot.c for clarity.
2020-04-24 20:16:10 +01:00
Olaf Bergmann ad1c985fcf Makefile.am: added new file coap_io_riot.c to EXTRA_DIST 2020-04-24 20:16:10 +01:00
Olaf Bergmann 7949440ee0 [RIOT] coap_io.c: replace coap_network_read()
A RIOT-specific version of the function coap_network_read() is
now included in the new file coap_io_riot.c. This function requires
the received gnrc_pktsnip_t structure to be passed with the
coap_socket_t structure.
2020-04-24 20:16:10 +01:00
Olaf Bergmann cf5f1a09e9 coap_session.c: minimize buffer space for coap_session_str()
The buffer szSession for storing a textual representation of the
session structure has been trimmed down to 2 * (INET6_ADDRSTRLEN + 8)
+ 24, allowing two IPv6 address references, port numbers, some
structuring text and about eight characters for the interface index.

Background: coap_print_addr() calls inet_ntop() for address output
which on RIOT is mapped to ipv6_addr_to_str(). As the length parameter
of ipv6_addr_to_str() is a uint8_t, only the lower eight bits of
szSession's size are effectively used. The previous value of 256 then
always lead no ENOSPC because 256 & 0xff == 0.
2020-04-24 20:16:10 +01:00
Olaf Bergmann f510b86573 coap_time.h: RIOT support based on xtimer 2020-04-24 20:16:10 +01:00
Olaf Bergmann 054fbf08ce coap_io.c: basic support for RIOT
RIOT lacks support of the ancillary interface and various ioctls
therefore basic sendto() and recvfrom() are used instead.

coap_io.c: Fix mismatching #elif

This change fixes a mismatching #elif introduced during git rebase
conflict resolution.
2020-04-24 20:16:10 +01:00
obgm 17957e1e68 Merge pull request #430 from gocarlos/develop
add cmake support to libcoap
2020-04-24 20:42:04 +02:00