Merge branch '1.x' of ssh://authdev.it.ohio-state.edu/~scantor/git/cpp-xmltooling...
[shibboleth/cpp-xmltooling.git] / xmltooling / soap / SOAPTransport.h
index 3a5c345..48c67bb 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  Copyright 2001-2009 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
@@ -24,6 +28,8 @@
 #define __xmltooling_soaptrans_h__
 
 #include <xmltooling/base.h>
+
+#include <string>
 #include <iostream>
 
 namespace xmltooling {
@@ -113,7 +119,7 @@ namespace xmltooling {
          * @param password  simple password/credential for transport authentication
          * @return  true iff the transport supports the indicated form of authentication
          */
-        virtual bool setAuth(transport_auth_t authType, const char* username=NULL, const char* password=NULL)=0;
+        virtual bool setAuth(transport_auth_t authType, const char* username=nullptr, const char* password=nullptr)=0;
 
         /**
          * Determines whether TLS/SSL connections include a check of the server's certificate
@@ -131,31 +137,40 @@ namespace xmltooling {
          *
          * <p>The lifetime of the credential must be longer than the lifetime of this object.
          *
-         * @param credential  a Credential instance, or NULL
+         * @param credential  a Credential instance, or nullptr
          * @return true iff the transport supports the use of the Credential
          */
-        virtual bool setCredential(const Credential* credential=NULL)=0;
+        virtual bool setCredential(const Credential* credential=nullptr)=0;
 
         /**
          * Provides an X509TrustEngine to the transport to authenticate the transport peer.
          * The lifetime of the engine must be longer than the lifetime of this object.
          *
-         * @param trustEngine   an X509TrustEngine instance, or NULL
-         * @param credResolver  a CredentialResolver to supply the peer's trusted credentials, or NULL
+         * @param trustEngine   an X509TrustEngine instance, or nullptr
+         * @param credResolver  a CredentialResolver to supply the peer's trusted credentials, or nullptr
          * @param criteria      optional criteria for selecting peer credentials
          * @param mandatory     flag controls whether message is sent at all if the
          *                      transport isn't authenticated using the TrustEngine
          * @return true iff the transport supports the use of a TrustEngine
          */
         virtual bool setTrustEngine(
-            const X509TrustEngine* trustEngine=NULL,
-            const CredentialResolver* credResolver=NULL,
-            CredentialCriteria* criteria=NULL,
+            const X509TrustEngine* trustEngine=nullptr,
+            const CredentialResolver* credResolver=nullptr,
+            CredentialCriteria* criteria=nullptr,
             bool mandatory=true
             )=0;
 #endif
 
         /**
+         * Installs (or clears) a pointer to an object used for cache management of the
+         * content being accessed. The lifetime of the object must be longer than the lifetime
+         * of this object.
+         *
+         * @param cacheTag  optional pointer to string used for cache management
+         */
+        virtual bool setCacheTag(std::string* cacheTag=nullptr);
+
+        /**
          * Sets an implementation-specific transport provider option.
          *
          * <p>Requires knowledge of the underlying SOAPTransport implementation.
@@ -188,7 +203,7 @@ namespace xmltooling {
          *
          * @param in    input stream to send
          */
-        virtual void send(std::istream* in=NULL);
+        virtual void send(std::istream* in=nullptr);
 
         /**
          * Returns reference to response stream.  The resulting stream must be
@@ -211,6 +226,13 @@ namespace xmltooling {
          * @return  MIME type of response, or an empty string
          */
         virtual std::string getContentType() const=0;
+
+        /**
+         * Returns the status code of the response.
+         *
+         * @return  transport status code, or 0 if unknown
+         */
+        virtual long getStatusCode() const;
     };
 
 #ifndef XMLTOOLING_NO_XMLSEC