/usr/include/xmltooling/soap/SOAPTransport.h is in libxmltooling-dev 1.4.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | /**
* 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.
*
* 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
*
* 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.
*/
/**
* @file xmltooling/soap/SOAPTransport.h
*
* Encapsulates a transport layer protocol for sending/receiving messages.
*/
#ifndef __xmltooling_soaptrans_h__
#define __xmltooling_soaptrans_h__
#include <xmltooling/base.h>
#include <string>
#include <iostream>
namespace xmltooling {
class XMLTOOL_API Credential;
class XMLTOOL_API CredentialCriteria;
class XMLTOOL_API CredentialResolver;
class XMLTOOL_API X509TrustEngine;
/**
* Encapsulates a transport layer protocol for sending/receiving messages.
*
* Most of the methods are const, meaning they don't affect the transport
* layer until the data is sent.
*/
class XMLTOOL_API SOAPTransport
{
MAKE_NONCOPYABLE(SOAPTransport);
protected:
SOAPTransport();
public:
virtual ~SOAPTransport();
/**
* A simple structure to capture SOAP addressing information.
*/
struct XMLTOOL_API Address {
/**
* Constructor.
*
* @param from name of sender
* @param to name of recipient
* @param endpoint endpoint URL
*/
Address(const char* from, const char* to, const char* endpoint) : m_from(from), m_to(to), m_endpoint(endpoint) {
}
/** Name of sender. */
const char* m_from;
/** Name of recipient. */
const char* m_to;
/** Endpoint URL. */
const char* m_endpoint;
};
/**
* Indicates whether transport provides confidentiality.
*
* @return true iff transport layer provides confidentiality
*/
virtual bool isConfidential() const=0;
/**
* Sets the connection timeout.
*
* @param timeout time to wait for connection to server in seconds, or -1 for no timeout
* @return true iff the transport supports connection timeouts
*/
virtual bool setConnectTimeout(long timeout)=0;
/**
* Sets the request timeout.
*
* @param timeout time to wait for a response in seconds, or -1 for no timeout
* @return true iff the transport supports request/response timeouts
*/
virtual bool setTimeout(long timeout)=0;
/**
* Common types of transport authentication that may be supported.
*/
enum transport_auth_t {
transport_auth_none = 0,
transport_auth_basic = 1,
transport_auth_digest = 2,
transport_auth_ntlm = 3,
transport_auth_gss = 4
};
/**
* Sets a particular form of transport authentication and credentials.
*
* @param authType type of transport authentication to use
* @param username username for transport authentication
* @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=nullptr, const char* password=nullptr)=0;
/**
* Determines whether TLS/SSL connections include a check of the server's certificate
* against the expected hostname or address. Defaults to true, and has no effect for
* insecure protocols.
*
* @param verify true iff the hostname should be verified against the server's certificate
* @return true iff the transport supports hostname verification
*/
virtual bool setVerifyHost(bool verify)=0;
#ifndef XMLTOOLING_NO_XMLSEC
/**
* Supplies transport credentials.
*
* <p>The lifetime of the credential must be longer than the lifetime of this object.
*
* @param credential a Credential instance, or nullptr
* @return true iff the transport supports the use of the Credential
*/
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 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=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.
* Without the proper knowledge and inputs, crashes may result.
*
* @param provider name of the SOAPTransport class the caller believes is in use
* @param option implementation-specific string containing the option to set
* @param value implementation- and option-specific string to use
* @return true iff the transport supports the option and value supplied
*/
virtual bool setProviderOption(const char* provider, const char* option, const char* value);
/**
* Sends a stream of data over the transport. The function may return without
* having received any data, depending on the nature of the transport.
*
* <p>If the stream is empty, a request may be issued with no body if the transport
* supports that feature.
*
* @param in input stream to send
*/
virtual void send(std::istream& in)=0;
/**
* Sends an optional stream of data over the transport. The function may return without
* having received any data, depending on the nature of the transport.
*
* <p>If the parameter is omitted, a request may be issued with no body if the transport
* supports that feature.
*
* @param in input stream to send
*/
virtual void send(std::istream* in=nullptr);
/**
* 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 isAuthenticated() const=0;
/**
* Returns the MIME type of the response, if any.
*
* @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
/**
* Registers SOAPTransport classes into the runtime.
*/
void XMLTOOL_API registerSOAPTransports();
/**
* Notifies transport infrastructure to initialize.
*/
void XMLTOOL_API initSOAPTransports();
/**
* Notifies transport infrastructure to shutdown.
*/
void XMLTOOL_API termSOAPTransports();
#endif
};
#endif /* __xmltooling_soaptrans_h__ */
|