Commit Graph
393 Commits
Author SHA1 Message Date
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
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 42296f73f5 introduce partiallydirty resources and dirty subscriptions
this change spreads the concept of "dirty" from resources to
subscriptions. this allows queuing up notifications in case not all of
them can be transmitted at the same time (which can happen due to
constraints in pdu or node space).

when a dirty resource's notifications can not be sent, the resource is
marked as partiallydirty, and on the subscriptions that could not be
sent out, the dirty flag is set. they get cleared later when
coap_notify_observers gets run again, as it not only looks for dirty,
but also for partiallydirty resources.

note that there is currently no facility that prevents that all the
nodes get assigned to the send queue, leaving no room for receiving
packages (which happens in mass notifications, blocks all incoming
packages and is only resolved by the transmissions timing out). my
current test setup always leaves at least one node free for reception by
over-allocating and freeing a node on sending.
2013-11-17 16:05:35 +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 b116fc6d79 adjust client and server example to relative timers 2013-11-06 22:34:48 +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 89acaa6775 bugfix: off-by-one error in coap_print_addr()
The closing ']' was misplaced, and the pointer not updated correctly. Thanks
to Andreas Bender for pointing this out.
2013-09-09 13:01:05 +02:00
Olaf Bergmann 66012c7bf9 Merge branch 'master' of ssh://git.code.sf.net/p/libcoap/code 2013-09-06 14:37:03 +02:00
Olaf Bergmann 14a5473396 Fixed output of IPv6 addresses with Contiki in coap_print_addr()
Addresses have been truncated and possibly had the wrong byte order. Thanks
to Andreas Bender for pointing this out.
2013-09-06 14:35:16 +02:00
Olaf Bergmann d0574b2ef4 Merge branch 'master' of ssh://git.code.sf.net/p/libcoap/code 2013-09-05 13:26:22 +02:00
Olaf Bergmann 968939c2db updated ChangeLog and increased patch level 2013-09-03 14:32:02 +02: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 3e47b66c29 increased size of argument type to support large option numbers
Note that the bit field for filters would grow very large if
COAP_MAX_OPT is set to larger values.
2013-09-03 14:11:24 +02:00
Olaf Bergmann ada296efaf added new test cases for error response generation
test t_error_response8 will fail when COAP_MAX_OPT < 2000
2013-09-03 14:07:16 +02:00
Olaf Bergmann 5d9ba55303 option number for Accept has changed in coap-18, fixed test_encode_pdu5() 2013-09-03 13:51:30 +02:00
Olaf Bergmann e4f922b833 bugfix: set new random value when more than sizeof(v) bytes are requested
The function contiki_prng_impl() used to fill the entire buffer with the
same two bytes of random data. (Thanks to Andreas Bender for pointing out.)
2013-08-09 15:00:35 +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 fccae63cb9 added missing t_list.h to HEADERS 2013-07-22 21:52:58 +02:00
Olaf Bergmann bf3530386b Basic list wrapper to align utlist.h with Contiki's list API.
This file was originally part of tinydtls.
(cherry picked from commit 5db598c45533b5471bb8c8bd6fac8f67b62df80d)
2013-07-22 17:28:04 +02:00
Olaf Bergmann 5318781565 option codes updated according to coap-18 2013-07-04 18:45:45 +02:00
chrysn 1715b80d87 declare the inline function opt_finished static
an `inline int opt_finished` causes GCC to spew this error when used
with -std=gnu99:

libcoap/option.c:165: undefined reference to `opt_finished'

Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
2013-05-03 12:52:05 +02:00
Olaf Bergmann 31c36a777b clean shared lib 2013-04-05 14:44:40 +02:00
Olaf Bergmann 14270f6cea quick hack to create shared library (use configure --with-shared) 2013-04-05 14:42:53 +02:00
Markus Becker 72e6f738c8 Add token to request in example client. 2013-02-05 15:46:47 +01:00
Olaf Bergmann 2045d377ca code cleanup in print_wellknown() 2013-02-05 15:08:57 +01:00
Markus Becker 5415743c30 Add token to request in example client. 2013-02-05 14:57:12 +01:00
Markus Becker 75acc0d03f Add token length to output of coap_show_pdu(). 2013-02-05 14:56:39 +01: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 b465bcc692 update 2013-02-01 14:14:22 +01:00
Olaf Bergmann 8eaa930de6 fixed bug #15 (#warn instead of #warning)
file a #warning for gnu preprocessor only.
2013-02-01 14:12:22 +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 6a613598c6 removed unused option iterator 2013-02-01 13:54:16 +01:00
Thomas Pötsch a3a60667a6 fixed block-wise transfer for power-of-two sized payloads 2013-01-29 10:41:27 +01:00
Olaf Bergmann b376fccf2d add missing licensing information when creating tar archive 2013-01-24 16:59:26 +01:00
Olaf Bergmann 107f6ce1c3 fixed year in copyright note 2013-01-21 17:27:21 +01:00
Olaf Bergmann 8b8c3d9ac9 more fixes for option iterator
Renamed option in struct coap_opt_iterator_t to next_option to detect
errors.
2013-01-21 17:25:36 +01:00
Olaf Bergmann 7852aa66a5 Merge branch 'klaus-encoding'
Conflicts:
	configure.in
	option.c
2013-01-19 11:05:35 +01:00
Olaf Bergmann 5458909797 Merge branch 'master' of ssh://libcoap.git.sourceforge.net/gitroot/libcoap/libcoap 2013-01-19 10:46:37 +01:00