├── package
├── postinst
├── postrm
├── packagedesc.txt
└── copyright
├── doc
├── doxygen
│ ├── pictures
│ │ ├── LL_Icon.png
│ │ ├── modem-router-mac.dia
│ │ ├── modem-router-mac.png
│ │ ├── dest-advert-sequence.dia
│ │ ├── dest-advert-sequence.png
│ │ ├── modem-using-dest-advert.dia
│ │ └── modem-using-dest-advert.png
│ └── markdown
│ │ └── Main.md
└── CMakeLists.txt
├── tests
├── bad_paramname_config.xml
├── bad_paramval1_config.xml
├── bad_paramval2_config.xml
├── test_modem_config_8175.xml
├── test_router_config.xml
├── test_modem_config_v6.xml
├── test_router_config_8175.xml
├── test_router_config_v6.xml
├── router1_config.xml
├── router2_config.xml
├── LogFile.h
├── CMakeLists.txt
├── helgrind.supp
├── LogFile.cpp
├── test_modem_config.xml
├── modem1_dest_advert.xml
├── modem2_dest_advert.xml
├── serialize.cpp
├── dest_advert.cpp
└── TestClientImpl.h
├── .gitignore
├── astylerc
├── destadvert.proto
├── libdlep.pc.in
├── LatencyRange.h
├── config
├── 4nodes_dest_advert
│ ├── router1.xml
│ ├── router2.xml
│ ├── modem1.xml
│ ├── modem2.xml
│ └── 4nodes.imn
├── CMakeLists.txt
├── modem_dest_advert.xml
├── modem.xml
├── modem_lo.xml
├── router.xml
├── router_lo.xml
└── protocol
│ ├── multi-hop-06.xml
│ ├── latency-range-03.xml
│ ├── example-extension-00.xml
│ └── protocol-config.xsd
├── Thread.h
├── MultiHop.h
├── IdTypes.h
├── DlepMac.cpp
├── LICENSE
├── Table.h
├── DlepInit.h
├── RELEASENOTES.md
├── DestAdvertInfo.h
├── DlepCommon.h
├── DlepMac.h
├── DlepLogger.h
├── DestAdvertDataBase.h
├── DlepLogger.cpp
├── DestAdvertMessage.h
├── DlepServiceImpl.h
├── DlepInit.cpp
├── NetUtils.h
├── Table.cpp
├── PeerDiscovery.h
├── DestAdvert.h
├── ProtocolMessage.h
├── README.md
├── Dlep.h
├── PeriodicMcastSendRcv.h
├── ExampleDlepClientImpl.h
├── CMakeLists.txt
├── ProtocolConfigImpl.h
├── Serialize.h
├── InfoBaseMgr.h
├── PeriodicMcastSendRcv.cpp
└── DlepClient.h
/package/postinst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | /sbin/ldconfig
4 |
--------------------------------------------------------------------------------
/package/postrm:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ "$1" = "remove" ]; then
4 | ldconfig
5 | fi
6 |
--------------------------------------------------------------------------------
/doc/doxygen/pictures/LL_Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-ll/LL-DLEP/HEAD/doc/doxygen/pictures/LL_Icon.png
--------------------------------------------------------------------------------
/doc/doxygen/pictures/modem-router-mac.dia:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-ll/LL-DLEP/HEAD/doc/doxygen/pictures/modem-router-mac.dia
--------------------------------------------------------------------------------
/doc/doxygen/pictures/modem-router-mac.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-ll/LL-DLEP/HEAD/doc/doxygen/pictures/modem-router-mac.png
--------------------------------------------------------------------------------
/doc/doxygen/pictures/dest-advert-sequence.dia:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-ll/LL-DLEP/HEAD/doc/doxygen/pictures/dest-advert-sequence.dia
--------------------------------------------------------------------------------
/doc/doxygen/pictures/dest-advert-sequence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-ll/LL-DLEP/HEAD/doc/doxygen/pictures/dest-advert-sequence.png
--------------------------------------------------------------------------------
/doc/doxygen/pictures/modem-using-dest-advert.dia:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-ll/LL-DLEP/HEAD/doc/doxygen/pictures/modem-using-dest-advert.dia
--------------------------------------------------------------------------------
/doc/doxygen/pictures/modem-using-dest-advert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-ll/LL-DLEP/HEAD/doc/doxygen/pictures/modem-using-dest-advert.png
--------------------------------------------------------------------------------
/tests/bad_paramname_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 |
6 |
7 |
--------------------------------------------------------------------------------
/tests/bad_paramval1_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | this_is_not_an_int
5 |
6 |
7 |
--------------------------------------------------------------------------------
/package/packagedesc.txt:
--------------------------------------------------------------------------------
1 | This is an implementation of the IETF DLEP protocol. See
2 | https://datatracker.ietf.org/doc/draft-ietf-manet-dlep/ for
3 | the current draft of DLEP.
4 |
--------------------------------------------------------------------------------
/tests/bad_paramval2_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | this_is_not_a_multicast_addr
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | *~
3 | *.log
4 | build-defs.h
5 | Dlep
6 | Dlep-static
7 | cppcheck*xml
8 | *.pb.cc
9 | *.pb.h
10 | lib*.a
11 | lib*so.*
12 | tests/*.log
13 | tests/lib_tests
14 | tests/deps
15 | deps
16 | build*/*
17 |
--------------------------------------------------------------------------------
/tests/test_modem_config_8175.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | test_modem_config.xml
5 | test-protocol-config-8175.xml
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/test_router_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | test_modem_config.xml
5 | router
6 | test-router
7 | test-router.log
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/test_modem_config_v6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | test_modem_config.xml
5 | test-modem-v6.log
6 | ff02::1:7
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/test_router_config_8175.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | test_modem_config_8175.xml
5 | router
6 | test-router
7 | test-router.log
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/test_router_config_v6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | test_router_config.xml
5 | test-router-v6.log
6 | ff02::1:7
7 |
8 |
9 |
--------------------------------------------------------------------------------
/astylerc:
--------------------------------------------------------------------------------
1 | # astyle options
2 | # astyle (Artistic Style) is a code formatter. Run like this:
3 | # astyle --options=astylerc *.cpp *.h
4 | --style=bsd
5 | --indent=spaces
6 | --indent-switches
7 | --max-instatement-indent=70
8 | --max-code-length=80
9 | --pad-header --pad-oper --unpad-paren
10 | --add-brackets --lineend=linux
11 | --align-pointer=middle
12 |
--------------------------------------------------------------------------------
/tests/router1_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | modem1_dest_advert.xml
5 | 0
6 | router
7 | test-router1
8 | test-router1.log
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/router2_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | modem2_dest_advert.xml
5 | 0
6 | router
7 | test-router2
8 | test-router2.log
9 |
10 |
11 |
--------------------------------------------------------------------------------
/destadvert.proto:
--------------------------------------------------------------------------------
1 | message DestinationAdvertisement {
2 | required uint32 reportinterval = 1; // report interval in seconds
3 | required uint32 sequencenumber = 2; // sequence number
4 | required uint64 uptimeinseconds = 3; // application up time in seconds
5 | required bytes localid = 4; // our local modem/radio id
6 | repeated bytes destinations = 5; // destinations to advertise
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/libdlep.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=${prefix}
3 | libdir=${exec_prefix}/lib
4 | includedir=${exec_prefix}/include
5 | sysconfdir=@ETCDIR@/dlep
6 |
7 | Name: @PROJECT_NAME@
8 | Description: MIT Lincoln Laboratory Dynamic Link Exchange Protocol
9 | Version: @DLEP_VERSION@
10 | Libs: -L${libdir} -ldlep
11 | Cflags: -I${includedir} \
12 | -DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS \
13 | -DBOOST_MPL_LIMIT_LIST_SIZE=30 \
14 | -DBOOST_MPL_LIMIT_VECTOR_SIZE=30 \
15 | -DDLEP_SYSCONFDIR=\"${sysconfdir}\"
16 |
--------------------------------------------------------------------------------
/LatencyRange.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2018 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Declarations for the Latency Range extension
9 |
10 | #ifndef LATENCY_RANGE_H
11 | #define LATENCY_RANGE_H
12 |
13 | namespace LLDLEP
14 | {
15 | namespace ProtocolStrings
16 | {
17 |
18 | // data item strings
19 |
20 | const std::string Latency_Range = "Latency_Range";
21 |
22 | } // namespace ProtocolStrings
23 | } // namespace LLDLEP
24 |
25 | #endif // LATENCY_RANGE_H
26 |
--------------------------------------------------------------------------------
/tests/LogFile.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Utility for examining DLEP log files.
9 |
10 | #ifndef LOG_FILE_H
11 | #define LOG_FILE_H
12 |
13 | #include
14 | #include
15 |
16 | class LogFile
17 | {
18 | public:
19 | explicit LogFile(std::string & filename);
20 | ~LogFile() {};
21 |
22 | int find(int start_line, const std::string & search_string);
23 |
24 | private:
25 | std::vector lines;
26 | };
27 |
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | SET(TEST_SRCS serialize.cpp dataitems.cpp messages.cpp lib_interface.cpp dest_advert.cpp LogFile.cpp TestClientImpl.cpp)
2 |
3 | find_package(Boost REQUIRED COMPONENTS unit_test_framework)
4 | add_definitions(${BOOST_INCREASE_VARIANT_TYPES})
5 | add_definitions(-DBOOST_TEST_DYN_LINK)
6 |
7 | include_directories(${LIBXML2_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
8 |
9 | add_executable(lib_tests ${TEST_SRCS})
10 | target_link_libraries(lib_tests dlepShared ${LIBXML2_LIBRARIES} ${PROTOBUF_LIBRARIES} ${Boost_LIBRARIES})
11 |
12 | add_test(NAME BoostTests COMMAND lib_tests WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
13 |
--------------------------------------------------------------------------------
/tests/helgrind.supp:
--------------------------------------------------------------------------------
1 | # helgrind (valgrind) suppressions file.
2 | # Using these suppressions, the tests run with no helgrind errors
3 | # with valgrind-3.10.0.SVN on Ubuntun 14.04.2. Run like this:
4 | # valgrind --tool=helgrind --verbose --read-var-info=yes --suppressions=helgrind.supp ./lib_tests --report_level=detailed --log_level=all
5 |
6 | {
7 | std::locale::locale()
8 | Helgrind:Race
9 | fun:_ZNSt6localeC1EPNS_5_ImplE
10 | }
11 |
12 | {
13 | std::locale::locale()
14 | Helgrind:Race
15 | fun:_ZNSt6localeaSERKS_
16 | }
17 |
18 | {
19 | std::has_facet()
20 | Helgrind:Race
21 | fun:_ZSt9has_facetISt5ctypeIcEEbRKSt6locale
22 | }
23 |
--------------------------------------------------------------------------------
/doc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(Doxygen REQUIRED)
2 | if(NOT ${DOXYGEN_DOT_FOUND})
3 | message(FATAL_ERROR "The Dot program was not found. Please install Graphviz to provide this executable.")
4 | endif(NOT ${DOXYGEN_DOT_FOUND})
5 |
6 | configure_file(doxygen.config.in ${CMAKE_CURRENT_BINARY_DIR}/doxygen.config @ONLY)
7 | add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.config
8 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxygen.config
9 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
10 | COMMENT "Generating documentation with doxygen")
11 |
12 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/ DESTINATION ${DOCDIR} PATTERN "*.md5" EXCLUDE)
13 |
--------------------------------------------------------------------------------
/doc/doxygen/markdown/Main.md:
--------------------------------------------------------------------------------
1 | %Table of Contents {#mainpage}
2 | =================
3 |
4 | - [User Guide](@ref userguide)
5 | - [Design Notes](@ref designnotes)
6 |
7 |
10 |
11 | \page proto_config_schema Protocol configuration schema
12 | \include protocol-config.xsd
13 |
14 | \page rfc8175 DLEP RFC 8175 protocol configuration
15 | \include dlep-rfc-8175.xml
16 |
17 | \page latency_range_config Latency Range extension protocol configuration
18 | \include latency-range-03.xml
19 |
20 | \page multi_hop_config Multi-Hop extension protocol configuration
21 | \include multi-hop-06.xml
22 |
--------------------------------------------------------------------------------
/config/4nodes_dest_advert/router1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | router
5 | 0
6 | 1
7 | 4854
8 | eth0
9 | 224.0.0.117
10 | 60
11 | 60
12 | 2
13 | 4854
14 | emulated-router1
15 | dlep-router1.log
16 |
17 |
18 |
--------------------------------------------------------------------------------
/config/4nodes_dest_advert/router2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | router
5 | 0
6 | 1
7 | 4854
8 | eth0
9 | 224.0.0.117
10 | 60
11 | 60
12 | 2
13 | 4854
14 | emulated-router2
15 | dlep-router2.log
16 |
17 |
18 |
--------------------------------------------------------------------------------
/config/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # files that can be validated against protocol-config.xsd
2 | file(GLOB DRAFTS_XML RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/protocol/dlep*.xml)
3 |
4 | # gather all xml/xsd files
5 | file(GLOB XML_INSTALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/protocol/*.x[ms][ld])
6 |
7 | foreach ( file ${XML_INSTALL_FILES} )
8 | add_test(wellformedxml_${file} ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_CURRENT_SOURCE_DIR}/${file})
9 | endforeach(file)
10 |
11 | foreach ( file ${DRAFTS_XML} )
12 | add_test(validatedxml_${file} ${LIBXML2_XMLLINT_EXECUTABLE} --noout --xinclude --schema ${CMAKE_CURRENT_SOURCE_DIR}/protocol/protocol-config.xsd ${CMAKE_CURRENT_SOURCE_DIR}/${file})
13 | endforeach(file)
14 |
15 | install(FILES ${XML_INSTALL_FILES} DESTINATION ${ETCDIR}/dlep)
16 |
--------------------------------------------------------------------------------
/Thread.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Portability header to make it easy to choose between Boost threads
9 | /// and C++ standard library (std::) threads.
10 |
11 | #ifndef THREAD_H
12 | #define THREAD_H
13 |
14 | #ifdef USE_BOOST_THREADS
15 | #include
16 |
17 | namespace LLDLEP
18 | {
19 | namespace internal
20 | {
21 |
22 | typedef boost::thread Thread;
23 |
24 | } // namespace internal
25 | } // namespace LLDLEP
26 |
27 | #else
28 |
29 | // use std threads
30 | #include
31 |
32 | namespace LLDLEP
33 | {
34 | namespace internal
35 | {
36 |
37 | typedef std::thread Thread;
38 |
39 | } // namespace internal
40 | } // namespace LLDLEP
41 |
42 | #endif
43 |
44 | #endif // THREAD_H
45 |
--------------------------------------------------------------------------------
/config/modem_dest_advert.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | modem
5 | 1
6 | 1
7 | lo
8 | 1
9 | eth0
10 | 4854
11 | 224.0.0.117
12 | 60
13 | 4854
14 | 60
15 | 2
16 | emulated-modem
17 | dlep-modem.log
18 |
19 |
20 |
--------------------------------------------------------------------------------
/config/4nodes_dest_advert/modem1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | modem
5 | 1
6 | 1
7 | eth1
8 | 1
9 | eth0
10 | 4854
11 | 224.0.0.117
12 | 60
13 | 4854
14 | 60
15 | 2
16 | dest-advert-modem1
17 | dlep-modem1.log
18 |
19 |
20 |
--------------------------------------------------------------------------------
/config/4nodes_dest_advert/modem2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | modem
5 | 1
6 | 2
7 | eth0
8 | 1
9 | eth1
10 | 4854
11 | 224.0.0.117
12 | 60
13 | 4854
14 | 60
15 | 2
16 | dest-advert-modem2
17 | dlep-modem2.log
18 |
19 |
20 |
--------------------------------------------------------------------------------
/tests/LogFile.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Utility for examining DLEP log files.
9 |
10 |
11 | #include "LogFile.h"
12 | #include
13 | #include
14 |
15 | LogFile::LogFile(std::string & filename)
16 | {
17 | std::ifstream file(filename);
18 | std::string oneline;
19 |
20 | // Read in all of the lines of the file
21 | while (std::getline(file, oneline))
22 | {
23 | lines.push_back(oneline);
24 | }
25 | }
26 |
27 | int
28 | LogFile::find(int start_line, const std::string & search_string)
29 | {
30 | for (unsigned int i = start_line; i < lines.size(); i++)
31 | {
32 | if (lines[i].find(search_string) != std::string::npos)
33 | {
34 | return i;
35 | }
36 | }
37 | return -1;
38 | }
39 |
--------------------------------------------------------------------------------
/MultiHop.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2018 Massachusetts Institute of Technology
5 | * Modified by LabN Consulting, L.L.C.
6 | */
7 |
8 | /// @file
9 | /// Declarations for the Multi Hop extension
10 |
11 | #ifndef MULTI_HOP_H
12 | #define MULTI_HOP_H
13 |
14 | namespace LLDLEP
15 | {
16 | namespace ProtocolStrings
17 | {
18 |
19 | // data item strings
20 |
21 | const std::string Hop_Count = "Hop_Count";
22 | const std::string Hop_Control = "Hop_Control";
23 |
24 | // extension name string
25 | //
26 | // string must match the module name defined in the protocol xml file
27 | const std::string Multi_Hop = "Multi-Hop";
28 |
29 | } // namespace ProtocolStrings
30 |
31 | /// Flag definitions for the Hop_Count
32 | enum HopCountFlags : std::uint8_t
33 | {
34 | none = 0, ///< no flags set
35 | p_bit = (1 << 7) ///< P-bit
36 | };
37 | } // namespace LLDLEP
38 | #endif // MULTI_HOP_H
39 |
--------------------------------------------------------------------------------
/config/modem.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | modem
9 | 1
10 |
11 |
12 | eth0
13 |
14 |
15 | 4854
16 |
17 |
18 | 225.0.0.117
19 | 60
20 |
21 |
22 | 4854
23 | 60
24 | 2
25 | emulated-modem
26 | dlep-modem.log
27 |
28 |
29 |
--------------------------------------------------------------------------------
/config/modem_lo.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | modem
9 | 1
10 |
11 |
12 | lo
13 |
14 |
15 | 4854
16 |
17 |
18 | 225.0.0.117
19 | 60
20 |
21 |
22 | 4854
23 | 60
24 | 2
25 | emulated-modem
26 | dlep-modem.log
27 |
28 |
29 |
--------------------------------------------------------------------------------
/config/router.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | router
9 | 1
10 |
11 |
12 | 4854
13 |
14 |
15 | eth0
16 |
17 |
18 | 225.0.0.117
19 | 60
20 | 60
21 | 2
22 |
23 |
24 | 4854
25 | emulated-router
26 | dlep-router.log
27 |
28 |
29 |
--------------------------------------------------------------------------------
/IdTypes.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2013 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Types for various kinds of DLEP IDs.
9 | ///
10 | /// These are NOT the types that are used on the wire, i.e., in the
11 | /// actual protocol. The wire representation varies according to the
12 | /// DLEP draft and is handled via configuration; see ProtocolConfig.
13 | /// These types are used internally and in the library interface to
14 | /// represent the IDs. They should be large enough to accommodate the
15 | /// largest expected wire representation for their respective ID type.
16 |
17 | #ifndef IDTYPES_H
18 | #define IDTYPES_H
19 |
20 | namespace LLDLEP
21 | {
22 |
23 | typedef std::uint32_t SignalIdType;
24 | typedef std::uint32_t DataItemIdType;
25 | typedef std::uint32_t ExtensionIdType;
26 | typedef std::uint32_t StatusCodeIdType;
27 |
28 | // value to use if an ID is unknown or undefined
29 | constexpr std::uint32_t IdUndefined = ~0U;
30 |
31 | } // namespace LLDLEP
32 |
33 | #endif // IDTYPES_H
34 |
--------------------------------------------------------------------------------
/tests/test_modem_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3
5 | 100
6 | 0
7 | eth0
8 | 4854
9 | 224.0.0.117
10 | 5
11 | 1
12 | 60
13 | 2
14 | modem
15 | test-modem.log
16 | 1
17 | ../config/protocol/dlep-rfc-8175.xml
18 | ../config/protocol/protocol-config.xsd
19 | test-modem
20 | 3
21 | 4854
22 |
23 |
24 |
--------------------------------------------------------------------------------
/config/router_lo.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | router
9 | 1
10 |
11 |
12 | 4854
13 |
14 |
15 | lo
16 |
17 |
18 | 225.0.0.117
19 | 60
20 | 60
21 | 2
22 |
23 |
24 | 127.0.0.1
25 | 4855
26 | emulated-router
27 | dlep-router.log
28 |
29 |
30 |
--------------------------------------------------------------------------------
/DlepMac.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016, 2018 Massachusetts Institute of Technology
5 | */
6 |
7 | #include
8 | #include
9 | #include "DlepCommon.h"
10 |
11 | namespace LLDLEP
12 | {
13 | /// Return true iff mac1 < mac2
14 | bool operator<(const DlepMac & mac1, const DlepMac & mac2)
15 | {
16 | return (mac1.mac_addr < mac2.mac_addr);
17 | }
18 |
19 | /// Return true iff mac1 == mac2
20 | bool operator==(const DlepMac & mac1, const DlepMac & mac2)
21 | {
22 | return (mac1.mac_addr == mac2.mac_addr);
23 | }
24 |
25 | std::ostream & operator<<(std::ostream & os, const DlepMac & mac)
26 | {
27 | os << mac.to_string();
28 | return os;
29 | }
30 |
31 | std::string DlepMac::to_string() const
32 | {
33 | std::ostringstream s;
34 | s << std::hex << std::setfill('0');
35 | std::string colon = "";
36 | for (auto mac_byte : mac_addr)
37 | {
38 | s << std::setw(0) << colon
39 | << std::setw(2) << (unsigned int)mac_byte;
40 | colon = ":";
41 | }
42 |
43 | return s.str();
44 | }
45 |
46 | } // namespace LLDLEP
47 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2015, 2016, 2017, 2018 Massachusetts Institute of Technology
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/package/copyright:
--------------------------------------------------------------------------------
1 | Copyright (C) 2015, 2016 Massachusetts Institute of Technology
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/Table.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Declaration of Table class
9 |
10 | #ifndef TABLE_H
11 | #define TABLE_H
12 |
13 | #include
14 | #include
15 | #include
16 |
17 | /// This class provides a convenient way to print tables of text
18 | /// values. Tables can be sparse; not every row/column needs to have
19 | /// a value. The table's column widths auto-adjust to accommodate the
20 | /// column's widest value.
21 | class Table
22 | {
23 | public:
24 | explicit Table(const std::vector & headings);
25 |
26 | void add_field(const std::string & value);
27 | void add_field(const std::string & field_name, const std::string & value);
28 | void finish_row(bool force_empty_row = false);
29 | unsigned int get_row_index();
30 | void set_row_index(unsigned int ri);
31 | void set_row_index_end();
32 | void print(std::ostream & os);
33 |
34 | private:
35 | unsigned int current_row;
36 | unsigned int current_column;
37 | typedef std::vector Row;
38 | std::vector table;
39 | };
40 |
41 | #endif // TABLE_H
42 |
--------------------------------------------------------------------------------
/DlepInit.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// DLEP Service library entry point declaration
9 |
10 | #ifndef DLEP_INIT_H
11 | #define DLEP_INIT_H
12 |
13 | #include "DlepClient.h"
14 | #include "DlepService.h"
15 |
16 | /// All client-visible identifiers necessary to use the DLEP Service Library
17 | /// are in this namespace.
18 | /// If you find it necessary to use identifiers in the Dlep source that are
19 | /// not in this namespace, you are most likely doing something wrong.
20 | namespace LLDLEP
21 | {
22 | /// Main entry point into the DLEP Service library.
23 | ///
24 | /// DLEP service library users call this function first to start the
25 | /// DLEP service. After performing some initialization, this function
26 | /// returns, but one or more threads remain active in the library to
27 | /// manage the DLEP protocol.
28 | ///
29 | /// @param[in] dlep_client
30 | /// used for the library to communicate to the caller
31 | ///
32 | /// @return
33 | /// - nullptr if the library failed to initialize
34 | /// - otherwise, a pointer to a DlepService object that the caller
35 | /// uses to communicate to the DLEP service library
36 | DlepService * DlepInit(DlepClient & dlep_client);
37 |
38 | } // namespace LLDLEP
39 |
40 | #endif // DLEP_INIT_H
41 |
--------------------------------------------------------------------------------
/tests/modem1_dest_advert.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3
5 | 100
6 | 1
7 | 1
8 | 225.6.7.8
9 | 33445
10 | 0
11 | 0
12 | 1
13 | lo
14 | 4854
15 | 224.0.0.117
16 | 5
17 | 1
18 | 60
19 | 2
20 | modem
21 | test-modem1.log
22 | 1
23 | ../config/protocol/dlep-rfc-8175.xml
24 | ../config/protocol/protocol-config.xsd
25 | test-modem
26 | 3
27 | 4854
28 |
29 |
30 |
--------------------------------------------------------------------------------
/tests/modem2_dest_advert.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 3
5 | 100
6 | 1
7 | 1
8 | 225.6.7.8
9 | 33445
10 | 0
11 | 0
12 | 2
13 | lo
14 | 4855
15 | 224.0.0.117
16 | 5
17 | 1
18 | 60
19 | 2
20 | modem
21 | test-modem2.log
22 | 1
23 | ../config/protocol/dlep-rfc-8175.xml
24 | ../config/protocol/protocol-config.xsd
25 | test-modem
26 | 3
27 | 4855
28 |
29 |
30 |
--------------------------------------------------------------------------------
/RELEASENOTES.md:
--------------------------------------------------------------------------------
1 | MIT Lincoln Laboratory DLEP (LL-DLEP) Implementation
2 |
3 | Release 2.1 July 23, 2018
4 | ==================================
5 |
6 | Unit tests for low-level serialization are added, and defects exposed
7 | by the new tests are fixed.
8 |
9 | Many warnings from gcc -Wall, cppcheck, clang-tidy are fixed.
10 |
11 | Code for an obsolete credit window extension is removed.
12 |
13 | Release 1.10
14 | ==================================
15 |
16 | Initial public release of the MIT LL implementation of the Dynamic
17 | Link Exchange Protocol (DLEP).
18 |
19 | LL-DLEP features the following:
20 |
21 | - A flexible library-based C++11 implementation of the protocol enabling
22 | clean integration with a wide variety of modem and router devices.
23 |
24 | - An example DLEP client (library user) that provides interactive
25 | access to the protocol via a command-line interface. The example
26 | client can be used as a surrogate for either a router or modem
27 | device.
28 |
29 | - Extensive configurability. The implementation supports multiple
30 | versions (drafts) of the DLEP protocol by using an XML-based
31 | protocol configuration file that captures the main protocol
32 | characteristics that vary across drafts. This simplifies
33 | interoperation with other DLEP implementations and makes updating to
34 | new DLEP drafts easier. A configuration files is provided for draft
35 | 24. The configuration system also enables convenient integration of
36 | DLEP extensions.
37 |
38 | - Support for running DLEP over either IPv4 or IPv6.
39 |
40 | - Partial support for the Credit Windowing extension.
41 |
42 | - A supplemental Destination Advertisement protocol that runs
43 | over-the-air between DLEP modems and enables exchange of additional
44 | information about destinations that is typically needed.
45 |
46 | - Documentation covering the library API, a user guide, and design
47 | considerations.
48 |
49 | - Unit and system test cases.
50 |
--------------------------------------------------------------------------------
/DestAdvertInfo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | *
6 | * Contributor: Adjacent Link LLC, Bridgewater, NJ
7 | */
8 |
9 | /// @file
10 | /// DestAdvertInfo class declaration.
11 |
12 | #ifndef DEST_ADVERT_INFO_H
13 | #define DEST_ADVERT_INFO_H
14 |
15 | #include
16 | #include
17 | #include
18 | #include "DlepCommon.h"
19 |
20 | namespace LLDLEP
21 | {
22 | namespace internal
23 | {
24 |
25 | // holds info going in/out of the advertisement msg
26 | struct DestAdvertInfo
27 | {
28 | std::uint32_t reportInterval;
29 | std::int64_t uptime;
30 | std::uint32_t sequenceNumber;
31 | LLDLEP::DlepMac rfId;
32 | LLDLEP::DlepMacAddrs destinations;
33 |
34 | DestAdvertInfo() :
35 | reportInterval {},
36 | uptime {},
37 | sequenceNumber {}
38 | { }
39 |
40 | DestAdvertInfo(std::uint32_t interval,
41 | time_t uptm,
42 | std::uint32_t seq,
43 | const LLDLEP::DlepMac & id,
44 | const LLDLEP::DlepMacAddrs & dests) :
45 | reportInterval {interval},
46 | uptime {uptm},
47 | sequenceNumber {seq},
48 | rfId(id),
49 | destinations(dests)
50 | { }
51 |
52 | std::string to_string() const
53 | {
54 | std::stringstream ss;
55 |
56 | ss << "report interval=" << reportInterval;
57 | ss << " uptime=" << uptime;
58 | ss << " seqnum=" << sequenceNumber;
59 | ss << " rfid=" << rfId.to_string();
60 | ss << " dests:";
61 |
62 | for (auto dest : destinations)
63 | {
64 | ss << dest.to_string() << ", ";
65 | }
66 |
67 | return ss.str();
68 | }
69 | };
70 |
71 | } // namespace internal
72 | } // namespace LLDLEP
73 |
74 | #endif
75 |
76 |
--------------------------------------------------------------------------------
/DlepCommon.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Declarations that are common to (i.e., needed by) both the client and
9 | /// the library.
10 |
11 | #ifndef DLEP_COMMON_H
12 | #define DLEP_COMMON_H
13 |
14 | #include "DataItem.h"
15 | #include "IdTypes.h"
16 |
17 | namespace LLDLEP
18 | {
19 |
20 | /// Information about a peer
21 | struct PeerInfo
22 | {
23 | /// Uniquely identifies the peer
24 | std::string peer_id;
25 |
26 | /// value of the %Peer Type data item sent by the peer during DLEP
27 | /// session negotiation
28 | std::string peer_type;
29 |
30 | /// the set of extensions to use with this peer (mutually agreed
31 | /// upon during DLEP session negotiation)
32 | std::vector extensions;
33 |
34 | /// values of the Experiment Name data items sent by the peer during
35 | /// DLEP session negotiation
36 | std::vector experiment_names;
37 |
38 | /// metrics and IP addresses associated with the peer
39 | DataItems data_items;
40 |
41 | /// destinations declared up by the peer
42 | std::vector destinations;
43 |
44 | /// heartbeat interval declared by the peer during DLEP session
45 | /// negotiation. This is the exact value sent by the peer in the
46 | /// Heartbeat Interval data item; no unit conversion has been
47 | /// performed.
48 | uint32_t heartbeat_interval;
49 | };
50 |
51 | /// Information about a destination
52 | struct DestinationInfo
53 | {
54 | /// MAC address of the destination
55 | DlepMac mac_address;
56 |
57 | /// peer to which this destination belongs
58 | std::string peer_id;
59 |
60 | /// boolean flags for this destination (none defined yet)
61 | std::uint32_t flags;
62 |
63 | /// metrics and IP addresses for this destination
64 | DataItems data_items;
65 | };
66 |
67 | } // namespace LLDLEP
68 |
69 | #endif // DLEP_COMMON_H
70 |
--------------------------------------------------------------------------------
/DlepMac.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2015, 2016 Massachusetts Institute of Technology
5 | */
6 |
7 | /// @file
8 | /// Declaration of MAC address type.
9 |
10 | #ifndef DLEP_MAC_H
11 | #define DLEP_MAC_H
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | namespace LLDLEP
19 | {
20 |
21 | /// MAC address. It is variable size so that we can support 6 or 8
22 | /// byte addresses as required by the draft, or even 2 byte addresses
23 | /// to hold EMANE NEM IDs.
24 | typedef struct d_mac
25 | {
26 | std::vector mac_addr;
27 |
28 | /// Convert to string representation
29 | std::string to_string() const;
30 |
31 | } DlepMac;
32 |
33 |
34 | /// Compare (<) two DlepMacs. With this, we can use a DlepMac as the
35 | /// key in a std::map.
36 | bool operator<(const DlepMac & mac1, const DlepMac & mac2);
37 |
38 | /// Compare two DlepMacs for equality.
39 | bool operator==(const DlepMac & mac1, const DlepMac & mac2);
40 |
41 | /// Output operator for convenient output to an ostream
42 | std::ostream & operator<<(std::ostream & os, const DlepMac & mac);
43 |
44 |
45 | /// set of DlepMac addrs
46 | using DlepMacAddrs = std::set;
47 |
48 | /// Find the difference between to sets of DlepMac addrs
49 | /// possibly use std::set_difference from \ instead
50 | inline void getDifference(const DlepMacAddrs & A, const DlepMacAddrs & B,
51 | DlepMacAddrs & C)
52 | {
53 | // whats in here
54 | for (const auto a : A)
55 | {
56 | bool found = false;
57 |
58 | // and not in here
59 | for (const auto b : B)
60 | {
61 | if (a == b)
62 | {
63 | found = true;
64 |
65 | break;
66 | }
67 | }
68 |
69 | if (! found)
70 | {
71 | C.insert(a);
72 | }
73 | }
74 | }
75 |
76 |
77 | } // namespace LLDLEP
78 |
79 | #endif // DLEP_MAC_H
80 |
--------------------------------------------------------------------------------
/DlepLogger.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Dynamic Link Exchange Protocol (DLEP)
3 | *
4 | * Copyright (C) 2013, 2018, 2019 Massachusetts Institute of Technology
5 | */
6 | #ifndef _DLEP_LOGGER_
7 | #define _DLEP_LOGGER_
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include