summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/Makefile.am2
-rw-r--r--bin/Makefile.in17
-rw-r--r--bin/wimaxll-pl-state-get.c96
3 files changed, 112 insertions, 3 deletions
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 394bf62..9969c0e 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -34,6 +34,7 @@ plugindir = $(pkglibdir)/plugins
plugin_LTLIBRARIES = \
wimaxll-pl-reset.la \
wimaxll-pl-rfkill.la \
+ wimaxll-pl-state-get.la \
wimaxll-pl-wfsc.la
plugin_LDFLAGS = -no-undefined -module -avoid-version \
@@ -41,4 +42,5 @@ plugin_LDFLAGS = -no-undefined -module -avoid-version \
wimaxll_pl_reset_la_LDFLAGS = $(plugin_LDFLAGS)
wimaxll_pl_rfkill_la_LDFLAGS = $(plugin_LDFLAGS)
+wimaxll_pl_state_get_la_LDFLAGS = $(plugin_LDFLAGS)
wimaxll_pl_wfsc_la_LDFLAGS = $(plugin_LDFLAGS)
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 80db28a..cb0df0f 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -67,6 +67,12 @@ wimaxll_pl_rfkill_la_OBJECTS = wimaxll-pl-rfkill.lo
wimaxll_pl_rfkill_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(wimaxll_pl_rfkill_la_LDFLAGS) $(LDFLAGS) -o $@
+wimaxll_pl_state_get_la_LIBADD =
+wimaxll_pl_state_get_la_SOURCES = wimaxll-pl-state-get.c
+wimaxll_pl_state_get_la_OBJECTS = wimaxll-pl-state-get.lo
+wimaxll_pl_state_get_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(wimaxll_pl_state_get_la_LDFLAGS) $(LDFLAGS) -o $@
wimaxll_pl_wfsc_la_LIBADD =
wimaxll_pl_wfsc_la_SOURCES = wimaxll-pl-wfsc.c
wimaxll_pl_wfsc_la_OBJECTS = wimaxll-pl-wfsc.lo
@@ -96,10 +102,10 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = wimaxll-pl-reset.c wimaxll-pl-rfkill.c wimaxll-pl-wfsc.c \
- wimaxll.c
+SOURCES = wimaxll-pl-reset.c wimaxll-pl-rfkill.c \
+ wimaxll-pl-state-get.c wimaxll-pl-wfsc.c wimaxll.c
DIST_SOURCES = wimaxll-pl-reset.c wimaxll-pl-rfkill.c \
- wimaxll-pl-wfsc.c wimaxll.c
+ wimaxll-pl-state-get.c wimaxll-pl-wfsc.c wimaxll.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -242,6 +248,7 @@ plugindir = $(pkglibdir)/plugins
plugin_LTLIBRARIES = \
wimaxll-pl-reset.la \
wimaxll-pl-rfkill.la \
+ wimaxll-pl-state-get.la \
wimaxll-pl-wfsc.la
plugin_LDFLAGS = -no-undefined -module -avoid-version \
@@ -249,6 +256,7 @@ plugin_LDFLAGS = -no-undefined -module -avoid-version \
wimaxll_pl_reset_la_LDFLAGS = $(plugin_LDFLAGS)
wimaxll_pl_rfkill_la_LDFLAGS = $(plugin_LDFLAGS)
+wimaxll_pl_state_get_la_LDFLAGS = $(plugin_LDFLAGS)
wimaxll_pl_wfsc_la_LDFLAGS = $(plugin_LDFLAGS)
all: all-am
@@ -316,6 +324,8 @@ wimaxll-pl-reset.la: $(wimaxll_pl_reset_la_OBJECTS) $(wimaxll_pl_reset_la_DEPEND
$(wimaxll_pl_reset_la_LINK) -rpath $(plugindir) $(wimaxll_pl_reset_la_OBJECTS) $(wimaxll_pl_reset_la_LIBADD) $(LIBS)
wimaxll-pl-rfkill.la: $(wimaxll_pl_rfkill_la_OBJECTS) $(wimaxll_pl_rfkill_la_DEPENDENCIES)
$(wimaxll_pl_rfkill_la_LINK) -rpath $(plugindir) $(wimaxll_pl_rfkill_la_OBJECTS) $(wimaxll_pl_rfkill_la_LIBADD) $(LIBS)
+wimaxll-pl-state-get.la: $(wimaxll_pl_state_get_la_OBJECTS) $(wimaxll_pl_state_get_la_DEPENDENCIES)
+ $(wimaxll_pl_state_get_la_LINK) -rpath $(plugindir) $(wimaxll_pl_state_get_la_OBJECTS) $(wimaxll_pl_state_get_la_LIBADD) $(LIBS)
wimaxll-pl-wfsc.la: $(wimaxll_pl_wfsc_la_OBJECTS) $(wimaxll_pl_wfsc_la_DEPENDENCIES)
$(wimaxll_pl_wfsc_la_LINK) -rpath $(plugindir) $(wimaxll_pl_wfsc_la_OBJECTS) $(wimaxll_pl_wfsc_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@@ -377,6 +387,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wimaxll-pl-reset.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wimaxll-pl-rfkill.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wimaxll-pl-state-get.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wimaxll-pl-wfsc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wimaxll.Po@am__quote@
diff --git a/bin/wimaxll-pl-state-get.c b/bin/wimaxll-pl-state-get.c
new file mode 100644
index 0000000..c41d7e0
--- /dev/null
+++ b/bin/wimaxll-pl-state-get.c
@@ -0,0 +1,96 @@
+/*
+ * Linux WiMax
+ * Swiss-army WiMAX knife
+ *
+ *
+ * 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.
+ */
+#define _GNU_SOURCE
+#include <argp.h>
+#include <error.h>
+#include <wimaxll.h>
+#include <wimaxll/version.h>
+#include <wimaxll/cmd.h>
+
+
+static
+struct argp_option state_get_options[] = {
+ { 0 }
+};
+
+static
+int state_get_parser(int key, char *arg, struct argp_state *state)
+{
+ return ARGP_ERR_UNKNOWN;
+}
+
+static
+int state_get_fn(struct cmd *cmd, struct wimaxll_handle *wmx,
+ int argc, char **argv)
+{
+ int result;
+ result = argp_parse(&cmd->argp, argc, argv,
+ ARGP_IN_ORDER | ARGP_PARSE_ARGV0, 0, NULL);
+ if (result < 0)
+ goto error_argp_parse;
+ w_cmd_need_if(wmx);
+ result = wimaxll_state_get(wmx);
+ if (result >= 0)
+ w_print("%s\n", wimaxll_state_to_name(result));
+error_argp_parse:
+ return result;
+}
+
+static
+struct cmd state_get_cmd = {
+ .name = "state-get",
+ .argp = {
+ .options = state_get_options,
+ .parser = state_get_parser,
+ .args_doc = "",
+ .doc = "Gets a WiMAX device's state\n",
+ },
+ .fn = state_get_fn,
+};
+
+static
+int state_get_init(void)
+{
+ return w_cmd_register(&state_get_cmd);
+}
+
+static
+void state_get_exit(void)
+{
+ w_cmd_unregister(&state_get_cmd);
+}
+
+
+PLUGIN("state_get", WIMAXLL_VERSION, state_get_init, state_get_exit);