1 /* 2 Copyright (C) 2000-2005 SKYRIX Software AG 3 4 This file is part of SOPE. 5 6 SOPE 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 SOPE 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 SOPE; 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 22 #ifndef __NGHttp_NGHttpHeaderFields_H__ 23 #define __NGHttp_NGHttpHeaderFields_H__ 24 25 #import <Foundation/NSObject.h> 26 27 @class NSString, NSHost, NSDate, NSDictionary; 28 @class NGInternetSocketAddress; 29 30 /* 31 Value field that occures in the HTTP 'Host' header field. 32 Looks like this: 'Host: trex@skyrix.com:80' 33 */ 34 @interface NGHttpHostHeaderField : NSObject 35 { 36 @protected 37 NSString *hostName; 38 int port; 39 } 40 41 - (id)initWithString:(NSString *)_value; 42 43 // accessors 44 45 - (NSString *)hostName; 46 - (int)port; 47 48 // advanced conversions 49 50 - (NGInternetSocketAddress *)socketAddress; 51 - (NSHost *)host; 52 53 // description 54 55 - (NSString *)stringValue; 56 57 @end 58 59 /* 60 Value field that occures in the HTTP 'accept-charset' header field. 61 Looks like this: 'accept-charset: iso-8859-1,*,utf-8' 62 */ 63 @interface NGHttpCharsetHeaderField : NSObject 64 { 65 NSArray *charsets; 66 BOOL containsWildcard; 67 } 68 69 - (id)initWithArray:(NSArray *)_charsetArray; 70 - (id)initWithString:(NSString *)_value; 71 72 // accessors 73 74 - (NSEnumerator *)charsets; 75 - (BOOL)containsCharset:(NSString *)_setName; 76 77 @end 78 79 /* 80 Value field that occures in the HTTP 'accept' header field. 81 Looks like this: 'accept: image/gif, image/x-xbitmap, image/jpeg, wildcard' 82 */ 83 @interface NGHttpTypeSetHeaderField : NSObject 84 { 85 NSArray *types; 86 } 87 88 - (id)initWithArray:(NSArray *)_typeArray; 89 90 // accessors 91 92 - (NSEnumerator *)types; 93 - (BOOL)containsMimeType:(NGMimeType *)_type; 94 95 @end 96 97 /* 98 Value field that occures in the HTTP 'accept-language' header field. 99 */ 100 @interface NGHttpLanguageSetHeaderField : NSObject 101 { 102 NSArray *languages; 103 } 104 105 - (id)initWithArray:(NSArray *)_langArray; 106 107 // accessors 108 109 - (NSEnumerator *)languages; 110 - (BOOL)containsLanguage:(NSString *)_language; 111 112 @end 113 114 /* 115 Value field that occures in the HTTP 'user-agent' header field. 116 Looks like this: 'user-agent: Mozilla/4.5b2 [en] ' 117 */ 118 @interface NGHttpUserAgent : NSObject 119 { 120 @protected 121 NSString *value; 122 NSString *browser; 123 char majorVersion; 124 char minorVersion; 125 } 126 127 - (id)initWithString:(NSString *)_value; 128 129 // browsers 130 131 - (BOOL)isMozilla; 132 - (BOOL)isInternetExplorer; 133 - (int)majorVersion; 134 - (int)minorVersion; 135 136 @end 137 138 /* 139 Value field that occures in the HTTP 'connection' header field. 140 Looks like this: 'connection: Keep-Alive' 141 */ 142 @interface NGHttpConnectionHeaderField : NSObject 143 { 144 @protected 145 BOOL close; 146 BOOL keepAlive; 147 BOOL isTE; 148 } 149 150 - (id)initWithString:(NSString *)_value; 151 152 // accessors 153 154 - (BOOL)keepAlive; 155 156 @end 157 158 /* 159 Value field that occures in the HTTP 'authorization' header field. 160 Looks like this: 'authorization: Basic aGVsZ2U6ZG9vZg==' 161 (class cluster) 162 */ 163 @interface NGHttpCredentials : NSObject 164 { 165 NSString *scheme; 166 NSData *credentials; 167 } 168 169 + (id)credentialsWithString:(NSString *)_cred; 170 + (id)credentialsWithScheme:(NSString *)_scheme 171 credentials:(NSData *)_credentials; 172 173 // accessors 174 175 - (NSString *)scheme; 176 - (NSData *)credentials; 177 178 - (NSString *)userName; 179 - (NSString *)password; 180 181 // description 182 183 - (NSString *)stringValue; 184 185 @end 186 187 /* 188 Value field that occures in the HTTP 'www-authenticate' header field. 189 Looks like this: 'www-authorization: Basic realm="SKYRIX"' 190 */ 191 @interface NGHttpChallenge : NSObject 192 { 193 NSString *scheme; 194 NSDictionary *parameters; 195 } 196 197 + (id)basicChallengeWithRealm:(NSString *)_realm; 198 - (id)initWithScheme:(NSString *)_scheme realm:(NSString *)_realm; 199 200 // accessors 201 202 - (NSString *)scheme; 203 204 - (void)setRealm:(NSString *)_realm; 205 - (NSString *)realm; 206 207 // description 208 209 - (NSString *)stringValue; 210 211 @end 212 213 #endif /* __NGHttp_NGHttpHeaderFields_H__ */ 214