Commit Graph
520 Commits
Author SHA1 Message Date
chrysn cf722e4a63 lwip pdus: update documentation 2015-01-16 12:06:30 +01:00
chrysn d28834a96f lwip port: re-introduce zero-copy pdu creation
this sidesteps the copying parts of coap_parse_pdu, using the directo
allocation of the pdu payload data from the package's pbuf, whose
reference is consumed.
2015-01-16 12:04:40 +01:00
chrysn 4f6c81a5a6 lwip packets: allow pbuf to be extracted 2015-01-16 12:04:03 +01:00
chrysn 6caf836023 lwip pdu implementation: shift from contiguous to memp + pbuf
the old implementation stuffed the pdu struct in front of the
transport-level pbuf, and preserved it on the stack while the packages
were sent.

this had two advantages:

* saving ram
* preserving the other implementation's structure of pdu->hdr == pdu+1
  (ie. starting right after the pdu struct)

but two disadvantages:

* bad readability and pointer juggling in the send routine
* relying on the send function to block until the package is out (which
  works for simple implementations of lwip drivers but not dma etc)

if something really assumes the contiguous memory structure, it will
show (unfortunately by corrupting other pdu structs), and chances are
people use ->hdr anyway.
2015-01-16 12:03:25 +01:00
chrysn 00beb7f1f7 (regroup coap_handle_message code to have pdu handling in one place) 2015-01-16 09:19:58 +01:00
chrysn 8a41533a87 document coap_pdu_t.hdr 2015-01-16 09:15:48 +01:00
chrysn 4cadf731a2 lwip port: store context in endpoint
this is required for the packages incoming via an endpoint to find their
way back to the context.

the relationship between context and endpoint is still to be documented.
2015-01-16 08:45:28 +01:00
chrysn 2680f038b0 lwip port: remove context struct members that are now in endpoint 2015-01-16 08:45:10 +01:00
chrysn fc18a4992b lwip: implement coap_packet_copy_source 2015-01-16 08:44:12 +01:00
chrysn 990098ab50 endpoint adaptions for lwip
possibly, endpoints should be made implementation-private just as
packets are
2015-01-15 13:34:21 +01:00
chrysn 330014445a lwip example updates
* resolve file resolution conflicts between lwip and libcoap in favor of
  lwip by rearranging the makefile

* cover the config.h of a configured base libcoap with the local one
  using the deprecated -I- gcc switch

* enable etharp (no idea why it wouldn't work ootb, the complete
  server.c lwip-contrib copy needs to be reviewed)

* disable optimizations for easier debugging, enable -g3 for macro
  expansions
2015-01-15 13:34:21 +01:00
chrysn c5f48ea4be implement receiving routines for lwip in independent file 2015-01-15 13:34:21 +01:00
chrysn 13d9ee291b provide lwip memory resources for more coap_malloc_type 2015-01-15 13:34:21 +01:00
chrysn bafa1ca05e coap_malloc_type implementation for lwip based on memp
those things need to reside in mem.h (instead of living implementation
dependently inside mem.c) because coap_malloc_type(MY_TYPE, ...) is
converted to memp_malloc(MEMP_MY_TYPE) and thus needs to be done in the
preprocessor. (the alternative would be to switch on the MY_TYPE enum,
which would be harder to maintain).
2015-01-15 13:34:21 +01:00
chrysn 850e895bac drop lwip-isms that can go away with coap_io from net.c 2015-01-15 13:34:21 +01:00
chrysn 7e37762227 coap_cancel: fix COAP_RESOURCES_NOHASH 2015-01-15 13:34:21 +01:00
chrysn 421170b704 use coap_malloc_type to ease lwip porting 2015-01-15 13:34:21 +01:00
chrysn 0ca090fbb6 make the internals of coap_packet_t private
they are now only accessed using helper functions, for a package looks
different in lwip.

in addition, the local_interface is now passed to coap_handle_message
not as an argument (because that would mean mixing different arguments
in the population of the node's local interface), but as a part of the
incoming package (as assigned in coap_network_read).
2015-01-15 13:33:35 +01:00
chrysn bfbb84f962 disable matching-interface check and debugging
this violates the pending package layering and needs to be further
investigated.
2015-01-15 13:23:37 +01:00
chrysn 003c78bfdb lwip example: no explicit call to coap_dispatch
this was done for posix in d5dc48d
2015-01-13 10:50:03 +01:00
chrysn d09f2e29b9 make lwip port buildable again
this fixes

* add coap_tick_diff_t from 3f3c8dc63f
* add COAP_PACKAGE_NAME etc required since 122200d3fd
2015-01-13 10:13:57 +01:00
Olaf Bergmann d48ab449fd added client option -a
This option allows to bind the client's listen interface.
2014-11-06 15:14:15 +01:00
Olaf Bergmann a763d73331 Merge commit 'bb9b01224212aa8e72032e397bfec762fcef8eea'
This merge fixes the bug in coap_str_hash() macro.
2014-09-03 12:37:26 +02:00
Olaf Bergmann ea270b0e60 bugfix: Block1 handling broken
This change contains a quick and dirty workaround for the following
bug that has been reported by Andrea Azzarà:

  "When sending a file with a POST to a CoAP server, such as

  ./coap-client -m post coap://vs0.inf.ethz.ch:5683/large-create/ -b 64
  -t 0 -f test

  the M bit is not correctly set to 1."
2014-08-27 18:44:52 +02:00
Sebastian Sontberg bb9b012242 Fix coap_str_hash macro
coap_str_hash called coap_hash() with wrong parameter ordering.
2014-08-15 17:41:16 +02:00
Sebastian Sontberg c3e27870ac Fix old-style-definition warnings 2014-08-10 07:10:03 +02:00
Olaf Bergmann 3552419496 even more strict-prototypes 2014-08-07 23:32:13 +02:00
Sebastian Sontberg 8ee0342809 Convert function declarations to strict-prototypes format 2014-08-05 01:31:05 +02:00
Olaf Bergmann 604ab76a1f Merge commit 'bb15767f4' 2014-07-24 23:45:13 +02:00
Olaf Bergmann 6b2ea692f1 enclose single debug() in block to avoid warning when build w/o debug code 2014-07-24 21:01:35 +02:00
Olaf Bergmann 8e55284de1 added media type 60 for application/cbor 2014-07-24 21:00:38 +02:00
Constantine Grantcharov bb15767f4d #if instead of #ifdef used in definition of struct coap_context_t
- replaced #if with #ifdef; compilation error gone.
2014-07-24 03:40:21 -04:00
Olaf Bergmann 690a3a552d updated README and license file
* renamed README to README.md
* reference RFC 7252 and coap.technology web site
* updated copyright date LICENSE.BSD
2014-07-06 19:23:37 +02:00
Olaf Bergmann 91a20eb67f fix request handler signature
Since the local_interface was added to the request handler callback,
the examples rd.c and etsi_iot_01.c were broken. This change fixes
rd.c and abandons etsi_iot_01.c (as it is very outdated).
2014-07-05 22:11:51 +02:00
Olaf Bergmann f769519ace fix transaction id generation
Incoming messages are matched to nodes in the retransmission
queue by comparing a hash value over (message id, port, ip addr).
For IPv4, the entire sockaddr_in structure was compared which
is potentially wrong (see merge request #7 from Dag Björklund).
Hopefully, this fixes the encountered issue.
2014-07-05 22:07:05 +02:00
Olaf Bergmann 82223d8a26 Merge branch 'master' of ssh://git.code.sf.net/p/libcoap/code 2014-06-19 15:24:00 +02:00
Olaf Bergmann f2e132df23 resolved conflict 2014-06-19 15:22:07 +02:00
Olaf Bergmann 1a0e4c7880 Merge branch 'master', commit '234cf4e07472433cd7748a7d3a35519ca15fba20' of git://git.code.sf.net/u/dbjorklu/libcoap_bugfix 2014-06-19 14:43:12 +02:00
Olaf Bergmann 143597a71d Improved logging function for Contiki.
Use vprintf() for log output when HAVE_VPRINTF is defined. Otherwise,
PRINTF will be used which does not work together with va_args.
2014-06-19 00:11:16 +02:00
Olaf Bergmann 77183cdc48 Use type tag in coap_free_type(). 2014-06-18 23:35:19 +02:00
Olaf Bergmann 6dcf3c7128 added header include for size_t 2014-06-18 18:52:25 +02:00
Olaf Bergmann 0f0169ee24 suppress gnu compiler warning on unused parameter 2014-06-18 18:51:59 +02:00
Olaf Bergmann c77c3cda32 fixed coap_iterator_next() to work on utlist structure. 2014-06-18 18:50:44 +02:00
Olaf Bergmann e90be63294 changed type of m and szx in coap_block_t back to unsigned int.
This is a partial revert of commit 4f6a7f5db to avoid compiler-specific
code.
2014-06-18 18:48:37 +02:00
Olaf Bergmann 4146735548 bugfix: use header format from coap-17 in hnd_get_time() 2014-06-18 18:31:50 +02:00
Olaf Bergmann 3d3e2a11d6 definitions for Contiki platform minimal-net 2014-06-18 18:30:13 +02:00
Olaf Bergmann 978577c686 Use a generalized iterator to walk through resources. 2014-06-18 18:28:57 +02:00
Olaf Bergmann 4882cc1caf added missing includes for debug.h and assert.h 2014-06-18 18:28:13 +02:00
Olaf Bergmann e6047eddb2 More code cleanup for Contiki.
coap_cancel() now uses the new resource_iterator.
2014-06-18 18:26:41 +02:00
Olaf Bergmann 68947e5e36 code cleanup for Contiki 2014-06-18 16:50:31 +02:00