<?xml version="1.0" encoding="utf-8"?>	
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
    
    <title>Process&#45;one</title>
    <link>http://www.process-one.net/en/wiki/</link>
    <description>Process&#45;one</description>
    <dc:language>en</dc:language>
    <dc:creator>contact@process-one.net</dc:creator>
    <dc:rights>Copyright 2006</dc:rights>
    <dc:date>2008-05-31T20:42:38+01:00</dc:date>
    <admin:generatorAgent rdf:resource="http://www.pmachine.com/" />
    

    <item>
      <title>ejabberd HTTP request handlers</title>
      <link>http://www.process&#45;one.net/en/wiki/ejabberd_HTTP_request_handlers/</link>
      <guid>http://www.process&#45;one.net/en/wiki/ejabberd_HTTP_request_handlers/</guid>
      <description><![CDATA[	<p>The web server embedded in ejabberd can be extended by writing your own<br />
modules.</p>

	<h2>Tutorial</h2>

	<p>Assume that you want to write a simple &#8220;mod_http_hello&#8221; module to handle<br />
all requests whose URL path begins with &#8221;/hello&#8221;, such as:</p>

	<ul>
	<li>http://localhost:5280/hello/world</li>
		<li>http://localhost:5280/hello/hedgehog</li>
	</ul>

	<p>Start by writing a &#8220;mod_http_hello.erl&#8221; file that contains request<br />
handlers, which are clauses of the process/2 function.  For<br />
example, to handle a request with the &#8221;/hello/world&#8221; path:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">process</span><span style="color: #007700">(</span><span style="color: #0000BB">_LocalPath </span><span style="color: #007700">= </span><span style="color: #0000BB">&#91;</span><span style="color: #DD0000">"world"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">_Request</span><span style="color: #007700">) -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"html"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;</span><span style="color: #DD0000">"xmlns"</span><span style="color: #007700">, </span><span style="color: #DD0000">"http://www.w3.org/1999/xhtml"</span><span style="color: #0000BB">&#125;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"head"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"title"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;&#125;&#93;&#125;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"body"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"p"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;xmlcdata</span><span style="color: #007700">, </span><span style="color: #DD0000">"Hello, world!"</span><span style="color: #0000BB">&#125;&#93;&#125;&#93;&#125;&#93;&#125;</span><span style="color: #007700">;</span>
</code></div></p>

 (Note that the &#8220;hello&#8221; part is not taken care of here, since it&#8217;s common to all handlers.)

	<p>The entire mod_http_hello.erl file would look like:</p>

	<p><div class="codeblock"><code>
<span style="color: #007700">%%%----------------------------------------------------------------------<br />%%% </span><span style="color: #0000BB">File&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">: </span><span style="color: #0000BB">mod_http_hello</span><span style="color: #007700">.</span><span style="color: #0000BB">erl<br /></span><span style="color: #007700">%%% </span><span style="color: #0000BB">Author&nbsp;&nbsp;</span><span style="color: #007700">: </span><span style="color: #0000BB">Your Name </span><span style="color: #007700">&lt;</span><span style="color: #0000BB">your &#91;at&#93; email &#91;dot&#93; org</span><span style="color: #007700">&gt;<br />%%% </span><span style="color: #0000BB">Purpose </span><span style="color: #007700">: </span><span style="color: #0000BB">Sample module that </span><span style="color: #007700">extends </span><span style="color: #0000BB">embedded ejabberd HTTP server<br /></span><span style="color: #007700">%%% </span><span style="color: #0000BB">Created </span><span style="color: #007700">:<br />%%% </span><span style="color: #0000BB">Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">:<br />%%%----------------------------------------------------------------------<br /><br />-</span><span style="color: #0000BB">module</span><span style="color: #007700">(</span><span style="color: #0000BB">mod_http_hello</span><span style="color: #007700">).<br />-</span><span style="color: #0000BB">author</span><span style="color: #007700">(</span><span style="color: #DD0000">'your@email.org'</span><span style="color: #007700">).<br />-</span><span style="color: #0000BB">vsn</span><span style="color: #007700">(</span><span style="color: #DD0000">''</span><span style="color: #007700">).<br />-</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #0000BB">ejabberd_debug</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">).<br /><br />-</span><span style="color: #0000BB">behaviour</span><span style="color: #007700">(</span><span style="color: #0000BB">gen_mod</span><span style="color: #007700">).<br /><br />-</span><span style="color: #0000BB">export</span><span style="color: #007700">(</span><span style="color: #0000BB">&#91;<br />&nbsp;&nbsp;&nbsp;&nbsp;start</span><span style="color: #007700">/</span><span style="color: #0000BB">2</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">stop</span><span style="color: #007700">/</span><span style="color: #0000BB">1</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">process</span><span style="color: #007700">/</span><span style="color: #0000BB">2<br />&nbsp;&nbsp;&nbsp;&nbsp;&#93;</span><span style="color: #007700">).<br /><br />-include(</span><span style="color: #DD0000">"ejabberd.hrl"</span><span style="color: #007700">).<br />-include(</span><span style="color: #DD0000">"jlib.hrl"</span><span style="color: #007700">).<br />-include(</span><span style="color: #DD0000">"ejabberd_http.hrl"</span><span style="color: #007700">).<br /><br />%%%----------------------------------------------------------------------<br />%%% </span><span style="color: #0000BB">REQUEST HANDLERS<br /></span><span style="color: #007700">%%%----------------------------------------------------------------------<br /><br /></span><span style="color: #0000BB">process</span><span style="color: #007700">(</span><span style="color: #0000BB">&#91;</span><span style="color: #DD0000">"world"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">_Request</span><span style="color: #007700">) -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"html"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;</span><span style="color: #DD0000">"xmlns"</span><span style="color: #007700">, </span><span style="color: #DD0000">"http://www.w3.org/1999/xhtml"</span><span style="color: #0000BB">&#125;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"head"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"title"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;&#125;&#93;&#125;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"body"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"p"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;xmlcdata</span><span style="color: #007700">, </span><span style="color: #DD0000">"Hello, world!"</span><span style="color: #0000BB">&#125;&#93;&#125;&#93;&#125;&#93;&#125;</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">process</span><span style="color: #007700">(</span><span style="color: #0000BB">&#91;</span><span style="color: #DD0000">"produce_error"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">_Request</span><span style="color: #007700">) -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;400</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"h1"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlcdata</span><span style="color: #007700">, </span><span style="color: #DD0000">"400 Bad Request"</span><span style="color: #0000BB">&#125;&#93;&#125;&#125;</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">process</span><span style="color: #007700">(</span><span style="color: #0000BB">LocalPath</span><span style="color: #007700">, </span><span style="color: #0000BB">_Request</span><span style="color: #007700">) -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"html"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;</span><span style="color: #DD0000">"xmlns"</span><span style="color: #007700">, </span><span style="color: #DD0000">"http://www.w3.org/1999/xhtml"</span><span style="color: #0000BB">&#125;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"head"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"title"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;&#125;&#93;&#125;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"body"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #DD0000">"p"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;xmlcdata</span><span style="color: #007700">, </span><span style="color: #0000BB">io_lib</span><span style="color: #007700">:</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">"Called with path: ~p"</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;LocalPath&#93;</span><span style="color: #007700">)</span><span style="color: #0000BB">&#125;&#93;&#125;&#93;&#125;&#93;&#125;</span><span style="color: #007700">.<br /><br />%%%----------------------------------------------------------------------<br />%%% </span><span style="color: #0000BB">BEHAVIOUR CALLBACKS<br /></span><span style="color: #007700">%%%----------------------------------------------------------------------<br /><br /></span><span style="color: #0000BB">start</span><span style="color: #007700">(</span><span style="color: #0000BB">_Host</span><span style="color: #007700">, </span><span style="color: #0000BB">_Opts</span><span style="color: #007700">) -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ok</span><span style="color: #007700">.<br /><br /></span><span style="color: #0000BB">stop</span><span style="color: #007700">(</span><span style="color: #0000BB">_Host</span><span style="color: #007700">) -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ok</span><span style="color: #007700">.</span>
</code></div></p>

	<p>Modify ejabberd.cfg so that mod_http_hello is loaded when ejabberd starts:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;modules</span><span style="color: #007700">,<br /> </span><span style="color: #0000BB">&#91;<br />&nbsp;&nbsp;</span><span style="color: #007700">%% ...<br />&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;mod_http_hello</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#93;&#125;</span><span style="color: #007700">,<br />&nbsp;&nbsp;%% ...<br /> </span><span style="color: #0000BB">&#93;&#125;</span><span style="color: #007700">.</span>
</code></div></p>

	<p>Also in ejabberd.cfg, configure ejabberd_http so that it dispatches requests beginning with &#8221;/hello/&#8221; to mod_http_hello:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;5280</span><span style="color: #007700">, </span><span style="color: #0000BB">ejabberd_http</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;http_poll</span><span style="color: #007700">, </span><span style="color: #0000BB">web_admin</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;request_handlers</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;&#91;</span><span style="color: #DD0000">"hello"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">mod_http_hello&#125;&#93;&#125;&#93;&#125;</span>
</code></div></p>

	<h2>API</h2>

	<p>Apart from callbacks required by gen_mod, your module only has to implement (one or more clauses of) process/2:</p>

	<ul>
	<li>your_http_module:process(LocalPath, Request)</li>
	</ul>

	<p>The process/2 function handles an HTTP request.  It returns the data to be sent back to the client, optionally with a status code and additional headers.</p>

	<p>process/2 will be called with two arguments: LocalPath and Request.</p>

	<p>The <strong>LocalPath</strong> argument is a list containing the part of the requested URL path that is &#8220;local to the module&#8221;.</p>

	<p>Example: mod_foo was configured in ejabberd.cfg to handle requests whose path begins with &#8221;/a/b&#8221;:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;5280</span><span style="color: #007700">, </span><span style="color: #0000BB">ejabberd_http</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;http_poll</span><span style="color: #007700">, </span><span style="color: #0000BB">web_admin</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;request_handlers</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;&#91;</span><span style="color: #DD0000">"a"</span><span style="color: #007700">, </span><span style="color: #DD0000">"b"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">mod_foo&#125;&#93;&#125;&#93;&#125;</span>
</code></div></p>

	<p>User requests the URL:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">http</span><span style="color: #007700">:</span><span style="color: #FF8000">//server:5280/a/b/c/d</span>
</code></div></p>

	<p>Path &#8220;local to the module&#8221; will be:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">&#91;</span><span style="color: #DD0000">"c"</span><span style="color: #007700">, </span><span style="color: #DD0000">"d"</span><span style="color: #0000BB">&#93;</span>
</code></div></p>

	<p>Usually you will want to select a handler based on the local path instead of the full path (Request#request.path), so that server administrators can make the module available under the path prefix of their choice.</p>

	<p>The <strong>Request</strong> argument is a record containing information about the HTTP request as defined in ejabberd_http.hrl.  It consists of the following fields:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;<br />&nbsp;&nbsp;</span><span style="color: #DD0000">"request"</span><span style="color: #007700">,<br />&nbsp;&nbsp;</span><span style="color: #0000BB">method</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;%% </span><span style="color: #0000BB">HTTP method </span><span style="color: #007700">(</span><span style="color: #DD0000">"GET" </span><span style="color: #007700">or </span><span style="color: #DD0000">"POST"</span><span style="color: #007700">)<br />&nbsp;&nbsp;</span><span style="color: #0000BB">path</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%% </span><span style="color: #0000BB">Full path to requested resource<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">%% </span><span style="color: #0000BB">e</span><span style="color: #007700">.</span><span style="color: #0000BB">g</span><span style="color: #007700">. for </span><span style="color: #DD0000">"http://server:5280/a/b/c/d"</span><span style="color: #007700">: </span><span style="color: #0000BB">&#91;</span><span style="color: #DD0000">"a"</span><span style="color: #007700">, </span><span style="color: #DD0000">"b"</span><span style="color: #007700">, </span><span style="color: #DD0000">"c"</span><span style="color: #007700">, </span><span style="color: #DD0000">"d"</span><span style="color: #0000BB">&#93;<br />&nbsp;&nbsp;q</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%% </span><span style="color: #0000BB">Query part of the URL<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">%% </span><span style="color: #0000BB">e</span><span style="color: #007700">.</span><span style="color: #0000BB">g</span><span style="color: #007700">. for </span><span style="color: #DD0000">"http://server:5280/a/b/c/d?foo=bar"</span><span style="color: #007700">: </span><span style="color: #0000BB">&#91;&#123;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">, </span><span style="color: #DD0000">"bar"</span><span style="color: #0000BB">&#125;&#93;<br />&nbsp;&nbsp;us</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%% </span><span style="color: #0000BB">Authenticated user </span><span style="color: #007700">and </span><span style="color: #0000BB">server</span><span style="color: #007700">.&nbsp;&nbsp;</span><span style="color: #0000BB">Used in ejabberd_web_admin </span><span style="color: #007700">for </span><span style="color: #0000BB">now</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%% </span><span style="color: #0000BB">e</span><span style="color: #007700">.</span><span style="color: #0000BB">g</span><span style="color: #007700">. for </span><span style="color: #DD0000">"foo@jabber.server.org"</span><span style="color: #007700">: </span><span style="color: #0000BB">&#123;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">, </span><span style="color: #DD0000">"jabber.server.org"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;auth</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%% </span><span style="color: #0000BB">Information provided </span><span style="color: #007700">for </span><span style="color: #0000BB">HTTP</span><span style="color: #007700">-</span><span style="color: #0000BB">auth </span><span style="color: #007700">(if </span><span style="color: #0000BB">any</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%% </span><span style="color: #0000BB">e</span><span style="color: #007700">.</span><span style="color: #0000BB">g</span><span style="color: #007700">. for </span><span style="color: #0000BB">a user </span><span style="color: #DD0000">"john" </span><span style="color: #0000BB">who entered the password </span><span style="color: #DD0000">"secret"</span><span style="color: #007700">: </span><span style="color: #0000BB">&#123;</span><span style="color: #DD0000">"john"</span><span style="color: #007700">, </span><span style="color: #DD0000">"secret"</span><span style="color: #0000BB">&#125;<br />&nbsp;&nbsp;lang </span><span style="color: #007700">= </span><span style="color: #DD0000">""</span><span style="color: #007700">, %% </span><span style="color: #0000BB">Language code<br />&nbsp;&nbsp;data </span><span style="color: #007700">= </span><span style="color: #DD0000">""</span><span style="color: #007700">, %% </span><span style="color: #0000BB">POST data<br />&#125;</span>
</code></div></p>


 ]]></description>
      <dc:subject>ejabberd HTTP request handlers</dc:subject>
      <dc:date>2008-05-31T20:42:38+01:00</dc:date>
    </item>

    <item>
      <title>Talk:ejabberd HTTP request handlers</title>
      <link>http://www.process&#45;one.net/en/wiki/Talk:ejabberd_HTTP_request_handlers/</link>
      <guid>http://www.process&#45;one.net/en/wiki/Talk:ejabberd_HTTP_request_handlers/</guid>
      <description><![CDATA[	<p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;5280</span><span style="color: #007700">, </span><span style="color: #0000BB">ejabberd_http</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;http_poll</span><span style="color: #007700">, </span><span style="color: #0000BB">web_admin</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;request_handlers</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;&#91;</span><span style="color: #DD0000">"hello"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">mod_http_hello&#125;&#93;&#125;&#93;&#125;</span>
</code></div></p>

	<p>this if one http handler, but if two?</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">&#123;5280</span><span style="color: #007700">, </span><span style="color: #0000BB">ejabberd_http</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#91;http_poll</span><span style="color: #007700">, </span><span style="color: #0000BB">web_admin</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;request_handlers</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;&#91;</span><span style="color: #DD0000">"hello"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">mod_http_hello&#125;</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">&#123;request_handlers</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;&#123;&#91;</span><span style="color: #DD0000">"http-bind"</span><span style="color: #0000BB">&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">mod_http_bind&#125;&#93;&#125;</span>
</code></div></p>

	<p>am I right?</p>


 ]]></description>
      <dc:subject>Talk:ejabberd HTTP request handlers</dc:subject>
      <dc:date>2007-05-26T09:34:13+01:00</dc:date>
    </item>

    <item>
      <title>ejabberd events and hooks</title>
      <link>http://www.process&#45;one.net/en/wiki/ejabberd_events_and_hooks/</link>
      <guid>http://www.process&#45;one.net/en/wiki/ejabberd_events_and_hooks/</guid>
      <description><![CDATA[	<p><em>Return to <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_module_development%2F" title="ejabberd_module_development">ejabberd module development</a></em></p>

	<h2>Introduction</h2>

	<p>ejabberd provides an event mechanism. Each module can subscribe to events and a hook in the module code is called when the event occurs.</p>

	<h2>Example</h2>

	<p>The module <a href="https://forge.process-one.net/browse/ejabberd/trunk/src/mod_offline.erl?r=trunk">mod_offline.erl</a> is an example of how the events/hooks mechanism can be used.</p>

	<h2>API</h2>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">ejabberd_hooks</span><span style="color: #007700">:</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #0000BB">Hook</span><span style="color: #007700">, </span><span style="color: #0000BB">Host</span><span style="color: #007700">, </span><span style="color: #0000BB">Module</span><span style="color: #007700">, Function, </span><span style="color: #0000BB">Priority</span><span style="color: #007700">)<br /></span><span style="color: #0000BB">ejabberd_hooks</span><span style="color: #007700">:</span><span style="color: #0000BB">remove</span><span style="color: #007700">(</span><span style="color: #0000BB">Hook</span><span style="color: #007700">, </span><span style="color: #0000BB">Host</span><span style="color: #007700">, </span><span style="color: #0000BB">Module</span><span style="color: #007700">, Function, </span><span style="color: #0000BB">Priority</span><span style="color: #007700">)<br />* </span><span style="color: #0000BB">Hook </span><span style="color: #007700">= </span><span style="color: #0000BB">atom</span><span style="color: #007700">()<br />* </span><span style="color: #0000BB">Host </span><span style="color: #007700">= </span><span style="color: #0000BB">string</span><span style="color: #007700">()<br />* </span><span style="color: #0000BB">Module </span><span style="color: #007700">= </span><span style="color: #0000BB">atom</span><span style="color: #007700">()<br />* Function = </span><span style="color: #0000BB">atom</span><span style="color: #007700">()<br />* </span><span style="color: #0000BB">Priority </span><span style="color: #007700">= </span><span style="color: #0000BB">integer</span><span style="color: #007700">()</span>
</code></div></p>

	<p>The Hook parameter is the name of the event (see below). Host is the name of the virtual host related to the event. Module and Function describe the hook to be called when the event occurs. Priority is the hook rank, to determine in which order the hooks are run (when several hooks are defined for the same event), use it if you have dependencies between hooks.</p>

	<h2>List of events</h2>

	<p>The list of available events, and the type of corresponding hooks, is described below.</p>

	<h3>Events</h3>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">adhoc_local_items</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />adhoc_sm_items</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />c2s_stream_features</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">)<br /></span><span style="color: #0000BB">c2s_unauthenticated_iq</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">, </span><span style="color: #0000BB">IQ</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />disco_local_features</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Node</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />disco_local_identity</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Node</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />disco_local_items</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Node</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />disco_sm_features</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Node</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />disco_sm_identity</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Node</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />disco_sm_items</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Node</span><span style="color: #007700">, </span><span style="color: #0000BB">Lang</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Adhoc<br />ejabberd_ctl_process</span><span style="color: #007700">(</span><span style="color: #0000BB">Args</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">CtlStatus<br />filter_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">&#123;From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet&#125;</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#123;From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet&#125;<br />local_send_to_resource_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />offline_message_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />privacy_check_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">, </span><span style="color: #0000BB">PrivacyList</span><span style="color: #007700">, </span><span style="color: #0000BB">&#123;From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet&#125;</span><span style="color: #007700">, </span><span style="color: #0000BB">Dir</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">Auth<br />privacy_get_user_list</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">PrivacyList<br />privacy_iq_get</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">IQ</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#123;result</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet&#125; </span><span style="color: #007700">| </span><span style="color: #0000BB">&#123;error</span><span style="color: #007700">, </span><span style="color: #0000BB">Error&#125;<br />privacy_iq_set</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">IQ</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#123;result</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet&#125; </span><span style="color: #007700">| </span><span style="color: #0000BB">&#123;error</span><span style="color: #007700">, </span><span style="color: #0000BB">Error&#125;<br />privacy_updated_list</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">OldPrivacyList</span><span style="color: #007700">, </span><span style="color: #0000BB">NewPrivacyList</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">PrivacyList<br />pubsub_publish_item</span><span style="color: #007700">(</span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Node</span><span style="color: #007700">, </span><span style="color: #0000BB">ItemID</span><span style="color: #007700">, </span><span style="color: #0000BB">Payload</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />remove_user</span><span style="color: #007700">(</span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />resend_offline_messages_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#91;Route&#93;<br />resend_subscription_requests_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#91;Packet&#93;<br />roster_get</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">&#123;User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server&#125;</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#91;RosterItem&#93;<br />roster_get_jid_info</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">, </span><span style="color: #0000BB">JID</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#123;Subscription</span><span style="color: #007700">, </span><span style="color: #0000BB">Groups&#125;<br />roster_get_subscription_lists</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">&#123;&#91;FromSubscription&#93;</span><span style="color: #007700">, </span><span style="color: #0000BB">&#91;ToSubscription&#93;&#125;<br />roster_in_subscription</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">, </span><span style="color: #0000BB">JID</span><span style="color: #007700">, </span><span style="color: #0000BB">SubscriptionType</span><span style="color: #007700">, </span><span style="color: #0000BB">Reason</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">bool</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">roster_out_subscription</span><span style="color: #007700">(</span><span style="color: #0000BB">Acc</span><span style="color: #007700">, </span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">, </span><span style="color: #0000BB">JID</span><span style="color: #007700">, </span><span style="color: #0000BB">SubscriptionType</span><span style="color: #007700">, </span><span style="color: #0000BB">Reason</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">bool</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">roster_process_item</span><span style="color: #007700">(</span><span style="color: #0000BB">RosterItem</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">RosterItem<br />set_presence_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">, </span><span style="color: #0000BB">Resource</span><span style="color: #007700">, </span><span style="color: #0000BB">Priority</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">none<br />sm_register_connection_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">SID</span><span style="color: #007700">, </span><span style="color: #0000BB">JID</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />sm_remove_connection_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">SID</span><span style="color: #007700">, </span><span style="color: #0000BB">JID</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />unset_presence_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">User</span><span style="color: #007700">, </span><span style="color: #0000BB">Server</span><span style="color: #007700">, </span><span style="color: #0000BB">Resource</span><span style="color: #007700">, </span><span style="color: #0000BB">Status</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">void</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">user_available_hook</span><span style="color: #007700">(</span><span style="color: #0000BB">JID</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />user_receive_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">JID</span><span style="color: #007700">, </span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />user_send_packet</span><span style="color: #007700">(</span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok</span>
</code></div></p>

	<h3>Types</h3>

<code>To = From = JID = ServerJID = #jid</code> (see <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fjlib%2F" title="jlib">jlib</a>)<br />
<code>Packet = Payload = &amp;#123;xmlelement, Name, Attrs, SubEl&amp;#125;</code><br />
<code>IQ = #iq</code> (see <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fjlib%2F" title="jlib">jlib</a>)<br />
<code>Error = ?STANZA_ERROR/3</code> (see <a href="https://forge.process-one.net/browse/ejabberd/trunk/src/jlib.hrl?r=trunk">jlib.h</a>)<br />
<code>Lang = string()</code><br />
<code>Dir = in | out</code><br />
<code>Auth = allow | deny</code><br />
<code>PrivacyList = OldPrivacyList = NewPrivacyList = none | #userlist</code><br />
<code>CtlStatus = false | ?STATUS_SUCCESS | ?STATUS_ERROR | ?STATUS_USAGE | ?STATUS_BADRPC</code> (see <a href="https://forge.process-one.net/browse/ejabberd/trunk/src/ejabberd_ctl.hrl?r=trunk">ejabberd_ctl.hrl</a>&#8221;)<br />
<code>Adhoc = &amp;#123;result, I&amp;#125; | &amp;#123;error, Error&amp;#125; | empty</code><br />
<code>Arg = [string()]</code><br />
<code>Node = [string()]</code><br />
<code>ItemID = string()</code><br />
<code>Route = &amp;#123;route, From, To, Packet</code><br />
<code>RosterItem = #roster</code> (see <a href="https://forge.process-one.net/browse/ejabberd/trunk/src/mod_roster.hrl?r=trunk">mod_roster.hrl</a>)<br />
<code>Subscription = none | from | to | both | remove</code><br />
<code>SubscriptionType = subscribe | unsubscribe</code><br />
<code>Reason = string()</code><br />
<code>Groups = [string()]</code><br />
<code>SimpleJID = FromSubscription = ToSubscription = &amp;#123;User, Server, Resource&amp;#125;</code><br />
<code>User = string()</code><br />
<code>Server = string()</code><br />
<code>Resource = string()</code><br />
<code>Status = string()</code><br />
<code>SID = &amp;#123;Time, pid()&amp;#125;</code><br />
<code>Time = &amp;#123;MegaSecs, Secs, MicroSecs&amp;#125;</code> (see <a href="http://www.erlang.org/doc/doc-5.5.3/lib/kernel-2.11.3/doc/html/erlang.html#now/0">erlang:now/0</a>)<br />
<code>MegaSecs = Secs = MicroSecs = int()</code><br />
<code>Acc = same type as the return type of the function</code>


 ]]></description>
      <dc:subject>ejabberd events and hooks</dc:subject>
      <dc:date>2007-05-04T08:53:35+01:00</dc:date>
    </item>

    <item>
      <title>Writing a Tsung plugin</title>
      <link>http://www.process&#45;one.net/en/wiki/Writing_a_Tsung_plugin/</link>
      <guid>http://www.process&#45;one.net/en/wiki/Writing_a_Tsung_plugin/</guid>
      <description><![CDATA[	<p>This is a simple tutorial on writing a tsung plugin.</p>

	<p>Since tsung is used to test servers lets define a simple server for testing. <em>myserver.erl</em> provides 3 operations: echo, add and subtract.</p>

	<p><em>myserver.erl</em> assumes the first byte to be a control instruction followed by 2 or more byte data. The echo operation merely returns the byte data while add and subtract performs these operations on the 2 byte data before returning the results. See the code of <em>myserver.erl</em> for details.</p>

	<p>We assume the source files for tsung-1.2.1 are available. This example was compiled using Erlang OTP R11B-3.</p>

	<h2>Step 0. Download the source code for this tutorial</h2>

	<p>The source code for this tutorial is available: <a href="http://www.process-one.net/downloads/tutorials/tutorial_tsung_1.tgz">tutorial_tsung_1.tgz</a></p>

	<h2>Step 1. Create tsung configuration file</h2>

	<p>Based on the 3 operations we want to test we define the <em>myclient.xml</em> which <br />
will take place of <em>tsung.xml</em>. You will notice <em>myclient.xml</em> looks very much <br />
like any normal tsung configuration file. The main difference is in the <br />
session definition. Here we use the <em>ts_myclient</em> type.</p>

	<p><div class="codeblock"><code>
<span style="color: #007700">&lt;</span><span style="color: #0000BB">session probability</span><span style="color: #007700">=</span><span style="color: #DD0000">"100" </span><span style="color: #0000BB">name</span><span style="color: #007700">=</span><span style="color: #DD0000">"myclient-example" </span><span style="color: #0000BB">type</span><span style="color: #007700">=</span><span style="color: #DD0000">"ts_myclient"</span><span style="color: #007700">&gt;</span>
</code></div></p>

	<p>This indicates which plugin tsung should call when creating a server request.<br />
We choose to name this plugin <em>ts_myclient</em>.</p>

	<p>The next difference is within the request element. Here we define a &#8216;myclient&#8217;<br />
element indicates the operations to test followed by the relevant data.</p>

	<p>Notice that <em>myclient</em> has 2 attributes: <em>type</em> and <em>arith</em> (optional). </p>

	<h2>Step 2. Update DTD</h2>

	<p>We now need to modify the <em>tsung-1.0.dtd</em> or validation would fail.</p>

	<p>In the request element we add the <em>myclient</em> tag. </p>

	<p><div class="codeblock"><code>
<span style="color: #007700">&lt;!</span><span style="color: #0000BB">ELEMENT request </span><span style="color: #007700">( </span><span style="color: #0000BB">match</span><span style="color: #007700">*, </span><span style="color: #0000BB">dyn_variable</span><span style="color: #007700">*, ( </span><span style="color: #0000BB">http </span><span style="color: #007700">| </span><span style="color: #0000BB">jabber </span><span style="color: #007700">| </span><span style="color: #0000BB">raw </span><span style="color: #007700">| </span><span style="color: #0000BB">pgsql </span><span style="color: #007700">| </span><span style="color: #0000BB">myclient </span><span style="color: #007700">) )&gt;</span>
</code></div></p>

	<p>Next we create the <em>myclient</em> element. </p>

	<p><div class="codeblock"><code>
<span style="color: #007700">&lt;!</span><span style="color: #0000BB">ELEMENT myclient </span><span style="color: #007700">(</span><span style="color: #FF8000">#PCDATA) &gt;</span>
</code></div></p>

	<p>Followed by defining the attributes list for <em>myclient</em>.</p>

	<p><div class="codeblock"><code>
<span style="color: #007700">&lt;!</span><span style="color: #0000BB">ATTLIST myclient<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arith&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">add </span><span style="color: #007700">| </span><span style="color: #0000BB">sub</span><span style="color: #007700">) </span><span style="color: #FF8000">#IMPLIED<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">(echo | </span><span style="color: #0000BB">compute</span><span style="color: #007700">) </span><span style="color: #FF8000">#REQUIRED &gt;</span>
</code></div></p>

	<p>Next, we add the <em>ts_myclient</em> option into the element&#8217;s <em>type</em> attribute list.</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">ts_http </span><span style="color: #007700">| </span><span style="color: #0000BB">ts_jabber </span><span style="color: #007700">| </span><span style="color: #0000BB">ts_pgsql </span><span style="color: #007700">| </span><span style="color: #0000BB">ts_myclient </span><span style="color: #007700">) </span><span style="color: #FF8000">#IMPLIED</span>
</code></div></p>

	<p>We do the same to the session&#8217;s <em>type</em> attribute list.</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">ts_jabber </span><span style="color: #007700">| </span><span style="color: #0000BB">ts_http </span><span style="color: #007700">| </span><span style="color: #0000BB">ts_raw </span><span style="color: #007700">| </span><span style="color: #0000BB">ts_pgsql </span><span style="color: #007700">| </span><span style="color: #0000BB">ts_myclient </span><span style="color: #007700">) </span><span style="color: #FF8000">#REQUIRED&gt;</span>
</code></div></p>

	<h2>Step 3. Create include file</h2>

	<p>In <em>PATH/include</em> create the include file <em>ts_myclient.hrl</em>. <br />
This include file should have a minimum of two records:</p>
	<ol>
	<li><em>myclient_request</em>: for storing request information parsed from tsung configuration. Will be use to generate server requests.</li>
		<li><em>myclient_dyndata</em>: for storing dynamic information. Not used in this case. </li>
	</ol>

	<h2>Step 4. Config reader</h2>

	<p>Create the <em>ts_config_myclient.erl</em> in <em>PATH/src/tsung_controller</em> to parse the XML file. This file must export <em>parse_config/2</em>.<br />
<em>ts_config_myclient:parse_config/2</em> is called from <em>ts_config:parse/1</em>.</p>

	<p>However trying to run <em>ts_config:parse/1</em> seperately seem to throw an undefined case error. </p>

	<p>The important function definition is:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">parse_config</span><span style="color: #007700">(</span><span style="color: #0000BB">Element </span><span style="color: #007700">= </span><span style="color: #FF8000">#xmlElement&#123;name=myclient&#125;, ...)</span>
</code></div></p>

	<p>Within this pattern we gather the various attributes, echo, compute, add, sub,<br />
and data creating a <em>myclient_request</em> record as needed. Notice for the case<br />
of type <em>compute</em> we parse the data into a list of 2 integers. Ensure you keep<br />
any data manipulation here consistant with calls in <em>ts_myclient:get_message/1</em>.</p>

	<p>If your configuration file support several element types then you will need a <em>parse_config</em> function for each.</p>

	<h2>Step 5. ts_myclient</h2>

	<p>The final file to create is <em>ts_myclient.erl</em> in <em>PATH/src/tsung</em>. </p>

	<p>The <em>get_message/1</em> function builds the actual data to be transmitted to the server. The function returns a binary even if your protocol uses strings.</p>

	<p>In <em>ts_myclient:get_message/1</em>, you can see how we create the message from the <em>myclient_request</em> record. Compare this with <em>myserver:test/3</em> and <em>myserver:test/1</em>.</p>

	<p><em>parse/2</em> deals with server responses. It is possible to parse the return data and update monitoring parameters. In the <em>ts_myclient:parse/1</em> we count the number of single and multi bytes returned from the server. Obviously these must match <em>echo</em> and <em>add / _sub</em> calls.</p>

	<p>The <em>ts_mon:add/1</em> parameters are restricted to:</p>
	<ol>
	<li>&#123;count, Type&#125;  &#8211; increments a running counter</li>
		<li>&#123;sum, Type, Val&#125; &#8211; adds <em>Val</em> to running counter</li>
		<li>&#123;sample_counter, Type, Value&#125; &#8211; updates <em>sample_counter</em></li>
		<li>&#123;sample, Type, Value&#125; &#8211; updates <em>counter</em></li>
	</ol>

	<h2>Step 6. Build and install</h2>

	<p>Return to PATH and type <em>make</em> followed by <em>make install</em>. </p>

	<p>There is no need to update any make files.</p>

	<h2>Step 7. Running</h2>

	<p>Start myserver then call <em>myserver:server()</em> in the erlang shell to start listening to the socket.</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">sh</span><span style="color: #007700">&gt; </span><span style="color: #0000BB">erl </span><span style="color: #007700">-</span><span style="color: #0000BB">s myserver start_link<br />1</span><span style="color: #007700">&gt; </span><span style="color: #0000BB">myserver</span><span style="color: #007700">:</span><span style="color: #0000BB">server</span><span style="color: #007700">().</span>
</code></div></p>

	<p>Run tsung, passing it <em>myclient.xml</em>:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">sh</span><span style="color: #007700">&gt; </span><span style="color: #0000BB">tsung </span><span style="color: #007700">-</span><span style="color: #0000BB">f myclient</span><span style="color: #007700">.</span><span style="color: #0000BB">xml</span>
</code></div></p>

	<h2>Authors</h2>

	<p>The first version of this tutorial has been written by tty.</p>

	<p><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2FCategory%3Atutorials%2F" title="Category:tutorials">Category:tutorials</a></p>


 ]]></description>
      <dc:subject>Writing a Tsung plugin</dc:subject>
      <dc:date>2007-03-25T17:41:27+01:00</dc:date>
    </item>

    <item>
      <title>Tsung</title>
      <link>http://www.process&#45;one.net/en/wiki/Tsung/</link>
      <guid>http://www.process&#45;one.net/en/wiki/Tsung/</guid>
      <description><![CDATA[	<p>Tsung is a high-performance, high-load benchmark platform.</p>

	<p>Here is some documentation, mainly targetting developers of contributed modules:</p>
 &#8211; tutorial: <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2FWriting_a_Tsung_plugin%2F" title="Writing_a_Tsung_plugin">Writing a Tsung plugin</a>


 ]]></description>
      <dc:subject>Tsung</dc:subject>
      <dc:date>2007-03-25T15:38:20+01:00</dc:date>
    </item>

    <item>
      <title>index</title>
      <link>http://www.process&#45;one.net/en/wiki/index/</link>
      <guid>http://www.process&#45;one.net/en/wiki/index/</guid>
      <description><![CDATA[	<h1>Documentation</h1>

	<h2>ejabberd</h2>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd%2F" title="ejabberd">ejabberd documentation</a></li>
	</ul>

	<h2>Tsung</h2>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2FTsung%2F" title="Tsung">tsung documentation</a></li>
	</ul>


 ]]></description>
      <dc:subject>index</dc:subject>
      <dc:date>2007-03-25T13:15:05+01:00</dc:date>
    </item>

    <item>
      <title>ejabberd module development</title>
      <link>http://www.process&#45;one.net/en/wiki/ejabberd_module_development/</link>
      <guid>http://www.process&#45;one.net/en/wiki/ejabberd_module_development/</guid>
      <description><![CDATA[	<h2>Introduction</h2>

	<p>ejabberd internal modules works as plugins. Each module is an <a href="http://erlang.org/">erlang</a> module with a name beginning with &#8220;mod_&#8221;. If you don&#8217;t already know Erlang, you should also take a look at this <a href="http://erlang.org/doc/doc-5.5.3/doc/getting_started/part_frame.html">doc</a>.</p>

	<h2>API of the module</h2>

	<p>All the internal modules must use the &#8220;gen_mod&#8221; behavior.</p>

	<p>It must provide the following API:</p>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">start</span><span style="color: #007700">(</span><span style="color: #0000BB">Host</span><span style="color: #007700">, </span><span style="color: #0000BB">Opts</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br />stop</span><span style="color: #007700">(</span><span style="color: #0000BB">Host</span><span style="color: #007700">) -&gt; </span><span style="color: #0000BB">ok<br /></span><span style="color: #007700">* </span><span style="color: #0000BB">Host </span><span style="color: #007700">= </span><span style="color: #0000BB">string</span><span style="color: #007700">()<br />* </span><span style="color: #0000BB">Opts </span><span style="color: #007700">= </span><span style="color: #0000BB">&#91;&#123;Name</span><span style="color: #007700">, </span><span style="color: #0000BB">Value&#125;&#93;<br /></span><span style="color: #007700">* </span><span style="color: #0000BB">Name </span><span style="color: #007700">= </span><span style="color: #0000BB">Value </span><span style="color: #007700">= </span><span style="color: #0000BB">string</span><span style="color: #007700">()</span>
</code></div></p>

	<p>Host is the name of the virtual host running the module. The start/2 and stop/1 functions are called for each virtual host at start and stop time of the server.<br />
Opts is a lists of options set in the configuration file for the module. They can be retrieved with the <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fgen_mod%2F" title="gen_mod">gen mod:get opt/3</a> function.</p>

	<h2>ejabberd API</h2>

	<p>The modules interact with ejabberd using one or several of the following mechanisms:</p>
	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_core_modules%2F" title="ejabberd_core_modules">ejabberd core modules</a></li>
		<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_events_and_hooks%2F" title="ejabberd_events_and_hooks">ejabberd events and hooks</a></li>
		<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_IQ_handlers%2F" title="ejabberd_IQ_handlers">ejabberd IQ handlers</a></li>
		<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_route_table%2F" title="ejabberd_route_table">ejabberd route table</a></li>
		<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_HTTP_request_handlers%2F" title="ejabberd_HTTP_request_handlers">ejabberd HTTP request handlers</a></li>
	</ul>

	<h2>Running an internal module as an external module</h2>

	<p>ejabberd internal modules using only the route table can also be used as external modules conform to <a href="http://www.xmpp.org/extensions/xep-0114.html"  title="Jabber Component Protocol">XEP-0114</a> with <a href="http://www.process-one.net/en/blogs/article/epeios_write_a_module_for_an_xmpp_server_once_run_it_everywhere/">epeios</a>, and thus, they can be used with any other XEP-0114 compliant XMPP servers.</p>


 ]]></description>
      <dc:subject>ejabberd module development</dc:subject>
      <dc:date>2007-02-28T14:03:22+01:00</dc:date>
    </item>

    <item>
      <title>ejabberd core modules</title>
      <link>http://www.process&#45;one.net/en/wiki/ejabberd_core_modules/</link>
      <guid>http://www.process&#45;one.net/en/wiki/ejabberd_core_modules/</guid>
      <description><![CDATA[	<p><em>Return to <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_module_development%2F" title="ejabberd_module_development">ejabberd module development</a></em></p>

	<h2>Router (ejabberd_router)</h2>

	<p>This module is the main router for XMPP packets on each node. It routes packets based on their destination domains. It has two tables: local and global routes. First, the destination domain of each packet is searched in local table. If found, the packet is routed to the appropriate process. Else, it searches in global table, and routes to the appropriate ejabberd node or process. If it does not exists in either tables, then the packet is sends to the S2S manager.</p>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_router%2F" title="ejabberd_router">Router API</a></li>
	</ul>

	<h2>Local router (ejabberd_local)</h2>

	<p>This module routes packets which have a destination domain equal to one of the virtual host name of the server. If destination JID has a non-empty user part, then it routes packets to the session manager, else it is processed depending on it&#8217;s content.</p>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_local%2F" title="ejabberd_local" class="noArticle">Local router API</a></li>
	</ul>

	<h2>Session manager (ejabberd_sm)</h2>

	<p>Handle the currently opened sessions.</p>

	<p>This module routes packets to local users. It determines which user resource the packet must be sent via the presence table. If this resource is connected to this node, it is routed to the C2S manager. If it&#8217;s connected via another node, then the packet is sent to the session manager on that node.</p>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_sm%2F" title="ejabberd_sm">Session manager API</a></li>
	</ul>

	<h2>Utilities (jlib)</h2>

	<p>Various helper functions. Modules should include the <a href="https://forge.process-one.net/browse/ejabberd/trunk/src/jlib.hrl?r=trunk">jlib.hrl</a> file in order to use the records defined by this module.</p>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fjlib%2F" title="jlib">jlib API</a></li>
	</ul>

	<h2>Modules utilities (gen_mod)</h2>

	<p>Utility functions useful in a module. This module also define the &#8220;gen_mod&#8221; behavior.</p>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fgen_mod%2F" title="gen_mod">gen mod API</a></li>
	</ul>

	<h2>XML utilities (xml)</h2>

	<p>Various utilities to manipulate XML packets.</p>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fxml%2F" title="xml">XML API</a></li>
	</ul>

	<h2>Relational database (ejabberd_odbc)</h2>

	<p>Used to run SQL queries.</p>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_odbc%2F" title="ejabberd_odbc">Relational database API</a></li>
	</ul>


 ]]></description>
      <dc:subject>ejabberd core modules</dc:subject>
      <dc:date>2007-02-26T13:27:12+01:00</dc:date>
    </item>

    <item>
      <title>ejabberd router</title>
      <link>http://www.process&#45;one.net/en/wiki/ejabberd_router/</link>
      <guid>http://www.process&#45;one.net/en/wiki/ejabberd_router/</guid>
      <description><![CDATA[	<p><em>Return the list of <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_core_modules%2F" title="ejabberd_core_modules">ejabberd core modules</a></em></p>

	<h2>Router (ejabberd_router)</h2>

	<p>This module is the main router for XMPP packets on each node. It routes packets based on their destination domains. It has two tables: local and global routes. First, the destination domain of each packet is searched in local table. If found, the packet is routed to the appropriate process. Else, it searches in global table, and routes to the appropriate ejabberd node or process. If it does not exists in either tables, then the packet is sends to the S2S manager.</p>

	<h3>API</h3>

	<h4>route/3</h4>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">route</span><span style="color: #007700">(</span><span style="color: #0000BB">From</span><span style="color: #007700">, </span><span style="color: #0000BB">To</span><span style="color: #007700">, </span><span style="color: #0000BB">Packet</span><span style="color: #007700">)<br />* </span><span style="color: #0000BB">Packet </span><span style="color: #007700">= </span><span style="color: #0000BB">&#123;xmlelement</span><span style="color: #007700">, </span><span style="color: #0000BB">Name</span><span style="color: #007700">, </span><span style="color: #0000BB">Attrs</span><span style="color: #007700">, </span><span style="color: #0000BB">SubEl&#125;<br /></span><span style="color: #007700">* </span><span style="color: #0000BB">Attrs </span><span style="color: #007700">= </span><span style="color: #0000BB">&#91;&#123;Name</span><span style="color: #007700">, </span><span style="color: #0000BB">Value&#125;&#93;<br /></span><span style="color: #007700">* </span><span style="color: #0000BB">Name </span><span style="color: #007700">= </span><span style="color: #0000BB">Value </span><span style="color: #007700">= </span><span style="color: #0000BB">string</span><span style="color: #007700">()<br />* </span><span style="color: #0000BB">SubEl </span><span style="color: #007700">= </span><span style="color: #0000BB">&#91;Packet&#93;</span>
</code></div><br />
Route an XML packet.</p>

	<h4>register_route/1 and unregister_route/1</h4>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">register_route</span><span style="color: #007700">(</span><span style="color: #0000BB">Host</span><span style="color: #007700">)<br /></span><span style="color: #0000BB">unregister_route</span><span style="color: #007700">(</span><span style="color: #0000BB">Host</span><span style="color: #007700">),<br />* </span><span style="color: #0000BB">Host </span><span style="color: #007700">= </span><span style="color: #0000BB">string</span><span style="color: #007700">()</span>
</code></div><br />
Host is the XMPP name of the route name. See the <a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_route_table%2F" title="ejabberd_route_table">routage mechanism of services</a> for more details.</p>

	<h4>dirty_get_all_routes/0</h4>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">dirty_get_all_routes</span><span style="color: #007700">() -&gt; </span><span style="color: #0000BB">&#91;RouteName&#93;<br /></span><span style="color: #007700">* </span><span style="color: #0000BB">RouteName </span><span style="color: #007700">= </span><span style="color: #0000BB">string</span><span style="color: #007700">()</span>
</code></div><br />
Return a list of all registered route names.</p>

	<h4>dirty_get_all_domains/0</h4>

	<p><div class="codeblock"><code>
<span style="color: #0000BB">dirty_get_all_domains</span><span style="color: #007700">() -&gt; </span><span style="color: #0000BB">&#91;Domains&#93;<br /></span><span style="color: #007700">* </span><span style="color: #0000BB">Domains </span><span style="color: #007700">= </span><span style="color: #0000BB">string</span><span style="color: #007700">()</span>
</code></div><br />
Return a list of all known domains.</p>


 ]]></description>
      <dc:subject>ejabberd router</dc:subject>
      <dc:date>2007-02-21T16:32:53+01:00</dc:date>
    </item>

    <item>
      <title>ejabberd</title>
      <link>http://www.process&#45;one.net/en/wiki/ejabberd/</link>
      <guid>http://www.process&#45;one.net/en/wiki/ejabberd/</guid>
      <description><![CDATA[	<h2>ejabberd documentation</h2>

	<ul>
	<li><a href="http://www.process-one.net/en?URL=http%3A%2F%2Fwww.process-one.net%2Fen%2Fwiki%2Fejabberd_module_development%2F" title="ejabberd_module_development">ejabberd module development</a></li>
	</ul>


 ]]></description>
      <dc:subject>ejabberd</dc:subject>
      <dc:date>2007-02-21T16:22:26+01:00</dc:date>
    </item>

    
    </channel>
</rss>