summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp
blob: 5ccebe2e484421e39795084919fea945c2384897 (plain)
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

void wrapInFunction()
{

//! [0]
QTransportAuth::Data *conData;
QTransportAuth *a = QTransportAuth::getInstance();

conData = a->connectTransport(
    QTransportAuth::Trusted | QTransportAuth::UnixStreamSock,
    socketDescriptor );
//! [0]


//! [1]
// mySocket can be any QIODevice subclass
AuthDevice *ad = a->recvBuf( d, mySocket );

// proxy in the auth device where the socket would have gone
connect( ad, SIGNAL(readyRead()), this, SLOT(mySocketReadyRead()));
//! [1]


//! [2]
AuthDevice *ad = a->authBuf( d, mySocket );

ad->write( someData );
//! [2]


//! [3]
policyCheck( QTransportAuth::Data &, const QString & )
//! [3]


//! [4]
QTransportAuth::Result r = d.status & QTransportAuth::ErrMask;
qWarning( "error: %s", QTransportAuth::errorStrings[r] );
//! [4]


//! [5]
MD5(K XOR opad, MD5(K XOR ipad, text))
//! [5]

}