mirror of
https://github.com/ubf/ubf.git
synced 2026-04-28 15:48:00 +00:00
declare 1st Draft status
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>UBF Home Page</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /></head><body><div class="article" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id2861924"></a>UBF Home Page</h2></div></div><hr /></div><p>UBF, a framework for Getting Erlang to talk to the outside world.
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>UBF Home Page</title><link rel="stylesheet" href="./docbook-xsl.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /></head><body><div class="article" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id2977158"></a>UBF Home Page</h2></div></div><hr /></div><p>UBF, a framework for Getting Erlang to talk to the outside world.
|
||||
This document and the corresponding open-source code repositories are
|
||||
based on Joe Armstrong’s original UBF site and code with an MIT
|
||||
license file added to the distribution. Since then, a large number of
|
||||
|
||||
52
misc-codes/ubf_bertrpc_plugin.erl
Normal file
52
misc-codes/ubf_bertrpc_plugin.erl
Normal file
@@ -0,0 +1,52 @@
|
||||
%%% -*- mode: erlang -*-
|
||||
%%% @doc Sample BERT-RPC plugin.
|
||||
%%%
|
||||
%%%
|
||||
|
||||
-module(ubf_bertrpc_plugin).
|
||||
-behavior(ubf_plugin_stateless).
|
||||
|
||||
%% Required (except keepalive/0) callback API for UBF stateless
|
||||
%% implementations.
|
||||
-export([info/0, description/0, keepalive/0]).
|
||||
-export([handlerStart/1, handlerStop/3, handlerRpc/1, handlerEvent/1]).
|
||||
|
||||
-import(ubf_plugin_handler, [sendEvent/2, install_handler/2]).
|
||||
|
||||
-compile({parse_transform,contract_parser}).
|
||||
-add_contract("ubf_bertrpc_plugin").
|
||||
|
||||
-include("ubf.hrl").
|
||||
-include("ubf_plugin_stateless.hrl").
|
||||
|
||||
info() ->
|
||||
"I am a BERT-RPC server".
|
||||
|
||||
description() ->
|
||||
"A BERT-RPC server programmed by UBF".
|
||||
|
||||
keepalive() ->
|
||||
ok.
|
||||
|
||||
%% @doc start handler
|
||||
handlerStart(_Args) ->
|
||||
ack = install_handler(self(), fun handlerEvent/1),
|
||||
{accept,ok,none,unused}.
|
||||
|
||||
%% @doc stop handler
|
||||
handlerStop(_Pid, _Reason, _StateData) ->
|
||||
unused.
|
||||
|
||||
%% @doc rpc handler
|
||||
%% @TODO Implement BERT-RPC 1.0 synchronous events
|
||||
handlerRpc(Event) when Event==info; Event==description ->
|
||||
?S(?MODULE:Event());
|
||||
handlerRpc(Event) when Event==keepalive ->
|
||||
?MODULE:Event().
|
||||
|
||||
%% @doc event handler
|
||||
%% @TODO: Implement BERT-RPC 1.0 asynchronous events
|
||||
handlerEvent(Event) ->
|
||||
%% Let's fake it and echo the request
|
||||
sendEvent(self(), Event),
|
||||
fun handlerEvent/1.
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user