reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
RecursiveRedirect.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
5#include <algorithm>
6
12#include "rutil/Logger.hxx"
13
14#define RESIPROCATE_SUBSYSTEM resip::Subsystem::REPRO
15
16using namespace resip;
17using namespace repro;
18using namespace std;
19
21 Processor("RecursiveRedirectHandler")
22{}
23
24
27
28
31{
32 DebugLog(<< "Lemur handling request: " << *this
33 << "; reqcontext = " << context);
34
35 const SipMessage* response = dynamic_cast<const SipMessage*>(context.getCurrentEvent());
36 if (response &&
37 response->isResponse() &&
38 response->header(h_StatusLine).statusCode() / 100 == 3)
39 {
40 TargetPtrList batch;
41 for (NameAddrs::const_iterator i=response->header(h_Contacts).begin();
42 i != response->header(h_Contacts).end(); ++i)
43 {
44 if(i->isWellFormed() && !i->isAllContacts())
45 {
46 QValueTarget* target = new QValueTarget(*i);
47 batch.push_back(target);
48 }
49 }
50 if(!batch.empty())
51 {
52#ifdef __SUNPRO_CC
53 sort(batch.begin(), batch.end(), Target::priorityMetricCompare);
54#else
56#endif
57 context.getResponseContext().addTargetBatch(batch);
58 //ResponseContext should be consuming the vector
59 resip_assert(batch.empty());
60 }
62 }
63 return Processor::Continue;
64}
65
66
67/* ====================================================================
68 * The Vovida Software License, Version 1.0
69 *
70 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
71 *
72 * Redistribution and use in source and binary forms, with or without
73 * modification, are permitted provided that the following conditions
74 * are met:
75 *
76 * 1. Redistributions of source code must retain the above copyright
77 * notice, this list of conditions and the following disclaimer.
78 *
79 * 2. Redistributions in binary form must reproduce the above copyright
80 * notice, this list of conditions and the following disclaimer in
81 * the documentation and/or other materials provided with the
82 * distribution.
83 *
84 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
85 * and "Vovida Open Communication Application Library (VOCAL)" must
86 * not be used to endorse or promote products derived from this
87 * software without prior written permission. For written
88 * permission, please contact vocal@vovida.org.
89 *
90 * 4. Products derived from this software may not be called "VOCAL", nor
91 * may "VOCAL" appear in their name, without prior written
92 * permission of Vovida Networks, Inc.
93 *
94 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
95 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
96 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
97 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
98 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
99 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
100 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
101 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
102 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
103 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
104 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
105 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
106 * DAMAGE.
107 *
108 * ====================================================================
109 */
#define DebugLog(args_)
Definition Logger.hxx:128
#define resip_assert(x)
This file needs to work for both C and C++ code.
virtual processor_action_t process(RequestContext &)
resip::Message * getCurrentEvent()
Returns the event that we are currently working on.
ResponseContext & getResponseContext()
bool addTargetBatch(TargetPtrList &targets, bool highPriority=false)
Adds a batch of Targets.
static bool priorityMetricCompare(const Target *lhs, const Target *rhs)
Definition Target.hxx:60
Represents a SIP message.
const RequestLine & header(const RequestLineType &l) const
Returns the RequestLine. This is only valid for request messages.
bool isResponse() const
Returns true if message is a response, false otherwise.
This Class is used to implement a primitive form of RPC using loose XML formatting.
std::list< Target * > TargetPtrList
Definition Target.hxx:81
dcm! – add UnusedChecking(_enum) below;
StatusLineType h_StatusLine
Definition Headers.cxx:348