1
0
mirror of https://github.com/ubf/ubf.git synced 2026-04-25 14:18:11 +00:00
Files
ubf/edoc/ubf_server.html

205 lines
9.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Module ubf_server</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>
<h1>Module ubf_server</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>UBF server-side public API.
<h2><a name="description">Description</a></h2><p>UBF server-side public API.</p>
<p>TO-DO: JoeNorton, ubf_server:start([file_plugin], 2000, [jsf])
will give a JSON-speaking server that has a lot of difficulty
decoding and encoding stuff. Do you have any plan to fix it?</p>
<p>This module implements most of the commonly-used server-side
functions: starting TCP listeners and registering their
implementation callback modules.</p>
<p>We implement three different wire formats for accessing the same
implementation of a UBF(B) protocol-checking server:</p>
<ul>
<li> UBF(A). This is Joe Armstrong's original implementation.
See <a href="http://www.sics.se/~joe/ubf/">
http://www.sics.se/~joe/ubf/</a> for details. </li>
<li> EBF, a.k.a. Erlang Binary Format. This protocol uses common
Erlang wire formats, the <tt>{packet, 4}</tt> protocol from
'inets' for TCP connections, and the
<tt>term_to_binary()</tt>/<tt>binary_to_term()</tt> BIFs for
payload encoding. These wire formats are used to pass Erlang
terms between a UBF(B) contract checking server and a client
that does not support the UBF(A) wire format but does support
Erlang's native wire formats. </li>
<li> JSF, a.k.a the JSON Server Format. Similar to EBF, except
that JavaScript's JSON encoding is used for the wire protocol
instead of UBF(A) or Erlang's native wire formats.
NOTE: This server is currently incomplete. Source code from
Gemini Mobile Technologies, Inc. is not yet available to
help glue JSF-style encoding to a full HTTP/JSON-RPC service.
</li>
</ul>
<p>TO-DO: There is no "stop" function.</p>
See the documentation for the <tt>file_plugin</tt> module for
extra commentary on writing an UBF server implementation module.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#ask_manager-2">ask_manager/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#help-0">help/0*</a></td><td></td></tr>
<tr><td valign="top"><a href="#init-5">init/5</a></td><td></td></tr>
<tr><td valign="top"><a href="#sendEvent-2">sendEvent/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#start-2">start/2</a></td><td>Start a server and a TCP listener on port Port and register
all of the protocol implementation modules in the PluginModules
list.</td></tr>
<tr><td valign="top"><a href="#start-3">start/3</a></td><td>Start a registered server and a TCP listener on port Port and
register all of the protocol implementation modules in the
PluginModules list.</td></tr>
<tr><td valign="top"><a href="#start-4">start/4</a></td><td>Start a registered server and a TCP listener on port Port with
the Options properties list and register all of the protocol
implementation modules in the PluginModules list.</td></tr>
<tr><td valign="top"><a href="#start_link-2">start_link/2</a></td><td>See start/2, but also link the server processs to the caller.</td></tr>
<tr><td valign="top"><a href="#start_link-3">start_link/3</a></td><td>See start/3, but also link the server processs to the caller.</td></tr>
<tr><td valign="top"><a href="#start_link-4">start_link/4</a></td><td>See start/4, but also link the server processs to the caller.</td></tr>
<tr><td valign="top"><a href="#start_proc-3">start_proc/3*</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_registered-2">start_registered/2*</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_server-3">start_server/3*</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_term_listener-3">start_term_listener/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#start_ubf_listener-4">start_ubf_listener/4*</a></td><td></td></tr>
</table>
<h2><a name="functions">Function Details</a></h2>
<h3 class="function"><a name="ask_manager-2">ask_manager/2</a></h3>
<div class="spec">
<p><tt>ask_manager(Manager, Q) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="help-0">help/0 *</a></h3>
<div class="spec">
<p><tt>help() -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="init-5">init/5</a></h3>
<div class="spec">
<p><tt>init(Name, Parent, PluginModules, Port, Options) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="sendEvent-2">sendEvent/2</a></h3>
<div class="spec">
<p><tt>sendEvent(Pid, Msg) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start-2">start/2</a></h3>
<div class="spec">
<p><tt>start(PluginModules::list(atom()), Port::integer()) -&gt; true</tt></p>
</div><p><p>Start a server and a TCP listener on port Port and register
all of the protocol implementation modules in the PluginModules
list.</p>
Here we start the server.</p>
<h3 class="function"><a name="start-3">start/3</a></h3>
<div class="spec">
<p><tt>start(Name::atom(), PluginModules::list(atom()), Port::integer()) -&gt; true</tt></p>
</div><p><p>Start a registered server and a TCP listener on port Port and
register all of the protocol implementation modules in the
PluginModules list. If Name is undefined, the server is not
registered.</p>
Here we start the server.</p>
<h3 class="function"><a name="start-4">start/4</a></h3>
<div class="spec">
<p><tt>start(Name::atom(), PluginModules::list(atom()), Port::integer(), Options::<a href="#type-proplist">proplist()</a>) -&gt; true</tt></p>
</div><p><p>Start a registered server and a TCP listener on port Port with
the Options properties list and register all of the protocol
implementation modules in the PluginModules list. If Name is
undefined, the server is not registered</p>
Valid properties in the Options proplist are:
<ul>
<li> {idletimer, integer() | infinity} ... Maximum time (in milliseconds)
that a client connection may remain idle before the server will
close the connection.
Default: infinity </li>
<li> {maxconn, integer()} ... Maximum number of simultaneous TCP
connections allowed.
Default: 10,000. </li>
<li> {proto, {ubf | ebf | jsf}} ... Enable the UBF, EBF, or JSF version
of the protocol's wire format.
Default: ubf. </li>
<li> {serverhello, string()} ... Meta contract greeting string, sent
when a client first connects to the server.
Default: "meta_server" </li>
<li> {statelessrpc, true | false} ... run the stateless variety of
a UBF(B) contract. A stateless contract is an extension of
Joe Armstrong's original UBF server implementation.
Default: false.
TO-DO: JoeNorton, add more? </li>
<li> {proto, {ubf | ebf | jsf}} ... Enable the UBF, EBF, or JSF version
of the protocol's wire format.
Default: ubf. </li>
<li> {verboserpc, true | false} ... Set the verbose RPC mode.
Default: false. </li>
<li> {registeredname, atom()} ... Set the name to be registered for
the TCP listener. If undefined, a default name is automatically
registered.
Default: undefined. </li>
<li> TO-DO: JoeNorton, add more? </li>
</ul></p>
<h3 class="function"><a name="start_link-2">start_link/2</a></h3>
<div class="spec">
<p><tt>start_link(PluginModules::list(atom()), Port::integer()) -&gt; true</tt></p>
</div><p>See start/2, but also link the server processs to the caller.</p>
<h3 class="function"><a name="start_link-3">start_link/3</a></h3>
<div class="spec">
<p><tt>start_link(Name::atom(), PluginModules::list(atom()), Port::integer()) -&gt; true</tt></p>
</div><p>See start/3, but also link the server processs to the caller.</p>
<h3 class="function"><a name="start_link-4">start_link/4</a></h3>
<div class="spec">
<p><tt>start_link(Name::atom(), PluginModules::list(atom()), Port::integer(), Options::<a href="#type-proplist">proplist()</a>) -&gt; true</tt></p>
</div><p>See start/4, but also link the server processs to the caller.</p>
<h3 class="function"><a name="start_proc-3">start_proc/3 *</a></h3>
<div class="spec">
<p><tt>start_proc(Parent, Name, F) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_registered-2">start_registered/2 *</a></h3>
<div class="spec">
<p><tt>start_registered(Name, F) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_server-3">start_server/3 *</a></h3>
<div class="spec">
<p><tt>start_server(PluginModules, Port, Options) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_term_listener-3">start_term_listener/3</a></h3>
<div class="spec">
<p><tt>start_term_listener(Server, PluginModules, Options) -&gt; any()</tt></p>
</div>
<h3 class="function"><a name="start_ubf_listener-4">start_ubf_listener/4 *</a></h3>
<div class="spec">
<p><tt>start_ubf_listener(MetaServerModule, Port, Server, Options) -&gt; any()</tt></p>
</div>
<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated EDoc, $Id$</i></p>
</body>
</html>