File: qsslsocket_c.cpp

package info (click to toggle)
libqtpas 2.6%2B2.0.8%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,860 kB
  • sloc: cpp: 56,595; pascal: 13,727; sh: 44; makefile: 18
file content (298 lines) | stat: -rw-r--r-- 8,594 bytes parent folder | download | duplicates (13)
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
//******************************************************************************
//  Copyright (c) 2005-2013 by Jan Van hijfte
//
//  See the included file COPYING.TXT for details about the copyright.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//******************************************************************************


#include "qsslsocket_c.h"

QSslSocketH QSslSocket_Create(QObjectH parent)
{
	return (QSslSocketH) new QSslSocket((QObject*)parent);
}

void QSslSocket_Destroy(QSslSocketH handle)
{
	delete (QSslSocket *)handle;
}

void QSslSocket_resume(QSslSocketH handle)
{
	((QSslSocket *)handle)->resume();
}

void QSslSocket_connectToHostEncrypted(QSslSocketH handle, PWideString hostName, quint16 port, unsigned int mode, QAbstractSocket::NetworkLayerProtocol protocol)
{
	QString t_hostName;
	copyPWideStringToQString(hostName, t_hostName);
	((QSslSocket *)handle)->connectToHostEncrypted(t_hostName, port, (QIODevice::OpenMode)mode, protocol);
}

void QSslSocket_connectToHostEncrypted2(QSslSocketH handle, PWideString hostName, quint16 port, PWideString sslPeerName, unsigned int mode, QAbstractSocket::NetworkLayerProtocol protocol)
{
	QString t_hostName;
	QString t_sslPeerName;
	copyPWideStringToQString(hostName, t_hostName);
	copyPWideStringToQString(sslPeerName, t_sslPeerName);
	((QSslSocket *)handle)->connectToHostEncrypted(t_hostName, port, t_sslPeerName, (QIODevice::OpenMode)mode, protocol);
}

void QSslSocket_connectToHost(QSslSocketH handle, PWideString hostName, quint16 port, unsigned int openMode, QAbstractSocket::NetworkLayerProtocol protocol)
{
	QString t_hostName;
	copyPWideStringToQString(hostName, t_hostName);
	((QSslSocket *)handle)->connectToHost(t_hostName, port, (QIODevice::OpenMode)openMode, protocol);
}

void QSslSocket_disconnectFromHost(QSslSocketH handle)
{
	((QSslSocket *)handle)->disconnectFromHost();
}

void QSslSocket_setSocketOption(QSslSocketH handle, QAbstractSocket::SocketOption option, const QVariantH value)
{
	((QSslSocket *)handle)->setSocketOption(option, *(const QVariant*)value);
}

void QSslSocket_socketOption(QSslSocketH handle, QVariantH retval, QAbstractSocket::SocketOption option)
{
	*(QVariant *)retval = ((QSslSocket *)handle)->socketOption(option);
}

QSslSocket::SslMode QSslSocket_mode(QSslSocketH handle)
{
	return (QSslSocket::SslMode) ((QSslSocket *)handle)->mode();
}

bool QSslSocket_isEncrypted(QSslSocketH handle)
{
	return (bool) ((QSslSocket *)handle)->isEncrypted();
}

QSsl::SslProtocol QSslSocket_protocol(QSslSocketH handle)
{
	return (QSsl::SslProtocol) ((QSslSocket *)handle)->protocol();
}

void QSslSocket_setProtocol(QSslSocketH handle, QSsl::SslProtocol protocol)
{
	((QSslSocket *)handle)->setProtocol(protocol);
}

QSslSocket::PeerVerifyMode QSslSocket_peerVerifyMode(QSslSocketH handle)
{
	return (QSslSocket::PeerVerifyMode) ((QSslSocket *)handle)->peerVerifyMode();
}

void QSslSocket_setPeerVerifyMode(QSslSocketH handle, QSslSocket::PeerVerifyMode mode)
{
	((QSslSocket *)handle)->setPeerVerifyMode(mode);
}

int QSslSocket_peerVerifyDepth(QSslSocketH handle)
{
	return (int) ((QSslSocket *)handle)->peerVerifyDepth();
}

void QSslSocket_setPeerVerifyDepth(QSslSocketH handle, int depth)
{
	((QSslSocket *)handle)->setPeerVerifyDepth(depth);
}

void QSslSocket_peerVerifyName(QSslSocketH handle, PWideString retval)
{
	QString t_retval;
	t_retval = ((QSslSocket *)handle)->peerVerifyName();
	copyQStringToPWideString(t_retval, retval);
}

void QSslSocket_setPeerVerifyName(QSslSocketH handle, PWideString hostName)
{
	QString t_hostName;
	copyPWideStringToQString(hostName, t_hostName);
	((QSslSocket *)handle)->setPeerVerifyName(t_hostName);
}

qint64 QSslSocket_bytesAvailable(QSslSocketH handle)
{
	return (qint64) ((QSslSocket *)handle)->bytesAvailable();
}

qint64 QSslSocket_bytesToWrite(QSslSocketH handle)
{
	return (qint64) ((QSslSocket *)handle)->bytesToWrite();
}

bool QSslSocket_canReadLine(QSslSocketH handle)
{
	return (bool) ((QSslSocket *)handle)->canReadLine();
}

void QSslSocket_close(QSslSocketH handle)
{
	((QSslSocket *)handle)->close();
}

bool QSslSocket_atEnd(QSslSocketH handle)
{
	return (bool) ((QSslSocket *)handle)->atEnd();
}

bool QSslSocket_flush(QSslSocketH handle)
{
	return (bool) ((QSslSocket *)handle)->flush();
}

void QSslSocket_abort(QSslSocketH handle)
{
	((QSslSocket *)handle)->abort();
}

void QSslSocket_setReadBufferSize(QSslSocketH handle, qint64 size)
{
	((QSslSocket *)handle)->setReadBufferSize(size);
}

qint64 QSslSocket_encryptedBytesAvailable(QSslSocketH handle)
{
	return (qint64) ((QSslSocket *)handle)->encryptedBytesAvailable();
}

qint64 QSslSocket_encryptedBytesToWrite(QSslSocketH handle)
{
	return (qint64) ((QSslSocket *)handle)->encryptedBytesToWrite();
}

void QSslSocket_sslConfiguration(QSslSocketH handle, QSslConfigurationH retval)
{
	*(QSslConfiguration *)retval = ((QSslSocket *)handle)->sslConfiguration();
}

void QSslSocket_setSslConfiguration(QSslSocketH handle, const QSslConfigurationH config)
{
	((QSslSocket *)handle)->setSslConfiguration(*(const QSslConfiguration*)config);
}

void QSslSocket_setLocalCertificate(QSslSocketH handle, const QSslCertificateH certificate)
{
	((QSslSocket *)handle)->setLocalCertificate(*(const QSslCertificate*)certificate);
}

void QSslSocket_setLocalCertificate2(QSslSocketH handle, PWideString fileName, QSsl::EncodingFormat format)
{
	QString t_fileName;
	copyPWideStringToQString(fileName, t_fileName);
	((QSslSocket *)handle)->setLocalCertificate(t_fileName, format);
}

void QSslSocket_localCertificate(QSslSocketH handle, QSslCertificateH retval)
{
	*(QSslCertificate *)retval = ((QSslSocket *)handle)->localCertificate();
}

void QSslSocket_peerCertificate(QSslSocketH handle, QSslCertificateH retval)
{
	*(QSslCertificate *)retval = ((QSslSocket *)handle)->peerCertificate();
}

void QSslSocket_sessionCipher(QSslSocketH handle, QSslCipherH retval)
{
	*(QSslCipher *)retval = ((QSslSocket *)handle)->sessionCipher();
}

void QSslSocket_setPrivateKey(QSslSocketH handle, const QSslKeyH key)
{
	((QSslSocket *)handle)->setPrivateKey(*(const QSslKey*)key);
}

void QSslSocket_setPrivateKey2(QSslSocketH handle, PWideString fileName, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format, const QByteArrayH passPhrase)
{
	QString t_fileName;
	copyPWideStringToQString(fileName, t_fileName);
	((QSslSocket *)handle)->setPrivateKey(t_fileName, algorithm, format, *(const QByteArray*)passPhrase);
}

void QSslSocket_privateKey(QSslSocketH handle, QSslKeyH retval)
{
	*(QSslKey *)retval = ((QSslSocket *)handle)->privateKey();
}

void QSslSocket_setCiphers(QSslSocketH handle, PWideString ciphers)
{
	QString t_ciphers;
	copyPWideStringToQString(ciphers, t_ciphers);
	((QSslSocket *)handle)->setCiphers(t_ciphers);
}

void QSslSocket_addCaCertificate(QSslSocketH handle, const QSslCertificateH certificate)
{
	((QSslSocket *)handle)->addCaCertificate(*(const QSslCertificate*)certificate);
}

void QSslSocket_addDefaultCaCertificate(const QSslCertificateH certificate)
{
	QSslSocket::addDefaultCaCertificate(*(const QSslCertificate*)certificate);
}

bool QSslSocket_waitForConnected(QSslSocketH handle, int msecs)
{
	return (bool) ((QSslSocket *)handle)->waitForConnected(msecs);
}

bool QSslSocket_waitForEncrypted(QSslSocketH handle, int msecs)
{
	return (bool) ((QSslSocket *)handle)->waitForEncrypted(msecs);
}

bool QSslSocket_waitForReadyRead(QSslSocketH handle, int msecs)
{
	return (bool) ((QSslSocket *)handle)->waitForReadyRead(msecs);
}

bool QSslSocket_waitForBytesWritten(QSslSocketH handle, int msecs)
{
	return (bool) ((QSslSocket *)handle)->waitForBytesWritten(msecs);
}

bool QSslSocket_waitForDisconnected(QSslSocketH handle, int msecs)
{
	return (bool) ((QSslSocket *)handle)->waitForDisconnected(msecs);
}

bool QSslSocket_supportsSsl()
{
	return (bool) QSslSocket::supportsSsl();
}

long QSslSocket_sslLibraryVersionNumber()
{
	return (long) QSslSocket::sslLibraryVersionNumber();
}

void QSslSocket_sslLibraryVersionString(PWideString retval)
{
	QString t_retval;
	t_retval = QSslSocket::sslLibraryVersionString();
	copyQStringToPWideString(t_retval, retval);
}

void QSslSocket_startClientEncryption(QSslSocketH handle)
{
	((QSslSocket *)handle)->startClientEncryption();
}

void QSslSocket_startServerEncryption(QSslSocketH handle)
{
	((QSslSocket *)handle)->startServerEncryption();
}

void QSslSocket_ignoreSslErrors(QSslSocketH handle)
{
	((QSslSocket *)handle)->ignoreSslErrors();
}