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

Contents of /branches/b-identity-0505/Headers.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4598 - (show annotations) (download)
Wed May 11 22:53:07 2005 UTC (14 years, 6 months ago) by derek
File size: 12943 byte(s)
set svn:eol-style to LF
1 #if !defined(RESIP_HEADERS_HXX)
2 #define RESIP_HEADERS_HXX
3
4 #include "resiprocate/ParserCategories.hxx"
5 #include "resiprocate/HeaderTypes.hxx"
6 #include "resiprocate/Symbols.hxx"
7 #include "resiprocate/os/Data.hxx"
8 #include "resiprocate/os/HeapInstanceCounter.hxx"
9
10 namespace resip
11 {
12 class SipMessage;
13
14 //#define PARTIAL_TEMPLATE_SPECIALIZATION
15 #ifdef PARTIAL_TEMPLATE_SPECIALIZATION
16 template<bool>
17 class TypeIf
18 {
19 public:
20 template <class T>
21 class Resolve
22 {
23 public:
24 typedef T Type;
25 };
26 };
27
28 class UnusedHeader
29 {
30 };
31
32 class TypeIf<false>
33 {
34 public:
35 template <class T>
36 class Resolve
37 {
38 public:
39 typedef UnusedHeader Type;
40 };
41 };
42
43 #define UnusedChecking(_enum) \
44 typedef TypeIf<Headers::_enum != Headers::UNKNOWN> TypeIfT; \
45 typedef TypeIfT::Resolve<Type> Resolver; \
46 typedef Resolver::Type UnknownReturn
47
48 #define MultiUnusedChecking(_enum) \
49 typedef TypeIf<Headers::_enum != Headers::UNKNOWN> TypeIfT; \
50 typedef TypeIfT::Resolve< ParserContainer<Type> > Resolver; \
51 typedef Resolver::Type UnknownReturn
52
53 #else
54
55 #define UnusedChecking(_enum) typedef int _dummy
56 #define MultiUnusedChecking(_enum) typedef int _dummy
57
58 #endif
59
60 class HeaderBase
61 {
62 public:
63 virtual Headers::Type getTypeNum() const = 0;
64 virtual void merge(SipMessage&, const SipMessage&)=0;
65 };
66
67 #define defineHeader(_enum, _name, _type, _rfc) \
68 class H_##_enum : public HeaderBase \
69 { \
70 public: \
71 RESIP_HeapCount(H_##_enum); \
72 enum {Single = true}; \
73 typedef _type Type; \
74 UnusedChecking(_enum); \
75 static Type& knownReturn(ParserContainerBase* container); \
76 virtual Headers::Type getTypeNum() const; \
77 virtual void merge(SipMessage&, const SipMessage&); \
78 H_##_enum(); \
79 }; \
80 extern H_##_enum h_##_enum
81
82 #define defineMultiHeader(_enum, _name, _type, _rfc) \
83 class H_##_enum##s : public HeaderBase \
84 { \
85 public: \
86 RESIP_HeapCount(H_##_enum##s); \
87 enum {Single = false}; \
88 typedef ParserContainer<_type> Type; \
89 MultiUnusedChecking(_enum); \
90 static Type& knownReturn(ParserContainerBase* container); \
91 virtual Headers::Type getTypeNum() const; \
92 virtual void merge(SipMessage&, const SipMessage&); \
93 H_##_enum##s(); \
94 }; \
95 extern H_##_enum##s h_##_enum##s
96
97 //====================
98 // Token:
99 //====================
100 typedef ParserContainer<Token> Tokens;
101
102 defineHeader(ContentDisposition, "Content-Disposition", Token, "RFC 3261");
103 defineHeader(ContentEncoding, "Content-Encoding", Token, "RFC 3261");
104 defineHeader(MIMEVersion, "Mime-Version", Token, "RFC 3261");
105 defineHeader(Priority, "Priority", Token, "RFC 3261");
106 defineHeader(Event, "Event", Token, "RFC 3265");
107 defineHeader(SubscriptionState, "Subscription-State", Token, "RFC 3265");
108
109 defineHeader(SIPETag, "SIP-ETag", Token, "RFC 3903");
110 defineHeader(SIPIfMatch, "SIP-If-Match", Token, "RFC 3903");
111 defineHeader(ContentId, "Content-ID", Token, "RFC 2045");
112
113 defineMultiHeader(AllowEvents, "Allow-Events", Token, "RFC 3265");
114
115 defineHeader(Identity, "Identity", StringCategory, "draft-sip-identity-03");
116 // explicitly declare to avoid h_AllowEventss, ugh
117 extern H_AllowEventss h_AllowEvents;
118
119 defineMultiHeader(AcceptEncoding, "Accept-Encoding", Token, "RFC 3261");
120 defineMultiHeader(AcceptLanguage, "Accept-Language", Token, "RFC 3261");
121 defineMultiHeader(Allow, "Allow", Token, "RFC 3261");
122 defineMultiHeader(ContentLanguage, "Content-Language", Token, "RFC 3261");
123 defineMultiHeader(ProxyRequire, "Proxy-Require", Token, "RFC 3261");
124 defineMultiHeader(Require, "Require", Token, "RFC 3261");
125 defineMultiHeader(Supported, "Supported", Token, "RFC 3261");
126 defineMultiHeader(Unsupported, "Unsupported", Token, "RFC 3261");
127 defineMultiHeader(SecurityClient, "Security-Client", Token, "RFC 3329");
128 defineMultiHeader(SecurityServer, "Security-Server", Token, "RFC 3329");
129 defineMultiHeader(SecurityVerify, "Security-Verify", Token, "RFC 3329");
130 // explicitly declare to avoid h_SecurityVerifys, ugh
131 extern H_SecurityVerifys h_SecurityVerifies;
132
133 defineMultiHeader(RequestDisposition, "Request-Disposition", Token, "RFC 3841");
134 defineMultiHeader(Reason, "Reason", Token, "RFC 3326");
135 defineMultiHeader(Privacy, "Privacy", Token, "RFC 3323");
136 // explicitly declare to avoid h_Privacys
137 extern H_Privacys h_Privacies;
138
139 defineMultiHeader(PMediaAuthorization, "P-Media-Authorization", Token, "RFC 3313");
140
141 //====================
142 // Mime
143 //====================
144 typedef ParserContainer<Mime> Mimes;
145
146 defineMultiHeader(Accept, "Accept", Mime, "RFC 3261");
147 defineHeader(ContentType, "Content-Type", Mime, "RFC 3261");
148
149 //====================
150 // GenericUris:
151 //====================
152 typedef ParserContainer<GenericUri> GenericUris;
153 defineMultiHeader(CallInfo, "Call-Info", GenericUri, "RFC 3261");
154 defineMultiHeader(AlertInfo, "Alert-Info", GenericUri, "RFC 3261");
155 defineMultiHeader(ErrorInfo, "Error-Info", GenericUri, "RFC 3261");
156 defineHeader(IdentityInfo, "Identity-Info", GenericUri, "draft-sip-identity-03");
157
158 //====================
159 // NameAddr:
160 //====================
161 typedef ParserContainer<NameAddr> NameAddrs;
162
163 defineMultiHeader(RecordRoute, "Record-Route", NameAddr, "RFC 3261");
164 defineMultiHeader(Route, "Route", NameAddr, "RFC 3261");
165 defineMultiHeader(Contact, "Contact", NameAddr, "RFC 3261");
166 defineHeader(From, "From", NameAddr, "RFC 3261");
167 defineHeader(To, "To", NameAddr, "RFC 3261");
168 defineHeader(ReplyTo, "Reply-To", NameAddr, "RFC 3261");
169 defineHeader(ReferTo, "Refer-To", NameAddr, "RFC 3515");
170 defineHeader(ReferredBy, "Referred-By", NameAddr, "RFC 3892");
171
172 defineMultiHeader(Path, "Path", NameAddr, "RFC 3327");
173 defineMultiHeader(AcceptContact, "Accept-Contact", NameAddr, "RFC 3841");
174 defineMultiHeader(RejectContact, "Reject-Contact", NameAddr, "RFC 3841");
175 defineMultiHeader(PPreferredIdentity, "P-Preferred-Identity", NameAddr, "RFC 3325");
176 // explicitly declare to avoid h_PAssertedIdentitys
177 extern H_PPreferredIdentitys h_PPreferredIdentities;
178
179 defineMultiHeader(PAssertedIdentity, "P-Asserted-Identity", NameAddr, "RFC 3325");
180 // explicitly declare to avoid h_PAssertedIdentitys
181 extern H_PAssertedIdentitys h_PAssertedIdentities;
182
183 defineHeader(PCalledPartyId, "P-Called-Party-ID", NameAddr, "RFC 3455");
184 defineMultiHeader(PAssociatedUri, "P-Associated-URI", NameAddr, "RFC 3455");
185 defineMultiHeader(ServiceRoute, "Service-Route", NameAddr, "RFC 3608");
186
187 //====================
188 // StringCategory:
189 //====================
190 typedef ParserContainer<StringCategory> StringCategories;
191
192 defineHeader(ContentTransferEncoding, "Content-Transfer-Encoding", StringCategory, "RFC ?");
193 defineHeader(Organization, "Organization", StringCategory, "RFC 3261");
194 defineHeader(Server, "Server", StringCategory, "RFC 3261");
195 defineHeader(Subject, "Subject", StringCategory, "RFC 3261");
196 defineHeader(UserAgent, "User-Agent", StringCategory, "RFC 3261");
197 defineHeader(Timestamp, "Timestamp", StringCategory, "RFC 3261");
198
199 //====================
200 // IntegerCategory:
201 //====================
202 typedef ParserContainer<IntegerCategory> IntegerCategories;
203
204 // !dlb! not clear this needs to be exposed
205 defineHeader(ContentLength, "Content-Length", IntegerCategory, "RFC 3261");
206 defineHeader(MaxForwards, "Max-Forwards", IntegerCategory, "RFC 3261");
207 defineHeader(MinExpires, "Min-Expires", IntegerCategory, "RFC 3261");
208 defineHeader(RSeq, "RSeq", IntegerCategory, "RFC 3261");
209
210 // !dlb! this one is not quite right -- can have (comment) after field value
211 defineHeader(RetryAfter, "Retry-After", IntegerCategory, "RFC 3261");
212 defineHeader(Expires, "Expires", ExpiresCategory, "RFC 3261");
213 defineHeader(SessionExpires, "Session-Expires", ExpiresCategory, "Session Timer draft");
214 defineHeader(MinSE, "Min-SE", ExpiresCategory, "Session Timer draft");
215
216 //====================
217 // CallId:
218 //====================
219 defineHeader(CallID, "Call-ID", CallID, "RFC 3261");
220 defineHeader(Replaces, "Replaces", CallID, "RFC 3261");
221 defineHeader(InReplyTo, "In-Reply-To", CallID, "RFC 3261");
222
223 typedef H_CallID H_CallId; // code convention compatible
224 extern H_CallId h_CallId; // code convention compatible
225
226 defineHeader(Join, "Join", CallId, "RFC 3911");
227 defineHeader(TargetDialog, "Target-Dialog", CallId, "Target Dialog draft");
228
229
230 //====================
231 // Auth:
232 //====================
233 typedef ParserContainer<Auth> Auths;
234 defineHeader(AuthenticationInfo, "Authentication-Info", Auth, "RFC 3261");
235 defineMultiHeader(Authorization, "Authorization", Auth, "RFC 3261");
236 defineMultiHeader(ProxyAuthenticate, "Proxy-Authenticate", Auth, "RFC 3261");
237 defineMultiHeader(ProxyAuthorization, "Proxy-Authorization", Auth, "RFC 3261");
238 defineMultiHeader(WWWAuthenticate, "Www-Authenticate", Auth, "RFC 3261");
239
240 //====================
241 // CSeqCategory:
242 //====================
243 defineHeader(CSeq, "CSeq", CSeqCategory, "RFC 3261");
244
245 //====================
246 // DateCategory:
247 //====================
248 defineHeader(Date, "Date", DateCategory, "RFC 3261");
249
250 //====================
251 // WarningCategory:
252 //====================
253 defineMultiHeader(Warning, "Warning", WarningCategory, "RFC 3261");
254
255 //====================
256 // Via
257 //====================
258 typedef ParserContainer<Via> Vias;
259 defineMultiHeader(Via, "Via", Via, "RFC 3261");
260
261 //====================
262 // RAckCategory
263 //====================
264 defineHeader(RAck, "RAck", RAckCategory, "RFC 3262");
265
266 //====================
267 // special first line accessors
268 //====================
269 class RequestLineType {};
270 extern RequestLineType h_RequestLine;
271
272 class StatusLineType {};
273 extern StatusLineType h_StatusLine;
274
275 }
276
277 #undef defineHeader
278 #undef defineMultiHeader
279
280 #endif
281
282 /* ====================================================================
283 * The Vovida Software License, Version 1.0
284 *
285 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
286 *
287 * Redistribution and use in source and binary forms, with or without
288 * modification, are permitted provided that the following conditions
289 * are met:
290 *
291 * 1. Redistributions of source code must retain the above copyright
292 * notice, this list of conditions and the following disclaimer.
293 *
294 * 2. Redistributions in binary form must reproduce the above copyright
295 * notice, this list of conditions and the following disclaimer in
296 * the documentation and/or other materials provided with the
297 * distribution.
298 *
299 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
300 * and "Vovida Open Communication Application Library (VOCAL)" must
301 * not be used to endorse or promote products derived from this
302 * software without prior written permission. For written
303 * permission, please contact vocal@vovida.org.
304 *
305 * 4. Products derived from this software may not be called "VOCAL", nor
306 * may "VOCAL" appear in their name, without prior written
307 * permission of Vovida Networks, Inc.
308 *
309 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
310 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
311 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
312 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
313 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
314 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
315 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
316 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
317 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
318 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
319 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
320 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
321 * DAMAGE.
322 *
323 * ====================================================================
324 *
325 * This software consists of voluntary contributions made by Vovida
326 * Networks, Inc. and many individuals on behalf of Vovida Networks,
327 * Inc. For more information on Vovida Networks, Inc., please see
328 * <http://www.vovida.org/>.
329 *
330 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27