void XmlRpcServer::incomingConnection( int socketDescriptor ) { #ifdef DEBUG_XMLRPC qDebug() << this << "new incoming connection"; #endif QAbstractSocket * s = NULL; #ifndef QT_NO_OPENSSL if ( sslParams != NULL && !sslParams->certificate.isNull() ) { s = new QSslSocket( this ); s->setSocketDescriptor( socketDescriptor ); ((QSslSocket *)s)->setLocalCertificate( sslParams->certificate ); ((QSslSocket *)s)->setPrivateKey( sslParams->privateKey ); ((QSslSocket *)s)->setCaCertificates( sslParams->ca ); } else { s = new QTcpSocket( this ); s->setSocketDescriptor( socketDescriptor ); } #else s = new QTcpSocket( this ); s->setSocketDescriptor( socketDescriptor ); #endif Q_ASSERT( s->state() == QAbstractSocket::ConnectedState ); connect( s, SIGNAL(disconnected()), this, SLOT(slotSocketDisconnected()) ); HttpServer * p = new HttpServer( s ); connect( p, SIGNAL(protocolTimeout(Protocol*)), this, SLOT(slotProtocolTimeout(Protocol*)) ); connect( p, SIGNAL(parseError(HttpServer*)), this, SLOT(slotParseError(HttpServer*)) ); connect( p, SIGNAL(requestReceived(HttpServer*, const QHttpRequestHeader&, const QByteArray&)), this, SLOT(slotRequestReceived(HttpServer*, const QHttpRequestHeader&, const QByteArray&)) ); connect( p, SIGNAL(replySent(HttpServer*)), this, SLOT(slotReplySent(HttpServer*)) ); }
QIODevice* EmbraceChunker::newDevice() { QAbstractSocket* lsocket = new QAbstractSocket(QAbstractSocket::UnknownSocketType, 0); int sock = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL)); if (sock < 0) { std::cerr << "socket : %s\n" << strerror(errno) << std::endl; } if (setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, (char *)&_socketBufferSize, sizeof(unsigned long long)) < 0) { std::cerr << "sock opt : %s\n" << strerror(errno) << std::endl; } lsocket->setSocketDescriptor(sock); return lsocket; }