~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to resip/stack/HeaderTypes.hxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined(RESIP_HEADERTYPES_HXX)
 
2
#define RESIP_HEADERTYPES_HXX 
 
3
 
 
4
#include "rutil/Data.hxx"
 
5
 
 
6
//****************************************************************************
 
7
//
 
8
// !dlb! until automated, must ensure that this set is consistent with
 
9
//
 
10
// ************ PLEASE RUN testParserCategories AFTER CHANGING ***************
 
11
//
 
12
// HeaderTypes.hxx
 
13
// Headers.hxx
 
14
// HeaderHash.gperf
 
15
// Headers.cxx
 
16
// SipMessage.hxx
 
17
// SipMessage.cxx
 
18
//
 
19
//****************************************************************************
 
20
 
 
21
// eventually use these macros to automate Headers.hxx, Headers.cxx+gperf
 
22
#define UNUSED_defineHeader(_enum, _name, _type, _rfc) SAVE##_enum, _enum = UNKNOWN, RESET##enum = SAVE##_enum-1
 
23
#define UNUSED_defineMultiHeader(_enum, _name, _type, _rfc) SAVE##_enum, _enum = UNKNOWN, RESET##enum = SAVE##_enum-1
 
24
#define defineHeader(_enum, _name, _type, _rfc) _enum
 
25
#define defineMultiHeader(_enum, _name, _type, _rfc) _enum
 
26
 
 
27
namespace resip
 
28
{
 
29
 
 
30
/**
 
31
   Maps from header name to derived ParserCategory. Determines whether the
 
32
   header is single or multiple valued.
 
33
 
 
34
   The Type enum controls the order of output of the headers in the encoded
 
35
   SipMessage.  Put headers that you want to appear early in the message early
 
36
   in this list.
 
37
*/
 
38
class Headers
 
39
{
 
40
   public:
 
41
      enum Type
 
42
      {
 
43
         UNKNOWN = -1,
 
44
         defineMultiHeader(Via, "Via", Via, "RFC 3261"), // rjs says must be first
 
45
         defineHeader(MaxForwards, "Max-Forwards", UInt32Category, "RFC 3261"),
 
46
         defineMultiHeader(Route, "Route", NameAddr, "RFC 3261"),
 
47
         defineMultiHeader(RecordRoute, "Record-Route", NameAddr, "RFC 3261"),
 
48
         defineMultiHeader(Path, "Path", NameAddr, "RFC 3327"),
 
49
         defineMultiHeader(ServiceRoute, "Service-Route", NameAddr, "RFC 3608"),
 
50
         defineMultiHeader(ProxyRequire, "Proxy-Require", Token, "RFC 3261"),
 
51
         defineMultiHeader(ProxyAuthenticate, "Proxy-Authenticate", Auth, "RFC 3261"),
 
52
         defineHeader(Identity, "Identity", StringCategory, "RFC 4474"),
 
53
         defineHeader(IdentityInfo, "Identity-Info", GenericUri, "RFC 4474"),
 
54
         defineMultiHeader(Require, "Require", Token, "RFC 3261"),
 
55
         defineMultiHeader(Contact, "Contact", NameAddr, "RFC 3261"),
 
56
 
 
57
         defineHeader(To, "To", NameAddr, "RFC 3261"), 
 
58
         defineHeader(From, "From", NameAddr, "RFC 3261"),
 
59
         defineHeader(CallID, "Call-ID", CallId, "RFC 3261"),
 
60
         defineHeader(CSeq, "CSeq", CSeqCategory, "RFC 3261"),
 
61
         defineHeader(Subject, "Subject", StringCategory, "RFC 3261"),
 
62
         defineHeader(Expires, "Expires", ExpiresCategory, "RFC 3261"),
 
63
         defineHeader(SessionExpires, "Session-Expires", ExpiresCategory, "RFC 4028"),
 
64
         defineHeader(MinSE, "Min-SE", ExpiresCategory, "RFC 4028"),
 
65
         defineMultiHeader(Accept, "Accept", Mime, "RFC 3261"),
 
66
         defineMultiHeader(AcceptEncoding, "Accept-Encoding", Token, "RFC 3261"),
 
67
         defineMultiHeader(AcceptLanguage, "Accept-Language", Token, "RFC 3261"),
 
68
         defineMultiHeader(AlertInfo, "Alert-Info", GenericUri, "RFC 3261"),
 
69
         defineMultiHeader(Allow, "Allow", Token, "RFC 3261"),
 
70
         defineHeader(AuthenticationInfo, "Authentication-Info", Auth, "RFC 3261"),
 
71
         defineMultiHeader(CallInfo, "Call-Info", GenericUri, "RFC 3261"),
 
72
         defineHeader(ContentDisposition, "Content-Disposition", Token, "RFC ?"),
 
73
         defineHeader(ContentEncoding, "Content-Encoding", Token, "RFC ?"),
 
74
         defineHeader(ContentId, "Content-ID", Token, "RFC 2045"),
 
75
         defineMultiHeader(ContentLanguage, "Content-Language", Token, "RFC ?"),
 
76
// i really think that Content-Transfer-Encoding should be a Token   !rwm
 
77
         defineHeader(ContentTransferEncoding, "Content-Transfer-Encoding", StringCategory, "RFC ?"), // !dlb! defineMultiHeader
 
78
         defineHeader(ContentType, "Content-Type", Mime, "RFC 3261"),
 
79
         defineHeader(Date, "Date", DateCategory, "RFC 3261"),
 
80
         defineMultiHeader(ErrorInfo, "Error-Info", GenericUri, "RFC 3261"),
 
81
         defineHeader(InReplyTo, "In-Reply-To", CallId, "RFC 3261"),
 
82
         defineHeader(MinExpires, "Min-Expires", UInt32Category, "RFC 3261"),
 
83
         defineHeader(MIMEVersion, "MIME-Version", Token, "RFC 3261"),
 
84
         defineHeader(Organization, "Organization", StringCategory, "RFC 3261"),
 
85
         defineHeader(Priority, "Priority", Token, "RFC 3261"),
 
86
         defineMultiHeader(ProxyAuthorization, "Proxy-Authorization", Auth, "RFC 3261"),
 
87
         defineHeader(ReplyTo, "Reply-To", NameAddr, "RFC 3261"),
 
88
         defineHeader(RetryAfter, "Retry-After", UInt32Category, "RFC 3261"),
 
89
         defineHeader(FlowTimer, "Flow-Timer", UInt32Category, "RFC 5626"),
 
90
         defineHeader(Server, "Server", StringCategory, "RFC 3261"),
 
91
         defineHeader(SIPETag, "SIP-ETag", Token, "RFC 3903"),
 
92
         defineHeader(SIPIfMatch, "SIP-If-Match", Token, "RFC 3903"),
 
93
         defineMultiHeader(Supported, "Supported", Token, "RFC 3261"),
 
94
         defineHeader(Timestamp, "Timestamp", StringCategory, "RFC 3261"),
 
95
         defineMultiHeader(Unsupported, "Unsupported", Token, "RFC 3261"),
 
96
         defineHeader(UserAgent, "User-Agent", StringCategory, "RFC 3261"),
 
97
         defineMultiHeader(Warning, "Warning", WarningCategory, "RFC 3261"),
 
98
         defineMultiHeader(WWWAuthenticate, "WWW-Authenticate", Auth, "RFC 3261"),
 
99
         defineHeader(SubscriptionState, "Subscription-State", Token, "RFC 3265"),
 
100
         defineHeader(ReferTo, "Refer-To", NameAddr, "RFC 3515"),
 
101
         defineHeader(ReferredBy, "Referred-By", NameAddr, "RFC 3892"),
 
102
         defineMultiHeader(Authorization, "Authorization", Auth, "RFC 3261"),
 
103
         defineHeader(Replaces, "Replaces", CallId, "RFC 3891"),
 
104
         defineHeader(Event, "Event", Token, "RFC 3265"),
 
105
         defineMultiHeader(AllowEvents, "Allow-Events", Token, "RFC 3265"),
 
106
         defineMultiHeader(SecurityClient, "Security-Client", Token, "RFC 3329"),
 
107
         defineMultiHeader(SecurityServer, "Security-Server", Token, "RFC 3329"),
 
108
         defineMultiHeader(SecurityVerify, "Security-Verify", Token, "RFC 3329"),
 
109
         defineHeader(RSeq, "RSeq", UInt32Category, "RFC 3262"),
 
110
         defineHeader(RAck, "RAck", RAckCategory, "RFC 3262"),
 
111
 
 
112
         defineMultiHeader(Reason, "Reason", Token, "RFC 3326"),
 
113
         defineMultiHeader(Privacy, "Privacy", PrivacyCategory, "RFC 3323"),
 
114
         defineMultiHeader(RequestDisposition, "Request-Disposition", Token, "RFC 3841"),
 
115
         defineMultiHeader(PMediaAuthorization, "P-Media-Authorization", Token, "RFC 3313"),
 
116
         defineHeader(Join, "Join", CallId, "RFC 3911"),
 
117
         defineHeader(TargetDialog, "Target-Dialog", CallId, "RFC 4538"),
 
118
         defineMultiHeader(PAssertedIdentity, "P-Asserted-Identity", NameAddr, "RFC 3325"),
 
119
         defineMultiHeader(PPreferredIdentity, "P-Preferred-Identity", NameAddr, "RFC 3325"),
 
120
         defineMultiHeader(AcceptContact, "Accept-Contact", NameAddr, "RFC 3841"),
 
121
         defineMultiHeader(RejectContact, "Reject-Contact", NameAddr, "RFC 3841"),
 
122
         defineHeader(PCalledPartyId, "P-Called-Party-ID", NameAddr, "RFC 3455"),
 
123
         defineMultiHeader(PAssociatedUri, "P-Associated-URI", NameAddr, "RFC 3455"),
 
124
 
 
125
         defineHeader(ContentLength, "Content-Length", UInt32Category, "RFC 3261"),
 
126
         defineHeader(ReferSub, "Refer-Sub", Token, "RFC 4488"),
 
127
         defineHeader(AnswerMode, "Answer-Mode", Token, "RFC 5373"),
 
128
         defineHeader(PrivAnswerMode, "Priv-Answer-Mode", Token, "RFC 5373"),
 
129
         defineMultiHeader(RemotePartyId, "Remote-Party-ID", NameAddr, "draft-ietf-sip-privacy-04"), // ?bwc? Not in 3323, should we keep?
 
130
         defineMultiHeader(HistoryInfo, "History-Info", NameAddr, "RFC 4244"),
 
131
 
 
132
         defineMultiHeader(RESIP_DO_NOT_USE, "ShouldNotSeeThis", StringCategory, "N/A"),
 
133
         MAX_HEADERS,
 
134
         NONE
 
135
      };
 
136
 
 
137
      // get enum from header name
 
138
      static Type getType(const char* name, int len);
 
139
      static bool isCommaTokenizing(Type type);
 
140
      static bool isCommaEncoding(Type type);
 
141
      static const Data& getHeaderName(int);
 
142
      static bool isMulti(Type type);
 
143
 
 
144
      // treat as private
 
145
      static bool CommaTokenizing[MAX_HEADERS+1];
 
146
      static bool CommaEncoding[MAX_HEADERS+1];
 
147
      static Data HeaderNames[MAX_HEADERS+1];
 
148
      static bool Multi[MAX_HEADERS+1];
 
149
};
 
150
 
 
151
}
 
152
 
 
153
#undef UNUSED_defineHeader
 
154
#undef UNUSED_defineMultiHeader
 
155
#undef defineHeader
 
156
#undef defineMultiHeader
 
157
 
 
158
#endif
 
159
 
 
160
/* ====================================================================
 
161
 * The Vovida Software License, Version 1.0 
 
162
 * 
 
163
 * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
 
164
 * 
 
165
 * Redistribution and use in source and binary forms, with or without
 
166
 * modification, are permitted provided that the following conditions
 
167
 * are met:
 
168
 * 
 
169
 * 1. Redistributions of source code must retain the above copyright
 
170
 *    notice, this list of conditions and the following disclaimer.
 
171
 * 
 
172
 * 2. Redistributions in binary form must reproduce the above copyright
 
173
 *    notice, this list of conditions and the following disclaimer in
 
174
 *    the documentation and/or other materials provided with the
 
175
 *    distribution.
 
176
 * 
 
177
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
 
178
 *    and "Vovida Open Communication Application Library (VOCAL)" must
 
179
 *    not be used to endorse or promote products derived from this
 
180
 *    software without prior written permission. For written
 
181
 *    permission, please contact vocal@vovida.org.
 
182
 *
 
183
 * 4. Products derived from this software may not be called "VOCAL", nor
 
184
 *    may "VOCAL" appear in their name, without prior written
 
185
 *    permission of Vovida Networks, Inc.
 
186
 * 
 
187
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
 
188
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
189
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
 
190
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
 
191
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
 
192
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
 
193
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
194
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 
195
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 
196
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
197
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 
198
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 
199
 * DAMAGE.
 
200
 * 
 
201
 * ====================================================================
 
202
 * 
 
203
 * This software consists of voluntary contributions made by Vovida
 
204
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
 
205
 * Inc.  For more information on Vovida Networks, Inc., please see
 
206
 * <http://www.vovida.org/>.
 
207
 *
 
208
 */