#include <string.h>#include <errno.h>#include <unistd.h>#include <sys/wait.h>#include <signal.h>#include "../../sr_module.h"#include "../../ip_addr.h"#include "../../tags.h"#include "../../socket_info.h"#include "../../resolve.h"#include "../../mem/mem.h"#include "../../mem/shm_mem.h"#include "../../dprint.h"#include "../../error.h"#include "../tm/tm_load.h"#include "../tm/h_table.h"#include "../tm/t_lookup.h"#include "encode_msg.h"#include "seas.h"#include "seas_action.h"#include "event_dispatcher.h"#include "statistics.h"#include "ha.h"#include "cluster.h"

Go to the source code of this file.
Functions | |
| char * | create_as_event_sl (struct sip_msg *msg, char processor_id, int *evt_len, int flags) |
| char * | create_as_event_t (struct cell *t, struct sip_msg *msg, char processor_id, int *evt_len, int flags) |
| static int | fixup_as_relay (void **param, int param_no) |
| char | get_processor_id (struct receive_info *rcv, as_p as) |
| static int | is_e2e_ack (struct cell *t, struct sip_msg *msg) |
| static int | seas_child_init (int rank) |
| static int | seas_exit () |
| static int | seas_init (void) |
| static void | seas_init_tags () |
| void | seas_sighandler (int signo) |
| static int | w_as_relay_sl (struct sip_msg *msg, char *as_name, char *foo) |
| static MODULE_VERSION int | w_as_relay_t (struct sip_msg *msg, char *as_name, char *foo) |
Variables | |
| struct as_entry * | as_list = 0 |
| struct as_entry * | as_table = 0 |
| static cmd_export_t | cmds [] |
| struct module_exports | exports |
| int | is_dispatcher = 0 |
| static param_export_t | params [] |
| int | read_pipe = 0 |
| struct seas_functions | seas_f |
| struct ip_addr * | seas_listen_ip = 0 |
| unsigned short | seas_listen_port = 0 |
| static char * | seas_listen_socket = 0 |
| static char * | seas_stats_socket = 0 |
| char * | seas_tag_suffix |
| char | seas_tags [TOTAG_VALUE_LEN+1] |
| int | sig_flag |
| char | whoami [MAX_WHOAMI_LEN] |
| int | write_pipe = 0 |
| char* create_as_event_sl | ( | struct sip_msg * | msg, | |
| char | processor_id, | |||
| int * | evt_len, | |||
| int | flags | |||
| ) |
creates an as_event in shared memory and returns its address or NULL if error. event_length(4) UNSIGNED INT includes the length 4 bytes itself type(1), processor_id(4), flags(4), transport(1). src_ip_len(1), src_ip(4 or 16), dst_ip_len(1), dst_ip(4 or 16), src_port(2), dst_port(2),
Definition at line 543 of file seas.c.
References receive_info::dst_ip, receive_info::dst_port, encode_msg(), ENCODED_MSG_SIZE, GET_PAY_SIZE, ip_addr::len, len, LM_ERR, NULL, port, receive_info::proto, sip_msg::rcv, shm_free, shm_malloc(), SL_REQ_IN, receive_info::src_ip, receive_info::src_port, and ip_addr::u.
Referenced by w_as_relay_sl(), and w_as_relay_t().
| char* create_as_event_t | ( | struct cell * | t, | |
| struct sip_msg * | msg, | |||
| char | processor_id, | |||
| int * | evt_len, | |||
| int | flags | |||
| ) |
creates an as_event in shared memory and returns its address or NULL if error. event_length(4) UNSIGNED INT includes the length 4 bytes itself type(1), flags(4), transport(1). src_ip_len(1), src_ip(4 or 16), dst_ip_len(1), dst_ip(4 or 16), src_port(2), dst_port(2), hash index(4), label(4), [cancelled hash_index,label]
seas_f.tmb.t_get_trans_ident(msg,&hash_index,&label); this is bad, because it ref-counts !!!
we dont even pass the unknown CANCEL to JAIN
Definition at line 422 of file seas.c.
References CANCEL_FOUND, receive_info::dst_ip, receive_info::dst_port, E2E_ACK, encode_msg(), ENCODED_MSG_SIZE, GET_PAY_SIZE, cell::hash_index, is_e2e_ack(), cell::label, ip_addr::len, len, LM_DBG, LM_ERR, LM_WARN, METHOD_CANCEL, NULL, port, receive_info::proto, sip_msg::rcv, seas_f, shm_free, shm_malloc(), receive_info::src_ip, receive_info::src_port, tm_binds::t_lookup_original_t, T_REQ_IN, T_UNDEFINED, seas_functions::tmb, and ip_addr::u.
Referenced by w_as_relay_t().
| static int fixup_as_relay | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 123 of file seas.c.
References AS_TYPE, _str::len, len, LM_DBG, LM_ERR, as_entry::name, as_entry::next, pkg_free, _str::s, and shm_malloc().
| char get_processor_id | ( | struct receive_info * | rcv, | |
| as_p | as | |||
| ) |
search within a given AS, if any of the registered processors is bound to the receive_info structure passed. If there is one, it returns its identifier (number between 0 and 128), otherwise it returns -1;
Definition at line 743 of file seas.c.
References ip_addr::addr, socket_info::address, ip_addr::af, app_server::binds, app_server::bound_processor, receive_info::dst_ip, ip_addr::len, MAX_BINDS, and ip_addr::u.
Referenced by w_as_relay_sl(), and w_as_relay_t().
Definition at line 604 of file seas.c.
References METHOD_ACK, ua_server::status, and cell::uas.
Referenced by create_as_event_t().
| static int seas_child_init | ( | int | rank | ) | [static] |
This function initializes each one of the processes spawn by the server. the rank is 1 only when the main process is being initialized, so in that case the function spawns the SEAS process to handle as_events triggered from the other SER processes (executing the script). the new process created, then goes into dispatcher_main_loop(), where it reads() the pipe waiting for events produced by other SER processes.
Definition at line 703 of file seas.c.
References dispatcher_main_loop(), LM_ERR, pid, and read_pipe.
| static int seas_exit | ( | void | ) | [static] |
Definition at line 731 of file seas.c.
References socket_info::address, get_first_socket(), NULL, and pkg_free.
| static int seas_init | ( | void | ) | [static] |
Initializes seas module. It first parses the listen_sockets parameter which has the form "ip_address[:port]", creates the pipe to communicate with the dispatcher.
Populate seas_functions
Populate seas_functions
Definition at line 617 of file seas.c.
References socket_info::address, find_export(), get_first_socket(), hostent2ip_addr, LM_ERR, load_tm_api(), MAX_UNC_AS_NR, NULL, parse_cluster_cfg(), pkg_free, pkg_malloc, port, prepare_ha(), read_pipe, resolvehost(), seas_f, seas_init_tags(), seas_listen_port, seas_listen_socket, seas_stats_socket, start_stats_server(), stop_stats_server(), str2s(), seas_functions::t_check_orig_trans, seas_functions::tmb, unc_as_t, use_stats, and write_pipe.
| static void seas_init_tags | ( | void | ) | [static] |
Initializes SEAS to-tags
Definition at line 689 of file seas.c.
References init_tags(), LM_DBG, seas_tag_suffix, and seas_tags.
Referenced by seas_init().
| void seas_sighandler | ( | int | signo | ) |
Sets up signal handlers
Definition at line 171 of file seas.c.
References app_server::ac_buffer, app_server::action_fd, app_server::action_pid, as_entry::as, AS_TYPE, as_entry::connected, is_dispatcher, LM_DBG, LM_INFO, my_as, as_entry::next, pkg_free, pkg_status, _str::s, sig_flag, as_entry::type, as_entry::u, and whoami.
Referenced by dispatcher_main_loop().
| static int w_as_relay_sl | ( | struct sip_msg * | msg, | |
| char * | as_name, | |||
| char * | foo | |||
| ) | [static] |
wrapper for the AS stateless relay script function.
TODO handle this correctly !!!
Definition at line 341 of file seas.c.
References as_msg::as, as_entry::as, as_relay_stat(), AS_TYPE, CLUSTER_TYPE, create_as_event_sl(), receive_info::dst_port, get_processor_id(), as_msg::len, _str::len, len, LM_DBG, LM_ERR, as_msg::msg, as_entry::name, sip_msg::rcv, REQ_FWDED, _str::s, seas_f, shm_free, shm_malloc(), SL_REQ_IN, tm_binds::t_gett, tm_binds::t_setkr, seas_functions::tmb, as_msg::transaction, as_msg::type, as_entry::type, as_entry::u, use_stats, and write_pipe.
| static int w_as_relay_t | ( | struct sip_msg * | msg, | |
| char * | entry, | |||
| char * | foo | |||
| ) | [static] |
wrapper for the AS transaction-stateful relay script function.
returns <0 on error 1 if (new transaction was created) or if (ACK for locally replied 200 with totag) or if (ACK for code>=300) 0 if it was a retransmission
TODO handle this correctly !!!
Definition at line 230 of file seas.c.
References as_msg::as, as_entry::as, as_relay_stat(), AS_TYPE, CLUSTER_TYPE, as_entry::connected, create_as_event_sl(), create_as_event_t(), receive_info::dst_port, E_BAD_VIA, get_processor_id(), as_msg::len, _str::len, len, LM_DBG, LM_ERR, METHOD_ACK, METHOD_INVITE, as_msg::msg, as_entry::name, sip_msg::rcv, reply_to_via, REQ_FWDED, _str::s, seas_f, ser_error, shm_free, shm_malloc(), tm_binds::t_gett, tm_binds::t_newtran, tm_binds::t_reply, T_REQ_IN, tm_binds::t_setkr, T_UNDEFINED, seas_functions::tmb, as_msg::transaction, as_msg::type, as_entry::type, as_entry::u, use_stats, and write_pipe.
Definition at line 81 of file seas.c.
Referenced by add_new_as(), dispatcher_main_loop(), handle_as_data(), handle_unc_as_data(), parse_cluster_cfg(), and spawn_pinger().
cmd_export_t cmds[] [static] |
| struct module_exports exports |
| int is_dispatcher = 0 |
Definition at line 70 of file seas.c.
Referenced by dispatcher_main_loop(), seas_sighandler(), spawn_action_dispatcher(), and spawn_pinger().
param_export_t params[] [static] |
| int read_pipe = 0 |
Definition at line 84 of file seas.c.
Referenced by dispatch_relay(), dispatcher_main_loop(), seas_child_init(), and seas_init().
| struct seas_functions seas_f |
Definition at line 86 of file seas.c.
Referenced by ac_cancel(), ac_reply(), ac_uac_req(), create_as_event_t(), seas_init(), uac_cb(), w_as_relay_sl(), and w_as_relay_t().
| struct ip_addr* seas_listen_ip = 0 |
| unsigned short seas_listen_port = 0 |
char* seas_listen_socket = 0 [static] |
char* seas_stats_socket = 0 [static] |
| char* seas_tag_suffix |
| char seas_tags[TOTAG_VALUE_LEN+1] |
| int sig_flag |
last signal received
Definition at line 194 of file main.c.
Referenced by dispatcher_main_loop(), handle_sigs(), seas_sighandler(), and sig_usr().
| char whoami[MAX_WHOAMI_LEN] |
Definition at line 69 of file seas.c.
Referenced by dispatch_actions(), dispatcher_main_loop(), seas_sighandler(), and spawn_pinger().
| int write_pipe = 0 |
Definition at line 83 of file seas.c.
Referenced by seas_init(), send_ping(), uac_cb(), w_as_relay_sl(), and w_as_relay_t().
1.5.6