#include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "sr_module.h"
#include "dprint.h"
#include "str.h"
#include "ut.h"
#include "mem/shm_mem.h"
#include "mem/mem.h"
#include "usr_avp.h"

Go to the source code of this file.
Data Structures | |
| struct | avp_galias |
| struct | avp_spec |
| struct | str_int_data |
| struct | str_str_data |
Functions | |
| int | add_avp (unsigned short flags, int_str name, int_str val) |
| Add an AVP to the global list. | |
| int | add_avp_galias (str *alias, int type, int_str avp_name) |
| Add global AVP alias to the list, allocate private memory. | |
| int | add_avp_galias_str (char *alias_definition) |
| Add global alias. | |
| static int | check_avp_galias (str *alias, int type, int_str avp_name) |
| static unsigned short | compute_ID (str *name) |
| void | destroy_avp (struct usr_avp *avp_del) |
| Search AVP in list and delete it. | |
| void | destroy_avp_list (struct usr_avp **list) |
| Free an AVP list in shared memory with memory locking. | |
| void | destroy_avp_list_unsafe (struct usr_avp **list) |
| Free an AVP list in shared memory without memory locking. | |
| int | destroy_avps (unsigned short flags, int_str name, int all) |
| Search AVP(s) in list and destroy them. | |
| struct usr_avp ** | get_avp_list (void) |
| Return global AVP list, assert that is not null. | |
| str * | get_avp_name (struct usr_avp *avp) |
| Get AVP name. | |
| void | get_avp_val (struct usr_avp *avp, int_str *val) |
| Get AVP value. | |
| static struct usr_avp * | internal_search_ID_avp (struct usr_avp *avp, unsigned short id, unsigned short flags) |
| static struct usr_avp * | internal_search_name_avp (struct usr_avp *avp, unsigned short id, str *name, unsigned short flags) |
| int | lookup_avp_galias (str *alias, int *type, int_str *avp_name) |
| Lookup global AVP alias. | |
| int | parse_avp_name (str *name, int *type, int_str *avp_name) |
| Parse an AVP name (as string) and set type and name. | |
| int | parse_avp_spec (str *name, int *type, int_str *avp_name) |
| Parse AVP specification (alias or AVP) and set type and name. | |
| void | reset_avps (void) |
| Destroy global AVP list. | |
| struct usr_avp * | search_first_avp (unsigned short flags, int_str name, int_str *val, struct usr_avp *start) |
| Search the first matching AVP in the global list. | |
| struct usr_avp * | search_next_avp (struct usr_avp *avp, int_str *val) |
| Search the next AVP in the given AVP list. | |
| struct usr_avp ** | set_avp_list (struct usr_avp **list) |
| Set global AVP list, assert that old list is not null. | |
Variables | |
| static struct usr_avp ** | crt_avps = &global_avps |
| static struct avp_galias * | galiases = 0 |
| static struct usr_avp * | global_avps = 0 |
Definition in file usr_avp.c.
Add an AVP to the global list.
| flags | AVP flags | |
| name | AVP name | |
| val | AVP value |
Definition at line 94 of file usr_avp.c.
References AVP_NAME_STR, AVP_VAL_STR, compute_ID(), usr_avp::data, usr_avp::flags, usr_avp::id, _str::len, len, LM_ERR, int_str::n, str_str_data::name, str_int_data::name, usr_avp::next, _str::s, int_str::s, s, shm_malloc(), str_str_data::val, and str_int_data::val.
Referenced by actually_rewrite(), add_gws_into_avps(), cr_load_user_carrier(), db_query_avp(), dbrow2avp(), do_from_gw(), ds_select_dst(), exec_avp(), fix_nated_register_f(), generate_avps(), h350_auth_lookup(), h350_call_preferences(), h350_service_level(), ldap_filter_url_encode(), ldap_write_result(), match_hash_table(), match_res(), next_gw(), ops_copy_avp(), ops_op_avp(), ops_subst(), ospPrepareDestination(), ospSaveDestination(), ospSetRpid(), run_proxy(), set_next_domain_on_rule(), stack_to_avp(), t_load_contacts(), and t_next_contacts().
Add global AVP alias to the list, allocate private memory.
| alias | alias string | |
| type | AVP type | |
| avp_name | AVP name |
Definition at line 467 of file usr_avp.c.
References avp_galias::alias, avp_galias::avp, AVP_NAME_STR, check_avp_galias(), _str::len, LM_DBG, LM_ERR, int_str::n, avp_spec::name, avp_galias::next, pkg_free, pkg_malloc, _str::s, int_str::s, and avp_spec::type.
Referenced by add_avp_galias_str().
| int add_avp_galias_str | ( | char * | alias_definition | ) |
Add global alias.
| alias_definition | alias definition, including the AVP |
Definition at line 621 of file usr_avp.c.
References add_avp_galias(), avp_galias::alias, _str::len, LM_ERR, parse_avp_name(), _str::s, and s.
Definition at line 439 of file usr_avp.c.
References avp_galias::alias, avp_galias::avp, AVP_NAME_STR, _str::len, int_str::n, avp_spec::name, avp_galias::next, int_str::s, _str::s, and avp_spec::type.
Referenced by add_avp_galias().
| static unsigned short compute_ID | ( | str * | name | ) | [inline, static] |
| void destroy_avp | ( | struct usr_avp * | avp | ) |
Search AVP in list and delete it.
| avp | searched AVP |
Definition at line 349 of file usr_avp.c.
References usr_avp::next, avp::next, and shm_free.
Referenced by destroy_avps(), ds_next_dst(), generate_uris(), ops_copy_avp(), ops_delete_avp(), ops_op_avp(), ops_subst(), and t_next_contacts().
| void destroy_avp_list | ( | struct usr_avp ** | list | ) | [inline] |
Free an AVP list in shared memory with memory locking.
Definition at line 397 of file usr_avp.c.
References LM_DBG, usr_avp::next, and shm_free.
Referenced by build_cell(), and reset_avps().
| void destroy_avp_list_unsafe | ( | struct usr_avp ** | list | ) |
Free an AVP list in shared memory without memory locking.
Definition at line 383 of file usr_avp.c.
References usr_avp::next, and shm_free_unsafe.
Referenced by free_cell().
| int destroy_avps | ( | unsigned short | flags, | |
| int_str | name, | |||
| int | all | |||
| ) |
Search AVP(s) in list and destroy them.
| flags | AVP flags | |
| name | AVP name | |
| all | set to 1 to delete all matching AVPs, 0 to delete only the first |
Definition at line 367 of file usr_avp.c.
References destroy_avp(), and search_first_avp().
Referenced by ops_delete_avp().
| struct usr_avp** get_avp_list | ( | void | ) | [read] |
Return global AVP list, assert that is not null.
Definition at line 236 of file usr_avp.c.
Referenced by ops_dbstore_avps(), ops_delete_avp(), and ops_print_avp().
Get AVP name.
| avp | inspected AVP |
Definition at line 179 of file usr_avp.c.
References AVP_NAME_STR, AVP_VAL_STR, usr_avp::data, usr_avp::flags, LM_ERR, and str_str_data::name.
Referenced by internal_search_name_avp(), ops_dbstore_avps(), ops_print_avp(), and search_next_avp().
Get AVP value.
Definition at line 205 of file usr_avp.c.
References AVP_NAME_STR, AVP_VAL_STR, usr_avp::data, usr_avp::flags, int_str::n, and int_str::s.
Referenced by ops_dbstore_avps(), ops_print_avp(), ospCheckOrigDestination(), ospDumpAllDestination(), ospGetLastOrigDestination(), ospGetNextOrigDestination(), ospReportOrigSetupUsage(), search_first_avp(), and search_next_avp().
| static struct usr_avp* internal_search_ID_avp | ( | struct usr_avp * | avp, | |
| unsigned short | id, | |||
| unsigned short | flags | |||
| ) | [static, read] |
Definition at line 247 of file usr_avp.c.
References AVP_NAME_STR, usr_avp::flags, usr_avp::id, and usr_avp::next.
Referenced by search_first_avp(), and search_next_avp().
| static struct usr_avp* internal_search_name_avp | ( | struct usr_avp * | avp, | |
| unsigned short | id, | |||
| str * | name, | |||
| unsigned short | flags | |||
| ) | [static, read] |
Definition at line 261 of file usr_avp.c.
References AVP_NAME_STR, usr_avp::flags, get_avp_name(), usr_avp::id, _str::len, usr_avp::next, and _str::s.
Referenced by search_first_avp(), and search_next_avp().
Lookup global AVP alias.
| alias | alias string | |
| type | AVP type | |
| avp_name | AVP name |
Definition at line 529 of file usr_avp.c.
References avp_galias::alias, avp_galias::avp, _str::len, avp_spec::name, avp_galias::next, _str::s, and avp_spec::type.
Referenced by parse_avp_spec().
Parse an AVP name (as string) and set type and name.
| name | AVP name | |
| type | AVP type | |
| avp_name | AVP name |
Definition at line 547 of file usr_avp.c.
References AVP_NAME_DELIM, AVP_NAME_STR, avp_script_flags, id, _str::len, LM_ERR, int_str::n, NULL, int_str::s, _str::s, s, and str2int().
Referenced by add_avp_galias_str(), and parse_avp_spec().
Parse AVP specification (alias or AVP) and set type and name.
| name | AVP name | |
| type | AVP type | |
| avp_name |
Definition at line 604 of file usr_avp.c.
References AVP_NAME_DELIM, _str::len, lookup_avp_galias(), NULL, parse_avp_name(), and _str::s.
| void reset_avps | ( | void | ) |
Destroy global AVP list.
Definition at line 412 of file usr_avp.c.
References destroy_avp_list().
Referenced by build_cell(), receive_msg(), and t_uac_cancel().
| struct usr_avp* search_first_avp | ( | unsigned short | flags, | |
| int_str | name, | |||
| int_str * | val, | |||
| struct usr_avp * | start | |||
| ) | [read] |
Search the first matching AVP in the global list.
Search the first AVP in the global list that matches to the given parameter.
| flags | AVP flags | |
| name | AVP name | |
| val | AVP value | |
| start | start the search at start->next, if NULL start from the head of the global list |
Definition at line 281 of file usr_avp.c.
References AVP_NAME_STR, AVP_SCRIPT_MASK, compute_ID(), get_avp_val(), internal_search_ID_avp(), internal_search_name_avp(), _str::len, LM_ERR, int_str::n, usr_avp::next, _str::s, and int_str::s.
Referenced by append_rpid_hf(), append_rpid_hf_p(), avp2timer(), cr_gp2id(), destroy_avps(), do_load_gws(), dp_apply_policy(), ds_mark_dst(), ds_next_dst(), extract_aor(), generate_uris(), get_media_relay(), get_signaling_ip(), is_rpid_user_e164(), legs2strar(), m_store(), next_gw(), ops_check_avp(), ops_copy_avp(), ops_dbstore_avps(), ops_is_avp_set(), ops_op_avp(), ops_pushto_avp(), ops_subst(), ospCheckOrigDestination(), ospCheckTranslation(), ospDumpAllDestination(), ospGetLastOrigDestination(), ospGetNextOrigDestination(), ospGetTermDestination(), ospReportOrigSetupUsage(), ospRequestRouting(), pack_ci(), registered(), sip_trace(), siptrace_get_table(), t_next_contacts(), tls_tcpconn_init(), trace_onreply_in(), trace_onreply_out(), trace_onreq_in(), trace_onreq_out(), and trace_sl_onreply_out().
Search the next AVP in the given AVP list.
Search the next AVP in the given AVP list, that is returned from search_first_avp
Definition at line 327 of file usr_avp.c.
References AVP_NAME_STR, AVP_SCRIPT_MASK, usr_avp::flags, get_avp_name(), get_avp_val(), usr_avp::id, internal_search_ID_avp(), internal_search_name_avp(), and usr_avp::next.
Referenced by ds_next_dst(), legs2strar(), ospCheckOrigDestination(), ospDumpAllDestination(), ospGetLastOrigDestination(), ospGetNextOrigDestination(), ospReportOrigSetupUsage(), sip_trace(), t_next_contacts(), trace_onreply_in(), trace_onreply_out(), trace_onreq_out(), and trace_sl_onreply_out().
Set global AVP list, assert that old list is not null.
Definition at line 423 of file usr_avp.c.
Referenced by build_cell(), faked_env(), pre_print_uac_request(), reply_received(), run_reqin_callbacks(), run_trans_callbacks(), and t_uac().
struct usr_avp** crt_avps = &global_avps [static] |
struct avp_galias* galiases = 0 [static] |
struct usr_avp* global_avps = 0 [static] |
1.5.6