#include <stdio.h>#include <string.h>#include <time.h>#include <stdlib.h>#include "../../mem/mem.h"#include "../../mem/shm_mem.h"#include "../../str.h"#include "../../ut.h"#include "../../dprint.h"#include "../../parser/msg_parser.h"#include "../../data_lump_rpl.h"#include "../tm/tm_load.h"#include "../usrloc/usrloc.h"#include "CPL_tree.h"#include "loc_set.h"#include "cpl_utils.h"#include "cpl_nonsig.h"#include "cpl_sig.h"#include "cpl_env.h"#include "cpl_run.h"#include "cpl_switches.h"#include "cpl_proxy.h"

Go to the source code of this file.
Defines | |
| #define | check_overflow_by_offset(_len_, _intr_, _error_) |
| #define | check_overflow_by_ptr(_ptr_, _intr_, _error_) |
| #define | CPL_RUNTIME_ERROR ((char*)0xfffffffc) |
| #define | CPL_SCRIPT_ERROR ((char*)0xfffffffd) |
| #define | CPL_TO_CONTINUE ((char*)0xfffffffb) |
| #define | DEFAULT_ACTION ((char*)0xfffffffe) |
| #define | EO_SCRIPT ((char*)0xffffffff) |
| #define | get_basic_attr(_p_, _code_, _n_, _intr_, _error_) |
| #define | get_first_child(_node_) ((NR_OF_KIDS(_node_)==0)?DEFAULT_ACTION:(_node_)+KID_OFFSET(_node_,0)) |
| #define | get_str_attr(_p_, _s_, _len_, _intr_, _error_, _FIXUP_) |
| #define | HDR_NOT_FOUND ((char*)0xffffffff) |
| #define | UNDEF_CHAR (0xff) |
Functions | |
| int | cpl_run_script (struct cpl_interpreter *intr) |
| void | free_cpl_interpreter (struct cpl_interpreter *intr) |
| struct cpl_interpreter * | new_cpl_interpreter (struct sip_msg *msg, str *script) |
| static char * | run_cpl_node (struct cpl_interpreter *intr) |
| static int | run_default (struct cpl_interpreter *intr) |
| static char * | run_location (struct cpl_interpreter *intr) |
| static char * | run_log (struct cpl_interpreter *intr) |
| static char * | run_lookup (struct cpl_interpreter *intr) |
| static char * | run_mail (struct cpl_interpreter *intr) |
| static char * | run_redirect (struct cpl_interpreter *intr) |
| static char * | run_reject (struct cpl_interpreter *intr) |
| static char * | run_remove_location (struct cpl_interpreter *intr) |
| static char * | run_sub (struct cpl_interpreter *intr) |
Variables | |
| static str | cpl_301_reason = str_init("Moved permanently") |
| static str | cpl_302_reason = str_init("Moved temporarily") |
| #define check_overflow_by_offset | ( | _len_, | |||
| _intr_, | |||||
| _error_ | ) |
| #define check_overflow_by_ptr | ( | _ptr_, | |||
| _intr_, | |||||
| _error_ | ) |
Definition at line 68 of file cpl_run.c.
Referenced by run_address_switch(), run_language_switch(), run_lookup(), run_priority_switch(), run_proxy(), run_string_switch(), run_sub(), and run_time_switch().
| #define CPL_RUNTIME_ERROR ((char*)0xfffffffc) |
Definition at line 58 of file cpl_run.c.
Referenced by cpl_run_script(), run_address_switch(), run_language_switch(), run_location(), run_log(), run_lookup(), run_mail(), run_priority_switch(), run_proxy(), run_redirect(), run_reject(), run_string_switch(), and run_time_switch().
| #define CPL_SCRIPT_ERROR ((char*)0xfffffffd) |
Definition at line 57 of file cpl_run.c.
Referenced by cpl_run_script(), run_address_switch(), run_cpl_node(), run_language_switch(), run_location(), run_log(), run_lookup(), run_mail(), run_priority_switch(), run_proxy(), run_redirect(), run_reject(), run_remove_location(), run_string_switch(), run_sub(), and run_time_switch().
| #define CPL_TO_CONTINUE ((char*)0xfffffffb) |
| #define DEFAULT_ACTION ((char*)0xfffffffe) |
Definition at line 56 of file cpl_run.c.
Referenced by cpl_run_script(), reply_callback(), run_address_switch(), run_cpl_node(), run_language_switch(), run_lookup(), run_priority_switch(), run_proxy(), run_string_switch(), and run_time_switch().
| #define EO_SCRIPT ((char*)0xffffffff) |
Definition at line 55 of file cpl_run.c.
Referenced by cpl_run_script(), run_proxy(), run_redirect(), and run_reject().
| #define get_basic_attr | ( | _p_, | |||
| _code_, | |||||
| _n_, | |||||
| _intr_, | |||||
| _error_ | ) |
Definition at line 90 of file cpl_run.c.
Referenced by run_address_switch(), run_language_switch(), run_location(), run_log(), run_lookup(), run_mail(), run_priority_switch(), run_proxy(), run_redirect(), run_reject(), run_remove_location(), run_string_switch(), run_sub(), and run_time_switch().
| #define get_first_child | ( | _node_ | ) | ((NR_OF_KIDS(_node_)==0)?DEFAULT_ACTION:(_node_)+KID_OFFSET(_node_,0)) |
Definition at line 87 of file cpl_run.c.
Referenced by reply_callback(), run_address_switch(), run_cpl_node(), run_language_switch(), run_location(), run_log(), run_lookup(), run_mail(), run_priority_switch(), run_proxy(), run_remove_location(), run_string_switch(), run_sub(), and run_time_switch().
| #define get_str_attr | ( | _p_, | |||
| _s_, | |||||
| _len_, | |||||
| _intr_, | |||||
| _error_, | |||||
| _FIXUP_ | ) |
Definition at line 98 of file cpl_run.c.
Referenced by run_address_switch(), run_language_switch(), run_location(), run_log(), run_mail(), run_priority_switch(), run_reject(), run_remove_location(), run_string_switch(), and run_time_switch().
| #define UNDEF_CHAR (0xff) |
Definition at line 62 of file cpl_run.c.
Referenced by run_address_switch(), run_location(), run_reject(), and run_remove_location().
| int cpl_run_script | ( | struct cpl_interpreter * | intr | ) |
Definition at line 966 of file cpl_run.c.
References ADDRESS_SWITCH_NODE, check_overflow_by_offset, CPL_NODE, CPL_RUNTIME_ERROR, CPL_SCRIPT_ERROR, CPL_TO_CONTINUE, DEFAULT_ACTION, EO_SCRIPT, cpl_interpreter::ip, LANGUAGE_SWITCH_NODE, LM_DBG, LM_ERR, LOCATION_NODE, LOG_NODE, LOOKUP_NODE, MAIL_NODE, NODE_TYPE, PRIORITY_SWITCH_NODE, PROXY_NODE, REDIRECT_NODE, REJECT_NODE, REMOVE_LOCATION_NODE, run_address_switch(), run_cpl_node(), run_default(), run_language_switch(), run_location(), run_log(), run_lookup(), run_mail(), run_priority_switch(), run_proxy(), run_redirect(), run_reject(), run_remove_location(), run_string_switch(), run_sub(), run_time_switch(), SCRIPT_END, SCRIPT_FORMAT_ERROR, SCRIPT_RUN_ERROR, SCRIPT_TO_BE_CONTINUED, SIMPLE_NODE_SIZE, STRING_SWITCH_NODE, SUB_NODE, and TIME_SWITCH_NODE.
Referenced by cpl_invoke_script(), and reply_callback().
| void free_cpl_interpreter | ( | struct cpl_interpreter * | intr | ) |
Definition at line 145 of file cpl_run.c.
References cpl_interpreter::accept_language, CPL_ACCEPTLANG_DUPLICATED, CPL_FROM_DUPLICATED, CPL_ORGANIZATION_DUPLICATED, CPL_PRIORITY_DUPLICATED, CPL_RURI_DUPLICATED, CPL_SUBJECT_DUPLICATED, CPL_TO_DUPLICATED, CPL_USERAGENT_DUPLICATED, empty_location_set(), cpl_interpreter::flags, cpl_interpreter::from, cpl_interpreter::loc_set, cpl_interpreter::organization, cpl_interpreter::priority, cpl_interpreter::ruri, _str::s, cpl_interpreter::script, shm_free, cpl_interpreter::subject, cpl_interpreter::to, cpl_interpreter::user, and cpl_interpreter::user_agent.
Referenced by cpl_invoke_script(), and reply_callback().
| struct cpl_interpreter* new_cpl_interpreter | ( | struct sip_msg * | msg, | |
| str * | script | |||
| ) | [read] |
Definition at line 114 of file cpl_run.c.
References CPL_NODE, cpl_interpreter::ip, _str::len, LM_ERR, cpl_interpreter::msg, NODE_TYPE, cpl_interpreter::recv_time, _str::s, cpl_interpreter::script, and shm_malloc().
Referenced by cpl_invoke_script().
| static char* run_cpl_node | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 177 of file cpl_run.c.
References ANCILLARY_NODE, CPL_RUN_INCOMING, CPL_SCRIPT_ERROR, DEFAULT_ACTION, cpl_interpreter::flags, get_first_child, INCOMING_NODE, cpl_interpreter::ip, KID_OFFSET, LM_DBG, LM_ERR, NODE_TYPE, NR_OF_KIDS, OUTGOING_NODE, and SUBACTION_NODE.
Referenced by cpl_run_script().
| static int run_default | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 916 of file cpl_run.c.
References CPL_LOC_SET_MODIFIED, CPL_PROXY_DONE, cpl_proxy_to_loc_set(), cpl_interpreter::flags, cpl_interpreter::loc_set, cpl_interpreter::msg, SCRIPT_DEFAULT, SCRIPT_END, and SCRIPT_RUN_ERROR.
Referenced by cpl_run_script(), and reply_callback().
| static char* run_location | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 334 of file cpl_run.c.
References add_location(), ATTR_PTR, CLEAR_ATTR, CPL_LOC_SET_MODIFIED, CPL_RUNTIME_ERROR, CPL_SCRIPT_ERROR, empty_location_set(), cpl_interpreter::flags, get_basic_attr, get_first_child, get_str_attr, cpl_interpreter::ip, _str::len, LM_ERR, LM_WARN, cpl_interpreter::loc_set, NO_VAL, NR_OF_ATTR, NR_OF_KIDS, PRIORITY_ATTR, _str::s, UNDEF_CHAR, URL_ATTR, and YES_VAL.
Referenced by cpl_run_script().
| static char* run_log | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 749 of file cpl_run.c.
References ATTR_PTR, COMMENT_ATTR, cpl_env, CPL_LOG_CMD, CPL_RUNTIME_ERROR, CPL_SCRIPT_ERROR, get_basic_attr, get_first_child, get_str_attr, cpl_interpreter::ip, _str::len, LM_ERR, LM_NOTICE, cpl_enviroment::log_dir, NAME_ATTR, NR_OF_ATTR, NR_OF_KIDS, _str::s, shm_malloc(), cpl_interpreter::user, user, and write_cpl_cmd().
Referenced by cpl_run_script().
| static char* run_lookup | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 210 of file cpl_run.c.
References add_location(), ATTR_PTR, ucontact::c, ucontact::cflags, check_overflow_by_ptr, CLEAR_ATTR, urecord::contacts, cpl_env, cpl_fct, CPL_LOC_DUPL, CPL_LOC_NATED, CPL_LOC_SET_MODIFIED, CPL_RUNTIME_ERROR, CPL_SCRIPT_ERROR, DEFAULT_ACTION, empty_location_set(), ucontact::expires, FAILURE_NODE, cpl_interpreter::flags, get_basic_attr, get_first_child, usrloc_api::get_urecord, cpl_interpreter::ip, KID_OFFSET, _str::len, LM_DBG, LM_ERR, LM_WARN, cpl_interpreter::loc_set, usrloc_api::lock_udomain, cpl_enviroment::lu_append_branches, cpl_enviroment::lu_domain, usrloc_api::nat_flag, ucontact::next, NO_VAL, NODE_TYPE, NOTFOUND_NODE, NR_OF_ATTR, NR_OF_KIDS, ucontact::q, ucontact::received, _str::s, SIMPLE_NODE_SIZE, SUCCESS_NODE, cpl_functions::ulb, usrloc_api::unlock_udomain, cpl_interpreter::user, and YES_VAL.
Referenced by cpl_run_script().
| static char* run_mail | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 831 of file cpl_run.c.
References ATTR_PTR, BODY_ATTR, CPL_MAIL_CMD, CPL_RUNTIME_ERROR, CPL_SCRIPT_ERROR, get_basic_attr, get_first_child, get_str_attr, cpl_interpreter::ip, _str::len, LM_ERR, LM_WARN, NR_OF_ATTR, NR_OF_KIDS, _str::s, shm_malloc(), SUBJECT_ATTR, TO_ATTR, and write_cpl_cmd().
Referenced by cpl_run_script().
| static char* run_redirect | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 625 of file cpl_run.c.
References add_lump_rpl(), location::addr, ATTR_PTR, cpl_fct, CPL_FORCE_STATEFUL, CPL_IS_STATEFUL, CPL_RUNTIME_ERROR, CPL_SCRIPT_ERROR, CRLF, CRLF_LEN, EO_SCRIPT, cpl_interpreter::flags, free_lump_rpl(), get_basic_attr, cpl_interpreter::ip, _str::len, LM_ERR, cpl_interpreter::loc_set, LUMP_RPL_HDR, cpl_interpreter::msg, location::next, NO_VAL, NR_OF_ATTR, NR_OF_KIDS, PERMANENT_ATTR, pkg_free, pkg_malloc, location::address::priority, _str::s, sl_binds::send_reply, cpl_functions::slb, tm_binds::t_newtran, cpl_functions::tmb, unlink_lump_rpl(), location::address::uri, and YES_VAL.
Referenced by cpl_run_script().
| static char* run_reject | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 522 of file cpl_run.c.
References ATTR_PTR, cpl_fct, CPL_FORCE_STATEFUL, CPL_IS_STATEFUL, CPL_RUNTIME_ERROR, CPL_SCRIPT_ERROR, EO_SCRIPT, cpl_interpreter::flags, get_basic_attr, get_str_attr, cpl_interpreter::ip, _str::len, LM_ERR, cpl_interpreter::msg, NR_OF_ATTR, NR_OF_KIDS, REASON_ATTR, _str::s, sl_binds::send_reply, cpl_functions::slb, STATUS_ATTR, tm_binds::t_newtran, cpl_functions::tmb, and UNDEF_CHAR.
Referenced by cpl_run_script().
| static char* run_remove_location | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 411 of file cpl_run.c.
References ATTR_PTR, CPL_LOC_SET_MODIFIED, CPL_SCRIPT_ERROR, empty_location_set(), cpl_interpreter::flags, get_basic_attr, get_first_child, get_str_attr, cpl_interpreter::ip, _str::len, LM_DBG, LM_ERR, cpl_interpreter::loc_set, LOCATION_ATTR, NR_OF_ATTR, NR_OF_KIDS, remove_location(), _str::s, and UNDEF_CHAR.
Referenced by cpl_run_script().
| static char* run_sub | ( | struct cpl_interpreter * | intr | ) | [inline, static] |
Definition at line 465 of file cpl_run.c.
References ATTR_PTR, check_overflow_by_ptr, CPL_SCRIPT_ERROR, get_basic_attr, get_first_child, cpl_interpreter::ip, LM_ERR, NODE_TYPE, NR_OF_ATTR, NR_OF_KIDS, REF_ATTR, _str::s, cpl_interpreter::script, SIMPLE_NODE_SIZE, and SUBACTION_NODE.
Referenced by cpl_run_script().
str cpl_301_reason = str_init("Moved permanently") [static] |
str cpl_302_reason = str_init("Moved temporarily") [static] |
1.5.6