فهرست منبع

evapi: documentation for evapi_set_tag(...)

Daniel-Constantin Mierla 9 سال پیش
والد
کامیت
ab2958ae0e
2فایلهای تغییر یافته به همراه59 افزوده شده و 10 حذف شده
  1. 31 9
      modules/evapi/README
  2. 28 1
      modules/evapi/doc/evapi_admin.xml

+ 31 - 9
modules/evapi/README

@@ -10,7 +10,7 @@ Daniel-Constantin Mierla
 
 
    <[email protected]>
    <[email protected]>
 
 
-   Copyright © 2014 asipto.com
+   Copyright © 2014 asipto.com
      __________________________________________________________________
      __________________________________________________________________
 
 
    Table of Contents
    Table of Contents
@@ -34,6 +34,7 @@ Daniel-Constantin Mierla
               4.1. evapi_relay(evdata)
               4.1. evapi_relay(evdata)
               4.2. evapi_async_relay(evdata)
               4.2. evapi_async_relay(evdata)
               4.3. evapi_close()
               4.3. evapi_close()
+              4.4. evapi_set_tag(tname)
 
 
         5. Event routes
         5. Event routes
 
 
@@ -51,7 +52,8 @@ Daniel-Constantin Mierla
    1.4. evapi_relay usage
    1.4. evapi_relay usage
    1.5. TCP message
    1.5. TCP message
    1.6. evapi_async_relay usage
    1.6. evapi_async_relay usage
-   1.7. evapi_evapi usage
+   1.7. evapi_close usage
+   1.8. evapi_set_tag usage
 
 
 Chapter 1. Admin Guide
 Chapter 1. Admin Guide
 
 
@@ -74,6 +76,7 @@ Chapter 1. Admin Guide
         4.1. evapi_relay(evdata)
         4.1. evapi_relay(evdata)
         4.2. evapi_async_relay(evdata)
         4.2. evapi_async_relay(evdata)
         4.3. evapi_close()
         4.3. evapi_close()
+        4.4. evapi_set_tag(tname)
 
 
    5. Event routes
    5. Event routes
 
 
@@ -157,8 +160,9 @@ modparam("evapi", "netstring_format", 0)
    4.1. evapi_relay(evdata)
    4.1. evapi_relay(evdata)
    4.2. evapi_async_relay(evdata)
    4.2. evapi_async_relay(evdata)
    4.3. evapi_close()
    4.3. evapi_close()
+   4.4. evapi_set_tag(tname)
 
 
-4.1.  evapi_relay(evdata)
+4.1. evapi_relay(evdata)
 
 
    Relay the event data given as parameter to connected applications.
    Relay the event data given as parameter to connected applications.
 
 
@@ -188,7 +192,7 @@ evapi_relay("{ \"event\": \"test\",\n \"data\": { \"fU\": \"$fU\" }\n}");
 },
 },
 ...
 ...
 
 
-4.2.  evapi_async_relay(evdata)
+4.2. evapi_async_relay(evdata)
 
 
    Relay the event data given as parameter to connected applications.
    Relay the event data given as parameter to connected applications.
    Before evaluating the parameter, the request processing is suspended
    Before evaluating the parameter, the request processing is suspended
@@ -210,13 +214,13 @@ evapi_async_relay("{ \"event\": \"suspend\",\n \"data\":"
         " { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}");
         " { \"index\": \"$T(id_index)\", \"label\": \"$T(id_label)\" }\n}");
 ...
 ...
 
 
-4.3.  evapi_close()
+4.3. evapi_close()
 
 
    Close evapi current client connection.
    Close evapi current client connection.
 
 
    This function can be used from ANY_ROUTE.
    This function can be used from ANY_ROUTE.
 
 
-   Example 1.7. evapi_evapi usage
+   Example 1.7. evapi_close usage
 ...
 ...
 event_route[evapi:connection-new] {
 event_route[evapi:connection-new] {
   if($evapi(srcaddr)!="127.0.0.1") {
   if($evapi(srcaddr)!="127.0.0.1") {
@@ -226,13 +230,31 @@ event_route[evapi:connection-new] {
 }
 }
 ...
 ...
 
 
+4.4. 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
+...
+event_route[evapi:connection-new] {
+  if($evapi(srcaddr)=="127.0.0.1") {
+    evapi_set_tag("local");
+    exit;
+  }
+}
+...
+
 5. Event routes
 5. Event routes
 
 
    5.1. evapi:connection-new
    5.1. evapi:connection-new
    5.2. evapi:connection-closed
    5.2. evapi:connection-closed
    5.3. evapi:message-received
    5.3. evapi:message-received
 
 
-5.1.  evapi:connection-new
+5.1. evapi:connection-new
 
 
    If defined, the module calls event_route[evapi:connection-new] when a
    If defined, the module calls event_route[evapi:connection-new] when a
    new client is connected.
    new client is connected.
@@ -242,7 +264,7 @@ event_route[evapi:connection-new] {
 }
 }
 ...
 ...
 
 
-5.2.  evapi:connection-closed
+5.2. evapi:connection-closed
 
 
    If defined, the module calls event_route[evapi:connection-closed] when
    If defined, the module calls event_route[evapi:connection-closed] when
    a client connection is closed.
    a client connection is closed.
@@ -252,7 +274,7 @@ event_route[evapi:connection-closed] {
 }
 }
 ...
 ...
 
 
-5.3.  evapi:message-received
+5.3. evapi:message-received
 
 
    If defined, the module calls event_route[evapi:message-received] when a
    If defined, the module calls event_route[evapi:message-received] when a
    message is received from a client.
    message is received from a client.

+ 28 - 1
modules/evapi/doc/evapi_admin.xml

@@ -213,7 +213,7 @@ evapi_async_relay("{ \"event\": \"suspend\",\n \"data\":"
 		This function can be used from ANY_ROUTE.
 		This function can be used from ANY_ROUTE.
 		</para>
 		</para>
 		<example>
 		<example>
-		<title><function>evapi_evapi</function> usage</title>
+		<title><function>evapi_close</function> usage</title>
 		<programlisting format="linespecific">
 		<programlisting format="linespecific">
 ...
 ...
 event_route[evapi:connection-new] {
 event_route[evapi:connection-new] {
@@ -227,6 +227,33 @@ event_route[evapi:connection-new] {
 	    </example>
 	    </example>
 	</section>
 	</section>
 
 
+	<section id="evapi.f.evapi_set_tag">
+	    <title>
+		<function moreinfo="none">evapi_set_tag(tname)</function>
+	    </title>
+	    <para>
+			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.
+		</para>
+		<para>
+		This function can be used from ANY_ROUTE.
+		</para>
+		<example>
+		<title><function>evapi_set_tag</function> usage</title>
+		<programlisting format="linespecific">
+...
+event_route[evapi:connection-new] {
+  if($evapi(srcaddr)=="127.0.0.1") {
+    evapi_set_tag("local");
+    exit;
+  }
+}
+...
+</programlisting>
+	    </example>
+	</section>
+
 	</section>
 	</section>
 
 
     <section>
     <section>