about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-07-06 21:42:01 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-07-06 21:42:01 +0000
commit330f54ac7f780872223f9cac62347393ffb4ef86 (patch)
tree1de817bd4b556e487b93884ac21561e1e5779635 /doc
downloadbcnm-330f54ac7f780872223f9cac62347393ffb4ef86.tar.gz
bcnm-330f54ac7f780872223f9cac62347393ffb4ef86.tar.xz
bcnm-330f54ac7f780872223f9cac62347393ffb4ef86.zip
Initial commit
Diffstat (limited to 'doc')
-rw-r--r--doc/index.html110
-rw-r--r--doc/libwpactrl/index.html233
-rw-r--r--doc/quickstart.html33
-rw-r--r--doc/upgrade.html28
4 files changed, 404 insertions, 0 deletions
diff --git a/doc/index.html b/doc/index.html
new file mode 100644
index 0000000..ae475e1
--- /dev/null
+++ b/doc/index.html
@@ -0,0 +1,110 @@
+<html>
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>bcnm - a better client network manager </title>
+    <meta name="Description" content="bcnm - a better client network manager" />
+    <meta name="Keywords" content="bcnm client network manager ethernet wifi laurent bercot ska skarnet networkmanager wicd connman wpa_supplicant" />
+    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+  </head>
+<body>
+
+<p>
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> bcnm </h1>
+
+<h2> What is it&nbsp;? </h2>
+
+<p>
+ bcnm is a client network manager: it automatically handles network
+connections for a client machine. It supports Ethernet and Wi-Fi.
+IP addresses can be attributed statically or via DHCP.
+</p>
+
+<p>
+<strong>
+ This is very much a work in progress. Do not expect full functionality
+in the short or even middle term.
+</strong>
+</p>
+
+<hr />
+
+<h2> Installation </h2>
+
+<h3> Requirements </h3>
+
+<ul>
+ <li> A Linux-based system with a standard C development environment </li>
+ <li> GNU make, version 3.81 or later </li>
+ <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
+2.5.1.1 or later </li>
+</ul>
+
+<h3> Licensing </h3>
+
+<p>
+ bcnm is free software. It is available under the
+<a href="http://opensource.org/licenses/ISC">ISC license</a>.
+</p>
+
+<h3> Download </h3>
+
+<ul>
+ <li> The current released version of bcnm is
+<a href="bcnm-0.0.1.0.tar.gz">0.0.1.0</a>. </li>
+ <li> Alternatively, you can checkout a copy of the
+<a href="//git.skarnet.org/cgi-bin/cgit.cgi/bcnm/">bcnm
+git repository</a>:
+<pre> git clone git://git.skarnet.org/bcnm </pre> </li>
+ <li> There's also a
+<a href="https://github.com/skarnet/bcnm">GitHub mirror</a>
+of the bcnm git repository. </li>
+</ul>
+
+<h3> Compilation </h3>
+
+<ul>
+ <li> See the enclosed INSTALL file for installation details. </li>
+</ul>
+
+<h3> Upgrade notes </h3>
+
+<ul>
+ <li> <a href="upgrade.html">This page</a> lists the differences to be aware of between
+the previous versions of bcnm and the current one. </li>
+</ul>
+
+<hr />
+
+<h2> Reference </h2>
+
+<h3> Commands </h3>
+
+<p>
+ All these commands exit 111 if they encounter a temporary error, and
+100 if they encounter a permanent error - such as a misuse.
+</p>
+
+<ul>
+</ul>
+
+<h3> Libraries </h3>
+
+<ul>
+ <li> <a href="libwpactrl/">The <tt>wpactrl</tt> library interface</a> </li>
+</ul>
+
+<h2> Related resources </h2>
+
+<ul>
+ <li> <tt>bcnm</tt> is discussed on the
+<a href="//skarnet.org/lists.html#skaware">skaware</a> mailing-list. </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/libwpactrl/index.html b/doc/libwpactrl/index.html
new file mode 100644
index 0000000..845cc7b
--- /dev/null
+++ b/doc/libwpactrl/index.html
@@ -0,0 +1,233 @@
+<html>
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>bcnm: the wpactrl library interface</title
+    <meta name="Description" content="bcnm: the wpactrl library interface" />
+    <meta name="Keywords" content="bcnm library wpactrl libwpactrl wpactrl.h wpa_supplicant command" />
+    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+  </head>
+<body>
+
+<p>
+<a href="../index.html">bcn,</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>wpactrl</tt> library interface </h1>
+
+<p>
+<tt>wpactrl</tt> is a library designed to interface a client
+with the <a href="https://w1.fi/wpa_supplicant/">wpa_supplicant</a>
+program, in a smaller, cleaner, more user-friendly and more
+packager-friendly way than the <tt>wpa_ctrl</tt> interface that
+comes with the <a href="https://w1.fi/wpa_supplicant/">wpa_supplicant</a>
+distribution.
+</p>
+
+<h2> Compiling </h2>
+
+<ul>
+ <li> Use <tt>#include &lt;bcnm/wpactrl.h&gt;</tt> </li>
+</ul>
+
+<h2> Linking </h2>
+
+<ul>
+ <li> Make sure the bcnm libraries, as well as the skalibs
+libraries, are visible in your library search path. </li>
+ <li> Link against <tt>-lwpactrl</tt> and <tt>-lskarnet</tt>.
+Also add <tt>`cat $sysdeps/socket.lib $sysdeps/tainnow.lib`</tt>
+to the end of your command line invoking the linker, in order
+to be portable to libcs that put socket or time functions into
+separate libraries.
+(<tt>$sysdeps</tt> stands for your skalibs sysdeps directory.) </li>
+</ul>
+
+
+<h2> Programming </h2>
+
+<p>
+ The <tt>bcnm/wpactrl.h</tt> header is the reference for the exact
+function prototypes.
+</p>
+
+<h3> General usage </h3>
+
+<p>
+ <tt>libwpactrl</tt> stores its information in a <tt>wpactrl_t</tt> structure.
+Such a structure must be allocated (can be declared in the stack) and
+initialized to WPACTRL_ZERO before use. The address of that <tt>wpactrl_t</tt>
+structure is then used as a handle and given as an argument to all the
+<tt>wpactrl_*</tt> function calls.
+</p>
+
+<h3> Connections </h3>
+
+<p>
+ A <tt>wpactrl_t</tt> instance represents two connections to a <tt>wpa_supplicant</tt>
+program: an <em>attached</em> one and a <em>detached</em> one. For proper operation,
+it is important to regularly read the data from the <em>attached</em> connection. This is
+achieved by calling the <tt>wpactrl_update()</tt> function whenever data is available
+on the <em>attached</em> connection; this is notified by the connection's fd becoming
+readable. The attached connection's fd can be obtained via the <tt>wpactrl_fd()</tt>
+function. So, proper usage of a <tt>wpactrl_t</tt> instance involves an asynchronous
+event loop.
+</p>
+
+<h3> Synchronous functions </h3>
+
+<p>
+ The bulk of <tt>libwpactrl</tt> functions take two extra arguments at the end, named
+<em>deadline</em> and <em>stamp</em>, of type
+<a href="//skarnet.org/software/skalibs/libstddjb/tai.html">tain_t</a>. This means
+they are synchronous function calls, and the extra arguments are there to ensure
+those calls do not block forever.
+</p>
+
+<p>
+<em>deadline</em> is an absolute date: if the function has not returned when this
+date is reached, it will immediately return with a code meaning "failure" and
+<tt>errno</tt> set to ETIMEDOUT. <em>stamp</em> must be first initialized to an
+accurate enough approximation of the current time, for instance via skalibs'
+<tt>tain_now()</tt> function; it will then be automatically updated by the
+libwpactrl function calls to always contain (an accurate enough approximation
+of) the current time.
+</p>
+
+<p>
+ <a href="//skarnet.org/software/skalibs/">skalibs</a> can keep track of the
+timestamp for you, in the global <tt>STAMP</tt> variable. All <tt>libwpactrl</tt>
+functions taking <em>deadline</em> and <em>stamp</em> arguments also have a
+version with a name ending in <tt>_g</tt>, that only takes a <tt>deadline</tt>
+argument, and assumes the <tt>STAMP</tt> variable always contains (an accurate
+enough approximation of) the current time.
+<p>
+
+<p>
+ Those synchronous function calls normally return almost instantly: there should
+be no blocking code path between the function call and its return. Nevertheless,
+since they involve communication with a complex <tt>wpa_supplicant</tt> process,
+it's impossible to guarantee that they will never block, so the deadline pattern
+is there to set a cap on the amount of time they block. A deadline set a few
+seconds into the future should be enough.
+</p>
+
+
+<h3> Starting and stopping a session </h3>
+
+<p>
+<code> int wpactrl_start (wpactrl_t *a, char const *path, tain_t const *deadline, tain_t *stamp) </code> <br />
+Starts a session with a <tt>wpa_supplicant</tt> instance listening on a Unix socket
+at <em>path</em>.
+The function returns 1 if it succeeds, or 0 (and sets errno) if
+it fails.
+</p>
+
+<p>
+<code> int wpactrl_end (wpactrl_t *a) </code> <br />
+Ends the session, freeing all used resources.
+</p>
+
+<h3> Low-level command sending </h3>
+
+<p>
+<code> ssize_t wpactrl_query (wpactrl_t *a, char const *q, size_t qlen, char *ans, size_t anslen, tain_t const *deadline, tain_t *stamp) </code> <br />
+Sends the query <em>q</em> of size <em>qlen</em> to the connected instance
+of wpa_supplicant, and reads its answer into the buffer pointed to by
+<em>ans</em>. Returns -1 in case of failure, or the number of bytes of
+the answer in case of success. Returns -1 with errno set to EMSGSIZE if
+the answer is bigger than <em>anslen</em> bytes.
+</p>
+
+<p>
+<code> ssize_t wpactrl_querysa (wpactrl_t *a, char const *q, size_t qlen, stralloc *sa, tain_t const *deadline, tain_t *stamp) </code> <br />
+Sends the query <em>q</em> of size <em>qlen</em> to the connected instance
+of wpa_supplicant, and reads its answer into the
+<a href="//skarnet.org/software/skalibs/libstddjb/stralloc.html">stralloc</a>
+pointed to by <em>sa</em>. Returns 1 if it succeeds and 0 if it fails.
+</p>
+
+<p>
+<code> wparesponse_t wpactrl_command (wpactrl_t *a, char const *q, size_t qlen, tain_t const *deadline, tain_t *stamp) </code> <br />
+Sends the command <em>q</em> of size <em>qlen</em> to the connected instance
+of wpa_supplicant, and returns its answer under the form of a
+<tt>wparesponse_t</tt>, which is an enumeration defined in the
+<tt>bcnm/wpactrl.h</tt> header. This function is meant to be used
+with commands returning a well-known value, such as <tt>RECONFIGURE</tt>
+(returning <tt>OK</tt> or <tt>FAIL</tt>) or <tt>PING</tt>
+(returning <tt>PONG</tt>).
+</p>
+
+<h3> Reading from the attached connection </h3>
+
+<p>
+<code> int wpactrl_update (wpactrl_t *a) </code> <br />
+Reads unsolicited messages from wpa_supplicant. If the messages
+are whitelisted, it keeps them, otherwise it discards them.
+The function returns the number of messages that have been read,
+or -1 in case of failure. A positive number does not mean that
+all pending messages have been read: there is a cap on the
+number of messages that can be consecutively read, to prevent
+a spamming wpa_supplicant from monopolizing your program.
+</p>
+
+<p>
+<code> char *wpactrl_data (wpactrl_t *a) </code> <br />
+Returns a pointer to the unsolicited messages from wpa_supplicant
+that have been read by <tt>wpactrl_update()</tt> but haven't been
+acknowledged yet.
+</p>
+
+<p>
+<code> char *wpactrl_datalen (wpactrl_t *a) </code> <br />
+Returns the length of unsolicited messages from wpa_supplicant
+that have been read by <tt>wpactrl_update()</tt> but haven't been
+acknowledged yet.
+</p>
+
+<p>
+<code> void wpactrl_ackdata (wpactrl_t *a) </code>
+Acknowledges reading the latest batch of unsolicited messages
+from wpa_supplicant: allows the next invocation of
+<tt>wpactrl_update()</tt> to reuse the storage.
+</p>
+
+<p>
+<code> int wpactrl_filter_add (wpactrl_t *a, char const *prefix) </code> <br />
+Adds <em>prefix</em> to the whitelist. Unsolicited messages from
+wpa_supplicant will be stored and made available to the application
+if they start with <tt>%lt;</tt><em>priority</em><tt>&gt;</tt><em>prefix</em>,
+<em>priority</em> being a single nonzero digit. If the filter is
+activated (which is the default), then only messages matching prefixes
+registered via <tt>wpactrl_filter_add()</tt> will be stored, and all
+other messages will be discarded. The function returns
+1 if it succeeds and 0 if it fails.
+</p>
+
+<p>
+<code> void wpactrl_filter_remove (wpactrl_t *a, char const *prefix) </code> <br />
+Removes <em>prefix</em> from the whitelist.
+</p>
+
+<p>
+<code> void wpactrl_filter_activate (wpactrl_t *a) </code>
+Activates the message filter. Unsolicited messages from
+wpa_supplicant will be discarded unless they are explicitly
+whitelisted by a call to <tt>wpactrl_filter_add()</tt>. This
+is the default.
+</p>
+
+<p>
+<code> void wpactrl_filter_deactivate (wpactrl_t *a) </code>
+Dectivates the message filter. All the unsolicited messages from
+wpa_supplicant will be stored and made available to the
+application.
+</p>
+
+<h3> Higher-level commands </h3>
+
+</body>
+</html>
diff --git a/doc/quickstart.html b/doc/quickstart.html
new file mode 100644
index 0000000..e9bbd3f
--- /dev/null
+++ b/doc/quickstart.html
@@ -0,0 +1,33 @@
+<html>
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>bcnm: quickstart and FAQ</title>
+    <meta name="Description" content="bcnm: quickstart and FAQ" />
+    <meta name="Keywords" content="bcnm installation quickstart faq" />
+    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+  </head>
+<body>
+
+<p>
+<a href="index.html">bcnm</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> Quickstart and FAQ for bcnm </h1>
+
+<h2> Quickstart </h2>
+
+<ul>
+ <li> Install all the bcnm dependencies:
+  <ul>
+   <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> </li>
+   <li> <a href="//skarnet.org/software/execline/">execline</a> </li>
+  </ul> </li>
+ <li> Install <a href="index.html">bcnm</a> itself </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/upgrade.html b/doc/upgrade.html
new file mode 100644
index 0000000..1c96b68
--- /dev/null
+++ b/doc/upgrade.html
@@ -0,0 +1,28 @@
+<html>
+  <head>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>bcnm: how to upgrade</title>
+    <meta name="Description" content="bcnm: how to upgrade" />
+    <meta name="Keywords" content="bcnm installation upgrade" />
+    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+  </head>
+<body>
+
+<p>
+<a href="index.html">bcnm</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> What has changed in bcnm </h1>
+
+<h2> in 0.0.1.0 </h2>
+
+<ul>
+ <li> Initial release. </li>
+</ul>
+
+</body>
+</html>