Browse Source

htable: fix some copy/paste errors in README

Ovidiu Sas 11 years ago
parent
commit
2e4c13669c
2 changed files with 95 additions and 189 deletions
  1. 91 185
      modules/htable/README
  2. 4 4
      modules/htable/doc/htable_admin.xml

+ 91 - 185
modules/htable/README

@@ -17,65 +17,65 @@ Alex Balashov
 
 
    <[email protected]>
    <[email protected]>
 
 
-   Copyright © 2008-2011 http://www.asipto.com
+   Copyright © 2008-2011 http://www.asipto.com
      __________________________________________________________________
      __________________________________________________________________
 
 
    Table of Contents
    Table of Contents
 
 
    1. Admin Guide
    1. Admin Guide
 
 
-        1. Overview
-        2. Dependencies
+        1.1. Overview
+        1.2. Dependencies
 
 
-              2.1. Kamailio Modules
-              2.2. External Libraries or Applications
-              2.3. Loading from database
+              1.2.1. Kamailio Modules
+              1.2.2. External Libraries or Applications
+              1.2.3. Loading from database
 
 
-        3. Parameters
+        1.3. Parameters
 
 
-              3.1. htable (str)
-              3.2. db_url (str)
-              3.3. key_name_column (str)
-              3.4. key_type_column (str)
-              3.5. value_type_column (str)
-              3.6. key_value_column (str)
-              3.7. expires_column (str)
-              3.8. array_size_suffix (str)
-              3.9. fetch_rows (integer)
-              3.10. timer_interval (integer)
-              3.11. timer_mode (integer)
-              3.12. db_expires (integer)
-              3.13. enable_dmq (integer)
+              1.3.1. htable (str)
+              1.3.2. db_url (str)
+              1.3.3. key_name_column (str)
+              1.3.4. key_type_column (str)
+              1.3.5. value_type_column (str)
+              1.3.6. key_value_column (str)
+              1.3.7. expires_column (str)
+              1.3.8. array_size_suffix (str)
+              1.3.9. fetch_rows (integer)
+              1.3.10. timer_interval (integer)
+              1.3.11. timer_mode (integer)
+              1.3.12. db_expires (integer)
+              1.3.13. enable_dmq (integer)
 
 
-        4. Functions
+        1.4. Functions
 
 
-              4.1. sht_print()
-              4.2. sht_rm_name_re(htable=>regexp)
-              4.3. sht_rm_value_re(htable=>regexp)
-              4.4. sht_lock(htable=>key)
-              4.5. sht_unlock(htable=>key)
+              1.4.1. sht_print()
+              1.4.2. sht_rm_name_re(htable=>regexp)
+              1.4.3. sht_rm_value_re(htable=>regexp)
+              1.4.4. sht_lock(htable=>key)
+              1.4.5. sht_unlock(htable=>key)
 
 
-        5. Exported pseudo-variables
-        6. MI Commands
+        1.5. Exported pseudo-variables
+        1.6. MI Commands
 
 
-              6.1. sht_reload
-              6.2. sht_dump
-              6.3. sht_delete
+              1.6.1. sht_reload
+              1.6.2. sht_dump
+              1.6.3. sht_delete
 
 
-        7. Exported RPC Commands
+        1.7. Exported RPC Commands
 
 
-              7.1. htable.get htable key
-              7.2. htable.delete htable key
-              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.8. htable.stats
+              1.7.1. htable.get htable key
+              1.7.2. htable.delete htable key
+              1.7.3. htable.sets htable key value
+              1.7.4. htable.seti htable key value
+              1.7.5. htable.dump htable
+              1.7.6. htable.reload htable
+              1.7.7. htable.listTables
+              1.7.8. htable.stats
 
 
-        8. Event routes
+        1.8. Event routes
 
 
-              8.1. htable:mod-init
+              1.8.1. htable:mod-init
 
 
    List of Examples
    List of Examples
 
 
@@ -102,62 +102,7 @@ Alex Balashov
 
 
 Chapter 1. Admin Guide
 Chapter 1. Admin Guide
 
 
-   Table of Contents
-
-   1. Overview
-   2. Dependencies
-
-        2.1. Kamailio Modules
-        2.2. External Libraries or Applications
-        2.3. Loading from database
-
-   3. Parameters
-
-        3.1. htable (str)
-        3.2. db_url (str)
-        3.3. key_name_column (str)
-        3.4. key_type_column (str)
-        3.5. value_type_column (str)
-        3.6. key_value_column (str)
-        3.7. expires_column (str)
-        3.8. array_size_suffix (str)
-        3.9. fetch_rows (integer)
-        3.10. timer_interval (integer)
-        3.11. timer_mode (integer)
-        3.12. db_expires (integer)
-        3.13. enable_dmq (integer)
-
-   4. Functions
-
-        4.1. sht_print()
-        4.2. sht_rm_name_re(htable=>regexp)
-        4.3. sht_rm_value_re(htable=>regexp)
-        4.4. sht_lock(htable=>key)
-        4.5. sht_unlock(htable=>key)
-
-   5. Exported pseudo-variables
-   6. MI Commands
-
-        6.1. sht_reload
-        6.2. sht_dump
-        6.3. sht_delete
-
-   7. Exported RPC Commands
-
-        7.1. htable.get htable key
-        7.2. htable.delete htable key
-        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.8. htable.stats
-
-   8. Event routes
-
-        8.1. htable:mod-init
-
-1. Overview
+1.1. Overview
 
 
    The module adds a hash table container to configuration language. The
    The module adds a hash table container to configuration language. The
    hash table is stored in shared memory and the access to it can be done
    hash table is stored in shared memory and the access to it can be done
@@ -178,7 +123,7 @@ Chapter 1. Admin Guide
    You can read more about hash tables at:
    You can read more about hash tables at:
    http://en.wikipedia.org/wiki/Hash_table.
    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.
    will be replaced at runtime.
 
 
    Example 1.1. Accessing $sht(htname=>key)
    Example 1.1. Accessing $sht(htname=>key)
@@ -201,7 +146,7 @@ $sht(a=>$ci::srcip) = $si;
    the failed authentications per user and one for storing the time of
    the failed authentications per user and one for storing the time of
    last authentication attempt. To ensure unique name per user, the hash
    last authentication attempt. To ensure unique name per user, the hash
    table uses a combination of authentication username and text
    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
    Example 1.2. Dictionary attack limitation
 ...
 ...
@@ -245,25 +190,21 @@ if(is_present_hf("Authorization"))
 }
 }
 ...
 ...
 
 
-2. Dependencies
-
-   2.1. Kamailio Modules
-   2.2. External Libraries or Applications
-   2.3. Loading from database
+1.2. Dependencies
 
 
-2.1. Kamailio Modules
+1.2.1. Kamailio Modules
 
 
    The following modules must be loaded before this module:
    The following modules must be loaded before this module:
      * If DMQ replication is enabled, the DMQ module must be loaded
      * If DMQ replication is enabled, the DMQ module must be loaded
        first..
        first..
 
 
-2.2. External Libraries or Applications
+1.2.2. External Libraries or Applications
 
 
    The following libraries or applications must be installed before
    The following libraries or applications must be installed before
    running Kamailio with this module loaded:
    running Kamailio with this module loaded:
      * None.
      * None.
 
 
-2.3. Loading from database
+1.2.3. Loading from database
 
 
    The module is able to load values in hash table at startup upon
    The module is able to load values in hash table at startup upon
    providing a DB URL and table name.
    providing a DB URL and table name.
@@ -280,23 +221,9 @@ if(is_present_hf("Authorization"))
           + 1 - value is integer.
           + 1 - value is integer.
      * key value - string containing the value of the key.
      * key value - string containing the value of the key.
 
 
-3. Parameters
+1.3. Parameters
 
 
-   3.1. htable (str)
-   3.2. db_url (str)
-   3.3. key_name_column (str)
-   3.4. key_type_column (str)
-   3.5. value_type_column (str)
-   3.6. key_value_column (str)
-   3.7. expires_column (str)
-   3.8. array_size_suffix (str)
-   3.9. fetch_rows (integer)
-   3.10. timer_interval (integer)
-   3.11. timer_mode (integer)
-   3.12. db_expires (integer)
-   3.13. enable_dmq (integer)
-
-3.1. htable (str)
+1.3.1. htable (str)
 
 
    The definition of a hash table. The value of the parameter must have
    The definition of a hash table. The value of the parameter must have
    the following format:
    the following format:
@@ -338,11 +265,11 @@ if(is_present_hf("Authorization"))
 ...
 ...
 modparam("htable", "htable", "a=>size=4;autoexpire=7200;dbtable=htable_a;")
 modparam("htable", "htable", "a=>size=4;autoexpire=7200;dbtable=htable_a;")
 modparam("htable", "htable", "b=>size=5;")
 modparam("htable", "htable", "b=>size=5;")
-modparam("htable", "htable", "c=>size=4;autoexpire=7200;initval=1;dmqreplicate=1
-;")
+modparam("htable", "htable", "c=>size=4;autoexpire=7200;initval=1;dmqreplicate=
+1;")
 ...
 ...
 
 
-3.2. db_url (str)
+1.3.2. db_url (str)
 
 
    The URL to connect to database for loading values in hash table at
    The URL to connect to database for loading values in hash table at
    start up.
    start up.
@@ -354,7 +281,7 @@ modparam("htable", "htable", "c=>size=4;autoexpire=7200;initval=1;dmqreplicate=1
 modparam("htable", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
 modparam("htable", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
 ...
 ...
 
 
-3.3. key_name_column (str)
+1.3.3. key_name_column (str)
 
 
    The name of the column containing hash table key name.
    The name of the column containing hash table key name.
 
 
@@ -365,7 +292,7 @@ modparam("htable", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
 modparam("htable", "key_name_column", "kname")
 modparam("htable", "key_name_column", "kname")
 ...
 ...
 
 
-3.4. key_type_column (str)
+1.3.4. key_type_column (str)
 
 
    The name of the column containing hash table key type.
    The name of the column containing hash table key type.
 
 
@@ -376,7 +303,7 @@ modparam("htable", "key_name_column", "kname")
 modparam("htable", "key_type_column", "ktype")
 modparam("htable", "key_type_column", "ktype")
 ...
 ...
 
 
-3.5. value_type_column (str)
+1.3.5. value_type_column (str)
 
 
    The name of the column containing hash table value type.
    The name of the column containing hash table value type.
 
 
@@ -387,7 +314,7 @@ modparam("htable", "key_type_column", "ktype")
 modparam("htable", "value_type_column", "vtype")
 modparam("htable", "value_type_column", "vtype")
 ...
 ...
 
 
-3.6. key_value_column (str)
+1.3.6. key_value_column (str)
 
 
    The name of the column containing hash table key value.
    The name of the column containing hash table key value.
 
 
@@ -398,7 +325,7 @@ modparam("htable", "value_type_column", "vtype")
 modparam("htable", "key_value_column", "kvalue")
 modparam("htable", "key_value_column", "kvalue")
 ...
 ...
 
 
-3.7. expires_column (str)
+1.3.7. expires_column (str)
 
 
    The name of the column containing expires type.
    The name of the column containing expires type.
 
 
@@ -409,7 +336,7 @@ modparam("htable", "key_value_column", "kvalue")
 modparam("htable", "expires", "expiry")
 modparam("htable", "expires", "expiry")
 ...
 ...
 
 
-3.8. array_size_suffix (str)
+1.3.8. array_size_suffix (str)
 
 
    The suffix to be added to store the number of items in an array.
    The suffix to be added to store the number of items in an array.
 
 
@@ -420,7 +347,7 @@ modparam("htable", "expires", "expiry")
 modparam("htable", "array_size_suffix", "-count")
 modparam("htable", "array_size_suffix", "-count")
 ...
 ...
 
 
-3.9. fetch_rows (integer)
+1.3.9. fetch_rows (integer)
 
 
    How many rows to fetch at once from database.
    How many rows to fetch at once from database.
 
 
@@ -431,7 +358,7 @@ modparam("htable", "array_size_suffix", "-count")
 modparam("htable", "fetch_rows", 1000)
 modparam("htable", "fetch_rows", 1000)
 ...
 ...
 
 
-3.10. timer_interval (integer)
+1.3.10. timer_interval (integer)
 
 
    Interval in seconds to check for expired htable values.
    Interval in seconds to check for expired htable values.
 
 
@@ -442,7 +369,7 @@ modparam("htable", "fetch_rows", 1000)
 modparam("htable", "timer_interval", 10)
 modparam("htable", "timer_interval", 10)
 ...
 ...
 
 
-3.11. timer_mode (integer)
+1.3.11. timer_mode (integer)
 
 
    If set to 1, will start a new timer process. If set to 0 will use
    If set to 1, will start a new timer process. If set to 0 will use
    default timer process to check for expired htable values.
    default timer process to check for expired htable values.
@@ -454,7 +381,7 @@ modparam("htable", "timer_interval", 10)
 modparam("htable", "timer_mode", 1)
 modparam("htable", "timer_mode", 1)
 ...
 ...
 
 
-3.12. db_expires (integer)
+1.3.12. db_expires (integer)
 
 
    If set to 1, will load/save the expires values of the items in hash
    If set to 1, will load/save the expires values of the items in hash
    table fromm/to database. It applies only to hash tables that have
    table fromm/to database. It applies only to hash tables that have
@@ -467,7 +394,7 @@ modparam("htable", "timer_mode", 1)
 modparam("htable", "db_expires", 1)
 modparam("htable", "db_expires", 1)
 ...
 ...
 
 
-3.13. enable_dmq (integer)
+1.3.13. enable_dmq (integer)
 
 
    If set to 1, will enable DMQ replication of actions performed upon
    If set to 1, will enable DMQ replication of actions performed upon
    entries in all tables having "dmqreplicate" parameter set. Any update
    entries in all tables having "dmqreplicate" parameter set. Any update
@@ -487,15 +414,9 @@ modparam("htable", "db_expires", 1)
 modparam("htable", "enable_dmq", 1)
 modparam("htable", "enable_dmq", 1)
 ...
 ...
 
 
-4. Functions
-
-   4.1. sht_print()
-   4.2. sht_rm_name_re(htable=>regexp)
-   4.3. sht_rm_value_re(htable=>regexp)
-   4.4. sht_lock(htable=>key)
-   4.5. sht_unlock(htable=>key)
+1.4. Functions
 
 
-4.1. sht_print()
+1.4.1.  sht_print()
 
 
    Dump content of hash table to L_ERR log level. Intended for debug
    Dump content of hash table to L_ERR log level. Intended for debug
    purposes.
    purposes.
@@ -508,7 +429,7 @@ modparam("htable", "enable_dmq", 1)
 sht_print();
 sht_print();
 ...
 ...
 
 
-4.2. sht_rm_name_re(htable=>regexp)
+1.4.2.  sht_rm_name_re(htable=>regexp)
 
 
    Delete all entries in the htable that match the name against regular
    Delete all entries in the htable that match the name against regular
    expression.
    expression.
@@ -521,7 +442,7 @@ sht_print();
 sht_rm_name_re("ha=>.*");
 sht_rm_name_re("ha=>.*");
 ...
 ...
 
 
-4.3. sht_rm_value_re(htable=>regexp)
+1.4.3.  sht_rm_value_re(htable=>regexp)
 
 
    Delete all entries in the htable that match the value against regular
    Delete all entries in the htable that match the value against regular
    expression.
    expression.
@@ -534,7 +455,7 @@ sht_rm_name_re("ha=>.*");
 sht_rm_value_re("ha=>.*");
 sht_rm_value_re("ha=>.*");
 ...
 ...
 
 
-4.4. sht_lock(htable=>key)
+1.4.4.  sht_lock(htable=>key)
 
 
    Lock the slot in htable corespoding to the key item.
    Lock the slot in htable corespoding to the key item.
 
 
@@ -545,7 +466,7 @@ sht_rm_value_re("ha=>.*");
 sht_lock("ha=>test");
 sht_lock("ha=>test");
 ...
 ...
 
 
-4.5. sht_unlock(htable=>key)
+1.4.5.  sht_unlock(htable=>key)
 
 
    Unlock the slot in htable corespoding to the key item.
    Unlock the slot in htable corespoding to the key item.
 
 
@@ -558,7 +479,7 @@ $sht(ha=>test) = $sht(ha=>test) + 10;
 sht_unlock("ha=>test");
 sht_unlock("ha=>test");
 ...
 ...
 
 
-5. Exported pseudo-variables
+1.5. Exported pseudo-variables
 
 
      * $sht(htable=>key)
      * $sht(htable=>key)
      * $shtex(htable=>key)
      * $shtex(htable=>key)
@@ -570,13 +491,9 @@ sht_unlock("ha=>test");
    Exported pseudo-variables are documented at
    Exported pseudo-variables are documented at
    http://www.kamailio.org/wiki/.
    http://www.kamailio.org/wiki/.
 
 
-6. MI Commands
-
-   6.1. sht_reload
-   6.2. sht_dump
-   6.3. sht_delete
+1.6. MI Commands
 
 
-6.1. sht_reload
+1.6.1.  sht_reload
 
 
    Reload a hash table from database.
    Reload a hash table from database.
 
 
@@ -589,7 +506,7 @@ sht_unlock("ha=>test");
                 _hash_table_name_
                 _hash_table_name_
                 _empty_line_
                 _empty_line_
 
 
-6.2. sht_dump
+1.6.2.  sht_dump
 
 
    Dump content of a hash table via MI.
    Dump content of a hash table via MI.
 
 
@@ -602,7 +519,7 @@ sht_unlock("ha=>test");
                 _hash_table_name_
                 _hash_table_name_
                 _empty_line_
                 _empty_line_
 
 
-6.3. sht_delete
+1.6.3.  sht_delete
 
 
    Delete a key from a hash table via MI.
    Delete a key from a hash table via MI.
 
 
@@ -621,18 +538,9 @@ sht_unlock("ha=>test");
    Example (note the quoting when executing it via FIFO):
    Example (note the quoting when executing it via FIFO):
                 kamctl fifo sht_delete auth '"[email protected]::last_auth"'
                 kamctl fifo sht_delete auth '"[email protected]::last_auth"'
 
 
-7. Exported RPC Commands
+1.7. Exported RPC Commands
 
 
-   7.1. htable.get htable key
-   7.2. htable.delete htable key
-   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.8. htable.stats
-
-7.1. htable.get htable key
+1.7.1.  htable.get htable key
 
 
    Lists one value in a hash table
    Lists one value in a hash table
 
 
@@ -648,7 +556,7 @@ sht_unlock("ha=>test");
 kamcmd htable.get students daniel
 kamcmd htable.get students daniel
 ...
 ...
 
 
-7.2. htable.delete htable key
+1.7.2.  htable.delete htable key
 
 
    Delete one value in a hash table
    Delete one value in a hash table
 
 
@@ -661,10 +569,10 @@ kamcmd htable.get students daniel
    Example:
    Example:
 ...
 ...
 # Delete $sht(students=>anna)
 # Delete $sht(students=>anna)
-kamcmd htable.get students anna
+kamcmd htable.delete students anna
 ...
 ...
 
 
-7.3. htable.sets htable key value
+1.7.3.  htable.sets htable key value
 
 
    Set an item in hash table to string value.
    Set an item in hash table to string value.
 
 
@@ -677,11 +585,11 @@ kamcmd htable.get students anna
 
 
    Example:
    Example:
 ...
 ...
-# Set $sht(test=>x)
+# Set $sht(test=>x) as string
 kamcmd htable.sets test x abc
 kamcmd htable.sets test x abc
 ...
 ...
 
 
-7.4. htable.seti htable key value
+1.7.4.  htable.seti htable key value
 
 
    Set an item in hash table to integer value.
    Set an item in hash table to integer value.
 
 
@@ -694,11 +602,11 @@ kamcmd htable.sets test x abc
 
 
    Example:
    Example:
 ...
 ...
-# Set $sht(test=>x)
-kamcmd htable.sets test x 123
+# Set $sht(test=>x) as integer
+kamcmd htable.seti test x 123
 ...
 ...
 
 
-7.5. htable.dump htable
+1.7.5.  htable.dump htable
 
 
    Lists all the values in a hash table
    Lists all the values in a hash table
 
 
@@ -712,7 +620,7 @@ kamcmd htable.sets test x 123
 kamcmd htable.dump ipban
 kamcmd htable.dump ipban
 ...
 ...
 
 
-7.6. htable.reload htable
+1.7.6.  htable.reload htable
 
 
    Reload hash table from database.
    Reload hash table from database.
 
 
@@ -726,7 +634,7 @@ kamcmd htable.dump ipban
 kamcmd htable.reload ipban
 kamcmd htable.reload ipban
 ...
 ...
 
 
-7.7. htable.listTables
+1.7.7.  htable.listTables
 
 
    Lists all defined tables
    Lists all defined tables
 
 
@@ -740,7 +648,7 @@ kamcmd htable.reload ipban
 kamcmd htable.listTables
 kamcmd htable.listTables
 ...
 ...
 
 
-7.8. htable.stats
+1.7.8.  htable.stats
 
 
    Get statistics for hash tables - name, number of slots, number of
    Get statistics for hash tables - name, number of slots, number of
    items, max number of items per slot, min number of items per slot.
    items, max number of items per slot, min number of items per slot.
@@ -755,11 +663,9 @@ kamcmd htable.listTables
 kamcmd htable.stats
 kamcmd htable.stats
 ...
 ...
 
 
-8. Event routes
-
-   8.1. htable:mod-init
+1.8. Event routes
 
 
-8.1. htable:mod-init
+1.8.1.  htable:mod-init
 
 
    When defined, the module calls event_route[htable:mod-init] after all
    When defined, the module calls event_route[htable:mod-init] after all
    modules have been initialized. A typical use case is to initialise
    modules have been initialized. A typical use case is to initialise

+ 4 - 4
modules/htable/doc/htable_admin.xml

@@ -805,7 +805,7 @@ kamcmd htable.get students daniel
 <programlisting  format="linespecific">
 <programlisting  format="linespecific">
 ...
 ...
 # Delete $sht(students=>anna)
 # Delete $sht(students=>anna)
-kamcmd htable.get students anna
+kamcmd htable.delete students anna
 ...
 ...
 </programlisting>
 </programlisting>
 	</section>
 	</section>
@@ -834,7 +834,7 @@ kamcmd htable.get students anna
                 </para>
                 </para>
 <programlisting  format="linespecific">
 <programlisting  format="linespecific">
 ...
 ...
-# Set $sht(test=>x)
+# Set $sht(test=>x) as string
 kamcmd htable.sets test x abc
 kamcmd htable.sets test x abc
 ...
 ...
 </programlisting>
 </programlisting>
@@ -864,8 +864,8 @@ kamcmd htable.sets test x abc
                 </para>
                 </para>
 <programlisting  format="linespecific">
 <programlisting  format="linespecific">
 ...
 ...
-# Set $sht(test=>x)
-kamcmd htable.sets test x 123
+# Set $sht(test=>x) as integer
+kamcmd htable.seti test x 123
 ...
 ...
 </programlisting>
 </programlisting>
 	</section>
 	</section>