-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/dtls-echo: Cleaning and upgrade to sock
Due to all the changes, this is basically a new version for this example. The main benefit is the use of sock_udp but also the client side is now more robust and reliable.
- Loading branch information
Showing
5 changed files
with
656 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,72 @@ | ||
# dtls_echo | ||
# dtls_echo example | ||
|
||
This example shows you how to use TinyDTLS with the non-socket approach. | ||
This example shows you how to use TinyDTLS with the non-socket approach. | ||
|
||
This code is based on ../gnrc_networking and ../gnrc_tftp. | ||
Is a good idea to read their README.md's for any doubt of how making the | ||
testings. | ||
## SOCK vs. Socket | ||
|
||
## SOCKET vs. Non-socket (GNRC) | ||
|
||
This example is configured to use the GNRC instead of sockets (over GNRC). | ||
At the moment, the configuration must be done manually in the Makefile of | ||
this project. | ||
This example is configured to use socks instead of sockets (over GNRC). It's | ||
possible to use sockets (again, over GNRC), which give a more similar approach | ||
to the original Linux version of TinyDTLS. However, is not tested yet. | ||
|
||
## Fast configuration (Between RIOT instances): | ||
|
||
Preparing the logical interfaces: | ||
|
||
./../../dist/tools/tapsetup/tapsetup --create 2 | ||
``` | ||
./../../dist/tools/tapsetup/tapsetup --create 3 | ||
``` | ||
|
||
For the server instance: | ||
|
||
make all; PORT=tap1 make term | ||
dtlss start | ||
ifconfig | ||
``` | ||
PORT=tap1 make all term | ||
dtlss start | ||
ifconfig | ||
``` | ||
|
||
Do not forget to copy the IPv6 addresses! | ||
|
||
For the client: | ||
|
||
PORT=tap0 make term | ||
dtlsc <IPv6's server address> "DATA TO DATA TO DATA!" | ||
``` | ||
PORT=tap0 make term | ||
dtlsc <IPv6's server address> "DATA to send under encrypted channel!" | ||
``` | ||
|
||
# Testings | ||
## Boards | ||
|
||
Those boards that do not support the `../gnrc_networking` example are included | ||
in the `BOARD_INSUFFICIENT_MEMORY`, plus the board `cc2650stk`. | ||
Boards that do not support the `../gnrc_networking` example are included | ||
in the `BOARD_INSUFFICIENT_MEMORY`, plus the board `cc2650stk`. | ||
|
||
There are certain boards that are having issues with `crypto.c` and | ||
`dtls_time.h` Which for now are in the the `BOARD_BLACKLIST`. | ||
|
||
The boards that requires `periph_conf.h` are not tested. | ||
|
||
Boards with problem type 1 (`crypto.c`): | ||
z1 | ||
wsn430-v1_4 | ||
wsn430-v1_3b | ||
waspmote-pro | ||
msb-430h | ||
msb-430 | ||
chronos | ||
arduino-mega2560 | ||
|
||
Boards with problem type 2 (`dtls_time.h`): | ||
cc2538dk | ||
msbiot | ||
telosb | ||
|
||
Boards with problem type 3 (Redifinition): | ||
saml21-xpro | ||
samr21-xpro | ||
arduino-uno | ||
arduino-duemilanove | ||
|
||
NOTE: Those on type 1 can be benefit of the following PR: | ||
https://github.com/RIOT-OS/RIOT/issues/2360 | ||
However, there are still issues to fix. | ||
|
||
NOTE: Those on type 2 can be fixed with the patch at | ||
https://github.com/RIOT-OS/RIOT/pull/5974 | ||
|
||
## FIT-LAB | ||
|
||
The code has been tested in the FIT-LAB with M3 motes. | ||
However, erros can occurrs. Enabling the line `CFLAGS += -DNDEBUG` in | ||
the `Makefile` reduces the risk. | ||
The code has been tested in the FIT IOT-LAB tesbed with the remote | ||
`iotlab-m3` and `iotlab-a8-m3` boards and with local `samr21-xpro` boards. | ||
|
||
## Handling the static memory allocation | ||
|
||
TinyDTLS for RIOT O.S. is using the `sys/memarray` module and therefore there | ||
are certain limits. Said resources are defined in | ||
`pkg/tinydtls/platform-specific/riot_boards.h`, but can be overwritten at | ||
compilation time. Their default values are considered for having two DTLS | ||
contexts (for purpose of DTLS renegotiation). | ||
|
||
The resources handled by memarray are: | ||
* `DTLS_CONTEXT_MAX` (default 2) The maximum number of DTLS context at the | ||
same time. | ||
* `DTLS_PEER_MAX` (default 1) The maximum number DTLS peers (i.e. sessions). | ||
* `DTLS_HANDSHAKE_MAX` (default 1) The maximum number of concurrent DTLS handshakes. | ||
* `DTLS_SECURITY_MAX` (the sum of the previous two) The maximum number of | ||
concurrently used cipher keys. | ||
* `DTLS_HASH_MAX` (Default: `3 * DTLS_PEER_MAX`) The maximum number of hash | ||
functions that can be used in parallel. | ||
|
||
## Handling retransmissions | ||
|
||
By default, the number of transmissions of any DTLS record is settled to just | ||
one. This can be handled by DTLS_DEFAULT_MAX_RETRANSMIT (defined in | ||
`pkg/tinydtls/platform-specific/riot_boards.h`). |
Oops, something went wrong.