SIP-Router core :: modules loading, structures declarations and utilitiesModule: SIP-router core. More...
#include "sr_module.h"#include "mod_fix.h"#include "dprint.h"#include "error.h"#include "mem/mem.h"#include "core_cmd.h"#include "ut.h"#include "re.h"#include "route_struct.h"#include "flags.h"#include "trim.h"#include "pvapi.h"#include "globals.h"#include "rpc_lookup.h"#include "sr_compat.h"#include <sys/stat.h>#include <regex.h>#include <dlfcn.h>#include <strings.h>#include <stdlib.h>#include <string.h>#include <stddef.h>
Go to the source code of this file.
Definition in file sr_module.c.
| 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 |
Definition at line 759 of file sr_module.c.
| int fix_param | ( | int | type, | |
| void ** | param | |||
| ) |
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().

| action_param_type* fixup_get_param_ptype | ( | void ** | param | ) |
| param |
Definition at line 1014 of file sr_module.c.
Referenced by fixup_get_param_type().

| action_param_type fixup_get_param_type | ( | void ** | param | ) |
Definition at line 1026 of file sr_module.c.
References fixup_get_param_ptype().
Referenced by fix_param_types(), fixup_var_int_12(), fixup_var_pve_12(), fixup_var_pve_str_12(), and fixup_var_str_12().


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


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

Get the function parameter value as compiled regular expression.
Definition at line 1740 of file sr_module.c.
References fparam::regex, and fparam::type.
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.
| static sr31_cmd_export_t* sr_cmd_exports_convert | ( | unsigned | ver, | |
| void * | src, | |||
| void * | mod | |||
| ) | [static] |
| ver | - module interface versions (0 == ser, 1 == kam). | |
| src | - null terminated array of cmd exports (either ser_cmd_export_t or kam_cmd_export_t, depending on ver). | |
| mod | - pointer to module exports structure. |
Definition at line 213 of file sr_module.c.
References kam_cmd_export_::fixup, ser_cmd_export_::fixup, sr31_cmd_export_::fixup, kam_cmd_export_::flags, ser_cmd_export_::flags, sr31_cmd_export_::flags, kam_cmd_export_::free_fixup, sr31_cmd_export_::free_fixup, kam_cmd_export_::function, ser_cmd_export_::function, sr31_cmd_export_::function, get_fixup_free(), sr31_cmd_export_::module_exports, sr31_cmd_export_::name, kam_cmd_export_::name, ser_cmd_export_::name, kam_cmd_export_::param_no, ser_cmd_export_::param_no, and sr31_cmd_export_::param_no.

1.7.1