reSIProcate/repro  9694
Public Member Functions
repro::StrictRouteFixup Class Reference

#include <StrictRouteFixup.hxx>

Inheritance diagram for repro::StrictRouteFixup:
Inheritance graph
[legend]
Collaboration diagram for repro::StrictRouteFixup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StrictRouteFixup ()
virtual ~StrictRouteFixup ()
virtual processor_action_t process (RequestContext &)
 This monkey looks to see if the request has a Route header (the RequestContext has already done preprocessing, and has removed any topmost route that was self).

Detailed Description

Definition at line 8 of file StrictRouteFixup.hxx.


Constructor & Destructor Documentation

StrictRouteFixup::StrictRouteFixup ( )

Definition at line 20 of file StrictRouteFixup.cxx.

                                   :
   Processor("StrictRouteFixup")
{}
StrictRouteFixup::~StrictRouteFixup ( ) [virtual]

Definition at line 24 of file StrictRouteFixup.cxx.

{}

Member Function Documentation

Processor::processor_action_t StrictRouteFixup::process ( RequestContext context) [virtual]

This monkey looks to see if the request has a Route header (the RequestContext has already done preprocessing, and has removed any topmost route that was self).

If there is, the previous hop was a strict routing proxy and the candidate set is exactly the RURI of the received request (after the above preprocessing).

Implements repro::Processor.

Definition at line 36 of file StrictRouteFixup.cxx.

{
   DebugLog(<< "Monkey handling request: " << *this 
            << "; reqcontext = " << context);

   resip::SipMessage& request = context.getOriginalRequest();

   if (request.exists(h_Routes) &&
       !request.header(h_Routes).empty())
   {
      if(!request.header(h_Routes).front().isWellFormed())
      {
         // Garbage topmost Route, reject
         SipMessage resp;
         resip::Helper::makeResponse(resp, request, 400, "Garbage Route Header.");
         context.sendResponse(resp);
         return SkipAllChains;
      }

      //Will cancel any active transactions (ideally there should be none)
      //and terminate any pending transactions.
      context.getResponseContext().cancelAllClientTransactions();
      std::auto_ptr<Target> target(new Target(request.header(h_RequestLine).uri()));
      if(!context.getTopRoute().uri().user().empty())
      {
         resip::Tuple source(Tuple::makeTupleFromBinaryToken(context.getTopRoute().uri().user().base64decode(), Proxy::FlowTokenSalt));
         if(!(source==resip::Tuple()))
         {
            // valid flow token
            target->rec().mReceivedFrom = source;
            target->rec().mUseFlowRouting = true;
         }
      }
      context.getResponseContext().addTarget(target);
      return Processor::SkipThisChain;
   }
  
   return Processor::Continue;
}

The documentation for this class was generated from the following files: