reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
RRVip.hxx
Go to the documentation of this file.
1#ifndef RESIP_RRVIP_HXX
2#define RESIP_RRVIP_HXX
3
5
6namespace resip
7{
8
10{
11 public:
12 RRVip();
13 ~RRVip();
14
15 void vip(const Data& target, int rrType, const Data& vip);
16 void removeVip(const Data& target, int rrType);
17 void transform(const Data& target, int rrType, std::vector<DnsResourceRecord*>&);
18
19 private:
20
21 RRVip(const RRVip&);
22 RRVip& operator=(const RRVip&);
23
24 typedef std::vector<DnsResourceRecord*> RRVector;
25 class Transform
26 {
27 public:
28 Transform(const Data& vip);
29 virtual ~Transform();
30 virtual void transform(RRVector& rrs, bool& invalidVip);
31 void updateVip(const Data& vip);
32 const Data& vip() { return mVip; };
33
34 protected:
35 Data mVip; // ip for a/aaaa, target host for srv, and replacement for naptr.
36 };
37
38 class NaptrTransform : public Transform
39 {
40 public:
41 NaptrTransform(const Data& vip);
42 void transform(RRVector& rrs, bool&);
43 };
44
45 class SrvTransform : public Transform
46 {
47 public:
48 SrvTransform(const Data& vip);
49 void transform(RRVector& rrs, bool&);
50 };
51
52 class MapKey
53 {
54 public:
55 MapKey();
56 MapKey(const Data& target, int rrType);
57 bool operator<(const MapKey&) const;
58 private:
59 Data mTarget;
60 int mRRType;
61 };
62
63 class TransformFactory
64 {
65 public:
66 virtual ~TransformFactory() {}
67 virtual Transform* createTransform(const Data& vip) = 0;
68 };
69
70 class HostTransformFactory : public TransformFactory
71 {
72 public:
73 Transform* createTransform(const Data& vip) { return new Transform(vip); }
74 };
75
76 class NaptrTransformFactroy : public TransformFactory
77 {
78 public:
79 Transform* createTransform(const Data& vip) { return new NaptrTransform(vip); }
80 };
81
82 class SrvTransformFactory : public TransformFactory
83 {
84 public:
85 Transform* createTransform(const Data& vip) { return new SrvTransform(vip); }
86 };
87
88 typedef std::map<int, TransformFactory*> TransformFactoryMap;
89 TransformFactoryMap mFactories;
90
91 typedef std::map<MapKey, Transform*> TransformMap;
92 TransformMap mTransforms;
93};
94
95}
96
97#endif
98
99/* ====================================================================
100 * The Vovida Software License, Version 1.0
101 *
102 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
103 *
104 * Redistribution and use in source and binary forms, with or without
105 * modification, are permitted provided that the following conditions
106 * are met:
107 *
108 * 1. Redistributions of source code must retain the above copyright
109 * notice, this list of conditions and the following disclaimer.
110 *
111 * 2. Redistributions in binary form must reproduce the above copyright
112 * notice, this list of conditions and the following disclaimer in
113 * the documentation and/or other materials provided with the
114 * distribution.
115 *
116 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
117 * and "Vovida Open Communication Application Library (VOCAL)" must
118 * not be used to endorse or promote products derived from this
119 * software without prior written permission. For written
120 * permission, please contact vocal@vovida.org.
121 *
122 * 4. Products derived from this software may not be called "VOCAL", nor
123 * may "VOCAL" appear in their name, without prior written
124 * permission of Vovida Networks, Inc.
125 *
126 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
127 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
128 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
129 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
130 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
131 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
132 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
133 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
134 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
135 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
136 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
137 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
138 * DAMAGE.
139 *
140 * ====================================================================
141 *
142 * This software consists of voluntary contributions made by Vovida
143 * Networks, Inc. and many individuals on behalf of Vovida Networks,
144 * Inc. For more information on Vovida Networks, Inc., please see
145 * <http://www.vovida.org/>.
146 *
147 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
void removeVip(const Data &target, int rrType)
Definition RRVip.cxx:86
void vip(const Data &target, int rrType, const Data &vip)
Definition RRVip.cxx:67
void transform(const Data &target, int rrType, std::vector< DnsResourceRecord * > &)
Definition RRVip.cxx:100
dcm! – add UnusedChecking(_enum) below;
bool operator<(const Data &lhs, const Data &rhs)
Definition Data.cxx:778