Commit Graph
45 Commits
Author SHA1 Message Date
Sebastian Sontberg 8ee0342809 Convert function declarations to strict-prototypes format 2014-08-05 01:31:05 +02: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 205520b601 zero-copy package reception 2013-11-17 16:53:08 +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 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 00d73408dc porting required to get a minimal example to build with lwip stack 2013-11-17 16:30:09 +01:00
Olaf Bergmann a5c5f75722 added small comment 2013-01-18 16:42:33 +01:00
Olaf Bergmann 3362f90b41 code cleanup 2013-01-15 16:49:31 +01:00
Olaf Bergmann e68a016b65 payload data 2013-01-11 17:45:12 +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 8bfc00481a coap-12: option type numbers, option jumps and length coding 2012-11-20 12:24:15 +01:00
Olaf Bergmann a30621493f bugfix (Thanks to John Sucaet) 2012-04-18 12:45:27 +02:00
Olaf Bergmann dfa4f32681 bugfix: sanity check on incoming message 2012-03-25 17:05:02 +02:00
Olaf Bergmann 582e59f107 handling of long option lists 2012-03-20 18:47:46 +01:00
Olaf Bergmann ceb3ff90e2 more fixes for Contiki 2012-03-08 18:15:33 +01:00
Olaf Bergmann a335f87847 bugfix 2012-01-20 18:04:08 +01:00
Olaf Bergmann 5f4209e04b observe 2012-01-13 18:43:38 +01:00
Olaf Bergmann 7503262aa9 some fixes for platform minimal-net 2012-01-06 15:27:48 +01:00
Olaf Bergmann a9dc65315b use static buffers for CoAP PDUs 2012-01-02 21:39:52 +01:00
Olaf Bergmann fae51d1cc9 cleaned debug stuff 2011-12-11 15:57:24 +01:00
Olaf Bergmann 2746d0f814 Initial version for Contiki-Server (target minimal-net or mbxxx) 2011-12-07 15:49:43 +01:00
Olaf Bergmann 298ad4fffa Cleaned debug output (now use -v9 to get all of it) 2011-11-17 09:43:57 +01:00
Olaf Bergmann 29be26b536 Response handling 2011-06-16 18:23:09 +02:00
Olaf Bergmann 60c7a7a8ee API improvement. 2011-06-13 02:29:11 +02:00
Olaf Bergmann 852055628f Improved options processing with coap_opt_iterator_t 2011-06-02 02:40:42 +02:00
Olaf Bergmann 758b7f775e Applied patches from Markus Becker (thanks!)
* 0001-Trailing-whitespace-cleanup.patch
* 0001-Went-back-to-2.65-of-autoconf.patch
* 0002-Fix-compiler-warning-for-str.patch
* added several files to Makefile target .gitignore
2010-11-22 13:01:00 +01:00
Olaf Bergmann 2d25b6f262 changes from draft-ietf-core-coap-03
* removed option Uri-Scheme
* added support for Uri-Query
* version number increment (0.07)
2010-10-26 14:40:55 +02:00
Olaf Bergmann 7c8d7f97e2 * check for unknown critical options and reject them
* use .well-known/core instead of .well-known/r (see draft coap-02)
2010-10-22 13:06:04 +02:00
Olaf Bergmann 94cc2c4f42 added license information and general project information 2010-10-18 14:53:04 +02:00
Olaf Bergmann d7f5527003 bugfix: accept empty request URIs 2010-07-26 00:03:10 +02:00
Olaf Bergmann 72194aa8b9 fixed URI hash function
CoAP default URI scheme
prepare for API changes in option handling
2010-07-23 18:22:11 +02:00
Olaf Bergmann 70322a312b net.c: remove subscriptions when RST was received
use length/value encoded strings in coap_uri_t
2010-07-22 18:07:15 +02:00
Olaf Bergmann 72500fa297 added coap_get_data() to retrieve PDU payload 2010-07-12 23:49:33 +02:00
Olaf Bergmann 28a14dbb11 use new malloc/free wrapper 2010-07-12 17:18:48 +02:00
Olaf Bergmann aa409eff46 changes for coap-01
added coap_check_option()
2010-07-11 19:59:29 +02:00
Olaf Bergmann e39c388a54 byte order for transaction id
do not overwrite existing transaction id when sending PDU
2010-07-08 21:23:59 +02:00
Olaf Bergmann 07ca868a95 code cleanup (removed some GCC extensions from pdu.h)
macros for improved handling of coap_opt_t objects
2010-07-05 19:25:57 +02:00
Olaf Bergmann cd38e27298 even more code cleanup 2010-07-04 21:03:11 +02:00
Olaf Bergmann ca5cb93abf transaction handling
added handling of incoming messages on "user layer"
some code cleanup
2010-07-04 20:48:57 +02:00
Olaf Bergmann 841ede849d Updated header bits according to draft-ietf-core-coap-01pre5.
Basic support for sending, retransmissions.
2010-07-04 03:25:45 +02:00
Olaf Bergmann f8a768f3ac Basic CoAP header structure and option encoding 2010-07-02 15:54:18 +02:00