summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-03-20 21:37:12 -0700
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-03-20 21:37:12 -0700
commitfabc48d51caadc72c317e8d0946e888089781ce6 (patch)
tree0684e5aa6807c9e52276d441f4710fd06105aadb
parent5d226de3eb549f6a2698f476ed13227694d3c977 (diff)
libwimaxll: add helpers to translate state names to values and back
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
-rw-r--r--Makefile.in1
-rwxr-xr-xconfigure52
-rw-r--r--configure.in3
-rw-r--r--doc/Makefile.in1
-rw-r--r--include/Makefile.in1
-rw-r--r--include/wimaxll.h5
-rw-r--r--include/wimaxll/Makefile.in1
-rw-r--r--lib/Makefile.am20
-rw-r--r--lib/Makefile.in53
-rwxr-xr-xlib/enum-to-names-vals33
-rw-r--r--lib/misc.c88
-rw-r--r--src/Makefile.in1
12 files changed, 224 insertions, 35 deletions
diff --git a/Makefile.in b/Makefile.in
index bee48d1..4991b7d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -124,6 +124,7 @@ LIBNL1_LIBS = @LIBNL1_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LINUX_INCLUDE_PATH = @LINUX_INCLUDE_PATH@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
diff --git a/configure b/configure
index bd8ec6f..8312398 100755
--- a/configure
+++ b/configure
@@ -884,6 +884,7 @@ PKG_CONFIG
LIBNL1_CFLAGS
LIBNL1_LIBS
I2400M_INCLUDES
+LINUX_INCLUDE_PATH
GLIB_CFLAGS
GLIB_LIBS
LIBOBJS
@@ -4471,7 +4472,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4474 "configure"' > conftest.$ac_ext
+ echo '#line 4475 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7528,11 +7529,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7531: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7532: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7535: \$? = $ac_status" >&5
+ echo "$as_me:7536: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7818,11 +7819,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7821: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7822: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7825: \$? = $ac_status" >&5
+ echo "$as_me:7826: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7922,11 +7923,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7925: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7926: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7929: \$? = $ac_status" >&5
+ echo "$as_me:7930: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10299,7 +10300,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10302 "configure"
+#line 10303 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10399,7 +10400,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10402 "configure"
+#line 10403 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12800,11 +12801,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12803: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12804: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12807: \$? = $ac_status" >&5
+ echo "$as_me:12808: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -12904,11 +12905,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12907: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12908: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:12911: \$? = $ac_status" >&5
+ echo "$as_me:12912: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14502,11 +14503,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14505: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14506: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14509: \$? = $ac_status" >&5
+ echo "$as_me:14510: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14606,11 +14607,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14609: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14610: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14613: \$? = $ac_status" >&5
+ echo "$as_me:14614: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16826,11 +16827,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16829: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16830: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16833: \$? = $ac_status" >&5
+ echo "$as_me:16834: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -17116,11 +17117,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17119: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17120: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:17123: \$? = $ac_status" >&5
+ echo "$as_me:17124: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -17220,11 +17221,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17223: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17224: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:17227: \$? = $ac_status" >&5
+ echo "$as_me:17228: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -20335,6 +20336,8 @@ fi
I2400M_INCLUDES="-I${LINUX_KERNEL}/include"
+LINUX_INCLUDE_PATH="${LINUX_KERNEL}/include"
+
{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
@@ -21317,13 +21320,14 @@ PKG_CONFIG!$PKG_CONFIG$ac_delim
LIBNL1_CFLAGS!$LIBNL1_CFLAGS$ac_delim
LIBNL1_LIBS!$LIBNL1_LIBS$ac_delim
I2400M_INCLUDES!$I2400M_INCLUDES$ac_delim
+LINUX_INCLUDE_PATH!$LINUX_INCLUDE_PATH$ac_delim
GLIB_CFLAGS!$GLIB_CFLAGS$ac_delim
GLIB_LIBS!$GLIB_LIBS$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 22; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.in b/configure.in
index 15f7375..10de604 100644
--- a/configure.in
+++ b/configure.in
@@ -120,7 +120,8 @@ then
AC_MSG_ERROR([WiMAX kernel support has minor version $wimax_gnl_vminor, this software needs at least $need_vminor])
fi
-AC_SUBST(I2400M_INCLUDES,"-I${LINUX_KERNEL}/include")
+AC_SUBST(I2400M_INCLUDES, "-I${LINUX_KERNEL}/include")
+AC_SUBST(LINUX_INCLUDE_PATH, "${LINUX_KERNEL}/include")
AC_CHECK_LIB(dl, dlopen, dummy=yes,
AC_MSG_ERROR(dynamic linking loader is required))
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 9eed296..57eb3e0 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -90,6 +90,7 @@ LIBNL1_LIBS = @LIBNL1_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LINUX_INCLUDE_PATH = @LINUX_INCLUDE_PATH@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
diff --git a/include/Makefile.in b/include/Makefile.in
index 977e04d..47a8792 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -111,6 +111,7 @@ LIBNL1_LIBS = @LIBNL1_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LINUX_INCLUDE_PATH = @LINUX_INCLUDE_PATH@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
diff --git a/include/wimaxll.h b/include/wimaxll.h
index 97d11f9..d44da2c 100644
--- a/include/wimaxll.h
+++ b/include/wimaxll.h
@@ -346,6 +346,11 @@ ssize_t wimaxll_wait_for_state_change(struct wimaxll_handle *wmx,
extern void (*wimaxll_vmsg)(const char *, va_list);
void wimaxll_vmsg_stderr(const char *, va_list);
+enum wimax_st wimaxll_state_by_name(const char *);
+size_t wimaxll_states_snprintf(char *, size_t);
+const char * wimaxll_state_to_name(enum wimax_st);
+
+#define wimaxll_array_size(a) (sizeof(a)/sizeof(a[0]))
static inline // ugly hack for doxygen
/**
diff --git a/include/wimaxll/Makefile.in b/include/wimaxll/Makefile.in
index 6f546cf..3ce3f9b 100644
--- a/include/wimaxll/Makefile.in
+++ b/include/wimaxll/Makefile.in
@@ -100,6 +100,7 @@ LIBNL1_LIBS = @LIBNL1_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LINUX_INCLUDE_PATH = @LINUX_INCLUDE_PATH@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 0a26f11..235604b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -10,6 +10,7 @@ lib_LTLIBRARIES = libwimaxll.la
lib_LIBRARIES = libwimaxll.a
libwimaxll_sources = \
genl.c \
+ misc.c \
op-open.c \
op-msg.c \
op-reset.c \
@@ -27,3 +28,22 @@ libwimaxll_la_CFLAGS = $(AM_CFLAGS)
# set to zero if removed existing interfaces
libwimaxll_la_LDFLAGS = -version-info 1:0:0 $(LIBNL1_LIBS)
libwimaxll_a_SOURCES = $(libwimaxll_sources)
+
+BUILT_SOURCES = names-vals.h
+
+enum_names = \
+ wimax_st
+
+CLEANFILES = names-vals.h
+
+names-vals.h: @LINUX_INCLUDE_PATH@/linux/wimax.h enum-to-names-vals
+ rm -f $@
+ echo "#include <linux/wimax.h>" > $@
+ for type in $(enum_names); \
+ do \
+ $(srcdir)/enum-to-names-vals $$type $^; \
+ done >> $@
+
+noinst_SCRIPTS = enum-to-names-vals
+
+EXTRA_DIST = $(noinst_SCRIPTS)
diff --git a/lib/Makefile.in b/lib/Makefile.in
index c9cee9d..a66d010 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -16,6 +16,7 @@
+
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -56,23 +57,24 @@ LIBRARIES = $(lib_LIBRARIES)
ARFLAGS = cru
libwimaxll_a_AR = $(AR) $(ARFLAGS)
libwimaxll_a_LIBADD =
-am__objects_1 = genl.$(OBJEXT) op-open.$(OBJEXT) op-msg.$(OBJEXT) \
- op-reset.$(OBJEXT) op-rfkill.$(OBJEXT) \
+am__objects_1 = genl.$(OBJEXT) misc.$(OBJEXT) op-open.$(OBJEXT) \
+ op-msg.$(OBJEXT) op-reset.$(OBJEXT) op-rfkill.$(OBJEXT) \
re-state-change.$(OBJEXT) wimax.$(OBJEXT)
am_libwimaxll_a_OBJECTS = $(am__objects_1)
libwimaxll_a_OBJECTS = $(am_libwimaxll_a_OBJECTS)
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libwimaxll_la_LIBADD =
-am__objects_2 = libwimaxll_la-genl.lo libwimaxll_la-op-open.lo \
- libwimaxll_la-op-msg.lo libwimaxll_la-op-reset.lo \
- libwimaxll_la-op-rfkill.lo libwimaxll_la-re-state-change.lo \
- libwimaxll_la-wimax.lo
+am__objects_2 = libwimaxll_la-genl.lo libwimaxll_la-misc.lo \
+ libwimaxll_la-op-open.lo libwimaxll_la-op-msg.lo \
+ libwimaxll_la-op-reset.lo libwimaxll_la-op-rfkill.lo \
+ libwimaxll_la-re-state-change.lo libwimaxll_la-wimax.lo
am_libwimaxll_la_OBJECTS = $(am__objects_2)
libwimaxll_la_OBJECTS = $(am_libwimaxll_la_OBJECTS)
libwimaxll_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libwimaxll_la_CFLAGS) \
$(CFLAGS) $(libwimaxll_la_LDFLAGS) $(LDFLAGS) -o $@
+SCRIPTS = $(noinst_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -135,6 +137,7 @@ LIBNL1_LIBS = @LIBNL1_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LINUX_INCLUDE_PATH = @LINUX_INCLUDE_PATH@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
@@ -217,6 +220,7 @@ lib_LTLIBRARIES = libwimaxll.la
lib_LIBRARIES = libwimaxll.a
libwimaxll_sources = \
genl.c \
+ misc.c \
op-open.c \
op-msg.c \
op-reset.c \
@@ -234,7 +238,15 @@ libwimaxll_la_CFLAGS = $(AM_CFLAGS)
# set to zero if removed existing interfaces
libwimaxll_la_LDFLAGS = -version-info 1:0:0 $(LIBNL1_LIBS)
libwimaxll_a_SOURCES = $(libwimaxll_sources)
-all: all-am
+BUILT_SOURCES = names-vals.h
+enum_names = \
+ wimax_st
+
+CLEANFILES = names-vals.h
+noinst_SCRIPTS = enum-to-names-vals
+EXTRA_DIST = $(noinst_SCRIPTS)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@@ -338,12 +350,14 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-genl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-misc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-op-msg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-op-open.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-op-reset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-op-rfkill.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-re-state-change.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwimaxll_la-wimax.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op-msg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op-open.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op-reset.Po@am__quote@
@@ -379,6 +393,13 @@ libwimaxll_la-genl.lo: genl.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwimaxll_la_CFLAGS) $(CFLAGS) -c -o libwimaxll_la-genl.lo `test -f 'genl.c' || echo '$(srcdir)/'`genl.c
+libwimaxll_la-misc.lo: misc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwimaxll_la_CFLAGS) $(CFLAGS) -MT libwimaxll_la-misc.lo -MD -MP -MF $(DEPDIR)/libwimaxll_la-misc.Tpo -c -o libwimaxll_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libwimaxll_la-misc.Tpo $(DEPDIR)/libwimaxll_la-misc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libwimaxll_la-misc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwimaxll_la_CFLAGS) $(CFLAGS) -c -o libwimaxll_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
+
libwimaxll_la-op-open.lo: op-open.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwimaxll_la_CFLAGS) $(CFLAGS) -MT libwimaxll_la-op-open.lo -MD -MP -MF $(DEPDIR)/libwimaxll_la-op-open.Tpo -c -o libwimaxll_la-op-open.lo `test -f 'op-open.c' || echo '$(srcdir)/'`op-open.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libwimaxll_la-op-open.Tpo $(DEPDIR)/libwimaxll_la-op-open.Plo
@@ -501,13 +522,15 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
-check: check-am
-all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(SCRIPTS) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@@ -524,6 +547,7 @@ install-strip:
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -531,6 +555,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean-am: clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \
@@ -607,6 +632,14 @@ uninstall-am: uninstall-libLIBRARIES uninstall-libLTLIBRARIES
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-libLIBRARIES uninstall-libLTLIBRARIES
+
+names-vals.h: @LINUX_INCLUDE_PATH@/linux/wimax.h enum-to-names-vals
+ rm -f $@
+ echo "#include <linux/wimax.h>" > $@
+ for type in $(enum_names); \
+ do \
+ $(srcdir)/enum-to-names-vals $$type $^; \
+ done >> $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/lib/enum-to-names-vals b/lib/enum-to-names-vals
new file mode 100755
index 0000000..9d27bd8
--- /dev/null
+++ b/lib/enum-to-names-vals
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+if [ $# = 0 ]
+then
+ cat 1>&2 <<EOF
+Usage: $(basename $0) ENUMPREFIX [FILES]
+EOF
+fi
+
+type="$1"
+shift
+
+cat <<EOF
+static
+const struct {
+ int value;
+ const char *name;
+} ${type}_names_vals[] = {
+EOF
+awk -vtype=$type -vtype_regex="^${type}_" ' \
+BEGIN { IGNORECASE = 1; } \
+$1 ~ type_regex { \
+ name=$1; \
+ symbol=$1; \
+ type_regex="^" type "_"; \
+ gsub(/,.*$/, "", symbol); \
+ gsub(type_regex, "", name); \
+ gsub(/,.*$/, "", name); \
+ gsub(/_/, "-", name); \
+ print "\t{ " symbol ", \"" tolower(name) "\" },"; \
+}' $@
+echo " { 0, NULL }"
+echo "};"
diff --git a/lib/misc.c b/lib/misc.c
new file mode 100644
index 0000000..dbbeac5
--- /dev/null
+++ b/lib/misc.c
@@ -0,0 +1,88 @@
+/*
+ * Linux WiMax
+ * Shared/common routines
+ *
+ *
+ * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
+ * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 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
+ * OWNER 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 USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * These are a set of facilities used by the implementation of the
+ * different ops in this library.
+ */
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <assert.h>
+#include <linux/types.h>
+#include <netlink/msg.h>
+#include <netlink/genl/genl.h>
+#include <wimaxll.h>
+#include "internal.h"
+#define D_LOCAL 0
+#include "debug.h"
+#include "names-vals.h"
+
+
+enum wimax_st wimaxll_state_by_name(const char *name)
+{
+ size_t itr, max = wimaxll_array_size(wimax_st_names_vals) - 1;
+
+ for (itr = 0; itr < max; itr++)
+ if (strcmp(wimax_st_names_vals[itr].name, name) == 0)
+ return wimax_st_names_vals[itr].value;
+ return __WIMAX_ST_INVALID;
+}
+
+
+const char * wimaxll_state_to_name(enum wimax_st st)
+{
+ size_t itr, max = wimaxll_array_size(wimax_st_names_vals) - 1;
+
+ for (itr = 0; itr < max; itr++)
+ if (wimax_st_names_vals[itr].value == st)
+ return wimax_st_names_vals[itr].name;
+ return NULL;
+}
+
+
+size_t wimaxll_states_snprintf(char *str, size_t size)
+{
+ size_t itr, max = wimaxll_array_size(wimax_st_names_vals) - 1;
+ size_t bytes = 0;
+
+ for (itr = 0; itr < max && bytes < size; itr++)
+ bytes += snprintf(str + bytes, size - bytes,
+ "%s ", wimax_st_names_vals[itr].name);
+ return bytes;
+}
diff --git a/src/Makefile.in b/src/Makefile.in
index a5589c2..31a9019 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -114,6 +114,7 @@ LIBNL1_LIBS = @LIBNL1_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LINUX_INCLUDE_PATH = @LINUX_INCLUDE_PATH@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@