From d074c0c0cd3271c5dbdb4ebbf7685cd96dc1f725 Mon Sep 17 00:00:00 2001 From: bpintea Date: Sun, 1 Aug 2010 18:38:56 +0200 Subject: [PATCH] removed "#if 0" dead code removed code disabled during development of 100rel extension --- apps/registrar_client/SIPRegistrarClient.h | 5 -- core/AmSession.cpp | 14 ------ core/AmSession.h | 6 --- core/AmSipDialog.cpp | 12 ----- core/AmSipDialog.h | 8 --- core/AmSipEvent.cpp | 20 -------- core/AmSipEvent.h | 57 ---------------------- core/SipCtrlInterface.cpp | 51 ------------------- core/SipCtrlInterface.h | 3 -- core/sip/sip_ua.h | 5 -- core/sip/trans_layer.cpp | 26 ---------- 11 files changed, 207 deletions(-) diff --git a/apps/registrar_client/SIPRegistrarClient.h b/apps/registrar_client/SIPRegistrarClient.h index 1c11f9ea..e79af3bf 100644 --- a/apps/registrar_client/SIPRegistrarClient.h +++ b/apps/registrar_client/SIPRegistrarClient.h @@ -127,13 +127,8 @@ class SIPRegistration : public AmSipDialogEventHandler, void onSipReply(const AmSipReply& reply, int old_dlg_status); void onSipRequest(const AmSipRequest& req) {} void onInvite2xx(const AmSipReply&) {} -#if 0 - void onNo2xxACK(unsigned int) {} - void onNoErrorACK(unsigned int) {} -#else void onNoAck(unsigned int) {} void onNoPrack(const AmSipRequest &, const AmSipReply &) {} -#endif /** is this registration registered? */ bool active; diff --git a/core/AmSession.cpp b/core/AmSession.cpp index 4ff6fa7a..e4ccfe36 100644 --- a/core/AmSession.cpp +++ b/core/AmSession.cpp @@ -906,18 +906,6 @@ void AmSession::onInvite2xx(const AmSipReply& reply) if(t) dlg.send_200_ack(*t); } -#if 0 -void AmSession::onNo2xxACK(unsigned int cseq) -{ - dlg.bye(); - setStopped(); -} - -void AmSession::onNoErrorACK(unsigned int cseq) -{ - setStopped(); -} -#else void AmSession::onNoAck(unsigned int cseq) { if (dlg.getStatus() == AmSipDialog::Connected) @@ -939,8 +927,6 @@ void AmSession::onNoPrack(const AmSipRequest &req, const AmSipReply &rpl) } } -#endif - void AmSession::onAudioEvent(AmAudioEvent* audio_ev) { if (audio_ev->event_id == AmAudioEvent::cleared) diff --git a/core/AmSession.h b/core/AmSession.h index ec59e886..692af26e 100644 --- a/core/AmSession.h +++ b/core/AmSession.h @@ -498,12 +498,6 @@ public: virtual void onSipRequest(const AmSipRequest& req); /** Entry point for SIP Replies */ virtual void onSipReply(const AmSipReply& reply, int old_dlg_status); -#if 0 - /** There was a timeout receiving a reply for the given SIP request */ - virtual void onSipReqTimeout(const AmSipRequest &req); - /** There was a timeout receiving a request (PR-/ACK) for given SIP reply */ - virtual void onSipRplTimeout(const AmSipRequest &req, const AmSipReply &rpl); -#endif /** 2xx reply has been received for an INVITE transaction */ virtual void onInvite2xx(const AmSipReply& reply); diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 98a34901..b26cb1e2 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -307,22 +307,10 @@ void AmSipDialog::uasTimeout(AmSipTimeoutEvent* to_ev) assert(to_ev); switch(to_ev->type){ -#if 0 - case AmSipTimeoutEvent::no2xxACK: - DBG("Timeout: missing 2xx-ACK\n"); - if(hdl) hdl->onNo2xxACK(to_ev->cseq); - break; - - case AmSipTimeoutEvent::noErrorACK: - DBG("Timeout: missing non-2xx-ACK\n"); - if(hdl) hdl->onNoErrorACK(to_ev->cseq); - break; -#else case AmSipTimeoutEvent::noACK: DBG("Timeout: missing ACK\n"); if(hdl) hdl->onNoAck(to_ev->cseq); break; -#endif case AmSipTimeoutEvent::noPRACK: DBG("Timeout: missing PRACK\n"); diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index d86107cd..e25104b1 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -96,19 +96,11 @@ class AmSipDialogEventHandler /** Hook called when a local INVITE request has been replied with 2xx */ virtual void onInvite2xx(const AmSipReply& reply)=0; -#if 0 - /** Hook called when a UAS INVITE transaction did not receive a 2xx-ACK */ - virtual void onNo2xxACK(unsigned int cseq)=0; - - /** Hook called when a UAS INVITE transaction did not receive a non-2xx-ACK */ - virtual void onNoErrorACK(unsigned int cseq)=0; -#else /** Hook called when a UAS INVITE transaction did not receive the ACK */ virtual void onNoAck(unsigned int)=0; /** Hook called when a UAS INVITE transaction did not receive the PRACK */ virtual void onNoPrack(const AmSipRequest &, const AmSipReply &)=0; -#endif virtual ~AmSipDialogEventHandler() {}; }; diff --git a/core/AmSipEvent.cpp b/core/AmSipEvent.cpp index fdabc422..70aae2a3 100644 --- a/core/AmSipEvent.cpp +++ b/core/AmSipEvent.cpp @@ -7,26 +7,6 @@ void AmSipTimeoutEvent::operator() (AmSipDialog* dlg) dlg->uasTimeout(this); } - -#if 0 - AmSipReqTimeoutEvent *req_tout_ev = - dynamic_cast(sip_ev); - if (req_tout_ev) { - CALL_EVENT_H(onSipReqTimeout, req_tout_ev->req); - onSipReqTimeout(req_tout_ev->req); - return; - } - - AmSipRplTimeoutEvent *rpl_tout_ev = - dynamic_cast(sip_ev); - if (rpl_tout_ev) { - CALL_EVENT_H(onSipRplTimeout, rpl_tout_ev->req, rpl_tout_ev->rpl); - onSipRplTimeout(rpl_tout_ev->req, rpl_tout_ev->rpl); - return; - } -#endif - - void AmSipRequestEvent::operator() (AmSipDialog* dlg) { assert(dlg); diff --git a/core/AmSipEvent.h b/core/AmSipEvent.h index 3214a216..489e411f 100644 --- a/core/AmSipEvent.h +++ b/core/AmSipEvent.h @@ -48,30 +48,6 @@ class AmSipEvent: public AmEvent virtual void operator() (AmSipDialog* dlg)=0; }; -#if 0 -/** \brief UAS reply re-transmission timeout event */ -class AmSipTimeoutEvent: public AmSipEvent -{ - public: - - enum EvType { - _noEv=0, - no2xxACK, - noErrorACK, - noPRACK - }; - - EvType type; - - unsigned int cseq; - - AmSipTimeoutEvent(EvType t, unsigned int cseq_num) - : AmSipEvent(), type(t) - {} - - virtual void operator() (AmSipDialog* dlg); -}; -#else /** \brief UAS reply re-transmission timeout event */ class AmSipTimeoutEvent: public AmSipEvent { @@ -98,7 +74,6 @@ class AmSipTimeoutEvent: public AmSipEvent virtual void operator() (AmSipDialog* dlg); }; -#endif /** \brief SIP request event */ class AmSipRequestEvent: public AmSipEvent @@ -126,37 +101,5 @@ class AmSipReplyEvent: public AmSipEvent }; -#if 0 -// TODO: have a single AmSipT.outEv. class, with type and a _AmSipMsgInDlg -// ptr: it will save the dynamic_cast efforts later. - -class AmSipTimeoutEvent: public AmSipEvent -{ - public: - AmSipTimeoutEvent(int id = -1) - : AmSipEvent(-1) - {} -}; - -class AmSipReqTimeoutEvent : public AmSipTimeoutEvent -{ - public: - AmSipRequest req; - AmSipReqTimeoutEvent(AmSipRequest &r): - AmSipTimeoutEvent(), req(r) - {} -}; - -class AmSipRplTimeoutEvent : public AmSipTimeoutEvent -{ - public: - AmSipRequest req; - AmSipReply rpl; - AmSipRplTimeoutEvent(AmSipRequest &_req, AmSipReply &_rpl): - AmSipTimeoutEvent(), req(_req), rpl(_rpl) - {} -}; -#endif - #endif diff --git a/core/SipCtrlInterface.cpp b/core/SipCtrlInterface.cpp index 050f0453..91cde150 100644 --- a/core/SipCtrlInterface.cpp +++ b/core/SipCtrlInterface.cpp @@ -571,57 +571,6 @@ void SipCtrlInterface::handle_sip_reply(sip_msg* msg) AmSipDispatcher::instance()->handleSipMsg(reply); } -#if 0 -void SipCtrlInterface::timer_expired(sip_trans* trans, sip_timer_type tt) -{ - assert(trans); - assert(trans->type == TT_UAS); - - AmSipTimeoutEvent::EvType ev = AmSipTimeoutEvent::_noEv; - - DBG("tt=%i;state=%i\n",tt,trans->state); - - //TODO: send an event to the SIP Dialog - switch(tt){ - - case STIMER_H: - switch(trans->state){ - case TS_TERMINATED_200: // missing 200-ACK - ev = AmSipTimeoutEvent::no2xxACK; - break; - case TS_COMPLETED: // missing error-ACK - ev = AmSipTimeoutEvent::noErrorACK; - break; - - // TODO: missing PRACK - //case TS_???: - default: - ERROR("timer H expired / transaction in undefined state\n"); - return; - } - break; - - default: - return; - } - - assert(trans->msg); - assert(trans->to_tag.len); - assert(trans->msg->cseq && trans->msg->cseq->p); - - sip_cseq* cseq = dynamic_cast(trans->msg->cseq->p); - - if(!cseq){ - ERROR("missing CSeq\n"); - return; - } - - AmEventDispatcher::instance()->post(c2stlstr(trans->to_tag), - new AmSipTimeoutEvent(ev, cseq->num)); -} -#endif - - void SipCtrlInterface::handle_reply_timeout(AmSipTimeoutEvent::EvType evt, sip_trans *tr, trans_bucket *buk) { diff --git a/core/SipCtrlInterface.h b/core/SipCtrlInterface.h index 53032203..7b512cc86 100644 --- a/core/SipCtrlInterface.h +++ b/core/SipCtrlInterface.h @@ -109,9 +109,6 @@ public: void handle_sip_reply(sip_msg* msg); void handle_reply_timeout(AmSipTimeoutEvent::EvType evt, sip_trans *tr, trans_bucket *buk=0); -#if 0 - void timer_expired(sip_trans* trans, sip_timer_type tt); -#endif }; diff --git a/core/sip/sip_ua.h b/core/sip/sip_ua.h index ff54ef54..253c209e 100644 --- a/core/sip/sip_ua.h +++ b/core/sip/sip_ua.h @@ -44,11 +44,6 @@ public: //virtual void handle_request_timeout(const sip_msg *msg)=0; virtual void handle_reply_timeout(AmSipTimeoutEvent::EvType evt, sip_trans *tr, trans_bucket *buk=0)=0; - -#if 0 - // UAS timer expired (UAC timers generate a local 408) - virtual void timer_expired(sip_trans* trans, sip_timer_type tt)=0; -#endif }; #endif diff --git a/core/sip/trans_layer.cpp b/core/sip/trans_layer.cpp index ec405bea..36303e71 100644 --- a/core/sip/trans_layer.cpp +++ b/core/sip/trans_layer.cpp @@ -1072,31 +1072,6 @@ void trans_layer::received_msg(sip_msg* msg) } } else { - -#if 0 - string t_id; - if(msg->u.request->method == sip_request::ACK){ - - // non-2xx ACK??? drop! - break; - } - else { - // New transaction - t = bucket->add_trans(msg, TT_UAS); - - bucket->unlock(); - - // let's pass the request to - // the UA. - assert(ua); - - ua->handle_sip_request(trans_ticket(t,bucket),msg); - - // forget the msg: it will be - // owned by the new transaction - return; - } -#else unsigned inv_h; trans_bucket* inv_bucket; sip_trans* inv_t; @@ -1137,7 +1112,6 @@ void trans_layer::received_msg(sip_msg* msg) // owned by the new transaction return; } -#endif } break;