From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- src/network/ntqdns.h | 170 +++++++++++++++++++++++ src/network/ntqftp.h | 202 +++++++++++++++++++++++++++ src/network/ntqhostaddress.h | 101 ++++++++++++++ src/network/ntqhttp.h | 277 +++++++++++++++++++++++++++++++++++++ src/network/ntqnetwork.h | 60 ++++++++ src/network/ntqserversocket.h | 94 +++++++++++++ src/network/ntqsocket.h | 156 +++++++++++++++++++++ src/network/ntqsocketdevice.h | 170 +++++++++++++++++++++++ src/network/qdns.cpp | 30 ++-- src/network/qdns.h | 170 ----------------------- src/network/qftp.cpp | 24 ++-- src/network/qftp.h | 202 --------------------------- src/network/qhostaddress.cpp | 6 +- src/network/qhostaddress.h | 101 -------------- src/network/qhttp.cpp | 28 ++-- src/network/qhttp.h | 277 ------------------------------------- src/network/qnetwork.cpp | 12 +- src/network/qnetwork.h | 60 -------- src/network/qserversocket.cpp | 6 +- src/network/qserversocket.h | 94 ------------- src/network/qsocket.cpp | 12 +- src/network/qsocket.h | 156 --------------------- src/network/qsocketdevice.cpp | 6 +- src/network/qsocketdevice.h | 170 ----------------------- src/network/qsocketdevice_unix.cpp | 4 +- src/network/qt_network.pri | 16 +-- 26 files changed, 1302 insertions(+), 1302 deletions(-) create mode 100644 src/network/ntqdns.h create mode 100644 src/network/ntqftp.h create mode 100644 src/network/ntqhostaddress.h create mode 100644 src/network/ntqhttp.h create mode 100644 src/network/ntqnetwork.h create mode 100644 src/network/ntqserversocket.h create mode 100644 src/network/ntqsocket.h create mode 100644 src/network/ntqsocketdevice.h delete mode 100644 src/network/qdns.h delete mode 100644 src/network/qftp.h delete mode 100644 src/network/qhostaddress.h delete mode 100644 src/network/qhttp.h delete mode 100644 src/network/qnetwork.h delete mode 100644 src/network/qserversocket.h delete mode 100644 src/network/qsocket.h delete mode 100644 src/network/qsocketdevice.h (limited to 'src/network') diff --git a/src/network/ntqdns.h b/src/network/ntqdns.h new file mode 100644 index 000000000..96f09d265 --- /dev/null +++ b/src/network/ntqdns.h @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Definition of TQDns class. +** +** Created : 991122 +** +** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQDNS_H +#define TQDNS_H + +#ifndef QT_H +#include "ntqobject.h" +#include "ntqhostaddress.h" +#include "ntqsocketnotifier.h" +#include "ntqstringlist.h" +#endif // QT_H + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_DNS +#else +#define TQM_EXPORT_DNS Q_EXPORT +#endif + +#ifndef QT_NO_DNS + +//#define Q_DNS_SYNCHRONOUS + +class TQDnsPrivate; + +class TQM_EXPORT_DNS TQDns: public TQObject { + Q_OBJECT +public: + enum RecordType { + None, + A, Aaaa, + Mx, Srv, + Cname, + Ptr, + Txt + }; + + TQDns(); + TQDns( const TQString & label, RecordType rr = A ); + TQDns( const TQHostAddress & address, RecordType rr = Ptr ); + virtual ~TQDns(); + + // to set/change the query + virtual void setLabel( const TQString & label ); + virtual void setLabel( const TQHostAddress & address ); + TQString label() const { return l; } + + virtual void setRecordType( RecordType rr = A ); + RecordType recordType() const { return t; } + + // whether something is happening behind the scenes + bool isWorking() const; + + // to query for replies + TQValueList addresses() const; + + class TQM_EXPORT_DNS MailServer { + public: + MailServer( const TQString & n=TQString::null, Q_UINT16 p=0 ) + :name(n), priority(p) {} + TQString name; + Q_UINT16 priority; + Q_DUMMY_COMPARISON_OPERATOR(MailServer) + }; + TQValueList mailServers() const; + + class TQM_EXPORT_DNS Server { + public: + Server(const TQString & n=TQString::null, Q_UINT16 p=0, Q_UINT16 w=0, Q_UINT16 po=0 ) + : name(n), priority(p), weight(w), port(po) {} + TQString name; + Q_UINT16 priority; + Q_UINT16 weight; + Q_UINT16 port; + Q_DUMMY_COMPARISON_OPERATOR(Server) + }; + TQValueList servers() const; + + TQStringList hostNames() const; + + TQStringList texts() const; + + TQString canonicalName() const; // ### real-world but uncommon: TQStringList + + TQStringList qualifiedNames() const { return n; } + +#if defined(Q_DNS_SYNCHRONOUS) +protected: + void connectNotify( const char *signal ); +#endif + +signals: + void resultsReady(); + +private slots: + void startQuery(); + +private: + static void doResInit(); + void setStartQueryTimer(); + static TQString toInAddrArpaDomain( const TQHostAddress &address ); +#if defined(Q_DNS_SYNCHRONOUS) + void doSynchronousLookup(); +#endif + + TQString l; + TQStringList n; + RecordType t; + TQDnsPrivate * d; + + friend class TQDnsAnswer; + friend class TQDnsManager; +}; + + +// TQDnsSocket are sockets that are used for DNS lookup + +class TQDnsSocket: public TQObject { + Q_OBJECT + // note: Private not public. This class contains NO public API. +protected: + TQDnsSocket( TQObject *, const char * ); + virtual ~TQDnsSocket(); + +private slots: + virtual void cleanCache(); + virtual void retransmit(); + virtual void answer(); +}; + +#endif // QT_NO_DNS + +#endif // TQDNS_H diff --git a/src/network/ntqftp.h b/src/network/ntqftp.h new file mode 100644 index 000000000..86ba65822 --- /dev/null +++ b/src/network/ntqftp.h @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Definition of TQFtp class. +** +** Created : 970521 +** +** Copyright (C) 1997-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQFTP_H +#define TQFTP_H + +#ifndef QT_H +#include "ntqstring.h" // char*->TQString conversion +#include "ntqurlinfo.h" +#include "ntqnetworkprotocol.h" +#endif // QT_H + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_FTP +#else +#define TQM_EXPORT_FTP Q_EXPORT +#endif + +#ifndef QT_NO_NETWORKPROTOCOL_FTP + + +class TQSocket; +class TQFtpCommand; + +class TQM_EXPORT_FTP TQFtp : public TQNetworkProtocol +{ + Q_OBJECT + +public: + TQFtp(); // ### TQt 4.0: get rid of this overload + TQFtp( TQObject *parent, const char *name=0 ); + virtual ~TQFtp(); + + int supportedOperations() const; + + // non-TQNetworkProtocol functions: + enum State { + Unconnected, + HostLookup, + Connecting, + Connected, + LoggedIn, + Closing + }; + enum Error { + NoError, + UnknownError, + HostNotFound, + ConnectionRefused, + NotConnected + }; + enum Command { + None, + ConnectToHost, + Login, + Close, + List, + Cd, + Get, + Put, + Remove, + Mkdir, + Rmdir, + Rename, + RawCommand + }; + + int connectToHost( const TQString &host, Q_UINT16 port=21 ); + int login( const TQString &user=TQString::null, const TQString &password=TQString::null ); + int close(); + int list( const TQString &dir=TQString::null ); + int cd( const TQString &dir ); + int get( const TQString &file, TQIODevice *dev=0 ); + int put( const TQByteArray &data, const TQString &file ); + int put( TQIODevice *dev, const TQString &file ); + int remove( const TQString &file ); + int mkdir( const TQString &dir ); + int rmdir( const TQString &dir ); + int rename( const TQString &oldname, const TQString &newname ); + + int rawCommand( const TQString &command ); + + Q_ULONG bytesAvailable() const; + Q_LONG readBlock( char *data, Q_ULONG maxlen ); + TQByteArray readAll(); + + int currentId() const; + TQIODevice* currentDevice() const; + Command currentCommand() const; + bool hasPendingCommands() const; + void clearPendingCommands(); + + State state() const; + + Error error() const; + TQString errorString() const; + +public slots: + void abort(); + +signals: + void stateChanged( int ); + void listInfo( const TQUrlInfo& ); + void readyRead(); + void dataTransferProgress( int, int ); + void rawCommandReply( int, const TQString& ); + + void commandStarted( int ); + void commandFinished( int, bool ); + void done( bool ); + +protected: + void parseDir( const TQString &buffer, TQUrlInfo &info ); // ### TQt 4.0: delete this? (not public API) + void operationListChildren( TQNetworkOperation *op ); + void operationMkDir( TQNetworkOperation *op ); + void operationRemove( TQNetworkOperation *op ); + void operationRename( TQNetworkOperation *op ); + void operationGet( TQNetworkOperation *op ); + void operationPut( TQNetworkOperation *op ); + + // ### TQt 4.0: delete these + // unused variables: + TQSocket *commandSocket, *dataSocket; + bool connectionReady, passiveMode; + int getTotalSize, getDoneSize; + bool startGetOnFail; + int putToWrite, putWritten; + bool errorInListChildren; + +private: + void init(); + int addCommand( TQFtpCommand * ); + + bool checkConnection( TQNetworkOperation *op ); + +private slots: + void startNextCommand(); + void piFinished( const TQString& ); + void piError( int, const TQString& ); + void piConnectState( int ); + void piFtpReply( int, const TQString& ); + +private slots: + void npListInfo( const TQUrlInfo & ); + void npDone( bool ); + void npStateChanged( int ); + void npDataTransferProgress( int, int ); + void npReadyRead(); + +protected slots: + // ### TQt 4.0: delete these + void hostFound(); + void connected(); + void closed(); + void dataHostFound(); + void dataConnected(); + void dataClosed(); + void dataReadyRead(); + void dataBytesWritten( int nbytes ); + void error( int ); +}; + +#endif // QT_NO_NETWORKPROTOCOL_FTP + +#endif // TQFTP_H diff --git a/src/network/ntqhostaddress.h b/src/network/ntqhostaddress.h new file mode 100644 index 000000000..17de16289 --- /dev/null +++ b/src/network/ntqhostaddress.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Definition of TQHostAddress class. +** +** Created : 979899 +** +** Copyright (C) 1997-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQHOSTADDRESS_H +#define TQHOSTADDRESS_H + +#ifndef QT_H +#include "ntqstring.h" +#endif // QT_H + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_NETWORK +#else +#define TQM_EXPORT_NETWORK Q_EXPORT +#endif + +#ifndef QT_NO_NETWORK +class TQHostAddressPrivate; + +typedef struct { + Q_UINT8 c[16]; +} Q_IPV6ADDR; + +class TQM_EXPORT_NETWORK TQHostAddress +{ +public: + TQHostAddress(); + TQHostAddress( Q_UINT32 ip4Addr ); + TQHostAddress( Q_UINT8 *ip6Addr ); + TQHostAddress(const Q_IPV6ADDR &ip6Addr); +#ifndef QT_NO_STRINGLIST + TQHostAddress(const TQString &address); +#endif + TQHostAddress( const TQHostAddress & ); + virtual ~TQHostAddress(); + + TQHostAddress & operator=( const TQHostAddress & ); + + void setAddress( Q_UINT32 ip4Addr ); + void setAddress( Q_UINT8 *ip6Addr ); +#ifndef QT_NO_STRINGLIST + bool setAddress( const TQString& address ); +#endif + bool isIp4Addr() const; // obsolete + Q_UINT32 ip4Addr() const; // obsolete + + bool isIPv4Address() const; + Q_UINT32 toIPv4Address() const; + bool isIPv6Address() const; + Q_IPV6ADDR toIPv6Address() const; + +#ifndef QT_NO_SPRINTF + TQString toString() const; +#endif + + bool operator==( const TQHostAddress & ) const; + bool isNull() const; + +private: + TQHostAddressPrivate* d; +}; + +#endif //QT_NO_NETWORK +#endif diff --git a/src/network/ntqhttp.h b/src/network/ntqhttp.h new file mode 100644 index 000000000..f0f9d2ea9 --- /dev/null +++ b/src/network/ntqhttp.h @@ -0,0 +1,277 @@ +/**************************************************************************** +** +** Definition of TQHttp and related classes. +** +** Created : 970521 +** +** Copyright (C) 1997-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQHTTP_H +#define TQHTTP_H + +#ifndef QT_H +#include "ntqobject.h" +#include "ntqnetworkprotocol.h" +#include "ntqstringlist.h" +#endif // QT_H + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_HTTP +#define TQM_TEMPLATE_EXTERN_HTTP +#else +#define TQM_EXPORT_HTTP Q_EXPORT +#define TQM_TEMPLATE_EXTERN_HTTP Q_TEMPLATE_EXTERN +#endif + +#ifndef QT_NO_NETWORKPROTOCOL_HTTP + +class TQSocket; +class TQTimerEvent; +class TQTextStream; +class TQIODevice; + +class TQHttpPrivate; +class TQHttpRequest; + +class TQM_EXPORT_HTTP TQHttpHeader +{ +public: + TQHttpHeader(); + TQHttpHeader( const TQHttpHeader& header ); + TQHttpHeader( const TQString& str ); + virtual ~TQHttpHeader(); + + TQHttpHeader& operator=( const TQHttpHeader& h ); + + TQString value( const TQString& key ) const; + void setValue( const TQString& key, const TQString& value ); + void removeValue( const TQString& key ); + + TQStringList keys() const; + bool hasKey( const TQString& key ) const; + + bool hasContentLength() const; + uint contentLength() const; + void setContentLength( int len ); + + bool hasContentType() const; + TQString contentType() const; + void setContentType( const TQString& type ); + + virtual TQString toString() const; + bool isValid() const; + + virtual int majorVersion() const = 0; + virtual int minorVersion() const = 0; + +protected: + virtual bool parseLine( const TQString& line, int number ); + bool parse( const TQString& str ); + void setValid( bool ); + +private: + TQMap values; + bool valid; +}; + +class TQM_EXPORT_HTTP TQHttpResponseHeader : public TQHttpHeader +{ +private: + TQHttpResponseHeader( int code, const TQString& text = TQString::null, int majorVer = 1, int minorVer = 1 ); + TQHttpResponseHeader( const TQString& str ); + + void setStatusLine( int code, const TQString& text = TQString::null, int majorVer = 1, int minorVer = 1 ); + +public: + TQHttpResponseHeader(); + TQHttpResponseHeader( const TQHttpResponseHeader& header ); + + int statusCode() const; + TQString reasonPhrase() const; + + int majorVersion() const; + int minorVersion() const; + + TQString toString() const; + +protected: + bool parseLine( const TQString& line, int number ); + +private: + int statCode; + TQString reasonPhr; + int majVer; + int minVer; + + friend class TQHttp; +}; + +class TQM_EXPORT_HTTP TQHttpRequestHeader : public TQHttpHeader +{ +public: + TQHttpRequestHeader(); + TQHttpRequestHeader( const TQString& method, const TQString& path, int majorVer = 1, int minorVer = 1 ); + TQHttpRequestHeader( const TQHttpRequestHeader& header ); + TQHttpRequestHeader( const TQString& str ); + + void setRequest( const TQString& method, const TQString& path, int majorVer = 1, int minorVer = 1 ); + + TQString method() const; + TQString path() const; + + int majorVersion() const; + int minorVersion() const; + + TQString toString() const; + +protected: + bool parseLine( const TQString& line, int number ); + +private: + TQString m; + TQString p; + int majVer; + int minVer; +}; + +class TQM_EXPORT_HTTP TQHttp : public TQNetworkProtocol +{ + Q_OBJECT + +public: + TQHttp(); + TQHttp( TQObject* parent, const char* name = 0 ); // ### TQt 4.0: make parent=0 and get rid of the TQHttp() constructor + TQHttp( const TQString &hostname, Q_UINT16 port=80, TQObject* parent=0, const char* name = 0 ); + virtual ~TQHttp(); + + int supportedOperations() const; + + enum State { Unconnected, HostLookup, Connecting, Sending, Reading, Connected, Closing }; + enum Error { + NoError, + UnknownError, + HostNotFound, + ConnectionRefused, + UnexpectedClose, + InvalidResponseHeader, + WrongContentLength, + Aborted + }; + + int setHost(const TQString &hostname, Q_UINT16 port=80 ); + + int get( const TQString& path, TQIODevice* to=0 ); + int post( const TQString& path, TQIODevice* data, TQIODevice* to=0 ); + int post( const TQString& path, const TQByteArray& data, TQIODevice* to=0 ); + int head( const TQString& path ); + int request( const TQHttpRequestHeader &header, TQIODevice *device=0, TQIODevice *to=0 ); + int request( const TQHttpRequestHeader &header, const TQByteArray &data, TQIODevice *to=0 ); + + int closeConnection(); + + Q_ULONG bytesAvailable() const; + Q_LONG readBlock( char *data, Q_ULONG maxlen ); + TQByteArray readAll(); + + int currentId() const; + TQIODevice* currentSourceDevice() const; + TQIODevice* currentDestinationDevice() const; + TQHttpRequestHeader currentRequest() const; + bool hasPendingRequests() const; + void clearPendingRequests(); + + State state() const; + + Error error() const; + TQString errorString() const; + +public slots: + void abort(); + +signals: + void stateChanged( int ); + void responseHeaderReceived( const TQHttpResponseHeader& resp ); + void readyRead( const TQHttpResponseHeader& resp ); + void dataSendProgress( int, int ); + void dataReadProgress( int, int ); + + void requestStarted( int ); + void requestFinished( int, bool ); + void done( bool ); + +protected: + void operationGet( TQNetworkOperation *op ); + void operationPut( TQNetworkOperation *op ); + + void timerEvent( TQTimerEvent * ); + +private slots: + void clientReply( const TQHttpResponseHeader &rep ); + void clientDone( bool ); + void clientStateChanged( int ); + + void startNextRequest(); + void slotReadyRead(); + void slotConnected(); + void slotError( int ); + void slotClosed(); + void slotBytesWritten( int ); + +private: + TQHttpPrivate *d; + void *unused; // ### TQt 4.0: remove this (in for binary compatibility) + int bytesRead; + + int addRequest( TQHttpRequest * ); + void sendRequest(); + void finishedWithSuccess(); + void finishedWithError( const TQString& detail, int errorCode ); + + void killIdleTimer(); + + void init(); + void setState( int ); + void close(); + + friend class TQHttpNormalRequest; + friend class TQHttpSetHostRequest; + friend class TQHttpCloseRequest; + friend class TQHttpPGHRequest; +}; + +#define Q_DEFINED_QHTTP +#include "ntqwinexport.h" +#endif +#endif diff --git a/src/network/ntqnetwork.h b/src/network/ntqnetwork.h new file mode 100644 index 000000000..0565ea514 --- /dev/null +++ b/src/network/ntqnetwork.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Definition of qInitNetworkProtocols function. +** +** Created : 970521 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQNETWORK_H +#define TQNETWORK_H + +#ifndef QT_H +#include "ntqglobal.h" +#endif // QT_H + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_NETWORK +#else +#define TQM_EXPORT_NETWORK Q_EXPORT +#endif + +#ifndef QT_NO_NETWORK + +TQM_EXPORT_NETWORK void qInitNetworkProtocols(); + +#endif + +#endif diff --git a/src/network/ntqserversocket.h b/src/network/ntqserversocket.h new file mode 100644 index 000000000..b5c2a4b88 --- /dev/null +++ b/src/network/ntqserversocket.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Definition of TQServerSocketClass. +** +** Created : 970521 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSERVERSOCKET_H +#define TQSERVERSOCKET_H + +#ifndef QT_H +#include "ntqobject.h" +#include "ntqhostaddress.h" +#include "ntqsocketdevice.h" // ### remove or keep for users' convenience? +#endif // QT_H +#ifndef QT_NO_NETWORK + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_NETWORK +#else +#define TQM_EXPORT_NETWORK Q_EXPORT +#endif + +class TQServerSocketPrivate; + + +class TQM_EXPORT_NETWORK TQServerSocket : public TQObject +{ + Q_OBJECT +public: + TQServerSocket( Q_UINT16 port, int backlog = 1, + TQObject *parent=0, const char *name=0 ); + TQServerSocket( const TQHostAddress & address, Q_UINT16 port, int backlog = 1, + TQObject *parent=0, const char *name=0 ); + TQServerSocket( TQObject *parent=0, const char *name=0 ); + virtual ~TQServerSocket(); + + bool ok() const; + + Q_UINT16 port() const ; + + int socket() const ; + virtual void setSocket( int socket ); + + TQHostAddress address() const ; + + virtual void newConnection( int socket ) = 0; + +protected: + TQSocketDevice *socketDevice(); + +private slots: + void incomingConnection( int socket ); + +private: + TQServerSocketPrivate *d; + void init( const TQHostAddress & address, Q_UINT16 port, int backlog ); +}; + +#endif // QT_NO_NETWORK +#endif // TQSERVERSOCKET_H diff --git a/src/network/ntqsocket.h b/src/network/ntqsocket.h new file mode 100644 index 000000000..2a727dd30 --- /dev/null +++ b/src/network/ntqsocket.h @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Definition of TQSocket class. +** +** Created : 970521 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSOCKET_H +#define TQSOCKET_H + +#ifndef QT_H +#include "ntqobject.h" +#include "ntqiodevice.h" +#include "ntqhostaddress.h" // int->TQHostAddress conversion +#endif // QT_H + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_NETWORK +#else +#define TQM_EXPORT_NETWORK Q_EXPORT +#endif + +#ifndef QT_NO_NETWORK +class TQSocketPrivate; +class TQSocketDevice; + + +class TQM_EXPORT_NETWORK TQSocket : public TQObject, public TQIODevice +{ + Q_OBJECT +public: + enum Error { + ErrConnectionRefused, + ErrHostNotFound, + ErrSocketRead + }; + + TQSocket( TQObject *parent=0, const char *name=0 ); + virtual ~TQSocket(); + + enum State { Idle, HostLookup, Connecting, + Connected, Closing, + Connection=Connected }; + State state() const; + + int socket() const; + virtual void setSocket( int ); + + TQSocketDevice *socketDevice(); + virtual void setSocketDevice( TQSocketDevice * ); + +#ifndef QT_NO_DNS + virtual void connectToHost( const TQString &host, Q_UINT16 port ); +#endif + TQString peerName() const; + + // Implementation of TQIODevice abstract virtual functions + bool open( int mode ); + void close(); + void flush(); + Offset size() const; + Offset at() const; + bool at( Offset ); + bool atEnd() const; + + Q_ULONG bytesAvailable() const; // ### TQIODevice::Offset instead? + Q_ULONG waitForMore( int msecs, bool *timeout ) const; + Q_ULONG waitForMore( int msecs ) const; // ### TQt 4.0: merge the two overloads + Q_ULONG bytesToWrite() const; + void clearPendingData(); + + Q_LONG readBlock( char *data, Q_ULONG maxlen ); + Q_LONG writeBlock( const char *data, Q_ULONG len ); + Q_LONG readLine( char *data, Q_ULONG maxlen ); + + int getch(); + int putch( int ); + int ungetch(int); + + bool canReadLine() const; + virtual TQString readLine(); + + Q_UINT16 port() const; + Q_UINT16 peerPort() const; + TQHostAddress address() const; + TQHostAddress peerAddress() const; + + void setReadBufferSize( Q_ULONG ); + Q_ULONG readBufferSize() const; + +signals: + void hostFound(); + void connected(); + void connectionClosed(); + void delayedCloseFinished(); + void readyRead(); + void bytesWritten( int nbytes ); + void error( int ); + +protected slots: + virtual void sn_read( bool force=FALSE ); + virtual void sn_write(); + +private slots: + void tryConnecting(); + void emitErrorConnectionRefused(); + +private: + TQSocketPrivate *d; + + bool consumeWriteBuf( Q_ULONG nbytes ); + void tryConnection(); + void setSocketIntern( int socket ); + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + TQSocket( const TQSocket & ); + TQSocket &operator=( const TQSocket & ); +#endif +}; + +#endif //QT_NO_NETWORK +#endif // TQSOCKET_H diff --git a/src/network/ntqsocketdevice.h b/src/network/ntqsocketdevice.h new file mode 100644 index 000000000..bd3d62225 --- /dev/null +++ b/src/network/ntqsocketdevice.h @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Definition of TQSocketDevice class. +** +** Created : 970521 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the network module of the TQt GUI Toolkit. +** +** 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 Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSOCKETDEVICE_H +#define TQSOCKETDEVICE_H + +#ifndef QT_H +#include "ntqiodevice.h" +#include "ntqhostaddress.h" // int->TQHostAddress conversion +#endif // QT_H + +#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) +#define TQM_EXPORT_NETWORK +#else +#define TQM_EXPORT_NETWORK Q_EXPORT +#endif + +#ifndef QT_NO_NETWORK +class TQSocketDevicePrivate; + + +class TQM_EXPORT_NETWORK TQSocketDevice: public TQIODevice +{ +public: + enum Type { Stream, Datagram }; + enum Protocol { IPv4, IPv6, Unknown }; + + TQSocketDevice( Type type = Stream ); + TQSocketDevice( Type type, Protocol protocol, int dummy ); + TQSocketDevice( int socket, Type type ); + virtual ~TQSocketDevice(); + + bool isValid() const; + Type type() const; + Protocol protocol() const; + + int socket() const; + virtual void setSocket( int socket, Type type ); + + bool open( int mode ); + void close(); + void flush(); + + // Implementation of TQIODevice abstract virtual functions + Offset size() const; + Offset at() const; + bool at( Offset ); + bool atEnd() const; + + bool blocking() const; + virtual void setBlocking( bool ); + + bool addressReusable() const; + virtual void setAddressReusable( bool ); + + int receiveBufferSize() const; + virtual void setReceiveBufferSize( uint ); + int sendBufferSize() const; + virtual void setSendBufferSize( uint ); + + virtual bool connect( const TQHostAddress &, Q_UINT16 ); + + virtual bool bind( const TQHostAddress &, Q_UINT16 ); + virtual bool listen( int backlog ); + virtual int accept(); + + Q_LONG bytesAvailable() const; + Q_LONG waitForMore( int msecs, bool *timeout=0 ) const; + Q_LONG readBlock( char *data, Q_ULONG maxlen ); + Q_LONG writeBlock( const char *data, Q_ULONG len ); + virtual Q_LONG writeBlock( const char *data, Q_ULONG len, + const TQHostAddress & host, Q_UINT16 port ); + + int getch(); + int putch( int ); + int ungetch(int); + + Q_UINT16 port() const; + Q_UINT16 peerPort() const; + TQHostAddress address() const; + TQHostAddress peerAddress() const; + + enum Error { + NoError, + AlreadyBound, + Inaccessible, + NoResources, + InternalError, + Bug = InternalError, // ### remove in 4.0? + Impossible, + NoFiles, + ConnectionRefused, + NetworkFailure, + UnknownError + }; + Error error() const; + +protected: + void setError( Error err ); + +private: + int fd; + Type t; + Q_UINT16 p; + TQHostAddress a; + Q_UINT16 pp; + TQHostAddress pa; + TQSocketDevice::Error e; + TQSocketDevicePrivate * d; + + enum Option { Broadcast, ReceiveBuffer, ReuseAddress, SendBuffer }; + + int option( Option ) const; + virtual void setOption( Option, int ); + + void fetchConnectionParameters(); +#if defined(Q_OS_WIN32) + void fetchPeerConnectionParameters(); +#endif + + static void init(); + int createNewSocket(); + Protocol getProtocol() const; + +private: // Disabled copy constructor and operator= +#if defined(Q_DISABLE_COPY) + TQSocketDevice( const TQSocketDevice & ); + TQSocketDevice &operator=( const TQSocketDevice & ); +#endif +}; + +#endif // QT_NO_NETWORK +#endif // TQSOCKETDEVICE_H diff --git a/src/network/qdns.cpp b/src/network/qdns.cpp index 1b896e552..e6dafa6c6 100644 --- a/src/network/qdns.cpp +++ b/src/network/qdns.cpp @@ -60,23 +60,23 @@ # undef socket #endif -#include "qdns.h" +#include "ntqdns.h" #ifndef QT_NO_DNS -#include "qdatetime.h" -#include "qdict.h" -#include "qptrlist.h" -#include "qstring.h" -#include "qtimer.h" -#include "qapplication.h" -#include "qptrvector.h" -#include "qstrlist.h" -#include "qptrdict.h" -#include "qfile.h" -#include "qtextstream.h" -#include "qsocketdevice.h" -#include "qcleanuphandler.h" +#include "ntqdatetime.h" +#include "ntqdict.h" +#include "ntqptrlist.h" +#include "ntqstring.h" +#include "ntqtimer.h" +#include "ntqapplication.h" +#include "ntqptrvector.h" +#include "ntqstrlist.h" +#include "ntqptrdict.h" +#include "ntqfile.h" +#include "ntqtextstream.h" +#include "ntqsocketdevice.h" +#include "ntqcleanuphandler.h" #include #ifdef Q_OS_MAC #include "../3rdparty/dlcompat/dlfcn.h" @@ -1598,7 +1598,7 @@ void TQDnsSocket::answer() /*! - \class TQDns qdns.h + \class TQDns ntqdns.h \brief The TQDns class provides asynchronous DNS lookups. \if defined(commercial) It is part of the TQt Enterprise Edition. diff --git a/src/network/qdns.h b/src/network/qdns.h deleted file mode 100644 index a14d2024f..000000000 --- a/src/network/qdns.h +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Definition of TQDns class. -** -** Created : 991122 -** -** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQDNS_H -#define TQDNS_H - -#ifndef QT_H -#include "qobject.h" -#include "qhostaddress.h" -#include "qsocketnotifier.h" -#include "qstringlist.h" -#endif // QT_H - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_DNS -#else -#define TQM_EXPORT_DNS Q_EXPORT -#endif - -#ifndef QT_NO_DNS - -//#define Q_DNS_SYNCHRONOUS - -class TQDnsPrivate; - -class TQM_EXPORT_DNS TQDns: public TQObject { - Q_OBJECT -public: - enum RecordType { - None, - A, Aaaa, - Mx, Srv, - Cname, - Ptr, - Txt - }; - - TQDns(); - TQDns( const TQString & label, RecordType rr = A ); - TQDns( const TQHostAddress & address, RecordType rr = Ptr ); - virtual ~TQDns(); - - // to set/change the query - virtual void setLabel( const TQString & label ); - virtual void setLabel( const TQHostAddress & address ); - TQString label() const { return l; } - - virtual void setRecordType( RecordType rr = A ); - RecordType recordType() const { return t; } - - // whether something is happening behind the scenes - bool isWorking() const; - - // to query for replies - TQValueList addresses() const; - - class TQM_EXPORT_DNS MailServer { - public: - MailServer( const TQString & n=TQString::null, Q_UINT16 p=0 ) - :name(n), priority(p) {} - TQString name; - Q_UINT16 priority; - Q_DUMMY_COMPARISON_OPERATOR(MailServer) - }; - TQValueList mailServers() const; - - class TQM_EXPORT_DNS Server { - public: - Server(const TQString & n=TQString::null, Q_UINT16 p=0, Q_UINT16 w=0, Q_UINT16 po=0 ) - : name(n), priority(p), weight(w), port(po) {} - TQString name; - Q_UINT16 priority; - Q_UINT16 weight; - Q_UINT16 port; - Q_DUMMY_COMPARISON_OPERATOR(Server) - }; - TQValueList servers() const; - - TQStringList hostNames() const; - - TQStringList texts() const; - - TQString canonicalName() const; // ### real-world but uncommon: TQStringList - - TQStringList qualifiedNames() const { return n; } - -#if defined(Q_DNS_SYNCHRONOUS) -protected: - void connectNotify( const char *signal ); -#endif - -signals: - void resultsReady(); - -private slots: - void startQuery(); - -private: - static void doResInit(); - void setStartQueryTimer(); - static TQString toInAddrArpaDomain( const TQHostAddress &address ); -#if defined(Q_DNS_SYNCHRONOUS) - void doSynchronousLookup(); -#endif - - TQString l; - TQStringList n; - RecordType t; - TQDnsPrivate * d; - - friend class TQDnsAnswer; - friend class TQDnsManager; -}; - - -// TQDnsSocket are sockets that are used for DNS lookup - -class TQDnsSocket: public TQObject { - Q_OBJECT - // note: Private not public. This class contains NO public API. -protected: - TQDnsSocket( TQObject *, const char * ); - virtual ~TQDnsSocket(); - -private slots: - virtual void cleanCache(); - virtual void retransmit(); - virtual void answer(); -}; - -#endif // QT_NO_DNS - -#endif // TQDNS_H diff --git a/src/network/qftp.cpp b/src/network/qftp.cpp index 78f29e8cd..441cdda5c 100644 --- a/src/network/qftp.cpp +++ b/src/network/qftp.cpp @@ -38,22 +38,22 @@ ** **********************************************************************/ -#include "qftp.h" +#include "ntqftp.h" #ifndef QT_NO_NETWORKPROTOCOL_FTP -#include "qsocket.h" -#include "qsocketdevice.h" -#include "qurlinfo.h" -#include "qurloperator.h" -#include "qstringlist.h" -#include "qregexp.h" -#include "qtimer.h" -#include "qfileinfo.h" -#include "qptrdict.h" // binary compatibility +#include "ntqsocket.h" +#include "ntqsocketdevice.h" +#include "ntqurlinfo.h" +#include "ntqurloperator.h" +#include "ntqstringlist.h" +#include "ntqregexp.h" +#include "ntqtimer.h" +#include "ntqfileinfo.h" +#include "ntqptrdict.h" // binary compatibility #ifndef QT_NO_TEXTCODEC -#include "qtextcodec.h" +#include "ntqtextcodec.h" #endif //#define TQFTPPI_DEBUG @@ -1064,7 +1064,7 @@ static void delete_d( const TQFtp* foo ) * *********************************************************************/ /*! - \class TQFtp qftp.h + \class TQFtp ntqftp.h \brief The TQFtp class provides an implementation of the FTP protocol. \if defined(commercial) It is part of the TQt Enterprise Edition. diff --git a/src/network/qftp.h b/src/network/qftp.h deleted file mode 100644 index 475eed1f0..000000000 --- a/src/network/qftp.h +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** -** -** Definition of TQFtp class. -** -** Created : 970521 -** -** Copyright (C) 1997-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQFTP_H -#define TQFTP_H - -#ifndef QT_H -#include "qstring.h" // char*->TQString conversion -#include "qurlinfo.h" -#include "qnetworkprotocol.h" -#endif // QT_H - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_FTP -#else -#define TQM_EXPORT_FTP Q_EXPORT -#endif - -#ifndef QT_NO_NETWORKPROTOCOL_FTP - - -class TQSocket; -class TQFtpCommand; - -class TQM_EXPORT_FTP TQFtp : public TQNetworkProtocol -{ - Q_OBJECT - -public: - TQFtp(); // ### TQt 4.0: get rid of this overload - TQFtp( TQObject *parent, const char *name=0 ); - virtual ~TQFtp(); - - int supportedOperations() const; - - // non-TQNetworkProtocol functions: - enum State { - Unconnected, - HostLookup, - Connecting, - Connected, - LoggedIn, - Closing - }; - enum Error { - NoError, - UnknownError, - HostNotFound, - ConnectionRefused, - NotConnected - }; - enum Command { - None, - ConnectToHost, - Login, - Close, - List, - Cd, - Get, - Put, - Remove, - Mkdir, - Rmdir, - Rename, - RawCommand - }; - - int connectToHost( const TQString &host, Q_UINT16 port=21 ); - int login( const TQString &user=TQString::null, const TQString &password=TQString::null ); - int close(); - int list( const TQString &dir=TQString::null ); - int cd( const TQString &dir ); - int get( const TQString &file, TQIODevice *dev=0 ); - int put( const TQByteArray &data, const TQString &file ); - int put( TQIODevice *dev, const TQString &file ); - int remove( const TQString &file ); - int mkdir( const TQString &dir ); - int rmdir( const TQString &dir ); - int rename( const TQString &oldname, const TQString &newname ); - - int rawCommand( const TQString &command ); - - Q_ULONG bytesAvailable() const; - Q_LONG readBlock( char *data, Q_ULONG maxlen ); - TQByteArray readAll(); - - int currentId() const; - TQIODevice* currentDevice() const; - Command currentCommand() const; - bool hasPendingCommands() const; - void clearPendingCommands(); - - State state() const; - - Error error() const; - TQString errorString() const; - -public slots: - void abort(); - -signals: - void stateChanged( int ); - void listInfo( const TQUrlInfo& ); - void readyRead(); - void dataTransferProgress( int, int ); - void rawCommandReply( int, const TQString& ); - - void commandStarted( int ); - void commandFinished( int, bool ); - void done( bool ); - -protected: - void parseDir( const TQString &buffer, TQUrlInfo &info ); // ### TQt 4.0: delete this? (not public API) - void operationListChildren( TQNetworkOperation *op ); - void operationMkDir( TQNetworkOperation *op ); - void operationRemove( TQNetworkOperation *op ); - void operationRename( TQNetworkOperation *op ); - void operationGet( TQNetworkOperation *op ); - void operationPut( TQNetworkOperation *op ); - - // ### TQt 4.0: delete these - // unused variables: - TQSocket *commandSocket, *dataSocket; - bool connectionReady, passiveMode; - int getTotalSize, getDoneSize; - bool startGetOnFail; - int putToWrite, putWritten; - bool errorInListChildren; - -private: - void init(); - int addCommand( TQFtpCommand * ); - - bool checkConnection( TQNetworkOperation *op ); - -private slots: - void startNextCommand(); - void piFinished( const TQString& ); - void piError( int, const TQString& ); - void piConnectState( int ); - void piFtpReply( int, const TQString& ); - -private slots: - void npListInfo( const TQUrlInfo & ); - void npDone( bool ); - void npStateChanged( int ); - void npDataTransferProgress( int, int ); - void npReadyRead(); - -protected slots: - // ### TQt 4.0: delete these - void hostFound(); - void connected(); - void closed(); - void dataHostFound(); - void dataConnected(); - void dataClosed(); - void dataReadyRead(); - void dataBytesWritten( int nbytes ); - void error( int ); -}; - -#endif // QT_NO_NETWORKPROTOCOL_FTP - -#endif // TQFTP_H diff --git a/src/network/qhostaddress.cpp b/src/network/qhostaddress.cpp index 360045282..43d614cc9 100644 --- a/src/network/qhostaddress.cpp +++ b/src/network/qhostaddress.cpp @@ -38,8 +38,8 @@ ** **********************************************************************/ -#include "qhostaddress.h" -#include "qstringlist.h" +#include "ntqhostaddress.h" +#include "ntqstringlist.h" #ifndef QT_NO_NETWORK class TQHostAddressPrivate @@ -83,7 +83,7 @@ TQHostAddressPrivate::TQHostAddressPrivate(const Q_IPV6ADDR &a_) : a(0), isIp4(F } /*! - \class TQHostAddress qhostaddress.h + \class TQHostAddress ntqhostaddress.h \brief The TQHostAddress class provides an IP address. \if defined(commercial) It is part of the TQt Enterprise Edition. diff --git a/src/network/qhostaddress.h b/src/network/qhostaddress.h deleted file mode 100644 index 09986861a..000000000 --- a/src/network/qhostaddress.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Definition of TQHostAddress class. -** -** Created : 979899 -** -** Copyright (C) 1997-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQHOSTADDRESS_H -#define TQHOSTADDRESS_H - -#ifndef QT_H -#include "qstring.h" -#endif // QT_H - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_NETWORK -#else -#define TQM_EXPORT_NETWORK Q_EXPORT -#endif - -#ifndef QT_NO_NETWORK -class TQHostAddressPrivate; - -typedef struct { - Q_UINT8 c[16]; -} Q_IPV6ADDR; - -class TQM_EXPORT_NETWORK TQHostAddress -{ -public: - TQHostAddress(); - TQHostAddress( Q_UINT32 ip4Addr ); - TQHostAddress( Q_UINT8 *ip6Addr ); - TQHostAddress(const Q_IPV6ADDR &ip6Addr); -#ifndef QT_NO_STRINGLIST - TQHostAddress(const TQString &address); -#endif - TQHostAddress( const TQHostAddress & ); - virtual ~TQHostAddress(); - - TQHostAddress & operator=( const TQHostAddress & ); - - void setAddress( Q_UINT32 ip4Addr ); - void setAddress( Q_UINT8 *ip6Addr ); -#ifndef QT_NO_STRINGLIST - bool setAddress( const TQString& address ); -#endif - bool isIp4Addr() const; // obsolete - Q_UINT32 ip4Addr() const; // obsolete - - bool isIPv4Address() const; - Q_UINT32 toIPv4Address() const; - bool isIPv6Address() const; - Q_IPV6ADDR toIPv6Address() const; - -#ifndef QT_NO_SPRINTF - TQString toString() const; -#endif - - bool operator==( const TQHostAddress & ) const; - bool isNull() const; - -private: - TQHostAddressPrivate* d; -}; - -#endif //QT_NO_NETWORK -#endif diff --git a/src/network/qhttp.cpp b/src/network/qhttp.cpp index 4d8cc3e53..b8a110e58 100644 --- a/src/network/qhttp.cpp +++ b/src/network/qhttp.cpp @@ -38,19 +38,19 @@ ** **********************************************************************/ -#include "qhttp.h" +#include "ntqhttp.h" #ifndef QT_NO_NETWORKPROTOCOL_HTTP -#include "qsocket.h" -#include "qtextstream.h" -#include "qmap.h" -#include "qstring.h" -#include "qstringlist.h" -#include "qcstring.h" -#include "qbuffer.h" -#include "qurloperator.h" -#include "qtimer.h" +#include "ntqsocket.h" +#include "ntqtextstream.h" +#include "ntqmap.h" +#include "ntqstring.h" +#include "ntqstringlist.h" +#include "ntqcstring.h" +#include "ntqbuffer.h" +#include "ntqurloperator.h" +#include "ntqtimer.h" #include "private/qinternal_p.h" //#define TQHTTP_DEBUG @@ -332,7 +332,7 @@ void TQHttpCloseRequest::start( TQHttp *http ) ****************************************************/ /*! - \class TQHttpHeader qhttp.h + \class TQHttpHeader ntqhttp.h \brief The TQHttpHeader class contains header information for HTTP. \if defined(commercial) It is part of the TQt Enterprise Edition. @@ -674,7 +674,7 @@ void TQHttpHeader::setContentType( const TQString& type ) ****************************************************/ /*! - \class TQHttpResponseHeader qhttp.h + \class TQHttpResponseHeader ntqhttp.h \brief The TQHttpResponseHeader class contains response header information for HTTP. \if defined(commercial) It is part of the TQt Enterprise Edition. @@ -837,7 +837,7 @@ TQString TQHttpResponseHeader::toString() const ****************************************************/ /*! - \class TQHttpRequestHeader qhttp.h + \class TQHttpRequestHeader ntqhttp.h \brief The TQHttpRequestHeader class contains request header information for \if defined(commercial) It is part of the TQt Enterprise Edition. @@ -1011,7 +1011,7 @@ TQString TQHttpRequestHeader::toString() const * ****************************************************/ /*! - \class TQHttp qhttp.h + \class TQHttp ntqhttp.h \brief The TQHttp class provides an implementation of the HTTP protocol. \if defined(commercial) It is part of the TQt Enterprise Edition. diff --git a/src/network/qhttp.h b/src/network/qhttp.h deleted file mode 100644 index b71ef105e..000000000 --- a/src/network/qhttp.h +++ /dev/null @@ -1,277 +0,0 @@ -/**************************************************************************** -** -** Definition of TQHttp and related classes. -** -** Created : 970521 -** -** Copyright (C) 1997-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQHTTP_H -#define TQHTTP_H - -#ifndef QT_H -#include "qobject.h" -#include "qnetworkprotocol.h" -#include "qstringlist.h" -#endif // QT_H - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_HTTP -#define TQM_TEMPLATE_EXTERN_HTTP -#else -#define TQM_EXPORT_HTTP Q_EXPORT -#define TQM_TEMPLATE_EXTERN_HTTP Q_TEMPLATE_EXTERN -#endif - -#ifndef QT_NO_NETWORKPROTOCOL_HTTP - -class TQSocket; -class TQTimerEvent; -class TQTextStream; -class TQIODevice; - -class TQHttpPrivate; -class TQHttpRequest; - -class TQM_EXPORT_HTTP TQHttpHeader -{ -public: - TQHttpHeader(); - TQHttpHeader( const TQHttpHeader& header ); - TQHttpHeader( const TQString& str ); - virtual ~TQHttpHeader(); - - TQHttpHeader& operator=( const TQHttpHeader& h ); - - TQString value( const TQString& key ) const; - void setValue( const TQString& key, const TQString& value ); - void removeValue( const TQString& key ); - - TQStringList keys() const; - bool hasKey( const TQString& key ) const; - - bool hasContentLength() const; - uint contentLength() const; - void setContentLength( int len ); - - bool hasContentType() const; - TQString contentType() const; - void setContentType( const TQString& type ); - - virtual TQString toString() const; - bool isValid() const; - - virtual int majorVersion() const = 0; - virtual int minorVersion() const = 0; - -protected: - virtual bool parseLine( const TQString& line, int number ); - bool parse( const TQString& str ); - void setValid( bool ); - -private: - TQMap values; - bool valid; -}; - -class TQM_EXPORT_HTTP TQHttpResponseHeader : public TQHttpHeader -{ -private: - TQHttpResponseHeader( int code, const TQString& text = TQString::null, int majorVer = 1, int minorVer = 1 ); - TQHttpResponseHeader( const TQString& str ); - - void setStatusLine( int code, const TQString& text = TQString::null, int majorVer = 1, int minorVer = 1 ); - -public: - TQHttpResponseHeader(); - TQHttpResponseHeader( const TQHttpResponseHeader& header ); - - int statusCode() const; - TQString reasonPhrase() const; - - int majorVersion() const; - int minorVersion() const; - - TQString toString() const; - -protected: - bool parseLine( const TQString& line, int number ); - -private: - int statCode; - TQString reasonPhr; - int majVer; - int minVer; - - friend class TQHttp; -}; - -class TQM_EXPORT_HTTP TQHttpRequestHeader : public TQHttpHeader -{ -public: - TQHttpRequestHeader(); - TQHttpRequestHeader( const TQString& method, const TQString& path, int majorVer = 1, int minorVer = 1 ); - TQHttpRequestHeader( const TQHttpRequestHeader& header ); - TQHttpRequestHeader( const TQString& str ); - - void setRequest( const TQString& method, const TQString& path, int majorVer = 1, int minorVer = 1 ); - - TQString method() const; - TQString path() const; - - int majorVersion() const; - int minorVersion() const; - - TQString toString() const; - -protected: - bool parseLine( const TQString& line, int number ); - -private: - TQString m; - TQString p; - int majVer; - int minVer; -}; - -class TQM_EXPORT_HTTP TQHttp : public TQNetworkProtocol -{ - Q_OBJECT - -public: - TQHttp(); - TQHttp( TQObject* parent, const char* name = 0 ); // ### TQt 4.0: make parent=0 and get rid of the TQHttp() constructor - TQHttp( const TQString &hostname, Q_UINT16 port=80, TQObject* parent=0, const char* name = 0 ); - virtual ~TQHttp(); - - int supportedOperations() const; - - enum State { Unconnected, HostLookup, Connecting, Sending, Reading, Connected, Closing }; - enum Error { - NoError, - UnknownError, - HostNotFound, - ConnectionRefused, - UnexpectedClose, - InvalidResponseHeader, - WrongContentLength, - Aborted - }; - - int setHost(const TQString &hostname, Q_UINT16 port=80 ); - - int get( const TQString& path, TQIODevice* to=0 ); - int post( const TQString& path, TQIODevice* data, TQIODevice* to=0 ); - int post( const TQString& path, const TQByteArray& data, TQIODevice* to=0 ); - int head( const TQString& path ); - int request( const TQHttpRequestHeader &header, TQIODevice *device=0, TQIODevice *to=0 ); - int request( const TQHttpRequestHeader &header, const TQByteArray &data, TQIODevice *to=0 ); - - int closeConnection(); - - Q_ULONG bytesAvailable() const; - Q_LONG readBlock( char *data, Q_ULONG maxlen ); - TQByteArray readAll(); - - int currentId() const; - TQIODevice* currentSourceDevice() const; - TQIODevice* currentDestinationDevice() const; - TQHttpRequestHeader currentRequest() const; - bool hasPendingRequests() const; - void clearPendingRequests(); - - State state() const; - - Error error() const; - TQString errorString() const; - -public slots: - void abort(); - -signals: - void stateChanged( int ); - void responseHeaderReceived( const TQHttpResponseHeader& resp ); - void readyRead( const TQHttpResponseHeader& resp ); - void dataSendProgress( int, int ); - void dataReadProgress( int, int ); - - void requestStarted( int ); - void requestFinished( int, bool ); - void done( bool ); - -protected: - void operationGet( TQNetworkOperation *op ); - void operationPut( TQNetworkOperation *op ); - - void timerEvent( TQTimerEvent * ); - -private slots: - void clientReply( const TQHttpResponseHeader &rep ); - void clientDone( bool ); - void clientStateChanged( int ); - - void startNextRequest(); - void slotReadyRead(); - void slotConnected(); - void slotError( int ); - void slotClosed(); - void slotBytesWritten( int ); - -private: - TQHttpPrivate *d; - void *unused; // ### TQt 4.0: remove this (in for binary compatibility) - int bytesRead; - - int addRequest( TQHttpRequest * ); - void sendRequest(); - void finishedWithSuccess(); - void finishedWithError( const TQString& detail, int errorCode ); - - void killIdleTimer(); - - void init(); - void setState( int ); - void close(); - - friend class TQHttpNormalRequest; - friend class TQHttpSetHostRequest; - friend class TQHttpCloseRequest; - friend class TQHttpPGHRequest; -}; - -#define Q_DEFINED_QHTTP -#include "qwinexport.h" -#endif -#endif diff --git a/src/network/qnetwork.cpp b/src/network/qnetwork.cpp index 5f5d3cdb8..a3e8a7443 100644 --- a/src/network/qnetwork.cpp +++ b/src/network/qnetwork.cpp @@ -38,17 +38,17 @@ ** **********************************************************************/ -#include "qnetwork.h" +#include "ntqnetwork.h" #ifndef QT_NO_NETWORK -#include "qnetworkprotocol.h" +#include "ntqnetworkprotocol.h" // protocols -#include "qftp.h" -#include "qhttp.h" +#include "ntqftp.h" +#include "ntqhttp.h" -/*! \file qnetwork.h */ +/*! \file ntqnetwork.h */ /*! \relates TQUrlOperator @@ -56,7 +56,7 @@ You must call this function before you use TQUrlOperator for these protocols. - This function is declared in \l qnetwork.h. + This function is declared in \l ntqnetwork.h. */ void qInitNetworkProtocols() { diff --git a/src/network/qnetwork.h b/src/network/qnetwork.h deleted file mode 100644 index 48a1841db..000000000 --- a/src/network/qnetwork.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Definition of qInitNetworkProtocols function. -** -** Created : 970521 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQNETWORK_H -#define TQNETWORK_H - -#ifndef QT_H -#include "qglobal.h" -#endif // QT_H - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_NETWORK -#else -#define TQM_EXPORT_NETWORK Q_EXPORT -#endif - -#ifndef QT_NO_NETWORK - -TQM_EXPORT_NETWORK void qInitNetworkProtocols(); - -#endif - -#endif diff --git a/src/network/qserversocket.cpp b/src/network/qserversocket.cpp index 706be57ee..04dc965ef 100644 --- a/src/network/qserversocket.cpp +++ b/src/network/qserversocket.cpp @@ -38,11 +38,11 @@ ** **********************************************************************/ -#include "qserversocket.h" +#include "ntqserversocket.h" #ifndef QT_NO_NETWORK -#include "qsocketnotifier.h" +#include "ntqsocketnotifier.h" class TQServerSocketPrivate { public: @@ -54,7 +54,7 @@ public: /*! - \class TQServerSocket qserversocket.h + \class TQServerSocket ntqserversocket.h \brief The TQServerSocket class provides a TCP-based server. \if defined(commercial) It is part of the TQt Enterprise Edition. diff --git a/src/network/qserversocket.h b/src/network/qserversocket.h deleted file mode 100644 index a54b04a7b..000000000 --- a/src/network/qserversocket.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Definition of TQServerSocketClass. -** -** Created : 970521 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSERVERSOCKET_H -#define TQSERVERSOCKET_H - -#ifndef QT_H -#include "qobject.h" -#include "qhostaddress.h" -#include "qsocketdevice.h" // ### remove or keep for users' convenience? -#endif // QT_H -#ifndef QT_NO_NETWORK - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_NETWORK -#else -#define TQM_EXPORT_NETWORK Q_EXPORT -#endif - -class TQServerSocketPrivate; - - -class TQM_EXPORT_NETWORK TQServerSocket : public TQObject -{ - Q_OBJECT -public: - TQServerSocket( Q_UINT16 port, int backlog = 1, - TQObject *parent=0, const char *name=0 ); - TQServerSocket( const TQHostAddress & address, Q_UINT16 port, int backlog = 1, - TQObject *parent=0, const char *name=0 ); - TQServerSocket( TQObject *parent=0, const char *name=0 ); - virtual ~TQServerSocket(); - - bool ok() const; - - Q_UINT16 port() const ; - - int socket() const ; - virtual void setSocket( int socket ); - - TQHostAddress address() const ; - - virtual void newConnection( int socket ) = 0; - -protected: - TQSocketDevice *socketDevice(); - -private slots: - void incomingConnection( int socket ); - -private: - TQServerSocketPrivate *d; - void init( const TQHostAddress & address, Q_UINT16 port, int backlog ); -}; - -#endif // QT_NO_NETWORK -#endif // TQSERVERSOCKET_H diff --git a/src/network/qsocket.cpp b/src/network/qsocket.cpp index 14e45b7dc..8e69aa7cc 100644 --- a/src/network/qsocket.cpp +++ b/src/network/qsocket.cpp @@ -38,12 +38,12 @@ ** **********************************************************************/ -#include "qsocket.h" +#include "ntqsocket.h" #ifndef QT_NO_NETWORK -#include "qptrlist.h" -#include "qtimer.h" -#include "qsocketdevice.h" -#include "qdns.h" +#include "ntqptrlist.h" +#include "ntqtimer.h" +#include "ntqsocketdevice.h" +#include "ntqdns.h" #include "private/qinternal_p.h" #include @@ -224,7 +224,7 @@ void TQSocketPrivate::setSocketDevice( TQSocket *q, TQSocketDevice *device ) } /*! - \class TQSocket qsocket.h + \class TQSocket ntqsocket.h \brief The TQSocket class provides a buffered TCP connection. \if defined(commercial) It is part of the TQt Enterprise Edition. diff --git a/src/network/qsocket.h b/src/network/qsocket.h deleted file mode 100644 index ee5b38422..000000000 --- a/src/network/qsocket.h +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Definition of TQSocket class. -** -** Created : 970521 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSOCKET_H -#define TQSOCKET_H - -#ifndef QT_H -#include "qobject.h" -#include "qiodevice.h" -#include "qhostaddress.h" // int->TQHostAddress conversion -#endif // QT_H - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_NETWORK -#else -#define TQM_EXPORT_NETWORK Q_EXPORT -#endif - -#ifndef QT_NO_NETWORK -class TQSocketPrivate; -class TQSocketDevice; - - -class TQM_EXPORT_NETWORK TQSocket : public TQObject, public TQIODevice -{ - Q_OBJECT -public: - enum Error { - ErrConnectionRefused, - ErrHostNotFound, - ErrSocketRead - }; - - TQSocket( TQObject *parent=0, const char *name=0 ); - virtual ~TQSocket(); - - enum State { Idle, HostLookup, Connecting, - Connected, Closing, - Connection=Connected }; - State state() const; - - int socket() const; - virtual void setSocket( int ); - - TQSocketDevice *socketDevice(); - virtual void setSocketDevice( TQSocketDevice * ); - -#ifndef QT_NO_DNS - virtual void connectToHost( const TQString &host, Q_UINT16 port ); -#endif - TQString peerName() const; - - // Implementation of TQIODevice abstract virtual functions - bool open( int mode ); - void close(); - void flush(); - Offset size() const; - Offset at() const; - bool at( Offset ); - bool atEnd() const; - - Q_ULONG bytesAvailable() const; // ### TQIODevice::Offset instead? - Q_ULONG waitForMore( int msecs, bool *timeout ) const; - Q_ULONG waitForMore( int msecs ) const; // ### TQt 4.0: merge the two overloads - Q_ULONG bytesToWrite() const; - void clearPendingData(); - - Q_LONG readBlock( char *data, Q_ULONG maxlen ); - Q_LONG writeBlock( const char *data, Q_ULONG len ); - Q_LONG readLine( char *data, Q_ULONG maxlen ); - - int getch(); - int putch( int ); - int ungetch(int); - - bool canReadLine() const; - virtual TQString readLine(); - - Q_UINT16 port() const; - Q_UINT16 peerPort() const; - TQHostAddress address() const; - TQHostAddress peerAddress() const; - - void setReadBufferSize( Q_ULONG ); - Q_ULONG readBufferSize() const; - -signals: - void hostFound(); - void connected(); - void connectionClosed(); - void delayedCloseFinished(); - void readyRead(); - void bytesWritten( int nbytes ); - void error( int ); - -protected slots: - virtual void sn_read( bool force=FALSE ); - virtual void sn_write(); - -private slots: - void tryConnecting(); - void emitErrorConnectionRefused(); - -private: - TQSocketPrivate *d; - - bool consumeWriteBuf( Q_ULONG nbytes ); - void tryConnection(); - void setSocketIntern( int socket ); - -private: // Disabled copy constructor and operator= -#if defined(Q_DISABLE_COPY) - TQSocket( const TQSocket & ); - TQSocket &operator=( const TQSocket & ); -#endif -}; - -#endif //QT_NO_NETWORK -#endif // TQSOCKET_H diff --git a/src/network/qsocketdevice.cpp b/src/network/qsocketdevice.cpp index 270d74571..c09cbb59a 100644 --- a/src/network/qsocketdevice.cpp +++ b/src/network/qsocketdevice.cpp @@ -38,10 +38,10 @@ ** **********************************************************************/ -#include "qsocketdevice.h" +#include "ntqsocketdevice.h" #ifndef QT_NO_NETWORK -#include "qwindowdefs.h" +#include "ntqwindowdefs.h" #include @@ -60,7 +60,7 @@ public: /*! - \class TQSocketDevice qsocketdevice.h + \class TQSocketDevice ntqsocketdevice.h \brief The TQSocketDevice class provides a platform-independent low-level socket API. \if defined(commercial) It is part of the TQt Enterprise Edition. diff --git a/src/network/qsocketdevice.h b/src/network/qsocketdevice.h deleted file mode 100644 index cfb847ce6..000000000 --- a/src/network/qsocketdevice.h +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Definition of TQSocketDevice class. -** -** Created : 970521 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the network module of the TQt GUI Toolkit. -** -** 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 Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSOCKETDEVICE_H -#define TQSOCKETDEVICE_H - -#ifndef QT_H -#include "qiodevice.h" -#include "qhostaddress.h" // int->TQHostAddress conversion -#endif // QT_H - -#if !defined( QT_MODULE_NETWORK ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_NETWORK ) -#define TQM_EXPORT_NETWORK -#else -#define TQM_EXPORT_NETWORK Q_EXPORT -#endif - -#ifndef QT_NO_NETWORK -class TQSocketDevicePrivate; - - -class TQM_EXPORT_NETWORK TQSocketDevice: public TQIODevice -{ -public: - enum Type { Stream, Datagram }; - enum Protocol { IPv4, IPv6, Unknown }; - - TQSocketDevice( Type type = Stream ); - TQSocketDevice( Type type, Protocol protocol, int dummy ); - TQSocketDevice( int socket, Type type ); - virtual ~TQSocketDevice(); - - bool isValid() const; - Type type() const; - Protocol protocol() const; - - int socket() const; - virtual void setSocket( int socket, Type type ); - - bool open( int mode ); - void close(); - void flush(); - - // Implementation of TQIODevice abstract virtual functions - Offset size() const; - Offset at() const; - bool at( Offset ); - bool atEnd() const; - - bool blocking() const; - virtual void setBlocking( bool ); - - bool addressReusable() const; - virtual void setAddressReusable( bool ); - - int receiveBufferSize() const; - virtual void setReceiveBufferSize( uint ); - int sendBufferSize() const; - virtual void setSendBufferSize( uint ); - - virtual bool connect( const TQHostAddress &, Q_UINT16 ); - - virtual bool bind( const TQHostAddress &, Q_UINT16 ); - virtual bool listen( int backlog ); - virtual int accept(); - - Q_LONG bytesAvailable() const; - Q_LONG waitForMore( int msecs, bool *timeout=0 ) const; - Q_LONG readBlock( char *data, Q_ULONG maxlen ); - Q_LONG writeBlock( const char *data, Q_ULONG len ); - virtual Q_LONG writeBlock( const char *data, Q_ULONG len, - const TQHostAddress & host, Q_UINT16 port ); - - int getch(); - int putch( int ); - int ungetch(int); - - Q_UINT16 port() const; - Q_UINT16 peerPort() const; - TQHostAddress address() const; - TQHostAddress peerAddress() const; - - enum Error { - NoError, - AlreadyBound, - Inaccessible, - NoResources, - InternalError, - Bug = InternalError, // ### remove in 4.0? - Impossible, - NoFiles, - ConnectionRefused, - NetworkFailure, - UnknownError - }; - Error error() const; - -protected: - void setError( Error err ); - -private: - int fd; - Type t; - Q_UINT16 p; - TQHostAddress a; - Q_UINT16 pp; - TQHostAddress pa; - TQSocketDevice::Error e; - TQSocketDevicePrivate * d; - - enum Option { Broadcast, ReceiveBuffer, ReuseAddress, SendBuffer }; - - int option( Option ) const; - virtual void setOption( Option, int ); - - void fetchConnectionParameters(); -#if defined(Q_OS_WIN32) - void fetchPeerConnectionParameters(); -#endif - - static void init(); - int createNewSocket(); - Protocol getProtocol() const; - -private: // Disabled copy constructor and operator= -#if defined(Q_DISABLE_COPY) - TQSocketDevice( const TQSocketDevice & ); - TQSocketDevice &operator=( const TQSocketDevice & ); -#endif -}; - -#endif // QT_NO_NETWORK -#endif // TQSOCKETDEVICE_H diff --git a/src/network/qsocketdevice_unix.cpp b/src/network/qsocketdevice_unix.cpp index fe7c619cc..a5adfef06 100644 --- a/src/network/qsocketdevice_unix.cpp +++ b/src/network/qsocketdevice_unix.cpp @@ -80,11 +80,11 @@ static inline int qt_socket_socket(int domain, int type, int protocol) # undef socket #endif -#include "qsocketdevice.h" +#include "ntqsocketdevice.h" #ifndef QT_NO_NETWORK -#include "qwindowdefs.h" +#include "ntqwindowdefs.h" #include #include diff --git a/src/network/qt_network.pri b/src/network/qt_network.pri index 86fcf24d4..537f2b99d 100644 --- a/src/network/qt_network.pri +++ b/src/network/qt_network.pri @@ -1,14 +1,14 @@ # Qt network module network { - HEADERS += $$NETWORK_H/qdns.h \ - $$NETWORK_H/qftp.h \ - $$NETWORK_H/qhttp.h \ - $$NETWORK_H/qhostaddress.h \ - $$NETWORK_H/qnetwork.h \ - $$NETWORK_H/qserversocket.h \ - $$NETWORK_H/qsocket.h \ - $$NETWORK_H/qsocketdevice.h + HEADERS += $$NETWORK_H/ntqdns.h \ + $$NETWORK_H/ntqftp.h \ + $$NETWORK_H/ntqhttp.h \ + $$NETWORK_H/ntqhostaddress.h \ + $$NETWORK_H/ntqnetwork.h \ + $$NETWORK_H/ntqserversocket.h \ + $$NETWORK_H/ntqsocket.h \ + $$NETWORK_H/ntqsocketdevice.h NETWORK_SOURCES = $$NETWORK_CPP/qdns.cpp \ $$NETWORK_CPP/qftp.cpp \ $$NETWORK_CPP/qhttp.cpp \ -- cgit v1.2.1