#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "mem/mem.h"
#include "mem/shm_mem.h"
#include "ut.h"
#include "dprint.h"
#include "route.h"
#include "hash_func.h"
#include "pvar.h"

Go to the source code of this file.
Data Structures | |
| struct | _pv_item |
| struct | _tr_item |
Defines | |
| #define | is_in_str(p, in) (p<in->s+in->len && *p) |
| #define | PV_PRINT_BUF_NO 3 |
| #define | PV_PRINT_BUF_SIZE 1024 |
| #define | PV_TABLE_SIZE 16 |
| #define | TR_TABLE_SIZE 4 |
Typedefs | |
| typedef struct _pv_item * | pv_item_p |
| typedef struct _pv_item | pv_item_t |
| typedef struct _tr_item * | tr_item_p |
| typedef struct _tr_item | tr_item_t |
Functions | |
| static int | is_pv_valid_char (char c) |
| pvname_list_t * | parse_pvname_list (str *in, unsigned int type) |
| void | pv_api_destroy (void) |
| int | pv_elem_free_all (pv_elem_p log) |
| int | pv_get_avp_name (struct sip_msg *msg, pv_param_p ip, int_str *avp_name, unsigned short *name_type) |
| int | pv_get_intstrval (struct sip_msg *msg, pv_param_t *param, pv_value_t *res, int ival, str *sval) |
| static int | pv_get_marker (struct sip_msg *msg, pv_param_t *param, pv_value_t *res) |
| int | pv_get_null (struct sip_msg *msg, pv_param_t *param, pv_value_t *res) |
| PV helper functions. | |
| int | pv_get_sintval (struct sip_msg *msg, pv_param_t *param, pv_value_t *res, int sival) |
| int | pv_get_spec_index (struct sip_msg *msg, pv_param_p ip, int *idx, int *flags) |
| int | pv_get_spec_name (struct sip_msg *msg, pv_param_p ip, pv_value_t *name) |
| int | pv_get_spec_value (struct sip_msg *msg, pv_spec_p sp, pv_value_t *value) |
| int | pv_get_strintval (struct sip_msg *msg, pv_param_t *param, pv_value_t *res, str *sval, int ival) |
| int | pv_get_strval (struct sip_msg *msg, pv_param_t *param, pv_value_t *res, str *sval) |
| int | pv_get_uintval (struct sip_msg *msg, pv_param_t *param, pv_value_t *res, unsigned int uival) |
| int | pv_init_iname (pv_spec_p sp, int param) |
| void | pv_init_table (void) |
| pv_export_t * | pv_lookup_spec_name (str *pvname, pv_spec_p e) |
| int | pv_parse_format (str *in, pv_elem_p *el) |
| int | pv_parse_index (pv_spec_p sp, str *in) |
| char * | pv_parse_spec (str *in, pv_spec_p e) |
| int | pv_printf (struct sip_msg *msg, pv_elem_p list, char *buf, int *len) |
| int | pv_printf_s (struct sip_msg *msg, pv_elem_p list, str *s) |
| int | pv_set_spec_value (struct sip_msg *msg, pv_spec_p sp, int op, pv_value_t *value) |
| void | pv_spec_free (pv_spec_t *spec) |
| int | pv_table_add (pv_export_t *e) |
| int | pv_table_free (void) |
| void | pv_value_destroy (pv_value_t *val) |
| int | register_pvars_mod (char *mod_name, pv_export_t *items) |
| int | register_trans_mod (char *mod_name, tr_export_t *items) |
| void | tr_destroy (trans_t *t) |
| Destroy transformation including eventual parameter. | |
| int | tr_exec (struct sip_msg *msg, trans_t *t, pv_value_t *v) |
| Exec transformation on a pseudo-variable value. | |
| void | tr_free (trans_t *t) |
| Free allocated memory of transformation list. | |
| static char * | tr_get_class (str *in, char *p, str *tclass) |
| void | tr_init_table (void) |
| char * | tr_lookup (str *in, trans_t **tr) |
| tr_export_t * | tr_lookup_class (str *tclass) |
| static trans_t * | tr_new (void) |
| void | tr_param_free (tr_param_t *tp) |
| Free transformation parameter list. | |
| int | tr_table_add (tr_export_t *e) |
| int | tr_table_free (void) |
Variables | |
| static pv_item_t * | _pv_table [PV_TABLE_SIZE] |
| static int | _pv_table_set = 0 |
| static tr_item_t * | _tr_table [TR_TABLE_SIZE] |
| static int | _tr_table_set = 0 |
| static str | pv_str_empty = { "", 0 } |
| static str | pv_str_marker = { PV_MARKER_STR, 1 } |
| static str | pv_str_null = { "<null>", 6 } |
Definition in file pvapi.c.
Definition at line 41 of file pvapi.c.
Referenced by parse_pvname_list(), pv_parse_format(), pv_parse_spec(), pv_table_add(), tr_get_class(), tr_lookup(), and tr_txt_parse_re().
| #define PV_PRINT_BUF_NO 3 |
| #define PV_PRINT_BUF_SIZE 1024 |
| #define PV_TABLE_SIZE 16 |
Definition at line 43 of file pvapi.c.
Referenced by pv_init_table(), pv_lookup_spec_name(), pv_table_add(), and pv_table_free().
| #define TR_TABLE_SIZE 4 |
Definition at line 44 of file pvapi.c.
Referenced by tr_init_table(), tr_lookup_class(), tr_table_add(), and tr_table_free().
| static int is_pv_valid_char | ( | char | c | ) | [static] |
| pvname_list_t* parse_pvname_list | ( | str * | in, | |
| unsigned int | type | |||
| ) |
Definition at line 992 of file pvapi.c.
References is_in_str, _str::len, LM_ERR, _pvname_list::next, NULL, pkg_free, pkg_malloc, pv_parse_spec(), _str::s, s, _pvname_list::sname, and _pv_spec::type.
Referenced by exec_avp_fixup(), and fixup_db_query_avp().
| int pv_elem_free_all | ( | pv_elem_p | log | ) |
Definition at line 1072 of file pvapi.c.
References _pv_elem::next, and pkg_free.
Referenced by fixup_spve(), and pv_parse_format().
| int pv_get_avp_name | ( | struct sip_msg * | msg, | |
| pv_param_p | ip, | |||
| int_str * | avp_name, | |||
| unsigned short * | name_type | |||
| ) |
Definition at line 802 of file pvapi.c.
References AVP_NAME_STR, AVP_SCRIPT_MASK, _pv_name::dname, _pv_value::flags, _pv_name::isname, LM_ERR, int_str::n, NULL, pv_get_spec_value(), PV_NAME_INTSTR, PV_TYPE_INT, PV_VAL_EMPTY, PV_VAL_INT, PV_VAL_NULL, _pv_param::pvn, _pv_value::ri, _pv_value::rs, int_str::s, _pv_name::type, and _pv_name::u.
Referenced by avpops_get_aname(), cpl_init(), db_query_avp(), exec_avp(), h350_auth_lookup(), init_avp_params(), init_rpid_avp(), init_tag_avp(), ldap_filter_url_encode(), ldap_write_result(), legs2strar(), mod_init(), ospVerifyParameters(), and parse_aaa_avps().
| int pv_get_intstrval | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res, | |||
| int | ival, | |||
| str * | sval | |||
| ) |
convert int-str to pv_value_t (type is int)
Definition at line 281 of file pvapi.c.
References _pv_value::flags, NULL, PV_TYPE_INT, PV_VAL_INT, PV_VAL_STR, _pv_value::ri, and _pv_value::rs.
| static int pv_get_marker | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res | |||
| ) | [static] |
Definition at line 295 of file pvapi.c.
References pv_get_strintval(), and _str::s.
Referenced by pv_parse_spec().
| int pv_get_null | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res | |||
| ) |
PV helper functions.
Definition at line 304 of file pvapi.c.
References _pv_value::flags, NULL, PV_VAL_NULL, _pv_value::ri, and _pv_value::rs.
Referenced by pv_get_color(), pv_get_dlg(), pv_get_dlg_lifetime(), pv_get_dlg_status(), pv_get_spec_value(), pv_get_t_var_req(), pv_get_t_var_rpl(), pv_get_uac_req(), pv_get_ulc(), tlsops_alt(), tlsops_bits(), tlsops_cert_version(), tlsops_check_cert(), tlsops_cipher(), tlsops_comp(), tlsops_desc(), tlsops_sn(), tlsops_tlsext(), tlsops_validity(), and tlsops_version().
| int pv_get_sintval | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res, | |||
| int | sival | |||
| ) |
convert signed int to pv_value_t
Definition at line 231 of file pvapi.c.
References _pv_value::flags, _str::len, NULL, PV_TYPE_INT, PV_VAL_INT, PV_VAL_STR, _pv_value::ri, _pv_value::rs, _str::s, and sint2str().
Referenced by bm_get_time_diff(), and pv_get_ulc().
| int pv_get_spec_index | ( | struct sip_msg * | msg, | |
| pv_param_p | ip, | |||
| int * | idx, | |||
| int * | flags | |||
| ) |
Definition at line 847 of file pvapi.c.
References _pv_index::dval, _pv_value::flags, _pv_index::ival, LM_ERR, NULL, pv_get_spec_value(), PV_IDX_ALL, PV_IDX_INT, PV_VAL_INT, _pv_param::pvi, _pv_value::ri, _pv_index::type, and _pv_index::u.
Referenced by ops_is_avp_set(), and pv_get_ulc().
| int pv_get_spec_name | ( | struct sip_msg * | msg, | |
| pv_param_p | ip, | |||
| pv_value_t * | name | |||
| ) |
Definition at line 767 of file pvapi.c.
References AVP_NAME_STR, _pv_name::dname, _pv_value::flags, _pv_name::isname, LM_ERR, NULL, pv_get_spec_value(), PV_NAME_INTSTR, PV_TYPE_INT, PV_VAL_EMPTY, PV_VAL_INT, PV_VAL_NULL, PV_VAL_STR, _pv_param::pvn, _pv_value::ri, _pv_value::rs, _pv_name::type, and _pv_name::u.
Referenced by ops_dbdelete_avps(), ops_dbload_avps(), and ops_dbstore_avps().
| int pv_get_spec_value | ( | struct sip_msg * | msg, | |
| pv_spec_p | sp, | |||
| pv_value_t * | value | |||
| ) |
Definition at line 882 of file pvapi.c.
References _pv_spec::getf, LM_ERR, LOCAL_ROUTE, NULL, pv_alter_context, pv_get_null(), _pv_spec::pvp, PVT_NONE, route_type, tr_exec(), _pv_spec::trans, and _pv_spec::type.
Referenced by allow_address(), allow_trusted_2(), allow_uri(), append2buf(), auth_get_ha1(), authorize(), comp_scriptvar(), comp_strval(), do_action(), do_from_gw(), do_to_gw(), dp_get_ivalue(), dp_get_svalue(), enum_pv_query_3(), eval_elem(), extra2strar(), fixup_get_ivalue(), fixup_get_svalue(), get_avp_credential(), get_dlg_timeout(), get_username_domain(), is_uri_user_e164(), load_gws_1(), ops_check_avp(), ops_dbdelete_avps(), ops_dbload_avps(), ops_dbstore_avps(), ops_op_avp(), ops_pushto_avp(), pv_get_avp_name(), pv_get_spec_index(), pv_get_spec_name(), pv_get_t_var_req(), pv_get_t_var_rpl(), pv_printf(), radius_does_uri_exist_1(), radius_does_uri_user_exist_1(), replace_build(), rule_translate(), set_timeout_avp(), w_is_domain_local(), w_reset_stat(), w_rl_check_forced(), w_update_stat(), and xlog_2().
| int pv_get_strintval | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res, | |||
| str * | sval, | |||
| int | ival | |||
| ) |
convert str-int to pv_value_t (type is str)
Definition at line 266 of file pvapi.c.
References _pv_value::flags, NULL, PV_VAL_INT, PV_VAL_STR, _pv_value::ri, and _pv_value::rs.
Referenced by pv_get_marker().
| int pv_get_strval | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res, | |||
| str * | sval | |||
| ) |
convert str to pv_value_t
Definition at line 252 of file pvapi.c.
References _pv_value::flags, NULL, PV_VAL_STR, and _pv_value::rs.
Referenced by pv_get_color(), pv_get_dlg(), pv_get_uac_req(), and pv_get_ulc().
| int pv_get_uintval | ( | struct sip_msg * | msg, | |
| pv_param_t * | param, | |||
| pv_value_t * | res, | |||
| unsigned int | uival | |||
| ) |
convert unsigned int to pv_value_t
Definition at line 210 of file pvapi.c.
References _pv_value::flags, int2str(), _str::len, NULL, PV_TYPE_INT, PV_VAL_INT, PV_VAL_STR, _pv_value::ri, _pv_value::rs, and _str::s.
Referenced by pv_get_dlg(), pv_get_dlg_ctx(), pv_get_uac_req(), and pv_get_ulc().
| int pv_init_iname | ( | pv_spec_p | sp, | |
| int | param | |||
| ) |
Definition at line 408 of file pvapi.c.
References _pv_name::isname, NULL, PV_NAME_INTSTR, _pv_param::pvn, _pv_spec::pvp, _pv_name::type, and _pv_name::u.
| void pv_init_table | ( | void | ) |
Definition at line 64 of file pvapi.c.
References _pv_table_set, and PV_TABLE_SIZE.
Referenced by pv_table_add().
| pv_export_t* pv_lookup_spec_name | ( | str * | pvname, | |
| pv_spec_p | e | |||
| ) |
Definition at line 315 of file pvapi.c.
References core_hash(), _pv_export::getf, _pv_spec::getf, _str::len, LM_ERR, _pv_export::name, _pv_item::next, NULL, PV_TABLE_SIZE, _pv_item::pve, _pv_item::pvid, _str::s, _pv_export::setf, _pv_spec::setf, _pv_export::type, and _pv_spec::type.
Referenced by pv_parse_spec().
Definition at line 698 of file pvapi.c.
References is_in_str, _str::len, _pv_elem::next, NULL, pkg_malloc, pv_elem_free_all(), PV_MARKER, pv_parse_spec(), _str::s, s, _pv_elem::spec, and _pv_elem::text.
Referenced by auth_fixup(), check_user_blacklist_fixup(), fixstringloadgws(), fixup_db_query_avp(), fixup_fix_sdp(), fixup_presence(), fixup_profile(), fixup_pua_xmpp(), fixup_replace_from1(), fixup_replace_from2(), fixup_sl_send_reply(), fixup_spve(), fixup_subscribe(), fixup_t_send_reply(), fixup_var_str_int(), h350_auth_lookup_fixup(), it_list_fixup(), ldap_filter_url_encode_fixup(), ldap_result_check_fixup(), ldap_search_fixup(), mod_init(), one_str_pv_elem_fixup(), and xdbg_fixup().
Definition at line 352 of file pvapi.c.
References _pv_index::dval, _pv_index::ival, _str::len, LM_ERR, NULL, pkg_malloc, PV_IDX_ALL, PV_IDX_INT, PV_IDX_PVAR, PV_MARKER, pv_parse_spec(), pv_spec_free(), _pv_param::pvi, _pv_spec::pvp, _str::s, s, _pv_index::type, and _pv_index::u.
Definition at line 417 of file pvapi.c.
References _pv_spec::getf, _pv_export::init_param, _pv_export::iparam, is_in_str, is_pv_valid_char(), _str::len, LM_ERR, NULL, _pv_export::parse_index, _pv_export::parse_name, pv_get_marker(), PV_LIBRACKET, PV_LNBRACKET, pv_lookup_spec_name(), PV_MARKER, PV_RIBRACKET, PV_RNBRACKET, PVT_MARKER, _str::s, s, TR_LBRACKET, tr_lookup(), TR_RBRACKET, _pv_spec::trans, and _pv_spec::type.
Referenced by auth_fixup(), avpops_parse_pvar(), cpl_init(), double_fixup(), dp_trans_fixup(), fixup_db_avp(), fixup_igp(), fixup_pvar(), get_gid_fixup(), get_hf(), h350_auth_lookup_fixup(), init_avp_params(), init_rpid_avp(), init_tag_avp(), ldap_filter_url_encode_fixup(), ldap_result_fixup(), mod_init(), ospVerifyParameters(), parse_aaa_avps(), parse_acc_extra(), parse_auth_avp(), parse_avp_db(), parse_extra_str(), parse_pvname_list(), parse_repl(), parse_tw_append(), pv_parse_format(), pv_parse_index(), pv_parse_t_var_name(), and xlog_fixup().
Definition at line 910 of file pvapi.c.
References _pv_value::flags, _str::len, LM_DBG, LM_ERR, _pv_elem::next, NULL, pv_get_spec_value(), PV_VAL_NULL, PVT_NONE, _pv_value::rs, _str::s, _pv_elem::spec, _pv_elem::text, and _pv_spec::type.
Referenced by func_handle_subscribe(), handle_publish(), ops_dbquery_avps(), pv_printf_s(), request_winfo(), and xl_print_log().
Definition at line 1097 of file pvapi.c.
References buf, _pv_spec::getf, _str::len, _pv_elem::next, PV_PRINT_BUF_NO, PV_PRINT_BUF_SIZE, pv_printf(), _str::s, _pv_elem::spec, and _pv_elem::text.
Referenced by authorize(), check_user_blacklist(), do_action(), ds_hash_pvar(), fix_nated_sdp_f(), fixup_get_svalue(), h350_auth_lookup(), h350_call_preferences(), h350_service_level(), h350_sipuri_lookup(), ldap_filter_url_encode(), ldap_result_check(), ldap_search_impl(), load_gws_from_grp(), rtpproxy_stream2_f(), w_add_rr_param(), w_get_profile_size(), w_is_in_profile(), w_pv_t_reply(), w_record_route(), w_record_route_preset(), w_replace_from1(), w_replace_from2(), w_send_reply(), w_set_dlg_profile(), w_sl_send_reply(), and w_unset_dlg_profile().
| int pv_set_spec_value | ( | struct sip_msg * | msg, | |
| pv_spec_p | sp, | |||
| int | op, | |||
| pv_value_t * | value | |||
| ) |
Definition at line 979 of file pvapi.c.
References LOCAL_ROUTE, NULL, pv_alter_context, pv_is_w, _pv_spec::pvp, route_type, and _pv_spec::setf.
Referenced by do_assign().
| void pv_spec_free | ( | pv_spec_t * | spec | ) |
Definition at line 1060 of file pvapi.c.
References pkg_free, tr_free(), and _pv_spec::trans.
Referenced by fixup_free_pvar(), get_gid_fixup(), pv_parse_index(), and tr_param_free().
| int pv_table_add | ( | pv_export_t * | e | ) |
Definition at line 84 of file pvapi.c.
References _pv_table_set, core_hash(), _pv_export::getf, in, is_in_str, is_pv_valid_char(), _str::len, LM_DBG, LM_ERR, _pv_export::name, _pv_item::next, NULL, pkg_malloc, pv_init_table(), PV_TABLE_SIZE, _pv_item::pve, _pv_item::pvid, PVT_NONE, _str::s, and _pv_export::type.
Referenced by register_pvars_mod().
| int pv_table_free | ( | void | ) |
Definition at line 184 of file pvapi.c.
References _pv_table_set, _pv_item::next, pkg_free, and PV_TABLE_SIZE.
| void pv_value_destroy | ( | pv_value_t * | val | ) |
Definition at line 1087 of file pvapi.c.
References _pv_value::flags, pkg_free, PV_VAL_PKG, PV_VAL_SHM, _pv_value::rs, _str::s, and shm_free.
Referenced by auth_get_ha1(), do_action(), do_assign(), and eval_elem().
| int register_pvars_mod | ( | char * | mod_name, | |
| pv_export_t * | items | |||
| ) |
Definition at line 163 of file pvapi.c.
References LM_ERR, _pv_export::name, pv_table_add(), and _str::s.
Referenced by register_module().
| int register_trans_mod | ( | char * | mod_name, | |
| tr_export_t * | items | |||
| ) |
Definition at line 1400 of file pvapi.c.
References LM_ERR, _str::s, _tr_export::tclass, and tr_table_add().
Referenced by mod_register().
| void tr_destroy | ( | trans_t * | t | ) |
Destroy transformation including eventual parameter.
| t | transformation |
Definition at line 1227 of file pvapi.c.
References _tr_param::next, NULL, _trans::params, and tr_param_free().
Referenced by tr_free(), and tr_lookup().
| int tr_exec | ( | struct sip_msg * | msg, | |
| trans_t * | t, | |||
| pv_value_t * | v | |||
| ) |
Exec transformation on a pseudo-variable value.
| msg | SIP message | |
| tr | one or more transformations | |
| val | pseudo-variable value |
Definition at line 1251 of file pvapi.c.
References LM_DBG, _trans::next, NULL, _trans::params, _trans::subtype, and _trans::trf.
Referenced by pv_get_spec_value().
| void tr_free | ( | trans_t * | t | ) |
Free allocated memory of transformation list.
| t | transformation list |
Definition at line 1275 of file pvapi.c.
References _trans::next, pkg_free, and tr_destroy().
Referenced by pv_spec_free().
Definition at line 1120 of file pvapi.c.
References is_in_str, _str::len, LM_ERR, NULL, _str::s, and TR_CLASS_MARKER.
Referenced by tr_lookup().
| void tr_init_table | ( | void | ) |
Definition at line 1322 of file pvapi.c.
References _tr_table_set, and TR_TABLE_SIZE.
Referenced by tr_table_add().
Definition at line 1152 of file pvapi.c.
References is_in_str, _str::len, LM_ERR, _trans::next, NULL, pkg_free, _str::s, s, _tr_export::tparse, tr_destroy(), tr_get_class(), TR_LBRACKET, tr_lookup_class(), tr_new(), and TR_RBRACKET.
Referenced by pv_parse_spec().
| tr_export_t* tr_lookup_class | ( | str * | tclass | ) |
Definition at line 1443 of file pvapi.c.
References core_hash(), _str::len, LM_ERR, _tr_item::next, NULL, _str::s, _tr_export::tclass, TR_TABLE_SIZE, _tr_item::tre, and _tr_item::trid.
Referenced by tr_lookup().
| static trans_t* tr_new | ( | void | ) | [inline, static] |
Definition at line 1138 of file pvapi.c.
References LM_ERR, NULL, and pkg_malloc.
Referenced by tr_lookup().
| void tr_param_free | ( | tr_param_t * | tp | ) |
Free transformation parameter list.
| tp | transformation list |
Definition at line 1293 of file pvapi.c.
References _tr_param::data, _tr_param::next, NULL, pkg_free, pv_spec_free(), TR_PARAM_SPEC, _tr_param::type, and _tr_param::v.
Referenced by tr_destroy().
| int tr_table_add | ( | tr_export_t * | e | ) |
Definition at line 1331 of file pvapi.c.
References _tr_table_set, core_hash(), _str::len, LM_DBG, LM_ERR, _tr_item::next, NULL, pkg_malloc, _str::s, _tr_export::tclass, tr_init_table(), TR_TABLE_SIZE, _tr_item::tre, and _tr_item::trid.
Referenced by register_trans_mod().
| int tr_table_free | ( | void | ) |
Definition at line 1421 of file pvapi.c.
References _tr_table_set, _tr_item::next, pkg_free, and TR_TABLE_SIZE.
int _pv_table_set = 0 [static] |
Definition at line 58 of file pvapi.c.
Referenced by pv_init_table(), pv_table_add(), and pv_table_free().
int _tr_table_set = 0 [static] |
Definition at line 1316 of file pvapi.c.
Referenced by tr_init_table(), tr_table_add(), and tr_table_free().
str pv_str_empty = { "", 0 } [static] |
str pv_str_marker = { PV_MARKER_STR, 1 } [static] |
str pv_str_null = { "<null>", 6 } [static] |
1.5.6