Commit Graph
174 Commits
Author SHA1 Message Date
onovo1 fe69ba5fb6 Update coap-rd.c
According to the Core Resource directory draft [1]. The discovery of the registration should be done using the /.well-known/core and including a Resource Type (rt) with the value "core.rd". Like that:
GET /.well-known/core?rt=core.rd
There is a typo in the libcoap which accept the "core-rd" instead of the "core.rd" parameter. Fixing that in this version.

[1] - https://tools.ietf.org/html/draft-ietf-core-resource-directory-05#section-5.1
2016-01-28 10:34:14 +02:00
Olaf Bergmann 7452d7d50f coap-server.c: updated URI to libcoap's homepage in resource '/' 2016-01-10 18:06:26 +01:00
Carsten Schoenert b4973f1d73 fixup argument list for uip_ds6_prefix_add
uip_ds6_prefix_add is using 6 arguments, better use explicit argument
list than let the compiler decide. Some compiler will complain if some
optionally arguments are missed.
2016-01-10 17:49:07 +01:00
Olaf Bergmann 2da31de732 configure.ac: fix disable options
The options --disable-documentation and --disable-examples did
not have the desired effect in some configurations. Now, if any
of documentation or examples is disabled, the manual pages in
the examples folder are not created.
2015-09-30 19:46:34 +02:00
Olaf Bergmann 683337890e bugfix: add flag for CON/NON notification messages
Two new flags COAP_RESOURCE_FLAGS_NOTIFY_NON and
COAP_RESOURCE_FLAGS_NOTIFY_CON have been added to control the
message type for notifications to send. The default type is
COAP_RESOURCE_FLAGS_NOTIFY_NON which can be changed with the
function coap_resource_set_mode().

The observer-specific flag has been removed.
2015-09-29 09:03:18 +02:00
Olaf Bergmann 7f2134db6f client.c: fixed empty service parameter in getaddrinfo call
Baptiste Clenet <bapclenet@gmail.com> has pointed out that passing
an empty string causes address resolution to fail in certain cases.
This modification replaces the service parameter in the getaddrinfo
call with NULL as suggested.
2015-09-08 18:06:03 +02:00
Carsten Schoenert 141eefdbb6 a2x: adding a check for needed helper
The previous commit added some asciidoc based man pages that need a2x
from the asciidoc package. To ensure the build will not break due a not
available a2x binary we better check before.
2015-06-22 21:25:43 +02:00
Carsten Schoenert 3e9afb1460 examples/*: adding example binaries man page support
This commmit adds the build of man pages for the binaries from the
example/ folder, in detail these are coap-client.5, coap-rd.5 and
coap-server.5.
The source of the man pages is written in asciidoc so the build
environment must have access to a installed asciidoc package.
2015-06-22 21:25:43 +02:00
Carsten Schoenert cb55cb44da examples/*coap-client*: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-06-19 20:54:31 +02:00
Carsten Schoenert 60bb15edd7 examples/coap-server.c: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-06-19 20:54:31 +02:00
Carsten Schoenert bda1a2360b examples/coap-rd.c: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-06-19 20:54:30 +02:00
Carsten Schoenert 1043892391 rename the example binaries to more strict naming schema
To normalize (and in preparation for manpages) the currently used files
for the example implementation of a CoAP based client, server and a
resource directory various files and variables are rename to coap-*.
2015-06-19 20:53:47 +02:00
Carsten Schoenert f0f271778f drop previous renamed *.in files
With commit cda3b72 the migration to a fully Autotools controled build
environment was started which is now finished. The previous used *.in
files was renamed to *.in.old to hold some maybe usefull informations
from the old system. We don't need this renamed files any longer so kill
it with fire.
2015-06-19 20:52:47 +02:00
Olaf Bergmann ee931e8f37 examples/client.c: Removed multicast join
As the client can send to multicast groups without explicitly joining,
this code is not required here and instead moved to the server
implementation.
2015-06-10 18:10:43 +02:00
Olaf Bergmann b9bcdc10ff examples/server.c: added flag -g to join multicast groups
This code is taken from client.c where it makes no sense.

TODO: leave group when the server is stopped.
2015-06-10 18:08:33 +02:00
Carsten Schoenert 21431bcb2f examples/Makefile.am: small fix for the path declaration 2015-06-02 20:41:37 +02:00
Carsten Schoenert 47e0c25c38 examples/Makefile.am: changing header includes
The build of the examples is complaining about a function that are not
inline'd. The compiler is mentioned this because we use the '-I'
directive for pointing to the header files. Just say the compiler also
that the header files are system headers so the false positive is going
away.
2015-03-22 14:38:36 +01:00
Carsten Schoenert da3570cb41 examples/Makefile.am: fix not needed target
The target 'install-exec-am' is obviosly wrong and not really needed.
2015-03-22 13:37:28 +01:00
Olaf Bergmann d9d20d906b rd.c: Fixed type-specifier warning
For POSIX, coap_tick_t is defined as unsigned long to support
timestamps in wallclock time. The rd uses ticks to make node
identifiers locally unique. As this is just one part of the
generated identifier, the timestamp's lower 32 bits are
sufficient.
2015-03-12 13:05:56 +01:00
Olaf Bergmann 41e3247c9b rd.c: Fixed a bunch of compiler warnings 2015-03-12 12:30:57 +01:00
Carsten Schoenert 60030d0fb4 examples: adding the examples folder to the build
After including the doc/ and the tests/ folder under the hood of the
autotools now adding the examples/ foolder too.
The user is now able to add the build of the example binarys if
configure is called with '--enable-examples' as option. The example
binarys will not be build by default!

Currently only 'coap-client', 'coap-server' and 'rd' is build.
2015-03-12 11:25:26 +01:00
Olaf Bergmann d55bd85e14 examples/contiki/server.c: Define clock_offset locally
The global variable clock_offset has been removed from libcoap, so
we have to define our own.
2015-03-11 14:37:18 +01:00
Olaf Bergmann f1b36046f2 Contiki: Make sure that COAP_RESOURCES_NOHASH is defined 2015-03-11 14:34:06 +01:00
Olaf Bergmann b9adebec93 client.c: Fixed signed/unsigned in comparisons 2015-03-10 13:47:38 +01:00
Olaf Bergmann 005d00bf5b client.c: Declare unused parameters to make -Wunused quiet 2015-03-10 13:42:40 +01:00
Olaf Bergmann 445849d5ba client.c: Made private functions static to quiet compiler warnings 2015-03-10 13:41:02 +01:00
Olaf Bergmann c38a6d9ca4 Made private functions static to quiet compiler warnings 2015-03-10 13:25:08 +01:00
Olaf Bergmann 9b1ab5eef3 server.c: Declare unused parameters to make -Wunused quiet 2015-03-10 13:06:03 +01:00
Olaf Bergmann 4ca91190d6 Revised time-related functions to get rid of clock_offset for POSIX platform.
* Removed tne preprocessor defines for coap_tick() and coap_clock_init() --
  this made the code less readable and seemed to be of little use.

* Introduced the new type coap_time_t to represent wall clock time. On POSIX,
  this is the number of seconds since the epoch, while on embedded systems
  without a real time clock, this could be the number of seconds since the
  last reboot. The new function coap_ticks_to_rt() is used to convert
  coap_tick_t to coap_time.h. Currently, this is a division by COAP_TICKS_PER_SECOND
  on all platforms.

* POSIX: coap_tick_t is now defined as unsigned long to avoid overflows in
  coap_ticks().
2015-03-08 15:14:43 +01:00
Olaf Bergmann a31981b95b Implement decode_segment() and check_segment(), LWS cleanup
The helper functions decode_segment() and check_segment() are private
functions in uri.c and thus should not be accessible from outside. For
simplicity, these functions have been copied to client.c.
2015-03-08 15:09:22 +01:00
Olaf Bergmann 78b96e606d Fix lwip example 2015-03-03 22:03:37 +01:00
Olaf Bergmann 124d871cc8 Fixed path to source and header path
Made vpath %.c point to ../../src and repaired include path.

The common part of the Makefile has been moved to Makefile.common
to leverage Makefile creation for other platforms such as econotag.
2015-03-03 21:53:26 +01:00
Olaf Bergmann 8d664dd475 Fixed Contiki-specific Makefile 2015-03-03 12:30:42 +01:00
Olaf Bergmann 9d673c8cfd moved platform-specific Makefile.contiki into examples/contiki 2015-03-03 12:30:42 +01:00
Olaf Bergmann 7e300c04d9 fix CoAP RFC number in comments 2015-03-03 12:29:13 +01:00
Olaf Bergmann a81a37b29d bugfix: CLIENT_OBJS in Makefile.in unknown
This variable has been renamed to client_OBJECTS but the change was
missing in target coap-client.
2015-02-21 16:32:35 +01:00
Olaf Bergmann aa3a050641 Replaced custom list implementation with linked lists from utlist.h
coap_insert() now appends every item at the list's end, sorting must
be done explicitly using LL_SORT. As a side-effect, the new
implementation makes valgrind happy :-)
2015-02-20 13:30:32 +01:00
Olaf Bergmann f4f4ffd900 Moved coap_list.[hc] to examples
The list implementation in coap_list.c is only used in client.c
hence it was moved into the examples sub-directory.
2015-02-20 13:10:04 +01:00
Olaf Bergmann b87f45eeb2 remove unused code from Contiki server example 2015-02-16 17:04:57 +01:00
Olaf Bergmann 9898a1627f Moved the observing client coap-observer.c into examples/contiki 2015-02-16 16:41:01 +01:00
Olaf Bergmann af4aeb2042 Added sample radvd.conf for testing the minimal-net server 2015-02-16 16:31:20 +01:00
Olaf Bergmann 4635435771 Created a self-contained Contiki server example
Directory examples/contiki now contains a small example server for
Contiki and a Makefile for platform minimal-net.

Build:

  make contiki     # clones Contiki
  make server      # creates the minimal-net coap server

Run:

Unfortunately, you have to run the server with sudo unless you
set CAP_NET_ADMIN for both, the server executable, and ifconfig
(sudo setcap cap_net_admin+pei ...).

  sudo ./server

Then, add the server's interface address to the tap0 device and
optionally set a default route:

  sudo ip -6 a a aaaa::1000 dev tap0
  sudo ip -6 r a aaaa::/64 dev tap0

Although everything should work now, it does not. I had to send
router advertisements on tap0:

  sudo radvd -C ./radvd.conf

Note that on Debian (and Ubuntu, and ...), radvd will not start
when IPv6 forwarding is disabled (which is usually the case on
end systems). Trying to enable like this did not work for me:

  sudo sysctl -w net.ipv6.conf.tap0.forwarding=1
  sudo sysctl -w net.ipv6.conf.tap0.mc_forwarding=1

Workaround (ugly): get the radvd sources, compile them and use that.
2015-02-16 16:30:28 +01:00
Olaf Bergmann 8c3cdf5e72 renamed config.h to coap_config.h.lwip, part 2 2015-02-15 22:51:42 +01:00
Olaf Bergmann e46961a5a2 changed config.h.lwip to coap_config.h.lwip 2015-02-15 22:47:54 +01:00
Olaf Bergmann 8ca0840b41 changed name of config.h to coap_config.h 2015-02-15 22:45:51 +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 003c78bfdb lwip example: no explicit call to coap_dispatch
this was done for posix in d5dc48d
2015-01-13 10:50:03 +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 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
Olaf Bergmann 3552419496 even more strict-prototypes 2014-08-07 23:32:13 +02:00