Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9684c57
Support runtime selection of transport.
malsbat Mar 27, 2019
735f60d
Add "-n" option across the board to specify network of addresses.
malsbat Apr 1, 2019
d599154
Allow different multicast ports for test isolation.
malsbat Apr 1, 2019
dba05dc
Run tests in parallel.
malsbat Apr 1, 2019
b74c12b
Use correct network in subscriber interactive mode.
malsbat Apr 1, 2019
dd1c2a2
Support network argument in publish test.
malsbat Apr 1, 2019
438ca09
Enable fuzzer transport again.
malsbat Apr 2, 2019
53a45dd
Transports is plural now.
malsbat Apr 2, 2019
cc28e37
Reduce number of verified builds.
malsbat Apr 2, 2019
b4c85e3
Allow 'transports' or 'transport' as scons variable.
malsbat Apr 2, 2019
3899e66
Ensure ref counts are cleaned up on mbedTLS errors.
malsbat Apr 2, 2019
cf4b5c8
Transports is plural now.
malsbat Apr 2, 2019
d7f520e
Rework multicast isolation for test runner to avoid EADDRINUSE.
malsbat Apr 3, 2019
43d0131
Git ignore patch artifacts.
malsbat Apr 3, 2019
6be92e2
Use common queue for resolver requests.
malsbat Apr 3, 2019
3d320cc
Don't rebuild ext when transports change.
malsbat Apr 10, 2019
22791c5
Remove unused define.
malsbat Apr 11, 2019
d94cdf9
Whitespace.
malsbat Apr 11, 2019
6acd6e4
Default network must be compiled in, not necessarily udp.
malsbat Apr 10, 2019
ae41e3a
Return DPS_ERR_EOD when trying to decode bytes or strings.
malsbat Apr 11, 2019
48a2e79
Pipe transport must supply listen address for peer endpoint.
malsbat Apr 11, 2019
6d9ee6d
Fix fuzzer compile error.
malsbat Apr 12, 2019
c031334
Add missing const qualifiers.
malsbat Apr 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ environment:

build_script:
- cd C:\projects\dps-for-iot
- scons variant=%VARIANT% transport=%TRANSPORT% PYTHON_PATH=C:\Python27-x64 SWIG=C:\ProgramData\chocolatey\bin\swig.exe
- scons variant=%VARIANT% transports=%TRANSPORT% PYTHON_PATH=C:\Python27-x64 SWIG=C:\ProgramData\chocolatey\bin\swig.exe
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ out
*.pdb
go/bin/*
go/pkg/*
*.orig
*.rej
24 changes: 9 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,23 @@ compiler:
- gcc

env:
- VARIANT=debug TRANSPORT=udp BINDINGS=all ASAN=yes FSAN=no
- VARIANT=debug TRANSPORT=tcp BINDINGS=all ASAN=yes FSAN=no
- VARIANT=debug TRANSPORT=dtls BINDINGS=all ASAN=yes FSAN=no
- VARIANT=debug TRANSPORT=pipe BINDINGS=all ASAN=yes FSAN=no
- VARIANT=release TRANSPORT=udp BINDINGS=all ASAN=yes FSAN=no
- VARIANT=release TRANSPORT=tcp BINDINGS=all ASAN=yes FSAN=no
- VARIANT=release TRANSPORT=dtls BINDINGS=all ASAN=yes FSAN=no
- VARIANT=release TRANSPORT=dtls BINDINGS=python,nodejs ASAN=yes FSAN=yes
- VARIANT=release TRANSPORT=pipe BINDINGS=all ASAN=yes FSAN=no
- VARIANT=release TRANSPORT=fuzzer BINDINGS=python,nodejs ASAN=yes FSAN=yes
- VARIANT=debug TRANSPORTS=udp,tcp,dtls,pipe BINDINGS=all ASAN=yes FSAN=no
- VARIANT=release TRANSPORTS=udp,tcp,dtls,pipe BINDINGS=all ASAN=yes FSAN=no
- VARIANT=release TRANSPORTS=dtls BINDINGS=python,nodejs ASAN=yes FSAN=yes
- VARIANT=release TRANSPORTS=fuzzer BINDINGS=python,nodejs ASAN=yes FSAN=yes

matrix:
exclude:
- compiler: clang
- compiler: gcc
env: VARIANT=release TRANSPORT=dtls BINDINGS=python,nodejs ASAN=yes FSAN=yes
env: VARIANT=release TRANSPORTS=dtls BINDINGS=python,nodejs ASAN=yes FSAN=yes
- compiler: gcc
env: VARIANT=release TRANSPORT=fuzzer BINDINGS=python,nodejs ASAN=yes FSAN=yes
env: VARIANT=release TRANSPORTS=fuzzer BINDINGS=python,nodejs ASAN=yes FSAN=yes
include:
- compiler: clang
env: VARIANT=release TRANSPORT=dtls BINDINGS=python,nodejs ASAN=yes FSAN=yes
env: VARIANT=release TRANSPORTS=dtls BINDINGS=python,nodejs ASAN=yes FSAN=yes
- compiler: clang
env: VARIANT=release TRANSPORT=fuzzer BINDINGS=python,nodejs ASAN=yes FSAN=yes
env: VARIANT=release TRANSPORTS=fuzzer BINDINGS=python,nodejs ASAN=yes FSAN=yes

addons:
apt:
Expand All @@ -54,5 +48,5 @@ install:
- pip install --user pexpect

script:
- scons CC=$CC CXX=$CXX variant=$VARIANT transport=$TRANSPORT bindings=$BINDINGS asan=$ASAN ubsan=yes fsan=$FSAN
- scons CC=$CC CXX=$CXX variant=$VARIANT transports=$TRANSPORTS bindings=$BINDINGS asan=$ASAN ubsan=yes fsan=$FSAN
- ./test_scripts/run.py -d
44 changes: 28 additions & 16 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ else:
commonenv.Append(CFLAGS = ['-Wstrict-prototypes'])
commonenv.Append(CPPPATH = ['#/inc'])

# Additional transport defines for these files
if commonenv['udp']:
commonenv['USE_UDP'] = 'true'
commonenv.Append(CPPDEFINES = ['DPS_USE_UDP'])
if commonenv['tcp']:
commonenv['USE_TCP'] = 'true'
commonenv.Append(CPPDEFINES = ['DPS_USE_TCP'])
if commonenv['dtls']:
commonenv['USE_DTLS'] = 'true'
commonenv.Append(CPPDEFINES = ['DPS_USE_DTLS'])
if commonenv['pipe']:
commonenv['USE_PIPE'] = 'true'
commonenv.Append(CPPDEFINES = ['DPS_USE_PIPE'])

# Core libraries
libenv = commonenv.Clone()

Expand Down Expand Up @@ -61,19 +75,17 @@ srcs = ['src/bitvec.c',
'src/mbedtls.c',
'src/queue.c']

if env['transport'] == 'udp':
srcs.extend(['src/multicast/network.c',
'src/udp/network.c'])
elif env['transport'] == 'dtls':
srcs.extend(['src/multicast/network.c',
'src/dtls/network.c'])
elif env['transport'] == 'tcp':
srcs.extend(['src/multicast/network.c',
'src/tcp/network.c'])
elif env['transport'] == 'pipe':
srcs.extend(['src/multicast/network.c',
'src/pipe/network.c'])
elif env['transport'] == 'fuzzer':
if env['udp'] or env['dtls'] or env['tcp'] or env['pipe']:
srcs.extend(['src/multicast/network.c'])
if env['udp']:
srcs.extend(['src/udp/network.c'])
if env['dtls']:
srcs.extend(['src/dtls/network.c'])
if env['tcp']:
srcs.extend(['src/tcp/network.c'])
if env['pipe']:
srcs.extend(['src/pipe/network.c'])
if env['fuzzer']:
srcs.extend(['src/fuzzer/network.c'])

Depends(srcs, ext_objs)
Expand Down Expand Up @@ -137,7 +149,7 @@ if env['python']:
elif 'gcc' in pyenv['CC']:
pyenv.Append(CCFLAGS = ['-Wno-ignored-qualifiers', '-Wno-cast-function-type'])
elif 'clang' in pyenv['CC']:
pyenv.Append(CCFLAGS = ['-Wno-deprecated-register', '-Wno-ignored-qualifiers'])
pyenv.Append(CCFLAGS = ['-std=c++11', '-Wno-deprecated-register', '-Wno-ignored-qualifiers'])

pyenv.Append(SWIGFLAGS = ['-python', '-c++', '-Wextra', '-Werror', '-v', '-O'], SWIGPATH = ['#/inc', './swig/py'])
pyenv.Append(CPPPATH = ['swig', 'swig/py'])
Expand Down Expand Up @@ -313,9 +325,9 @@ if env['PLATFORM'] == 'posix' and env['fsan'] == True:
fenv.Append(LIBS = [lib, env['DPS_LIBS']])

fsrcs = ['test/fuzzer/cbor_fuzzer.c']
if env['transport'] == 'dtls':
if 'dtls' in env['transports']:
fsrcs.extend(['test/fuzzer/dtls_fuzzer.c'])
elif env['transport'] == 'fuzzer':
elif 'fuzzer' in env['transports']:
fsrcs.extend(['test/fuzzer/net_receive_fuzzer.c',
'test/fuzzer/multicast_receive_fuzzer.c'])

Expand Down
18 changes: 5 additions & 13 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ AddOption('--tool', action='append', dest='tools', help='Add tool to the environ

vars = Variables()

transports = Split('udp tcp dtls pipe fuzzer')
bindings = Split('python nodejs go')

# Generic build variables
Expand All @@ -16,7 +17,7 @@ vars.AddVariables(
BoolVariable('fsan', 'Enable fuzzer sanitizer?', False),
BoolVariable('cov', 'Enable code coverage?', False),
EnumVariable('variant', 'Build variant', default='release', allowed_values=('debug', 'release'), ignorecase=2),
EnumVariable('transport', 'Transport protocol', default='udp', allowed_values=('udp', 'tcp', 'dtls', 'pipe', 'fuzzer'), ignorecase=2),
ListVariable(['transports', 'transport'], 'Transport protocol', [t for t in transports if t != 'fuzzer'], transports),
EnumVariable('target', 'Build target', default='local', allowed_values=('local', 'yocto'), ignorecase=2),
ListVariable('bindings', 'Bindings to build', bindings, bindings),
PathVariable('application', 'Application to build', '', PathVariable.PathAccept),
Expand Down Expand Up @@ -63,18 +64,9 @@ for key, val in ARGLIST:
for b in bindings:
env[b] = b in env['bindings']

if env['transport'] == 'udp':
env['USE_UDP'] = 'true'
env.Append(CPPDEFINES = ['DPS_USE_UDP'])
elif env['transport'] == 'tcp':
env['USE_TCP'] = 'true'
env.Append(CPPDEFINES = ['DPS_USE_TCP'])
elif env['transport'] == 'dtls':
env['USE_DTLS'] = 'true'
env.Append(CPPDEFINES = ['DPS_USE_DTLS'])
elif env['transport'] == 'pipe':
env['USE_PIPE'] = 'true'
env.Append(CPPDEFINES = ['DPS_USE_PIPE'])
# Unpack transports into individually testable booleans
for t in transports:
env[t] = t in env['transports']

print("Building for " + env['variant'])

Expand Down
4 changes: 2 additions & 2 deletions doc/Building-and-Running.dox
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ To build the DPS libraries, examples, bindings, and documentation run
@c scons.

@verbatim
$ scons [variant=debug|release] [transport=udp|tcp|dtls] [bindings=all|none|{python,nodejs,go}]
$ scons [variant=debug|release] [transports=udp|tcp|dtls] [bindings=all|none|{python,nodejs,go}]
@endverbatim

To build with a different compiler use the @c CC and @c CXX build
Expand All @@ -125,7 +125,7 @@ Depending on the platform and compiler only a subset of bindings are supported.
</table>

To see the complete list of build options run <tt>scons --help</tt>.
The default build configuration is <tt>variant=release transport=udp
The default build configuration is <tt>variant=release transports=udp
bindings=all</tt>.

@note A limitation of the current implementation is that the transport
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorial/hello_world.dox
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ parameter value allows both @c / and @c . as separators.
Once created, a node must be started. Starting a node enables it
to begin sending and receiving DPS messages in the network.

For this example, we are going to be sending and receiving
multicast publications so we enable both and let DPS assign the
listening port.
For this example, we are going to be sending and receiving multicast
publications so we enable both and let DPS assign the listening
address for the chosen network.

@see DPS_MCAST_PUB_DISABLED, DPS_GetListenAddress()

Expand Down
8 changes: 4 additions & 4 deletions doc/tutorial/link.dox
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ the @c mcastPub parameter of DPS_StartNode(). All publications and
subscriptions will go through the forwarding node.

The second thing we do is specify the @c listenAddr parameter to
DPS_StartNode(). In this instance we bind the node to all available
interfaces at the port provided. A port value of zero lets DPS assign
an ephemeral listening port. A value of non-zero requests a specific
port.
DPS_StartNode(). In this instance we select UDP and bind the node to
all available interfaces at the port provided for the chosen network.
For IP networks, a port value of zero lets DPS assign an ephemeral
listening port while a value of non-zero requests a specific port.

The last thing we do is get the port DPS has chosen with
DPS_GetListenAddress(). This will be used by the subscriber and
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorial/security.dox
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The first step to enabling network layer security is to build with
a transport that supports it.

@code
$ scons transport=dtls
$ scons transports=dtls
@endcode

The DTLS transport supports two mechanisms for securing the
Expand Down
Loading