#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <fcntl.h>#include <signal.h>#include "../../mem/shm_mem.h"#include "../../mem/mem.h"#include "../../sr_module.h"#include "../../str.h"#include "../../ut.h"#include "../../dprint.h"#include "../../data_lump_rpl.h"#include "../../pvar.h"#include "../../parser/parse_uri.h"#include "../../parser/parse_from.h"#include "../../parser/parse_content.h"#include "../../parser/parse_disposition.h"#include "../../db/db.h"#include "../../mi/mi.h"#include "../sl/sl_api.h"#include "cpl_run.h"#include "cpl_env.h"#include "cpl_db.h"#include "cpl_loader.h"#include "cpl_parser.h"#include "cpl_nonsig.h"#include "loc_set.h"

Go to the source code of this file.
Data Structures | |
| struct | cpl_error |
Defines | |
| #define | ACTION_PARAM "action" |
| #define | ACTION_PARAM_LEN (sizeof(ACTION_PARAM)-1) |
| #define | CONTENT_TYPE_HDR ("Content-Type: application/cpl-xml"CRLF) |
| #define | CONTENT_TYPE_HDR_LEN (sizeof(CONTENT_TYPE_HDR)-1) |
| #define | CPL_SCRIPT "script" |
| #define | CPL_SCRIPT_LEN (sizeof(CPL_SCRIPT)-1) |
| #define | MAX_PROXY_RECURSE 10 |
| #define | MAX_USERHOST_LEN 256 |
| #define | REMOVE_ACTION "remove" |
| #define | REMOVE_ACTION_LEN (sizeof(REMOVE_ACTION)-1) |
| #define | REMOVE_SCRIPT 0xcaca |
| #define | STORE_ACTION "store" |
| #define | STORE_ACTION_LEN (sizeof(STORE_ACTION)-1) |
| #define | STORE_SCRIPT 0xbebe |
Functions | |
| static int | build_user_AOR (str *username, str *domain, str *uh, int sip) |
| static int | cpl_child_init (int rank) |
| static int | cpl_exit (void) |
| static int | cpl_init (void) |
| static MODULE_VERSION int | cpl_invoke_script (struct sip_msg *msg, char *str, char *str2) |
| static void | cpl_process (int rank) |
| static int | cpl_process_register (struct sip_msg *msg, int no_rpl) |
| static int | do_script_action (struct sip_msg *msg, int action) |
| static int | do_script_download (struct sip_msg *msg) |
| static int | fixup_cpl_run_script (void **param, int param_no) |
| static int | get_dest_user (struct sip_msg *msg, str *username, str *domain) |
| static int | get_orig_user (struct sip_msg *msg, str *username, str *domain) |
| static int | mi_child_init (void) |
| static int | w_process_register (struct sip_msg *msg, char *str, char *str2) |
| static int | w_process_register_norpl (struct sip_msg *msg, char *str, char *str2) |
Variables | |
| static struct cpl_error | bad_cpl = {400,str_init("Bad CPL script")} |
| static struct cpl_error | bad_req = {400,str_init("Bad request")} |
| static cmd_export_t | cmds [] |
| struct cpl_enviroment | cpl_env |
| static struct cpl_error * | cpl_err = &bad_req |
| struct cpl_functions | cpl_fct |
| static str | cpl_ok_rpl = str_init("OK") |
| static proc_export_t | cpl_procs [] |
| static str | db_table = str_init("cpl") |
| static str | db_url = str_init(DEFAULT_DB_URL) |
| static char * | dtd_file = 0 |
| struct module_exports | exports |
| static struct cpl_error | intern_err = {500,str_init("Internal server error")} |
| static char * | lookup_domain = 0 |
| static mi_export_t | mi_cmds [] |
| static param_export_t | params [] |
| static str | timer_avp = {NULL, 0} |
| #define ACTION_PARAM "action" |
| #define ACTION_PARAM_LEN (sizeof(ACTION_PARAM)-1) |
| #define CONTENT_TYPE_HDR ("Content-Type: application/cpl-xml"CRLF) |
Definition at line 629 of file cpl.c.
Referenced by do_script_download(), and send_sip_msg_request().
| #define CONTENT_TYPE_HDR_LEN (sizeof(CONTENT_TYPE_HDR)-1) |
Definition at line 630 of file cpl.c.
Referenced by do_script_download(), and send_sip_msg_request().
| #define CPL_SCRIPT "script" |
| #define CPL_SCRIPT_LEN (sizeof(CPL_SCRIPT)-1) |
| #define MAX_PROXY_RECURSE 10 |
| #define REMOVE_ACTION "remove" |
| #define REMOVE_ACTION_LEN (sizeof(REMOVE_ACTION)-1) |
| #define REMOVE_SCRIPT 0xcaca |
| #define STORE_ACTION "store" |
| #define STORE_ACTION_LEN (sizeof(STORE_ACTION)-1) |
| #define STORE_SCRIPT 0xbebe |
Definition at line 423 of file cpl.c.
References cpl_enviroment::case_sensitive, len, _str::len, LM_CRIT, LM_ERR, cpl_enviroment::realm_prefix, _str::s, shm_malloc(), and cpl_enviroment::use_domain.
Referenced by cpl_invoke_script().
| static int cpl_child_init | ( | int | rank | ) | [static] |
| static int cpl_exit | ( | void | ) | [static] |
| static int cpl_init | ( | void | ) | [static] |
Definition at line 227 of file cpl.c.
References bind_usrloc(), cpl_enviroment::cmd_pipe, cpl_db_bind(), cpl_fct, dtd_file, find_export(), init_CPL_parser(), _str::len, LM_CRIT, LM_ERR, LM_INFO, LM_NOTICE, load_sl_api(), load_tm_api(), cpl_enviroment::log_dir, lookup_domain, cpl_enviroment::lu_domain, MAX_LOG_DIR_SIZE, MAX_PROXY_RECURSE, cpl_enviroment::orig_tz, cpl_enviroment::proxy_recurse, pv_get_avp_name(), pv_parse_spec(), _pv_spec::pvp, PVT_AVP, cpl_enviroment::realm_prefix, usrloc_api::register_udomain, _str::s, shm_malloc(), cpl_functions::slb, strlower(), cpl_enviroment::timer_avp, cpl_enviroment::timer_avp_type, cpl_functions::tmb, _pv_spec::type, and cpl_functions::ulb.
| static int cpl_invoke_script | ( | struct sip_msg * | msg, | |
| char * | str, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 542 of file cpl.c.
References add_location(), build_user_AOR(), cpl_bin_col, CPL_RUN_INCOMING, CPL_RUN_OUTGOING, cpl_run_script(), domain, cpl_interpreter::flags, free_cpl_interpreter(), get_dest_user(), get_orig_user(), get_user_script(), _str::len, cpl_interpreter::loc_set, new_cpl_interpreter(), _str::s, cpl_interpreter::script, SCRIPT_DEFAULT, SCRIPT_END, SCRIPT_FORMAT_ERROR, SCRIPT_RUN_ERROR, SCRIPT_TO_BE_CONTINUED, shm_free, cpl_enviroment::use_domain, and cpl_interpreter::user.
| static void cpl_process | ( | int | rank | ) | [static] |
Definition at line 405 of file cpl.c.
References cpl_enviroment::cmd_pipe, cpl_aux_process(), and cpl_enviroment::log_dir.
| static int cpl_process_register | ( | struct sip_msg * | msg, | |
| int | no_rpl | |||
| ) | [static] |
Definition at line 773 of file cpl.c.
References ACTION_PARAM, ACTION_PARAM_LEN, disposition_param::body, cpl_fct, CPL_SCRIPT, CPL_SCRIPT_LEN, do_script_action(), do_script_download(), cpl_error::err_code, cpl_error::err_msg, get_accept, get_content_disposition, _str::len, LM_DBG, LM_ERR, disposition_param::name, disposition_param::next, disposition::params, parse_accept_hdr(), parse_content_disposition(), parse_content_type_hdr(), print_disposition(), REMOVE_ACTION, REMOVE_ACTION_LEN, REMOVE_SCRIPT, _str::s, sl_binds::send_reply, cpl_functions::slb, STORE_ACTION, STORE_ACTION_LEN, STORE_SCRIPT, SUBTYPE_ALL, SUBTYPE_CPLXML, disposition::type, TYPE_ALL, and TYPE_APPLICATION.
Referenced by w_process_register(), and w_process_register_norpl().
| static int do_script_action | ( | struct sip_msg * | msg, | |
| int | action | |||
| ) | [inline, static] |
Definition at line 644 of file cpl.c.
References sip_msg::content_length, domain, encodeCPL(), get_body(), get_content_length, get_dest_user(), HDR_CONTENTLENGTH_F, _str::len, LM_ERR, parse_headers(), pkg_free, REMOVE_SCRIPT, rmv_from_db(), _str::s, STORE_SCRIPT, cpl_enviroment::use_domain, and write_to_db().
Referenced by cpl_process_register().
| static int do_script_download | ( | struct sip_msg * | msg | ) | [inline, static] |
Definition at line 716 of file cpl.c.
References add_lump_rpl(), CONTENT_TYPE_HDR, CONTENT_TYPE_HDR_LEN, cpl_xml_col, domain, get_dest_user(), get_user_script(), _str::len, LM_ERR, LUMP_RPL_BODY, LUMP_RPL_HDR, _str::s, shm_free, and cpl_enviroment::use_domain.
Referenced by cpl_process_register().
| static int fixup_cpl_run_script | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 192 of file cpl.c.
References CPL_FORCE_STATEFUL, CPL_IS_STATEFUL, CPL_RUN_INCOMING, CPL_RUN_OUTGOING, E_UNSPEC, LM_ERR, and pkg_free.
Definition at line 483 of file cpl.c.
References sip_msg::first_line, get_to, HDR_TO_F, sip_uri::host, _str::len, LM_DBG, LM_ERR, sip_msg::new_uri, parse_headers(), parse_uri(), msg_start::request, _str::s, sip_msg::to, msg_start::u, and sip_uri::user.
Referenced by cpl_invoke_script(), do_script_action(), and do_script_download().
Definition at line 513 of file cpl.c.
References sip_msg::from, sip_uri::host, _str::len, LM_DBG, LM_ERR, parse_from_header(), parse_uri(), hdr_field::parsed, _str::s, to_body::uri, and sip_uri::user.
Referenced by cpl_invoke_script().
| static int mi_child_init | ( | void | ) | [static] |
| static int w_process_register | ( | struct sip_msg * | msg, | |
| char * | str, | |||
| char * | str2 | |||
| ) | [static] |
| static int w_process_register_norpl | ( | struct sip_msg * | msg, | |
| char * | str, | |||
| char * | str2 | |||
| ) | [static] |
cmd_export_t cmds[] [static] |
| struct cpl_enviroment cpl_env |
Definition at line 81 of file cpl.c.
Referenced by cpl_proxy_to_loc_set(), mi_cpl_get(), mi_cpl_load(), mi_cpl_remove(), run_log(), run_lookup(), run_proxy(), run_time_switch(), and write_cpl_cmd().
| struct cpl_functions cpl_fct |
Definition at line 96 of file cpl.c.
Referenced by cpl_init(), cpl_process_register(), cpl_proxy_to_loc_set(), run_lookup(), run_proxy(), run_redirect(), and run_reject().
str cpl_ok_rpl = str_init("OK") [static] |
proc_export_t cpl_procs[] [static] |
Initial value:
{
{"CPL Aux", 0, 0, cpl_process, 1 },
{0,0,0,0,0}
}
char* dtd_file = 0 [static] |
| struct module_exports exports |
struct cpl_error intern_err = {500,str_init("Internal server error")} [static] |
char* lookup_domain = 0 [static] |
mi_export_t mi_cmds[] [static] |
param_export_t params[] [static] |
1.5.6