Skip to content

Commit

Permalink
Merge pull request #220 from david-antliff-imgtec/gengetopts-daemons
Browse files Browse the repository at this point in the history
Updated daemons to use gengetopts, as the tools have always done.

Also, bootstrap config files have been moved from core/ to config/ and renamed *.bsc as per #219. Documentation and test configuration has been updated.
  • Loading branch information
Roland Bewick authored Jul 4, 2016
2 parents 9e83162 + 9f47bf8 commit 72dfd09
Show file tree
Hide file tree
Showing 89 changed files with 10,962 additions and 6,285 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ TEST_PATHS=--clientDaemonPath=$(LWM2M_CLIENTD_BIN) \
--serverDaemonPath=$(LWM2M_SERVERD_BIN) \
--bootstrapDaemon=$(LWM2M_BOOTSTRAPD_BIN) \
--coapClientPath=$(LIBCOAP_COAP_CLIENT) \
--bootstrapConfig=api/tests/bootstrap-gtest.config
--bootstrapConfig=api/tests/gtest.bsc

.PHONY: gtest_tests
gtest_tests: $(TEST_SRC_BIN) $(TEST_API_BIN) $(TEST_TOOLS_BIN) $(TEST_STATIC_API_BIN)
Expand Down
10 changes: 5 additions & 5 deletions api/python/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#************************************************************************************************************************/

Expand All @@ -38,7 +38,7 @@ class _DefaultsStandalone(object):
SERVER_LOG_FILE = "awa_serverd.log"
CLIENT_LOG_FILE = "awa_clientd.log"

BOOTSTRAP_CONFIG_FILE = "../../bootstrap-localhost.config"
BOOTSTRAP_CONFIG_FILE = "../../localhost.bsc"

CLIENT_ENDPOINT_NAME = "TestClient"

Expand All @@ -60,7 +60,7 @@ class _DefaultsSpawn(object):
SERVER_LOG_FILE = "awa_serverd.log"
CLIENT_LOG_FILE = "awa_clientd.log"

BOOTSTRAP_CONFIG_FILE = "../lwm2m_ipc/bootstrap.config"
BOOTSTRAP_CONFIG_FILE = "../../localhost.bsc"

CLIENT_ENDPOINT_NAME = "imgClient"

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion api/tests/support/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const char * const coapClientPath = "lib/libcoap/examples/coap-client";
const char * const clientDaemonPath = "core/src/client/awa_clientd";
const char * const serverDaemonPath = "core/src/server/awa_serverd";
const char * const bootstrapServerDaemonPath = "core/src/bootstrap/awa_bootstrapd";
const char * const bootstrapServerConfig = "../api/tests/bootstrap-gtest.config";
const char * const bootstrapServerConfig = "../api/tests/gtest.bsc";

} // namespace defaults

Expand Down
2 changes: 1 addition & 1 deletion api/tests/support/main/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ all: $(FILES:=.c)
.PHONY: gen_cmdline
gen_cmdline: $(FILES)

%_cmdline.c %_cmdline.h: %.cmdline
%_cmdline.c %_cmdline.h: %.ggo
gengetopt --input=$^ --include-getopt --file $*_cmdline

.PHONY: clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ option "coapClientPath" - "Path to libcoap coap-client tool" string option
option "clientDaemonPath" - "Path to LWM2M client daemon" string optional default="core/src/client/awa_clientd"
option "serverDaemonPath" - "Path to LWM2M server daemon" string optional default="core/src/server/awa_serverd"
option "bootstrapDaemonPath" - "Path to LWM2M bootstrap daemon" string optional default="core/src/bootstrap/awa_bootstrapd"
option "bootstrapConfig" - "Path to bootstrap config file" string optional default="../api/tests/bootstrap-gtest.config"
option "bootstrapConfig" - "Path to bootstrap config file" string optional default="../api/tests/gtest.bsc"

option "defaultTimeout" - "Set default timeout in milliseconds for IPC operations" int optional typestr="TIMEOUT"
8 changes: 4 additions & 4 deletions api/tests/support/main/main_cmdline.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
File autogenerated by gengetopt version 2.22.6
generated with the following command:
gengetopt --input=main.cmdline --include-getopt --file main_cmdline
gengetopt --input=main.ggo --include-getopt --file main_cmdline
The developers of gengetopt consider the fixed text that goes in all
gengetopt output files to be in the public domain:
Expand Down Expand Up @@ -45,7 +45,7 @@ const char *gengetopt_args_info_help[] = {
" --clientDaemonPath=STRING Path to LWM2M client daemon\n (default=`core/src/client/awa_clientd')",
" --serverDaemonPath=STRING Path to LWM2M server daemon\n (default=`core/src/server/awa_serverd')",
" --bootstrapDaemonPath=STRING\n Path to LWM2M bootstrap daemon\n (default=`core/src/bootstrap/awa_bootstrapd')",
" --bootstrapConfig=STRING Path to bootstrap config file\n (default=`../api/tests/bootstrap-gtest.config')",
" --bootstrapConfig=STRING Path to bootstrap config file\n (default=`../api/tests/gtest.bsc')",
" --defaultTimeout=TIMEOUT Set default timeout in milliseconds for IPC\n operations",
0
};
Expand Down Expand Up @@ -105,7 +105,7 @@ void clear_args (struct gengetopt_args_info *args_info)
args_info->serverDaemonPath_orig = NULL;
args_info->bootstrapDaemonPath_arg = gengetopt_strdup ("core/src/bootstrap/awa_bootstrapd");
args_info->bootstrapDaemonPath_orig = NULL;
args_info->bootstrapConfig_arg = gengetopt_strdup ("../api/tests/bootstrap-gtest.config");
args_info->bootstrapConfig_arg = gengetopt_strdup ("../api/tests/gtest.bsc");
args_info->bootstrapConfig_orig = NULL;
args_info->defaultTimeout_orig = NULL;

Expand Down Expand Up @@ -1323,7 +1323,7 @@ cmdline_parser_internal (

if (update_arg( (void *)&(args_info->bootstrapConfig_arg),
&(args_info->bootstrapConfig_orig), &(args_info->bootstrapConfig_given),
&(local_args_info.bootstrapConfig_given), optarg, 0, "../api/tests/bootstrap-gtest.config", ARG_STRING,
&(local_args_info.bootstrapConfig_given), optarg, 0, "../api/tests/gtest.bsc", ARG_STRING,
check_ambiguity, override, 0, 0,
"bootstrapConfig", '-',
additional_error))
Expand Down
2 changes: 1 addition & 1 deletion api/tests/support/main/main_cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct gengetopt_args_info
char * bootstrapDaemonPath_arg; /**< @brief Path to LWM2M bootstrap daemon (default='core/src/bootstrap/awa_bootstrapd'). */
char * bootstrapDaemonPath_orig; /**< @brief Path to LWM2M bootstrap daemon original value given at command line. */
const char *bootstrapDaemonPath_help; /**< @brief Path to LWM2M bootstrap daemon help description. */
char * bootstrapConfig_arg; /**< @brief Path to bootstrap config file (default='../api/tests/bootstrap-gtest.config'). */
char * bootstrapConfig_arg; /**< @brief Path to bootstrap config file (default='../api/tests/gtest.bsc'). */
char * bootstrapConfig_orig; /**< @brief Path to bootstrap config file original value given at command line. */
const char *bootstrapConfig_help; /**< @brief Path to bootstrap config file help description. */
int defaultTimeout_arg; /**< @brief Set default timeout in milliseconds for IPC operations. */
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions core/src/bootstrap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set (awa_bootstrapd_SOURCES
awa_bootstrapd_cmdline.c
lwm2m_bootstrap_server.c
lwm2m_bootstrap.c
lwm2m_bootstrap_core.c
Expand Down Expand Up @@ -35,6 +36,9 @@ if (ENABLE_GCOV)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif ()

# disable -Wall warnings for _cmdline.c files
set_source_files_properties (awa_bootstrapd_cmdline.c PROPERTIES COMPILE_FLAGS -Wno-all)

add_executable (awa_bootstrapd ${awa_bootstrapd_SOURCES})
target_include_directories (awa_bootstrapd PRIVATE ${awa_bootstrapd_INCLUDE_DIRS})
target_link_libraries (awa_bootstrapd awa_common_static)
Expand Down
16 changes: 16 additions & 0 deletions core/src/bootstrap/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FILES:=awa_bootstrapd_cmdline

# prevent autodeletion of intermediate files:
#.SECONDARY:

all: $(FILES:=.c)

.PHONY: gen_cmdline
gen_cmdline: $(FILES)

%_cmdline.c %_cmdline.h: %.ggo
gengetopt --input=$^ --include-getopt --unamed-opts=PATHS --file $*_cmdline

.PHONY: clean
clean:
rm -f $(FILES:=.c) $(FILES:=.h)
22 changes: 22 additions & 0 deletions core/src/bootstrap/awa_bootstrapd.ggo
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# gengetopt configuration file
package "awa_bootstrapd"
purpose "Awa LWM2M Bootstrap Server"
versiontext "Copyright (c) 2016 Imagination Technologies Limited and/or its affiliated group companies."
args "--no-version"

option "ip" a "Accept client bootstrap requests on IP address ADDR" string optional default="0.0.0.0" typestr="ADDR"
option "interface" e "Accept client bootstrap requests on network interface IF" string optional typestr="IF"
option "addressFamily" f "Address family for network interface. AF=4 for IPv4, AF=6 for IPv6"
int optional default="4" typestr="AF" values="4","6"
option "port" p "Use port number PORT for CoAP communications" int optional default="15685" typestr="PORT"
option "config" c "Load server list configuration from FILE" string optional typestr="FILE" multiple(1-4)
option "secure" s "CoAP communications are secured with DTLS" flag off
option "daemonize" d "Detach process from terminal and run in the background" flag off
option "verbose" v "Generate verbose output" flag off
option "logFile" l "Log output to FILE" string optional typestr="FILE"
option "version" V "Print version and exit" flag off

text "\n"
text "Example:\n"
text " awa_bootstrapd --port 15685 --config bootstrap.config\n"
text "\n"
Loading

0 comments on commit 72dfd09

Please sign in to comment.