Commit 492ea9c9 authored by Simon Morlat's avatar Simon Morlat

remove useless methods to SipEvent, IncomingAgent and OutgoingAgent (can be...

remove useless methods to SipEvent, IncomingAgent and OutgoingAgent (can be dealed with default arguments)
parent 1b4c0aad
......@@ -741,15 +741,10 @@ void Agent::send(const shared_ptr<MsgSip> &ms, url_string_t const *u, tag_type_t
ta_list ta;
ta_start(ta, tag, value);
msg_t* msg = msg_dup(ms->getMsg());
nta_msg_tsend(mAgent, msg, u, ta_tags(ta));
nta_msg_tsend(mAgent, msg, u, ta_tags(ta),TAG_END());
ta_end(ta);
}
void Agent::send(const shared_ptr<MsgSip> &ms) {
msg_t* msg = msg_dup(ms->getMsg());
nta_msg_tsend(mAgent, msg, NULL, TAG_END());
}
void Agent::incrReplyStat(int status) {
switch (status) {
case 100:
......
......@@ -158,7 +158,6 @@ class Agent: public IncomingAgent, public OutgoingAgent, public std::enable_shar
int onIncomingMessage(msg_t *msg, sip_t *sip);
private:
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...);
virtual void send(const std::shared_ptr<MsgSip> &msg);
virtual void reply(const std::shared_ptr<MsgSip> &msg, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...);
void discoverInterfaces();
void startLogWriter();
......
......@@ -161,15 +161,6 @@ void RequestSipEvent::send(const shared_ptr<MsgSip> &msg, url_string_t const *u,
terminateProcessing();
}
void RequestSipEvent::send(const shared_ptr<MsgSip> &msg) {
if (mOutgoingAgent != NULL) {
SLOGD << "Sending Request SIP message:\n" << *msg;
mOutgoingAgent->send(msg);
} else {
LOGD("The Request SIP message is not send");
}
terminateProcessing();
}
void RequestSipEvent::reply(int status, char const *phrase, tag_type_t tag, tag_value_t value, ...) {
if (mIncomingAgent != NULL) {
......@@ -269,18 +260,6 @@ void ResponseSipEvent::send(const shared_ptr<MsgSip> &msg, url_string_t const *u
terminateProcessing();
}
void ResponseSipEvent::send(const shared_ptr<MsgSip> &msg) {
if (mIncomingAgent != NULL) {
/*if the message is still the one for which the ResponseSipEvent was created and mPopVia is set, then pop the via*/
if (mPopVia && msg==mMsgSip) sip_via_remove(msg->getMsg(), msg->getSip());
SLOGD << "Sending response:\n" << *msg;
mIncomingAgent->send(msg);
} else {
SLOGD << "The response is discarded.";
}
terminateProcessing();
}
void ResponseSipEvent::setOutgoingAgent(const shared_ptr<OutgoingAgent> &agent) {
LOGA("Can't change outgoing agent in response sip event");
......
......@@ -128,8 +128,7 @@ public:
mOutgoingAgent = agent;
}
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...) = 0;
virtual void send(const std::shared_ptr<MsgSip> &msg) = 0;
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u=NULL, tag_type_t tag=0, tag_value_t value=0, ...) = 0;
virtual ~SipEvent();
......@@ -178,8 +177,7 @@ public:
std::shared_ptr<IncomingTransaction> createIncomingTransaction();
std::shared_ptr<OutgoingTransaction> createOutgoingTransaction();
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...);
virtual void send(const std::shared_ptr<MsgSip> &msg);
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u=NULL, tag_type_t tag=0, tag_value_t value=0, ...);
virtual void reply(int status, char const *phrase, tag_type_t tag, tag_value_t value, ...);
......@@ -199,8 +197,7 @@ public:
ResponseSipEvent(std::shared_ptr<OutgoingAgent> outgoingAgent, const std::shared_ptr<MsgSip> &msgSip);
ResponseSipEvent(const std::shared_ptr<ResponseSipEvent> &sipEvent);
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...);
virtual void send(const std::shared_ptr<MsgSip> &msg);
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u=NULL, tag_type_t tag=0, tag_value_t value=0, ...);
virtual void setOutgoingAgent(const std::shared_ptr<OutgoingAgent> &agent);
......
......@@ -216,7 +216,7 @@ bool ForwardModule::isLooping(shared_ptr<RequestSipEvent> &ev, const char * bran
void ForwardModule::onResponse(shared_ptr<ResponseSipEvent> &ev) {
const shared_ptr<MsgSip> &ms = ev->getMsgSip();
ev->send(ms, (url_string_t*) NULL, TAG_END());
ev->send(ms);
}
#include <sofia-sip/su_md5.h>
......
......@@ -68,7 +68,7 @@ void OutgoingTransaction::send(const shared_ptr<MsgSip> &ms, url_string_t const
ta_list ta;
ta_start(ta, tag, value);
LOGD("Message is sent through an outgoing transaction.");
mOutgoing = nta_outgoing_mcreate(mAgent->mAgent, OutgoingTransaction::_callback, (nta_outgoing_magic_t*) this, u, msg, ta_tags(ta));
mOutgoing = nta_outgoing_mcreate(mAgent->mAgent, OutgoingTransaction::_callback, (nta_outgoing_magic_t*) this, u, msg, ta_tags(ta),TAG_END());
ta_end(ta);
if (mOutgoing == NULL) {
LOGE("Error during outgoing transaction creation");
......@@ -80,20 +80,6 @@ void OutgoingTransaction::send(const shared_ptr<MsgSip> &ms, url_string_t const
}
void OutgoingTransaction::send(const shared_ptr<MsgSip> &ms) {
msg_t* msg = msg_dup(ms->getMsg());
LOGD("Message is sent through an outgoing transaction.");
mOutgoing = nta_outgoing_mcreate(mAgent->mAgent, OutgoingTransaction::_callback, (nta_outgoing_magic_t*) this, NULL, msg, TAG_END());
if (mOutgoing == NULL) {
LOGE("Error during outgoing transaction creation");
msg_destroy(msg);
} else {
mSofiaRef = shared_from_this();
mAgent->sendTransactionEvent(TransactionEvent::makeCreate(shared_from_this()));
}
}
int OutgoingTransaction::_callback(nta_outgoing_magic_t *magic, nta_outgoing_t *irq, const sip_t *sip) {
OutgoingTransaction * otr = reinterpret_cast<OutgoingTransaction *>(magic);
LOGD("OutgoingTransaction callback %p", otr);
......@@ -168,19 +154,6 @@ void IncomingTransaction::send(const shared_ptr<MsgSip> &ms, url_string_t const
}
}
void IncomingTransaction::send(const shared_ptr<MsgSip> &ms) {
if (mIncoming) {
msg_t* msg = msg_dup(ms->getMsg());
LOGD("Response is sent through an incoming transaction.");
nta_incoming_mreply(mIncoming, msg);
if (ms->getSip()->sip_status != NULL && ms->getSip()->sip_status->st_status >= 200) {
destroy();
}
} else {
LOGW("Invalid incoming");
}
}
void IncomingTransaction::reply(const shared_ptr<MsgSip> &msgIgnored, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...) {
if (mIncoming) {
mAgent->incrReplyStat(status);
......
......@@ -33,7 +33,6 @@ class Agent;
class IncomingAgent {
public:
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...) = 0;
virtual void send(const std::shared_ptr<MsgSip> &msg) = 0;
virtual void reply(const std::shared_ptr<MsgSip> &msg, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...) = 0;
......@@ -47,7 +46,6 @@ public:
class OutgoingAgent {
public:
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...) = 0;
virtual void send(const std::shared_ptr<MsgSip> &msg) = 0;
virtual Agent *getAgent() = 0;
......@@ -155,7 +153,6 @@ private:
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...);
virtual void send(const std::shared_ptr<MsgSip> &msg);
void destroy();
......@@ -181,7 +178,6 @@ private:
nta_incoming_t *mIncoming;
virtual void send(const std::shared_ptr<MsgSip> &msg, url_string_t const *u, tag_type_t tag, tag_value_t value, ...);
virtual void send(const std::shared_ptr<MsgSip> &msg);
virtual void reply(const std::shared_ptr<MsgSip> &msg, int status, char const *phrase, tag_type_t tag, tag_value_t value, ...);
void destroy();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment