Skip to content

Commit

Permalink
add include headers for devel package, update help, update to version…
Browse files Browse the repository at this point in the history
… 1.0.1

Change-Id: Id47f7b96d98a3f4ea4ec4ad364d149aefee06fc4
  • Loading branch information
Priyesh Padmavilasom committed May 18, 2016
1 parent be387dc commit b76c98f
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ltmain.sh
libtool
ar-lib

/include/config.h.in
/include/config.h.in*
/include/stamp*
/common/.deps
/common/.libs
Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ACLOCAL_AMFLAGS = -I m4

pkginclude_HEADERS=include/public/netmgr.h

SUBDIRS = \
common \
src \
Expand Down
1 change: 1 addition & 0 deletions build/package/rpm/netmgmt.spec
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ cd build && make install DESTDIR=$RPM_BUILD_ROOT

%exclude %{_lib64dir}/libnetmgr.a
%exclude %{_lib64dir}/libnetmgr.la
%exclude %{_includedir}/*

# %doc ChangeLog README COPYING

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ(2.59)

AC_INIT([netmgmt], [1.0.0], [[email protected]])
AC_INIT([netmgmt], [1.0.1], [[email protected]])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_HEADERS([include/config.h])
Expand Down
6 changes: 3 additions & 3 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
#define PACKAGE_NAME "netmgmt"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "netmgmt 1.0.0"
#define PACKAGE_STRING "netmgmt 1.0.1"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "netmgmt"
Expand All @@ -99,13 +99,13 @@
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "1.0.0"
#define PACKAGE_VERSION "1.0.1"

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* Version number of package */
#define VERSION "1.0.0"
#define VERSION "1.0.1"

/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
Expand Down
79 changes: 32 additions & 47 deletions m4/libtool.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
Expand All @@ -1324,19 +1324,9 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
;;
*)
LD="${LD-ld} -m elf_i386"
;;
esac
;;
powerpc64le-*)
LD="${LD-ld} -m elf32lppclinux"
LD="${LD-ld} -m elf_i386"
;;
powerpc64-*)
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
Expand All @@ -1355,10 +1345,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*)
LD="${LD-ld} -m elf64lppc"
;;
powerpc-*)
ppc*-*linux*|powerpc*-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
Expand Down Expand Up @@ -1701,8 +1688,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len" && \
test undefined != "$lt_cv_sys_max_cmd_len"; then
if test -n "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
Expand Down Expand Up @@ -2526,6 +2512,17 @@ freebsd* | dragonfly*)
esac
;;
gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
Expand Down Expand Up @@ -2642,7 +2639,7 @@ linux*oldld* | linux*aout* | linux*coff*)
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
linux* | k*bsd*-gnu | kopensolaris*-gnu)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
Expand Down Expand Up @@ -2687,18 +2684,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
dynamic_linker='GNU/Linux ld.so'
;;
netbsdelf*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='NetBSD ld.elf_so'
;;
netbsd*)
version_type=sunos
need_lib_prefix=no
Expand Down Expand Up @@ -3258,6 +3243,10 @@ freebsd* | dragonfly*)
fi
;;
gnu*)
lt_cv_deplibs_check_method=pass_all
;;
haiku*)
lt_cv_deplibs_check_method=pass_all
;;
Expand Down Expand Up @@ -3296,11 +3285,11 @@ irix5* | irix6* | nonstopux*)
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
linux* | k*bsd*-gnu | kopensolaris*-gnu)
lt_cv_deplibs_check_method=pass_all
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
Expand Down Expand Up @@ -4048,7 +4037,7 @@ m4_if([$1], [CXX], [
;;
esac
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
KCC*)
# KAI C++ Compiler
Expand Down Expand Up @@ -4112,7 +4101,7 @@ m4_if([$1], [CXX], [
;;
esac
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
Expand Down Expand Up @@ -4347,7 +4336,7 @@ m4_if([$1], [CXX], [
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
# old Intel for x86_64 which still supported -KPIC.
ecc*)
Expand Down Expand Up @@ -4589,9 +4578,6 @@ m4_if([$1], [CXX], [
;;
esac
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
Expand Down Expand Up @@ -4654,9 +4640,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
openbsd*)
with_gnu_ld=no
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
Expand Down Expand Up @@ -4878,7 +4861,7 @@ _LT_EOF
fi
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
Expand Down Expand Up @@ -5055,7 +5038,6 @@ _LT_EOF
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
_LT_TAGVAR(link_all_deplibs, $1)=no
else
# not using gcc
if test "$host_cpu" = ia64; then
Expand Down Expand Up @@ -5360,7 +5342,7 @@ _LT_EOF
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
Expand Down Expand Up @@ -6240,6 +6222,9 @@ if test "$_lt_caught_CXX_error" != yes; then
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
gnu*)
;;
haiku*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(link_all_deplibs, $1)=yes
Expand Down Expand Up @@ -6401,7 +6386,7 @@ if test "$_lt_caught_CXX_error" != yes; then
_LT_TAGVAR(inherit_rpath, $1)=yes
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
Expand Down
85 changes: 68 additions & 17 deletions tools/netmgr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,68 @@

#include "includes.h"

//name of command,
//pointer to command invoke
//parameters if any
//help message
NETMGR_CLI_CMD_MAP arCmdMap[] =
{
{"help",
cmd_help,
"",
"show this message"
},
{"ifup",
cmd_ifup,
"<interfacename>",
"bring up the specified interface if it is currently down."
},
{"ifdown",
cmd_ifdown,
"<interfacename>",
"bring down the specified interface if it is currently up."
},
{"list",
cmd_list,
"-4 or -6",
"shows list of available interfaces. -4 is the default"
},
{"set_iaid",
cmd_set_iaid,
"<interfacename> <IAID>",
"set IAID"
},
{"get_iaid",
cmd_get_iaid,
"<interfacename>",
"get IAID"
},
{"set_duid",
cmd_set_duid,
"<interfacename> <DUID>",
"set DUID"
},
{"get_duid",
cmd_get_duid,
"<interfacename>",
"get DUID"
},
{"set_dns_servers",
cmd_set_dns_servers,
"<dns servers list>",
"set dns servers"
},
{"get_dns_servers",
cmd_get_dns_servers,
"",
"get dns servers"
},
};

int main(int argc, char* argv[])
{
uint32_t err = 0;
PNETMGR_CMD_ARGS pCmdArgs = NULL;
NETMGR_CLI_CMD_MAP arCmdMap[] =
{
{"help", cmd_help},
{"ifup", cmd_ifup},
{"ifdown", cmd_ifdown},
{"list", cmd_list},
{"set_iaid", cmd_set_iaid},
{"get_iaid", cmd_get_iaid},
{"set_duid", cmd_set_duid},
{"get_duid", cmd_get_duid},
{"set_dns_servers", cmd_set_dns_servers},
{"get_dns_servers", cmd_get_dns_servers},
};

int nCommandCount = sizeof(arCmdMap)/sizeof(NETMGR_CLI_CMD_MAP);
const char* pszCmd = NULL;
Expand Down Expand Up @@ -94,16 +139,22 @@ cmd_help(
PNETMGR_CMD_ARGS pCmdArgs
)
{
int i = 0;
int nCommandCount = sizeof(arCmdMap)/sizeof(NETMGR_CLI_CMD_MAP);
fprintf(stdout, "Usage: netmgr [options] command\n");
fprintf(stdout, "\n");

fprintf(stdout, "List of commands\n");
fprintf(stdout, "\n");

fprintf(stdout, "help\tshows this message\n");
fprintf(stdout, "ifup <interfacename>\tbring up the specified interface if it is currently down.\n");
fprintf(stdout, "ifdown <interfacename>\tbring down the specified interface if it is currently up.\n");
fprintf(stdout, "list\tshows list of available interfaces. use -6 to show ipv6 only\n");
for(i = 0; i < nCommandCount; ++i)
{
fprintf(stdout,
"%s %s\t%s\n",
arCmdMap[i].pszCmdName,
arCmdMap[i].pszParams,
arCmdMap[i].pszHelpMessage);
}

return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions tools/netmgr/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ typedef struct _NETMGR_CLI_CMD_MAP
{
char* pszCmdName;
uint32_t (*pFnCmd)(PNETMGR_CMD_ARGS);
char* pszParams;
char* pszHelpMessage;
}NETMGR_CLI_CMD_MAP, *PNETMGR_CLI_CMD_MAP;

#ifdef __cplusplus
Expand Down

0 comments on commit b76c98f

Please sign in to comment.