First SOAP encoder.
[shibboleth/cpp-opensaml.git] / saml / binding / GenericResponse.h
1 /*
2  *  Copyright 2001-2006 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file saml/binding/GenericResponse.h
19  * 
20  * Interface to generic protocol responses that transport SAML messages. 
21  */
22
23 #ifndef __saml_genres_h__
24 #define __saml_genres_h__
25
26 #include <saml/base.h>
27 #include <iostream>
28
29 namespace opensaml {
30     
31     /**
32      * Interface to caller-supplied shim for accessing generic transport
33      * request context.
34      * 
35      * <p>This interface need not be threadsafe.
36      */
37     class SAML_API GenericResponse {
38         MAKE_NONCOPYABLE(GenericResponse);
39     protected:
40         GenericResponse() {}
41     public:
42         virtual ~GenericResponse() {}        
43
44         /**
45          * Sets or clears the MIME type of the response.
46          * 
47          * @param type the MIME type, or NULL to clear
48          */
49         virtual void setContentType(const char* type=NULL)=0;
50
51         /**
52          * Sends a completed response to the client along with a
53          * transport-specific "OK" indication. Used for "normal" responses.
54          * 
55          * @param inputStream   reference to source of response data
56          * @return a result code to return from the calling MessageEncoder
57          */
58         virtual long sendResponse(std::istream& inputStream)=0;
59
60         /**
61          * Sends an "error" response to the client along with a
62          * transport-specific error indication.
63          * 
64          * @param inputStream   reference to source of response data
65          * @return a result code to return from the calling MessageEncoder
66          */
67         virtual long sendError(std::istream& inputStream)=0;
68
69         /**
70          * Sends a completed response to the client.
71          * 
72          * @param inputStream   reference to source of response data
73          * @param status        transport-specific status to return
74          * @return a result code to return from the calling MessageEncoder
75          */
76         virtual long sendResponse(std::istream& inputStream, long status)=0;
77     };
78 };
79
80 #endif /* __saml_genres_h__ */