comparison ui/sslconnection.h @ 1255:2a1aa9df8f11

(issue133) Improve API documentation
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 25 Sep 2014 17:58:12 +0200
parents 78798d3af8f0
children
comparison
equal deleted inserted replaced
1254:6d840341bc25 1255:2a1aa9df8f11
8 #ifndef SSLCONNECTION_H 8 #ifndef SSLCONNECTION_H
9 #define SSLCONNECTION_H 9 #define SSLCONNECTION_H
10 10
11 /** 11 /**
12 * @file sslconnection.h 12 * @file sslconnection.h
13 * @brief Qt wrapper around polarssl ssl api 13 * @brief Controller of the downloader network connection
14 */ 14 */
15 15
16 #include <QDebug> 16 #include <QDebug>
17 #include <QUrl> 17 #include <QUrl>
18 #include <QString> 18 #include <QString>
19 #include <QByteArray> 19 #include <QByteArray>
20 20
21 /** @brief Controller of the downloader network connection
22 *
23 * Base class of the SSL connection used. Offers a high
24 * level API that the downloader can use regardless of the
25 * concrete SSL implementation.
26 *
27 */
21 class SSLConnection 28 class SSLConnection
22 { 29 {
23 public: 30 public:
31 /**
32 * @enum ErrorCode
33 * @brief Possible Errors of the SSL connection.
34 */
24 enum ErrorCode { 35 enum ErrorCode {
36 /*! Everything OK */
25 NoError, 37 NoError,
38 /*! Failure before the SSL Handshake. Connection failure.*/
26 NoConnection, 39 NoConnection,
40 /*! SSL Handshake failed. Probably unsupported ciphersuites.*/
27 SSLHandshakeFailed, 41 SSLHandshakeFailed,
42 /*! The pinned certificate did not match with the server cert.*/
28 InvalidCertificate, 43 InvalidCertificate,
44 /*! The pinned certificate could not be parsed. Coding error!.*/
29 InvalidPinnedCertificate, 45 InvalidPinnedCertificate,
46 /*! The response from the server could not be parsed.*/
30 InvalidResponse, 47 InvalidResponse,
48 /*! The connection was established but lost at one point.*/
31 ConnectionLost, 49 ConnectionLost,
50 /*! A connection timeout was hit.*/
32 Timeout, 51 Timeout,
52 /*! The unexpected.*/
33 ErrUnknown 53 ErrUnknown
34 }; 54 };
35 55
36 /** 56 /**
37 * @brief Construct a pinned SSL Connection 57 * @brief Construct a pinned SSL Connection
42 SSLConnection(const QString& url, 62 SSLConnection(const QString& url,
43 const QByteArray& certificate = QByteArray()); 63 const QByteArray& certificate = QByteArray());
44 64
45 virtual ~SSLConnection() {}; 65 virtual ~SSLConnection() {};
46 66
67 /**@brief wether or not everything could be parsed and all options could be set.
68 *
69 * This should usually be true. Otherwise it is likely something wrong
70 * with the internal data or the used library versions.
71 *
72 * @returns false when some error occured during initalization.
73 **/
47 bool initialized() { return mInitialized; } 74 bool initialized() { return mInitialized; }
75
76 /** @brief wether or not the connection has been established */
48 bool connected() { return mConnected; } 77 bool connected() { return mConnected; }
49 78
50 ErrorCode getLastError() { return mErrorState; } 79 ErrorCode getLastError() { return mErrorState; }
51 80
52 /** @brief: Establish the connection 81 /** @brief: Establish the connection

http://wald.intevation.org/projects/trustbridge/