|
reSIProcate/repro
9694
|
#include <RequestContext.hxx>

Definition at line 26 of file RequestContext.hxx.
typedef std::vector<ProcessorChain::Chain::iterator> repro::RequestContext::ChainIteratorStack [protected] |
Stack of iterators used to keep track of where we are in the request processor chain(s) for async processing.
Definition at line 105 of file RequestContext.hxx.
| RequestContext::RequestContext | ( | Proxy & | proxy, |
| ProcessorChain & | requestP, | ||
| ProcessorChain & | responseP, | ||
| ProcessorChain & | targetP | ||
| ) |
Definition at line 34 of file RequestContext.cxx.
: mHaveSentFinalResponse(false), mOriginalRequest(0), mCurrentEvent(0), mAck200ToRetransmit(0), mRequestProcessorChain(requestP), mResponseProcessorChain(responseP), mTargetProcessorChain(targetP), mTransactionCount(1), mProxy(proxy), mResponseContext(*this), mTCSerial(0), mKeyValueStore(*Proxy::getRequestKeyValueStoreKeyAllocator()) { mInitialTimerCSet=false; }
| RequestContext::~RequestContext | ( | ) | [virtual] |
Definition at line 54 of file RequestContext.cxx.
{
DebugLog (<< "RequestContext::~RequestContext() " << this);
if (mOriginalRequest != mCurrentEvent)
{
delete mOriginalRequest;
mOriginalRequest = 0;
}
delete mCurrentEvent;
mCurrentEvent = 0;
delete mAck200ToRetransmit;
mAck200ToRetransmit=0;
}
| void RequestContext::cancelClientTransaction | ( | const resip::Data & | tid | ) | [virtual] |
Definition at line 784 of file RequestContext.cxx.
{
getProxy().getStack().cancelClientInviteTransaction(tid);
}
| void RequestContext::doPostRequestProcessing | ( | resip::SipMessage * | msg, |
| bool | original | ||
| ) | [protected] |
Definition at line 405 of file RequestContext.cxx.
{
assert(msg->isRequest());
// .bwc. This is called after an incoming request is done processing. This
// IS NOT called if the request-processor chain goes async, and IS NOT called
// when async work finishes. The intent of this function is to prompt either:
// 1) The initiation of new client transactions.
// 2) Failing 1, the sending of a failure response to the original request.
// if target list is empty return a 480
if (!mResponseContext.hasTargets())
{
// make 480, send, dispose of memory
resip::SipMessage response;
InfoLog (<< *this << ": no targets for "
<< mOriginalRequest->header(h_RequestLine).uri()
<< " send 480");
Helper::makeResponse(response, *mOriginalRequest, 480);
sendResponse(response);
}
else
{
Processor::processor_action_t ret=Processor::Continue;
InfoLog (<< *this << " there are "
<< mResponseContext.mCandidateTransactionMap.size()
<< " candidates -> continue");
try
{
ret = mTargetProcessorChain.process(*this);
}
catch(resip::BaseException& e)
{
if(mResponseContext.hasActiveTransactions())
{
// .bwc. Whoops. We may have just forwarded garbage upstream.
// TODO is it appropriate to try to CANCEL here?
ErrLog(<<"Server error caught after"
" request was forwarded. Exception was: "<<e);
}
else
{
mResponseContext.clearCandidateTransactions();
SipMessage response;
Helper::makeResponse(response,*mOriginalRequest,500);
response.header(h_StatusLine).reason()="Server error: " + e.getMessage();
ErrLog(<<"Exception caught: " << e);
sendResponse(response);
}
}
if(ret != Processor::WaitingForEvent &&
!mHaveSentFinalResponse &&
!mResponseContext.hasActiveTransactions())
{
if(mResponseContext.hasCandidateTransactions())
{
// Someone forgot to start any of the targets they just added.
// Send a 500 response
resip::SipMessage response;
ErrLog( << "In RequestContext, target processor chain appears "
<< "to have failed to process any targets. (Bad baboon?)"
<< "Sending a 500 response for this request:"
<< mOriginalRequest->header(h_RequestLine).uri() );
Helper::makeResponse(response, *mOriginalRequest, 500);
sendResponse(response);
}
else
{
ErrLog(<< "In RequestContext, request processor chain "
<< " appears to have added Targets, but all of these Targets"
<< " are already Terminated. Further, there are no candidate"
<< " Targets. (Bad monkey?)");
// Send best response
mResponseContext.forwardBestResponse();
}
}
}
}
| void RequestContext::doPostResponseProcessing | ( | resip::SipMessage * | msg | ) | [protected] |
Definition at line 587 of file RequestContext.cxx.
{
bool nit408 = msg->method() != INVITE && msg->header(resip::h_StatusLine).statusCode() == 408;
mResponseContext.processResponse(*msg);
//If everything we have tried so far has gone quiescent, we
//need to fire up some more Targets (if there are any left)
mTargetProcessorChain.process(*this);
if(!mHaveSentFinalResponse &&
!mResponseContext.hasActiveTransactions())
{
if(mResponseContext.hasCandidateTransactions())
{
resip::SipMessage response;
Helper::makeResponse(response, *mOriginalRequest, 500);
// The last active transaction has ended, and the response processors
// did not start any of the pending transactions.
// Send a 500 response.
ErrLog( << "In RequestContext, after processing a sip response:"
<< " We have no active transactions, but there are candidates "
<< " remaining. (Bad baboon?)"
<< "Sending a 500 response for this request:"
<< mOriginalRequest->header(h_RequestLine).uri() );
sendResponse(response);
}
else if(nit408)
{
InfoLog(<<"In RequestContext, after processing a NIT/408, all"
<< " transactions are terminated. In this case, we do not send a"
<< " final response.");
}
else
{
ErrLog(<<"In RequestContext, after processing "
<< "a sip response (_not_ a NIT/408): all transactions are terminated,"
<< " but we have not sent a final response. (What happened here?) ");
// Send best response
mResponseContext.forwardBestResponse();
}
}
}
| void RequestContext::fixStrictRouterDamage | ( | ) | [protected] |
RjS! When we wire this class for logging, here's a
Definition at line 974 of file RequestContext.cxx.
{
if(mOriginalRequest->header(h_RequestLine).uri().exists(p_lr))
{
if (mOriginalRequest->exists(h_Routes)
&& !mOriginalRequest->header(h_Routes).empty())
{
mOriginalRequest->header(h_RequestLine).uri() = mOriginalRequest->header(h_Routes).back().uri();
mOriginalRequest->header(h_Routes).pop_back();
}
else
{
//!RjS! When we wire this class for logging, here's a
// place to log a warning
}
}
}
| void RequestContext::forwardAck200 | ( | const resip::SipMessage & | ack | ) |
Definition at line 790 of file RequestContext.cxx.
{
if(!mAck200ToRetransmit)
{
mAck200ToRetransmit = new SipMessage(ack);
mAck200ToRetransmit->header(h_MaxForwards).value()--;
Helper::processStrictRoute(*mAck200ToRetransmit);
mAck200ToRetransmit->header(h_Vias).push_front(Via());
// .bwc. Check for flow-token
if(!mTopRoute.uri().user().empty())
{
resip::Tuple dest(Tuple::makeTupleFromBinaryToken(mTopRoute.uri().user().base64decode(), Proxy::FlowTokenSalt));
if(!(dest==resip::Tuple()))
{
// valid flow token
mAck200ToRetransmit->setDestination(dest);
}
}
}
send(*mAck200ToRetransmit);
}
| resip::Message * RequestContext::getCurrentEvent | ( | ) |
Returns the event that we are currently working on.
Use a pointer since users need to check for null
Definition at line 842 of file RequestContext.cxx.
{
return mCurrentEvent;
}
| const resip::Message * RequestContext::getCurrentEvent | ( | ) | const |
Definition at line 848 of file RequestContext.cxx.
{
return mCurrentEvent;
}
| const resip::Data & RequestContext::getDigestIdentity | ( | ) | const |
Definition at line 860 of file RequestContext.cxx.
{
return mDigestIdentity;
}
| resip::KeyValueStore& repro::RequestContext::getKeyValueStore | ( | ) | [inline] |
Definition at line 72 of file RequestContext.hxx.
{ return mKeyValueStore; }
| resip::SipMessage & RequestContext::getOriginalRequest | ( | ) |
Returns the SipMessage associated with the server transaction.
Definition at line 816 of file RequestContext.cxx.
{
return *mOriginalRequest;
}
| const resip::SipMessage & RequestContext::getOriginalRequest | ( | ) | const |
Definition at line 822 of file RequestContext.cxx.
{
return *mOriginalRequest;
}
| Proxy & RequestContext::getProxy | ( | ) |
Definition at line 1026 of file RequestContext.cxx.
{
return mProxy;
}
| ResponseContext & RequestContext::getResponseContext | ( | ) |
Definition at line 1032 of file RequestContext.cxx.
{
return mResponseContext;
}
| NameAddr & RequestContext::getTopRoute | ( | ) |
Definition at line 1038 of file RequestContext.cxx.
{
return mTopRoute;
}
| resip::Data RequestContext::getTransactionId | ( | ) | const |
Definition at line 828 of file RequestContext.cxx.
{
if(mOriginalRequest->mIsBadAck200)
{
static Data ack("ack");
return mOriginalRequest->getTransactionId()+ack;
}
else
{
return mOriginalRequest->getTransactionId();
}
}
| void RequestContext::handleSelfAimedStrayAck | ( | resip::SipMessage * | sip | ) | [virtual] |
Definition at line 778 of file RequestContext.cxx.
{
InfoLog(<<"Stray ACK aimed at us that routes back to us. Dropping it...");
}
| void RequestContext::postAck200Done | ( | ) |
Definition at line 881 of file RequestContext.cxx.
{
assert(mOriginalRequest->method()==ACK);
DebugLog(<<"Posting Ack200DoneMessage");
// .bwc. This needs to have a timer attached to it. (We need to
// wait until all potential retransmissions of the ACK/200 have
// stopped. However, we must be mindful that we may receive a new,
// non-ACK transaction with the same tid during this time, and make
// sure we don't explode violently when this happens.)
mProxy.postMS(
std::auto_ptr<ApplicationMessage>(new Ack200DoneMessage(getTransactionId())),
64*resip::Timer::T1);
}
| void RequestContext::postTimedMessage | ( | std::auto_ptr< resip::ApplicationMessage > | msg, |
| int | seconds | ||
| ) |
Definition at line 875 of file RequestContext.cxx.
| void RequestContext::process | ( | resip::TransactionTerminated & | msg | ) | [virtual] |
Definition at line 70 of file RequestContext.cxx.
{
InfoLog (<< "RequestContext::process(TransactionTerminated) "
<< msg.getTransactionId() << " : " << *this);
if (msg.isClientTransaction())
{
mResponseContext.removeClientTransaction(msg.getTransactionId());
}
mTransactionCount--;
if (mTransactionCount == 0)
{
delete this;
}
}
| virtual void repro::RequestContext::process | ( | std::auto_ptr< resip::SipMessage > | sip | ) | [virtual] |
| void RequestContext::process | ( | std::auto_ptr< resip::ApplicationMessage > | app | ) | [virtual] |
Definition at line 633 of file RequestContext.cxx.
{
InfoLog (<< "RequestContext::process(ApplicationMessage) " << *app);
if (mCurrentEvent != mOriginalRequest)
{
delete mCurrentEvent;
}
mCurrentEvent = app.release();
Ack200DoneMessage* ackDone = dynamic_cast<Ack200DoneMessage*>(mCurrentEvent);
if (ackDone)
{
delete this;
return;
}
TimerCMessage* tc = dynamic_cast<TimerCMessage*>(mCurrentEvent);
if(tc)
{
if(tc->mSerial == mTCSerial)
{
mResponseContext.processTimerC();
}
return;
}
ProcessorMessage* proc=dynamic_cast<ProcessorMessage*>(mCurrentEvent);
if(proc)
{
Processor::ChainType type = proc->chainType();
Processor::processor_action_t ret=Processor::Continue;
switch(type)
{
case Processor::REQUEST_CHAIN:
try
{
ret = mRequestProcessorChain.process(*this);
}
catch(resip::BaseException& e)
{
resip::SipMessage response;
Helper::makeResponse(response,*mOriginalRequest,500);
response.header(h_StatusLine).reason()="Server error: " + e.getMessage();
ErrLog(<<"Exception caught: " << e);
sendResponse(response);
}
if(ret != Processor::WaitingForEvent && !mHaveSentFinalResponse)
{
if (!mResponseContext.hasTargets())
{
// make 480, send, dispose of memory
resip::SipMessage response;
Helper::makeResponse(response, *mOriginalRequest, 480);
InfoLog (<< *this << ": no targets for "
<< mOriginalRequest->header(h_RequestLine).uri()
<< " send 480");
sendResponse(response);
}
else
{
InfoLog (<< *this << " there are "
<< mResponseContext.mCandidateTransactionMap.size()
<< " candidates -> continue");
try
{
ret = mTargetProcessorChain.process(*this);
}
catch(resip::BaseException& e)
{
if(mResponseContext.hasActiveTransactions())
{
// .bwc. Whoops. We may have just forwarded garbage upstream.
// ?bwc? TODO is it appropriate to try to CANCEL here?
ErrLog(<<"Server error caught after"
" request was forwarded. Exception was: "<<e);
}
else
{
mResponseContext.clearCandidateTransactions();
resip::SipMessage response;
Helper::makeResponse(response,*mOriginalRequest,500);
response.header(h_StatusLine).reason()="Server error: " + e.getMessage();
ErrLog(<<"Exception caught: " << e);
sendResponse(response);
}
}
if(ret != Processor::WaitingForEvent &&
!mHaveSentFinalResponse &&
!mResponseContext.hasActiveTransactions())
{
if(mResponseContext.hasCandidateTransactions())
{
resip::SipMessage response;
Helper::makeResponse(response, *mOriginalRequest, 500);
// Someone forgot to start any of the targets they just added.
// Send a 500 response
ErrLog( << "In RequestContext, request and target processor"
<< " chains have run, and we have some Candidate Targets,"
<< " but no active Targets. (Bad baboon?)"
<< "Sending a 500 response for this request:"
<< mOriginalRequest->header(h_RequestLine).uri() );
sendResponse(response);
}
else if(mResponseContext.mBestResponse.header(h_StatusLine).statusCode() != 408)
{
ErrLog(<< "In RequestContext, request and target processor "
<< "chains have run, and all Targets are now Terminated."
<< " However, we have not sent a final response, and our "
<< "best final response is not a 408.(What happened here?)");
// Send best response
mResponseContext.forwardBestResponse();
}
}
}
}
break;
case Processor::RESPONSE_CHAIN:
ret = mResponseProcessorChain.process(*this);
mTargetProcessorChain.process(*this);
break;
case Processor::TARGET_CHAIN:
ret = mTargetProcessorChain.process(*this);
break;
default:
ErrLog(<<"RequestContext " << getTransactionId() << " got a "
<< "ProcessorMessage addressed to a non existent chain "
<< type);
}
}
}
| void RequestContext::processRequestAckTransaction | ( | resip::SipMessage * | msg, |
| bool | original | ||
| ) | [protected] |
Definition at line 350 of file RequestContext.cxx.
{
assert(msg->isRequest());
if(msg->method()!=ACK)
{
// !bwc! Somebody collided with an ACK/200. Send a failure response.
SipMessage response;
Helper::makeResponse(response,*msg,400);
response.header(h_StatusLine).reason()="Transaction-id collision";
send(response);
return;
}
DebugLog(<<"This ACK has its own tid.");
try
{
// .slg. look at mOriginalRequest for Routes since removeTopRouteIfSelf() is only called on mOriginalRequest
if((!mOriginalRequest->exists(h_Routes) || mOriginalRequest->header(h_Routes).empty()) &&
getProxy().isMyUri(msg->header(h_RequestLine).uri()))
{
// .bwc. Someone sent an ACK with us in the Request-Uri, and no
// Route headers (after we have removed ourself). We will never perform
// location service or retargeting on an ACK, and we shouldn't send
// it to ourselves. So, just drop the thing.
handleSelfAimedStrayAck(msg);
}
// Note: mTopRoute is only populated if RemoveTopRouteIfSelf successfully removes the top route.
else if(!mTopRoute.uri().host().empty() || getProxy().isMyUri(msg->header(h_From).uri()))
{
// Top most route is us, or From header uri is ours. Note: The From check is
// required to interoperate with endpoints that configure outbound proxy
// settings, and do not place the outbound proxy in a Route header.
mResponseContext.cancelAllClientTransactions();
forwardAck200(*mOriginalRequest);
}
else
{
// .slg. Someone is using us to relay an ACK, but we are not the
// top-most route and the host in From isn't ours. Refusing to do so.
InfoLog(<<"Top most route or From header are not ours. We do not allow relaying ACKs. Dropping it...");
}
}
catch(resip::ParseException&)
{
InfoLog(<<"Parse error processing ACK. Dropping it...");
}
if(original) // Only queue Ack200Done if this is the original request
{
postAck200Done();
}
}
| bool RequestContext::processRequestInviteTransaction | ( | resip::SipMessage * | msg, |
| bool | original | ||
| ) | [protected] |
Definition at line 192 of file RequestContext.cxx.
{
bool doPostProcess=false;
assert(msg->isRequest());
if(original)
{
assert(msg->method()==INVITE);
try
{
Processor::processor_action_t ret=Processor::Continue;
ret = mRequestProcessorChain.process(*this);
if(ret!=Processor::WaitingForEvent && !mHaveSentFinalResponse)
{
doPostProcess=true;
}
}
catch(resip::BaseException& e)
{
SipMessage response;
Helper::makeResponse(response,*mOriginalRequest,500);
response.header(h_StatusLine).reason()="Server error: " + e.getMessage();
ErrLog(<<"Exception caught: " << e);
sendResponse(response);
}
}
else
{
if(msg->method()==CANCEL)
{
mResponseContext.processCancel(*msg);
doPostProcess=true;
}
else if(msg->method()==ACK)
{
// .bwc. The stack should not be forwarding ACK/failure to the TU,
// nor should we be getting a bad ACK/200. (There is code further
// up that makes bad ACK/200 look like a new transaction, like it
// is supposed to be.)
// TODO Remove this code block entirely.
assert(0);
DebugLog(<<"This ACK has the same tid as the original INVITE.");
DebugLog(<<"The reponse we sent back was a "
<< mResponseContext.mBestResponse.header(h_StatusLine).statusCode());
// .bwc. Since this is not an ACK transaction, the stack will let
// us know when we need to clean up.
if(!mHaveSentFinalResponse)
{
// .bwc. Whoa, something went wrong here. We got an ACK, but we
// haven't sent back a final response. The stack shouldn't have
// allowed this through!
ErrLog(<<"Got an ACK, but haven't sent a final response. "
"What happened here?");
}
else if(mResponseContext.mBestResponse.header(h_StatusLine).statusCode() / 100 == 2)
{
InfoLog(<<"Got an ACK within an INVITE transaction, but our "
"response was a 2xx. Someone didn't change their tid "
"like they were supposed to...");
if(
(
msg->exists(h_Routes) &&
!msg->header(h_Routes).empty()
)
||
(
!getProxy().isMyUri(msg->header(h_RequestLine).uri()) &&
(msg->header(h_From).isWellFormed() && getProxy().isMyUri(msg->header(h_From).uri()))
)
)
{
forwardAck200(*msg);
}
}
}
else
{
// .bwc. The stack should not have done this. This indicates either a
// bug in the stack, processInvite was called in a non-invite
// RequestContext, or this RequestContext was leaked and hit with a
// subsequent transaction
ErrLog(<<"We got an unexpected request from "
"the stack in an invite RequestContext. "
"Why?"
" Orig: " << mOriginalRequest->brief() <<
" This: " << msg->brief());
assert(0);
}
}
return doPostProcess;
}
| bool RequestContext::processRequestNonInviteTransaction | ( | resip::SipMessage * | msg, |
| bool | original | ||
| ) | [protected] |
Definition at line 289 of file RequestContext.cxx.
{
assert(msg->isRequest());
bool doPostProcess=false;
if(original)
{
assert(msg->method()==mOriginalRequest->method());
try
{
Processor::processor_action_t ret=Processor::Continue;
ret = mRequestProcessorChain.process(*this);
if(ret!=Processor::WaitingForEvent && !mHaveSentFinalResponse)
{
doPostProcess=true;
}
}
catch(resip::BaseException& e)
{
SipMessage response;
Helper::makeResponse(response,*mOriginalRequest,500);
response.header(h_StatusLine).reason()="Server error: " + e.getMessage();
ErrLog(<<"Exception caught: " << e);
sendResponse(response);
}
}
else
{
if(msg->method()==CANCEL)
{
// .bwc. Got a CANCEL in a non-invite transaction. Just respond with
// 200 and ignore.
SipMessage response;
Helper::makeResponse(response,*msg,200);
send(response);
}
else
{
// ?bwc? We got a second request from the stack. Why?
ErrLog(<<"We got a second non-invite request from the"
" stack in an already-established non-"
"invite RequestContext. "
"Why?"
" Orig: " << mOriginalRequest->brief() <<
" This: " << msg->brief());
if(msg->method()!=ACK)
{
SipMessage response;
Helper::makeResponse(response,*msg,500);
response.header(h_StatusLine).reason()="Server error: got an "
"unexpected request in a non-invite RequestContext";
send(response);
}
assert(0);
}
}
return doPostProcess;
}
| void repro::RequestContext::processResponseAckTransaction | ( | resip::SipMessage * | msg | ) | [protected] |
| bool RequestContext::processResponseInviteTransaction | ( | resip::SipMessage * | msg | ) | [protected] |
Definition at line 488 of file RequestContext.cxx.
{
assert(msg->isResponse());
bool doPostProcessing=false;
resip::Data tid(msg->getTransactionId());
tid.lowercase();
if(msg->method()==INVITE)
{
try
{
Processor::processor_action_t ret = Processor::Continue;
ret = mResponseProcessorChain.process(*this);
assert(ret != Processor::WaitingForEvent);
if (ret == Processor::Continue)
{
doPostProcessing=true;
}
else
{
// This means the response has been eaten. Do not forward back.
mResponseContext.terminateClientTransaction(tid);
}
}
catch(resip::ParseException& e)
{
InfoLog(<<"Garbage in response; dropping message. " << e);
mResponseContext.terminateClientTransaction(tid);
}
catch(resip::BaseException& e)
{
ErrLog(<<"Exception thrown in response processor chain: " << e);
// ?bwc? TODO what do we do here? Continue processing? Give up?
mResponseContext.terminateClientTransaction(tid);
}
}
else if(msg->method()==CANCEL)
{
// .bwc. Do nothing.
}
else
{
// ?bwc? Is this possible?
assert(0);
}
return doPostProcessing;
}
| bool RequestContext::processResponseNonInviteTransaction | ( | resip::SipMessage * | msg | ) | [protected] |
Definition at line 539 of file RequestContext.cxx.
{
assert(msg->isResponse());
resip::Data tid(msg->getTransactionId());
tid.lowercase();
bool doPostProcessing=false;
if(msg->method()==mOriginalRequest->method())
{
try
{
Processor::processor_action_t ret = Processor::Continue;
ret = mResponseProcessorChain.process(*this);
assert(ret != Processor::WaitingForEvent);
if (ret == Processor::Continue)
{
doPostProcessing=true;
}
else
{
// This means the response has been eaten. Do not forward back.
mResponseContext.terminateClientTransaction(tid);
}
}
catch(resip::ParseException& e)
{
InfoLog(<<"Garbage in response; dropping message. " << e);
mResponseContext.terminateClientTransaction(tid);
}
catch(resip::BaseException& e)
{
ErrLog(<<"Exception thrown in response processor chain: " << e);
// ?bwc? TODO what do we do here? Continue processing? Give up?
mResponseContext.terminateClientTransaction(tid);
}
}
else
{
// ?bwc? Is this possible?
assert(0);
}
return doPostProcessing;
}
| void RequestContext::removeTopRouteIfSelf | ( | ) | [protected] |
Pops the topmost route if it's us.
Definition at line 994 of file RequestContext.cxx.
{
if(mOriginalRequest->exists(h_Routes)
&& !mOriginalRequest->header(h_Routes).empty()
&& mProxy.isMyUri(mOriginalRequest->header(h_Routes).front().uri()))
{
// save the top-most Route header field so monkeys can check it later
mTopRoute = mOriginalRequest->header(h_Routes).front();
mOriginalRequest->header(h_Routes).pop_front();
static ExtensionParameter p_drr("drr");
if(mTopRoute.uri().exists(p_drr))
{
if(!mOriginalRequest->header(h_Routes).empty()
&& mProxy.isMyUri(mOriginalRequest->header(h_Routes).front().uri()))
{
// .bwc. Do double-record routing logic
mTopRoute = mOriginalRequest->header(h_Routes).front();
mOriginalRequest->header(h_Routes).pop_front();
}
else
{
// ?bwc? Somebody messed with our record-routes. Just ignore? Or
// should we reject?
}
}
}
}
| void RequestContext::send | ( | resip::SipMessage & | msg | ) | [virtual] |
Definition at line 896 of file RequestContext.cxx.
| void RequestContext::sendResponse | ( | resip::SipMessage & | response | ) |
Definition at line 902 of file RequestContext.cxx.
{
assert (msg.isResponse());
// We can't respond to an ACK request - so just drop it and generate an Ack200DoneMessage so the request context
// gets cleaned up properly
if(mOriginalRequest->method() == ACK)
{
ErrLog(<<"Posting Ack200DoneMessage: due to sendResponse(). This is probably a bug.");
postAck200Done();
}
else
{
DebugLog(<< "tid of orig req: " << mOriginalRequest->getTransactionId());
resip::Data tid;
try
{
tid=msg.getTransactionId();
}
catch(SipMessage::Exception&)
{
InfoLog(<< "Bad tid in response. Trying to replace with 2543 tid "
"from orig request.");
tid=mOriginalRequest->getRFC2543TransactionId();
// .bwc. If the original request didn't have a proper transaction-
// id, the response will not either. We need to set the tid in the
// response in order to make sure that this response hits the
// correct transaction down in the stack.
msg.setRFC2543TransactionId(tid);
}
if(tid!=mOriginalRequest->getTransactionId())
{
InfoLog(<<"Someone messed with the Via stack in a response. This "
"is not only bad behavior, but potentially malicious. "
"Response came from: " << msg.getSource() <<
" Request came from: " <<
mOriginalRequest->getSource() <<
" Via after modification (in response): " <<
msg.header(h_Vias).front() <<
" Via before modification (in orig request): " <<
mOriginalRequest->header(h_Vias).front());
// .bwc. Compensate for malicous/broken UAS fiddling with Via stack.
msg.header(h_Vias).front()=mOriginalRequest->header(h_Vias).front();
}
DebugLog(<<"Ensuring orig tid matches tid of response: " <<
msg.getTransactionId() << " == " <<
mOriginalRequest->getTransactionId());
assert(msg.getTransactionId()==mOriginalRequest->getTransactionId());
// .bwc. Provisionals are not final responses, and CANCEL/200 is not a final
//response in this context.
if (msg.header(h_StatusLine).statusCode()>199 && msg.method()!=CANCEL)
{
DebugLog(<<"Sending final response.");
mHaveSentFinalResponse=true;
}
const resip::Data& serverText = mProxy.getServerText();
if (!serverText.empty() && !msg.exists(h_Server) )
{
msg.header(h_Server).value() = serverText;
}
send(msg);
}
}
| void RequestContext::setDigestIdentity | ( | const resip::Data & | data | ) |
Definition at line 854 of file RequestContext.cxx.
{
mDigestIdentity = data;
}
| void RequestContext::updateTimerC | ( | ) |
Definition at line 866 of file RequestContext.cxx.
{
InfoLog(<<"Updating timer C.");
mTCSerial++;
TimerCMessage* tc = new TimerCMessage(this->getTransactionId(),mTCSerial);
mProxy.postTimerC(std::auto_ptr<TimerCMessage>(tc));
}
| EncodeStream& operator<< | ( | EncodeStream & | strm, |
| const repro::RequestContext & | rc | ||
| ) | [friend] |
friend class ResponseContext [friend] |
Definition at line 111 of file RequestContext.hxx.
Definition at line 78 of file RequestContext.hxx.
Definition at line 106 of file RequestContext.hxx.
resip::Message* repro::RequestContext::mCurrentEvent [protected] |
Definition at line 77 of file RequestContext.hxx.
resip::Data repro::RequestContext::mDigestIdentity [protected] |
Definition at line 92 of file RequestContext.hxx.
Definition at line 74 of file RequestContext.hxx.
Definition at line 67 of file RequestContext.hxx.
Definition at line 98 of file RequestContext.hxx.
resip::SipMessage* repro::RequestContext::mOriginalRequest [protected] |
Definition at line 76 of file RequestContext.hxx.
Proxy& repro::RequestContext::mProxy [protected] |
Definition at line 94 of file RequestContext.hxx.
Definition at line 79 of file RequestContext.hxx.
Definition at line 96 of file RequestContext.hxx.
Definition at line 80 of file RequestContext.hxx.
Definition at line 81 of file RequestContext.hxx.
int repro::RequestContext::mTCSerial [protected] |
Definition at line 97 of file RequestContext.hxx.
resip::NameAddr repro::RequestContext::mTopRoute [protected] |
Definition at line 95 of file RequestContext.hxx.
int repro::RequestContext::mTransactionCount [protected] |
Definition at line 93 of file RequestContext.hxx.
1.7.5.1