Mercurial > trustbridge
comparison ui/sslconnection.h @ 46:d28e2624c1d5
Reset connection before the next request.
This makes the downloader work for the first simple test.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 17 Mar 2014 10:51:47 +0000 |
parents | c6125d73faf4 |
children | 17e1c8f37d72 |
comparison
equal
deleted
inserted
replaced
45:c6125d73faf4 | 46:d28e2624c1d5 |
---|---|
46 | 46 |
47 /** @brief write */ | 47 /** @brief write */ |
48 int write(const QByteArray& request); | 48 int write(const QByteArray& request); |
49 | 49 |
50 /** | 50 /** |
51 * @brief read at most len bytes | 51 * @brief read at most len bytes and reset the connection |
52 * and return them as a byte array returns a NULL byte array on error*/ | 52 * |
53 * @param [in] len Amount of bytes to read. | |
54 * | |
55 * @returns a byte array containing the data or | |
56 * a NULL byte array on error*/ | |
53 QByteArray read(size_t len); | 57 QByteArray read(size_t len); |
54 | 58 |
55 bool initialized() { return mInitialized; } | 59 bool initialized() { return mInitialized; } |
56 bool connected() { return mConnected; } | 60 bool connected() { return mConnected; } |
57 | 61 |
68 QByteArray mPinnedCert; | 72 QByteArray mPinnedCert; |
69 x509_crt mX509PinnedCert; | 73 x509_crt mX509PinnedCert; |
70 entropy_context mEntropy; | 74 entropy_context mEntropy; |
71 ctr_drbg_context mCtr_drbg; | 75 ctr_drbg_context mCtr_drbg; |
72 ssl_context mSSL; | 76 ssl_context mSSL; |
77 ssl_session mSavedSession; | |
73 bool mInitialized; | 78 bool mInitialized; |
74 bool mConnected; | 79 bool mConnected; /* A connection was established */ |
80 bool mNeedsReset; /* The connection needs to be reset before the next | |
81 write */ | |
75 int mServerFD; | 82 int mServerFD; |
76 SSLConnection::ErrorCode mErrorState; | 83 SSLConnection::ErrorCode mErrorState; |
77 /* @brief: Initialize polarssl structures | 84 /* @brief: Initialize polarssl structures |
78 * | 85 * |
79 * This wraps polarssl initialization functions | 86 * This wraps polarssl initialization functions |
81 * Sets the error state accordingly. | 88 * Sets the error state accordingly. |
82 * | 89 * |
83 * @returns: 0 on success a polarssl error otherwise. | 90 * @returns: 0 on success a polarssl error otherwise. |
84 */ | 91 */ |
85 int init(); | 92 int init(); |
93 | |
94 /* @brief Reset the connection. | |
95 * | |
96 * Resets the https connection and does another handshake. | |
97 * | |
98 * @returns: 0 on success a polarssl error or -1 otherwise. */ | |
99 int reset(); | |
100 | |
101 /* @brief validates that the certificate matches the pinned one. | |
102 * | |
103 * Checks the peer certificate of mSSL and validates that the | |
104 * certificate matches mPinnedCertificate. | |
105 * | |
106 * @returns: 0 on success a polarssl error or -1 otherwise. */ | |
107 int validateCertificate(); | |
108 | |
109 /* @brief disconnects the connection */ | |
110 void disconnect(); | |
86 }; | 111 }; |
87 | 112 |
88 #endif | 113 #endif |