Commit graph

41120 commits

Author SHA1 Message Date
Adam Podogrocki
c80023fca3 exti/stm32: add support for F334 & F373 MCUs
Change-Id: Ide3a3842077e6138ec9e6ce87bacf744632413bc
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Adam Podogrocki
c514f671c7 clock/stm32: add STM32F3X reset and clock control
Change-Id: Ie5f3ffec0b3aaf15f9d9f8063d2bab6be5aebb6e
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Adam Podogrocki
42a4615973 soc/stm32: add initial support for STM32F3X series
Supported SoCs:
- STM32F303XC
- STM32F334X8
- STM32F373XC

Change-Id: I74b9561272d54e270ae1a1f602fd389d4c86539a
Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-01-23 15:15:52 -06:00
Erwan Gouriou
9ff75b2a1b board: add nucleo_401re board documentation
This patch adds documentation for nucleo_f401re board

Change-Id: I605b990885130fb8bbe23581713b03656fbca061
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-01-23 15:15:52 -06:00
Kumar Gala
2e0c2aff97 arm: nvic: kill _NvicSwInterruptTrigger
_NvicSwInterruptTrigger is only utilized by a testcase for irq handling
on ARM-V7M.  Just put the code into the testcase so we dont need to
support an additional interface.

Change-Id: I763c63c32a7a52918250458351d08b8fa54069dd
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:52 -06:00
Ricardo Salveti
6e14642c1e arm/nordic_nrf5: enable SOC_FLASH_NRF5 by default if FLASH is enabled
SOC_FLASH_NRF5 is compatible with any nrf5 device, so enable the driver
by default if CONFIG_FLASH is also enabled.

Change-Id: I6ddf7cc41bb28071f682e78661b184a8e2ee7aa9
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-23 15:15:52 -06:00
Ricardo Salveti
58460a52c9 arm: set default vector table address in prep_c when XIP
It is called before early SoC initialization, so remove the duplicated
code from other boards and just set it by default when using XIP.

This can later be used when adding bootloader support, as an
additional option could be created to move the VTOR offset to a
different address.

Change-Id: Ia1f5d9a066de61858ee287215cefdd58596b6b1c
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-23 15:15:52 -06:00
Kumar Gala
90f38f395e arm: kinetis: Remove duplicate & unused defines
The k20_sim.h used by the PWM driver has some defines that also exist in
the MCUX HAL.  Lets pickup the values from the HAL and drop the one's
that are in k20_sim.h.  Also, they aren't used by anything at this
point.

Change-Id: Iaed4e8e5cec7d57a5ce9e89480cecfb7dc90a5e6
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-23 15:15:52 -06:00
David B. Kinder
38ca5843cd doc: update MAINTAINERS for .rst files
Previous MAINTAINERS patch using F: *.rst didn't work
so trying adding */*.rst */*/*.rst , etc. to see if
that works.

Change-Id: I0555b3ad2a2bf24cf0b9351860d7a85f6cc7627a
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-01-23 18:36:28 +00:00
Anas Nashif
78adda30c9 boards: arduino 101: set user LED values correctly
Change-Id: Ie6b2c4c4c0ac6af5bc5a7d628599313ab971f56b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-23 17:32:53 +00:00
Bogdan Davidoaia
bc5039cfba docs: sensor: update included example code
Update line numbers for included example code to reflect changes in the
source files.

Change-Id: Iceeed0a8b6df91746cf58d23fe09a03713a07d98
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-23 15:32:54 +02:00
Anas Nashif
594992f7b2 license: use SPDX identifier for files in ext/
Change-Id: I32cb4211056046ca28a81aa97aca5d3c0b9b8303
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-20 20:22:57 -05:00
David B. Kinder
516e155bb5 tests: update to Apache 2.0 SPDX tags on new tests
Some new tests were added that had the Apache 2.0 boilerplate licensing
instead of the SPDX licensing tag.

Change-Id: I4bde8c9c6e7a6d44bceeffb6bbcff9f62d417648
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-01-21 01:21:21 +00:00
David B. Kinder
2cb045420c doc: fix .rst files canonical heading order
The headings on some .rst files were not following the expected
heading order of using # for h1, * for h2, = for h3, and - for h4
This patch fixes that, and the doc/templates/*.tmpl files created
for folks to use as templates for creating board and sample docs.

Change-Id: I0263b005648558d5ea41a681ceaa4798c9594dd9
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-01-20 16:06:36 -08:00
Anas Nashif
aaf7f7fb91 Merge "Merge net branch into master" 2017-01-20 15:23:09 +00:00
Bogdan Davidoaia
4fadbbeebd sensor: fxos8700: fix missing dependency in Kconfig
FXOS8700_THREAD_PRIORITY and FXOS8700_THREAD_STACK_SIZE need to also
depend on FXOS8700_TRIGGER, else they will not show in the fxos8700
menu entry when running "make menuconfig".

Change-Id: I8f59125157f046592f3c92dcf2a92bd0e407cd6a
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-20 14:40:40 +00:00
Bogdan Davidoaia
6460e7655d samples: sensor: fxos8700: use floating point for printing sensor values
Printing values as <integer_part>.<fractional_part> gives undesired
results for negative numbers, so print the values converted to floating
point to avoid this.

Change-Id: I871b8461f2d643a2adce67df064e9f5e6d506319
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-01-20 14:40:39 +00:00
Jukka Rissanen
90c37e21ea Merge net branch into master
Main changes:

- TCP fixes
- ZoAP server sample application
- Fixes to issues reported by Coverity

----------------------------------------------------------------
Anas Nashif (1):
      net: in newlib, ESHUTDOWN is considered an extension

Andrei Emeltchenko (1):
      wpan_serial: Fix possible NULL pointer dereference

Andy Ross (2):
      net: tcp: Pass correct user_data pointers
      net: tcp: Destroy net_tcp struct at the same time as the context

Flavio Santes (3):
      samples/net: Remove redundant configuration variable
      drivers/ethernet: Update default GPIO pin for the ENC28J60 module
      samples/net: Remove legacy configuation variables

Jukka Rissanen (11):
      net: Fix possible null pointer dereference in nbuf
      net: icmpv6: Removing dead code
      net: tcp: Allocate space for TCP header
      net: ipv6: Check neighbor pointer in NS reply timeout
      net: ipv6: Fix IPv6 prefix comparision
      net: nbuf: Check possible null pointer access
      net: buf: Use TCP sent_list variable only if needed
      net: nbuf: Fix debug prints in memory pool init and unref
      net: context: Add status to connect callback
      net: echo-server: Use net_buf_frag_del() return parameter
      net: echo-server: Discard 0 byte received packets

Leandro Pereira (7):
      net: slip: Do not remove fragments when sending data
      net: tcp: Ensure all timers are disposed of when releasing context
      net: tcp: Use an uint8_t for retry timeout instead of an uin32_t
      net: tcp: Remove unused `recv_ack` field from TCP context
      net: tcp: Get rid of `recv_mss` field from TCP struct
      net: tcp: Reduce size of `state` member from 32 to 4 bits
      net: tcp: When retransmitting, hold an extra, temporary reference

Luiz Augusto von Dentz (2):
      net: zoap-client: Add bluetooth support
      net: zperf: Add bluetooth support

Michael Scott (13):
      net: linkaddr: calculate linkaddr storage addr size via config
      net: linkaddr: introduce net_linkaddr_set function
      net: ipv6: fix NULL reference in handle_ra_neighbor
      net: route: remove extra variable use in net_route_add()
      net: tcp: remove unused semaphore tcp_lock
      net: tcp: in tcp_establish save TCP flags for post-processing use
      net: tcp: handle TCP_FIN after processing any data in the buffer
      net: tcp: don't assume TCP_FIN buffers are NET_DROP
      net: tcp: if buffer is TCP_FIN increment send_ack by 1
      net: tcp: fix buffer leak in tcp_synack_received
      net: net_context: correct description of recv_data_wait in net_context
      net: tcp: move accept_cb from net_context to net_tcp
      net: tcp: add timeout wait in net_context_connect

Ravi kumar Veeramally (6):
      samples: net: Fix DHCPv4 config options and run on its own thread
      net: 6lo: Handle destination address uncompression properly
      net: 6lo: Fix dereferencing null pointer
      net: dhcpv4: Remove dead code
      net: samples: Add ENC28J60 pin numbers to documentation
      net: samples: Print assigned address from DHCPv4 server

Tomasz Bursztyka (4):
      net: shell: Use lighter printk() instead of printf()
      samples: net: Fix a format issues in echo_client
      samples: net: Enable buffer warning and errors in echo apps on qemu
      net: tcp: Fix TCP states swap when accepted an incoming connection

Vinicius Costa Gomes (14):
      samples/zoap_server: Add support for the '/separate' resource
      samples/zoap_server: Add support for blockwise GET tests
      iot/zoap: Add response code for Continue status
      samples/zoap_server: Add resouce for TD_COAP_BLOCK_03
      iot/zoap: Ignore non-request packets in zoap_handle_request
      iot/zoap: Fix wrong byte-order when retrieving integer options
      iot/zoap: Clarify the return value of zoap_register_observer()
      iot/zoap: Add a helper to find an observer by address
      samples/zoap_server: Fix responding messages with the wrong type
      samples/zoap_server: Add support for messages with token
      samples/zoap_server: Add Content-Format options to GET responses
      samples/zoap_server: Include a path for the "created" resource
      samples/zoap-server: Add support for the "location-query" resource
      samples/zoap_server: Do not error if there's no payload or queries

 drivers/ethernet/Kconfig.enc28j60                  |   2 +-
 drivers/slip/slip.c                                |   5 +-
 include/net/buf.h                                  |   2 +
 include/net/net_context.h                          |  24 +-
 include/net/net_ip.h                               |  21 +-
 include/net/net_linkaddr.h                         |  55 ++-
 include/net/zoap.h                                 |   9 +
 samples/net/dhcpv4_client/prj_arduino_101.conf     |   2 -
 samples/net/dhcpv4_client/prj_frdm_k64f.conf       |  12 +-
 samples/net/dhcpv4_client/prj_qemu_x86.conf        |  29 +-
 samples/net/dhcpv4_client/src/Makefile             |   1 +
 samples/net/dhcpv4_client/src/main.c               |  52 ++-
 samples/net/dns_client/README.rst                  |  22 +-
 samples/net/dns_client/prj_arduino_101.conf        |   5 -
 samples/net/echo_client/prj_arduino_101.conf       |   4 +-
 samples/net/echo_client/prj_qemu_x86.conf          |   3 +
 samples/net/echo_client/src/echo-client.c          |   2 +-
 samples/net/echo_server/prj_arduino_101.conf       |   4 +-
 samples/net/echo_server/prj_qemu_x86.conf          |   3 +
 samples/net/echo_server/src/echo-server.c          |  16 +-
 .../net/mbedtls_dtlsclient/prj_arduino_101.conf    |   2 -
 samples/net/wpan_serial/src/main.c                 |   6 +-
 samples/net/zoap_client/Makefile                   |   7 +-
 samples/net/zoap_client/prj_bt.conf                |  21 +
 samples/net/zoap_client/src/Makefile               |   5 +
 samples/net/zoap_client/src/zoap-client.c          |  38 +-
 samples/net/zoap_client/testcase.ini               |   5 +
 samples/net/zoap_server/src/zoap-server.c          | 476 ++++++++++++++++++++-
 samples/net/zperf/Makefile                         |   7 +-
 samples/net/zperf/prj_bt.conf                      |  32 ++
 samples/net/zperf/src/Makefile                     |   5 +
 samples/net/zperf/src/zperf_shell.c                |  12 +
 subsys/net/ip/6lo.c                                |  16 +-
 subsys/net/ip/Makefile                             |   1 +
 subsys/net/ip/dhcpv4.c                             |   9 +-
 subsys/net/ip/icmpv6.c                             |   4 -
 subsys/net/ip/ipv6.c                               |  26 +-
 subsys/net/ip/nbr.c                                |   6 +-
 subsys/net/ip/nbuf.c                               |  40 +-
 subsys/net/ip/net_context.c                        | 126 +++---
 subsys/net/ip/net_shell.c                          | 217 +++++-----
 subsys/net/ip/route.c                              |   6 +-
 subsys/net/ip/tcp.c                                | 140 +++---
 subsys/net/ip/tcp.h                                |  67 ++-
 subsys/net/lib/zoap/zoap.c                         |  86 +++-
 tests/net/context/src/main.c                       |   3 +-
 tests/net/ipv6/src/main.c                          |  66 +++
 tests/net/rpl/src/main.c                           |   8 +-
 48 files changed, 1278 insertions(+), 432 deletions(-)
 create mode 100644 samples/net/zoap_client/prj_bt.conf
 create mode 100644 samples/net/zperf/prj_bt.conf

Change-Id: Id27ce34fccfaf2b7d5f3112b9a8b47c60f695f3e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:27:01 +02:00
Jukka Rissanen
007e231ff5 net: echo-server: Discard 0 byte received packets
If we receive 0 byte packets from the network, we need to
ignore those as otherwise it is possible to leak network
buffers.

Change-Id: Id4b5b0d03c0b6d1e16634ff2d1960ea4728c8aa1
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:21 +02:00
Jukka Rissanen
011b22d64e net: echo-server: Use net_buf_frag_del() return parameter
Because net_buf_frag_del() returns the next fragment in the list,
we can use the return value which makes the code nicer looking.

Change-Id: Ic3d0155417b52a34bfbaa918570ff9af95aee468
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:21 +02:00
Andrei Emeltchenko
4a24192529 wpan_serial: Fix possible NULL pointer dereference
Return and clean buffer when fragment can not be allocated.

Coverity-CID: 157590

Change-Id: Ic8844609da4049623a6cf0c2ae037b2b777542e9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-01-20 16:23:21 +02:00
Tomasz Bursztyka
467c69d524 net: tcp: Fix TCP states swap when accepted an incoming connection
TCP states are swaped between "server" context and the new connection
context. But in any case the "server" context should loose the
information that makes it able to accept other new connections.

The swap was badly made, as the "server" context was loosing the
accept_cb (!) and the user data pointer. Instead the new connection
context was unrelevantly inheriting those.

Change-Id: Icc877449e1d4c4e59553dcbfd41718c5006edca0
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-20 16:23:21 +02:00
Jukka Rissanen
088289ec28 net: context: Add status to connect callback
It is useful that the user API can know whether the connection
was established properly or not. So this commit adds status
parameter to connect callback in net_context API.

The call to connect callback needs to be set properly in TCP
code. This commit does not fix the connect callback call which
is not properly done right now in net_context.c.

Change-Id: I284a60ddd658ceef9e65022e96591f467a936a09
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:21 +02:00
Ravi kumar Veeramally
724aa3ffbd net: samples: Print assigned address from DHCPv4 server
Print assigned address and other information if client receives
anything from server. E.g. subnet, lease time and router.

Change-Id: I759d59522930401766452eb1fb3d57d1a8295a67
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-01-20 16:23:21 +02:00
Ravi kumar Veeramally
9b68f18ffb net: samples: Add ENC28J60 pin numbers to documentation
ENC28J60 has numbers on the board. Documentation has information about
signals only. Wiring will be easy with pin numbers.

Change-Id: I0afd6058a9417b679ef6358304737bf256aa3522
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2017-01-20 16:23:20 +02:00
Jukka Rissanen
9a7ccf81f9 net: nbuf: Fix debug prints in memory pool init and unref
Wrong pool pointer was used when printing pool information during
the unref in nbuf.c. During nbuf init, wrong pool pointer was used
when printing memory pool sizes.

Change-Id: I9ed08cf7afa3c841c97ea981b97fff37aa40a984
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:20 +02:00
Luiz Augusto von Dentz
0918a903b1 net: zperf: Add bluetooth support
Change-Id: I56f2000cef929d5d0ddae0d67bc222d20db06480
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-20 16:23:20 +02:00
Luiz Augusto von Dentz
862b8dcfc6 net: zoap-client: Add bluetooth support
Change-Id: I9bef7f176deca6476e20d97d547b8d91ffc62c83
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-20 16:23:20 +02:00
Michael Scott
72e013a7ba net: tcp: add timeout wait in net_context_connect
If the parameter "timeout" is set in net_context_connect(), the
assumption by the user is that the function would wait for SYNACK
to be received before returning to the caller.

Currently this is not the case.  The timeout parameter is handed
off to net_l2_offload_ip_connect() if CONFIG_NET_L2_OFFLOAD_IP is
defined but never handled in a normal call.

To implement the timeout, let's use a semaphore to wait for
tcp_synack_received() to get a SYNACK before returning from
net_context_connect().

Change-Id: I7565550ed5545e6410b2d99c429367c1fb539970
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Michael Scott
eb9055c019 net: tcp: move accept_cb from net_context to net_tcp
net_context is used for more than just TCP contexts.  However,
the accept_cb field is only used for TCP.  Let's move it from
the generic net_context structure to the TCP specific net_tcp
structure.

Change-Id: If923c7aba1355cf5f91c07a7e7e469d385c7c365
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Michael Scott
34b67374de net: net_context: correct description of recv_data_wait in net_context
The recv_data_wait field in struct net_context is described as a "Mutex"
when in fact it's a semaphore signal.

Change-Id: I3bef8d1a07ceb3da5894ae4cdc8f1fe3c61c5dbe
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Michael Scott
2c3faa0de2 net: tcp: fix buffer leak in tcp_synack_received
When SYNACK is received we dont hand off the netbuf to anything
which will call net_nbuf_unref, so let's not mark it NET_OK.
Instead let the code path fall through to mark it NET_DROP.

Change-Id: I1f883e1a13c53c930bf50c07ff701e3db6f02d8a
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Michael Scott
87914610b0 net: tcp: if buffer is TCP_FIN increment send_ack by 1
Now that the TCP_FIN block is after a potential packet_received()
tcp->send_ack should be appropriately set to the last sequence
processed.

In the case of a TCP_FIN buffer, we should advance it by 1 or else
the destination will continue to retry to send the last block.

Change-Id: I9c97d35a87ad6cc1a50f928b237780bff4cd2877
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Michael Scott
c1f822222b net: tcp: don't assume TCP_FIN buffers are NET_DROP
Since we default to a return value of NET_DROP, we
can remove the automatic NET_DROP in the TCP_FIN block.

The return value will be set to NET_OK by packet_received()
if appropriate data is found which needs to be sent to
the callback.

Change-Id: Ib2634ba34440ca7053a4e98bf80f12cf6fbbd361
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Michael Scott
29b7d9c644 net: tcp: handle TCP_FIN after processing any data in the buffer
Buffers marked TCP_FIN may still have data attached to them
which needs to be processed and handed back to the callback.

Let's move the TCP_FIN handling to after the data processing
section now that we have a copy of the TCP flags to do this.

Change-Id: I90f53b10e393024ebffebe1837b8866764b8a7ac
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Michael Scott
da7e00e3aa net: tcp: in tcp_establish save TCP flags for post-processing use
buffer TCP flags can be cleared during packet_received so let's
save a copy of them for later.

Change-Id: I401e99c1ed2723dac4e86da58635b548a5645c13
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-01-20 16:23:20 +02:00
Anas Nashif
8da8118e3c net: in newlib, ESHUTDOWN is considered an extension
Allow building the IP stack with newlib by enabling linux extensions.

Jira: ZEP-1592
Change-Id: I6714b73c7666a6f56c5203e2754ce1d7d94af0f1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-20 16:23:20 +02:00
Jukka Rissanen
700c313ce7 net: buf: Use TCP sent_list variable only if needed
If TCP is not enabled, then compile out the TCP retransmit
list variable that is part of net_buf struct.

Change-Id: I07e188454d9be76ac93fe96405f00a89b967668a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-01-20 16:23:20 +02:00
Tomasz Bursztyka
d9b30d3029 samples: net: Enable buffer warning and errors in echo apps on qemu
These logs are mandatory to spot buffer leaks. Unfortunately, they are
still not detailed enough to spot the actual place where the leak
happen.

Change-Id: If36dfa7a54aa1546fb268301f369b5ecd046e276
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-20 16:23:19 +02:00
Tomasz Bursztyka
c2ed1c1aee samples: net: Fix a format issues in echo_client
To avoid a build warning.

Change-Id: Ic6349c6867f04f5827923a070e8e615ca3bead94
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-20 16:23:19 +02:00
Tomasz Bursztyka
b7dd42879d net: shell: Use lighter printk() instead of printf()
CONFIG_STDOUT_CONSOLE is anyway disabled by default so printf() will not
output anything without it.

Change-Id: I8013e4efa5cb760215316e9413734281fb576f4d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
ec7d09eccc samples/zoap_server: Do not error if there's no payload or queries
In case of a GET request do not error if there's no payload or queries
parameters.

Change-Id: I29b2225700c83a8a2dad166146288dd55bd8f3de
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
bc70a39ac6 samples/zoap-server: Add support for the "location-query" resource
This resource verify the capability of the server to send a response to
a POST including a Location-Query option.

Change-Id: I4b663e813eb713d7e93a3c2f8cfd58c335b24cde
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
6f57867654 samples/zoap_server: Include a path for the "created" resource
The CoAP test suite expects a specific path included in the
Location-Path option in the response.

Change-Id: Ib7616f9ad318fa93dc862f686429edb5084306e3
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
e44dfffba2 samples/zoap_server: Add Content-Format options to GET responses
The Californium tests expects that all GET responses include the
Content-Format information of the response. In our case, all responses
are of type plain-text.

Change-Id: I08844825f31ed8f4c54020a41b9172cef5da6d70
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
0eaeaf2481 samples/zoap_server: Add support for messages with token
So the sample zoap server application is more conformant, include the
token from the request, if any, in the response.

Change-Id: I5aacc1a3f81ebeaf473d327163c952b829489b01
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
db049395f1 samples/zoap_server: Fix responding messages with the wrong type
The Californium test suite considers an error responding a NON_CON
request with a ACK response, even if the spec says it is valid, so add
support for using the correct type of response according to the
request.

Change-Id: I211c8a135b8db83af442a1d645b7ea0826dbbdec
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
d27cc52f37 iot/zoap: Add a helper to find an observer by address
In some situations, for example, when the remote side sends a RESET
message indicating that it is no longer interested in observing a
resource, it is helpful to have a way to obtain the obverser
representation.

Change-Id: Ifbf627f9170be844fd525c557dda8cb722ac7aff
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
e49ae1c6e2 iot/zoap: Clarify the return value of zoap_register_observer()
Change-Id: Ib30a81d424d8db13399d57851622d75be5f7c010
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00
Vinicius Costa Gomes
13fc795b3e iot/zoap: Fix wrong byte-order when retrieving integer options
When retrieving options that represent an integer, the order of the
bytes being considered was inverted, resulting in invalid values being
returned.

Change-Id: I8ba84f77e3402066632c0ba650939266c87a8ea2
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2017-01-20 16:23:19 +02:00