← Volver al índice de módulos

htable

The module adds a hash table container to the configuration language. The hash table is stored in shared memory and the access to it can be done via pseudo-variables: $sht(htname=>name).
🔒 Autenticación y Seguridad Kamailio 6.1 30 parámetros 25 funciones

Descripción general

The module adds a hash table container to the configuration language. The hash table is stored in shared memory and the access to it can be done via pseudo-variables: $sht(htname=>name). The module supports definition of many hash tables and can load values at startup from a database table. A typical use case for the SIP server is to implement a cache system in configuration file - if a value is not found in hash table, load it from database and store it in hash table so next time the access to it is very fast. In the definition of the table you can define the default expiration time of cached items. The expiration time can be adjusted per item via assignment operation at runtime. Replication between multiple servers is performed automatically (if enabled) via the DMQ module. 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 will be replaced at runtime. Example 1.1. Accessing $sht(htname=>key) ... modparam("htable", "htable", "a=>size=8;") ... $sht(a=>test) = 1; $sht(a=>$ci::srcip) = $si; ... The next example shows a way to protect against dictionary attacks. If someone fails to authenticate 3 times, it is forbidden for 15 minutes. Authentication against database is expensive as it does a select on the “subscriber” table. By disabling the DB auth for 15 minutes, resources on the server are saved and time to discover the password is increased substantially. Additional alertin

Documentación oficial: https://www.kamailio.org/docs/modules/stable/modules/htable.html
Código fuente: https://github.com/kamailio/kamailio/tree/master/src/modules/htable

Parámetros de configuración

ParámetroTipoDescripción
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
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. ti
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
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. db_expires (integer) 3.12
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. db_expires (integer) 3.12. enable_dmq (integer) 3.13.
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. db_expires (integer) 3.12. enable_dmq (integer) 3.13. dmq_init_sync (integer) 3.14
expires_column str 3.8. array_size_suffix (str) 3.9. fetch_rows (integer) 3.10. timer_interval (integer) 3.11. db_expires (integer) 3.12. enable_dmq (integer) 3.13. dmq_init_sync (integer) 3.14. timer_procs (integer) 3.
array_size_suffix str 3.9. fetch_rows (integer) 3.10. timer_interval (integer) 3.11. db_expires (integer) 3.12. enable_dmq (integer) 3.13. dmq_init_sync (integer) 3.14. timer_procs (integer) 3.15. event_callback (str) 3.16
fetch_rows integer 3.10. timer_interval (integer) 3.11. db_expires (integer) 3.12. enable_dmq (integer) 3.13. dmq_init_sync (integer) 3.14. timer_procs (integer) 3.15. event_callback (str) 3.16. event_callback_mode (int
timer_interval integer 3.11. db_expires (integer) 3.12. enable_dmq (integer) 3.13. dmq_init_sync (integer) 3.14. timer_procs (integer) 3.15. event_callback (str) 3.16. event_callback_mode (int)
db_expires integer 3.12. enable_dmq (integer) 3.13. dmq_init_sync (integer) 3.14. timer_procs (integer) 3.15. event_callback (str) 3.16. event_callback_mode (int)
enable_dmq integer 3.13. dmq_init_sync (integer) 3.14. timer_procs (integer) 3.15. event_callback (str) 3.16. event_callback_mode (int)
dmq_init_sync integer 3.14. timer_procs (integer) 3.15. event_callback (str) 3.16. event_callback_mode (int)
timer_procs integer 3.15. event_callback (str) 3.16. event_callback_mode (int)
event_callback str 3.16. event_callback_mode (int)
event_callback_mode int 3.1. htable (str)
htable str The definition of a hash table. The value of the parameter may have the following format: * "htname=>size=_number_;autoexpire=_number_;dbtable=_string_"
db_url str The URL to connect to database for loading values in hash table at start up.
key_name_column str The name of the column containing the hash table key name.
key_type_column str The name of the column containing the hash table key type.
value_type_column str The name of the column containing the hash table value type.
key_value_column str The name of the column containing hash table key value.
expires_column str The name of the column containing the expires value.
array_size_suffix str The suffix to be added to store the number of items in an array (see key type).
fetch_rows integer How many rows to fetch at once from database.
timer_interval integer Interval in seconds to check for expired htable values.
db_expires integer If set to 1, the module loads/saves the value for expire of the items in hash table from/to database. It applies only to hash tables that have the auto-expires attribute defined. If set to 0, only the
enable_dmq integer If set to 1, will enable DMQ replication of actions performed upon entries in all tables having "dmqreplicate" parameter set. Any update action performed via pseudo-variables and RPC commands will be
dmq_init_sync integer If set to 1, will request synchronization from other nodes at startup. It applies to all tables having the "dmqreplicate" parameter set. As above, it is important to ensure the definition (size, autoe
timer_procs integer If set to 1 or greater, the module will create its own timer processes to scan for expired items in hash tables. If set to zero, it will use the core timer for this task. Set it to 1 if you store a lo

Funciones exportadas

sht_print()

4.2. sht_rm(htname, itname) 4.3. sht_rm_name_re(htable=>regexp) 4.4. sht_rm_value_re(htable=>regexp) 4.5. sht_rm_name(htable, op, val) 4.6. sht_rm_value(htable, op, val) 4.7. sht_setxs(htname, itname, itval, exval) 4.8. sht_setxi(htname, itname, itva

sht_rm(htname, itname)

4.3. sht_rm_name_re(htable=>regexp) 4.4. sht_rm_value_re(htable=>regexp) 4.5. sht_rm_name(htable, op, val) 4.6. sht_rm_value(htable, op, val) 4.7. sht_setxs(htname, itname, itval, exval) 4.8. sht_setxi(htname, itname, itval, exval) 4.9. sht_reset(hta

sht_rm_name_re(htable=>regexp)

4.4. sht_rm_value_re(htable=>regexp) 4.5. sht_rm_name(htable, op, val) 4.6. sht_rm_value(htable, op, val) 4.7. sht_setxs(htname, itname, itval, exval) 4.8. sht_setxi(htname, itname, itval, exval) 4.9. sht_reset(htable) 4.10. sht_lock(htable=>key) 4.1

sht_rm_value_re(htable=>regexp)

4.5. sht_rm_name(htable, op, val) 4.6. sht_rm_value(htable, op, val) 4.7. sht_setxs(htname, itname, itval, exval) 4.8. sht_setxi(htname, itname, itval, exval) 4.9. sht_reset(htable) 4.10. sht_lock(htable=>key) 4.11. sht_unlock(htable=>key) 4.12. sht_

sht_rm_name(htable, op, val)

4.6. sht_rm_value(htable, op, val) 4.7. sht_setxs(htname, itname, itval, exval) 4.8. sht_setxi(htname, itname, itval, exval) 4.9. sht_reset(htable) 4.10. sht_lock(htable=>key) 4.11. sht_unlock(htable=>key) 4.12. sht_iterator_start(iname, hname) 4.13.

sht_rm_value(htable, op, val)

4.7. sht_setxs(htname, itname, itval, exval) 4.8. sht_setxi(htname, itname, itval, exval) 4.9. sht_reset(htable) 4.10. sht_lock(htable=>key) 4.11. sht_unlock(htable=>key) 4.12. sht_iterator_start(iname, hname) 4.13. sht_iterator_end(iname) 4.14. sht_

sht_setxs(htname, itname, itval, exval)

4.8. sht_setxi(htname, itname, itval, exval) 4.9. sht_reset(htable) 4.10. sht_lock(htable=>key) 4.11. sht_unlock(htable=>key) 4.12. sht_iterator_start(iname, hname) 4.13. sht_iterator_end(iname) 4.14. sht_iterator_next(iname) 4.15. sht_iterator_rm(in

sht_setxi(htname, itname, itval, exval)

4.9. sht_reset(htable) 4.10. sht_lock(htable=>key) 4.11. sht_unlock(htable=>key) 4.12. sht_iterator_start(iname, hname) 4.13. sht_iterator_end(iname) 4.14. sht_iterator_next(iname) 4.15. sht_iterator_rm(iname) 4.16. sht_iterator_sets(iname, sval) 4.1

sht_reset(htable)

4.10. sht_lock(htable=>key) 4.11. sht_unlock(htable=>key) 4.12. sht_iterator_start(iname, hname) 4.13. sht_iterator_end(iname) 4.14. sht_iterator_next(iname) 4.15. sht_iterator_rm(iname) 4.16. sht_iterator_sets(iname, sval) 4.17. sht_iterator_seti(in

sht_lock(htable=>key)

4.11. sht_unlock(htable=>key) 4.12. sht_iterator_start(iname, hname) 4.13. sht_iterator_end(iname) 4.14. sht_iterator_next(iname) 4.15. sht_iterator_rm(iname) 4.16. sht_iterator_sets(iname, sval) 4.17. sht_iterator_seti(iname, ival) 4.18. sht_iterato

sht_unlock(htable=>key)

4.12. sht_iterator_start(iname, hname) 4.13. sht_iterator_end(iname) 4.14. sht_iterator_next(iname) 4.15. sht_iterator_rm(iname) 4.16. sht_iterator_sets(iname, sval) 4.17. sht_iterator_seti(iname, ival) 4.18. sht_iterator_setex(iname, exval) 4.19. sh

sht_iterator_start(iname, hname)

4.13. sht_iterator_end(iname) 4.14. sht_iterator_next(iname) 4.15. sht_iterator_rm(iname) 4.16. sht_iterator_sets(iname, sval) 4.17. sht_iterator_seti(iname, ival) 4.18. sht_iterator_setex(iname, exval) 4.19. sht_match_name(htable, op, mval) 4.20. sh

sht_iterator_end(iname)

4.14. sht_iterator_next(iname) 4.15. sht_iterator_rm(iname) 4.16. sht_iterator_sets(iname, sval) 4.17. sht_iterator_seti(iname, ival) 4.18. sht_iterator_setex(iname, exval) 4.19. sht_match_name(htable, op, mval) 4.20. sht_has_name(htable, op, mval) 4

sht_iterator_next(iname)

4.15. sht_iterator_rm(iname) 4.16. sht_iterator_sets(iname, sval) 4.17. sht_iterator_seti(iname, ival) 4.18. sht_iterator_setex(iname, exval) 4.19. sht_match_name(htable, op, mval) 4.20. sht_has_name(htable, op, mval) 4.21. sht_match_str_value(htable

sht_iterator_rm(iname)

4.16. sht_iterator_sets(iname, sval) 4.17. sht_iterator_seti(iname, ival) 4.18. sht_iterator_setex(iname, exval) 4.19. sht_match_name(htable, op, mval) 4.20. sht_has_name(htable, op, mval) 4.21. sht_match_str_value(htable, op, mval) 4.22. sht_has_str

sht_iterator_sets(iname, sval)

4.17. sht_iterator_seti(iname, ival) 4.18. sht_iterator_setex(iname, exval) 4.19. sht_match_name(htable, op, mval) 4.20. sht_has_name(htable, op, mval) 4.21. sht_match_str_value(htable, op, mval) 4.22. sht_has_str_value(htable, op, mval) 4.23. sht_is

sht_iterator_seti(iname, ival)

4.18. sht_iterator_setex(iname, exval) 4.19. sht_match_name(htable, op, mval) 4.20. sht_has_name(htable, op, mval) 4.21. sht_match_str_value(htable, op, mval) 4.22. sht_has_str_value(htable, op, mval) 4.23. sht_is_null(htname, itname) 4.24. sht_inc(h

sht_iterator_setex(iname, exval)

4.19. sht_match_name(htable, op, mval) 4.20. sht_has_name(htable, op, mval) 4.21. sht_match_str_value(htable, op, mval) 4.22. sht_has_str_value(htable, op, mval) 4.23. sht_is_null(htname, itname) 4.24. sht_inc(htname, itname) 4.25. sht_dec(htname, it

sht_match_name(htable, op, mval)

4.20. sht_has_name(htable, op, mval) 4.21. sht_match_str_value(htable, op, mval) 4.22. sht_has_str_value(htable, op, mval) 4.23. sht_is_null(htname, itname) 4.24. sht_inc(htname, itname) 4.25. sht_dec(htname, itname)

sht_has_name(htable, op, mval)

4.21. sht_match_str_value(htable, op, mval) 4.22. sht_has_str_value(htable, op, mval) 4.23. sht_is_null(htname, itname) 4.24. sht_inc(htname, itname) 4.25. sht_dec(htname, itname)

sht_match_str_value(htable, op, mval)

4.22. sht_has_str_value(htable, op, mval) 4.23. sht_is_null(htname, itname) 4.24. sht_inc(htname, itname) 4.25. sht_dec(htname, itname)

sht_has_str_value(htable, op, mval)

4.23. sht_is_null(htname, itname) 4.24. sht_inc(htname, itname) 4.25. sht_dec(htname, itname)

sht_is_null(htname, itname)

4.24. sht_inc(htname, itname) 4.25. sht_dec(htname, itname)

sht_inc(htname, itname)

4.25. sht_dec(htname, itname)

sht_dec(htname, itname)

4.1. sht_print()

Autores y contribuidores

Elena-Ramona Modroiu <ramona@rosdev.ro>Alex Balashov <abalashov@evaristesys.com>Ovidiu Sas <osas@voipembedded.com>Tyler Moore <tmoore@dopensource.com>

Copyright © 2008-2011 http://www.asipto.com
Copyright © 2023-2025 Tyler Moore, dOpenSource

Módulos relacionados

auth auth_arnacon auth_db auth_diameter auth_ephemeral auth_radius crypto ipops