Commit graph

294 commits

Author SHA1 Message Date
Jukka Rissanen a9395157a3 samples: net: dumb_http_server: Check EOF while skipping headers
If recv() returns 0 bytes, then terminate the connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-23 13:13:35 +03:00
Jukka Rissanen 3d6ce30f29 samples: net: dumb_http_server: Add net_pkt.h file inclusion
The function net_pkt_get_info() is found in net_pkt.h and not
in buf.h. This caused
"implicit declaration of function ‘net_pkt_get_info’"
warning if CONFIG_NET_BUF_POOL_USAGE was enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-23 13:13:35 +03:00
Charles Youse 8e307a3ad9 ethernet/eth_e1000.c: change to new PCI(e) functions
Migrate from "legacy" PCI support (drivers/pci) to new PCI(e) support.

The e1000 driver is merely for testing with QEMU and so should not be
a model for the use of PCI(e) functions. Consult instead "real-world"
PCI(e) drivers like the NS16550 UART (drivers/serial/uart_ns16550.c).

Signed-off-by: Charles Youse <charles.youse@intel.com>
2019-04-22 09:34:00 -07:00
Vincent Wan 751025957a samples: sockets: sntp_client: Add support for cc3220sf_launchxl
This commits adds a configuration file for cc3220sf_launchxl
suitable for the example.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-04-19 13:54:21 -05:00
Vincent Wan be5bfb6169 samples: sockets: sntp_client: make IPv6 & NET_CONFIG_SETTINGS optional
In this commit, a config.h header file is added to support the case
when the NET_CONFIG_SETTINGS is not used. main.c is also modified to
enable platforms that do not support IPv6. These changes are necessary
in order to allow cc3220sf_launchxl support.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-04-19 13:54:21 -05:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Anas Nashif da5f185e06 samples: add test identifier
Add unique identifier instead of just 'test' for samples.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-03-29 17:44:11 -04:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Paul Sokolovsky 946836577b samples: sockets: Add e1000 and stellaris ethernet drivers overlays
Add qemu ethernet driver overlays for big_http_download and
dumb_http_server samples, which are default integration samples/
tests for TCP stack. This change follows up after similar addition
of such overlays to other samples (and smsc911x overlay addition
to these samples).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-26 07:29:40 -05:00
Tedd Ho-Jeong An 5d35b66327 Samples: net: can: initialize the variables
Initialize the variables.

Fix Bug: #14819
Coverity CID: 196637

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-24 10:55:06 -05:00
Vincent Wan 111dab4a25 samples: sockets: echo_async: Add support for cc3220sf_launchxl
Adding support for cc3220sf_launchxl by introducing a board-specific
Kconfig file.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-03-20 11:36:18 -05:00
Vincent Wan 734e247d02 samples: sockets: echo_async: Make IPV6 optional
Changing the example to not use IPv6 when it is not configured,
given IPv6 is not enabled on some platforms such as cc3220sf_launchxl.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-03-20 11:36:18 -05:00
Robert Lubos e39aed53a2 samples: net: Update overlay-bt.conf in various samples
`CONFIG_NET_L2_BT` no longer forces required BT configuration, but
depends on a user to set a valid configuration instead. Hence, we
need to select a proper configuration in the overlay config file.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-03-20 11:32:40 -05:00
Tedd Ho-Jeong An 980cf393f0 Samples: echo-client: Add overlay when echo-server is running on Linux
This patch adds the overlay when the echo-server is running on Linux and
echo-client is running on Qemu.

Fix: #14654

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-20 11:31:57 -05:00
Marcio Montenegro 69613cad6a samples: net: sockets: echo_client : Fix tcp_stop() error
Check for an open socket, 0 is a valid file descriptor.

Signed-off-by: Marcio Montenegro <msam@cesar.org.br>
2019-03-18 11:34:47 -05:00
David B. Kinder 6000a6205a doc: prepare for improving doc API linking
Linking to API material requires knowing the pecularities of how
doxygen, sphinx, and breathe work. In an attempt to hide some of this
we're preparing the current docs to allow use of configuration defaults
that will let us more simply use a default role that will hunt for a
reference target in the various domains that are available by using a
default "role" of "all".  This will let us use the simple notation
`functionname` or `typename` without fully specifying the reference as
:c:func:`functionname`.

This patch cleans up exising docs that were (incorrectly) using single
backtics where double backtics should have been used, and also found
some typos (such as a space between the role name and the reference,
such as :file: `filename`, and a missing colon such as
c:func:`functionname`)

This is a start to address issue #14313

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-03-15 05:47:19 +01:00
Jukka Rissanen e7107ba562 samples: net: can: Readme file was missing
The socket CAN application was missing a README.rst file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 15:57:48 -05:00
Jukka Rissanen e7ce08a2ac samples: net: can: Send and receive can_frame type of data
The CANBUS sockets require "struct can_frame" to be used in order to be
compatible with Linux code.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:58:30 -05:00
Jukka Rissanen d2ce588441 samples: net: can: setsockopt() requires can_filter
The CANBUS sockets require can_filter to be used in order to be
compatible with Linux code.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:58:30 -05:00
Paul Sokolovsky 7e81aca961 samples: sockets: echo: Better error checks
Check socket fd return results.

Fixes: #11086, #11087
Coverity-CID: 189519, 189520

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-13 05:38:10 -05:00
Tedd Ho-Jeong An 19ed83c723 samples: sockets: echo_async: Check return value of setsockopt
This patch checks the return values of setsockopt.

Fixes: #14392, #14402
Coverity-CID: 195897, 195848

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-13 05:37:28 -05:00
Ravi kumar Veeramally 718dd56d38 net: samples: Fix packet socket sample iface index
Patch (3206568e43) changed network
interface numbering starts from 1. The index 0 is reserved.
So use api to get default interface index for packet socket sample.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-11 20:56:11 -07:00
David B. Kinder 505cc2bb0e doc: use :zephyr_file: where appropriate
A new role :zephyr_file: is available that renders to a link to the file
or folder in GitHub.  Find appropriate references using :file: and
convert to :zephyr_file: to take advantage of its linking capability.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-03-09 09:50:27 -05:00
Tedd Ho-Jeong An 4063b3b149 sample: sockets: can: Update error handle flow
This patch updates error handle flows for socket apis.

Fix: #13859
Coverity-CID: 190956

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-08 08:43:29 -05:00
Kumar Gala a2d61fedf6 kconfig: remove stale CONFIG_IEEE802154_CC2520_AUTO_ACK
CONFIG_IEEE802154_CC2520_AUTO_ACK seems to creep back in, but has long
since be removed.  We remove old references a few times.

Commit 2facf33f28 - "net: ieee802154: Remove old cc2520 AUTO_ACK
assignments".

Remove them again.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-07 13:04:29 -06:00
Kumar Gala 6833ea718f kconfig: Remove dead references to CONFIG_PCI_DEBUG
CONFIG_PCI_DEBUG isn't a Kconfig option we support anymore so remove
some dead references to it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-07 13:04:29 -06:00
Tedd Ho-Jeong An 32caf24cb4 samples: sockets: echo_async: Add more error checking
This patch adds more error checking and handling for socket APIs.

Fixes: #13885
Coverity-CID: 190928

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-07 10:15:59 -05:00
Tedd Ho-Jeong An 2df4652077 samples: sockets: echo_async_select: Add error check
This patch adds error checking routine for socket APIs.

Fixes: #13852
Coverity-CID: 190966

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
2019-03-07 09:40:13 -05:00
Ravi kumar Veeramally f860d31465 samples: net: coap_client: Fix coverity issue
Fix uninitialized variable.

Coverity-CID: 190969
Fixes: #13850

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-01 19:44:11 +01:00
Sebastian Bøe 4e5300ba7f cmake: Drop all in-tree usage 'set_conf_file'
Port all users of 'set_conf_file' to use the built-in rules
instead. This follows the convention-over-configuration principle to
make the system as a whole simpler and more consistent.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-01 09:44:09 +01:00
Jukka Rissanen 2db03ce277 samples: net: socket: can: Do cleanup if failure
If bind() fails or TX thread cannot start, then cleanup the
socket by calling close()

Coverity-CID: 191003
Fixes #13824

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-28 08:46:52 -06:00
Paul Sokolovsky fff2011fb5 samples: sockets: echo_server: Print port number to connect to
We have a great number of samples now, using different port numbers,
etc. Let them be self-documenting and print out port number used.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-27 08:32:58 -06:00
Kumar Gala bb6b1918b2 drivers: can: stm32: Cleanup Kconfig enablement
Follow the pattern we have for other peripherals in that if the driver
class (CAN) is enabled than enable the driver for that class
(CAN_STM32).  Also have the STM32 CAN driver depend on being on a STM32
SoC.

Remove setting of CONFIG_CAN_STM32 in any .conf files as it will get set
of CONFIG_CAN is set/enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-25 10:05:21 -06:00
Jukka Rissanen c478b5bb6e can: Rename can_msg and can_msg_filter structs
In order to follow the naming from Linux, change the name of
can_msg to zcan_frame, and can_msg_filter to zcan_filter.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Jukka Rissanen 58f3ae5334 can: Add Linux compatible frame and filter structs
Add new "struct can_frame" which is compatible with Linux so that it
is easier to port socket-can applications from Linux.
Rename existing can_filter to can_msg_filter so that the name will
not conflict with Linux compatible can_filter struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-22 08:07:03 -05:00
Jukka Rissanen 41d17433f0 doc: net: Add more info for network connectivity with host
Added more detailed information how to connect Zephyr instance
to host system like Linux desktop.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-20 07:32:42 -05:00
Jukka Rissanen f626c3ccbe samples: net: sockets: Add smoke testing support
The net-app based echo-server/client applications were used for
various smoke testing purposes. As those two apps are now removed
we need to introduce the same support into sockets based echo-client
and echo-server applications.

Fixes #13300 #13481

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:01 -05:00
Paul Sokolovsky 89dfa5bb5b samples: dumb_http_server: Fix typos and improve wording in docs
Both actual typos and just less word repetition.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-18 15:08:37 -05:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Jukka Rissanen 62c75107a3 samples: net: can: Add socket CAN sample
Simple socket CAN application that sends data periodically and
receives the data back.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-08 12:03:34 -05:00
Ravi kumar Veeramally 2c3ecd8c51 net: samples: Disable IPv4 from packet socket sample
IPv4 is not needed for packet socket sample. Previous commit
helps to remove dependencies.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-08 12:35:03 +02:00
Anas Nashif 74c573635f samples/tests: filter based on toolchain features
Do not run with toolchains that do not support newlib.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-07 22:46:10 -06:00
Ravi kumar Veeramally 7e8ded911d samples: sockets: Add packet socket sample application
Sample application which opens a packet socket and receives
every packet on the wire and send some dummy packet over
socket. Simple demo of how to use packet sockets.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-07 14:43:30 +02:00
Ravi kumar Veeramally 1e47f26d1c net: coap: Remove legacy CoAP implementation
As we are removing net_app and net_pkt based libraries and
applications, CoAP legacy based libraries and apps are moved
to socket based implementations. So removing legacy CoAP.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-02-04 16:49:59 -05:00
Jukka Rissanen 48abdc2cb9 samples: net: Remove net-app based sample applications
As net-app API is removed, remove also all the sample applications
that use it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-01 12:29:21 +02:00
Paul Sokolovsky 30ba9de4c4 samples: sockets: Remove Zephyr logging from POSIX-compatible samples
As example of echo_async_select added recently shows, we no longer
need to define a logger unconditionally in each source file. These
samples are intended to show Zephyr compatibility with POSIX sockets
API, so the less there're differences between Zephyr vs POSIX
ifdefs, the better.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-01 08:50:02 +02:00
Robert Lubos 18af0d1572 samples: sockets: Update echo_client/echo_server documentation
As the net-app based echo samples are being removed, there's no use
referencing them any longer in their socket counterparts.

Additionally, overlay configuration descriptions were added in the
same manner original samples did.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-31 13:56:05 -05:00
Aurelien Jarno 4394601524 net: sntp: get rid of the callback function
The original SNTP client library was designed for the net-app API, for
which it makes sense to have a callback function, which is called
asynchronously when an answer is received.

For the socket based interface, the callback is called just before
sntp_request() returns. It gets the status and the epoch_time in
parameter, however the status is already returned by sntp_request(). It
therefore make sense to replace the callback function by a pointer to
epoch_time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-31 10:14:12 +02:00
Paul Sokolovsky d6ffca36f3 samples: sockets: Clean up headers included
Don't include net_app.h and net_buf.h, the first is deprecated, the
latter is low-level header, both shouldn't be used for socket apps.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-30 21:05:11 -05:00
Ravi kumar Veeramally a9acc6d4d7 net: samples: Add socket based SNTP client application
SNTP client sample requests time sync on IPv4 and IPv6 addresses
using socket based SNTP client library.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-01-29 12:25:01 -05:00
Paul Sokolovsky fe7043d7ca samples: net: sockets: Set explicit min_flash on some samples
Fixes build issues with lpcxpresso54114_m0 which set to have 32K RAM,
and only 64K Flash.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky 8c50ce934b samples: net: socket: Add "socket" tag to sample.yaml's
So it was easy to run all socket tests without remembering
the exact path(s).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-25 10:35:39 +02:00
Paul Sokolovsky df95a423b2 samples: echo_async_select: Add select()-based async echo sample
A copy of poll()-based echo_async, converted to use select().

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-24 17:14:43 +02:00
Paul Sokolovsky c3aa195940 samples: sockets: Add eth_smsc911x overlays
Add overlays for commonly used socket samples: big_http_download and
dumb_http_server. Can be used with:

make BOARD=mps2_an385 CONF_FILE="prj.conf overlay-smsc911x.conf"

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-19 11:59:29 -05:00
Robert Lubos 97aa3ac519 samples: openthread: Increase shell stack size
OpenThread commissioner shell command caused stack overflow on shell
thread, hence increase it for OpenThread samples.

Fixes #12455

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-01-18 15:24:16 +02:00
Paul Sokolovsky fbcc43393c samples: big_http_download: Set min_flash to 128K.
Previously there was just "min_ram: 32", which took care about
suitable flash size implicitly. But now we have interesting boards
(e.g. lpcxpresso54114_m0) which tout RAM of 32K and Flash of 64K.
So, become more explicit about Flash requirement for the sample.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-01-15 17:22:39 -05:00
Andy Ross f033d542ad tests: samples: Disable newlib tests on x86_64
This builds with a host compiler, not one from the SDK, and so no
newlib library is available.  There is work to enable newlib detection
at and above the cmake level.  This patch can be reverted when that
lands.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-01-11 15:18:52 -05:00
Tomasz Bursztyka fc3f090ab8 samples/sockets: Enable 802.15.4 properly for echo apps
These were still running through Ethernet using generic
overlay-802154.conf thus creating a dedicated one.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-01-08 11:25:33 +02:00
Anas Nashif 5060ca6a30 cmake: increase minimal required version to 3.13.1
Move to latest cmake version with many bug fixes and enhancements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-03 11:51:29 -05:00
Robert Lubos 167486f4a4 samples: sockets: Update OT overlays for echo samples
Increase rx stack size for OpenThread overlay, as updated revision of
OpenThread requires more stack to operate.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-12-21 10:27:33 +01:00
Paul Sokolovsky 4bbdf8b59d samples: sockets: echo_async: Check results of fcntl() calls
Check result of fcntl() to catch any regressions in fcntl() handling
in Zephyr. To facilitate this, also merge block() and nonblock()
functions into single setblocking().

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-12-14 13:21:31 +02:00
Robert Lubos 417cfdd833 samples: sockets: Tweak echo_client/server sample parameters for DTLS
Current application data size in echo_client sample does not fit into a
single datagram with DTLS enbled for default IPv6 MTU (1280 bytes). This
caused abrupt failure of the sample with DTLS enabled over 802.15.4 L2.
Decreasing the application data size allows it to fit into a single UDP
datagram after encapsulating it into DTLS record.

Additionally, finetune DTLS timeout on echo_server to match UDP
application timeout on echo_client (so that a single datagram loss
does not cauase DTLS session to end).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-12-13 21:13:52 +02:00
Paul Sokolovsky 5ea1e23202 samples: sockets: echo_async: Don't include <sys/fcntl.h>
POSIX doesn't mandate such a header, only <fcntl.h>. <sys/fnctl.h>
is just an internal implementation detail of Newlib on which we should
not rely.

This makes it possible to build this sample against minimal libc.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-12-13 14:21:34 +02:00
Jukka Rissanen cd4eb946c4 samples: net: Convert to use generic logging macros
Use generic logging macros LOG_*() instead of NET_*() as the
latter are mostly meant for internal networking stack use.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00
Jukka Rissanen 86689030e8 net: Clarify logging in networking code
Remove network specific default and max log level setting
and start to use the zephyr logging values for those.

Remove LOG_MODULE_REGISTER() from net_core.h and place the
calls into .c files. This is done in order to avoid weird
compiler errors in some cases and to make the code look similar
as other subsystems.

Fixes #11343
Fixes #11659

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-12-07 12:00:04 +02:00
Robert Lubos 3651e03eeb samples: sockets: Add overlay configs to socket echo samples
Add Bluetooth, 802.15.4 and OpenThread overlay configurations to socket
echo_client and echo_server samples.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-12-06 12:45:19 -05:00
Patrik Flykt 079f55d519 samples: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Gil Pitney 9991bcb4c5 net: samples: sockets: http_get: Add secure socket offload support
Update the http_get sockets sample to enable association of secure
tags with certificate filenames.

This allows certificates and keys to be provisioned to the file
system on secure flash, without having to include the actual
certificates in the application.

Validated on the cc3220sf_launchxl board.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-11-23 09:16:21 -05:00
Anas Nashif 3d906dc4c1 net: coap: Move both CoAP implementations into one Kconfig
Two separate folders and Kconfig options causing confusion on
CoAP and CoAP_SOCK implementations. This patch simplifies it.
Current CoAP Kconfig option moved to COAP_NET_PKT.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-22 09:08:46 -05:00
Andrei Gansari f37ec3b0af samples: net: some samples min_flash = 140k
In order to prevent failing tests on i.MX RT the following samples were
limited to a minimum 140k of flash: http_client, http_server,
socket/echo_client and sockets/echo_server.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2018-11-20 09:54:25 -06:00
Robert Lubos 1d4223ef3a samples: sockets: Set correct log module name in echo_server
echo_server used incorrect net_echo_client_* names for logger.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-19 11:40:39 -05:00
Robert Lubos f60b580710 samples: sockets: Configure correct number of FDs for echo_server
echo_server can use up to 6 sockets therefore it needs more file
descriptors than the maximum default value specified.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-11-15 10:02:49 -05:00
Niranjhana N d158c07ddb samples: net: echo: fix unchecked returns
Before connecting, check for errors in
bind and listen calls in the echo test.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-11-06 13:18:20 +02:00
Ravi kumar Veeramally 077408c860 samples: net: coap_server: Implemented over sockets
Sample application coap_server is implemented now over sockets.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-10-31 19:44:25 -04:00
Ravi kumar Veeramally 2ab8f599ce samples: net: coap_client: Implemented over sockets
Sample application coap_client is implemented now over sockets.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2018-10-31 19:44:25 -04:00
Reto Schneider 7eabab2f5d samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
2018-10-27 21:31:25 -04:00
Gil Pitney ca61459300 net: samples: sockets: http_get: build for cc3220sf_launchxl
Adds boards prj conf file, and updates CMakeLists.txt to
enable build.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-12 13:06:53 +03:00
Gil Pitney ab09674e4c samples: net: include sockets echo sample build in cc3220sf sanitycheck
Previously, wifi-enabled samples were not built by sanitycheck for the
cc3220sf_launchxl.

This patch gets the sockets echo sample to build.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 15:51:57 +03:00
Gil Pitney c2cdbbafd7 net: sockets: Get socket offload to build after net logging overhaul.
Also, defines one LOG_MODULE_NAME for the simplelink WiFi driver, and
uses the same name for all files in this driver (module).

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 15:51:57 +03:00
Ulf Magnusson 92ef8582b9 Kconfig: Remove redundant $(ZEPHYR_BASE) from 'source's
The $srctree environment variable gives the path relative to which
'(o)source' statements work (the current directory is used if $srctree
is unset). It is set to $ZEPHYR_BASE in cmake/kconfig.cmake, so there's
no need to qualify the source of Kconfig.zephyr in sample Kconfig files
(or in external projects).

All 'source's in Zephyr assume that the Zephyr root directory is used as
the srctree as well, and would break otherwise.

Remove the $(ZEPHYR_BASE)s to make it clearer that all 'source'
statements work relative to the Zephyr root. There was some user
confusion on IRC.

Also explain how things work in the documentation.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-10-10 11:28:27 -05:00
Anas Nashif c1d2930471 drivers: wifi: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Jukka Rissanen 7b2bdfc491 samples: net: sockets: Convert to use new logging
Use new logging system with support for network log level.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-04 14:13:57 +03:00
David B. Kinder 432562dd19 doc: fix doc misspellings
Fix misspellings missed during regular reviews

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-09-29 22:55:14 -04:00
Robert Lubos a6de97b3a4 samples: net: sockets: Update docs with TLS information
Update documentation of socket samples that support TLS with information
on how to enable it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-09-26 18:13:34 +03:00
Paul Sokolovsky e4fa2f5db7 samples: sockets: echo_client/server: Build for minimal libc
With recent changes, sockets no longer depend on Newlib libc, so
let's have actual samples which demonstrate this. echo_client/
echo_server, which were ported from net_app samples, are converted.
The rest of socket samples are intended to be buildable on a
POSIX system (e.g. Linux), so they rather stay with more
full-fledged libc.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-09-26 18:11:24 +03:00
Robert Lubos b4d856397e samples: net: sockets: Use TLS overlay config file
Unify method of enabling secure TLS sockets in samples by using TLS
overlay config file instead of standalone config files.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-09-25 15:20:58 +03:00
Robert Lubos 743e64992b samples: net: sockets: Put echo samples configuration into single file
Avoid having not-necessarily board specific configs in a separate file.
Instead, have a single project file with appropriate overlay configs.
Board specific configurations can be added in future if needed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-09-25 15:20:58 +03:00
Sebastian Bøe 72e7bfa680 cmake: Remove unnecessary KCONFIG_ROOT configuration
It is no longer necessary to set the KCONFIG_ROOT variable when the
KConfig file is in the application root directory.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-09-21 13:37:21 -04:00
Jukka Rissanen 27d99d16f8 samples: net: sockets: echo_server: Add VLAN support
If user enables VLAN support, then the sample application will
create two extra VLAN network interfaces for testing purposes.

The application can be compiled like this for VLAN support:

    cmake -DBOARD=qemu_x86 -DOVERLAY_CONFIG=overlay-vlan.conf ..

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-09-20 11:21:22 +03:00
Jukka Rissanen b17b1609ec samples: net: sockets: echo-client: Add VLAN support
Add support for VLANs which are disabled by default.
The application can be configured to use the VLANs by setting
the IP addresses properly in config file. The VLAN support in
this sample application is only meant for testing multiple network
interface handling.

The application can be compiled like this for VLAN support:

    cmake -DBOARD=qemu_x86 -DOVERLAY_CONFIG=overlay-vlan.conf ..

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-09-20 11:21:22 +03:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Gil Pitney 844e6f5a2e samples: net: sockets: echo: enable socket offload for cc3220sf_launchxl
Add a prj conf file for the TI cc3220sf_launchxl board
to enable socket offload to the simplelink WiFi driver.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-09-11 18:42:34 +03:00
Gil Pitney a4cc88ad30 samples: net: sockets: echo-client: fix sock fd test, allow zero.
Per: http://pubs.opengroup.org/onlinepubs/009695399/functions/socket.html
"Upon successful completion, socket() shall return a non-negative
integer, the socket file descriptor."

The test in prepare_fds() however fails if socket fd is
zero (non-negative), which should be a valid value.

This was found while testing the SimpleLink socket offload driver,
which can return a zero-valued socket fd, per the POSIX spec.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-08-22 15:37:15 -07:00
Robert Lubos d529aef9f2 net: tls: Apply DTLS review fixes
This commit contains several fixes for DTLS implementation, proposed in
a post-merge review of #9338.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-08-17 15:10:00 +03:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
Paul Sokolovsky 028aae1ec9 net: config: Rename Kconfig options to correspond to library name
This finishes refactor of splitting off net_config library name from
net_app library, started in c60df1311, c89a06dbc. This commit makes
sure that Kconfig options are prefixed with CONFIG_NET_CONFIG_
instead of CONFIG_NET_APP_, and propagates these changes thru the
app configs in the tree.

Also, minor dependency, etc. tweaks are made.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-08-13 18:42:31 -07:00
Robert Lubos b7c254fc40 samples: net: Add DTLS support to socket echo_client/echo_server
Add DTLS support to socket echo_client and echo_server samples.

Additionally, move TLS-related configs to overlay-tls.conf config file,
to align with other examples.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-08-13 15:24:34 +03:00
Robert Lubos 29b65859b1 net: samples: Add TLS support to socket echo_client/echo_server
This commit adds TLS support to socket echo_client/echo_server samples.

Credentials used are the same as in the non-socket versions of these
samples, therefore they can be easily tested with net-tools utils.

Maximum payload size for the client was sligtly reduced to fit the
encrypted data within 1280 bytes.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-26 12:13:15 -04:00
Robert Lubos 50631b3501 net: samples: Add CA certificates to http_get and big_http_download
Add CA certificates to http_get and big_http_download samples. Use
socket options to configure TLS connection - TLS certificates are now
validated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-26 12:13:15 -04:00
Robert Lubos 7b8b09bde4 samples: net: Explicitly ignore socket close return value
Fixes #8994

Coverity ID :187072

Explicitly ignore return value of socket close.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-18 19:51:17 +03:00
Anas Nashif c8b114f25d samples: exclude socket samples on esp32
ESP32 does not like newlib, exclude for now to get a clean sanitycheck
run. We have issues about this already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-07-16 19:00:32 -04:00
Robert Lubos f25baebf27 net: samples: Add TLS support to http_get and big_http_download samples
Add config file that enables to run http_get and big_http_download
samples with TLS enabled and receive the data through HTTPS.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-13 15:03:45 -04:00
Robert Lubos b813502077 samples: net: Socket based echo_server
Echo server sample running on top of network sockets.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-06-28 15:18:42 +03:00
Robert Lubos f01b81731b samples: net: Socket based echo_client
Echo client sample running on top of network sockets.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-06-28 15:18:42 +03:00
Satya Bhattacharya af70e8f7f0 samples: net: Check the return value of close()
Check the return value of close() in socket_dumb_http.c
If non-zero, print the error code

Fixes #8413.

Signed-off-by: Satya Bhattacharya <satyacube@gmail.com>
2018-06-18 10:47:24 +03:00
Paul Sokolovsky 59309c1a2d samples: sockets: dumb_http_server: Use consistent logging settings
Use logging settings consistent with other samples/net/sockets/ apps
(which includes error logging enabled by default).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-06-11 17:24:54 -04:00
Leandro Pereira e7a3d01dc5 samples: net: dumb_http_server: Handle recv() errors
The recv() call can return errors, so handle them before reading the
received byte.  Unrecoverable errors will just trigger the client
socket to be closed as usual.

Coverity-ID: 182778
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-08 13:07:19 -05:00
Paul Sokolovsky 659c241e3a samples: net: big_http_download: Ignore close() return value.
We aren't interested in doing error handling for close(), close()
is itself on error handling path, and its purpose if to free
socket resources.

Coverity-CID: 186062
Fixes: #7713

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-05-29 16:23:46 -04:00
Paul Sokolovsky 0b76b12837 samples: sockets: big_http_download: Update for DHCPv4 support.
Enable CONFIG_NET_DHCPV4, while keeping static IP configuration,
which allows the app to work both with static IP (e.g. when
connected to a workstation without DHCP server) and with DHCP (e.g.
when connected to a router). When using DHCP, getting an address
may take some time, during which getaddrinfo() may fail due to a
timeout. So, add retries for this call.

Tested with qemu_x86 (non-DHCP) and frdm_k64f (both DHCP and
non-DHCP).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-05-18 13:03:44 +03:00
Paul Sokolovsky 092f716020 samples: sockets: dumb_http_server: Disable TIME_WAIT delay
This is required to test the server with ab (ApacheBench), which
itself is an important integration test for the IP stack.

Fixes: #7377

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-05-16 11:03:49 +03:00
Paul Sokolovsky b56b1436ed samples: sockets: Make more errors fatal
In samples, using CHECK() helper macro, make it exist in case of
error. This makes sure that negative value (error indicator) can't
be passed as argument to other function and fixes Coverity reports.

Coverity-CID: 183062
Fixes: #6101

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-05-15 18:14:07 +03:00
Paul Sokolovsky 16a8a309a3 samples: sockets: dumb_http_server: Improve error handling
Check socket function return codes to address Coverity issues.

Coverity-CID: 182771
Fixes: #6100

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-05-15 17:21:08 +03:00
Paul Sokolovsky a3a5c48d93 samples: net: echo_async: Better error and write handling
Initially this sample was intended to be very simple and schematic,
but as this sample going to become a base for stream API conversion,
time to handle all the edge conditions.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-03-02 16:50:41 +01:00
Paul Sokolovsky 8e867378da samples: sockets: echo: Better error and short write handling
Initially this sample was intended to be very simple and schematic,
but as this sample going to become a base for stream API conversion,
time to handle all the edge conditions.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-26 10:20:50 -06:00
Kumar Gala d9bd6909c3 samples: dump_http_server: move generated files into include/generated
Move the generated files into include/generated so they live with the
build and not in the zephyr source tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-02-21 18:53:23 -05:00
Paul Sokolovsky 7e06be2218 samples: sockets: http_get: Include Host: header in request
The Host header is even mandatory in HTTP 1.1, and indeed without
it, many virtual hosting setups don't work (which are many), so to
be faithful to what README says: "You can edit the source code to
issue a request to any other site on the Internet", let's
complicate the sample by including it.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-19 10:39:14 +02:00
Paul Sokolovsky f303e9d115 samples: sockets: Add big_http_download sample
This sample downloads a more or less big file (~6MB as preconfigured)
over HTTP and checks its hash for integrity. It also repeat such a
download indefinitely, counting total number of bytes transferred.

This is thus a kind of traffic load testing sample. (Ported to C
from MicroPython original).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-17 09:11:29 -05:00
Paul Sokolovsky bc1a82acc7 samples: net: sockets: Clean up/improve socket samples
With 323e8cf069 applied and printf() working out of the box,
CONFIG_NET_BUF_LOG=y workarounds can be removed from configs of
all samples.

Also, print an intro message at the start of each server sample,
to give a user hint that the app didn't just hang and what to do
next. (The port waiting for connection is printed. We can't (easily)
print host address, because the samples should run on both Zephyr
and POSIX systems, and finding out local host address would require
hairy #ifdef's undermining the purpose of these samples (that is,
showing that the *same* code can be used on both types of systems)).

Fixes: #5379

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-11 09:49:31 -05:00
Paul Sokolovsky 166cd7f66d samples: sockets: http_get: More configurability and logging
Make it easy to override HTTP host/port/path. Print URL which we
request and make few other adjustment to the output for clarity.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-06 12:57:48 +02:00
Anas Nashif b5b8095749 samples: bluetooth and net samples need test setup
remove build_only and make them depend on test harness (bluetooth)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 23f81eeb42 tests/samples: fixed yaml syntax
Use a map directory, avoid the list which makes parsing a bit
cumbersome.

Fixes #5109

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-11 14:47:08 -05:00
Paul Sokolovsky ed3ede06e1 samples: net: sockets: Reinstate POSIX Makefiles.
All current socket samples as one of the points show portability to
POSIX platforms, and provide POSIX makefiles to let user build such
a version of application easily. These Makefiles were lost during
CMake conversion.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-11-13 16:41:14 -05:00
Sebastian Bøe 965f78088f samples: dump_http_server: Change where the .inc file is written
KBuild would write the .inc file to the source directory, this was
changed during the CMake migration because whenever possible it should
be avoided to write files outside of the build directory.

But Makefile.posix assumes that these files are generated in the
source directory so we need to keep generating them there for now.

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-13 10:08:41 -05:00
Jukka Rissanen dea2868a82 samples: net: Update compilation instructions for cmake
Update network sample documentation for cmake.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-11-10 11:36:33 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Anas Nashif 0fb51fa849 headers: fix global includes for various source files
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-31 12:32:34 -04:00
Paul Sokolovsky 5cbfa397c5 samples: sockets: dumb_http_server: Use big payload by default
This sends out 2KB+ payload (i.e. guaranteedly more than 1 network
packet). When this sample was initially written, using such payload
quickly let to a deadlock somewhere in the network stack. However
as of now, running with such payload can sustain testing with
"ab -n10000" (10000 consecutive HTTP requests using Apache Bench),
so set is as a default, to serve as a mark point against possible
future regressions.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-18 12:38:36 -04:00
David B. Kinder ee71332b99 doc: fix doc misspellings
Found some spelling issues missed during regular PR review

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-10-17 14:31:52 -04:00
Paul Sokolovsky de6fafb701 samples: net: sockets: Print incoming connection number
This helps to debug issues with mass connection handling (e.g. when
issues happen at ~500th connection).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-16 11:01:06 +03:00
Anas Nashif 0356590df5 tests: samples: fix yaml syntax
Fix indentation and syntax and make it pass yamllint tool.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-15 08:15:00 -04:00
Paul Sokolovsky ef39533365 samples: sockets: Add a dumb HTTP server example
It's dumb, because it doesn't really parse HTTP request, just always
sends the same page in response. Even such, it's useful for socket
load testing with tools like Apache Bench (ab) and for regression
checking in the net subsystem.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-09-22 08:24:36 -04:00
Paul Sokolovsky 4a771bad37 samples: net: sockets: Add HTTP GET example
This example shows usage of client connection and getaddrinfo().

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-09-19 17:39:44 +03:00
Paul Sokolovsky 756e729c00 samples: net: echo_async: Add IPv6 support
The main reason is allowing to run on 6LoWPAN devices, though also to
demonstrate IPv6 support with BSD Sockets in general.

Tested on 96b_carbon.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-21 08:40:46 -04:00
Paul Sokolovsky d9af77bfd6 net: sockets: Consistently use "BSD Sockets compatible API" moniker
This is how it's called in the main docs, so use this same phrase in
Kconfig and samples too.

Also, added some articles to docs.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-17 12:02:55 -05:00
Paul Sokolovsky e314de5d53 samples: net: sockets: Add READMEs for echo/echo_async samples
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-16 16:09:05 -04:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Paul Sokolovsky 5245a686fc samples: net: sockets: Switch to net_app auto-init
Don't call net configuration explicitly, instead rely on net_app
auto init service.

Thus, the only difference between POSIX and Zephyr versions of these
samples are different include files. The application code is 100%
the same.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-07 10:13:47 +03:00
Anas Nashif 48b351e34c samples: socket: echo_async unify prj.conf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-02 07:31:22 -04:00
Anas Nashif 6ca686cc51 samples: socket: echo: unify prj.conf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-02 07:31:22 -04:00
Anas Nashif ca0ad13a61 net: enable SLIP only on QEMU targets
In many networking tests we had to configure SLIP in the prj.conf
leaving those configurations Qemu specific. This change enables SLIP for
QEMU targets automatically and allows reuse of prj.conf for multiple
boards.

Additionally, the TUN options is removed. This option was not used
anywhere.

To enable self-contained networking tests that do not depend on SLIP, we
introduce the new option NET_TEST which disables TAP and allows testing
in QEMU without the need for a host interface.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 10:57:48 -04:00
Paul Sokolovsky 0e5c365f9a samples: net: sockets: Move socket sample(s) under a subdir
It's expected that there will be few socket-based samples, so move
tehm under samples/sockets/ to not clutter the main dir.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-07-18 21:46:56 +03:00
Paul Sokolovsky 00e8309f03 samples: sockets: Add async echo server example
Implements asynchronous TCP echo server using non-blocking sockets
and poll, with concurrent connections support.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-07-18 21:46:06 +03:00