#include "seas.h"


Go to the source code of this file.
Data Structures | |
| struct | as_uac_param |
Defines | |
| #define | AC_CANCEL 7 |
| #define | AC_FAIL_UNKNOWN 0x01 |
| #define | AC_RES_FAIL 5 |
| #define | FAKED_REPLY_FLAG 0x02 |
| #define | JAIN_PONG 8 |
| #define | REPLY_FIN 2 |
| #define | REPLY_FIN_DLG 3 |
| #define | REPLY_PROV 1 |
| #define | SL_MSG 6 |
| #define | UAC_REQ 4 |
Functions | |
| int | ac_cancel (as_p the_as, char *action, int len) |
| int | ac_encode_msg (as_p the_as, char *action, int len) |
| int | ac_reply (as_p the_as, char *action, int len) |
| int | ac_sl_msg (as_p the_as, char *action, int len) |
| int | ac_uac_req (as_p the_as, char *action, int len) |
| int | as_action_fail_resp (int uac_id, int sip_error, char *err_buf, int err_len) |
| char * | create_as_action_reply (struct cell *c, struct tmcb_params *params, int uac_id, char processor_id, int *evt_len) |
| int | dispatch_actions (void) |
| int | extract_allowed_headers (struct sip_msg *my_msg, int allow_vias, int allow_Rroutes, hdr_flags_t forbidden_hdrs, char *headers, int headers_len) |
| int | forward_sl_request (struct sip_msg *msg, struct proxy_l *proxy, int proto) |
| int | process_action (as_p my_as) |
| void | uac_cb (struct cell *t, int type, struct tmcb_params *) |
| void | uac_cleanup_cb (struct cell *t, int type, struct tmcb_params *) |
| #define AC_CANCEL 7 |
| #define AC_FAIL_UNKNOWN 0x01 |
Definition at line 35 of file seas_action.h.
| #define AC_RES_FAIL 5 |
| #define FAKED_REPLY_FLAG 0x02 |
| #define JAIN_PONG 8 |
| #define REPLY_FIN 2 |
| #define REPLY_FIN_DLG 3 |
Definition at line 27 of file seas_action.h.
| #define REPLY_PROV 1 |
| #define SL_MSG 6 |
| #define UAC_REQ 4 |
| int ac_cancel | ( | as_p | the_as, | |
| char * | action, | |||
| int | len | |||
| ) |
ac_cancel:
| the_as | Application Server structure which sent this action | |
| action | action payload | |
| len | the length of the payload |
Returns:
Definition at line 393 of file seas_action.c.
References as_action_fail_resp(), sip_msg::buf, CRLF, CRLF_LEN, as_uac_param::destroy_cb_set, extract_allowed_headers(), sip_msg::first_line, free_hdr_field_lst(), get_body(), get_content_length, HDR_CALLID_F, HDR_CONTENTLENGTH_F, HDR_CSEQ_F, HDR_EOH_F, HDR_FROM_F, HDR_ROUTE_F, HDR_TO_F, sip_msg::headers, sip_msg::len, _str::len, LM_DBG, LM_ERR, MAX_HEADER, my_as, net2hostL, NULL, parse_headers(), parse_msg(), pkg_free, pkg_malloc, as_uac_param::processor_id, _str::s, SE_CANCEL, SE_CANCEL_MSG, SE_CANCEL_MSG_LEN, seas_f, shm_free, shm_malloc(), SIP_REPLY, SPIRAL_FLAG, SPIRAL_HDR, SPIRAL_HDR_LEN, tm_binds::t_cancel_uac, tm_binds::t_lookup_ident, seas_functions::tmb, msg_start::type, uac_cb(), as_uac_param::uac_id, tm_binds::unref_cell, and as_uac_param::who.
Referenced by process_action().
| int ac_encode_msg | ( | as_p | the_as, | |
| char * | action, | |||
| int | len | |||
| ) |
| int ac_reply | ( | as_p | the_as, | |
| char * | action, | |||
| int | len | |||
| ) |
ACTION processing functions
ac_reply: UAS transaction Reply action. It replies to an incoming request with a response.
function descriptionReturns: what
Definition at line 644 of file seas_action.c.
References action_stat(), to_body::body, sip_msg::content_length, to_body::error, extract_allowed_headers(), sip_msg::first_line, cell::flags, free_sip_msg_lite(), get_body(), HDR_CALLID_F, HDR_CONTENTLENGTH_F, HDR_CSEQ_F, HDR_EOH_F, HDR_FROM_F, HDR_TO_F, HDR_VIA_F, is_invite, _str::len, LM_DBG, LM_ERR, MAX_HEADER, net2hostL, NULL, parse_ac_msg(), hdr_field::parsed, pkg_free, recordroute_diff(), msg_start::reply, REQ_LINE, ua_server::request, _str::s, seas_f, ua_server::status, T_IS_LOCAL_FLAG, tm_binds::t_lookup_ident, tm_binds::t_reply_with_body, to_body::tag_value, seas_functions::tmb, sip_msg::to, msg_start::u, cell::uas, tm_binds::unref_cell, and use_stats.
Referenced by process_action().
| int ac_sl_msg | ( | as_p | the_as, | |
| char * | action, | |||
| int | len | |||
| ) |
Definition at line 781 of file seas_action.c.
References sip_msg::first_line, sip_msg::force_send_socket, forward_sl_request(), free_proxy(), free_sip_msg_lite(), GET_RURI, grep_sock_info(), HDR_EOH_F, via_body::host, LM_DBG, LM_ERR, rr::nameaddr, net2hostL, NULL, parse_ac_msg(), parse_rr(), hdr_field::parsed, pkg_free, via_body::port, via_body::proto, proxy_l::proto, PROTO_NONE, proxy, msg_start::reply, msg_start::request, sip_msg::route, SIP_REQUEST, msg_start::type, msg_start::u, name_addr::uri, uri2proxy(), and sip_msg::via1.
Referenced by process_action().
| int ac_uac_req | ( | as_p | the_as, | |
| char * | action, | |||
| int | len | |||
| ) |
we trick req_within
Awful hack: to be able to set our own CSeq, from_tag and call-ID we have to use req_within instead of req_outside (it sets it's own CSeq,Call-ID and ftag), so we have to simulate that the dialog is already in completed state so...
this SHOULD be: shm_duplicate_rr(&my_dlg->route_set,my_msg->route->parsed); but it will last more...
now undo all the fakes we have put in my_dlg
Definition at line 912 of file seas_action.c.
References as_action_fail_resp(), hdr_field::body, calculate_hooks(), sip_msg::callid, check_transaction_quadruple(), sip_msg::content_length, CRLF, CRLF_LEN, sip_msg::cseq, as_uac_param::destroy_cb_set, to_body::display, tm_binds::dlg_add_extra, DLG_CONFIRMED, E_UNSPEC, err2reason_phrase(), extract_allowed_headers(), sip_msg::first_line, tm_binds::free_dlg, free_hdr_field_lst(), sip_msg::from, get_body(), get_content_length, get_from, HDR_CALLID_F, HDR_CONTENTLENGTH_F, HDR_CSEQ_F, HDR_EOH_F, HDR_FROM_F, HDR_ROUTE_F, HDR_TO_F, sip_msg::headers, dlg::hooks, dlg::id, _str::len, LM_DBG, LM_ERR, MAX_HEADER, MAX_REASON_LEN, METHOD_ACK, METHOD_CANCEL, my_as, net2hostL, tm_binds::new_dlg_uac, dlg_hooks::next_hop, NULL, cseq_body::number, parse_ac_msg(), parse_from_header(), parse_headers(), parse_rr(), hdr_field::parsed, pkg_free, pkg_malloc, print_local_uri(), as_uac_param::processor_id, dlg_id::rem_tag, dlg::rem_target, msg_start::request, sip_msg::route, dlg::route_set, _str::s, SE_UAC, seas_f, server_signature, shm_free, shm_malloc(), shm_str_dup(), SIP_REPLY, SPIRAL_FLAG, SPIRAL_HDR, SPIRAL_HDR_LEN, dlg::state, str2int(), dlg::T_flags, T_NO_AUTOACK_FLAG, T_PASS_PROVISIONAL_FLAG, tm_binds::t_request_within, to_body::tag_value, seas_functions::tmb, sip_msg::to, msg_start::type, msg_start::u, uac_cb(), as_uac_param::uac_id, to_body::uri, and as_uac_param::who.
Referenced by process_action().
| int as_action_fail_resp | ( | int | uac_id, | |
| int | sip_error, | |||
| char * | err_buf, | |||
| int | i | |||
| ) |
Event creating functions
ERROR action responses are composed of: 4: the length of the event 1: the event type (AC_RES_FAIL) 4: NBO of the uac-action-request identification (uac_id) 4: the sip_error code in NBO. 1: (unsigned) the length of the string. N: the string
Definition at line 1358 of file seas_action.c.
References AC_RES_FAIL, app_server::action_fd, as_entry::as, LM_ERR, MAX_REASON_LEN, my_as, and as_entry::u.
Referenced by ac_cancel(), and ac_uac_req().
| char* create_as_action_reply | ( | struct cell * | c, | |
| struct tmcb_params * | params, | |||
| int | uac_id, | |||
| char | processor_id, | |||
| int * | evt_len | |||
| ) |
Definition at line 1469 of file seas_action.c.
References tmcb_params::code, receive_info::dst_ip, receive_info::dst_port, encode_msg(), ENCODED_MSG_SIZE, FAKED_REPLY, FAKED_REPLY_FLAG, cell::hash_index, cell::label, ip_addr::len, len, LM_ERR, cell::method, tmcb_params::param, port, receive_info::proto, sip_msg::rcv, RES_IN, tmcb_params::rpl, _str::s, shm_malloc(), receive_info::src_ip, receive_info::src_port, and ip_addr::u.
Referenced by uac_cb().
| int dispatch_actions | ( | void | ) |
Action Dispatcher process functions
Definition at line 93 of file seas_action.c.
References app_server::ac_buffer, app_server::action_fd, as_entry::as, AS_BUF_SIZE, jain_ping_timeout, app_server::jain_pings, _str::len, LM_ERR, MAX_WHOAMI_LEN, my_as, my_parent, as_entry::name, NULL, pkg_malloc, print_pingtable(), process_input(), process_pings(), pt, _str::s, servlet_ping_timeout, snprintf, timeout, as_entry::u, use_ha, and whoami.
Referenced by spawn_action_dispatcher().
| int extract_allowed_headers | ( | struct sip_msg * | my_msg, | |
| int | strip_top_vias, | |||
| int | allow_top_Rroutes, | |||
| hdr_flags_t | forbidden_hdrs, | |||
| char * | headers, | |||
| int | headers_len | |||
| ) |
Strips the "<strip_top_vias>" topmost via headers. Leaves only the topmost "<allow_top_routes>" Record-Route headers.
All vias MUST be parsed !!
skip this via header
is this dangerous ? because the rtcnt is the control variable for this conditional 'if' so if I change rtcnt value in one of the statements... what then ???
Definition at line 1250 of file seas_action.c.
References hdr_field::body, CRLF, CRLF_LEN, via_body::error, free_rr(), HDR_RECORDROUTE_T, HDR_T2F, HDR_VIA_T, sip_msg::headers, via_body::i, rr::len, hdr_field::len, _str::len, len, LM_DBG, LM_ERR, LM_WARN, name_addr::name, via_body::name, hdr_field::name, rr::nameaddr, rr::next, via_body::next, hdr_field::next, NULL, parse_rr(), hdr_field::parsed, rb, _str::s, hdr_field::type, VIA, and VIA_LEN.
Referenced by ac_cancel(), ac_reply(), and ac_uac_req().
Utility functions
Definition at line 867 of file seas_action.c.
References proxy_l::addr_idx, sip_msg::buf, get_next_su(), get_send_socket(), proxy_l::host, hostent2su(), sip_msg::len, LM_DBG, LM_ERR, msg_send(), pkg_free, pkg_malloc, proxy_l::port, sockaddr_union::s, and SIP_PORT.
Referenced by ac_sl_msg().
| int process_action | ( | as_p | the_as | ) |
Processes the actions received from the socket. returns -1 on error 0 on success
Definition at line 276 of file seas_action.c.
References app_server::ac_buffer, ac_cancel(), AC_CANCEL, ac_jain_pong(), ac_reply(), ac_sl_msg(), ac_uac_req(), AS_BUF_SIZE, JAIN_PONG, _str::len, LM_DBG, LM_WARN, app_server::name, REPLY_FIN, REPLY_PROV, _str::s, SL_MSG, stats_reply(), UAC_REQ, and use_stats.
Referenced by process_input().
| void uac_cb | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | rcvd_params | |||
| ) |
Callback Functions
This function will be called from a SER process when a reply is received for the transaction. The SER processes only have acces to the EventDispatcher fifo (not to the ActionDispatcher) so EventDispatcher will be the one who will send the event to the AppServer. TODO WARNING !!! there's a clear MEMORY LEAK here, see exit: at the bottom of the function... it should free ev_info !!!!!!!! I have disabled the free() because It may be that we receive a retransmitted 200 OK if the ACK gets lost, that 200 OK will make SER invoke this callback a second,third, etc time...
Definition at line 1412 of file seas_action.c.
References as_msg::as, tmcb_params::code, create_as_action_reply(), as_uac_param::destroy_cb_set, is_local, ua_client::last_received, as_msg::len, _str::len, LM_DBG, LM_ERR, as_msg::msg, as_entry::name, cell::nr_of_outgoings, NULL, tmcb_params::param, as_uac_param::processor_id, tm_binds::register_tmcb, RES_IN, tmcb_params::rpl, _str::s, seas_f, shm_free, shm_malloc(), seas_functions::tmb, TMCB_LOCAL_COMPLETED, TMCB_TRANS_DELETED, as_msg::transaction, as_msg::type, cell::uac, uac_cleanup_cb(), as_uac_param::uac_id, as_uac_param::who, and write_pipe.
Referenced by ac_cancel(), and ac_uac_req().
| void uac_cleanup_cb | ( | struct cell * | t, | |
| int | type, | |||
| struct tmcb_params * | ||||
| ) |
Definition at line 1389 of file seas_action.c.
References NULL, tmcb_params::param, and shm_free.
Referenced by uac_cb().
1.5.6