summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am3
-rw-r--r--include/Makefile.in413
-rw-r--r--include/wimax-version.h.in2
-rw-r--r--include/wimax.h50
-rw-r--r--include/wimaxll-version.h.in1
-rw-r--r--include/wimaxll.h606
6 files changed, 1075 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..48f13e1
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,3 @@
+include_HEADERS = \
+ wimaxll.h wimaxll-version.h \
+ wimax.h wimax-version.h
diff --git a/include/Makefile.in b/include/Makefile.in
new file mode 100644
index 0000000..81075d8
--- /dev/null
+++ b/include/Makefile.in
@@ -0,0 +1,413 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = include
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/wimax-version.h.in \
+ $(srcdir)/wimaxll-version.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/lib/config.h
+CONFIG_CLEAN_FILES = wimax-version.h wimaxll-version.h
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(includedir)"
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+I2400M_INCLUDES = @I2400M_INCLUDES@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBNL1_CFLAGS = @LIBNL1_CFLAGS@
+LIBNL1_LIBS = @LIBNL1_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+include_HEADERS = \
+ wimaxll.h wimaxll-version.h \
+ wimax.h wimax-version.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+wimax-version.h: $(top_builddir)/config.status $(srcdir)/wimax-version.h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+wimaxll-version.h: $(top_builddir)/config.status $(srcdir)/wimaxll-version.h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am \
+ install-includeHEADERS install-info install-info-am \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS
+
+# 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/include/wimax-version.h.in b/include/wimax-version.h.in
new file mode 100644
index 0000000..aa19456
--- /dev/null
+++ b/include/wimax-version.h.in
@@ -0,0 +1,2 @@
+#warning DEPRECATED: this file is deprecated, use wimaxll-version.h
+#define WIMAX_VERSION "@PACKAGE_VERSION@"
diff --git a/include/wimax.h b/include/wimax.h
new file mode 100644
index 0000000..1533a18
--- /dev/null
+++ b/include/wimax.h
@@ -0,0 +1,50 @@
+#ifndef __lib_wimax_h__
+#define __lib_wimax_h__
+#warning DEPRECATED: this file is deprecated, use wimaxll.h
+#include <wimaxll.h>
+
+#define wimax_handle wimaxll_handle
+#define wimax_gnl_cb_context wimaxll_gnl_cb_context
+#define wimax_msg_to_user_cb_f wimaxll_msg_to_user_cb_f
+#define wimax_state_change_cb_f wimaxll_state_change_cb_f
+#define WIMAX_GNL_CB_CONTEXT_INIT(a) WIMAXLL_GNL_CB_CONTEXT_INIT(a)
+#define wimax_gnl_cb_context_init(a, b) wimaxll_gnl_cb_context_init(a, b)
+#define wimax_cb_context_set_result(a, b) wimaxll_cb_context_set_result(a, b)
+
+#define wimax_open(a) wimaxll_open(a)
+#define wimax_close(a) wimaxll_close(a)
+#define wimax_ifname(a) wimaxll_ifname(a)
+
+#define wimax_mc_rx_open(a, b) wimaxll_mc_rx_open(a, b)
+#define wimax_mc_rx_fd(a, b) wimaxll_mc_rx_fd(a, b)
+#define wimax_mc_rx_close(a, b) wimaxll_mc_rx_close(a, b)
+#define wimax_mc_rx_read(a, b) wimaxll_mc_rx_read(a, b)
+
+#define wimax_pipe_open(a, b) wimaxll_pipe_open(a, b)
+#define wimax_pipe_fd(a, b) wimaxll_pipe_fd(a, b)
+#define wimax_pipe_read(a, b) wimaxll_pipe_read(a, b)
+#define wimax_pipe_close(a, b) wimaxll_pipe_close(a, b)
+
+#define wimax_pipe_msg_read(a, b, c) wimaxll_pipe_msg_read(a, b, c)
+#define wimax_pipe_msg_free(a) wimaxll_pipe_msg_free(a)
+#define wimax_pipe_get_cb_msg_to_user(a, b, c, d) wimaxll_pipe_get_cb_msg_to_user(a, b, c, d)
+#define wimax_pipe_set_cb_msg_to_user(a, b, c, d) wimaxll_pipe_set_cb_msg_to_user(a, b, c, d)
+#define wimax_msg_fd(a) wimaxll_msg_fd(a)
+#define wimax_msg_read(a, b) wimaxll_msg_read(a, b)
+#define wimax_msg_write(a, b, c) wimaxll_msg_write(a, b, c)
+#define wimax_msg_free(a) wimaxll_msg_free(a)
+#define wimax_msg_pipe_id(a) wimaxll_msg_pipe_id(a)
+#define wimax_rfkill(a, b) wimaxll_rfkill(a, b)
+#define wimax_reset(a) wimaxll_reset(a)
+#define wimax_get_cb_state_change(a, b, c) wimaxll_get_cb_state_change(a, b, c)
+#define wimax_set_cb_state_change(a, b, c) wimaxll_set_cb_state_change(a, b, c)
+#define wimax_wait_for_state_change(a, b, c) wimaxll_wait_for_state_change(a, b, c)
+
+#define wimax_swap_16(a) wimaxll_swap_16(a)
+#define wimax_swap_32(a) wimaxll_swap_32(a)
+#define wimax_cpu_to_le16(a) wimaxll_cpu_to_le16(a)
+#define wimax_le16_to_cpu(a) wimaxll_le16_to_cpu(a)
+#define wimax_cpu_to_le32(a) wimaxll_cpu_to_le32(a)
+#define wimax_le32_to_cpu(a) wimaxll_le32_to_cpu(a)
+
+#endif /* #ifndef __lib_wimax_h__ */
diff --git a/include/wimaxll-version.h.in b/include/wimaxll-version.h.in
new file mode 100644
index 0000000..b789fff
--- /dev/null
+++ b/include/wimaxll-version.h.in
@@ -0,0 +1 @@
+#define WIMAXLL_VERSION "@PACKAGE_VERSION@"
diff --git a/include/wimaxll.h b/include/wimaxll.h
new file mode 100644
index 0000000..3632542
--- /dev/null
+++ b/include/wimaxll.h
@@ -0,0 +1,606 @@
+/*
+ * Linux WiMax
+ * User Space API
+ *
+ *
+ * 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.
+ *
+ *
+ *
+ */
+/**
+ * @mainpage
+ *
+ * This is a simple library to control WiMAX devices through the
+ * control API exported by the Linux kernel WiMAX Stack. It provides
+ * means to execute functions exported by the stack and to receive its
+ * notifications.
+ *
+ * Because of this, this is a callback oriented library. It is
+ * designed to be operated asynchronously and/or in an event loop. For
+ * the very simple cases, helpers that implement synchronous
+ * functionality are available.
+ *
+ * This library is provided as a convenience and using it is not
+ * required to talk to the WiMAX kernel stack. It is possible to do so
+ * by interacting with it over generic netlink.
+ *
+ * \note this is a very low level library. It does not provide the
+ * caller with means to scan, connect, disconnect, etc from a WiMAX
+ * network. Said capability is provided by higher level services which
+ * might be users of this library.
+ *
+ * @section conventions Conventions
+ *
+ * Most function calls return an integer with a negative \a errno
+ * error code when there is an error.
+ *
+ * @section general_usage General usage
+ *
+ * The first operation to start controlling a WiMAX device is to open
+ * a handle for it:
+ *
+ * @code
+ * struct wimaxll_handle *wmx = wimaxll_open("wmx0");
+ * @endcode
+ *
+ * With an open handle you can execute all the WiMax API
+ * operations. When done with the handle, it has to be closed:
+ *
+ * @code
+ * wimaxll_close(wmx);
+ * @endcode
+ *
+ * If the device is unloaded/disconnected, the handle will be marked
+ * as invalid and any operation will fail with -ENODEV.
+ *
+ * To reset a WiMAX device, use:
+ *
+ * @code
+ * wimaxll_reset(wmx);
+ * @endcode
+ *
+ * To turn a device \e on or \e off, or to query it's status, use:
+ *
+ * @code
+ * wimaxll_rfkill(wmx, WIMAX_RF_ON);
+ * @endcode
+ *
+ * WIMAX_RF_ON and WIMAX_RF_OFF turn the radio on and off
+ * respectively, using the software switch and return the current
+ * status of both switches. WIMAX_RF_QUERY just returns the status of
+ * both the \e HW and \e SW switches.
+ *
+ * See \ref device_management "device management" for more information.
+ *
+ * \section receiving Receiving notifications from the WiMAX kernel stack
+ *
+ * The WiMAX kernel stack will broadcast notifications and
+ * driver-specific messages to all the user space clients connected to
+ * it over the default \e message \e pipe.
+ *
+ * Different drivers might implement pipes other then default pipe to
+ * which applications can listen to. For more information, see \ref
+ * the_messaging_interface "the messaging interface".
+ *
+ * To listen to said notifications, a library client needs to block
+ * waiting for them or set \ref callbacks "callbacks" and integrate into
+ * some kind of main loop using \e select() to detect notifications
+ * ready from the kernel.
+ *
+ * Simple example of mainloop integration:
+ *
+ * @code
+ * int fd = wimaxll_msg_fd(wmx);
+ * fd_set pipe_fds, read_fds;
+ * ...
+ * // Main loop
+ * FD_ZERO(&pipe_fds);
+ * FD_SET(fd, &pipe_fds);
+ * while(1) {
+ * read_fds = pipe_fds;
+ * select(FD_SETSIZE, &read_fds, NULL, NULL, NULL);
+ * if (FD_ISSET(fd, &read_fds))
+ * wimaxll_pipe_read(wmx, wimax_msg_pipe_id(wmx));
+ * }
+ * @endcode
+ *
+ * This code will call wimaxll_pipe_read() on the default \e message
+ * \e pipe when notifications are available for delivery. Calling said
+ * function will execute, for each notification, the callback
+ * associated to it.
+ *
+ * To wait for a \e state \e change notification, for example:
+ *
+ * @code
+ * result = wimaxll_wait_for_state_change(wmx, &old_state, &new_state);
+ * @endcode
+ *
+ * The same thing can be accomplished setting a callback for a state
+ * change notification with wimaxll_set_cb_state_change() and then
+ * waiting on a main loop. See \ref state_change_group "state changes"
+ * for more information.
+ *
+ * To wait for a (device-specific) message from the driver on the
+ * default \e message pipe, an application would use:
+ *
+ * @code
+ * void *msg;
+ * ...
+ *
+ * size = wimaxll_msg_read(wmx, &msg);
+ *
+ * ... <act on the message>
+ *
+ * wimaxll_msg_free(msg); // done with the message
+ * @endcode
+ *
+ * \e msg points to a buffer which contains the message payload as
+ * sent by the driver. When done with \a msg it has to be freed with
+ * wimaxll_msg_free().
+ *
+ * As with \e state \e change notifications, a callback can be set
+ * that will be executed from a mainloop every time a message is
+ * received from a message pipe. See
+ * wimaxll_pipe_set_cb_msg_to_user().
+ *
+ * A message can be sent to the driver over the default \e message
+ * pipe with wimaxll_msg_write(). Note you cannot send messages to the
+ * driver over other pipes that are not the default \e message pipe.
+ *
+ * For more details, see \ref the_messaging_interface.
+ *
+ * @section miscellaneous Miscellaneous
+ *
+ * @subsection diagnostics Controlling the ouput of diagnostics
+ *
+ * \e libwimaxll will output messages by default to \a stderr. See
+ * \ref diagnostics_group for changing the default destination.
+ *
+ * @subsection bytesex Endianess conversion
+ *
+ * The following convenience helpers are provided for endianess
+ * conversion:
+ *
+ * - wimaxll_le32_to_cpu() and wimaxll_cpu_to_le32()
+ * - wimaxll_le16_to_cpu() and wimaxll_cpu_to_le16()
+ * - wimaxll_swap_16() and wimaxll_swap_32()
+ *
+ * @section multithreading Multithreading
+ *
+ * This library is not threaded or locked. The maximum level of
+ * paralellism you can do with one handle is:
+ *
+ * - Functions that can't be executed in parallel when using the same
+ * handle (need to be serialized):
+ * <ul>
+ * <li> wimaxll_msg_write()
+ * <li> wimaxll_rfkill()
+ * <li> wimaxll_pipe_open(), wimaxll_pipe_msg_read(),
+ * wimaxll_pipe_msg_free(), wimaxll_pipe_close()
+ * <li> wimaxll_mc_rx_open(), wimaxll_mc_rx_close(), wimaxll_mc_rx_read()
+ * <li> wimaxll_reset()
+ * </ul>
+ *
+ * - wimaxll_msg_read(), wimaxll_pipe_msg_read() and wimaxll_mc_rx_read()
+ * can be run in parallel with other functions, except with
+ * themselves.
+ *
+ * - callbacks are all executed serially; don't call any pipe
+ * management function from inside a callback.
+ *
+ * - \a wimaxll_swap_*() and \a wimaxll_*cpu*() can all be parallelized.
+ */
+
+
+#ifndef __lib_wimaxll_h__
+#define __lib_wimaxll_h__
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <endian.h>
+#include <byteswap.h>
+#include <stdarg.h>
+#include <linux/wimax.h>
+
+/**
+ * A WiMax control pipe handle
+ *
+ * This type is opaque to the user
+ */
+struct wimaxll_handle;
+
+struct wimaxll_gnl_cb_context;
+struct nlattr;
+
+
+/**
+ * \defgroup callbacks Callbacks
+ *
+ * When notification callbacks are being executed, the processing of
+ * notifications from the kernel is effectively blocked by it. Care
+ * must be taken not to call blocking functions, especially
+ * wimaxll_pipe_read().
+ *
+ * Callbacks are always passed a pointer to a private context as set
+ * by the application. The context is always of type struct
+ * wimaxll_gnl_cb_context and is meant to be used wrapped in an
+ * application-specific structure where private information can be
+ * stored.
+ *
+ * When an application specific context is created, the
+ * wimaxll_gnl_cb_context part of it should be initialized (with
+ * WIMAXLL_GNL_CB_CONTEXT_INIT() or
+ * wimaxll_gnl_cb_context_init()). Callback functions can safely
+ * update it's \e result field with wimaxll_cb_context_set_result().
+ */
+
+/**
+ * Callback for a \e message \e to \e user generic netlink message
+ *
+ * A \e driver \e specific message has been received from the kernel;
+ * the pointer to the data and the size are passed in \a data and \a
+ * size. The callback can access that data, but it's lifetime is valid
+ * only while the callback is executing. If it will be accessed later,
+ * it has to be copied to a safe location.
+ *
+ * \note See \ref callbacks callbacks for a set of warnings and
+ * guidelines for using callbacks.
+ *
+ * \param wmx WiMAX device handle
+ * \param ctx Context passed by the user with
+ * wimaxll_pipe_set_cb_msg_to_user().
+ * \param data Pointer to a buffer with the message data.
+ * \param size Size of the buffer
+ * \return 0 if it is ok to keep processing messages, -EBUSY if
+ * message processing should stop and control be returned to the
+ * caller.
+ *
+ * \ingroup the_messaging_interface
+ */
+typedef int (*wimaxll_msg_to_user_cb_f)(struct wimaxll_handle *wmx,
+ struct wimaxll_gnl_cb_context *ctx,
+ const char *data, size_t size);
+
+/**
+ * Callback for a \e state \e change notification from the WiMAX
+ * kernel stack.
+ *
+ * The WiMAX device has changed state from \a old_state to \a
+ * new_state.
+ *
+ * \note See \ref callbacks callbacks for a set of warnings and
+ * guidelines for using callbacks.
+ *
+ * \param wmx WiMAX device handle
+ * \param ctx Context passed by the user with
+ * wimaxll_set_cb_state_change(). This is a pointer to a standard
+ * context structure than can be wrapped in application-specific
+ * ones.
+ * \param old_state State the WiMAX device left
+ * \param new_state State the WiMAX device entered
+ * \return 0 if it is ok to keep processing messages, -EBUSY if
+ * message processing should stop and control be returned to the
+ * caller.
+ *
+ * \ingroup state_change_group
+ */
+typedef int (*wimaxll_state_change_cb_f)(
+ struct wimaxll_handle *, struct wimaxll_gnl_cb_context *,
+ enum wimax_st old_state, enum wimax_st new_state);
+
+
+/**
+ * General structure for storing callback context
+ *
+ * Callbacks set by the user receive a user-set pointer to a context
+ * structure. The user can wrap this struct in a bigger context struct
+ * and use wimaxll_container_of() during the callback to obtain its
+ * pointer.
+ *
+ * Usage:
+ *
+ * \code
+ * ...
+ * struct wimaxll_handle *wmx;
+ * ...
+ * struct my_context {
+ * struct wimaxll_gnl_cb_context ctx;
+ * <my data>
+ * } my_ctx = {
+ * .ctx = WIMAXLL_GNL_CB_CONTEXT_INIT(wmx),
+ * <my data initialization>
+ * };
+ * ...
+ * wimaxll_set_cb_SOMECALLBACK(wmx, my_callback, &my_ctx.ctx);
+ * ...
+ * result = wimaxll_pipe_read(wmx);
+ * ...
+ *
+ * // When my_callback() is called
+ * my_callback(wmx, ctx, ...)
+ * {
+ * struct my_context *my_ctx = wimaxll_container_of(
+ * ctx, struct my_callback, ctx);
+ * ...
+ * // do stuff with my_ctx
+ * }
+ * \endcode
+ *
+ * \param wmx WiMAX handle this context refers to (for usage by the
+ * callback).
+ * \param result Result of the handling of the message. For usage by
+ * the callback. Should not be set to -EINPROGRESS, as this will
+ * be interpreted by the message handler as no processing was done
+ * on the message.
+ *
+ * \ingroup callbacks
+ */
+struct wimaxll_gnl_cb_context {
+ struct wimaxll_handle *wmx;
+ ssize_t result;
+};
+
+
+/**
+ * Initialize a definition of struct wimaxll_gnl_cb_context
+ *
+ * \param _wmx pointer to the WiMAX device handle this will be
+ * associated to
+ *
+ * Use as:
+ *
+ * \code
+ * struct wimaxll_handle *wmx;
+ * ...
+ * struct wimaxll_gnl_cb_context my_context = WIMAXLL_GNL_CB_CONTEXT_INIT(wmx);
+ * \endcode
+ *
+ * \ingroup callbacks
+ */
+#define WIMAXLL_GNL_CB_CONTEXT_INIT(_wmx) { \
+ .wmx = (_wmx), \
+ .result = -EINPROGRESS, \
+}
+
+
+static inline // ugly workaround for doxygen
+/**
+ * Initialize a struct wimaxll_gnl_cb_context
+ *
+ * \param ctx Pointer to the struct wimaxll_gnl_cb_context.
+ * \param wmx pointer to the WiMAX device handle this will be
+ * associated to
+ *
+ * Use as:
+ *
+ * \code
+ * struct wimaxll_handle *wmx;
+ * ...
+ * struct wimaxll_gnl_cb_context my_context;
+ * ...
+ * wimaxll_gnl_cb_context(&my_context, wmx);
+ * \endcode
+ *
+ * \ingroup callbacks
+ * \fn static void wimaxll_gnl_cb_context_init(struct wimaxll_gnl_cb_context *ctx, struct wimaxll_handle *wmx)
+ */
+void wimaxll_gnl_cb_context_init(struct wimaxll_gnl_cb_context *ctx,
+ struct wimaxll_handle *wmx)
+{
+ ctx->wmx = wmx;
+ ctx->result = -EINPROGRESS;
+}
+
+
+static inline // ugly workaround for doxygen
+/**
+ * Set the result value in a callback context
+ *
+ * \param ctx Context where to set -- if NULL, no action will be taken
+ * \param val value to set for \a result
+ *
+ * \ingroup callbacks
+ * \fn static void wimaxll_cb_context_set_result(struct wimaxll_gnl_cb_context *ctx, int val)
+ */
+void wimaxll_cb_context_set_result(struct wimaxll_gnl_cb_context *ctx, int val)
+{
+ if (ctx != NULL && ctx->result == -EINPROGRESS)
+ ctx->result = val;
+}
+
+
+/* Basic handle management */
+struct wimaxll_handle *wimaxll_open(const char *device_name);
+void wimaxll_close(struct wimaxll_handle *);
+const char *wimaxll_ifname(const struct wimaxll_handle *);
+
+/* Very low level handling of pipes for reading generic netlink
+ * messages from the kernel */
+int wimaxll_mc_rx_open(struct wimaxll_handle *, const char *);
+int wimaxll_mc_rx_fd(struct wimaxll_handle *, unsigned);
+void wimaxll_mc_rx_close(struct wimaxll_handle *, unsigned);
+ssize_t wimaxll_mc_rx_read(struct wimaxll_handle *, unsigned);
+
+/* Handling of pipes for generic netlink messages from the kernel */
+int wimaxll_pipe_open(struct wimaxll_handle *, const char *);
+int wimaxll_pipe_fd(struct wimaxll_handle *, unsigned);
+ssize_t wimaxll_pipe_read(struct wimaxll_handle *, unsigned pipe_id);
+void wimaxll_pipe_close(struct wimaxll_handle *, unsigned);
+
+/* driver-user messaging interface for all the pipes */
+ssize_t wimaxll_pipe_msg_read(struct wimaxll_handle *, unsigned, void **);
+void wimaxll_pipe_msg_free(void *);
+void wimaxll_pipe_get_cb_msg_to_user(struct wimaxll_handle *, unsigned pipe_id,
+ wimaxll_msg_to_user_cb_f *,
+ struct wimaxll_gnl_cb_context **);
+void wimaxll_pipe_set_cb_msg_to_user(struct wimaxll_handle *, unsigned pipe_id,
+ wimaxll_msg_to_user_cb_f,
+ struct wimaxll_gnl_cb_context *);
+
+/* Default (bidirectional) message pipe from the kernel */
+int wimaxll_msg_fd(struct wimaxll_handle *);
+ssize_t wimaxll_msg_read(struct wimaxll_handle *, void **);
+ssize_t wimaxll_msg_write(struct wimaxll_handle *, const void *, size_t);
+void wimaxll_msg_free(void *);
+unsigned wimaxll_msg_pipe_id(struct wimaxll_handle *);
+
+/* generic API */
+int wimaxll_rfkill(struct wimaxll_handle *, enum wimax_rf_state);
+int wimaxll_reset(struct wimaxll_handle *);
+
+void wimaxll_get_cb_state_change(
+ struct wimaxll_handle *, wimaxll_state_change_cb_f *,
+ struct wimaxll_gnl_cb_context **);
+void wimaxll_set_cb_state_change(
+ struct wimaxll_handle *, wimaxll_state_change_cb_f,
+ struct wimaxll_gnl_cb_context *);
+ssize_t wimaxll_wait_for_state_change(struct wimaxll_handle *wmx,
+ enum wimax_st *old_state,
+ enum wimax_st *new_state);
+
+
+/**
+ * \defgroup miscellaneous_group Miscellaneous utilities
+ */
+extern void (*wimaxll_vmsg)(const char *, va_list);
+void wimaxll_vmsg_stderr(const char *, va_list);
+
+
+static inline // ugly hack for doxygen
+/**
+ *
+ * Swap the nibbles in a 16 bit number.
+ *
+ * \ingroup miscellaneous_group
+ * \fn unsigned short wimaxll_swap_16(unsigned short x)
+ */
+unsigned short wimaxll_swap_16(unsigned short x)
+{
+ return bswap_16(x);
+}
+
+
+static inline // ugly hack for doxygen
+/**
+ * Swap the nibbles in a 32 bit number.
+ *
+ * \ingroup miscellaneous_group
+ * \fn unsigned long wimaxll_swap_32(unsigned long x)
+ */
+unsigned long wimaxll_swap_32(unsigned long x)
+{
+ return bswap_32(x);
+}
+
+
+static inline // ugly hack for doxygen
+/**
+ * Convert a little-endian 16 bits to cpu order.
+ *
+ * \ingroup miscellaneous_group
+ * \fn unsigned short wimaxll_cpu_to_le16(unsigned short x)
+ */
+unsigned short wimaxll_cpu_to_le16(unsigned short x)
+{
+ unsigned short le16;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ le16 = x;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ le16 = wimaxll_swap_16(x);
+#else
+#error ERROR: unknown byte sex - FIXME
+#endif
+ return le16;
+}
+
+
+static inline // ugly hack for doxygen
+/**
+ * Convert a cpu-order 16 bits to little endian.
+ *
+ * \ingroup miscellaneous_group
+ * \fn unsigned short wimaxll_le16_to_cpu(unsigned short le16)
+ */
+unsigned short wimaxll_le16_to_cpu(unsigned short le16)
+{
+ unsigned short cpu;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ cpu = le16;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ cpu = wimaxll_swap_16(le16);
+#else
+#error ERROR: unknown byte sex - FIXME
+#endif
+ return cpu;
+}
+
+
+static inline // ugly hack for doxygen
+/**
+ * Convert a little-endian 32 bits to cpu order.
+ *
+ * \ingroup miscellaneous_group
+ * \fn unsigned long wimaxll_cpu_to_le32(unsigned long x)
+ */
+unsigned long wimaxll_cpu_to_le32(unsigned long x)
+{
+ unsigned long le32;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ le32 = x;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ le32 = wimaxll_swap_32(x);
+#else
+#error ERROR: unknown byte sex - FIXME
+#endif
+ return le32;
+}
+
+
+static inline // ugly hack for doxygen
+/**
+ * Convert a cpu-order 32 bits to little endian.
+ *
+ * \ingroup miscellaneous_group
+ * \fn unsigned long wimaxll_le32_to_cpu(unsigned long le32)
+ */
+unsigned long wimaxll_le32_to_cpu(unsigned long le32)
+{
+ unsigned long cpu;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ cpu = le32;
+#elif __BYTE_ORDER == __BIG_ENDIAN
+ cpu = wimaxll_swap_32(le32);
+#else
+#error ERROR: unknown byte sex - FIXME
+#endif
+ return cpu;
+}
+
+#endif /* #ifndef __lib_wimaxll_h__ */