mirror of
https://github.com/ubf/ubf.git
synced 2026-04-21 20:25:57 +00:00
185 lines
9.7 KiB
HTML
185 lines
9.7 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 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.</li>
|
|
<li> TBF, a.k.a the Thrift Binary Format. Similar to EBF, except
|
|
that Thrift's binary encoding is used for the wire protocol
|
|
instead of UBF(A) or Erlang's native wire formats.</li>
|
|
<li> PBF, a.k.a the Google's Protocol Buffers Format. Similar to
|
|
EBF, except that Google's Protocol Buffers binary encoding is used
|
|
for the wire protocol instead of UBF(A) or Erlang's native wire
|
|
formats.</li>
|
|
<li> ABF, a.k.a the Avro Binary Format. Similar to EBF, except
|
|
that Avro's binary encoding is used for the wire protocol
|
|
instead of UBF(A) or Erlang's native wire formats.</li>
|
|
</ul>
|
|
|
|
<p>There is no "stop" function. To stop the server, instead stop the
|
|
TCP service manager that controls it: see the <code>proc_socket_server</code>
|
|
module for extra details.</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="#init-5">init/5</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 Plugins 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 Plugins
|
|
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 Plugins 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_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="init-5">init/5</a></h3>
|
|
<div class="spec">
|
|
<p><tt>init(Name, Parent, Plugins, Port, Options) -> any()</tt></p>
|
|
</div>
|
|
|
|
<h3 class="function"><a name="start-2">start/2</a></h3>
|
|
<div class="spec">
|
|
<p><tt>start(Plugins::list(atom()), Port::integer()) -> 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 Plugins 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(), Plugins::list(atom()), Port::integer()) -> 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 Plugins
|
|
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(), Plugins::list(atom()), Port::integer(), Options::<a href="#type-proplist">proplist()</a>) -> 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 Plugins 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 | atom()}} ... Enable the UBF, EBF, or
|
|
an alternative protocol wire format.
|
|
Default: ubf. </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> {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. </li>
|
|
<li> {startplugin, atom()} ... Set the starting plugin, set after a
|
|
client first connects to the server. If not set, client may
|
|
select the service using the startSession() API. There is
|
|
no default setting. </li>
|
|
<li> {serverhello, string() | undefined} ... Meta contract greeting
|
|
string, sent when a client first connects to the server. If
|
|
undefined, server hello is not sent to the client.
|
|
Default: "meta_server". </li>
|
|
<li> {simplerpc, true | false} ... Set the simple RPC mode. If
|
|
true, server returns only the rpc reply to client. If false,
|
|
server returns the rpc reply and next state to client.
|
|
Default: false. </li>
|
|
<li> {verboserpc, true | false} ... Set the verbose RPC mode. If
|
|
true, server calls the plugin handler with the rpc request and
|
|
matched contract types. If false, server calls the plugin
|
|
handler only with the rpc request.
|
|
Default: false. </li>
|
|
<li> {tlog_module, atom() | {atom(), boolean()}} ... Set the transaction
|
|
log callback module and optionally control the built-in calls
|
|
by 'contract_manager_tlog' to the 'error_logger' module.
|
|
If the 2-tuple representation is used and the boolean() member is
|
|
false, then calls to 'error_logger' will not be attempted.
|
|
Default: undefined. </li>
|
|
<li> {process_options, list()} ... Specify additional options used
|
|
for spawning server and/or client related erlang processes.
|
|
Typically used to specify non-default, garbage collection options.
|
|
Default: []. </li>
|
|
</ul>
|
|
</p>
|
|
|
|
<h3 class="function"><a name="start_link-2">start_link/2</a></h3>
|
|
<div class="spec">
|
|
<p><tt>start_link(Plugins::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(Name::atom(), Plugins::list(atom()), Port::integer()) -> 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(), Plugins::list(atom()), Port::integer(), Options::<a href="#type-proplist">proplist()</a>) -> true</tt></p>
|
|
</div><p>See start/4, 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(Server0, Plugins, 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 EDoc, $Id$</i></p>
|
|
</body>
|
|
</html>
|