]> err.no Git - sope/blob - sope-appserver/NGObjWeb/NGHttp/NGHttpHeaderFields.h
fixed makefiles to search FHS locations at the last resort
[sope] / sope-appserver / NGObjWeb / NGHttp / NGHttpHeaderFields.h
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGHttp_NGHttpHeaderFields_H__
24 #define __NGHttp_NGHttpHeaderFields_H__
25
26 #import <Foundation/NSObject.h>
27
28 @class NSString, NSHost, NSDate, NSDictionary;
29 @class NGInternetSocketAddress;
30
31 /*
32   Value field that occures in the HTTP 'Host' header field.
33   Looks like this: 'Host: trex@skyrix.com:80'
34 */
35 @interface NGHttpHostHeaderField : NSObject
36 {
37 @protected
38   NSString *hostName;
39   int      port;
40 }
41
42 - (id)initWithString:(NSString *)_value;
43
44 // accessors
45
46 - (NSString *)hostName;
47 - (int)port;
48
49 // advanced conversions
50
51 - (NGInternetSocketAddress *)socketAddress;
52 - (NSHost *)host;
53
54 // description
55
56 - (NSString *)stringValue;
57
58 @end
59
60 /*
61   Value field that occures in the HTTP 'accept-charset' header field.
62   Looks like this: 'accept-charset: iso-8859-1,*,utf-8'
63 */
64 @interface NGHttpCharsetHeaderField : NSObject
65 {
66   NSArray *charsets;
67   BOOL    containsWildcard;
68 }
69
70 - (id)initWithArray:(NSArray *)_charsetArray;
71 - (id)initWithString:(NSString *)_value;
72
73 // accessors
74
75 - (NSEnumerator *)charsets;
76 - (BOOL)containsCharset:(NSString *)_setName;
77
78 @end
79
80 /*
81   Value field that occures in the HTTP 'accept' header field.
82   Looks like this: 'accept: image/gif, image/x-xbitmap, image/jpeg, wildcard'
83 */
84 @interface NGHttpTypeSetHeaderField : NSObject
85 {
86   NSArray *types;
87 }
88
89 - (id)initWithArray:(NSArray *)_typeArray;
90
91 // accessors
92
93 - (NSEnumerator *)types;
94 - (BOOL)containsMimeType:(NGMimeType *)_type;
95
96 @end
97
98 /*
99   Value field that occures in the HTTP 'accept-language' header field.
100 */
101 @interface NGHttpLanguageSetHeaderField : NSObject
102 {
103   NSArray *languages;
104 }
105
106 - (id)initWithArray:(NSArray *)_langArray;
107
108 // accessors
109
110 - (NSEnumerator *)languages;
111 - (BOOL)containsLanguage:(NSString *)_language;
112
113 @end
114
115 /*
116   Value field that occures in the HTTP 'user-agent' header field.
117   Looks like this: 'user-agent: Mozilla/4.5b2 [en] '
118 */
119 @interface NGHttpUserAgent : NSObject
120 {
121 @protected
122   NSString *value;
123   NSString *browser;
124   char     majorVersion;
125   char     minorVersion;
126 }
127
128 - (id)initWithString:(NSString *)_value;
129
130 // browsers
131
132 - (BOOL)isMozilla;
133 - (BOOL)isInternetExplorer;
134 - (int)majorVersion;
135 - (int)minorVersion;
136
137 @end
138
139 /*
140   Value field that occures in the HTTP 'connection' header field.
141   Looks like this: 'connection: Keep-Alive'
142 */
143 @interface NGHttpConnectionHeaderField : NSObject
144 {
145 @protected
146   BOOL close;
147   BOOL keepAlive;
148   BOOL isTE;
149 }
150
151 - (id)initWithString:(NSString *)_value;
152
153 // accessors
154
155 - (BOOL)keepAlive;
156
157 @end
158
159 /*
160   Value field that occures in the HTTP 'authorization' header field.
161   Looks like this: 'authorization: Basic aGVsZ2U6ZG9vZg=='
162   (class cluster)
163 */
164 @interface NGHttpCredentials : NSObject
165 {
166   NSString *scheme;
167   NSData   *credentials;
168 }
169
170 + (id)credentialsWithString:(NSString *)_cred;
171 + (id)credentialsWithScheme:(NSString *)_scheme
172   credentials:(NSData *)_credentials;
173
174 // accessors
175
176 - (NSString *)scheme;
177 - (NSData *)credentials;
178
179 - (NSString *)userName;
180 - (NSString *)password;
181
182 // description
183
184 - (NSString *)stringValue;
185
186 @end
187
188 /*
189   Value field that occures in the HTTP 'www-authenticate' header field.
190   Looks like this: 'www-authorization: Basic realm="SKYRIX"'
191 */
192 @interface NGHttpChallenge : NSObject
193 {
194   NSString     *scheme;
195   NSDictionary *parameters;
196 }
197
198 + (id)basicChallengeWithRealm:(NSString *)_realm;
199 - (id)initWithScheme:(NSString *)_scheme realm:(NSString *)_realm;
200
201 // accessors
202
203 - (NSString *)scheme;
204
205 - (void)setRealm:(NSString *)_realm;
206 - (NSString *)realm;
207
208 // description
209
210 - (NSString *)stringValue;
211
212 @end
213
214 #endif /* __NGHttp_NGHttpHeaderFields_H__ */