/[resiprocate]/branches/b-identity-0505/dum/RedirectManager.hxx
ViewVC logotype

Contents of /branches/b-identity-0505/dum/RedirectManager.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4598 - (show annotations) (download)
Wed May 11 22:53:07 2005 UTC (14 years, 7 months ago) by derek
File size: 4822 byte(s)
set svn:eol-style to LF
1 #if !defined(RESIP_REDIRECTMANAGER_HXX)
2 #define RESIP_REDIRECTMANAGER_HXX
3
4
5 #include <set>
6 #include <queue>
7 #include <functional>
8 #include <vector>
9
10 #include "resiprocate/dum/Handles.hxx"
11 #include "resiprocate/NameAddr.hxx"
12 #include "resiprocate/SipMessage.hxx"
13 #include "resiprocate/dum/DialogSetId.hxx"
14 #include "resiprocate/os/HashMap.hxx"
15
16 //8.1.3.4
17 //19.1.5
18
19 namespace resip
20 {
21
22 class DialogSet;
23
24 class RedirectManager
25 {
26 public:
27 class Ordering : public std::binary_function<const NameAddr&, const NameAddr&, bool>
28 {
29 public:
30 virtual bool operator()(const NameAddr& lhs, const NameAddr& rhs) const;
31 };
32
33 bool handle(DialogSet& dSet, SipMessage& origRequest, const SipMessage& response);
34
35 //deafult is by q-value, no q-value last
36 void setOrdering(const Ordering& order);
37
38 void removeDialogSet(DialogSetId id);
39
40 //based on follows 8.1.3.4 of 3261. Overload to interject user decisions
41 //or to process 301, 305 or 380 reponses.
42 // virtual void onRedirect(AppDialogSetHandle, const SipMessage& response);
43 //use a priority queue by q-value, and a list(linear, set too heavy?) of
44 //values that have been tried. Do q-values really have any meaning across
45 //different 3xx values? Or should the first 3xx always win.
46 protected:
47 class TargetSet
48 {
49 public:
50 TargetSet(const SipMessage& request, const Ordering& order) :
51 mTargetQueue(order),
52 mRequest(request)
53 {}
54
55 void addTargets(const SipMessage& msg);
56 //pass in the message stored in the creator
57 bool makeNextRequest(SipMessage& request);
58 protected:
59 typedef std::set<NameAddr> EncounteredTargetSet;
60 typedef std::priority_queue<NameAddr, std::vector<NameAddr>, Ordering> TargetQueue;
61
62 EncounteredTargetSet mTargetSet;
63 TargetQueue mTargetQueue;
64 //mLastRequest in creator is kept in sync with this, this is needed
65 //so that embedded information in a target uri does not migrate to
66 //the wrong attempt
67 SipMessage mRequest;
68 };
69
70 typedef HashMap<DialogSetId, TargetSet*> RedirectedRequestMap;
71 RedirectedRequestMap mRedirectedRequestMap;
72 Ordering mOrdering;
73 };
74
75
76 }
77
78 #endif
79
80 /* ====================================================================
81 * The Vovida Software License, Version 1.0
82 *
83 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
84 *
85 * Redistribution and use in source and binary forms, with or without
86 * modification, are permitted provided that the following conditions
87 * are met:
88 *
89 * 1. Redistributions of source code must retain the above copyright
90 * notice, this list of conditions and the following disclaimer.
91 *
92 * 2. Redistributions in binary form must reproduce the above copyright
93 * notice, this list of conditions and the following disclaimer in
94 * the documentation and/or other materials provided with the
95 * distribution.
96 *
97 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
98 * and "Vovida Open Communication Application Library (VOCAL)" must
99 * not be used to endorse or promote products derived from this
100 * software without prior written permission. For written
101 * permission, please contact vocal@vovida.org.
102 *
103 * 4. Products derived from this software may not be called "VOCAL", nor
104 * may "VOCAL" appear in their name, without prior written
105 * permission of Vovida Networks, Inc.
106 *
107 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
108 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
109 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
110 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
111 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
112 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
113 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
114 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
115 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
116 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
117 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
118 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
119 * DAMAGE.
120 *
121 * ====================================================================
122 *
123 * This software consists of voluntary contributions made by Vovida
124 * Networks, Inc. and many individuals on behalf of Vovida Networks,
125 * Inc. For more information on Vovida Networks, Inc., please see
126 * <http://www.vovida.org/>.
127 *
128 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27