1 martin 1.4 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.5 //
|
3 martin 1.4 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.5 //
|
10 martin 1.4 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.5 //
|
17 martin 1.4 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.5 //
|
20 martin 1.4 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.5 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.4 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.5 //
|
28 martin 1.4 //////////////////////////////////////////////////////////////////////////
|
29 carolann.graves 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_HTTPExportResponseDecoder_h
33 #define Pegasus_HTTPExportResponseDecoder_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/Message.h>
37 #include <Pegasus/Common/Exception.h>
38 #include <Pegasus/Common/HTTPMessage.h>
39 #include <Pegasus/Common/String.h>
40 #include <Pegasus/Common/XmlParser.h>
41 #include <Pegasus/Common/CIMMessage.h>
42 #include <Pegasus/ExportClient/Linkage.h>
|
43 anusha.kandepu 1.6 #ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
44 #include <Pegasus/WsmServer/WsmResponse.h>
45 #endif
46 #include <Pegasus/Common/ContentLanguageList.h>
|
47 carolann.graves 1.1
48 PEGASUS_NAMESPACE_BEGIN
49
50 /**
51 The ClientExceptionMessage class represents an exception encapsulated in a
52 response message. A ClientExceptionMessage is generated by the HTTP Export
53 Response Decoder when an error is detected in the export response.
54 */
55 class ClientExceptionMessage : public Message
56 {
57 public:
58 /**
59 Constructs a ClientExceptionMessage.
60
61 @param clientException_ INPUT Exception* exception to be
62 encapsulated in the message
63 */
64 ClientExceptionMessage(Exception* clientException_)
65 :
66 Message(CLIENT_EXCEPTION_MESSAGE),
67 clientException(clientException_)
68 carolann.graves 1.1 {
69 }
70
71 Exception* clientException;
72 };
73
74 /**
75 The HTTPExportResponseDecoder class provides interfaces to parse and
76 validate HTTP headers, and decode an export response message.
77 */
|
78 mike 1.2 class PEGASUS_EXPORT_CLIENT_LINKAGE HTTPExportResponseDecoder
|
79 carolann.graves 1.1 {
80 public:
81
82 /**
83 Parses the headers and status line of the HTTP message.
84
85 This method is called by the CIMExportResponseDecoder before calling
86 the client authenticator to check the response header for an
87 authentication challenge.
88
89 @param httpMessage INPUT HTTPMessage* message to be processed
90 @param exceptionMessage OUTPUT ClientExceptionMessage* response
91 containing exception when error is
92 detected in export response message
93 @param headers OUTPUT Array<HTTPHeader> containing headers
94 @param contentLength OUTPUT Uint32 length of message content
95 @param statusCode OUTPUT Uint32 status code from status line
96 @param reasonPhrase OUTPUT String reasonPhrase from status line
97 @param cimReconnect OUTPUT Boolean indicating whether close and
98 reconnect are necessary
99 @param valid OUTPUT Boolean indicating whether any errors
100 carolann.graves 1.1 were encountered
101 */
102 static void parseHTTPHeaders(
103 HTTPMessage* httpMessage,
104 ClientExceptionMessage*& exceptionMessage,
105 Array<HTTPHeader>& headers,
106 Uint32& contentLength,
107 Uint32& statusCode,
108 String& reasonPhrase,
109 Boolean& cimReconnect,
110 Boolean& valid);
111
112 /**
113 Validates the HTTP headers of the HTTP message.
114
115 This method is called by the CIMExportResponseDecoder after calling
116 the client authenticator to check the response header for an
117 authentication challenge.
118
119 @param httpMessage INPUT HTTPMessage* message to be processed
120 @param headers INPUT Array<HTTPHeader> containing headers
121 carolann.graves 1.1 @param contentLength INPUT Uint32 length of message content
122 @param statusCode INPUT Uint32 status code from status line
123 @param cimReconnect INPUT Boolean indicating whether close and
124 reconnect are necessary
125 @param reasonPhrase INPUT String reasonPhrase from status line
126 @param content OUTPUT char* containing message content
127 @param exceptionMessage OUTPUT ClientExceptionMessage* response
128 containing exception when error is
129 detected in export response message
130 @param valid OUTPUT Boolean indicating whether any errors
131 were encountered
132 */
133 static void validateHTTPHeaders(
134 HTTPMessage* httpMessage,
135 Array<HTTPHeader>& headers,
136 Uint32 contentLength,
137 Uint32 statusCode,
138 Boolean cimReconnect,
139 const String& reasonPhrase,
140 char*& content,
141 ClientExceptionMessage*& exceptionMessage,
|
142 anusha.kandepu 1.6 Boolean& valid,
143 Boolean wsmanFlag = false);
|
144 carolann.graves 1.1
145 /**
146 Decodes the Export Response in the HTTP message.
147
148 @param content INPUT char* containing message content
149 @param cimReconnect INPUT Boolean indicating whether close and
150 reconnect are necessary
|
151 kumpf 1.3 @param responseMessage OUTPUT Message* response containing either
|
152 carolann.graves 1.1 export indication response, or
153 exception when error is detected
154 */
155 static void decodeExportResponse(
156 char* content,
157 Boolean cimReconnect,
158 Message*& responseMessage);
159
|
160 anusha.kandepu 1.6 #ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
161 static void decodeWSMANExportResponse(
162 char* content,
163 Boolean reconnect,
164 Message*& responseMessage,
165 ContentLanguageList & contentLanguages,
166 WsmRequest* request);
167 #endif
|
168 carolann.graves 1.1 private:
169
170 /**
171 Decodes an Export Indication response.
172
173 @param parser XmlParser the XML parser
174 @param messageId String ID from MESSAGE element
175 @param isEmptyExpMethodResponseTag Boolean indicating whether
176 EXPMETHODRESPONSE was empty tag
177
178 @return pointer to a CIM Export Indication Response Message
179 */
180 static CIMExportIndicationResponseMessage* _decodeExportIndicationResponse(
181 XmlParser& parser,
182 const String& messageId,
183 Boolean isEmptyExpMethodResponseTag);
|
184 anusha.kandepu 1.6
|
185 carolann.graves 1.1 };
186
187 PEGASUS_NAMESPACE_END
188
189 #endif /* Pegasus_HTTPExportResponseDecoder_h */
|