SIP-Router core :: modules loading, structures declarations and utilitiesModule: SIP-router core. More...
#include <dlfcn.h>#include "parser/msg_parser.h"#include "ver_defs.h"#include "rpc.h"#include "route_struct.h"#include "route.h"#include "str.h"#include "kstats_types.h"#include "mi/mi_types.h"#include "pvar.h"

Go to the source code of this file.
Definition in file sr_module.h.
| #define PROC_INIT -127 |
total number of processes).
Definition at line 194 of file sr_module.h.
Referenced by child_init().
| #define PROC_SIPRPC 127 |
Don't do any special processing in the child init with this rank - just bare child initialization
Definition at line 209 of file sr_module.h.
Referenced by init_mi_child().
| typedef int(* cmd_function)(struct sip_msg *, char *param1, char *param2) |
Main two parameter module function, default and oldest version.
| sip_msg | SIP message | |
| param1 | first parameter | |
| param2 | second parameter |
Definition at line 122 of file sr_module.h.
| typedef int(* cmd_function_var)(struct sip_msg *, int no, action_u_t *vals) |
Variable number of parameter module function, takes as param the sip_msg, extra parameters number and a pointer to an array of parameters
| sip_msg | SIP message | |
| no | extra parameters number | |
| vals | extra parameters |
Definition at line 139 of file sr_module.h.
| typedef int(* mod_register_function)(char *path, int *dlflags, void *reserved1, void *reserved2) |
mod_register is a function called when loading a module (if present), prior to registering the module exports.
| path | path to the module, including file name | |
| dlflags | pointer to the dlflags used when loading the module. If the value is changed to a different and non-zero value, the module will be reloaded with the new flags. | |
| reserved1 | - reserved for future use. | |
| reserved2 | - reserved for future use |
Definition at line 109 of file sr_module.h.
| typedef int(* response_function)(struct sip_msg *) |
| sip_msg | SIP message |
Definition at line 148 of file sr_module.h.
| void* find_param_export | ( | struct sr_module * | mod, | |
| char * | name, | |||
| modparam_t | type_mask, | |||
| modparam_t * | param_type | |||
| ) |
| mod | module | |
| name | parameter name | |
| type_mask | parameter mask | |
| param_type | parameter type |
| mod | module | |
| name | parameter name | |
| type_mask | parameter mask | |
| param_type | parameter type |
Definition at line 759 of file sr_module.c.
| int fix_param | ( | int | type, | |
| void ** | param | |||
| ) |
Generic parameter fixup function which creates fparam_t structure. Type parameter contains allowed parameter types.
| type | parameter type | |
| param | fixed parameter |
Creates a fparam_t structure.
| type | contains allowed parameter types | |
| param | is the parameter that will be fixed-up |
Definition at line 1101 of file sr_module.c.
References fparam::asciiz, fparam::avp, fparam::i, _str::len, fparam::orig, parse_avp_ident(), parse_select(), fparam::pve, fparam::pvs, fparam::regex, _str::s, fparam::select, fparam::str, fparam::subst, and fparam::type.
Referenced by fix_param_types(), fixup_int_12(), fixup_regex_12(), fixup_str_12(), fixup_var_int_12(), fixup_var_pve_12(), fixup_var_pve_str_12(), and fixup_var_str_12().


| int fix_param_types | ( | int | types, | |
| void ** | param | |||
| ) |
| types | - bitmap of the allowed types (e.g. FPARAM_INT|FPARAM_STR) | |
| param | - value/result |
Definition at line 1328 of file sr_module.c.
References fix_param(), and fixup_get_param_type().

| int fixup_free_fparam_1 | ( | void ** | param, | |
| int | param_no | |||
| ) |
| param | - double pointer to param, as for normal fixup functions. | |
| param_no | - parameter number: the function will work only for param_no == 1 (first parameter). |
Definition at line 1774 of file sr_module.c.
References fparam_free_restore().

| int fixup_free_fparam_2 | ( | void ** | param, | |
| int | param_no | |||
| ) |
| param | - double pointer to param, as for normal fixup functions. | |
| param_no | - parameter number: the function will work only for param_no == 2 (2nd parameter). |
Definition at line 1789 of file sr_module.c.
References fparam_free_restore().

| int fixup_free_fparam_all | ( | void ** | param, | |
| int | param_no | |||
| ) |
| param | - double pointer to param, as for normal fixup functions. | |
| param_no | - parameter number, ignored. |
Definition at line 1760 of file sr_module.c.
References fparam_free_restore().

| int fixup_var_int_12 | ( | void ** | param, | |
| int | param_no | |||
| ) |
Fixup variable integer, the parameter can be AVP, SELECT, or ordinary integer. AVP and select identifiers will be resolved to their values and converted to int if necessary during runtime. The parameter value will be converted to fparam structure
| param | fixed parameter value | |
| param_no | number of parameter |
Definition at line 1493 of file sr_module.c.
References fix_param(), and fixup_get_param_type().
Referenced by fixup_sl_reply(), fixup_var_int_1(), fixup_var_int_2(), get_fixup_free(), and is_fparam_rve_fixup().


| int fixup_var_pve_12 | ( | void ** | param, | |
| int | param_no | |||
| ) |
The parameter can be a PVE (pv based format string) or string. non-static PVEs identifiers will be resolved to their values during runtime. The parameter value will be converted to fparam structure
| param | - double pointer to param, as for normal fixup functions. | |
| param_no | - parameter number, ignored. |
Definition at line 1398 of file sr_module.c.
References fix_param(), fixup_get_param_type(), fparam_free_restore(), and fparam::pve.

| int fixup_var_pve_str_12 | ( | void ** | param, | |
| int | param_no | |||
| ) |
The parameter can be a PVAR, AVP, SELECT, PVE (pv based format string) or string.
The parameter can be a PVAR, AVP, SELECT, PVE (pv based format string) or string. PVAR, AVP and select and non-static PVEs identifiers will be resolved to their values during runtime. The parameter value will be converted to fparam structure
| param | - double pointer to param, as for normal fixup functions. | |
| param_no | - parameter number, ignored. |
Definition at line 1437 of file sr_module.c.
References fix_param(), fixup_get_param_type(), fparam_free_restore(), and fparam::pve.
Referenced by fixup_sl_reply(), fixup_var_pve_str_1(), fixup_var_pve_str_2(), get_fixup_free(), and is_fparam_rve_fixup().


| int fixup_var_str_12 | ( | void ** | param, | |
| int | param_no | |||
| ) |
Fixup variable string, the parameter can be AVP, SELECT, or ordinary string. AVP and select identifiers will be resolved to their values during runtime. The parameter value will be converted to fparam structure.
| param | fixed parameter value | |
| param_no | number of parameter |
Definition at line 1357 of file sr_module.c.
References fix_param(), and fixup_get_param_type().
Referenced by fixup_var_str_1(), fixup_var_str_2(), get_fixup_free(), and is_fparam_rve_fixup().


| void fparam_free_contents | ( | fparam_t * | fp | ) |
Frees the "content" of a fparam, but not the fparam itself. Note: it doesn't free fp->orig! Assumes pkg_malloc'ed content.
| fp | - fparam to be freed |
Definition at line 1248 of file sr_module.c.
References fparam::avp, free_select(), pv_spec_free(), fparam::pve, fparam::pvs, fparam::regex, fparam::select, fparam::subst, and fparam::type.
Referenced by fparam_free_restore().


| void fparam_free_restore | ( | void ** | param | ) |
Generic free fixup type function for a fixed fparam. It will free whatever was allocated during the initial fparam fixup and restore the original param value.
| param | freed parameters |
Definition at line 1306 of file sr_module.c.
References fparam_free_contents(), and fparam::orig.
Referenced by fixup_free_fparam_1(), fixup_free_fparam_2(), fixup_free_fparam_all(), fixup_var_pve_12(), and fixup_var_pve_str_12().


| free_fixup_function get_fixup_free | ( | fixup_function | f | ) |
Returns the corresponding fixup_free* for various known fixup types. Used to automatically fill in free_fixup* functions.
| f | fixup function pointer |
Definition at line 1839 of file sr_module.c.
References fixup_int_1(), fixup_int_12(), fixup_int_2(), fixup_regex_1(), fixup_regex_12(), fixup_regex_2(), fixup_str_1(), fixup_str_12(), fixup_str_2(), fixup_var_int_1(), fixup_var_int_12(), fixup_var_int_2(), fixup_var_pve_str_1(), fixup_var_pve_str_12(), fixup_var_pve_str_2(), fixup_var_str_1(), fixup_var_str_12(), fixup_var_str_2(), and mod_fix_get_fixup_free().
Referenced by sr_cmd_exports_convert().


| dst | string destination | |
| msg | SIP message | |
| param | function parameters |
Definition at line 1679 of file sr_module.c.
References fparam::avp, fparam::i, fparam::orig, fparam::pvs, fparam::select, and fparam::type.
Referenced by w_send_reply(), w_sl_send_reply(), and xmlrpc_reply().

| dst | string destination | |
| msg | SIP message | |
| param | function parameters |
Get the function parameter value as compiled regular expression.
Definition at line 1740 of file sr_module.c.
References fparam::regex, and fparam::type.
| dst | string destination | |
| msg | SIP message | |
| param | function parameters |
Definition at line 1612 of file sr_module.c.
References fparam::asciiz, fparam::avp, int2str(), _str::len, fparam::orig, fparam::pve, fparam::pvs, _str::s, fparam::select, fparam::str, and fparam::type.
Referenced by w_send_reply(), w_sl_send_reply(), and xmlrpc_reply().


| int is_fparam_rve_fixup | ( | fixup_function | f | ) |
Used to automatically detect "pure" fparam fixups that can be used with non contant RVEs.
| f | - function pointer |
Definition at line 1804 of file sr_module.c.
References fixup_int_1(), fixup_int_12(), fixup_int_2(), fixup_regex_1(), fixup_regex_12(), fixup_regex_2(), fixup_str_1(), fixup_str_12(), fixup_str_2(), fixup_var_int_1(), fixup_var_int_12(), fixup_var_int_2(), fixup_var_pve_str_1(), fixup_var_pve_str_12(), fixup_var_pve_str_2(), fixup_var_str_1(), fixup_var_str_12(), and fixup_var_str_2().

| int load_module | ( | char * | mod_path | ) |
tries to load the module specified by mod_path. If mod_path is 'modname' or 'modname.so' then <MODS_DIR>/<modname>.so will be tried and if this fails <MODS_DIR>/<modname>/<modname>.so If mod_path contain a '/' it is assumed to be the path to the module and tried first. If fails and mod_path is not absolute path (not starting with '/') then will try: <MODS_DIR>/mod_path
| mod_path | path or module name |
Definition at line 440 of file sr_module.c.
References DEFAULT_DLFLAGS, and modules.
1.7.1