mirror of
https://github.com/ubf/ubf.git
synced 2026-05-01 17:18:08 +00:00
162 lines
7.9 KiB
HTML
162 lines
7.9 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, I can't seem to start multiple listeners, only
|
|
the first one succeeds. At a casual glance, that seems to be The
|
|
Current Correct Behavior, but it'd be awful nice to have multiple
|
|
listeners inside the same VM. Is there another way to do that?
|
|
ubf_server:start([file_plugin], 2000, []).
|
|
ubf_server:start([irc_plugin], 2001, []).</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="#init-4">init/4</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 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 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_term_listener-3">start_term_listener/3</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) -> any()</tt></p>
|
|
</div>
|
|
|
|
<h3 class="function"><a name="init-4">init/4</a></h3>
|
|
<div class="spec">
|
|
<p><tt>init(Parent, PluginModules, Port, Options) -> any()</tt></p>
|
|
</div>
|
|
|
|
<h3 class="function"><a name="sendEvent-2">sendEvent/2</a></h3>
|
|
<div class="spec">
|
|
<p><tt>sendEvent(Pid, Msg) -> 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()) -> true</tt></p>
|
|
</div><p><p>Start a TCP listener on port Port and register all of the
|
|
protocol implementation modules in the PluginModules list.</p>
|
|
|
|
Here we start the server.
|
|
This is the *only* registered process on the server side.</p>
|
|
|
|
<h3 class="function"><a name="start-3">start/3</a></h3>
|
|
<div class="spec">
|
|
<p><tt>start(PluginModules::list(atom()), Port::integer(), Options::<a href="#type-proplist">proplist()</a>) -> true</tt></p>
|
|
</div><p><p>Start a TCP listener on port Port with the Options properties
|
|
list and register all of the protocol implementation modules in the
|
|
PluginModules list.</p>
|
|
|
|
Valid properties in the Options proplist are:
|
|
<ul>
|
|
<li> {ebf, true | false} ... Enable the EBF version of the protocol's
|
|
wire format.
|
|
Only one of ebf, jsf, and ubf should be specified.
|
|
Default: false. </li>
|
|
<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> {jsf, true | false} ... Enable the JSON version of the protocol's
|
|
wire format.
|
|
Only one of ebf, jsf, and ubf should be specified.
|
|
Default: false. </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> {ubf, true | false} ... Enable the JSON version of the protocol's
|
|
wire format.
|
|
Only one of ebf, jsf, and ubf should be specified.
|
|
Default: true. </li>
|
|
<li> {verboserpc, true | false} ... Set the verbose RPC mode.
|
|
Default: false.
|
|
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()) -> 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(PluginModules::list(atom()), Port::integer(), Options::<a href="#type-proplist">proplist()</a>) -> true</tt></p>
|
|
</div><p>See start/3, but also link the server processs to the caller.</p>
|
|
|
|
<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) -> 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 by EDoc, Apr 19 2009, 21:35:58.</i></p>
|
|
</body>
|
|
</html>
|