~ubuntu-branches/ubuntu/saucy/sope/saucy

« back to all changes in this revision

Viewing changes to sope-appserver/NGObjWeb/NGHttp/NGHttpResponse.h

  • Committer: Package Import Robot
  • Author(s): Jeroen Dekkers
  • Date: 2012-05-09 15:39:17 UTC
  • Revision ID: package-import@ubuntu.com-20120509153917-nr4jlm8mktma1yv3
Tags: upstream-1.3.14
ImportĀ upstreamĀ versionĀ 1.3.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_NGHttpResponse_H__
 
23
#define __NGHttp_NGHttpResponse_H__
 
24
 
 
25
#import "NGHttpMessage.h"
 
26
 
 
27
@class NSString;
 
28
@class NGHttpRequest, NGHttpChallenge;
 
29
 
 
30
typedef enum {
 
31
  NGHttpStatusCode_unknown = 0,
 
32
 
 
33
  // 1xx informational
 
34
  NGHttpStatusCode_Continue                    = 100,
 
35
  NGHttpStatusCode_SwitchingProtocols          = 101,
 
36
 
 
37
  // 2xx successful
 
38
  NGHttpStatusCode_OK                          = 200,
 
39
  NGHttpStatusCode_Created                     = 201,
 
40
  NGHttpStatusCode_Accepted                    = 202,
 
41
  NGHttpStatusCode_NonAuthoritativeInformation = 203,
 
42
  NGHttpStatusCode_NoContent                   = 204,
 
43
  NGHttpStatusCode_ResetContent                = 205,
 
44
  NGHttpStatusCode_PartialContent              = 206,
 
45
 
 
46
  // 3xx redirection
 
47
  NGHttpStatusCode_MultipleChoices             = 300,
 
48
  NGHttpStatusCode_MovedPermanently            = 301,
 
49
  NGHttpStatusCode_MovedTemporarily            = 302,
 
50
  NGHttpStatusCode_SeeOther                    = 303,
 
51
  NGHttpStatusCode_NotModified                 = 304,
 
52
  NGHttpStatusCode_UseProxy                    = 305,
 
53
 
 
54
  // 4xx client error
 
55
  NGHttpStatusCode_BadRequest                  = 400,
 
56
  NGHttpStatusCode_Unauthorized                = 401,
 
57
  NGHttpStatusCode_PaymentRequired             = 402,
 
58
  NGHttpStatusCode_Forbidden                   = 403,
 
59
  NGHttpStatusCode_NotFound                    = 404,
 
60
  NGHttpStatusCode_MethodNotAllowed            = 405,
 
61
  NGHttpStatusCode_NoneAcceptable              = 406,
 
62
  NGHttpStatusCode_ProxyAuthenticationRequired = 407,
 
63
  NGHttpStatusCode_RequestTimeout              = 408,
 
64
  NGHttpStatusCode_Conflict                    = 409,
 
65
  NGHttpStatusCode_Gone                        = 410,
 
66
  NGHttpStatusCode_LengthRequired              = 411,
 
67
  NGHttpStatusCode_UnlessTrue                  = 412,
 
68
 
 
69
  // 5xx server error
 
70
  NGHttpStatusCode_InternalServerError         = 500,
 
71
  NGHttpStatusCode_NotImplemented              = 501,
 
72
  NGHttpStatusCode_BadGateway                  = 502,
 
73
  NGHttpStatusCode_ServiceUnavailable          = 503,
 
74
  NGHttpStatusCode_GatewayTimeout              = 504,
 
75
 
 
76
  NGHttpStatusCode_last
 
77
} NGHttpStatusCode;
 
78
 
 
79
@interface NGHttpResponse : NGHttpMessage
 
80
{
 
81
  NGHttpStatusCode statusCode;
 
82
  NSString         *reason;
 
83
 
 
84
  NGHttpRequest *request;
 
85
}
 
86
 
 
87
- (id)initWithRequest:(NGHttpRequest *)_request;
 
88
 
 
89
- (id)initWithStatus:(int)_status reason:(NSString *)_reason
 
90
  header:(NGHashMap *)_header version:(NSString *)_version;
 
91
 
 
92
// accessors
 
93
 
 
94
- (void)setStatusCode:(NGHttpStatusCode)_code;
 
95
- (NGHttpStatusCode)statusCode;
 
96
 
 
97
- (void)setReason:(NSString *)_text;
 
98
- (NSString *)reason;
 
99
 
 
100
- (void)setRequest:(NGHttpRequest *)_request;
 
101
- (NGHttpRequest *)request;
 
102
 
 
103
@end
 
104
 
 
105
@interface NGHttpResponse(CommonHeaders)
 
106
 
 
107
- (void)setWWWAuthenticate:(NGHttpChallenge *)_challenge;
 
108
- (NGHttpChallenge *)wwwAuthenticate;
 
109
 
 
110
@end
 
111
 
 
112
static inline BOOL NGIsInformationalHttpStatusCode(NGHttpStatusCode _code) {
 
113
  return ((_code >= 100) && (_code < 200)) ? YES : NO;
 
114
}
 
115
static inline BOOL NGIsSuccessfulHttpStatusCode(NGHttpStatusCode _code) {
 
116
  return ((_code >= 200) && (_code < 300)) ? YES : NO;
 
117
}
 
118
static inline BOOL NGIsRedirectionHttpStatusCode(NGHttpStatusCode _code) {
 
119
  return ((_code >= 300) && (_code < 400)) ? YES : NO;
 
120
}
 
121
static inline BOOL NGIsClientErrorHttpStatusCode(NGHttpStatusCode _code) {
 
122
  return ((_code >= 400) && (_code < 500)) ? YES : NO;
 
123
}
 
124
static inline BOOL NGIsServerErrorHttpStatusCode(NGHttpStatusCode _code) {
 
125
  return ((_code >= 500) && (_code < 600)) ? YES : NO;
 
126
}
 
127
 
 
128
#endif /* __NGHttp_NGHttpResponse_H__ */