reSIProcate/repro  9694
ConstantLocationMonkey.cxx
Go to the documentation of this file.
00001 #if defined(HAVE_CONFIG_H)
00002 #include "config.h"
00003 #endif
00004 
00005 #include "resip/stack/SipMessage.hxx"
00006 #include "repro/monkeys/ConstantLocationMonkey.hxx"
00007 #include "repro/RequestContext.hxx"
00008 
00009 #include "rutil/Logger.hxx"
00010 #define RESIPROCATE_SUBSYSTEM resip::Subsystem::REPRO
00011 
00012 using namespace resip;
00013 using namespace repro;
00014 using namespace std;
00015 
00016 
00017 ConstantLocationMonkey::ConstantLocationMonkey() :
00018    Processor("ConstantLocationMonkey")
00019 {}
00020 
00021 ConstantLocationMonkey::~ConstantLocationMonkey()
00022 {}
00023 
00024 Processor::processor_action_t
00025 ConstantLocationMonkey::process(RequestContext& context)
00026 {
00027   DebugLog(<< "Monkey handling request: " << *this 
00028            << "; reqcontext = " << context);
00029 
00030   if (context.getOriginalRequest().header(h_RequestLine).uri().user() == "inner")
00031   {
00032      context.getResponseContext().addTarget(NameAddr("<sip:inner@72.29.230.162>"));
00033   }
00034   else if (context.getOriginalRequest().header(h_RequestLine).uri().user() == "outer")
00035   {
00036      context.getResponseContext().addTarget(NameAddr("<sip:101@sipedge.sipit.net>"));     
00037   }
00038   
00039   return Processor::Continue;
00040 }
00041 
00042 
00043 /* ====================================================================
00044  * The Vovida Software License, Version 1.0 
00045  * 
00046  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00047  * 
00048  * Redistribution and use in source and binary forms, with or without
00049  * modification, are permitted provided that the following conditions
00050  * are met:
00051  * 
00052  * 1. Redistributions of source code must retain the above copyright
00053  *    notice, this list of conditions and the following disclaimer.
00054  * 
00055  * 2. Redistributions in binary form must reproduce the above copyright
00056  *    notice, this list of conditions and the following disclaimer in
00057  *    the documentation and/or other materials provided with the
00058  *    distribution.
00059  * 
00060  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00061  *    and "Vovida Open Communication Application Library (VOCAL)" must
00062  *    not be used to endorse or promote products derived from this
00063  *    software without prior written permission. For written
00064  *    permission, please contact vocal@vovida.org.
00065  *
00066  * 4. Products derived from this software may not be called "VOCAL", nor
00067  *    may "VOCAL" appear in their name, without prior written
00068  *    permission of Vovida Networks, Inc.
00069  * 
00070  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00071  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00072  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00073  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00074  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00075  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00076  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00077  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00078  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00079  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00080  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00081  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00082  * DAMAGE.
00083  * 
00084  * ====================================================================
00085  * 
00086  * This software consists of voluntary contributions made by Vovida
00087  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00088  * Inc.  For more information on Vovida Networks, Inc., please see
00089  * <http://www.vovida.org/>.
00090  *
00091  */