reSIProcate/repro  9694
SimpleTargetHandler.cxx
Go to the documentation of this file.
00001 #include "repro/monkeys/SimpleTargetHandler.hxx"
00002 
00003 #include "repro/RequestContext.hxx"
00004 #include "repro/ResponseContext.hxx"
00005 
00006 namespace repro
00007 {
00008 
00009 SimpleTargetHandler::SimpleTargetHandler() :
00010    Processor("SimpleTargetHandler")
00011 {
00012 }
00013 
00014 SimpleTargetHandler::~SimpleTargetHandler()
00015 {
00016 }
00017 
00018 Processor::processor_action_t
00019 SimpleTargetHandler::process(RequestContext &rc)
00020 {
00021    ResponseContext& rsp=rc.getResponseContext();
00022 
00023    std::list<std::list<resip::Data> >& tidBank = rsp.mTransactionQueueCollection;
00024    std::list<std::list<resip::Data> >::iterator outer=tidBank.begin();
00025    while(!rsp.hasActiveTransactions() && outer!=tidBank.end())
00026    {   
00027       for(; outer!=tidBank.end() && !rsp.hasActiveTransactions(); outer++)
00028       {
00029          std::list<resip::Data>::const_iterator i;
00030          for(i=outer->begin();i!=outer->end();i++)
00031          {
00032             rsp.beginClientTransaction(*i);
00033          }
00034       }
00035    }
00036    
00037    if(rsp.hasActiveTransactions())
00038    {
00039       return Processor::SkipAllChains;
00040    }
00041    else
00042    {
00043       //If after all this we still don't have any active transactions,
00044       //make it a free-for-all.
00045       rsp.beginClientTransactions();
00046       return Processor::Continue;
00047    }
00048 }
00049 
00050 }
00051 
00052 /* ====================================================================
00053  * The Vovida Software License, Version 1.0 
00054  * 
00055  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00056  * 
00057  * Redistribution and use in source and binary forms, with or without
00058  * modification, are permitted provided that the following conditions
00059  * are met:
00060  * 
00061  * 1. Redistributions of source code must retain the above copyright
00062  *    notice, this list of conditions and the following disclaimer.
00063  * 
00064  * 2. Redistributions in binary form must reproduce the above copyright
00065  *    notice, this list of conditions and the following disclaimer in
00066  *    the documentation and/or other materials provided with the
00067  *    distribution.
00068  * 
00069  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00070  *    and "Vovida Open Communication Application Library (VOCAL)" must
00071  *    not be used to endorse or promote products derived from this
00072  *    software without prior written permission. For written
00073  *    permission, please contact vocal@vovida.org.
00074  *
00075  * 4. Products derived from this software may not be called "VOCAL", nor
00076  *    may "VOCAL" appear in their name, without prior written
00077  *    permission of Vovida Networks, Inc.
00078  * 
00079  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00080  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00081  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00082  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00083  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00084  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00085  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00086  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00087  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00088  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00089  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00090  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00091  * DAMAGE.
00092  * 
00093  * ====================================================================
00094  */