Skip to content

Commit

Permalink
evapi: documentation for evapi broadcast functions
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed May 6, 2016
1 parent 2236da9 commit 4fa443a
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 24 deletions.
56 changes: 44 additions & 12 deletions modules/evapi/README
Expand Up @@ -33,8 +33,10 @@ Daniel-Constantin Mierla

4.1. evapi_relay(evdata)
4.2. evapi_async_relay(evdata)
4.3. evapi_close()
4.4. evapi_set_tag(tname)
4.3. evapi_multicast(evdata, etag)
4.4. evapi_async_multicast(evdata, etag)
4.5. evapi_close()
4.6. evapi_set_tag(tname)

5. Event routes

Expand All @@ -52,8 +54,10 @@ Daniel-Constantin Mierla
1.4. evapi_relay usage
1.5. TCP message
1.6. evapi_async_relay usage
1.7. evapi_close usage
1.8. evapi_set_tag usage
1.7. evapi_multicast usage
1.8. evapi_async_multicast usage
1.9. evapi_close usage
1.10. evapi_set_tag usage

Chapter 1. Admin Guide

Expand All @@ -75,8 +79,10 @@ Chapter 1. Admin Guide

4.1. evapi_relay(evdata)
4.2. evapi_async_relay(evdata)
4.3. evapi_close()
4.4. evapi_set_tag(tname)
4.3. evapi_multicast(evdata, etag)
4.4. evapi_async_multicast(evdata, etag)
4.5. evapi_close()
4.6. evapi_set_tag(tname)

5. Event routes

Expand Down Expand Up @@ -159,8 +165,10 @@ modparam("evapi", "netstring_format", 0)

4.1. evapi_relay(evdata)
4.2. evapi_async_relay(evdata)
4.3. evapi_close()
4.4. evapi_set_tag(tname)
4.3. evapi_multicast(evdata, etag)
4.4. evapi_async_multicast(evdata, etag)
4.5. evapi_close()
4.6. evapi_set_tag(tname)

4.1. evapi_relay(evdata)

Expand Down Expand Up @@ -214,13 +222,37 @@ evapi_async_relay("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}");
...

4.3. evapi_close()
4.3. evapi_multicast(evdata, etag)

Relay the event data given as parameter to connections that match the
tag provided by etag value. The etag can be a variable. For more see
evapi_relay() and evapi_set_tag().

Example 1.7. evapi_multicast usage
...
evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}", "tagx")
;
...

4.4. evapi_async_multicast(evdata, etag)

Async relay the event data given as parameter to connections that match
the tag provided by etag value. The etag can be a variable. For more
see evapi_async_relay() and evapi_set_tag().

Example 1.8. evapi_async_multicast usage
...
evapi_async_multicast("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}", "tagx");
...

4.5. evapi_close()

Close evapi current client connection.

This function can be used from ANY_ROUTE.

Example 1.7. evapi_close usage
Example 1.9. evapi_close usage
...
event_route[evapi:connection-new] {
if($evapi(srcaddr)!="127.0.0.1") {
Expand All @@ -230,15 +262,15 @@ event_route[evapi:connection-new] {
}
...

4.4. evapi_set_tag(tname)
4.6. evapi_set_tag(tname)

Set tag name for current client connection. The parameters has to be a
string up to 64 characters. It can also be a variable holding such
string.

This function can be used from ANY_ROUTE.

Example 1.8. evapi_set_tag usage
Example 1.10. evapi_set_tag usage
...
event_route[evapi:connection-new] {
if($evapi(srcaddr)=="127.0.0.1") {
Expand Down
63 changes: 51 additions & 12 deletions modules/evapi/doc/evapi_admin.xml
Expand Up @@ -127,10 +127,10 @@ modparam("evapi", "netstring_format", 0)
<section>
<title>Functions</title>
<section id="evapi.f.evapi_relay">
<title>
<title>
<function moreinfo="none">evapi_relay(evdata)</function>
</title>
<para>
</title>
<para>
Relay the event data given as parameter to connected applications.
</para>
<para>
Expand All @@ -154,7 +154,7 @@ modparam("evapi", "netstring_format", 0)
evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}");
...
</programlisting>
</example>
</example>
<para>
The above exaple will send the following message over tcp:
</para>
Expand All @@ -168,14 +168,14 @@ evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}");
},
...
</programlisting>
</example>
</example>
</section>

<section id="evapi.f.evapi_async_relay">
<title>
<title>
<function moreinfo="none">evapi_async_relay(evdata)</function>
</title>
<para>
</title>
<para>
Relay the event data given as parameter to connected applications. Before
evaluating the parameter, the request processing is suspended using
tm module (using the t_suspend()/t_continue() framework). The routing
Expand All @@ -199,14 +199,53 @@ evapi_async_relay("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}");
...
</programlisting>
</example>
</example>
</section>

<section id="evapi.f.evapi_multicast">
<title>
<function moreinfo="none">evapi_multicast(evdata, etag)</function>
</title>
<para>
Relay the event data given as parameter to connections that match
the tag provided by etag value. The etag can be a variable. For more
see evapi_relay() and evapi_set_tag().
</para>
<example>
<title><function>evapi_multicast</function> usage</title>
<programlisting format="linespecific">
...
evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}", "tagx");
...
</programlisting>
</example>
</section>

<section id="evapi.f.evapi_async_multicast">
<title>
<function moreinfo="none">evapi_async_multicast(evdata, etag)</function>
</title>
<para>
Async relay the event data given as parameter to connections that match
the tag provided by etag value. The etag can be a variable. For more
see evapi_async_relay() and evapi_set_tag().
</para>
<example>
<title><function>evapi_async_multicast</function> usage</title>
<programlisting format="linespecific">
...
evapi_async_multicast("{ \"event\": \"suspend\",\n \"data\":"
" { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}", "tagx");
...
</programlisting>
</example>
</section>

<section id="evapi.f.evapi_close">
<title>
<title>
<function moreinfo="none">evapi_close()</function>
</title>
<para>
</title>
<para>
Close evapi current client connection.
</para>
<para>
Expand Down

0 comments on commit 4fa443a

Please sign in to comment.