pvar.h File Reference

Definitions for Pseudo-variable support. More...

#include "str.h"
#include "usr_avp.h"
#include "parser/msg_parser.h"

Include dependency graph for pvar.h:

Go to the source code of this file.

Data Structures

struct  _pv_elem
struct  _pv_export
 PV spec format:
  • $class_name
  • $class_name(inner_name)
  • $(class_name[index])
  • $(class_name(inner_name)[index])
  • $(class_name{transformation})
  • $(class_name(inner_name){transformation})
  • $(class_name[index]{transformation})
  • $(class_name(inner_name)[index]{transformation}).
More...
struct  _pv_index
struct  _pv_name
struct  _pv_param
struct  _pv_spec
struct  _pv_value
struct  _pvname_list
struct  _tr_export
struct  _tr_param
struct  _trans
struct  pv_spec_list

Defines

#define pv_alter_context(pv)
#define pv_has_dname(pv)   ((pv)->pvp.pvn.type==PV_NAME_PVAR)
#define pv_has_iname(pv)
#define pv_has_sname(pv)
#define PV_IDX_ALL   2
#define PV_IDX_INT   0
#define PV_IDX_PVAR   1
#define pv_is_w(pv)   ((pv)->setf!=NULL)
#define PV_LIBRACKET   '['
#define PV_LIBRACKET_STR   "["
#define PV_LNBRACKET   '('
#define PV_LNBRACKET_STR   "("
#define PV_MARKER   '$'
#define PV_MARKER_STR   "$"
#define PV_NAME_INTSTR   0
#define PV_NAME_OTHER   2
#define PV_NAME_PVAR   1
#define PV_RIBRACKET   ']'
#define PV_RIBRACKET_STR   "]"
#define PV_RNBRACKET   ')'
#define PV_RNBRACKET_STR   ")"
#define PV_TYPE_INT   16
#define PV_VAL_EMPTY   2
#define PV_VAL_INT   8
#define PV_VAL_NONE   0
#define PV_VAL_NULL   1
#define PV_VAL_PKG   32
#define PV_VAL_SHM   64
#define PV_VAL_STR   4
#define TR_CLASS_MARKER   '.'
#define TR_LBRACKET   '{'
#define TR_LBRACKET_STR   "{"
#define TR_PARAM_MARKER   ','
#define TR_RBRACKET   '}'
#define TR_RBRACKET_STR   "}"

Typedefs

typedef struct _pv_elempv_elem_p
typedef struct _pv_elem pv_elem_t
typedef struct _pv_export pv_export_t
 PV spec format:
  • $class_name
  • $class_name(inner_name)
  • $(class_name[index])
  • $(class_name(inner_name)[index])
  • $(class_name{transformation})
  • $(class_name(inner_name){transformation})
  • $(class_name[index]{transformation})
  • $(class_name(inner_name)[index]{transformation}).

typedef int pv_flags_t
typedef int(* pv_getf_t )(struct sip_msg *, pv_param_t *, pv_value_t *)
typedef struct _pv_indexpv_index_p
typedef struct _pv_index pv_index_t
typedef int(* pv_init_param_f )(pv_spec_p sp, int param)
typedef struct _pv_namepv_name_p
typedef struct _pv_name pv_name_t
typedef struct _pv_parampv_param_p
typedef struct _pv_param pv_param_t
typedef int(* pv_parse_index_f )(pv_spec_p sp, str *in)
typedef int(* pv_parse_name_f )(pv_spec_p sp, str *in)
typedef int(* pv_setf_t )(struct sip_msg *, pv_param_t *, int, pv_value_t *)
typedef struct pv_spec_listpv_spec_list_p
typedef struct pv_spec_list pv_spec_list_t
typedef struct _pv_specpv_spec_p
typedef struct _pv_spec pv_spec_t
typedef enum _pv_type pv_type_t
typedef struct _pv_valuepv_value_p
typedef struct _pv_value pv_value_t
typedef struct _pvname_listpvname_list_p
typedef struct _pvname_list pvname_list_t
typedef struct _tr_exporttr_export_p
typedef struct _tr_export tr_export_t
typedef int(* tr_func_t )(struct sip_msg *, tr_param_t *, int, pv_value_t *)
typedef struct _tr_paramtr_param_p
typedef struct _tr_param tr_param_t
typedef char *(* tr_parsef_t )(str *, trans_t *)
typedef struct _transtrans_p
typedef struct _trans trans_t

Enumerations

enum  _pv_type {
  PVT_NONE = 0, PVT_EMPTY, PVT_NULL, PVT_MARKER,
  PVT_AVP, PVT_HDR, PVT_RURI, PVT_RURI_USERNAME,
  PVT_RURI_DOMAIN, PVT_DSTURI, PVT_COLOR, PVT_BRANCH,
  PVT_FROM, PVT_TO, PVT_OURI, PVT_SCRIPTVAR,
  PVT_MSG_BODY, PVT_CONTEXT, PVT_OTHER, PVT_EXTRA
}
enum  _tr_param_type {
  TR_PARAM_NONE = 0, TR_PARAM_STRING, TR_PARAM_NUMBER, TR_PARAM_SPEC,
  TR_PARAM_SUBST, TR_PARAM_OTHER
}

Functions

pvname_list_tparse_pvname_list (str *in, unsigned int type)
void pv_api_destroy (void)
int pv_elem_free_all (pv_elem_p log)
int pv_free_extra_list (void)
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)
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)
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 sp)
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)
int pv_spec_dbg (pv_spec_p sp)
void pv_spec_free (pv_spec_t *spec)
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)
int tr_exec (struct sip_msg *msg, trans_t *t, pv_value_t *v)
 Exec transformation on a pseudo-variable value.
char * tr_lookup (str *in, trans_t **tr)
tr_export_ttr_lookup_class (str *tclass)
void tr_param_free (tr_param_t *tp)
 Free transformation parameter list.


Detailed Description

Definitions for Pseudo-variable support.

Definition in file pvar.h.


Define Documentation

#define pv_alter_context ( pv   ) 

Value:

((pv)->type==PVT_CONTEXT \
                           || (pv)->type==PVT_BRANCH)

Definition at line 137 of file pvar.h.

Referenced by pv_get_spec_value(), pv_get_t_var_req(), pv_get_t_var_rpl(), and pv_set_spec_value().

#define pv_has_dname ( pv   )     ((pv)->pvp.pvn.type==PV_NAME_PVAR)

if PV name is dynamic, integer, or str

Definition at line 67 of file pvar.h.

Referenced by ops_dbdelete_avps(), ops_dbload_avps(), and ops_dbstore_avps().

#define pv_has_iname ( pv   ) 

Value:

((pv)->pvp.pvn.type==PV_NAME_INTSTR \
                     && !((pv)->pvp.pvn.u.isname.type&AVP_NAME_STR))

Definition at line 68 of file pvar.h.

Referenced by parse_avp_db().

#define pv_has_sname ( pv   ) 

Value:

((pv)->pvp.pvn.type==PV_NAME_INTSTR \
                     && (pv)->pvp.pvn.u.isname.type&AVP_NAME_STR)

Definition at line 70 of file pvar.h.

Referenced by parse_avp_db().

#define PV_IDX_ALL   2

Definition at line 64 of file pvar.h.

Referenced by pv_get_spec_index(), and pv_parse_index().

#define PV_IDX_INT   0

Definition at line 62 of file pvar.h.

Referenced by pv_get_spec_index(), and pv_parse_index().

#define PV_IDX_PVAR   1

Definition at line 63 of file pvar.h.

Referenced by pv_parse_index().

#define pv_is_w ( pv   )     ((pv)->setf!=NULL)

Definition at line 72 of file pvar.h.

Referenced by do_action(), do_assign(), mod_init(), and pv_set_spec_value().

#define PV_LIBRACKET   '['

Definition at line 45 of file pvar.h.

Referenced by pv_parse_spec().

#define PV_LIBRACKET_STR   "["

Definition at line 44 of file pvar.h.

#define PV_LNBRACKET   '('

Definition at line 40 of file pvar.h.

Referenced by pv_parse_spec().

#define PV_LNBRACKET_STR   "("

Definition at line 39 of file pvar.h.

#define PV_MARKER   '$'

#define PV_MARKER_STR   "$"

Definition at line 36 of file pvar.h.

#define PV_NAME_INTSTR   0

#define PV_NAME_OTHER   2

Definition at line 60 of file pvar.h.

#define PV_NAME_PVAR   1

Definition at line 59 of file pvar.h.

Referenced by pv_parse_t_var_name(), and pv_parse_ulc_name().

#define PV_RIBRACKET   ']'

Definition at line 47 of file pvar.h.

Referenced by pv_parse_spec().

#define PV_RIBRACKET_STR   "]"

Definition at line 46 of file pvar.h.

#define PV_RNBRACKET   ')'

Definition at line 42 of file pvar.h.

Referenced by pv_parse_spec().

#define PV_RNBRACKET_STR   ")"

Definition at line 41 of file pvar.h.

#define PV_TYPE_INT   16

#define PV_VAL_EMPTY   2

#define PV_VAL_INT   8

#define PV_VAL_NONE   0

Definition at line 49 of file pvar.h.

Referenced by auth_get_ha1(), and eval_elem().

#define PV_VAL_NULL   1

#define PV_VAL_PKG   32

Definition at line 55 of file pvar.h.

Referenced by eval_elem(), and pv_value_destroy().

#define PV_VAL_SHM   64

Definition at line 56 of file pvar.h.

Referenced by eval_elem(), and pv_value_destroy().

#define PV_VAL_STR   4

#define TR_CLASS_MARKER   '.'

Definition at line 224 of file pvar.h.

Referenced by tr_get_class().

#define TR_LBRACKET   '{'

Definition at line 221 of file pvar.h.

Referenced by pv_parse_spec(), tr_lookup(), and tr_txt_parse_re().

#define TR_LBRACKET_STR   "{"

Transformations

Definition at line 220 of file pvar.h.

#define TR_PARAM_MARKER   ','

Definition at line 225 of file pvar.h.

Referenced by tr_txt_parse_re().

#define TR_RBRACKET   '}'

Definition at line 223 of file pvar.h.

Referenced by pv_parse_spec(), tr_lookup(), and tr_txt_parse_re().

#define TR_RBRACKET_STR   "}"

Definition at line 222 of file pvar.h.


Typedef Documentation

typedef struct _pv_elem * pv_elem_p

typedef struct _pv_elem pv_elem_t

typedef struct _pv_export pv_export_t

PV spec format:

  • $class_name
  • $class_name(inner_name)
  • $(class_name[index])
  • $(class_name(inner_name)[index])
  • $(class_name{transformation})
  • $(class_name(inner_name){transformation})
  • $(class_name[index]{transformation})
  • $(class_name(inner_name)[index]{transformation}).

typedef int pv_flags_t

Definition at line 85 of file pvar.h.

typedef int(* pv_getf_t)(struct sip_msg *, pv_param_t *, pv_value_t *)

Definition at line 122 of file pvar.h.

typedef struct _pv_index * pv_index_p

typedef struct _pv_index pv_index_t

typedef int(* pv_init_param_f)(pv_spec_p sp, int param)

Definition at line 135 of file pvar.h.

typedef struct _pv_name * pv_name_p

typedef struct _pv_name pv_name_t

typedef struct _pv_param * pv_param_p

typedef struct _pv_param pv_param_t

typedef int(* pv_parse_index_f)(pv_spec_p sp, str *in)

Definition at line 134 of file pvar.h.

typedef int(* pv_parse_name_f)(pv_spec_p sp, str *in)

Definition at line 133 of file pvar.h.

typedef int(* pv_setf_t)(struct sip_msg *, pv_param_t *, int, pv_value_t *)

Definition at line 123 of file pvar.h.

typedef struct pv_spec_list * pv_spec_list_p

typedef struct pv_spec_list pv_spec_list_t

typedef struct _pv_spec * pv_spec_p

typedef struct _pv_spec pv_spec_t

typedef enum _pv_type pv_type_t

Definition at line 84 of file pvar.h.

typedef struct _pv_value * pv_value_p

typedef struct _pv_value pv_value_t

typedef struct _pvname_list * pvname_list_p

typedef struct _pvname_list pvname_list_t

typedef struct _tr_export * tr_export_p

typedef struct _tr_export tr_export_t

typedef int(* tr_func_t)(struct sip_msg *, tr_param_t *, int, pv_value_t *)

Definition at line 240 of file pvar.h.

typedef struct _tr_param * tr_param_p

typedef struct _tr_param tr_param_t

typedef char*(* tr_parsef_t)(str *, trans_t *)

Definition at line 251 of file pvar.h.

typedef struct _trans * trans_p

typedef struct _trans trans_t


Enumeration Type Documentation

enum _pv_type

Enumerator:
PVT_NONE 
PVT_EMPTY 
PVT_NULL 
PVT_MARKER 
PVT_AVP 
PVT_HDR 
PVT_RURI 
PVT_RURI_USERNAME 
PVT_RURI_DOMAIN 
PVT_DSTURI 
PVT_COLOR 
PVT_BRANCH 
PVT_FROM 
PVT_TO 
PVT_OURI 
PVT_SCRIPTVAR 
PVT_MSG_BODY 
PVT_CONTEXT 
PVT_OTHER 
PVT_EXTRA 

Definition at line 74 of file pvar.h.

Enumerator:
TR_PARAM_NONE 
TR_PARAM_STRING 
TR_PARAM_NUMBER 
TR_PARAM_SPEC 
TR_PARAM_SUBST 
TR_PARAM_OTHER 

Definition at line 227 of file pvar.h.


Function Documentation

pvname_list_t* parse_pvname_list ( str in,
unsigned int  type 
)

void pv_api_destroy ( void   ) 

Definition at line 1469 of file pvapi.c.

Referenced by cleanup().

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_free_extra_list ( void   ) 

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 
)

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.

int pv_get_null ( struct sip_msg msg,
pv_param_t param,
pv_value_t res 
)

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 
)

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 
)

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 
)

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  sp 
)

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 
)

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().

int pv_spec_dbg ( pv_spec_p  sp  ) 

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().

void pv_value_destroy ( pv_value_t val  ) 

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().

int tr_exec ( struct sip_msg msg,
trans_t t,
pv_value_t v 
)

Exec transformation on a pseudo-variable value.

Parameters:
msg SIP message
tr one or more transformations
val pseudo-variable value
Returns:
0 on success, -1 on error

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().

char* tr_lookup ( str in,
trans_t **  tr 
)

tr_export_t* tr_lookup_class ( str tclass  ) 

void tr_param_free ( tr_param_t tp  ) 

Free transformation parameter list.

Parameters:
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().


Generated on Thu May 24 08:01:16 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6