/[resiprocate]/branches/b-identity-0505/dum/MasterProfile.cxx
ViewVC logotype

Contents of /branches/b-identity-0505/dum/MasterProfile.cxx

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: 6820 byte(s)
set svn:eol-style to LF
1
2 #include "resiprocate/dum/Profile.hxx"
3 #include "resiprocate/dum/MasterProfile.hxx"
4 #include "resiprocate/HeaderTypes.hxx"
5
6 using namespace resip;
7 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
8
9
10 MasterProfile::MasterProfile() :
11 mValidateContentEnabled(true),
12 mValidateContentLanguageEnabled(false),
13 mValidateAcceptEnabled(true)
14 {
15 // Default settings
16 addSupportedMimeType(INVITE, Mime("application", "sdp"));
17 addSupportedMimeType(OPTIONS, Mime("application", "sdp"));
18 addSupportedMimeType(PRACK, Mime("application", "sdp"));
19 addSupportedMimeType(UPDATE, Mime("application", "sdp"));
20 addSupportedLanguage(Token("en"));
21 addSupportedMethod(INVITE);
22 addSupportedMethod(ACK);
23 addSupportedMethod(CANCEL);
24 addSupportedMethod(OPTIONS);
25 addSupportedMethod(BYE);
26 addSupportedScheme(Symbols::Sip);
27 }
28
29 void
30 MasterProfile::addSupportedScheme(const Data& scheme)
31 {
32 mSupportedSchemes.insert(scheme);
33 }
34
35 bool
36 MasterProfile::isSchemeSupported(const Data& scheme) const
37 {
38 return mSupportedSchemes.count(scheme) != 0;
39 }
40
41 void
42 MasterProfile::clearSupportedSchemes()
43 {
44 mSupportedSchemes.clear();
45 }
46
47 void
48 MasterProfile::addSupportedMethod(const MethodTypes& method)
49 {
50 mSupportedMethodTypes.insert(method);
51 mSupportedMethods.push_back(Token(getMethodName(method)));
52 }
53
54 bool
55 MasterProfile::isMethodSupported(MethodTypes method) const
56 {
57 return mSupportedMethodTypes.count(method) != 0;
58 }
59
60 Tokens
61 MasterProfile::getAllowedMethods() const
62 {
63 return mSupportedMethods;
64 }
65
66 void
67 MasterProfile::clearSupportedMethods()
68 {
69 mSupportedMethodTypes.clear();
70 mSupportedMethods.clear();
71 }
72
73 void
74 MasterProfile::addSupportedOptionTag(const Token& tag)
75 {
76 mSupportedOptionTags.push_back(tag);
77 }
78
79 Tokens
80 MasterProfile::getUnsupportedOptionsTags(const Tokens& requiresOptionTags)
81 {
82 Tokens tokens;
83 for (Tokens::const_iterator i=requiresOptionTags.begin(); i != requiresOptionTags.end(); ++i)
84 {
85 // if this option is not supported
86 if (!mSupportedOptionTags.find(*i))
87 {
88 tokens.push_back(*i);
89 }
90 }
91
92 return tokens;
93 }
94
95 Tokens
96 MasterProfile::getSupportedOptionTags() const
97 {
98 return mSupportedOptionTags;
99 }
100
101 void
102 MasterProfile::clearSupportedOptionTags()
103 {
104 mSupportedOptionTags.clear();
105 }
106
107 void
108 MasterProfile::addSupportedMimeType(const MethodTypes& method, const Mime& mimeType)
109 {
110 mSupportedMimeTypes[method].push_back(mimeType);
111 }
112
113 bool
114 MasterProfile::isMimeTypeSupported(const MethodTypes& method, const Mime& mimeType)
115 {
116 return mSupportedMimeTypes[method].find(mimeType);
117 }
118
119 Mimes
120 MasterProfile::getSupportedMimeTypes(const MethodTypes& method)
121 {
122 return mSupportedMimeTypes[method];
123 }
124
125 void
126 MasterProfile::clearSupportedMimeTypes(const MethodTypes& method)
127 {
128 mSupportedMimeTypes[method].clear();
129 }
130
131 void
132 MasterProfile::clearSupportedMimeTypes()
133 {
134 mSupportedMimeTypes.clear();
135 }
136
137 void
138 MasterProfile::addSupportedEncoding(const Token& encoding)
139 {
140 mSupportedEncodings.push_back(encoding);
141 }
142
143 bool
144 MasterProfile::isContentEncodingSupported(const Token& encoding) const
145 {
146 return mSupportedEncodings.find(encoding);
147 }
148
149 Tokens
150 MasterProfile::getSupportedEncodings() const
151 {
152 return mSupportedEncodings;
153 }
154
155 void
156 MasterProfile::clearSupportedEncodings()
157 {
158 mSupportedEncodings.clear();
159 }
160
161 void
162 MasterProfile::addSupportedLanguage(const Token& lang)
163 {
164 mSupportedLanguages.push_back(lang);
165 }
166
167 bool
168 MasterProfile::isLanguageSupported(const Tokens& langs) const
169 {
170 for (Tokens::const_iterator i=langs.begin(); i != langs.end(); ++i)
171 {
172 if (mSupportedLanguages.find(*i) == false)
173 {
174 return false;
175 }
176 }
177 return true;
178 }
179
180 Tokens
181 MasterProfile::getSupportedLanguages() const
182 {
183 return mSupportedLanguages;
184 }
185
186 void
187 MasterProfile::clearSupportedLanguages()
188 {
189 mSupportedLanguages.clear();
190 }
191
192 bool&
193 MasterProfile::validateContentEnabled()
194 {
195 return mValidateContentEnabled;
196 }
197
198 const bool
199 MasterProfile::validateContentEnabled() const
200 {
201 return mValidateContentEnabled;
202 }
203
204 bool&
205 MasterProfile::validateContentLanguageEnabled()
206 {
207 return mValidateContentLanguageEnabled;
208 }
209
210 const bool
211 MasterProfile::validateContentLanguageEnabled() const
212 {
213 return mValidateContentLanguageEnabled;
214 }
215
216 bool&
217 MasterProfile::validateAcceptEnabled()
218 {
219 return mValidateAcceptEnabled;
220 }
221
222 const bool
223 MasterProfile::validateAcceptEnabled() const
224 {
225 return mValidateContentEnabled;
226 }
227
228
229 /* ====================================================================
230 * The Vovida Software License, Version 1.0
231 *
232 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
233 *
234 * Redistribution and use in source and binary forms, with or without
235 * modification, are permitted provided that the following conditions
236 * are met:
237 *
238 * 1. Redistributions of source code must retain the above copyright
239 * notice, this list of conditions and the following disclaimer.
240 *
241 * 2. Redistributions in binary form must reproduce the above copyright
242 * notice, this list of conditions and the following disclaimer in
243 * the documentation and/or other materials provided with the
244 * distribution.
245 *
246 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
247 * and "Vovida Open Communication Application Library (VOCAL)" must
248 * not be used to endorse or promote products derived from this
249 * software without prior written permission. For written
250 * permission, please contact vocal@vovida.org.
251 *
252 * 4. Products derived from this software may not be called "VOCAL", nor
253 * may "VOCAL" appear in their name, without prior written
254 * permission of Vovida Networks, Inc.
255 *
256 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
257 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
258 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
259 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
260 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
261 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
262 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
263 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
264 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
265 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
267 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
268 * DAMAGE.
269 *
270 * ====================================================================
271 *
272 * This software consists of voluntary contributions made by Vovida
273 * Networks, Inc. and many individuals on behalf of Vovida Networks,
274 * Inc. For more information on Vovida Networks, Inc., please see
275 * <http://www.vovida.org/>.
276 *
277 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27