Update copyright.
[shibboleth/cpp-xmltooling.git] / xmltooling / soap / SOAPTransport.h
index c25f43d..39a8712 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -86,7 +86,7 @@ namespace xmltooling {
          */
         virtual bool setAuth(transport_auth_t authType, const char* username=NULL, const char* password=NULL) const=0;
 
-#ifndef XMLTOOLING_NO_XMLSEC 
+#ifndef XMLTOOLING_NO_XMLSEC
         /**
          * Provides a CredentialResolver to the transport to supply transport credentials.
          * The lifetime of the resolver must be longer than the lifetime of this object.
@@ -103,21 +103,42 @@ namespace xmltooling {
          * The lifetime of the engine must be longer than the lifetime of this object.
          * 
          * @param trustEngine   a TrustEngine instance, or NULL
+         * @param mandatory     flag controls whether message is sent at all if the
+         *                      transport isn't authenticated using the TrustEngine
          * @param keyResolver   optional externally supplied KeyResolver, or NULL
          * @return true iff the transport supports the use of a TrustEngine
          */
-        virtual bool setTrustEngine(const X509TrustEngine* trustEngine, const xmlsignature::KeyResolver* keyResolver=NULL) const=0;
+        virtual bool setTrustEngine(
+            const X509TrustEngine* trustEngine,
+            bool mandatory=true,
+            const xmlsignature::KeyResolver* keyResolver=NULL
+            ) const=0;
 #endif
 
         /**
-         * Sends a stream of data over the transport, and writes the results into another.
+         * Sends a stream of data over the transport. The function may return without
+         * having received any data, depending on the nature of the transport.
          * 
          * @param in    input stream to send
-         * @param out   output stream to write result into 
          */        
-        virtual size_t send(std::istream& in, std::ostream& out)=0;
+        virtual void send(std::istream& in)=0;
         
         /**
+         * Returns reference to response stream.  The resulting stream must be
+         * checked directly to determine whether data is available.
+         * 
+         * @return  reference to a stream containing the response, if any
+         */
+        virtual std::istream& receive()=0;
+        
+        /**
+         * Returns result of authenticating transport peer.
+         * 
+         * @return true iff TrustEngine or other mechanism successfully authenticated the peer
+         */
+        virtual bool isSecure() const=0;
+
+        /**
          * Returns the MIME type of the response, if any.
          * 
          * @return  MIME type of response, or an empty string