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
44 PEGASUS_NAMESPACE_BEGIN
45
46 /**
47 The ClientExceptionMessage class represents an exception encapsulated in a
48 response message. A ClientExceptionMessage is generated by the HTTP Export
49 Response Decoder when an error is detected in the export response.
50 carolann.graves 1.1 */
51 class ClientExceptionMessage : public Message
52 {
53 public:
54 /**
55 Constructs a ClientExceptionMessage.
56
57 @param clientException_ INPUT Exception* exception to be
58 encapsulated in the message
59 */
60 ClientExceptionMessage(Exception* clientException_)
61 :
62 Message(CLIENT_EXCEPTION_MESSAGE),
63 clientException(clientException_)
64 {
65 }
66
67 Exception* clientException;
68 };
69
70 /**
71 carolann.graves 1.1 The HTTPExportResponseDecoder class provides interfaces to parse and
72 validate HTTP headers, and decode an export response message.
73 */
|
74 mike 1.2 class PEGASUS_EXPORT_CLIENT_LINKAGE HTTPExportResponseDecoder
|
75 carolann.graves 1.1 {
76 public:
77
78 /**
79 Parses the headers and status line of the HTTP message.
80
81 This method is called by the CIMExportResponseDecoder before calling
82 the client authenticator to check the response header for an
83 authentication challenge.
84
85 @param httpMessage INPUT HTTPMessage* message to be processed
86 @param exceptionMessage OUTPUT ClientExceptionMessage* response
87 containing exception when error is
88 detected in export response message
89 @param headers OUTPUT Array<HTTPHeader> containing headers
90 @param contentLength OUTPUT Uint32 length of message content
91 @param statusCode OUTPUT Uint32 status code from status line
92 @param reasonPhrase OUTPUT String reasonPhrase from status line
93 @param cimReconnect OUTPUT Boolean indicating whether close and
94 reconnect are necessary
95 @param valid OUTPUT Boolean indicating whether any errors
96 carolann.graves 1.1 were encountered
97 */
98 static void parseHTTPHeaders(
99 HTTPMessage* httpMessage,
100 ClientExceptionMessage*& exceptionMessage,
101 Array<HTTPHeader>& headers,
102 Uint32& contentLength,
103 Uint32& statusCode,
104 String& reasonPhrase,
105 Boolean& cimReconnect,
106 Boolean& valid);
107
108 /**
109 Validates the HTTP headers of the HTTP message.
110
111 This method is called by the CIMExportResponseDecoder after calling
112 the client authenticator to check the response header for an
113 authentication challenge.
114
115 @param httpMessage INPUT HTTPMessage* message to be processed
116 @param headers INPUT Array<HTTPHeader> containing headers
117 carolann.graves 1.1 @param contentLength INPUT Uint32 length of message content
118 @param statusCode INPUT Uint32 status code from status line
119 @param cimReconnect INPUT Boolean indicating whether close and
120 reconnect are necessary
121 @param reasonPhrase INPUT String reasonPhrase from status line
122 @param content OUTPUT char* containing message content
123 @param exceptionMessage OUTPUT ClientExceptionMessage* response
124 containing exception when error is
125 detected in export response message
126 @param valid OUTPUT Boolean indicating whether any errors
127 were encountered
128 */
129 static void validateHTTPHeaders(
130 HTTPMessage* httpMessage,
131 Array<HTTPHeader>& headers,
132 Uint32 contentLength,
133 Uint32 statusCode,
134 Boolean cimReconnect,
135 const String& reasonPhrase,
136 char*& content,
137 ClientExceptionMessage*& exceptionMessage,
138 carolann.graves 1.1 Boolean& valid);
139
140 /**
141 Decodes the Export Response in the HTTP message.
142
143 @param content INPUT char* containing message content
144 @param cimReconnect INPUT Boolean indicating whether close and
145 reconnect are necessary
|
146 kumpf 1.3 @param responseMessage OUTPUT Message* response containing either
|
147 carolann.graves 1.1 export indication response, or
148 exception when error is detected
149 */
150 static void decodeExportResponse(
151 char* content,
152 Boolean cimReconnect,
153 Message*& responseMessage);
154
155 private:
156
157 /**
158 Decodes an Export Indication response.
159
160 @param parser XmlParser the XML parser
161 @param messageId String ID from MESSAGE element
162 @param isEmptyExpMethodResponseTag Boolean indicating whether
163 EXPMETHODRESPONSE was empty tag
164
165 @return pointer to a CIM Export Indication Response Message
166 */
167 static CIMExportIndicationResponseMessage* _decodeExportIndicationResponse(
168 carolann.graves 1.1 XmlParser& parser,
169 const String& messageId,
170 Boolean isEmptyExpMethodResponseTag);
171 };
172
173 PEGASUS_NAMESPACE_END
174
175 #endif /* Pegasus_HTTPExportResponseDecoder_h */
|