Commit Graph
119 Commits
Author SHA1 Message Date
Olaf Bergmann d5dc48d97a Track local network interface for received packets.
Changed various functions to pass the local interface using the
new coap_endpoint_t abstraction. This change uses the functions
implemented earlier in commit 786ca6da (branch dcaf) but does not
use callback functions for network I/O.

This change closes bug #23 "server responds from wrong endpoint
(ipv6 address)" (POSIX only, CONTIKI and LWIP tbd).
2014-03-21 18:12:40 +01:00
Olaf Bergmann a3fae3ce3a Support cancellation of observe relationships using GET w/ Observe: 1.
Adding and removal of observes is now handled by libcoap. The application's
GET handler only needs to add the Observe option (see server.c:hnd_get_time()).
2014-03-09 02:27:52 +00:00
Olaf Bergmann 37699fd058 Cancel retransmission of messages when response has arrived.
In case the ACK of a separate message is lost, the request would be
retransmitted until the maximum number of transmissions is reached because
the response usually has a different messsage id. The matching at this
point is done based on the response's source address and token.
2014-03-06 15:38:37 +00:00
Olaf Bergmann e2dfed6035 bugfix: #24 Empty ACK improperly includes Token
Included the patch proposed by tbahls to fix this issue. Now, the
ACK message is always truncated to its bare header when the message code
is 0.00.
2014-02-25 19:03:25 +01:00
Olaf Bergmann 909cccd05d Support for response code 7.31 to cancel observation relationships.
This new behavior is described in Section 4.6 of draft-ietf-core-observe-12.
The idea is to send a response with code 7.31 and the token to identify
the subscription.
2014-02-25 19:00:10 +01:00
Olaf Bergmann 2c96f39e31 Always acknowledge confirmable responses.
Instead of letting the receipient acknowledge a confirmable response in
its custom response handler, this is now done automatically.
2014-02-25 17:14:10 +01:00
Olaf Bergmann 9e25cd26cb merged with branch relative-timestamps 2014-02-05 15:08:37 +01:00
Olaf Bergmann 660deefe73 Support for block-wise transfer of /.well-known/core. 2014-02-04 17:56:31 +01:00
Olaf Bergmann f37ec9654e (Yet incomplete) support for block-wise transfer of .well-known/core.
The function wellknown_response() now honors a Block2 option when present
in the request or adds a new Block2 option to the response when the resource
description does not fit.

Bug: get_wkc_len() currently returns a hard-coded value instead of calculating
the size of the resource description (which requires changes in resource.c).
2014-01-07 23:41:15 +01:00
Olaf Bergmann 591aa06783 Support for partial output of .well-known/core
This change provides basic support for block-wise transfer of resource
descriptions. print_wellknown() now takes an additional parameter that
specifies the offset in the resource description where output shall start.
coap_print_link() has been modified to truncate resource descriptions that
do not fit in the given buffer (instead of failing with an error code as
was the case before).
2014-01-07 17:33:49 +01:00
Olaf Bergmann 3f69cd1e9b Use log levels from syslog.h when available.
Thanks to Dag Björklund for pointing this out.
2013-12-30 01:15:11 +01:00
Olaf Bergmann 627ce6c9e3 bugfix: coap-client segfault on ACK in coap_remove_from_queue()
Need to check if new queue head is NULL before accessing (*queue)->t.
2013-12-05 19:08:16 +01:00
chrysn 77c5856ad9 a clean lwip timer interface based on the relative-timestamps branch 2013-11-17 17:40:12 +01:00
chrysn 91faa07b5d treat time wraps better at lwip-timer / coap-node boundary
this mitigates the problems from
https://sourceforge.net/p/libcoap/bugs/27/, but does not resolve it.
2013-11-17 16:53:35 +01:00
chrysn 316e189d4e calculate offset for adjusting back pbuf to contain pdu again 2013-11-17 16:53:35 +01:00
chrysn 706fe27690 use lwip timers for retransmission in lwIP 2013-11-17 16:53:09 +01:00
chrysn 49ad7bdb79 use lwip provided time function 2013-11-17 16:53:09 +01:00
chrysn 205520b601 zero-copy package reception 2013-11-17 16:53:08 +01:00
chrysn c23d681036 allocate the coap context in the lwip memory pools 2013-11-17 16:45:30 +01:00
chrysn 22e1e5093c restore pdu after sending
this way, the send-then-delete approach to pdus keeps working (meaning
less lwip specific patches), and for retransmission it's required to
keep the pdu around anyway (until we switch the send queue to a pbuf
queue)
2013-11-17 16:40:56 +01:00
chrysn 0b9c55d6cb zero-copy sending 2013-11-17 16:40:55 +01:00
chrysn 2a6f04dd16 use lwip memp pools for allocating coap_queue_t 2013-11-17 16:40:55 +01:00
chrysn e74a4c1690 further use of WITH_POSIX
some contiki specific defines were eliminated by defining ntohs as
uip_ntohs in the contiki confiuration header file
2013-11-17 16:40:55 +01:00
chrysn 6d28c3154e use htonl/ntohl/ntohs/htons from lwip
on bigger systems, you don't simply write endian.h
2013-11-17 16:30:10 +01:00
chrysn c65b384ff1 free memory after sending 2013-11-17 16:30:10 +01:00
chrysn 325c805c07 asserts don't need a newline 2013-11-17 16:30:10 +01:00
chrysn 9365b2f3d9 temporarily enable malloc for coap_{malloc,free}_node 2013-11-17 16:30:09 +01:00
chrysn 75116fe2b3 lwip for net.c 2013-11-17 16:30:09 +01:00
chrysn 00d73408dc porting required to get a minimal example to build with lwip stack 2013-11-17 16:30:09 +01:00
chrysn c5f88316e1 allow having a resource list instead of a hash
this brings O(n) lookup time for resources, but allows removing dynamic
memory management
2013-11-17 16:28:27 +01:00
chrysn 4951e368a1 have all coap_log error messages complete their lines 2013-11-17 16:05:12 +01:00
chrysn 3d2f21a2ce fix segfault when removing the only element in the send queue 2013-11-17 16:05:04 +01:00
chrysn edab7b40c4 drop assertion on not wrapping
it is the idea of the relative-timestamps branch that such asserts are
not necessary any more, and that if timestamps wrap, they just may.

rephrased expression for determining t for clarity.
2013-11-17 16:04:55 +01:00
Olaf Bergmann e1152dfd7c added coap_adjust_basetime() to advance sendqueue_basetime 2013-11-10 11:51:38 +01:00
Olaf Bergmann c4cb5ce770 Revert "use time comparion functions"
This reverts commit 2d0ae6b82b.

Possibly not use this for relative timestamps.
2013-11-08 17:00:08 +01:00
Olaf Bergmann 2d0ae6b82b use time comparion functions 2013-11-08 10:14:28 +01:00
Olaf Bergmann 1df1ef5483 use relative timers in retransmission queue
This change addresses bug #27 "_order_timestamp can't handle time wraps".
t in struct coap_queue_t now is the time (in ticks) relative to the
previous entry in the queue. The first entry is relative to sendqueue_basetime
in struct coap_context_t (TODO: possibly make the first entry in the
queue relative to 0, eliding the need for sendqueue_basetime).

As no other ordering of nodes except for timestamps is used, the function
parameter for coap_insert_node() has been removed.
2013-11-06 22:17:31 +01:00
Olaf Bergmann 095e2ee629 bugfix: #17 coap_opt_size underestimates space usage
Fixed calculation of option size in coap_new_error_response(). As
only some options are copied from the request, the delta value can
increase and thus require more space to encode. This fix closes
https://sourceforge.net/p/libcoap/bugs/17/ (thanks to chrysn and
tbahls for pointing this out).
2013-09-03 14:19:59 +02:00
Olaf Bergmann accc094785 notifications and observer removal according to draft-ietf-core-observe-09 2013-07-23 17:33:03 +02:00
Olaf Bergmann 5318781565 option codes updated according to coap-18 2013-07-04 18:45:45 +02:00
Olaf Bergmann c007638c1a fixed bug in size-calculation of coap_new_error_response() (applied patch from Thomas Stammeier)
The calculation of required space for textual error phrase did not take into account the one
byte for the payload start marker.
2013-02-04 11:01:13 +01:00
Olaf Bergmann 81ee38611d applied patch from chrysn to fix bug in .well-known/core generation (missing 2 bytes) 2013-02-01 13:58:11 +01:00
Olaf Bergmann b186bfe22d bugfix 2013-01-18 17:40:39 +01:00
Olaf Bergmann 54ef9fd83c Klaus-encoding and option iterators 2013-01-18 16:44:19 +01:00
Olaf Bergmann f48ecd9f2d replaced CoAP option Token by new encoding 2013-01-11 17:44:49 +01:00
Olaf Bergmann cd10925056 modified option parser 2013-01-11 11:32:22 +01:00
Olaf Bergmann c6412f2038 Rework of option parser to support "Klaus encoding" (coap-13), unit tests
The subdirectory "tests" now contains a growing set of unit tests for the
libcoap API. To use this, you will need CUnit (see http://cunit.sourceforge.net)
and must configure with the option --with-tests.
2013-01-07 17:37:49 +01:00
Olaf Bergmann ae4cb93619 debug code cleanup 2012-11-20 13:02:59 +01:00
Olaf Bergmann 624159aa7c bugfix 2012-11-20 12:55:57 +01:00
Olaf Bergmann 8bfc00481a coap-12: option type numbers, option jumps and length coding 2012-11-20 12:24:15 +01:00