934 lines
31 KiB
HTML
934 lines
31 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en" data-view="home" class="no-js">
|
||
|
<head>
|
||
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||
|
<meta name="google" content="notranslate" />
|
||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||
|
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="description" content="">
|
||
|
<meta name="author" content="Löwenware s.r.o">
|
||
|
|
||
|
<title>AISL Handbook</title>
|
||
|
|
||
|
|
||
|
<link href="/static/style.css" rel="stylesheet" />
|
||
|
|
||
|
<script type="text/javascript">document.documentElement.className='';</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="main-wrapper">
|
||
|
<div class="overlay">
|
||
|
<svg class="logo"><use xlink:href="/static/sprite.svg#logo"/></svg>
|
||
|
<a href="javascript:;" id="menu__switch" class="menu__switch" title="Switch menu">
|
||
|
<svg class="icon svg-menu-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
|
||
|
<g class="svg-menu-group">
|
||
|
<path class="svg-menu-lines" d="m0 4v2h24v-2zm0 7v2h24v-2zm0 7v2h24v-2z"/>
|
||
|
<path class="svg-menu-cross" d="m4.22 2.81-1.42 1.42 7.78 7.78-7.78 7.78 1.42 1.42 7.78-7.78 7.78 7.78 1.42-1.42-7.78-7.78 7.78-7.78-1.42-1.42-7.78 7.78z">
|
||
|
</g>
|
||
|
</svg>
|
||
|
</a>
|
||
|
<div class="logo__text">Löwenware</div>
|
||
|
</div>
|
||
|
|
||
|
<nav id="menu" class="menu">
|
||
|
<ul class="menu__list">
|
||
|
<li><a href="/">Home</a></li>
|
||
|
<li><a href="/about/">About</a></li>
|
||
|
<li><a href="/aisl/" class="active">AISL</a></li>
|
||
|
<li><a href="/dotrix/">Dotrix</a></li>
|
||
|
<li><a href="/blog/">Blog</a></li>
|
||
|
<li><a href="/contact/">Contact</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
|
||
|
|
||
|
<main class="content text-content">
|
||
|
<h1>AISL Handbook</h1>
|
||
|
|
||
|
<p>This document describes main concepts and API of AISL library
|
||
|
v.1.0.x.</p>
|
||
|
<p>Last update: 2019-06-16</p>
|
||
|
|
||
|
<h2>Table of Contents</h2>
|
||
|
<ul class="table-of-contents">
|
||
|
<li><a href="#overview">AISL Overview</a>
|
||
|
<ul>
|
||
|
<li><a href="#features">Features</a></li>
|
||
|
<li><a href="#installation">Installation</a></li>
|
||
|
<li><a href="#getting-started">Getting started</a> — Hello World</li>
|
||
|
<li><a href="#getting-advanced">Getting advanced</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li><a href="#api-reference">API Reference</a>
|
||
|
<ul>
|
||
|
<li>Class <a href="#AislInstance">AislInstance</a>
|
||
|
<ul>
|
||
|
<li>Methods:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_new">aisl_new</a></li>
|
||
|
<li><a href="#aisl_free">aisl_free</a></li>
|
||
|
<li><a href="#aisl_run_cycle">aisl_run_cycle</a></li>
|
||
|
<li><a href="#aisl_sleep">aisl_sleep</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Class <a href="#AislServer">AislServer</a>
|
||
|
<ul>
|
||
|
<li>Methods:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_server_get_instance">aisl_server_get_instance</a></li>
|
||
|
<li><a href="#aisl_server_get_address">aisl_server_get_address</a></li>
|
||
|
<li><a href="#aisl_server_get_ssl">aisl_server_get_ssl</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Class <a href="#AislClient">AislClient</a>
|
||
|
<ul>
|
||
|
<li>Methods:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_client_get_server">aisl_client_get_server</a></li>
|
||
|
<li><a href="#aisl_client_get_address">aisl_client_get_address</a></li>
|
||
|
<li><a href="#aisl_client_get_http_version">aisl_client_get_http_version</a></li>
|
||
|
<li><a href="#aisl_client_disconnect">aisl_client_disconnect</a></li>
|
||
|
<li><a href="#aisl_client_is_secure">aisl_client_is_secure</a></li>
|
||
|
<li><a href="#aisl_client_is_online">aisl_client_is_online</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Class <a href="#AislStream">AislStream</a>
|
||
|
<ul>
|
||
|
<li>Properties access methods:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_get_secure">aisl_is_secure</a></li>
|
||
|
<li><a href="#aisl_get_server">aisl_get_server</a></li>
|
||
|
<li><a href="#aisl_get_client">aisl_get_client</a></li>
|
||
|
<li><a href="#aisl_get_instance">aisl_get_instance</a></li>
|
||
|
<li><a href="#aisl_get_http_version">aisl_get_http_version</a></li>
|
||
|
<li><a href="#aisl_set_context">aisl_set_context</a></li>
|
||
|
<li><a href="#aisl_get_context">aisl_get_context</a></li>
|
||
|
<li><a href="#aisl_set_output_event">aisl_set_output_event</a></li>
|
||
|
<li><a href="#aisl_get_output_event">aisl_get_output_event</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Response methods:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_response">aisl_response</a></li>
|
||
|
<li><a href="#aisl_header">aisl_header</a></li>
|
||
|
<li><a href="#aisl_header_printf">aisl_header_printf</a></li>
|
||
|
<li><a href="#aisl_header_vprintf">aisl_header_vprintf</a></li>
|
||
|
<li><a href="#aisl_printf">aisl_printf</a></li>
|
||
|
<li><a href="#aisl_vprintf">aisl_vprintf</a></li>
|
||
|
<li><a href="#aisl_write">aisl_write</a></li>
|
||
|
<li><a href="#aisl_puts">aisl_puts</a></li>
|
||
|
<li><a href="#aisl_flush">aisl_flush</a></li>
|
||
|
<li><a href="#aisl_reject">aisl_reject</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Enumeration <a href="#AislStatus">AislStatus</a>
|
||
|
<ul>
|
||
|
<li>Functions:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_status_to_string">aisl_status_to_string</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Enumeration <a href="#AislEvent">AislEvent</a> — AISL event model
|
||
|
<ul>
|
||
|
<li>Values:
|
||
|
<ul>
|
||
|
<li><a href="#AISL_EVENT_SERVER_READY">AISL_EVENT_SERVER_READY</a></li>
|
||
|
<li><a href="#AISL_EVENT_SERVER_ERROR">AISL_EVENT_SERVER_ERROR</a></li>
|
||
|
<li><a href="#AISL_EVENT_CLIENT_CONNECT">AISL_EVENT_CLIENT_CONNECT</a></li>
|
||
|
<li><a href="#AISL_EVENT_CLIENT_DISCONNECT">AISL_EVENT_CLIENT_DISCONNECT</a></li>
|
||
|
<li><a href="#AISL_EVENT_STREAM_OPEN">AISL_EVENT_STREAM_OPEN</a></li>
|
||
|
<li><a href="#AISL_EVENT_STREAM_HEADER">AISL_EVENT_STREAM_HEADER</a></li>
|
||
|
<li><a href="#AISL_EVENT_STREAM_INPUT">AISL_EVENT_STREAM_INPUT</a></li>
|
||
|
<li><a href="#AISL_EVENT_STREAM_REQUEST">AISL_EVENT_STREAM_REQUEST</a></li>
|
||
|
<li><a href="#AISL_EVENT_STREAM_OUTPUT">AISL_EVENT_STREAM_OUTPUT</a></li>
|
||
|
<li><a href="#AISL_EVENT_STREAM_CLOSE">AISL_EVENT_STREAM_CLOSE</a></li>
|
||
|
<li><a href="#AISL_EVENT_STREAM_ERROR">AISL_EVENT_STREAM_ERROR</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Callback:
|
||
|
<ul>
|
||
|
<li><a href="#AislCallback">AislCallback</a> — AISL event callback prototype</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Payloads:
|
||
|
<ul>
|
||
|
<li>
|
||
|
<li><a href="#aisl_evt">struct aisl_evt</a> — Common event payload</li>
|
||
|
<li><a href="#aisl_evt_open">struct aisl_evt_open</a> — Event specific payload</li>
|
||
|
<li><a href="#aisl_evt_header">struct aisl_evt_header</a> — Event specific payload</li>
|
||
|
<li><a href="#aisl_evt_input">struct aisl_evt_input</a> — Event specific payload</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Functions:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_event_to_string">aisl_event_to_string</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Enumeration <a href="#AislHttpVersion">AislHttpVersion</a>
|
||
|
<ul>
|
||
|
<li>Functions:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_http_version_to_string">aisl_http_version_to_string</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Enumeration <a href="#AislHttpMethod">AislHttpMethod</a>
|
||
|
<ul>
|
||
|
<li>Functions:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_http_method_to_string">aisl_http_method_to_string</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Enumeration <a href="#AislHttpResponse">AislHttpResponse</a>
|
||
|
<ul>
|
||
|
<li>Functions:
|
||
|
<ul>
|
||
|
<li><a href="#aisl_http_response_to_string">aisl_http_response_to_string</a></li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>Configuration Structures</li>
|
||
|
<ul>
|
||
|
<li><a href="#aisl_cfg">struct aisl_cfg</a> — Engine configuration</li>
|
||
|
<li><a href="#aisl_cfg_ssl">struct aisl_cfg_ssl</a> — SSL configuration</li>
|
||
|
<li><a href="#aisl_cfg_srv">struct aisl_cfg_srv</a> — HTTP Server configuration</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</li>
|
||
|
</ul>
|
||
|
|
||
|
<hr />
|
||
|
|
||
|
<h2 id="overview">AISL Overview</h2>
|
||
|
|
||
|
<p>If you are reading this, either you are somehow already familiar with web
|
||
|
applications and web servers and you probably used to count them as an
|
||
|
independent entities. Indeed, most of the existing web technologies are
|
||
|
based on standalone web server and HTTP parser that together provide some
|
||
|
programming interface to work with cached in memory and on a hard disk HTTP
|
||
|
request. It is not that efficient and sometimes even vulnerable in sence of
|
||
|
DDoS attacks.</p>
|
||
|
<p>AISL works differently. Using AISL you can create web application
|
||
|
that is a web server. It means that developer can keep under control all the
|
||
|
workflow of an HTTP stream, by appropriate reactoin on triggered by AISL
|
||
|
programmable events, which is a great performance and security advantage.
|
||
|
For example, application may want to already start some routines to prepare
|
||
|
response, when just first line of the HTTP request like
|
||
|
<span class="inline-code">GET /index.html HTTP/1.1</span> was received. Or
|
||
|
it may also want to ignore some of the HTTP headers or even full body
|
||
|
content to preserve resources and CPU time, if they are unnecessary
|
||
|
or even unwelcome.</p>
|
||
|
|
||
|
<h3 id="features">Features</h3>
|
||
|
<ul>
|
||
|
<li>Asynchronous event-based engine</li>
|
||
|
<li>Lightweight solution: size of the shared C library is just about 38
|
||
|
Kbytes.</li>
|
||
|
<li>HTTP 1.x support (support of HTTP 2.0 is planned).</li>
|
||
|
<li>HTTPS support (using openssl).</li>
|
||
|
<li>Free software with open source code.</li>
|
||
|
<li><a href="https://creativecommons.org/licenses/by-nd/4.0/" rel="license">CC BY-ND 4.0</a> License.</p>
|
||
|
</ul>
|
||
|
|
||
|
<h3 id="installation">Installation</h3>
|
||
|
<p>One can get AISL sources from GitHub at any time. Master branch is always
|
||
|
stable. To get the Library follow these steps:</p>
|
||
|
<ol>
|
||
|
<li>Clone GIT repositroy<code>$ git clone https://github.com/lowenware/aisl.git</code></li>
|
||
|
<li>Navigate to cloned folder<code>$ cd aisl</code></li>
|
||
|
<li>Compile the library<code>$ make PREFIX=/usr/local LIB_DIR=lib</code>
|
||
|
Set <code class="inline">PREFIX</code> to preffered installation path
|
||
|
and <code class="inline">LIB_DIR</code> to your system related name of
|
||
|
library directory (lib, lib32 or lib64).</li>
|
||
|
<li>Install the library<code>$ sudo make install</code></li>
|
||
|
<li>Optionaly advanced users may want to build library with one or more
|
||
|
options:
|
||
|
<code class="inline">AISL_WITH_SSL=0</code> - disable
|
||
|
HTTPS support, <code class="inline">AISL_WITH_STRINGIFIERS=0</code> -
|
||
|
disable several optional *_to_string functions to preserve library sizea,
|
||
|
<code class="inline">AISL_WITH_DEBUG=1</code> - enable library debug
|
||
|
output.</li>
|
||
|
<li>You may also want to edit (if you have changed
|
||
|
<code class="inline">PREFIX</code> or <code class="inline">LIB_DIR</code>)
|
||
|
and copy <i>libaisl.pc.example</i> file to <i>/usr/lib/pkgconfig</i>, so
|
||
|
<i>pkgconfig</i> could be used to simplify future linking.</li>
|
||
|
</ol>
|
||
|
|
||
|
<h3 id="hello-world">Getting started - Hello World</h3>
|
||
|
<p>If you have AISL installed, it is time to try it out with simple
|
||
|
`Hello World!` application. Full source code could be found on a
|
||
|
<a href="https://github.com/lowenware/aisl/blob/master/examples/hello-world.c">GitHub</a>
|
||
|
and the most important steps are highlighted bellow.</p>
|
||
|
<p>Include AISL meta-header file to add necessary declarations to you
|
||
|
code file. You should never include other AISL header files in to your
|
||
|
projects.</p>
|
||
|
<code>#include <aisl/aisl.h></code>
|
||
|
|
||
|
<p>In this example we create one HTTP server without encryption, that will
|
||
|
listen to port 8080 on all available network interfaces.</p>
|
||
|
<code>struct <a href="#aisl_cfg_srv">aisl_cfg_srv</a>[] srv = {{
|
||
|
.host = "0.0.0.0",
|
||
|
.port = 8080,
|
||
|
.secure = false
|
||
|
}};</code>
|
||
|
|
||
|
<p>To initialize configuration structure we use default values.</p>
|
||
|
<code>struct <a href="#aisl_cfg">aisl_cfg</a> cfg = AISL_CFG_DEFAULT;</code>
|
||
|
|
||
|
<p>An address of the defined servers configuration and their number must be
|
||
|
also stored in the structure.</p>
|
||
|
<code>cfg.srv = srv;
|
||
|
cfg.srv_cnt = sizeof (srv) / sizeof (srv[0]);</code>
|
||
|
|
||
|
<p>Event handler is a core function of the web application. It should match
|
||
|
<a href="#AislCallback">AislCallback</a> prototype and its address also
|
||
|
must be stored in the configuration structure before library
|
||
|
initialization.</p>
|
||
|
<code>cfg.callback = hello_world;</code>
|
||
|
|
||
|
<p>When configuration is ready, it is time to allocate and initialize our
|
||
|
<a href="#AislInstance">AislInstance</a> and start application loop.</p>
|
||
|
<code>AislInstance aisl;
|
||
|
AislStatus status;
|
||
|
...
|
||
|
if ( (aisl = aisl_new(&cfg)) != NULL ) {
|
||
|
/* launch application loop */
|
||
|
fprintf(stdout, "Entering main loop\n" );
|
||
|
for(;;) {
|
||
|
status = aisl_run_cycle(aisl);
|
||
|
|
||
|
if ( status != AISL_SUCCESS )
|
||
|
aisl_sleep(aisl, 500);
|
||
|
}
|
||
|
aisl_free(aisl);
|
||
|
} else {
|
||
|
fprintf(stderr, "Failed to initialize AISL\n");
|
||
|
}</code>
|
||
|
<p>Function <a href="#aisl_run_cycle">aisl_run_cycle</a> being called within
|
||
|
a loop does all the core routines of our HTTP server and triggers event callback
|
||
|
defined in configuration structure. To avoid unnecessary CPU loading we
|
||
|
also execute <a href="#aisl_sleep">aisl_sleep</a> on idle cycles. To
|
||
|
release allocated by AISL resources on a runtime we are using
|
||
|
<a href="#aisl_sleep">aisl_sleep</a>.</p>
|
||
|
|
||
|
<p>And finally it is time to define the event handler matching
|
||
|
<a href="#AislCallback">AislCallback</a> prototype.</p>
|
||
|
<code>static void
|
||
|
hello_world(const struct aisl_evt *evt, void *p_ctx)
|
||
|
{
|
||
|
AislStream s;
|
||
|
|
||
|
const char html[] =
|
||
|
"<html>"
|
||
|
"<head>"
|
||
|
"<title>Hello World</title>"
|
||
|
"</head>"
|
||
|
"<body>"
|
||
|
"<h1>Hello World</h1>"
|
||
|
"<p>Powered by AISL</p>"
|
||
|
"</body>"
|
||
|
"</html>";
|
||
|
|
||
|
if (evt->code != AISL_EVENT_STREAM_REQUEST)
|
||
|
return;
|
||
|
|
||
|
s = evt->source;
|
||
|
|
||
|
if (aisl_response(s, AISL_HTTP_OK, sizeof (html)-1) == AISL_SUCCESS) {
|
||
|
if (aisl_write(s, html, sizeof (html)-1) != -1) {
|
||
|
aisl_flush(s);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
aisl_reject(s);
|
||
|
(void) p_ctx;
|
||
|
}</code>
|
||
|
<p>The function is being called by AISL engine on every event, but proceeds
|
||
|
only if <a href="#AISL_EVENT_STREAM_REQUEST">AISL_EVENT_STREAM_REQUEST</a>
|
||
|
is received. It starts an HTML response stored in <code class="inline">html</code>
|
||
|
constant. Make sure you use <code class="inline">sizeof (htmk)-1</code> for
|
||
|
content length, to avoid unwanted write of last NULL terminating character
|
||
|
of <code class="inline">html</code> string constant.</p>
|
||
|
|
||
|
<p>To compile the example using GCC and pkgconfig run:</p>
|
||
|
<code>$ gcc `pkgconf --libs --cflags libaisl` hello-world.c -o hello-world</code>
|
||
|
<p>Or specify paths to installed header files and library manualy:</p>
|
||
|
<code>$ -I/usr/local/include -L/usr/local/lib -laisl hello-world.c -o hello-world</code>
|
||
|
|
||
|
<p>Now execute compiled hello_world binary and open <a href="http://localhost:8080">http://localhost:8080</a> in
|
||
|
your browser. If you get any <code class="inline">symbol lookup error</code> on execution attempt,
|
||
|
try to specify the path to the library in the environment variable:</p>
|
||
|
<code>$ LD_LIBRARY_PATH="/usr/local/lib" ./hello-world</code>
|
||
|
<p>The result should look like this:</p>
|
||
|
<img src="/aisl/hello-world.jpg" class="shrink-picture" />
|
||
|
|
||
|
<h3 id="getting-advanced">Getting advanced</h3>
|
||
|
<p>Right after this chapter you will find full AISL
|
||
|
<a href="#api-reference">API Reference</a> that guides through all the types
|
||
|
and functions. The most significant of them you may already know from the
|
||
|
<a href="#getting-started">Hello World</a> example. To become an advanced
|
||
|
AISL developer, you will need to understand <a href="#AislEvent">events model</a>
|
||
|
and <a href="#AislStream">stream concept</a>. The rest of library
|
||
|
components carry more auxiliary function.</p>
|
||
|
|
||
|
<h2 id="api-reference">API Reference</h2>
|
||
|
<p>AISL library API has object oriented model. Although C has no objects,
|
||
|
it still allows to use transparent data structures to represent classes and
|
||
|
functions as methods.</p>
|
||
|
<p>Each AISL component has a library specific prefix:</p>
|
||
|
<ul>
|
||
|
<li><b>Aisl*</b> - for data types (typedefs)</li>
|
||
|
<li><b>aisl_*</b> - for functions and structures names</li>
|
||
|
<li><b>AISL_*</b> - for constants and macro definitions</li>
|
||
|
</ul>
|
||
|
<p>Functions, related to some data type (methods), include name of the type in
|
||
|
their names, i.e. <code class="inline">AislServer - aisl_server_get_address()</code>.
|
||
|
There are two exceptions from this rule though introduced for simplicity and
|
||
|
shorter names for the functions being used most often: <a href="#AislInstance">AislInstance</a>
|
||
|
and <a href="#AislStream">AislStream</a>.</p>
|
||
|
|
||
|
<h3 id="AislInstance">Class AislInstance</h3>
|
||
|
<p>This class represents library engine, that could be dynamically allocated
|
||
|
in memory. It means that you can have several library instances in one application,
|
||
|
though you may never meet a real use case for this.</p>
|
||
|
<p>Every instance may handle several independent HTTP servers running on
|
||
|
different network sockets and manages SSL certificates and communication with
|
||
|
clients.</p>
|
||
|
<p>Each instance must be configured with proper parameters stored in
|
||
|
<a href="#aisl_cfg">aisl_cfg</a> data structure with at least one HTTP
|
||
|
server and event handler matching <a href="#AislCallback">AislCallback</a>
|
||
|
prototype.
|
||
|
|
||
|
<h4>Methods</h4>
|
||
|
<h5 id="aisl_new">aisl_new</h5>
|
||
|
<code<a href="#AislInstance">AislInstance</a>
|
||
|
aisl_new(const struct <a href="#aisl_cfg">aisl_cfg</a> *cfg);</code>
|
||
|
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p>A constructor of <a href="#AislInstance">AislInstance</a> class.</p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li><b>cfg</b> — a pointer to an <a href="#aisl_cfg">aisl_cfg</a> configuration
|
||
|
structure</li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p>Pointer to an <a href="#AislInstance">AislInstance</a> or NULL if
|
||
|
out of memory.</p>
|
||
|
|
||
|
<h5 id="aisl_free">aisl_free</h5>
|
||
|
<code>void
|
||
|
aisl_free(<a href="#AislInstance">AislInstance</a> instance);</code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p>Frees previously allocated pointer of AISL instance.</p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li><b>instance</b> — a pointer to an <a href="#AislInstance">AislInstance</a>.</li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p>Returns no value.</p>
|
||
|
|
||
|
<h5 id="aisl_run_cycle">aisl_run_cycle</h5>
|
||
|
<code><a href="#AislStatus">AislStatus</a>
|
||
|
aisl_run_cycle(<a href="#AislInstance">AislInstance</a> instance);</code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li><b>instance</b> — a pointer to an <a href="#AislInstance">AislInstance</a>.</li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<ul>
|
||
|
<li><a href="#AISL_SUCCESS">AISL_SUCCESS</a> — if some event was triggered</li>
|
||
|
<li><a href="#AISL_IDLE">AISL_IDLE</a> — if no event was triggered</li>
|
||
|
<li><a href="#AISL_MALLOC_ERROR">AISL_MALLOC_ERROR</a> — if system run out
|
||
|
of memory</li>
|
||
|
<li><a href="#AISL_SYSCALL_ERROR">AISL_SYSCALL_ERROR</a> — if some system
|
||
|
call failed</li>
|
||
|
</ul>
|
||
|
<p>Return value handling should be soft. It is completely safe to continue
|
||
|
program execution even if error value was returned.</p>
|
||
|
<p>To preserve CPU time it is recommended to add a delay between
|
||
|
<a href="#aisl_run_cycle">aisl_run_cycle</a> calls, at least if anything but
|
||
|
<a href="#AISL_SUCCESS">AISL_SUCCESS</a> has been returned. You may want to
|
||
|
use <a href="#aisl_sleep">aisl_sleep</a> for this.</p>
|
||
|
|
||
|
<h5 id="aisl_sleep">aisl_sleep</h5>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="AislServer">Class AislServer</h3>
|
||
|
<h3 id="AislClient">Class AislClient</h3>
|
||
|
<h3 id="AislStream">Class AislStream</h3>
|
||
|
<h3 id="AislStatus">Enumeration AislStatus</h3>
|
||
|
<h3 id="AislEvent">Enumeration AislEvent</h3>
|
||
|
<h3 id="AislHttpVersion">Enumeration AislHttpVersion</h3>
|
||
|
<h3 id="AislHttpMethod">Enumeration AislHttpMethod</h3>
|
||
|
<h3 id="AislHttpResponse">Enumeration AislHttpResponse</h3>
|
||
|
|
||
|
<h2 id="chapter-3">Data Structures</h2>
|
||
|
|
||
|
<h3 id="aisl_cfg">struct aisl_cfg</h3>
|
||
|
<h3 id="aisl_cf">struct aisl_cfg_ssl</h3>
|
||
|
<h3 id="aisl_cfg_srv">struct aisl_cfg_srv</h3>
|
||
|
<h3 id="aisl_evt">struct aisl_evt</h3>
|
||
|
<h3 id="aisl_evt_open">struct aisl_evt_open</h3>
|
||
|
<h3 id="aisl_evt_header">struct aisl_evt_header</h3>
|
||
|
<h3 id="aisl_evt_input">struct aisl_evt_input</h3>
|
||
|
|
||
|
|
||
|
<h2 id="chapter-4">Events</h2>
|
||
|
|
||
|
<h3 id="AISL_EVENT_SERVER_READY">AISL_EVENT_SERVER_READY</h3>
|
||
|
<h3 id="AISL_EVENT_SERVER_ERROR">AISL_EVENT_SERVER_ERROR</h3>
|
||
|
<h3 id="AISL_EVENT_CLIENT_CONNECT">AISL_EVENT_CLIENT_CONNECT</h3>
|
||
|
<h3 id="AISL_EVENT_CLIENT_DISCONNECT">AISL_EVENT_CLIENT_DISCONNECT</h3>
|
||
|
<h3 id="AISL_EVENT_STREAM_OPEN">AISL_EVENT_STREAM_OPEN</h3>
|
||
|
<h3 id="AISL_EVENT_STREAM_HEADER">AISL_EVENT_STREAM_HEADER</h3>
|
||
|
<h3 id="AISL_EVENT_STREAM_INPUT">AISL_EVENT_STREAM_INPUT</h3>
|
||
|
<h3 id="AISL_EVENT_STREAM_REQUEST">AISL_EVENT_STREAM_REQUEST</h3>
|
||
|
<h3 id="AISL_EVENT_STREAM_OUTPUT">AISL_EVENT_STREAM_OUTPUT</h3>
|
||
|
<h3 id="AISL_EVENT_STREAM_CLOSE">AISL_EVENT_STREAM_CLOSE</h3>
|
||
|
<h3 id="AISL_EVENT_STREAM_ERROR">AISL_EVENT_STREAM_ERROR</h3>
|
||
|
|
||
|
|
||
|
<h2 id="chapter-5">Functions</h2>
|
||
|
|
||
|
|
||
|
|
||
|
<h3 id="aisl_get_server">aisl_get_server</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
|
||
|
<h3 id="aisl_get_client">aisl_get_client</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_stream_get_instance">aisl_stream_get_instance</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_is_secure">aisl_is_secure</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
|
||
|
<h3 id="aisl_get_http_version">aisl_get_http_version</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_set_context">aisl_set_context</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_get_context">aisl_get_context</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_set_output_event">aisl_set_output_event</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_get_output_event">aisl_get_output_event</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
|
||
|
<h3 id="aisl_response">aisl_response</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_header">aisl_header</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_header_printf">aisl_header_printf</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_header_vprintf">aisl_header_vprintf</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_printf">aisl_printf</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_vprintf">aisl_vprintf</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_write">aisl_write</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_puts">aisl_puts</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_flush">aisl_flush</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_reject">aisl_reject</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
|
||
|
<h3 id="aisl_server_get_instance">aisl_server_get_instance</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_server_get_address">aisl_server_get_address</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_server_get_ssl">aisl_server_get_ssl</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
|
||
|
<h3 id="aisl_client_get_server">aisl_client_get_server</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_client_get_address">aisl_client_get_address</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_client_get_http_version">aisl_client_get_http_version</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_client_disconnect">aisl_client_disconnect</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_client_is_secure">aisl_client_is_secure</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_client_is_online">aisl_client_is_online</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
|
||
|
|
||
|
<h3 id="aisl_status_to_string">aisl_status_to_string</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_event_to_string">aisl_event_to_string</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_http_version_to_string">aisl_http_version_to_string</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_http_method_to_string">aisl_http_method_to_string</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
<h3 id="aisl_http_response_to_string">aisl_http_response_to_string</h3>
|
||
|
<code></code>
|
||
|
<p class="content-node">DESCRIPTION</p>
|
||
|
<p></p>
|
||
|
<p class="content-node">PARAMETERS</p>
|
||
|
<ul>
|
||
|
<li></li>
|
||
|
</ul>
|
||
|
<p class="content-node">RETURN VALUE</p>
|
||
|
<p></p>
|
||
|
|
||
|
</main>
|
||
|
|
||
|
</div>
|
||
|
<div class="footer">
|
||
|
<div class="footer__logo dark-bg">Löwenware</div>
|
||
|
<div class="footer__above">
|
||
|
<!--div class="newsletter">
|
||
|
<form>
|
||
|
<label for="newsletter__email">Subscribe to newsletter</label>
|
||
|
<div class="newsletter__field">
|
||
|
<input type="email" name="email" id="newsletter__email" placeholder="your@email.address" />
|
||
|
<button type="submit" class="submit" name="submit" value="1">Subscribe</button>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div-->
|
||
|
<div class="footer__social">
|
||
|
<a href="/goto/github" title="Go to GitHub"><svg class="icon"><use xlink:href="/static/sprite.svg#github"/></svg></a>
|
||
|
<a href="/goto/gitter" title="Go to Gitter chat"><svg class="icon"><use xlink:href="/static/sprite.svg#gitter"/></svg></a>
|
||
|
<a href="/goto/youtube" title="Go to YouTube channel"><svg class="icon"><use xlink:href="/static/sprite.svg#youtube"/></svg></a>
|
||
|
<a href="/goto/instagram" title="Go to Instagram"><svg class="icon"><use xlink:href="/static/sprite.svg#instagram"/></svg></a>
|
||
|
<a href="/goto/medium" title="Go to Medium page"><svg class="icon"><use xlink:href="/static/sprite.svg#medium"/></svg></a>
|
||
|
<a href="/goto/linkedin" title="Go to LinkedIn profile"><svg class="icon"><use xlink:href="/static/sprite.svg#linkedin"/></svg></a>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="footer__below dark-bg">
|
||
|
<div class="footer__credentials">
|
||
|
<div class="copyright">© 2017 - 2019 by Löwenware s.r.o.</div>
|
||
|
<ul class="legal">
|
||
|
<li class="legal__node legal__first"><a href="/privacy-statement.html">Privacy statement</a></li>
|
||
|
<li class="legal__node legal__marker"><a href="/terms-of-use.html">Terms of use</a></li>
|
||
|
</ul>
|
||
|
<div style="clear:left;"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script async type="text/javascript" src="/static/main.js"></script>
|
||
|
</body>
|
||
|
</html>
|