Commit Graph
433 Commits
Author SHA1 Message Date
Olaf Bergmann a4358bd2ce added tests for relative timestamps 2014-02-05 14:53:58 +01:00
Olaf Bergmann 160f570c6f include tests with distribution 2014-02-04 18:15:26 +01:00
Olaf Bergmann 46a107dbcd update 2014-02-04 17:58:08 +01:00
Olaf Bergmann 660deefe73 Support for block-wise transfer of /.well-known/core. 2014-02-04 17:56:31 +01:00
Olaf Bergmann a3a17fcb1d use coap_opt_block_num() instead of COAP_OPT_BLOCK_NUM 2014-02-04 17:55:56 +01:00
Olaf Bergmann b5fe35646b Fixed handling of zero-length options in COAP_OPT_BLOCK_LAST macro.
The macro did not respect zero-length option values hence a pointer
to the option byte itself was returned. This macro now returns NULL
for zero-length option values. Macros and functions that use this
macro have been updated accordingly. COAP_OPT_BLOCK_NUM has been
replaced by the function coap_opt_block_num().
2014-02-04 17:50:35 +01:00
Olaf Bergmann a391c9e9cb Fixed delta for Accept option.
The number has changed from 16 to 17 in coap-18.
2014-02-04 17:48:45 +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 05713f48e8 Unit tests for the new functionality of coap_print_link() and print_wellknown() 2014-01-07 17:37:49 +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 78794d3385 bugfix: wrong calculation of written bytes in .well-known/core payload 2014-01-03 16:18:27 +01:00
Dag Björklund c234833d16 renaming parameters named list, as there is a struct named list, and for c++ list and struct list is the same
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
2013-12-30 01:18:22 +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 2d57017540 removed comment 2013-12-30 01:05:18 +01:00
Dag Björklund 07065b3d1f adding extern C to make libcoap c++ compilable
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
2013-12-30 01:02:58 +01:00
Dag Björklund 85ea3eebc7 Only requiring an observervable resource to have a GET handler, if it is in fact an observable resource
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
2013-12-30 00:50:45 +01:00
Olaf Bergmann b966a0c834 increased minor version number for LWIP port 2013-12-30 00:29:06 +01:00
Olaf Bergmann 9e99ad975b Merged with LWIP port from chrysn, see <https://git.gitorious.org/coap-lwip/coap-lwip.git>
This introduces new compiler flags WITH_POSIX and WITH_LWIP to
distinguish target platforms.
coap-lwip
2013-12-23 12:16:27 +01:00
chrysn af2096a047 add coap to the lwip example 2013-12-09 15:38:55 +01:00
chrysn 691a87d812 minimal server for lwip demo (no coap yet) 2013-12-09 15:38:49 +01:00
Olaf Bergmann 99348b9e6a removed outdated comment 2013-12-06 16:33:03 +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 c983c853d7 check for an error case
if the coap pdu struct is larger than the headers that are stripped off
a datagram by the time it arrives at coap, all the nice zero-copying
stops working. instead of working around by allocating bigger headers
(which would go untested), it was decided to lock up. given how
reproducible the header calculations are, this will let the developer
know what's up early, if this ever happens to be critical at all.

there are two plausible causes for this to happen:

* the pdu struct grows, eg. because of additional fields or becaus it is
  used on architecture with large alignment requirements
* packages "come in shallow", that is, are created from an interface
  that barely has headers. such an interface could be a network
  interfaces created from a hardware network stack.

this also changes the sizes of allocated pdus, in which previously, the
probelm was not considered and covered by overallocation.
2013-11-17 16:53:35 +01:00
chrysn 1b1f4d0db4 (compiler warning fix) 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 030e87185a implement COAP_MALLOC_TYPE on lwip
the approach fits very well with the lwippools, and only requires
minimal changes there.
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 1199324dc7 fix wrong name for memp resource 2013-11-17 16:53:08 +01:00
chrysn 205520b601 zero-copy package reception 2013-11-17 16:53:08 +01:00
chrysn 7359e0ca4d use lwip pools for resources and resource attributes 2013-11-17 16:53:07 +01:00
chrysn c23d681036 allocate the coap context in the lwip memory pools 2013-11-17 16:45:30 +01:00
chrysn f3d98c9a2b 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:44:34 +01:00
chrysn d573c0779a use lwip pools for observations 2013-11-17 16:43:51 +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 1961caeebc use lwip pbufs for pdu allocation
so far, this only replaces the allocator; it is not used yet for
zero-copy operations.
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 8fac6ed0fa introduce WITH_POSIX (as compared to WITH_COAP etc)
this will make reading the ifdefed sections easier.

as the typedef struct __coap_address_t {...}; /
define coap_address_t __coap_address_t trick is not needed any more to
detect whether a WITH defined coap_address_t or not, it was removed.
2013-11-17 16:32:09 +01:00
chrysn e32a0f3497 add coap_add_option_later function
the coap_add_option_later works like coap_add_option, but does not take
data. instead, it allocates the option empty, and returns an address the
application has to fill with data later.

this is especially useful for the etag and block options; the
application can write out its variable data, generate a checksum while
writing, and fill the etag when the data is already written to the pdu.
with the block options, the more flag can be set at the last moment.
2013-11-17 16:30:10 +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 6498b01552 lwip address fields are constant sized 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 697e13d649 non-c99 compatibility 2013-11-17 16:30:09 +01:00
chrysn 75116fe2b3 lwip for net.c 2013-11-17 16:30:09 +01:00
chrysn 0bd172032a defunct time implementation for lwip 2013-11-17 16:30:09 +01:00