Module: sip-router Branch: master Commit: 5d45ea50a7ebb53cfcfb04553a3152e61d1e6831 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5d45ea50...
Author: Elena-Ramona Modroiu ramona@asipto.com Committer: Elena-Ramona Modroiu ramona@asipto.com Date: Mon Jun 3 11:13:56 2013 +0200
htable: documented the new rpc commands
- htable.sets and htable.seti
---
modules/htable/README | 70 +++++++++++++++++++++++++++------- modules/htable/doc/htable_admin.xml | 60 ++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 15 deletions(-)
diff --git a/modules/htable/README b/modules/htable/README index bf28a7a..2cf178e 100644 --- a/modules/htable/README +++ b/modules/htable/README @@ -17,7 +17,7 @@ Alex Balashov
- Copyright (c) 2008-2011 http://www.asipto.com + Copyright © 2008-2011 http://www.asipto.com __________________________________________________________________
Table of Contents @@ -63,9 +63,11 @@ Alex Balashov
7.1. htable.get htable key 7.2. htable.delete htable key - 7.3. htable.dump htable - 7.4. htable.reload htable - 7.5. htable.listTables + 7.3. htable.sets htable key value + 7.4. htable.seti htable key value + 7.5. htable.dump htable + 7.6. htable.reload htable + 7.7. htable.listTables
8. Event routes
@@ -134,9 +136,11 @@ Chapter 1. Admin Guide
7.1. htable.get htable key 7.2. htable.delete htable key - 7.3. htable.dump htable - 7.4. htable.reload htable - 7.5. htable.listTables + 7.3. htable.sets htable key value + 7.4. htable.seti htable key value + 7.5. htable.dump htable + 7.6. htable.reload htable + 7.7. htable.listTables
8. Event routes
@@ -160,7 +164,7 @@ Chapter 1. Admin Guide You can read more about hash tables at: http://en.wikipedia.org/wiki/Hash_table.
- The "name" can be a static string or can include pseudo- variables that + The “name” can be a static string or can include pseudo- variables that will be replaced at runtime.
Example 1.1. Accessing $sht(htname=>key) @@ -183,7 +187,7 @@ $sht(a=>$ci::srcip) = $si; the failed authentications per user and one for storing the time of last authentication attempt. To ensure unique name per user, the hash table uses a combination of authentication username and text - "::auth_count" and "::last_auth". + “::auth_count” and “::last_auth”.
Example 1.2. Dictionary attack limitation ... @@ -553,9 +557,11 @@ sht_rm_value_re("ha=>.*");
7.1. htable.get htable key 7.2. htable.delete htable key - 7.3. htable.dump htable - 7.4. htable.reload htable - 7.5. htable.listTables + 7.3. htable.sets htable key value + 7.4. htable.seti htable key value + 7.5. htable.dump htable + 7.6. htable.reload htable + 7.7. htable.listTables
7.1. htable.get htable key
@@ -589,7 +595,41 @@ kamcmd htable.get students daniel kamcmd htable.get students anna ...
-7.3. htable.dump htable +7.3. htable.sets htable key value + + Set an item in hash table to string value. + + Name: htable.sets + + Parameters: + * htable : Name of the hash table + * key : Key name in the hash table + * Value : String value for the item + + Example: +... +# Set $sht(test=>x) +kamcmd htable.sets test x abc +... + +7.4. htable.seti htable key value + + Set an item in hash table to integer value. + + Name: htable.seti + + Parameters: + * htable : Name of the hash table + * key : Key name in the hash table + * Value : Integer value for the item + + Example: +... +# Set $sht(test=>x) +kamcmd htable.sets test x 123 +... + +7.5. htable.dump htable
Lists all the values in a hash table
@@ -603,7 +643,7 @@ kamcmd htable.get students anna kamcmd htable.dump ipban ...
-7.4. htable.reload htable +7.6. htable.reload htable
Reload hash table from database.
@@ -617,7 +657,7 @@ kamcmd htable.dump ipban kamcmd htable.reload ipban ...
-7.5. htable.listTables +7.7. htable.listTables
Lists all defined tables
diff --git a/modules/htable/doc/htable_admin.xml b/modules/htable/doc/htable_admin.xml index 978298f..ae7dc3d 100644 --- a/modules/htable/doc/htable_admin.xml +++ b/modules/htable/doc/htable_admin.xml @@ -733,6 +733,66 @@ kamcmd htable.get students anna ... </programlisting> </section> + <section> + <title> + <function moreinfo="none">htable.sets htable key value</function> + </title> + <para> + Set an item in hash table to string value. + </para> + <para> + Name: <emphasis>htable.sets</emphasis> + </para> + <para>Parameters:</para> + <itemizedlist> + <listitem><para>htable : Name of the hash table</para> + </listitem> + <listitem><para>key : Key name in the hash table</para> + </listitem> + <listitem><para>Value : String value for the item</para> + </listitem> + + </itemizedlist> + <para> + Example: + </para> +<programlisting format="linespecific"> +... +# Set $sht(test=>x) +kamcmd htable.sets test x abc +... +</programlisting> + </section> + <section> + <title> + <function moreinfo="none">htable.seti htable key value</function> + </title> + <para> + Set an item in hash table to integer value. + </para> + <para> + Name: <emphasis>htable.seti</emphasis> + </para> + <para>Parameters:</para> + <itemizedlist> + <listitem><para>htable : Name of the hash table</para> + </listitem> + <listitem><para>key : Key name in the hash table</para> + </listitem> + <listitem><para>Value : Integer value for the item</para> + </listitem> + + </itemizedlist> + <para> + Example: + </para> +<programlisting format="linespecific"> +... +# Set $sht(test=>x) +kamcmd htable.sets test x 123 +... +</programlisting> + </section> <section> <title> <function moreinfo="none">htable.dump htable</function>
On 6/3/13 8:18 PM, Juha Heinanen wrote:
Elena-Ramona Modroiu writes:
htable: documented the new rpc commands
- htable.sets and htable.seti
thanks for the commands. it was not clear to me based on the description if the key already needs to exist in htable.
If exists, it is updated, otherwise it is added. Same as assignment to $sht(...).
Ramona
Elena-Ramona Modroiu writes:
- htable.sets and htable.seti
thanks for the commands. it was not clear to me based on the description if the key already needs to exist in htable.
If exists, it is updated, otherwise it is added. Same as assignment to $sht(...).
is there a "null" value that when set deletes the key from htable?
-- juha
On 6/4/13 6:33 PM, Juha Heinanen wrote:
Elena-Ramona Modroiu writes:
- htable.sets and htable.seti
thanks for the commands. it was not clear to me based on the description if the key already needs to exist in htable.
If exists, it is updated, otherwise it is added. Same as assignment to $sht(...).
is there a "null" value that when set deletes the key from htable?
There are two other commands to work with values in a hatable - htable.get and htable.delete - they were added by other developers, from what I could see in the code, htable.delete removes an item from hash table.
Ramona