SIP Express Router v0.8.8 - Developer's Guide | ||
---|---|---|
<<< Previous | The Module Interface | Next >>> |
In addition to set of functions each module can export set of configuration variables. Value of a module's configuration variable can be changed in the config file using modparam function. Module configuration will be described in this section.
modparam function accepts three parameters:
module name - Name of module as exported in name field of exports global variable.
variable name - Name of variable to be set - it must be one of names specified in param_names field of exports variable of the module.
value - New value of the variable. There are two types of variables: string and integer. If the last parameter (value) of modparam function is enclosed in quotes, it is string paramater and server will try to find the corresponding variable among string parameters only.
Otherwise it is integer parameter and server will try to find corresponding variable among integer parameters only.
When the server finds modparam function in the config file, it will call set_mod_param function. The function can be found in modparam.c file. The function will do the following:
It tries to find corresponding variable using find_param_export function.
If it is string parameter, a new copy of the string will be obtained using strdup function and pointer to the copy will be stored in the variable.
If it is integer parameter, its value will be simply copied in the variable.
This function accepts 3 parameters:
module - Name of module.
parameter - Name of parameter to be found.
type - Type of the parameter.
The function will search list of all modules until it finds module with given name. Then it will search throught all module's exported parameters until it finds parameter with corresponding name and type. If such parameter was found, pointer to variable holding the parameter's value will be returned. If the function failed to find either module or parameter with given name and type then zero will be returned.
<<< Previous | Home | Next >>> |
Module Loading | Up | Finding an Exported Function |