reSIProcate/repro  9694
Public Member Functions | Private Member Functions | Private Attributes
repro::StaticRoute Class Reference

#include <StaticRoute.hxx>

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

List of all members.

Public Member Functions

 StaticRoute (ProxyConfig &config)
virtual ~StaticRoute ()
virtual processor_action_t process (RequestContext &)

Private Member Functions

void challengeRequest (repro::RequestContext &rc, resip::Data &realm)

Private Attributes

RouteStoremRouteStore
bool mNoChallenge
bool mParallelForkStaticRoutes
bool mContinueProcessingAfterRoutesFound
bool mUseAuthInt

Detailed Description

Definition at line 11 of file StaticRoute.hxx.


Constructor & Destructor Documentation

StaticRoute::StaticRoute ( ProxyConfig config)

Definition at line 21 of file StaticRoute.cxx.

                                            :
   Processor("StaticRoute"),
   mRouteStore(config.getDataStore()->mRouteStore),
   mNoChallenge(config.getConfigBool("DisableAuth", false)),
   mParallelForkStaticRoutes(config.getConfigBool("ParallelForkStaticRoutes", false)),
   mContinueProcessingAfterRoutesFound(config.getConfigBool("ContinueProcessingAfterRoutesFound", false)),
   mUseAuthInt(!config.getConfigBool("DisableAuthInt", false))
{}
StaticRoute::~StaticRoute ( ) [virtual]

Definition at line 30 of file StaticRoute.cxx.

{}

Member Function Documentation

void StaticRoute::challengeRequest ( repro::RequestContext rc,
resip::Data realm 
) [private]

Definition at line 111 of file StaticRoute.cxx.

{
   Message *message = rc.getCurrentEvent();
   SipMessage *sipMessage = dynamic_cast<SipMessage*>(message);
   assert(sipMessage);

   SipMessage *challenge = Helper::makeProxyChallenge(*sipMessage, realm, mUseAuthInt /*auth-int*/, false /*stale*/);
   rc.sendResponse(*challenge);

   delete challenge;
}
Processor::processor_action_t StaticRoute::process ( RequestContext context) [virtual]

Implements repro::Processor.

Definition at line 34 of file StaticRoute.cxx.

{
   DebugLog(<< "Monkey handling request: " << *this 
            << "; reqcontext = " << context);
   
   SipMessage& msg = context.getOriginalRequest();
   
   Uri ruri(msg.header(h_RequestLine).uri());
   Data method(getMethodName(msg.header(h_RequestLine).method()));
   Data event;
   if ( msg.exists(h_Event) && msg.header(h_Event).isWellFormed())
   {
      event = msg.header(h_Event).value() ;
   }
   
   RouteStore::UriList targets(mRouteStore.process( ruri,
                                                    method,
                                                    event));
   bool requireAuth = false;
   if(!context.getKeyValueStore().getBoolValue(IsTrustedNode::mFromTrustedNodeKey) && 
      msg.method() != ACK &&  // Don't challenge ACK and BYE requests
      msg.method() != BYE)
   {
      requireAuth = !mNoChallenge;
      //for ( RouteStore::UriList::const_iterator i = targets.begin();
      //      i != targets.end(); i++ )
      //{      
         // !rwm! TODO would be useful to check if these targets require authentication
         // but for know we will just fail safe and assume that all routes require auth
         // if the sender is not trusted
      //   requireAuth |= !mNoChallenge;
      //}
   }

   if (requireAuth && context.getDigestIdentity().empty())
   {
      // !rwm! TODO do we need anything more sophisticated to figure out the realm?
      Data realm = msg.header(h_RequestLine).uri().host();
      
      challengeRequest(context, realm);
      return Processor::SkipAllChains;
   }
   else
   {
      TargetPtrList parallelBatch;
      for (RouteStore::UriList::const_iterator i = targets.begin();
           i != targets.end(); i++ )
      {
         //Targets are only added after authentication
         InfoLog(<< "Adding target " << *i );

         if(mParallelForkStaticRoutes)
         {
            Target* target = new Target(*i);
            parallelBatch.push_back(target);
         }
         else
         {
            // Add Simple Target
            context.getResponseContext().addTarget(NameAddr(*i));
         }
      }
      if(parallelBatch.size() > 0)
      {
         context.getResponseContext().addTargetBatch(parallelBatch, false /* highPriority */);
      }

      if(!targets.empty() && !mContinueProcessingAfterRoutesFound)
      {
         return Processor::SkipThisChain;
      }
   }
   
   return Processor::Continue;
}

Member Data Documentation

Definition at line 23 of file StaticRoute.hxx.

Definition at line 21 of file StaticRoute.hxx.

Definition at line 22 of file StaticRoute.hxx.

Definition at line 20 of file StaticRoute.hxx.

Definition at line 24 of file StaticRoute.hxx.


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