| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <h1>APPWEB API</h1>
- <a name="Extensions"></a><h2>Extensions</h2>
- <table class="apiIndex" title="Extensions">
- <tr class="apiDef">
- <td class="apiName"><a href="#group___ma_state" class="nameRef">MaState</a></td>
- <td class="apiBrief">Current configuration parse state.</td></tr>
- </table>
- <a name="Functions"></a><h2>Functions</h2>
- <table class="apiIndex" title="Functions">
- <tr class="apiDef"><td class="apiType">void</td><td><a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="nameRef">maAddDirective</a>(<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *directive, <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a> proc)</td></tr><tr class="apiBrief"><td> </td><td>Define a new appweb configuration file directive.</td></tr>
- <tr class="apiDef"><td class="apiType">int</td><td><a href="#group___ma_state_1ga3a076271dc5d0227cf3e4c79dcb3f026" class="nameRef">maConfigureServer</a>(<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *configFile, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *home, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *documents, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *ip, int port)</td></tr><tr class="apiBrief"><td> </td><td>Configure a web server.</td></tr>
- <tr class="apiDef"><td class="apiType">char*</td><td><a href="#group___ma_state_1ga55e8a5ed07c0c10d79fd20d3c0e1d602" class="nameRef">maGetNextArg</a>(char *s, char **tok)</td></tr><tr class="apiBrief"><td> </td><td>Get the argument in a directive.</td></tr>
- <tr class="apiDef"><td class="apiType">int</td><td><a href="#group___ma_state_1ga94cd7d8346894055cff0fc79dcd09a48" class="nameRef">maLoadModule</a>(<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *name, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *libname)</td></tr><tr class="apiBrief"><td> </td><td>Load an appweb module.</td></tr>
- <tr class="apiDef"><td class="apiType">int</td><td><a href="#group___ma_state_1gaa70fb4c9b9835739719c049af17180ef" class="nameRef">maLoadModules</a>(void)</td></tr><tr class="apiBrief"><td> </td><td>Load default modules.</td></tr>
- <tr class="apiDef"><td class="apiType">int</td><td><a href="#group___ma_state_1gae9c5d28320c9ebe7f2a6e810215be37c" class="nameRef">maParseConfig</a>(<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *path)</td></tr><tr class="apiBrief"><td> </td><td>Parse an Appweb configuration file.</td></tr>
- <tr class="apiDef"><td class="apiType">int</td><td><a href="#group___ma_state_1gaf65d5f6135abce2b2cbf625e02a5d1f4" class="nameRef">maParseFile</a>(<a href="#group___ma_state" class="ref">MaState</a> *state, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *path)</td></tr><tr class="apiBrief"><td> </td><td>Parse a configuration file.</td></tr>
- <tr class="apiDef"><td class="apiType"><a href="#group___ma_state" class="ref">MaState*</a></td><td><a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="nameRef">maPopState</a>(<a href="#group___ma_state" class="ref">MaState</a> *state)</td></tr><tr class="apiBrief"><td> </td><td>Pop the state.</td></tr>
- <tr class="apiDef"><td class="apiType"><a href="#group___ma_state" class="ref">MaState*</a></td><td><a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="nameRef">maPushState</a>(<a href="#group___ma_state" class="ref">MaState</a> *state)</td></tr><tr class="apiBrief"><td> </td><td>Push the state.</td></tr>
- <tr class="apiDef"><td class="apiType">int</td><td><a href="#group___ma_state_1ga88a2bd1d0f26f024e6cb2d693c13e4f7" class="nameRef">maRunSimpleWebServer</a>(<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *ip, int port, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *home, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *documents)</td></tr><tr class="apiBrief"><td> </td><td>Create and run a simple web server listening on a single IP address.</td></tr>
- <tr class="apiDef"><td class="apiType">int</td><td><a href="#group___ma_state_1ga4994c273e87409b094418dd7bd370ee4" class="nameRef">maRunWebServer</a>(<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *configFile)</td></tr><tr class="apiBrief"><td> </td><td>Create and run a web server based on a configuration file.</td></tr>
- <tr class="apiDef"><td class="apiType"><a href="osdep.html#group___osdep_1gad5c9d4ba3dc37783a528b0925dc981a0" class="ref">bool</a></td><td><a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="nameRef">maTokenize</a>(<a href="#group___ma_state" class="ref">MaState</a> *state, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *str, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *fmt, ...)</td></tr><tr class="apiBrief"><td> </td><td>Tokenize a string based on route data.</td></tr>
- </table>
- <a name="Typedefs"></a><h2>Typedefs</h2>
- <table class="apiIndex" title="typedefs">
- <tr class="apiDef"><td class="apiName"><a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="nameRef">MaDirective</a></td><td class="apiBrief">Appweb configuration file directive parsing callback function.</td></tr>
- </table>
- <a name="Defines"></a><h2>Defines</h2>
- <table class="apiIndex" title="Defines">
- <tr class="apiDef">
- <td>#define</td><td><a href="#appweb_8h_1a3b315098fc2d1fc56d9d2832902dacff" class="nameRef">MA_PARSE_NON_SERVER</a> 0x1</td>
- </tr>
- <tr class="apiBrief"><td> </td><td>Command file being parsed by a utility program.</td></tr>
- <tr class="apiDef">
- <td>#define</td><td><a href="#appweb_8h_1aba0a3eb51d76651562bc5c0bb2c0f424" class="nameRef">MA_UNLOAD_TIMEOUT</a> "5mins"</td>
- </tr>
- <tr class="apiBrief"><td> </td><td>Default module inactivity timeout.</td></tr>
- </table>
- <h2>MaState</h2>
- <a name="group___ma_state"></a>
- <div class="api">
- <div class="prototype">MaState</div>
- <div class="apiDetail">
- <p>Current configuration parse state.</p>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>Fields:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">HttpAuth *</td><td><td>auth</td><td>
- Quick alias for route->auth.
- </td>
- <tr><td class="param">char *</td><td><td>configDir</td><td>
- Directory containing config file.
- </td>
- <tr><td class="param">struct MaState *</td><td><td>current</td><td>
- Current state.
- </td>
- <tr><td class="param">char *</td><td><td>data</td><td>
- Config data (managed).
- </td>
- <tr><td class="param">int</td><td><td>enabled</td><td>
- True if the current block is enabled.
- </td>
- <tr><td class="param">char *</td><td><td>endpoints</td><td>
- Virtual host endpoints.
- </td>
- <tr><td class="param">MprFile *</td><td><td>file</td><td>
- Config file handle.
- </td>
- <tr><td class="param">char *</td><td><td>filename</td><td>
- Config file name.
- </td>
- <tr><td class="param">int</td><td><td>flags</td><td>
- Parsing flags.
- </td>
- <tr><td class="param">HttpHost *</td><td><td>host</td><td>
- Current host.
- </td>
- <tr><td class="param">char *</td><td><td>key</td><td>
- Current directive being parsed.
- </td>
- <tr><td class="param">int</td><td><td>lineNumber</td><td>
- Current line number.
- </td>
- <tr><td class="param">struct MaState *</td><td><td>prev</td><td>
- Previous (inherited) state.
- </td>
- <tr><td class="param">HttpRoute *</td><td><td>route</td><td>
- Current route.
- </td>
- <tr><td class="param">struct MaState *</td><td><td>top</td><td>
- Top level state.
- </td>
- </table></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1ga0625b7b754d921353acac4505eb9de02"></a>
- <div class="api">
- <div class="prototype">
- void
- maAddDirective
- (<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *directive, <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a> proc)
- </div>
- <div class="apiDetail">
- <p>Define a new appweb configuration file directive.</p>
- <dl><dt><b>Description</b>:</dt><dd>The appweb configuration file parse is extensible. New directives can be registered by this call. When encountered in the config file, the given callback proc will be invoked to parse.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">directive</td><td>Directive name.</td>
- <tr><td class="param">proc</td><td>Directive callback procedure of the type <a class="ref" href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2">MaDirective</a></td>
- </table></dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1ga3a076271dc5d0227cf3e4c79dcb3f026"></a>
- <div class="api">
- <div class="prototype">
- int
- maConfigureServer
- (<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *configFile, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *home, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *documents, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *ip, int port)
- </div>
- <div class="apiDetail">
- <p>Configure a web server.</p>
- <dl><dt><b>Description</b>:</dt><dd>This will configure a web server based on either a configuration file or using the supplied IP address and port.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">configFile</td><td>File name of the Appweb configuration file (appweb.conf) that defines the web server configuration.</td>
- <tr><td class="param">home</td><td>Admin directory for the server. This overrides the value in the config file.</td>
- <tr><td class="param">documents</td><td>Default directory for web documents to serve. This overrides the value in the config file.</td>
- <tr><td class="param">ip</td><td>IP address to listen on. This overrides the value specified in the config file.</td>
- <tr><td class="param">port</td><td>Port address to listen on. This overrides the value specified in the config file.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1ga55e8a5ed07c0c10d79fd20d3c0e1d602"></a>
- <div class="api">
- <div class="prototype">
- char *
- maGetNextArg
- (char *s, char **tok)
- </div>
- <div class="apiDetail">
- <p>Get the argument in a directive.</p>
- <dl><dt><b>Description</b>:</dt><dd>Break into arguments. Args may be quoted. An outer quoting of the entire arg is removed.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">s</td><td>String to examine.</td>
- <tr><td class="param">tok</td><td>Next token reference.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Reference to the next token. (Not allocate.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1ga94cd7d8346894055cff0fc79dcd09a48"></a>
- <div class="api">
- <div class="prototype">
- int
- maLoadModule
- (<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *name, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *libname)
- </div>
- <div class="apiDetail">
- <p>Load an appweb module.</p>
- <dl><dt><b>Description</b>:</dt><dd>Load an appweb module. If the module is already loaded, this call will return successfully without reloading. Modules can be dynamically loaded or may also be pre-loaded using static linking.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">name</td><td>User name. Must be defined in the system password file.</td>
- <tr><td class="param">libname</td><td>Library path name.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1gaa70fb4c9b9835739719c049af17180ef"></a>
- <div class="api">
- <div class="prototype">
- int
- maLoadModules
- (void )
- </div>
- <div class="apiDetail">
- <p>Load default modules.</p>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Prototype.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1gae9c5d28320c9ebe7f2a6e810215be37c"></a>
- <div class="api">
- <div class="prototype">
- int
- maParseConfig
- (<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *path)
- </div>
- <div class="apiDetail">
- <p>Parse an Appweb configuration file.</p>
- <dl><dt><b>Description</b>:</dt><dd>Parse the configuration file and configure the server. This creates a default host and route and then configures the server based on config file directives.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">path</td><td>Configuration file pathname.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1gaf65d5f6135abce2b2cbf625e02a5d1f4"></a>
- <div class="api">
- <div class="prototype">
- int
- maParseFile
- (<a href="#group___ma_state" class="ref">MaState</a> *state, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *path)
- </div>
- <div class="apiDetail">
- <p>Parse a configuration file.</p>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">state</td><td>Current state level object.</td>
- <tr><td class="param">path</td><td>Filename to parse.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Prototype.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9"></a>
- <div class="api">
- <div class="prototype">
- <a href="#group___ma_state" class="ref">MaState</a> *
- maPopState
- (<a href="#group___ma_state" class="ref">MaState</a> *state)
- </div>
- <div class="apiDetail">
- <p>Pop the state.</p>
- <dl><dt><b>Description</b>:</dt><dd>This is used when parsing config files to handle nested include files and block level directives.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">state</td><td>Current state.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>The next lower level state object.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1gad960c7ab5089293e33a0cf221f41072d"></a>
- <div class="api">
- <div class="prototype">
- <a href="#group___ma_state" class="ref">MaState</a> *
- maPushState
- (<a href="#group___ma_state" class="ref">MaState</a> *state)
- </div>
- <div class="apiDetail">
- <p>Push the state.</p>
- <dl><dt><b>Description</b>:</dt><dd>This is used when parsing config files to handle nested include files and block level directives.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">state</td><td>Current state.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>The state passed as a parameter which becomes the new top level state.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1ga88a2bd1d0f26f024e6cb2d693c13e4f7"></a>
- <div class="api">
- <div class="prototype">
- int
- maRunSimpleWebServer
- (<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *ip, int port, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *home, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *documents)
- </div>
- <div class="apiDetail">
- <p>Create and run a simple web server listening on a single IP address.</p>
- <dl><dt><b>Description</b>:</dt><dd>Create a simple web server without using a configuration file. The server is created to listen on the specified IP address and port. This routine provides a one-line embedding of Appweb. If you want to use a config file, try the <a class="ref" href="#group___ma_state_1ga4994c273e87409b094418dd7bd370ee4">maRunWebServer</a> instead.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">ip</td><td>IP address on which to listen. Set to "0.0.0.0" to listen on all interfaces.</td>
- <tr><td class="param">port</td><td>Port number to listen to.</td>
- <tr><td class="param">home</td><td>Home directory for the web server.</td>
- <tr><td class="param">documents</td><td>Directory containing the documents to serve.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1ga4994c273e87409b094418dd7bd370ee4"></a>
- <div class="api">
- <div class="prototype">
- int
- maRunWebServer
- (<a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *configFile)
- </div>
- <div class="apiDetail">
- <p>Create and run a web server based on a configuration file.</p>
- <dl><dt><b>Description</b>:</dt><dd>Create a web server configuration based on the supplied config file. This routine provides a one-line embedding of Appweb. If you don't want to use a config file, try the <a class="ref" href="#group___ma_state_1ga88a2bd1d0f26f024e6cb2d693c13e4f7">maRunSimpleWebServer</a> instead.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">configFile</td><td>File name of the Appweb configuration file (appweb.conf) that defines the web server configuration.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
- <a name="group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a"></a>
- <div class="api">
- <div class="prototype">
- <a href="osdep.html#group___osdep_1gad5c9d4ba3dc37783a528b0925dc981a0" class="ref">bool</a>
- maTokenize
- (<a href="#group___ma_state" class="ref">MaState</a> *state, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *str, <a href="osdep.html#group___osdep_1ga4f52f6802d742ebd12c628e69a2bd162" class="ref">cchar</a> *fmt, ...)
- </div>
- <div class="apiDetail">
- <p>Tokenize a string based on route data.</p>
- <dl><dt><b>Description</b>:</dt><dd>This is a utility routine to parse a string into tokens given a format specifier. Mandatory tokens can be specified with "%" format specifier. Optional tokens are specified with "?" format. Values wrapped in quotes will have the outermost quotes trimmed.</dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">state</td><td>Current config parsing state.</td>
- <tr><td class="param">str</td><td>String to expand.</td>
- <tr><td class="param">fmt</td><td>Format string specifier Supported tokens: <ul><li>B - Boolean. Parses: on/off, true/false, yes/no. </li><li>N - Number. Parses numbers in base 10. </li><li>S - String. Removes quotes. </li><li>P - Path string. Removes quotes and expands ${PathVars}. Resolved relative to host->dir (ServerRoot). </li><li>W - Parse words into a list </li><li>%! - Optional negate. Set value to HTTP_ROUTE_NOT present, otherwise zero. </li></ul></td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>True if the string can be successfully parsed.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2" class="ref">MaDirective</a>, <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a></dd></dl>
- </div>
- </div>
- <h2>Functions</h2>
- <h2>Typedefs</h2>
- <a name="group___ma_state_1ga77e98d350eaa12e72d0caee671b4d0d2"></a>
- <div class="api">
- <div class="prototype">
- typedef int() MaDirective(MaState *state, cchar *key, cchar *value).
- </div>
- <div class="apiDetail">
- <p>Appweb configuration file directive parsing callback function.</p>
- <dl><dt><b>Description</b>:</dt><dd>Directive callbacks are invoked to parse a directive. Directive callbacks are registered using <a class="ref" href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02">maAddDirective</a></dd></dl>
- <dl><dt>Parameters:</dt><dd>
- <table class="parameters" title="Parameters">
- <tr><td class="param">state</td><td>Current config parse state.</td>
- <tr><td class="param">key</td><td>Directive key name.</td>
- <tr><td class="param">value</td><td>Directive key value.</td>
- </table></dd></dl>
- <dl><dt>Returns:</dt><dd>Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.</dd></dl>
- <dl><dt><b>API</b> Stability:</dt><dd>Evolving.</dd></dl>
- <dl><dt>See Also:</dt><dd>
- <a href="#group___ma_state" class="ref">MaState</a>, <a href="#group___ma_state_1ga0625b7b754d921353acac4505eb9de02" class="ref">maAddDirective</a>, <a href="#group___ma_state_1ga2ff0312d66ba2c173b2ff6882e1f4ce9" class="ref">maPopState</a>, <a href="#group___ma_state_1gad960c7ab5089293e33a0cf221f41072d" class="ref">maPushState</a>, <a href="#group___ma_state_1gabb856e86d408307d5e31ad0ff2d2f69a" class="ref">maTokenize</a></dd></dl>
- </div>
- </div>
|