1 carolann.graves 1.1 //%2006////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 carolann.graves 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_HTTPExportResponseDecoder_h
35 #define Pegasus_HTTPExportResponseDecoder_h
36
37 #include <Pegasus/Common/Config.h>
38 #include <Pegasus/Common/Message.h>
39 #include <Pegasus/Common/Exception.h>
40 #include <Pegasus/Common/HTTPMessage.h>
41 #include <Pegasus/Common/String.h>
42 #include <Pegasus/Common/XmlParser.h>
43 carolann.graves 1.1 #include <Pegasus/Common/CIMMessage.h>
44 #include <Pegasus/ExportClient/Linkage.h>
45
46 PEGASUS_NAMESPACE_BEGIN
47
48 /**
49 The ClientExceptionMessage class represents an exception encapsulated in a
50 response message. A ClientExceptionMessage is generated by the HTTP Export
51 Response Decoder when an error is detected in the export response.
52 */
53 class ClientExceptionMessage : public Message
54 {
55 public:
56 /**
57 Constructs a ClientExceptionMessage.
58
59 @param clientException_ INPUT Exception* exception to be
60 encapsulated in the message
61 */
62 ClientExceptionMessage(Exception* clientException_)
63 :
64 carolann.graves 1.1 Message(CLIENT_EXCEPTION_MESSAGE),
65 clientException(clientException_)
66 {
67 }
68
69 Exception* clientException;
70 };
71
72 /**
73 The HTTPExportResponseDecoder class provides interfaces to parse and
74 validate HTTP headers, and decode an export response message.
75 */
|
77 carolann.graves 1.1 {
78 public:
79
80 /**
81 Parses the headers and status line of the HTTP message.
82
83 This method is called by the CIMExportResponseDecoder before calling
84 the client authenticator to check the response header for an
85 authentication challenge.
86
87 @param httpMessage INPUT HTTPMessage* message to be processed
88 @param exceptionMessage OUTPUT ClientExceptionMessage* response
89 containing exception when error is
90 detected in export response message
91 @param headers OUTPUT Array<HTTPHeader> containing headers
92 @param contentLength OUTPUT Uint32 length of message content
93 @param statusCode OUTPUT Uint32 status code from status line
94 @param reasonPhrase OUTPUT String reasonPhrase from status line
95 @param cimReconnect OUTPUT Boolean indicating whether close and
96 reconnect are necessary
97 @param valid OUTPUT Boolean indicating whether any errors
98 carolann.graves 1.1 were encountered
99 */
100 static void parseHTTPHeaders(
101 HTTPMessage* httpMessage,
102 ClientExceptionMessage*& exceptionMessage,
103 Array<HTTPHeader>& headers,
104 Uint32& contentLength,
105 Uint32& statusCode,
106 String& reasonPhrase,
107 Boolean& cimReconnect,
108 Boolean& valid);
109
110 /**
111 Validates the HTTP headers of the HTTP message.
112
113 This method is called by the CIMExportResponseDecoder after calling
114 the client authenticator to check the response header for an
115 authentication challenge.
116
117 @param httpMessage INPUT HTTPMessage* message to be processed
118 @param headers INPUT Array<HTTPHeader> containing headers
119 carolann.graves 1.1 @param contentLength INPUT Uint32 length of message content
120 @param statusCode INPUT Uint32 status code from status line
121 @param cimReconnect INPUT Boolean indicating whether close and
122 reconnect are necessary
123 @param reasonPhrase INPUT String reasonPhrase from status line
124 @param content OUTPUT char* containing message content
125 @param exceptionMessage OUTPUT ClientExceptionMessage* response
126 containing exception when error is
127 detected in export response message
128 @param valid OUTPUT Boolean indicating whether any errors
129 were encountered
130 */
131 static void validateHTTPHeaders(
132 HTTPMessage* httpMessage,
133 Array<HTTPHeader>& headers,
134 Uint32 contentLength,
135 Uint32 statusCode,
136 Boolean cimReconnect,
137 const String& reasonPhrase,
138 char*& content,
139 ClientExceptionMessage*& exceptionMessage,
140 carolann.graves 1.1 Boolean& valid);
141
142 /**
143 Decodes the Export Response in the HTTP message.
144
145 @param content INPUT char* containing message content
146 @param cimReconnect INPUT Boolean indicating whether close and
147 reconnect are necessary
148 @param responseMessage OUTPUT Message* response containing either
149 export indication response, or
150 exception when error is detected
151 */
152 static void decodeExportResponse(
153 char* content,
154 Boolean cimReconnect,
155 Message*& responseMessage);
156
157 private:
158
159 /**
160 Decodes an Export Indication response.
161 carolann.graves 1.1
162 @param parser XmlParser the XML parser
163 @param messageId String ID from MESSAGE element
164 @param isEmptyExpMethodResponseTag Boolean indicating whether
165 EXPMETHODRESPONSE was empty tag
166
167 @return pointer to a CIM Export Indication Response Message
168 */
169 static CIMExportIndicationResponseMessage* _decodeExportIndicationResponse(
170 XmlParser& parser,
171 const String& messageId,
172 Boolean isEmptyExpMethodResponseTag);
173 };
174
175 PEGASUS_NAMESPACE_END
176
177 #endif /* Pegasus_HTTPExportResponseDecoder_h */
|