Skip to content

Commit 4b31168

Browse files
authored
Merge pull request #2 from named-data-iot/refactor
Refactor forwarder
2 parents 9c003e0 + 9b97009 commit 4b31168

24 files changed

+1437
-24
lines changed

CMakeInputs/adaptation.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
target_sources(ndn-lite PUBLIC
2+
${DIR_ADAPTATION}/adapt-consts.h
3+
${DIR_ADAPTATION}/udp/udp-face.h
4+
)
5+
target_sources(ndn-lite PRIVATE
6+
${DIR_ADAPTATION}/uniform-time.c
7+
${DIR_ADAPTATION}/udp/udp-face.c
8+
)

CMakeInputs/encode.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
set(DIR_ENCODE "${DIR_NDN_LITE}/encode")
2+
set(DIR_TRUST_SCHEMA "${DIR_ENCODE}/trust-schema")
23
target_sources(ndn-lite PUBLIC
34
${DIR_ENCODE}/data.h
45
${DIR_ENCODE}/decoder.h
@@ -12,6 +13,12 @@ target_sources(ndn-lite PUBLIC
1213
${DIR_ENCODE}/signature.h
1314
${DIR_ENCODE}/signed-interest.h
1415
${DIR_ENCODE}/tlv.h
16+
${DIR_ENCODE}/forwarder-helper.h
17+
${DIR_ENCODE}/ndn-rule-storage.h
18+
${DIR_TRUST_SCHEMA}/ndn-trust-schema-common.h
19+
${DIR_TRUST_SCHEMA}/ndn-trust-schema-pattern-component.h
20+
${DIR_TRUST_SCHEMA}/ndn-trust-schema-pattern.h
21+
${DIR_TRUST_SCHEMA}/ndn-trust-schema-rule.h
1522
)
1623
target_sources(ndn-lite PRIVATE
1724
${DIR_ENCODE}/data.c
@@ -22,5 +29,11 @@ target_sources(ndn-lite PRIVATE
2229
${DIR_ENCODE}/name.c
2330
${DIR_ENCODE}/signature.c
2431
${DIR_ENCODE}/signed-interest.c
32+
${DIR_ENCODE}/forwarder-helper.c
33+
${DIR_ENCODE}/ndn-rule-storage.c
34+
${DIR_TRUST_SCHEMA}/ndn-trust-schema-pattern-component.c
35+
${DIR_TRUST_SCHEMA}/ndn-trust-schema-pattern.c
36+
${DIR_TRUST_SCHEMA}/ndn-trust-schema-rule.c
2537
)
38+
unset(DIR_TRUST_SCHEMA)
2639
unset(DIR_ENCODE)

CMakeInputs/examples.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set(DIR_EXAMPLES_OUTPUT "${PROJECT_BINARY_DIR}/examples")
2+
3+
# Single-file examples
4+
set(LIST_EXAMPLES
5+
"udp-basic-producer"
6+
"udp-basic-consumer"
7+
# "udp-group-producer"
8+
# "udp-group-consumer"
9+
# "access-control-producer"
10+
# "access-control-consumer"
11+
# "access-control-controller"
12+
)
13+
foreach(EXAM_NAME IN LISTS LIST_EXAMPLES)
14+
add_executable(${EXAM_NAME} "${DIR_EXAMPLES}/${EXAM_NAME}.c")
15+
target_link_libraries(${EXAM_NAME} ndn-lite)
16+
set_target_properties(${EXAM_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${DIR_EXAMPLES_OUTPUT})
17+
endforeach()
18+
unset(LIST_EXAMPLES)
19+
20+
unset(DIR_EXAMPLES_OUTPUT)

CMakeInputs/face.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
set(DIR_FACE "${DIR_NDN_LITE}/face")
22
target_sources(ndn-lite PUBLIC
3-
${DIR_FACE}/direct-face.h
43
${DIR_FACE}/dummy-face.h
54
)
65
target_sources(ndn-lite PRIVATE
7-
${DIR_FACE}/direct-face.c
86
${DIR_FACE}/dummy-face.c
97
)
108
unset(DIR_FACE)

CMakeInputs/forwarder.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
set(DIR_FORWARDER "${DIR_NDN_LITE}/forwarder")
22
target_sources(ndn-lite PUBLIC
3+
${DIR_FORWARDER}/callback-funcs.h
4+
${DIR_FORWARDER}/face-table.h
35
${DIR_FORWARDER}/face.h
46
${DIR_FORWARDER}/fib.h
57
${DIR_FORWARDER}/forwarder.h
8+
${DIR_FORWARDER}/name-tree.h
69
${DIR_FORWARDER}/pit.h
710
)
811
target_sources(ndn-lite PRIVATE
9-
${DIR_FORWARDER}/face.c
12+
${DIR_FORWARDER}/face-table.c
13+
${DIR_FORWARDER}/fib.c
1014
${DIR_FORWARDER}/forwarder.c
15+
${DIR_FORWARDER}/name-tree.c
1116
${DIR_FORWARDER}/pit.c
1217
)
1318
unset(DIR_FORWARDER)

CMakeInputs/ndnlite.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ target_sources(ndn-lite PUBLIC
33
${DIR_NDN_LITE}/ndn-enums.h
44
${DIR_NDN_LITE}/ndn-error-code.h
55
${DIR_NDN_LITE}/ndn-services.h
6+
${PROJECT_SOURCE_DIR}/ndn-lite.h
67
)
78
include(${DIR_CMAKEFILES}/app-support.cmake)
89
include(${DIR_CMAKEFILES}/encode.cmake)

CMakeInputs/security.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ target_sources(ndn-lite PUBLIC
1111
${DIR_SECURITY}/ndn-lite-sec-config.h
1212
${DIR_SECURITY}/ndn-lite-sec-utils.h
1313
${DIR_SECURITY}/ndn-lite-sha.h
14+
${DIR_SECURITY}/ndn-trust-schema.h
1415
)
1516
target_sources(ndn-lite PRIVATE
1617
${DIR_SECURITY}/ndn-lite-aes.c
@@ -20,6 +21,7 @@ target_sources(ndn-lite PRIVATE
2021
${DIR_SECURITY}/ndn-lite-sec-config.c
2122
${DIR_SECURITY}/ndn-lite-sec-utils.c
2223
${DIR_SECURITY}/ndn-lite-sha.c
24+
${DIR_SECURITY}/ndn-trust-schema.c
2325
${DIR_DEFAULT_BACKEND}/ndn-lite-default-aes-impl.h
2426
${DIR_DEFAULT_BACKEND}/ndn-lite-default-aes-impl.c
2527
${DIR_DEFAULT_BACKEND}/ndn-lite-default-ecc-impl.h

CMakeInputs/unittest.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ target_sources(unittest PRIVATE
6868
"${DIR_UNITTESTS}/sign-verify/ecdsa-sign-verify-tests/test-secp256k1-def.c"
6969
)
7070

71-
#target_sources(unittest PRIVATE
72-
# "${DIR_UNITTESTS}/schematized-trust/trust-schema-tests.h"
73-
# "${DIR_UNITTESTS}/schematized-trust/trust-schema-tests.c"
74-
# "${DIR_UNITTESTS}/schematized-trust/trust-schema-tests-def.h"
75-
# "${DIR_UNITTESTS}/schematized-trust/trust-schema-tests-def.c"
76-
#)
71+
target_sources(unittest PRIVATE
72+
"${DIR_UNITTESTS}/schematized-trust/trust-schema-tests.h"
73+
"${DIR_UNITTESTS}/schematized-trust/trust-schema-tests.c"
74+
"${DIR_UNITTESTS}/schematized-trust/trust-schema-tests-def.h"
75+
"${DIR_UNITTESTS}/schematized-trust/trust-schema-tests-def.c"
76+
)

CMakeInputs/util.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ set(DIR_UTIL "${DIR_NDN_LITE}/util")
22
target_sources(ndn-lite PUBLIC
33
${DIR_UTIL}/memory-pool.h
44
${DIR_UTIL}/msg-queue.h
5+
${DIR_UTIL}/uniform-time.h
6+
${DIR_UTIL}/bit-operations.h
7+
${DIR_UTIL}/re.h
58
)
69
target_sources(ndn-lite PRIVATE
710
${DIR_UTIL}/memory-pool.c
811
${DIR_UTIL}/msg-queue.c
12+
${DIR_UTIL}/re.c
913
)
1014
unset(DIR_UTIL)

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,32 @@
22
cmake_minimum_required (VERSION 3.11)
33
project(ndn-lite)
44

5+
add_definitions(-D_GNU_SOURCE)
56
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wall -O0 -ggdb")
67
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
78
set(CMAKE_C_FLAGS_RELEASE "-O3")
89

910
set(DIR_CMAKEFILES "${PROJECT_SOURCE_DIR}/CMakeInputs")
1011
set(DIR_NDN_LITE "${PROJECT_SOURCE_DIR}/ndn-lite")
12+
set(DIR_ADAPTATION "${PROJECT_SOURCE_DIR}/adaptation")
13+
set(DIR_EXAMPLES "${PROJECT_SOURCE_DIR}/examples")
1114
include_directories(${PROJECT_SOURCE_DIR})
1215

1316
# NDN-Lite static library
1417
add_library(ndn-lite STATIC)
1518
include(${DIR_CMAKEFILES}/ndnlite.cmake)
1619

20+
# Adaptation
21+
include(${DIR_CMAKEFILES}/adaptation.cmake)
22+
1723
# Unit test program
1824
add_executable(unittest)
1925
target_link_libraries(unittest ndn-lite)
2026
include(${DIR_CMAKEFILES}/unittest.cmake)
2127

28+
# Examples
29+
include(${DIR_CMAKEFILES}/examples.cmake)
30+
2231
# Doxygen
2332
# first we can indicate the documentation build as an option and set it to ON by default
2433
option(BUILD_DOCS "Build documentation" OFF)

0 commit comments

Comments
 (0)