diff options
Diffstat (limited to 'sip/tqtnetwork')
-rw-r--r-- | sip/tqtnetwork/copying.sip | 51 | ||||
-rw-r--r-- | sip/tqtnetwork/tqdns.sip | 272 | ||||
-rw-r--r-- | sip/tqtnetwork/tqftp.sip | 171 | ||||
-rw-r--r-- | sip/tqtnetwork/tqhostaddress.sip | 89 | ||||
-rw-r--r-- | sip/tqtnetwork/tqhttp.sip | 263 | ||||
-rw-r--r-- | sip/tqtnetwork/tqlocalfs.sip | 54 | ||||
-rw-r--r-- | sip/tqtnetwork/tqnetwork.sip | 32 | ||||
-rw-r--r-- | sip/tqtnetwork/tqserversocket.sip | 58 | ||||
-rw-r--r-- | sip/tqtnetwork/tqsocket.sip | 241 | ||||
-rw-r--r-- | sip/tqtnetwork/tqsocketdevice.sip | 168 | ||||
-rw-r--r-- | sip/tqtnetwork/tqtnetworkmod.sip | 78 |
11 files changed, 1477 insertions, 0 deletions
diff --git a/sip/tqtnetwork/copying.sip b/sip/tqtnetwork/copying.sip new file mode 100644 index 0000000..49b4531 --- /dev/null +++ b/sip/tqtnetwork/copying.sip @@ -0,0 +1,51 @@ +// This is the SIP file defining the PyTQt license. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%Copying +Copyright (c) 2007 + Riverbank Computing Limited <info@riverbankcomputing.co.uk> + +This file is part of PyTQt. + +This copy of PyTQt is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +%End + + +%OptionalInclude pytqt-internal.sip +%OptionalInclude pytqt-gpl.sip +%OptionalInclude pytqt-commercial.sip +%OptionalInclude pytqt-edu.sip +%OptionalInclude pytqt-eval.sip +%OptionalInclude pytqt-nc.sip +%OptionalInclude pytqt-tkc.sip diff --git a/sip/tqtnetwork/tqdns.sip b/sip/tqtnetwork/tqdns.sip new file mode 100644 index 0000000..7d9c436 --- /dev/null +++ b/sip/tqtnetwork/tqdns.sip @@ -0,0 +1,272 @@ +// This is the SIP interface definition for TQDns. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQDns (TQt v2.2+)</Title> +<Para> +<Literal>TQDns</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +%If (TQt_DNS) + +class TQDns : TQObject +{ +%TypeHeaderCode +#include <tqdns.h> +%End + +public: + enum RecordType { + None, + A, + Aaaa, + Mx, + Srv, + Cname, + Ptr, + Txt + }; + + TQDns(); + TQDns(const TQString &,RecordType = A); + TQDns(const TQHostAddress &,RecordType = A); + + virtual void setLabel(const TQString &); + virtual void setLabel(const TQHostAddress &); + TQString label() const; + + virtual void setRecordType(RecordType = A); + RecordType recordType() const; + + bool isWorking() const; + + TQValueList<TQHostAddress> addresses() const; + + class MailServer + { + public: + MailServer(const TQString & = TQString::null,TQ_UINT16 = 0); + + TQString name; + TQ_UINT16 priority; + }; + + TQValueList<TQDns::MailServer> mailServers() const; + + class Server + { + public: + Server(const TQString & = TQString::null,TQ_UINT16 = 0, + TQ_UINT16 = 0,TQ_UINT16 = 0); + + TQString name; + TQ_UINT16 priority; + TQ_UINT16 weight; + TQ_UINT16 port; + }; + + TQValueList<TQDns::Server> servers() const; + + TQStringList hostNames() const; + + TQStringList texts() const; + + TQString canonicalName() const; + + TQStringList qualifiedNames() const; + +signals: + void resultsReady(); +}; + + +%MappedType TQValueList<TQHostAddress> +{ +%TypeHeaderCode +#include <tqvaluelist.h> +%End + +%ConvertFromTypeCode + // Convert to a Python list of TQHostAddress instances. + + int i; + PyObject *l; + + // Create the list. + + if ((l = PyList_New(sipCpp -> count())) == NULL) + return NULL; + + // Get it. + + i = 0; + TQValueListConstIterator<TQHostAddress> it; + + for (it = sipCpp -> begin(); it != sipCpp -> end(); ++it) + { + PyObject *tmobj; + + if ((tmobj = sipConvertFromNewInstance(new TQHostAddress(*it),sipClass_TQHostAddress,sipTransferObj)) == NULL || PyList_SetItem(l,i,tmobj) < 0) + { + Py_XDECREF(tmobj); + Py_DECREF(l); + + return NULL; + } + + ++i; + } + + return l; +%End + +%ConvertToTypeCode + // At the moment this will never be called, so provide a null + // implementation. + + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + PyErr_Format(PyExc_TypeError,"Converting to TQValueList<TQHostAddress> not yet implemented"); + + *sipIsErr = 1; + + return 0; +%End +}; + + +%MappedType TQValueList<TQDns::MailServer> +{ +%TypeHeaderCode +#include <tqvaluelist.h> +%End + +%ConvertFromTypeCode + // Convert to a Python list of TQDns::MailServer instances. + + int i; + PyObject *l; + + // Create the list. + + if ((l = PyList_New(sipCpp -> count())) == NULL) + return NULL; + + // Get it. + + i = 0; + TQValueListConstIterator<TQDns::MailServer> it; + + for (it = sipCpp -> begin(); it != sipCpp -> end(); ++it) + { + PyObject *tmobj; + + if ((tmobj = sipConvertFromNewInstance(new TQDns::MailServer(*it),sipClass_TQDns_MailServer,sipTransferObj)) == NULL || PyList_SetItem(l,i,tmobj) < 0) + { + Py_XDECREF(tmobj); + Py_DECREF(l); + + return NULL; + } + + ++i; + } + + return l; +%End + +%ConvertToTypeCode + // At the moment this will never be called, so provide a null + // implementation. + + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + PyErr_Format(PyExc_TypeError,"Converting to TQValueList<TQDns::MailServer> not yet implemented"); + + *sipIsErr = 1; + + return 0; +%End +}; + + +%MappedType TQValueList<TQDns::Server> +{ +%TypeHeaderCode +#include <tqvaluelist.h> +%End + +%ConvertFromTypeCode + // Convert to a Python list of TQDns::Server instances. + + int i; + PyObject *l; + + // Create the list. + + if ((l = PyList_New(sipCpp -> count())) == NULL) + return NULL; + + // Get it. + + i = 0; + TQValueListConstIterator<TQDns::Server> it; + + for (it = sipCpp -> begin(); it != sipCpp -> end(); ++it) + { + PyObject *tmobj; + + if ((tmobj = sipConvertFromNewInstance(new TQDns::Server(*it),sipClass_TQDns_Server,sipTransferObj)) == NULL || PyList_SetItem(l,i,tmobj) < 0) + { + Py_XDECREF(tmobj); + Py_DECREF(l); + + return NULL; + } + + ++i; + } + + return l; +%End + +%ConvertToTypeCode + // At the moment this will never be called, so provide a null + // implementation. + + if (sipIsErr == NULL) + return PyList_Check(sipPy); + + PyErr_Format(PyExc_TypeError,"Converting to TQValueList<TQDns::Server> not yet implemented"); + + *sipIsErr = 1; + + return 0; +%End +}; + +%End diff --git a/sip/tqtnetwork/tqftp.sip b/sip/tqtnetwork/tqftp.sip new file mode 100644 index 0000000..ee945db --- /dev/null +++ b/sip/tqtnetwork/tqftp.sip @@ -0,0 +1,171 @@ +// This is the SIP interface definition for TQFtp. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQFtp (TQt v2.2+)</Title> +<FuncSynopsis> + <FuncDef>TQ_LONG <Function>readBlock</Function></FuncDef> + <ParamDef>char *<Parameter>data</Parameter></ParamDef> + <ParamDef>TQ_ULONG <Parameter>maxlen</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This takes a single <Literal>maxlen</Literal> parameter. The +<Literal>data</Literal> is returned if there was no error, otherwise +<Literal>None</Literal> is returned. +</Para> +</Sect2> +%End + + +%If (TQt_NETWORKPROTOCOL_FTP) + +class TQFtp : TQNetworkProtocol +{ +%TypeHeaderCode +#include <tqftp.h> +%End + +public: + TQFtp(); + TQFtp(TQObject * /TransferThis/,const char * = 0); + virtual ~TQFtp(); + + int supportedOperations() const; + + 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 &,TQ_UINT16 = 21) /ReleaseGIL/; + int login(const TQString & = TQString::null, + const TQString & = TQString::null) /ReleaseGIL/; + int close() /ReleaseGIL/; + int list(const TQString & = TQString::null) /ReleaseGIL/; + int cd(const TQString &) /ReleaseGIL/; + int get(const TQString &,TQIODevice * = 0) /ReleaseGIL/; + int put(const TQByteArray &,const TQString &) /ReleaseGIL/; + int put(TQIODevice *,const TQString &) /ReleaseGIL/; + int remove(const TQString &) /ReleaseGIL/; + int mkdir(const TQString &) /ReleaseGIL/; + int rmdir(const TQString &) /ReleaseGIL/; + int rename(const TQString &,const TQString &) /ReleaseGIL/; + + int rawCommand(const TQString &) /ReleaseGIL/; + + unsigned long bytesAvailable() const; + + SIP_PYOBJECT readBlock(TQ_ULONG) /ReleaseGIL/ [TQ_LONG (char *,TQ_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + TQ_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipCpp -> TQFtp::readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else if ((sipRes = PyBytes_FromStringAndSize(buf,actlen)) == NULL) + sipIsErr = 1; + + sipFree((void *)buf); + } +%End + + TQByteArray readAll() /ReleaseGIL/; + + 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 &,TQUrlInfo &); + virtual void operationListChildren(TQNetworkOperation *); + virtual void operationMkDir(TQNetworkOperation *); + virtual void operationRemove(TQNetworkOperation *); + virtual void operationRename(TQNetworkOperation *); + virtual void operationGet(TQNetworkOperation *); + virtual void operationPut(TQNetworkOperation *); + +private: + virtual bool checkConnection(TQNetworkOperation *); +}; + +%End diff --git a/sip/tqtnetwork/tqhostaddress.sip b/sip/tqtnetwork/tqhostaddress.sip new file mode 100644 index 0000000..6e1cc91 --- /dev/null +++ b/sip/tqtnetwork/tqhostaddress.sip @@ -0,0 +1,89 @@ +// This is the SIP interface definition for TQHostAddress. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQHostAddress (TQt v2.2+)</Title> +<FuncSynopsis> + <FuncDef><Function>TQHostAddress</Function></FuncDef> + <ParamDef>TQ_UINT8 *<Parameter>ip6Addr</Parameter></ParamDef> +</FuncSynopsis> +<Para> +Not yet implemented. +</Para> + +<FuncSynopsis> + <FuncDef><Function>TQHostAddress</Function></FuncDef> + <ParamDef>const Q_IPV6ADDR &<Parameter>ip6Addr</Parameter></ParamDef> +</FuncSynopsis> +<Para> +Not yet implemented. +</Para> + +<FuncSynopsis> + <FuncDef>void <Function>setAddress</Function></FuncDef> + <ParamDef>TQ_UINT8 *<Parameter>ip6Addr</Parameter></ParamDef> +</FuncSynopsis> +<Para> +Not yet implemented. +</Para> + +<FuncSynopsis> + <FuncDef>Q_IPV6ADDR <Function>toIPv6Address</Function> const</FuncDef> + <ParamDef><Parameter></Parameter></ParamDef> +</FuncSynopsis> +<Para> +Not yet implemented. +</Para> +</Sect2> +%End + + +class TQHostAddress +{ +%TypeHeaderCode +#include <tqhostaddress.h> +%End + +public: + TQHostAddress(); + TQHostAddress(TQ_UINT32); +// TQHostAddress(TQ_UINT8 *); + //TQHostAddress(const Q_IPV6ADDR &); + // This isn't mentioned in the documentation. + //TQHostAddress(const TQString &); + TQHostAddress(const TQHostAddress &); + + void setAddress(TQ_UINT32); +// void setAddress(TQ_UINT8 *); + bool setAddress(const TQString &); + bool isIp4Addr() const; + TQ_UINT32 ip4Addr() const; + + bool isIPv4Address() const; + TQ_UINT32 toIPv4Address() const; + bool isIPv6Address() const; + //Q_IPV6ADDR toIPv6Address() const; + + TQString toString() const; + + bool isNull() const; +}; diff --git a/sip/tqtnetwork/tqhttp.sip b/sip/tqtnetwork/tqhttp.sip new file mode 100644 index 0000000..2f80e22 --- /dev/null +++ b/sip/tqtnetwork/tqhttp.sip @@ -0,0 +1,263 @@ +// This is the SIP interface definition for TQHttp, TQHttpHeader, +// TQHttpRequestHeader and TQHttpResponseHeader. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQHttp (TQt v3+)</Title> +<FuncSynopsis> + <FuncDef>TQ_LONG <Function>readBlock</Function></FuncDef> + <ParamDef>char *<Parameter>data</Parameter></ParamDef> + <ParamDef>TQ_ULONG <Parameter>maxlen</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This takes a single <Literal>maxlen</Literal> parameter. The +<Literal>data</Literal> is returned if there was no error, otherwise +<Literal>None</Literal> is returned. +</Para> +</Sect2> + +<Sect2><Title>TQHttpHeader (TQt v3.1+)</Title> +<Para> +<Literal>TQHttpHeader</Literal> is fully implemented. +</Para> +</Sect2> + +<Sect2><Title>TQHttpRequestHeader (TQt v3.1+)</Title> +<Para> +<Literal>TQHttpRequestHeader</Literal> is fully implemented. +</Para> +</Sect2> + +<Sect2><Title>TQHttpResponseHeader (TQt v3.1+)</Title> +<Para> +<Literal>TQHttpResponseHeader</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +%If (TQt_NETWORKPROTOCOL_HTTP) + +class TQHttpHeader +{ +%TypeHeaderCode +#include <tqhttp.h> +%End + +public: + TQHttpHeader(); + TQHttpHeader(const TQHttpHeader &); + TQHttpHeader(const TQString &); + virtual ~TQHttpHeader(); + + TQString value(const TQString &) const; + void setValue(const TQString &,const TQString &); + void removeValue(const TQString &); + + TQStringList keys() const; + bool hasKey(const TQString &) const; + + bool hasContentLength() const; + uint contentLength() const; + void setContentLength(int); + + bool hasContentType() const; + TQString contentType() const; + void setContentType(const TQString &); + + virtual TQString toString() const; + bool isValid() const; + + virtual int majorVersion() const = 0; + virtual int minorVersion() const = 0; + +protected: + virtual bool parseLine(const TQString &,int); + bool parse(const TQString &); + void setValid(bool); +}; + + +class TQHttpResponseHeader : TQHttpHeader +{ +%TypeHeaderCode +#include <tqhttp.h> +%End + +public: + TQHttpResponseHeader(); + TQHttpResponseHeader(const TQHttpResponseHeader &); + + int statusCode() const; + TQString reasonPhrase() const; + + int majorVersion() const; + int minorVersion() const; + + TQString toString() const; + +protected: + bool parseLine(const TQString &,int); +}; + + +class TQHttpRequestHeader : TQHttpHeader +{ +%TypeHeaderCode +#include <tqhttp.h> +%End + +public: + TQHttpRequestHeader(); + TQHttpRequestHeader(const TQString &,const TQString &,int = 1,int = 1); + TQHttpRequestHeader(const TQHttpRequestHeader &); + TQHttpRequestHeader(const TQString &); + + void setRequest(const TQString &,const TQString &,int = 1,int = 1); + + TQString method() const; + TQString path() const; + + int majorVersion() const; + int minorVersion() const; + + TQString toString() const; + +protected: + bool parseLine(const TQString &,int); +}; + + +class TQHttp : TQNetworkProtocol +{ +%TypeHeaderCode +#include <tqhttp.h> +%End + +public: + TQHttp(); + TQHttp(TQObject * /TransferThis/,const char * = 0); + TQHttp(const TQString &,TQ_UINT16 = 80,TQObject * /TransferThis/ = 0, + const char * = 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 &,TQ_UINT16 = 80); + + int get(const TQString &,TQIODevice * = 0) /ReleaseGIL/; + int post(const TQString &,TQIODevice *,TQIODevice * = 0) /ReleaseGIL/; + int post(const TQString &,const TQByteArray &, + TQIODevice * = 0) /ReleaseGIL/; + int head(const TQString &) /ReleaseGIL/; + int request(const TQHttpRequestHeader &,TQIODevice * = 0, + TQIODevice * = 0) /ReleaseGIL/; + int request(const TQHttpRequestHeader &,const TQByteArray &, + TQIODevice * = 0) /ReleaseGIL/; + + int closeConnection(); + + unsigned long bytesAvailable() const; + + SIP_PYOBJECT readBlock(TQ_ULONG) /ReleaseGIL/ [TQ_LONG (char *,TQ_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + TQ_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipCpp -> TQHttp::readBlock(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else if ((sipRes = PyBytes_FromStringAndSize(buf,actlen)) == NULL) + sipIsErr = 1; + + sipFree((void *)buf); + } +%End + + TQByteArray readAll() /ReleaseGIL/; + + 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 &); + void readyRead(const TQHttpResponseHeader &); + void dataSendProgress(int,int); + void dataReadProgress(int,int); + + void requestStarted(int); + void requestFinished(int,bool); + void done(bool); + +protected: + void operationGet(TQNetworkOperation *); + void operationPut(TQNetworkOperation *); + + void timerEvent(TQTimerEvent *); +}; + +%End diff --git a/sip/tqtnetwork/tqlocalfs.sip b/sip/tqtnetwork/tqlocalfs.sip new file mode 100644 index 0000000..f33d6e0 --- /dev/null +++ b/sip/tqtnetwork/tqlocalfs.sip @@ -0,0 +1,54 @@ +// This is the SIP interface definition for TQLocalFs. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQLocalFs (TQt v2.1+)</Title> +<Para> +<Literal>TQLocalFs</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +%If (TQt_NETWORKPROTOCOL) + +class TQLocalFs : TQNetworkProtocol +{ +%TypeHeaderCode +#include <tqlocalfs.h> +%End + +public: + TQLocalFs(); + + virtual int supportedOperations() const; + +protected: + virtual void operationListChildren(TQNetworkOperation *); + virtual void operationMkDir(TQNetworkOperation *); + virtual void operationRemove(TQNetworkOperation *); + virtual void operationRename(TQNetworkOperation *); + virtual void operationGet(TQNetworkOperation *); + virtual void operationPut(TQNetworkOperation *); +}; + +%End diff --git a/sip/tqtnetwork/tqnetwork.sip b/sip/tqtnetwork/tqnetwork.sip new file mode 100644 index 0000000..b0a6af3 --- /dev/null +++ b/sip/tqtnetwork/tqnetwork.sip @@ -0,0 +1,32 @@ +// This is the SIP interface definition for tqInitNetworkProtocols. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%If (TQt_NETWORKPROTOCOL) + +%ModuleHeaderCode +#include <tqglobal.h> +#include <tqnetwork.h> +%End + +void tqInitNetworkProtocols(); + +%End diff --git a/sip/tqtnetwork/tqserversocket.sip b/sip/tqtnetwork/tqserversocket.sip new file mode 100644 index 0000000..4cbcdce --- /dev/null +++ b/sip/tqtnetwork/tqserversocket.sip @@ -0,0 +1,58 @@ +// This is the SIP interface definition for TQServerSocket. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQServerSocket (TQt v2.2+)</Title> +<Para> +<Literal>TQServerSocket</Literal> is fully implemented. +</Para> +</Sect2> +%End + + +class TQServerSocket : TQObject +{ +%TypeHeaderCode +#include <tqserversocket.h> +%End + +public: + TQServerSocket(TQ_UINT16,int = 1,TQObject * /TransferThis/ = 0, + const char * = 0); + TQServerSocket(const TQHostAddress &,TQ_UINT16,int = 1, + TQObject * /TransferThis/ = 0,const char * = 0); + TQServerSocket(TQObject * /TransferThis/ = 0,const char * = 0); + + bool ok() const; + + TQ_UINT16 port() const; + + int socket() const; + virtual void setSocket(int); + + TQHostAddress address() const ; + + virtual void newConnection(int) = 0; + +protected: + TQSocketDevice *socketDevice(); +}; diff --git a/sip/tqtnetwork/tqsocket.sip b/sip/tqtnetwork/tqsocket.sip new file mode 100644 index 0000000..ed52819 --- /dev/null +++ b/sip/tqtnetwork/tqsocket.sip @@ -0,0 +1,241 @@ +// This is the SIP interface definition for TQSocket. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSocket (TQt v2.2+)</Title> +<FuncSynopsis> + <FuncDef>TQ_LONG <Function>readBlock</Function></FuncDef> + <ParamDef>char *<Parameter>data</Parameter></ParamDef> + <ParamDef>TQ_ULONG <Parameter>len</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This takes a single <Literal>len</Literal> parameter. The +<Literal>data</Literal> is returned if there was no error, otherwise +<Literal>Py_None</Literal> is returned. +</Para> + +<FuncSynopsis> + <FuncDef>TQ_LONG <Function>readLine</Function></FuncDef> + <ParamDef>char *<Parameter>data</Parameter></ParamDef> + <ParamDef>TQ_ULONG <Parameter>maxlen</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This takes a single <Literal>maxlen</Literal> parameter. The +<Literal>data</Literal> is returned if there was no error, otherwise +<Literal>Py_None</Literal> is returned. +</Para> + +<FuncSynopsis> + <FuncDef>TQ_LONG <Function>writeBlock</Function></FuncDef> + <ParamDef>const char *<Parameter>data</Parameter></ParamDef> + <ParamDef>TQ_ULONG <Parameter>len</Parameter></ParamDef> +</FuncSynopsis> +<Para> +<Literal>len</Literal> is derived from <Literal>data</Literal> and not passed +as a parameter. +</Para> +</Sect2> +%End + + +class TQSocket : TQObject, TQIODevice +{ +%TypeHeaderCode +#include <tqsocket.h> +%End + +public: + enum Error { + ErrConnectionRefused, + ErrHostNotFound, + ErrSocketRead + }; + + TQSocket(TQObject * /TransferThis/ = 0,const char * = 0); + + enum State { + Idle, + HostLookup, + Connecting, + Connected, + Closing, + Connection + }; + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipWrapperType **type; + int yes, no; + } graph[] = { + {sipName_TQServerSocket, &sipClass_TQServerSocket, -1, 1}, + {sipName_TQSocket, &sipClass_TQSocket, -1, 2}, + {sipName_TQFtp, &sipClass_TQFtp, -1, 3}, + {sipName_TQLocalFs, &sipClass_TQLocalFs, -1, 4}, + {sipName_TQHttp, &sipClass_TQHttp, -1, 5}, + {sipName_TQDns, &sipClass_TQDns, -1, -1}, + }; + + int i = 0; + + sipClass = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipClass = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + + State state() const; + + int socket() const; + virtual void setSocket(int); + + TQSocketDevice *socketDevice(); + virtual void setSocketDevice(TQSocketDevice *); + +%If (TQt_DNS) + virtual void connectToHost(const TQString &,TQ_UINT16) /ReleaseGIL/; +%End + TQString peerName() const; + + bool open(int) /ReleaseGIL/; + void close() /ReleaseGIL/; + void flush() /ReleaseGIL/; + Offset size() const; + Offset at() const; + bool at(Offset); + bool atEnd() const; + + TQ_ULONG bytesAvailable() const; + TQ_ULONG waitForMore(int) const /ReleaseGIL/; + //TQ_ULONG waitForMore(int,bool *) const /ReleaseGIL/; + TQ_ULONG bytesToWrite() const; + void clearPendingData(); + + SIP_PYOBJECT readBlock(TQ_ULONG) /ReleaseGIL/ [TQ_LONG (char *,TQ_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + TQ_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipSelfWasArg ? sipCpp->TQSocket::readBlock(buf, a0) : sipCpp->readBlock(buf, a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + sipFree((void *)buf); + + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(buf,actlen); + + sipFree((void *)buf); + + if (sipRes == NULL) + sipIsErr = 1; + } + } +%End + + TQ_LONG writeBlock(const char * /Array/, + TQ_ULONG /ArraySize/) /ReleaseGIL/; + + SIP_PYOBJECT readLine(TQ_ULONG) /ReleaseGIL/ [TQ_LONG (char *,TQ_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + TQ_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipCpp -> readLine(buf,a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + sipFree((void *)buf); + + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(buf,actlen); + + sipFree((void *)buf); + + if (sipRes == NULL) + sipIsErr = 1; + } + } +%End + + int getch() /ReleaseGIL/; + int putch(int) /ReleaseGIL/; + int ungetch(int); + + bool canReadLine() const; + virtual TQString readLine() /ReleaseGIL/; + + TQ_UINT16 port() const; + TQ_UINT16 peerPort() const; + TQHostAddress address() const; + TQHostAddress peerAddress() const; + + void setReadBufferSize(TQ_ULONG); + TQ_ULONG readBufferSize() const; + +signals: + void hostFound(); + void connected(); + void connectionClosed(); + void delayedCloseFinished(); + void readyRead(); + void bytesWritten(int); + void error(int); + +protected: + +private: + TQSocket(const TQSocket &); +}; diff --git a/sip/tqtnetwork/tqsocketdevice.sip b/sip/tqtnetwork/tqsocketdevice.sip new file mode 100644 index 0000000..32ee5e5 --- /dev/null +++ b/sip/tqtnetwork/tqsocketdevice.sip @@ -0,0 +1,168 @@ +// This is the SIP interface definition for TQSocketDevice. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%ExportedDoc +<Sect2><Title>TQSocketDevice (TQt v2.2+)</Title> +<FuncSynopsis> + <FuncDef>TQ_LONG <Function>readBlock</Function></FuncDef> + <ParamDef>char *<Parameter>data</Parameter></ParamDef> + <ParamDef>TQ_ULONG <Parameter>len</Parameter></ParamDef> +</FuncSynopsis> +<Para> +This takes a single <Literal>len</Literal> parameter. The +<Literal>data</Literal> is returned if there was no error, otherwise +<Literal>None</Literal> is returned. +</Para> + +<FuncSynopsis> + <FuncDef>TQ_LONG <Function>writeBlock</Function></FuncDef> + <ParamDef>const char *<Parameter>data</Parameter></ParamDef> + <ParamDef>TQ_ULONG <Parameter>len</Parameter></ParamDef> +</FuncSynopsis> +<Para> +<Literal>len</Literal> is derived from <Literal>data</Literal> and not passed +as a parameter. +</Para> +</Sect2> +%End + + +class TQSocketDevice : TQIODevice +{ +%TypeHeaderCode +#include <tqsocketdevice.h> +%End + +public: + enum Type { + Stream, + Datagram + }; + + enum Protocol { + IPv4, + IPv6, + Unknown + }; + + TQSocketDevice(Type = Stream); + TQSocketDevice(Type,Protocol,int); + TQSocketDevice(int,Type); + + bool isValid() const; + Type type() const; + Protocol protocol() const; + + int socket() const; + virtual void setSocket(int,Type); + + bool open(int) /ReleaseGIL/; + void close(); + void flush() /ReleaseGIL/; + + 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 &,TQ_UINT16); + + virtual bool bind(const TQHostAddress &,TQ_UINT16); + virtual bool listen(int); + virtual int accept(); + + TQ_LONG bytesAvailable() const; + TQ_LONG waitForMore(int) const /ReleaseGIL/; + + SIP_PYOBJECT readBlock(TQ_ULONG) /ReleaseGIL/ [TQ_LONG (char *,TQ_ULONG)]; +%MethodCode + char *buf; + + if ((buf = (char *)sipMalloc(a0)) == NULL) + sipIsErr = 1; + else + { + TQ_LONG actlen; + + Py_BEGIN_ALLOW_THREADS + actlen = sipSelfWasArg ? sipCpp->TQSocketDevice::readBlock(buf, a0) : sipCpp->readBlock(buf, a0); + Py_END_ALLOW_THREADS + + if (actlen < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else if ((sipRes = PyBytes_FromStringAndSize(buf,actlen)) == NULL) + sipIsErr = 1; + + sipFree((void *)buf); + } +%End + + + TQ_LONG writeBlock(const char * /Array/, + TQ_ULONG /ArraySize/) /ReleaseGIL/; + virtual TQ_LONG writeBlock(const char * /Array/,TQ_ULONG /ArraySize/, + const TQHostAddress &,TQ_UINT16) /ReleaseGIL/; + + int getch(); + int putch(int); + int ungetch(int); + + TQ_UINT16 port() const; + TQ_UINT16 peerPort() const; + TQHostAddress address() const; + TQHostAddress peerAddress() const; + + enum Error { + NoError, + AlreadyBound, + Inaccessible, + NoResources, + Bug, + Impossible, + NoFiles, + ConnectionRefused, + NetworkFailure, + UnknownError + }; + + Error error() const; + +protected: + void setError(Error); + +private: + TQSocketDevice(const TQSocketDevice &); +}; diff --git a/sip/tqtnetwork/tqtnetworkmod.sip b/sip/tqtnetwork/tqtnetworkmod.sip new file mode 100644 index 0000000..db78a13 --- /dev/null +++ b/sip/tqtnetwork/tqtnetworkmod.sip @@ -0,0 +1,78 @@ +// This is the SIP interface definition for the tqtnetwork module of PyTQt. +// +// Copyright (c) 2007 +// Riverbank Computing Limited <info@riverbankcomputing.co.uk> +// +// This file is part of PyTQt. +// +// This copy of PyTQt is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. +// +// PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along with +// PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%Module PyTQt.tqtnetwork 1 + +%Import tqt/tqtmod.sip + +%Include copying.sip + + +%Include tqdns.sip +%Include tqhostaddress.sip +%Include tqftp.sip +%Include tqhttp.sip +%Include tqlocalfs.sip +%Include tqnetwork.sip +%Include tqserversocket.sip +%Include tqsocket.sip +%Include tqsocketdevice.sip + + +// The build file template. + +%Makefile tqtnetwork.pro.in +# The project file for the tqtnetwork module. +# +# Copyright (c) 2007 +# Riverbank Computing Limited <info@riverbankcomputing.co.uk> +# +# This file is part of PyTQt. +# +# This copy of PyTQt is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. +# +# PyTQt is supplied in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# PyTQt; see the file LICENSE. If not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +TEMPLATE = lib +TARGET = @BLX_TARGET_LIB@ +DESTDIR = @PYTQT_MODDIR@ +CONFIG += @BLX_CONFIG_LIB@ @PYTQT_WARN@ +INCLUDEPATH = @BLX_INCLUDEPATH@ +DEFINES = @BLX_DEFINES@ +LIBS += @PYTQT_TQT_MODULE@ @BLX_LIBS@ +macx:QMAKE_LFLAGS += -framework Python + +SOURCES = $B + +HEADERS = $H +%End |