// qabstractsocket.sip generated by MetaSIP on Mon Oct 24 12:34:01 2011 // // This file is part of the QtNetwork Python extension module. // // Copyright (c) 2011 Riverbank Computing Limited // // This file is part of PyQt. // // This file may be used under the terms of the GNU General Public // License versions 2.0 or 3.0 as published by the Free Software // Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 // included in the packaging of this file. Alternatively you may (at // your option) use any later version of the GNU General Public // License if such license has been publicly approved by Riverbank // Computing Limited (or its successors, if any) and the KDE Free Qt // Foundation. In addition, as a special exception, Riverbank gives you // certain additional rights. These rights are described in the Riverbank // GPL Exception version 1.1, which can be found in the file // GPL_EXCEPTION.txt in this package. // // If you are unsure which license is appropriate for your use, please // contact the sales department at sales@riverbankcomputing.com. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. class QAbstractSocket : QIODevice { %TypeHeaderCode #include %End %ConvertToSubClassCode static struct class_graph { const char *name; sipTypeDef **type; int yes, no; } graph[] = { #if QT_VERSION >= 0x040500 {sipName_QAbstractNetworkCache, &sipType_QAbstractNetworkCache, 12, 1}, #else {0, 0, 12, 1}, #endif #if QT_VERSION >= 0x040700 {sipName_QNetworkConfigurationManager, &sipType_QNetworkConfigurationManager, -1, 2}, #else {0, 0, -1, 2}, #endif #if QT_VERSION >= 0x040400 {sipName_QNetworkAccessManager, &sipType_QNetworkAccessManager, -1, 3}, #else {0, 0, -1, 3}, #endif #if QT_VERSION >= 0x040400 {sipName_QNetworkReply, &sipType_QNetworkReply, -1, 4}, #else {0, 0, -1, 4}, #endif {sipName_QTcpServer, &sipType_QTcpServer, -1, 5}, #if QT_VERSION >= 0x040700 {sipName_QNetworkSession, &sipType_QNetworkSession, -1, 6}, #else {0, 0, -1, 6}, #endif {sipName_QFtp, &sipType_QFtp, -1, 7}, #if QT_VERSION >= 0x040400 {sipName_QNetworkCookieJar, &sipType_QNetworkCookieJar, -1, 8}, #else {0, 0, -1, 8}, #endif #if QT_VERSION >= 0x040400 {sipName_QLocalServer, &sipType_QLocalServer, -1, 9}, #else {0, 0, -1, 9}, #endif {sipName_QHttp, &sipType_QHttp, -1, 10}, #if QT_VERSION >= 0x040400 {sipName_QLocalSocket, &sipType_QLocalSocket, -1, 11}, #else {0, 0, -1, 11}, #endif {sipName_QAbstractSocket, &sipType_QAbstractSocket, 13, -1}, #if QT_VERSION >= 0x040500 {sipName_QNetworkDiskCache, &sipType_QNetworkDiskCache, -1, -1}, #else {0, 0, -1, -1}, #endif {sipName_QTcpSocket, &sipType_QTcpSocket, 15, 14}, {sipName_QUdpSocket, &sipType_QUdpSocket, -1, -1}, #if QT_VERSION >= 0x040300 && !defined(QT_NO_OPENSSL) {sipName_QSslSocket, &sipType_QSslSocket, -1, -1}, #else {0, 0, -1, -1}, #endif }; int i = 0; sipType = NULL; do { struct class_graph *cg = &graph[i]; if (cg->name != NULL && sipCpp->inherits(cg->name)) { sipType = *cg->type; i = cg->yes; } else i = cg->no; } while (i >= 0); %End public: enum SocketType { TcpSocket, UdpSocket, UnknownSocketType, }; enum NetworkLayerProtocol { IPv4Protocol, IPv6Protocol, UnknownNetworkLayerProtocol, }; enum SocketError { ConnectionRefusedError, RemoteHostClosedError, HostNotFoundError, SocketAccessError, SocketResourceError, SocketTimeoutError, DatagramTooLargeError, NetworkError, AddressInUseError, SocketAddressNotAvailableError, UnsupportedSocketOperationError, %If (Qt_4_3_0 -) UnfinishedSocketOperationError, %End %If (Qt_4_3_0 -) ProxyAuthenticationRequiredError, %End %If (Qt_4_4_0 -) SslHandshakeFailedError, %End %If (Qt_4_5_0 -) ProxyConnectionRefusedError, %End %If (Qt_4_5_0 -) ProxyConnectionClosedError, %End %If (Qt_4_5_0 -) ProxyConnectionTimeoutError, %End %If (Qt_4_5_0 -) ProxyNotFoundError, %End %If (Qt_4_5_0 -) ProxyProtocolError, %End UnknownSocketError, }; enum SocketState { UnconnectedState, HostLookupState, ConnectingState, ConnectedState, BoundState, ListeningState, ClosingState, }; QAbstractSocket(QAbstractSocket::SocketType socketType, QObject *parent /TransferThis/); virtual ~QAbstractSocket(); void connectToHost(const QString &hostName, quint16 port, QFlags mode = QIODevice::ReadWrite) /ReleaseGIL/; void connectToHost(const QHostAddress &address, quint16 port, QFlags mode = QIODevice::ReadWrite) /ReleaseGIL/; void disconnectFromHost() /ReleaseGIL/; bool isValid() const; virtual qint64 bytesAvailable() const; virtual qint64 bytesToWrite() const; virtual bool canReadLine() const; quint16 localPort() const; QHostAddress localAddress() const; quint16 peerPort() const; QHostAddress peerAddress() const; QString peerName() const; qint64 readBufferSize() const; void setReadBufferSize(qint64 size); void abort(); int socketDescriptor() const; bool setSocketDescriptor(int socketDescriptor, QAbstractSocket::SocketState state = QAbstractSocket::ConnectedState, QIODevice::OpenMode mode = QIODevice::ReadWrite); QAbstractSocket::SocketType socketType() const; QAbstractSocket::SocketState state() const; QAbstractSocket::SocketError error() const; virtual void close(); virtual bool isSequential() const; virtual bool atEnd() const; bool flush() /ReleaseGIL/; bool waitForConnected(int msecs = 30000) /ReleaseGIL/; virtual bool waitForReadyRead(int msecs = 30000) /ReleaseGIL/; virtual bool waitForBytesWritten(int msecs = 30000) /ReleaseGIL/; bool waitForDisconnected(int msecs = 30000) /ReleaseGIL/; void setProxy(const QNetworkProxy &networkProxy); QNetworkProxy proxy() const; signals: void hostFound(); void connected(); void disconnected(); void stateChanged(QAbstractSocket::SocketState); void error(QAbstractSocket::SocketError); %If (Qt_4_3_0 -) void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); %End protected slots: void connectToHostImplementation(const QString &hostName, quint16 port, QFlags mode = QIODevice::ReadWrite); void disconnectFromHostImplementation(); protected: virtual SIP_PYOBJECT readData(qint64 maxlen) /DocType="Py_v3:bytes;str",ReleaseGIL/ [qint64 (char *data, qint64 maxlen)]; %MethodCode // Return the data read or None if there was an error. if (a0 < 0) { PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); sipIsErr = 1; } else { char *s = new char[a0]; qint64 len; Py_BEGIN_ALLOW_THREADS #if defined(SIP_PROTECTED_IS_PUBLIC) len = sipSelfWasArg ? sipCpp->QAbstractSocket::readData(s, a0) : sipCpp->readData(s, a0); #else len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); #endif Py_END_ALLOW_THREADS if (len < 0) { Py_INCREF(Py_None); sipRes = Py_None; } else { sipRes = SIPBytes_FromStringAndSize(s, len); if (!sipRes) sipIsErr = 1; } delete[] s; } %End virtual SIP_PYOBJECT readLineData(qint64 maxlen) /DocType="Py_v3:bytes;str",ReleaseGIL/ [qint64 (char *data, qint64 maxlen)]; %MethodCode // Return the data read or None if there was an error. if (a0 < 0) { PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); sipIsErr = 1; } else { char *s = new char[a0]; qint64 len; Py_BEGIN_ALLOW_THREADS #if defined(SIP_PROTECTED_IS_PUBLIC) len = sipSelfWasArg ? sipCpp->QAbstractSocket::readLineData(s, a0) : sipCpp->readLineData(s, a0); #else len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0); #endif Py_END_ALLOW_THREADS if (len < 0) { Py_INCREF(Py_None); sipRes = Py_None; } else { sipRes = SIPBytes_FromStringAndSize(s, len); if (!sipRes) sipIsErr = 1; } delete[] s; } %End virtual qint64 writeData(const char *data /Array/, qint64 len /ArraySize/) /ReleaseGIL/; void setSocketState(QAbstractSocket::SocketState state); void setSocketError(QAbstractSocket::SocketError socketError); void setLocalPort(quint16 port); void setLocalAddress(const QHostAddress &address); void setPeerPort(quint16 port); void setPeerAddress(const QHostAddress &address); void setPeerName(const QString &name); public: %If (Qt_4_6_0 -) enum SocketOption { LowDelayOption, KeepAliveOption, }; %End %If (Qt_4_6_0 -) void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); %End %If (Qt_4_6_0 -) QVariant socketOption(QAbstractSocket::SocketOption option); %End private: QAbstractSocket(const QAbstractSocket &); };