diff options
Diffstat (limited to 'tdecore/network')
27 files changed, 457 insertions, 457 deletions
diff --git a/tdecore/network/kbufferedsocket.cpp b/tdecore/network/kbufferedsocket.cpp index 3566bde93..1b08d121e 100644 --- a/tdecore/network/kbufferedsocket.cpp +++ b/tdecore/network/kbufferedsocket.cpp @@ -38,7 +38,7 @@ using namespace KNetwork::Internal; class KNetwork::KBufferedSocketPrivate { public: - mutable KSocketBuffer *input, *output; + mutable TDESocketBuffer *input, *output; KBufferedSocketPrivate() { @@ -64,7 +64,7 @@ KBufferedSocket::~KBufferedSocket() delete d; } -void KBufferedSocket::setSocketDevice(KSocketDevice* device) +void KBufferedSocket::setSocketDevice(TDESocketDevice* device) { KStreamSocket::setSocketDevice(device); device->setBlocking(false); @@ -134,7 +134,7 @@ TQT_TQIO_LONG KBufferedSocket::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) return KStreamSocket::tqreadBlock(data, maxlen); } -TQT_TQIO_LONG KBufferedSocket::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSocketAddress& from) +TQT_TQIO_LONG KBufferedSocket::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from) { from = peerAddress(); return tqreadBlock(data, maxlen); @@ -156,7 +156,7 @@ TQ_LONG KBufferedSocket::peekBlock(char *data, TQ_ULONG maxlen) return KStreamSocket::peekBlock(data, maxlen); } -TQ_LONG KBufferedSocket::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) +TQ_LONG KBufferedSocket::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) { from = peerAddress(); return peekBlock(data, maxlen); @@ -193,7 +193,7 @@ TQT_TQIO_LONG KBufferedSocket::tqwriteBlock(const char *data, TQT_TQIO_ULONG len } TQT_TQIO_LONG KBufferedSocket::tqwriteBlock(const char *data, TQT_TQIO_ULONG maxlen, - const KSocketAddress&) + const TDESocketAddress&) { // ignore the third parameter return tqwriteBlock(data, maxlen); @@ -256,7 +256,7 @@ void KBufferedSocket::setInputBuffering(bool enable) } else if (d->input == 0L) { - d->input = new KSocketBuffer; + d->input = new TDESocketBuffer; } } @@ -275,7 +275,7 @@ void KBufferedSocket::setOutputBuffering(bool enable) } else if (d->output == 0L) { - d->output = new KSocketBuffer; + d->output = new TDESocketBuffer; } } diff --git a/tdecore/network/kbufferedsocket.h b/tdecore/network/kbufferedsocket.h index 93bee08f3..158a5a434 100644 --- a/tdecore/network/kbufferedsocket.h +++ b/tdecore/network/kbufferedsocket.h @@ -52,7 +52,7 @@ class KBufferedSocketPrivate; * imposed by Qt's TQSocketNotifier. If you want to use a socket * in an auxiliary thread, please use KStreamSocket. * - * @see KNetwork::KStreamSocket, KNetwork::KServerSocket + * @see KNetwork::KStreamSocket, KNetwork::TDEServerSocket * @author Thiago Macieira <thiago@kde.org> */ class TDECORE_EXPORT KBufferedSocket: public KStreamSocket @@ -79,7 +79,7 @@ public: /** * Be sure to catch new devices. */ - virtual void setSocketDevice(KSocketDevice* device); + virtual void setSocketDevice(TDESocketDevice* device); protected: /** @@ -122,7 +122,7 @@ public: * * The @p from parameter is always set to @ref peerAddress() */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSocketAddress& from); + virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from); /** * Peeks data from the socket. @@ -135,7 +135,7 @@ public: * * The @p from parameter is always set to @ref peerAddress() */ - virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress &from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress &from); /** * Writes data to the socket. @@ -148,7 +148,7 @@ public: * * The @p to parameter is discarded. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const KSocketAddress& to); + virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to); /** * Catch changes. diff --git a/tdecore/network/kclientsocketbase.cpp b/tdecore/network/kclientsocketbase.cpp index 780a5ec71..eb8e4883b 100644 --- a/tdecore/network/kclientsocketbase.cpp +++ b/tdecore/network/kclientsocketbase.cpp @@ -83,7 +83,7 @@ void KClientSocketBase::setState(SocketState state) bool KClientSocketBase::setSocketOptions(int opts) { TQMutexLocker locker(mutex()); - KSocketBase::setSocketOptions(opts); // call parent + TDESocketBase::setSocketOptions(opts); // call parent // don't create the device unnecessarily if (hasDevice()) @@ -323,7 +323,7 @@ TQT_TQIO_LONG KClientSocketBase::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) return retval; } -TQT_TQIO_LONG KClientSocketBase::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSocketAddress& from) +TQT_TQIO_LONG KClientSocketBase::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from) { resetError(); TQ_LONG retval = socketDevice()->tqreadBlock(data, maxlen, from); @@ -347,7 +347,7 @@ TQ_LONG KClientSocketBase::peekBlock(char *data, TQ_ULONG maxlen) return retval; } -TQ_LONG KClientSocketBase::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) +TQ_LONG KClientSocketBase::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) { resetError(); TQ_LONG retval = socketDevice()->peekBlock(data, maxlen, from); @@ -371,7 +371,7 @@ TQT_TQIO_LONG KClientSocketBase::tqwriteBlock(const char *data, TQT_TQIO_ULONG l return retval; } -TQT_TQIO_LONG KClientSocketBase::tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const KSocketAddress& to) +TQT_TQIO_LONG KClientSocketBase::tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to) { resetError(); TQ_LONG retval = socketDevice()->tqwriteBlock(data, len, to); @@ -383,12 +383,12 @@ TQT_TQIO_LONG KClientSocketBase::tqwriteBlock(const char *data, TQT_TQIO_ULONG l return retval; } -KSocketAddress KClientSocketBase::localAddress() const +TDESocketAddress KClientSocketBase::localAddress() const { return socketDevice()->localAddress(); } -KSocketAddress KClientSocketBase::peerAddress() const +TDESocketAddress KClientSocketBase::peerAddress() const { return socketDevice()->peerAddress(); } diff --git a/tdecore/network/kclientsocketbase.h b/tdecore/network/kclientsocketbase.h index 59da43511..68c45dd28 100644 --- a/tdecore/network/kclientsocketbase.h +++ b/tdecore/network/kclientsocketbase.h @@ -115,7 +115,7 @@ public: protected: /** - * Sets the socket options. Reimplemented from KSocketBase. + * Sets the socket options. Reimplemented from TDESocketBase. */ virtual bool setSocketOptions(int opts); @@ -160,7 +160,7 @@ public: * * This is useful, for instance, when IP addresses are in * their string representation (such as "1.2.3.4") or come - * from other sources like @ref KSocketAddress. + * from other sources like @ref TDESocketAddress. * * @param enable whether to enable */ @@ -186,7 +186,7 @@ public: * emitted (only once, even if we're doing a double lookup). * If the lookup failed (for any of the two lookups) the * @ref gotError signal will be emitted with the appropriate - * error condition (see @ref KSocketBase::SocketError). + * error condition (see @ref TDESocketBase::SocketError). * * This function returns true on success and false on error. Note that * this is not the lookup result! @@ -216,7 +216,7 @@ public: const TQString& service = TQString::null) = 0; /** - * Reimplemented from KSocketBase. Connect this socket to this + * Reimplemented from TDESocketBase. Connect this socket to this * specific address. * * Unlike @ref bind(const TQString&, const TQString&) above, this function @@ -258,7 +258,7 @@ public: /** * @overload - * Reimplemented from KSocketBase. + * Reimplemented from TDESocketBase. */ virtual bool connect(const KResolverEntry& address); @@ -300,7 +300,7 @@ public: /** * Returns the number of bytes available on this socket. - * Reimplemented from KSocketBase. + * Reimplemented from TDESocketBase. */ #ifdef USE_QT3 virtual TQ_LONG bytesAvailable() const; @@ -310,52 +310,52 @@ public: #endif /** - * Waits for more data. Reimplemented from KSocketBase. + * Waits for more data. Reimplemented from TDESocketBase. */ virtual TQ_LONG waitForMore(int msecs, bool *timeout = 0L); /** - * Reads data from a socket. Reimplemented from KSocketBase. + * Reads data from a socket. Reimplemented from TDESocketBase. */ virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen); /** * @overload - * Reads data from a socket. Reimplemented from KSocketBase. + * Reads data from a socket. Reimplemented from TDESocketBase. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSocketAddress& from); + virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from); /** - * Peeks data from the socket. Reimplemented from KSocketBase. + * Peeks data from the socket. Reimplemented from TDESocketBase. */ virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen); /** * @overload - * Peeks data from the socket. Reimplemented from KSocketBase. + * Peeks data from the socket. Reimplemented from TDESocketBase. */ - virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress &from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress &from); /** - * Writes data to the socket. Reimplemented from KSocketBase. + * Writes data to the socket. Reimplemented from TDESocketBase. */ virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len); /** * @overload - * Writes data to the socket. Reimplemented from KSocketBase. + * Writes data to the socket. Reimplemented from TDESocketBase. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const KSocketAddress& to); + virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to); /** - * Returns the local socket address. Reimplemented from KSocketBase. + * Returns the local socket address. Reimplemented from TDESocketBase. */ - virtual KSocketAddress localAddress() const; + virtual TDESocketAddress localAddress() const; /** - * Returns the peer socket address. Reimplemented from KSocketBase. + * Returns the peer socket address. Reimplemented from TDESocketBase. */ - virtual KSocketAddress peerAddress() const; + virtual TDESocketAddress peerAddress() const; /** * Returns true if the readyRead signal is set to be emitted. diff --git a/tdecore/network/kdatagramsocket.cpp b/tdecore/network/kdatagramsocket.cpp index c5a1562a4..ac8e526ee 100644 --- a/tdecore/network/kdatagramsocket.cpp +++ b/tdecore/network/kdatagramsocket.cpp @@ -153,7 +153,7 @@ KDatagramPacket KDatagramSocket::receive() } TQByteArray data(size); - KSocketAddress address; + TDESocketAddress address; // now do the reading size = tqreadBlock(data.data(), size, address); @@ -170,7 +170,7 @@ TQ_LONG KDatagramSocket::send(const KDatagramPacket& packet) return tqwriteBlock(packet.data(), packet.size(), packet.address()); } -TQ_LONG KDatagramSocket::tqwriteBlock(const char *data, TQ_ULONG len, const KSocketAddress& to) +TQ_LONG KDatagramSocket::tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) { if (to.family() != AF_UNSPEC) { diff --git a/tdecore/network/kdatagramsocket.h b/tdecore/network/kdatagramsocket.h index c51fea1ef..fd12a0d97 100644 --- a/tdecore/network/kdatagramsocket.h +++ b/tdecore/network/kdatagramsocket.h @@ -51,7 +51,7 @@ class KResolverEntry; class TDECORE_EXPORT KDatagramPacket { TQByteArray m_data; - KSocketAddress m_address; + TDESocketAddress m_address; public: /** @@ -78,14 +78,14 @@ public: /** * Constructs the datagram with the specified content and address. */ - KDatagramPacket(const TQByteArray& content, const KSocketAddress& addr) + KDatagramPacket(const TQByteArray& content, const TDESocketAddress& addr) : m_data(content), m_address(addr) { } /** * Constructs the datagram with the specified content and address. */ - KDatagramPacket(const char *content, uint length, const KSocketAddress& addr) + KDatagramPacket(const char *content, uint length, const TDESocketAddress& addr) : m_address(addr) { setData(content, length); } @@ -134,13 +134,13 @@ public: /** * Returns the socket address */ - const KSocketAddress& address() const + const TDESocketAddress& address() const { return m_address; } /** * Sets the address stored to the given value. */ - void setAddress(const KSocketAddress& addr) + void setAddress(const TDESocketAddress& addr) { m_address = addr; } /** @@ -241,7 +241,7 @@ public: /** * Writes data to the socket. Reimplemented from KClientSocketBase. */ - virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len, const KSocketAddress& to); + virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); /** * Receives one datagram from the stream. The reading process is guaranteed diff --git a/tdecore/network/khttpproxysocketdevice.cpp b/tdecore/network/khttpproxysocketdevice.cpp index 42d65326b..e4529f28a 100644 --- a/tdecore/network/khttpproxysocketdevice.cpp +++ b/tdecore/network/khttpproxysocketdevice.cpp @@ -45,15 +45,15 @@ public: KResolverEntry proxy; TQCString request; TQCString reply; - KSocketAddress peer; + TDESocketAddress peer; KHttpProxySocketDevicePrivate() : proxy(KHttpProxySocketDevice::defaultProxy) { } }; -KHttpProxySocketDevice::KHttpProxySocketDevice(const KSocketBase* parent) - : KSocketDevice(parent), d(new KHttpProxySocketDevicePrivate) +KHttpProxySocketDevice::KHttpProxySocketDevice(const TDESocketBase* parent) + : TDESocketDevice(parent), d(new KHttpProxySocketDevicePrivate) { } @@ -66,7 +66,7 @@ KHttpProxySocketDevice::KHttpProxySocketDevice(const KResolverEntry& proxy) KHttpProxySocketDevice::~KHttpProxySocketDevice() { // nothing special to be done during closing - // KSocketDevice::~KSocketDevice closes the socket + // TDESocketDevice::~TDESocketDevice closes the socket delete d; } @@ -90,27 +90,27 @@ void KHttpProxySocketDevice::setProxyServer(const KResolverEntry& proxy) void KHttpProxySocketDevice::close() { d->reply = d->request = TQCString(); - d->peer = KSocketAddress(); - KSocketDevice::close(); + d->peer = TDESocketAddress(); + TDESocketDevice::close(); } -KSocketAddress KHttpProxySocketDevice::peerAddress() const +TDESocketAddress KHttpProxySocketDevice::peerAddress() const { if (isOpen()) return d->peer; - return KSocketAddress(); + return TDESocketAddress(); } -KSocketAddress KHttpProxySocketDevice::externalAddress() const +TDESocketAddress KHttpProxySocketDevice::externalAddress() const { - return KSocketAddress(); + return TDESocketAddress(); } bool KHttpProxySocketDevice::connect(const KResolverEntry& address) { if (d->proxy.family() == AF_UNSPEC) // no proxy server set ! - return KSocketDevice::connect(address); + return TDESocketDevice::connect(address); if (isOpen()) { @@ -148,7 +148,7 @@ bool KHttpProxySocketDevice::connect(const TQString& node, const TQString& servi if (m_sockfd == -1) { // must create the socket - if (!KSocketDevice::connect(d->proxy)) + if (!TDESocketDevice::connect(d->proxy)) return false; // also unable to contact proxy server setState(0); // unset open flag @@ -170,7 +170,7 @@ bool KHttpProxySocketDevice::connect(const TQString& node, const TQString& servi bool KHttpProxySocketDevice::parseServerReply() { // make sure we're connected - if (!KSocketDevice::connect(d->proxy)) + if (!TDESocketDevice::connect(d->proxy)) if (error() == InProgress) return true; else if (error() != NoError) diff --git a/tdecore/network/khttpproxysocketdevice.h b/tdecore/network/khttpproxysocketdevice.h index 903d7aa6f..dc5faef93 100644 --- a/tdecore/network/khttpproxysocketdevice.h +++ b/tdecore/network/khttpproxysocketdevice.h @@ -35,18 +35,18 @@ class KHttpProxySocketDevicePrivate; * @class KHttpProxySocketDevice khttpproxysocketdevice.h khttproxysocketdevice.h * @brief The low-level backend for HTTP proxying. * - * This class derives from @ref KSocketDevice and implements the necessary + * This class derives from @ref TDESocketDevice and implements the necessary * calls to make a connection through an HTTP proxy. * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KHttpProxySocketDevice: public KSocketDevice +class TDECORE_EXPORT KHttpProxySocketDevice: public TDESocketDevice { public: /** * Constructor. */ - KHttpProxySocketDevice(const KSocketBase* = 0L); + KHttpProxySocketDevice(const TDESocketBase* = 0L); /** * Constructor with proxy server's address. @@ -92,13 +92,13 @@ public: /** * Return the peer address. */ - virtual KSocketAddress peerAddress() const; + virtual TDESocketAddress peerAddress() const; /** * Return the externally visible address. We can't tell what that address is, * so this function always returns an empty object. */ - virtual KSocketAddress externalAddress() const; + virtual TDESocketAddress externalAddress() const; private: /** diff --git a/tdecore/network/kmulticastsocket.h b/tdecore/network/kmulticastsocket.h index 848e64491..8fe413283 100644 --- a/tdecore/network/kmulticastsocket.h +++ b/tdecore/network/kmulticastsocket.h @@ -78,14 +78,14 @@ public: * @param group the multicast group to join * @returns true on success */ - virtual bool joinGroup(const KSocketAddress& group); + virtual bool joinGroup(const TDESocketAddress& group); /** * @overload * Joins a multicast group. This function also specifies the network interface * to be used. */ - virtual bool joinGroup(const KSocketAddress& group, + virtual bool joinGroup(const TDESocketAddress& group, const KNetworkInterface& iface); /** @@ -95,13 +95,13 @@ public: * @param group the group to leave * @returns true on successful leaving the group */ - virtual bool leaveGroup(const KSocketAddress& group); + virtual bool leaveGroup(const TDESocketAddress& group); /** * @overload * Leaves a multicast group. */ - virtual bool leaveGroup(const KSocketAddress& group, + virtual bool leaveGroup(const TDESocketAddress& group, const KNetworkInterface& iface); private: diff --git a/tdecore/network/kmulticastsocketdevice.h b/tdecore/network/kmulticastsocketdevice.h index ffb567ff1..a24ba326a 100644 --- a/tdecore/network/kmulticastsocketdevice.h +++ b/tdecore/network/kmulticastsocketdevice.h @@ -42,13 +42,13 @@ class KMulticastSocketImplPrivate; * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class KMulticastSocketImpl: public KSocketDevice +class KMulticastSocketImpl: public TDESocketDevice { public: /** * Constructor. */ - KMulticastSocketImpl(const KSocketBase* = 0L); + KMulticastSocketImpl(const TDESocketBase* = 0L); /** * Destructor @@ -117,14 +117,14 @@ public: * @param group the multicast group to join * @returns true on success */ - virtual bool joinGroup(const KSocketAddress& group); + virtual bool joinGroup(const TDESocketAddress& group); /** * @overload * Joins a multicast group. This function also specifies the network interface * to be used. */ - virtual bool joinGroup(const KSocketAddress& group, + virtual bool joinGroup(const TDESocketAddress& group, const KNetworkInterface& iface); /** @@ -134,13 +134,13 @@ public: * @param group the group to leave * @returns true on successful leaving the group */ - virtual bool leaveGroup(const KSocketAddress& group); + virtual bool leaveGroup(const TDESocketAddress& group); /** * @overload * Leaves a multicast group. */ - virtual bool leaveGroup(const KSocketAddress& group, + virtual bool leaveGroup(const TDESocketAddress& group, const KNetworkInterface& iface); private: KMulticastSocketImplPrivate *d; diff --git a/tdecore/network/kresolver.cpp b/tdecore/network/kresolver.cpp index a6ca8e45c..1c32e80ec 100644 --- a/tdecore/network/kresolver.cpp +++ b/tdecore/network/kresolver.cpp @@ -75,7 +75,7 @@ using namespace KNetwork::Internal; class KNetwork::KResolverEntryPrivate: public TQShared { public: - KSocketAddress addr; + TDESocketAddress addr; int socktype; int protocol; TQString canonName; @@ -93,7 +93,7 @@ KResolverEntry::KResolverEntry() : } // constructor with stuff -KResolverEntry::KResolverEntry(const KSocketAddress& addr, int socktype, int protocol, +KResolverEntry::KResolverEntry(const TDESocketAddress& addr, int socktype, int protocol, const TQString& canonName, const TQCString& encodedName) : d(new KResolverEntryPrivate) { @@ -110,7 +110,7 @@ KResolverEntry::KResolverEntry(const struct sockaddr* sa, TQ_UINT16 salen, int s const TQCString& encodedName) : d(new KResolverEntryPrivate) { - d->addr = KSocketAddress(sa, salen); + d->addr = TDESocketAddress(sa, salen); d->socktype = socktype; d->protocol = protocol; d->canonName = canonName; @@ -135,9 +135,9 @@ KResolverEntry::~KResolverEntry() } // returns the socket address -KSocketAddress KResolverEntry::address() const +TDESocketAddress KResolverEntry::address() const { - return d ? d->addr : KSocketAddress(); + return d ? d->addr : TDESocketAddress(); } // returns the length diff --git a/tdecore/network/kresolver.h b/tdecore/network/kresolver.h index 5e20e174a..3de19acd3 100644 --- a/tdecore/network/kresolver.h +++ b/tdecore/network/kresolver.h @@ -73,10 +73,10 @@ public: KResolverEntry(); /** - * Constructs a new KResolverEntry from a KSocketAddress + * Constructs a new KResolverEntry from a TDESocketAddress * and other data. * - * The KSocketAddress @p addr parameter will be deep-copied. + * The TDESocketAddress @p addr parameter will be deep-copied. * * @param addr the address that was resolved * @param socktype the socket type of the resolved address @@ -84,7 +84,7 @@ public: * @param canonName the canonical name of the resolved hostname * @param encodedName the ASCII-compatible encoding of the hostname */ - KResolverEntry(const KSocketAddress& addr, int socktype, int protocol, + KResolverEntry(const TDESocketAddress& addr, int socktype, int protocol, const TQString& canonName = TQString::null, const TQCString& encodedName = TQCString()); @@ -92,7 +92,7 @@ public: * Constructs a new KResolverEntry from raw forms of * socket addresses and other data. * - * This constructor instead creates an internal KSocketAddress object. + * This constructor instead creates an internal TDESocketAddress object. * * @param sa the sockaddr structure containing the raw address * @param salen the length of the sockaddr structure @@ -123,7 +123,7 @@ public: /** * Retrieves the socket address associated with this entry. */ - KSocketAddress address() const; + TDESocketAddress address() const; /** * Retrieves the length of the socket address structure. diff --git a/tdecore/network/kreverseresolver.cpp b/tdecore/network/kreverseresolver.cpp index 20ec41b1d..fc172c2ff 100644 --- a/tdecore/network/kreverseresolver.cpp +++ b/tdecore/network/kreverseresolver.cpp @@ -55,7 +55,7 @@ namespace class ReverseThread: public KResolverWorkerBase { public: - ReverseThread(const KSocketAddress& addr, int flags) + ReverseThread(const TDESocketAddress& addr, int flags) : m_addr(addr), m_flags(flags), m_parent(0L) { } @@ -68,7 +68,7 @@ namespace virtual bool postprocess(); // input: - KSocketAddress m_addr; + TDESocketAddress m_addr; int m_flags; KReverseResolver *m_parent; @@ -99,18 +99,18 @@ class KNetwork::KReverseResolverPrivate public: TQString node; TQString service; - KSocketAddress addr; + TDESocketAddress addr; int flags; ReverseThread* worker; bool success; - inline KReverseResolverPrivate(const KSocketAddress& _addr) + inline KReverseResolverPrivate(const TDESocketAddress& _addr) : addr(_addr), worker(0L), success(false) { } }; -KReverseResolver::KReverseResolver(const KSocketAddress& addr, int flags, +KReverseResolver::KReverseResolver(const TDESocketAddress& addr, int flags, TQObject *parent, const char* name) : TQObject(parent, name), d(new KReverseResolverPrivate(addr)) { @@ -148,7 +148,7 @@ TQString KReverseResolver::service() const return d->service; } -const KSocketAddress& KReverseResolver::address() const +const TDESocketAddress& KReverseResolver::address() const { return d->addr; } @@ -190,7 +190,7 @@ bool KReverseResolver::event(TQEvent *e) return true; } -bool KReverseResolver::resolve(const KSocketAddress& addr, TQString& node, +bool KReverseResolver::resolve(const TDESocketAddress& addr, TQString& node, TQString& serv, int flags) { ReverseThread th(addr, flags); @@ -206,7 +206,7 @@ bool KReverseResolver::resolve(const KSocketAddress& addr, TQString& node, bool KReverseResolver::resolve(const struct sockaddr* sa, TQ_UINT16 salen, TQString& node, TQString& serv, int flags) { - return resolve(KSocketAddress(sa, salen), node, serv, flags); + return resolve(TDESocketAddress(sa, salen), node, serv, flags); } bool ReverseThread::run() diff --git a/tdecore/network/kreverseresolver.h b/tdecore/network/kreverseresolver.h index 21a17b0a5..4a3fa4bdd 100644 --- a/tdecore/network/kreverseresolver.h +++ b/tdecore/network/kreverseresolver.h @@ -88,7 +88,7 @@ public: * @param addr the address to resolve * @param flags the flags to use, see @ref Flags */ - KReverseResolver(const KSocketAddress& addr, int flags = 0, + KReverseResolver(const TDESocketAddress& addr, int flags = 0, TQObject * = 0L, const char * = 0L); /** @@ -128,7 +128,7 @@ public: /** * Returns the socket address which was subject to resolution. */ - const KSocketAddress& address() const; + const TDESocketAddress& address() const; /** * Starts the resolution. This function returns 'true' @@ -165,7 +165,7 @@ public: * @return true if the resolution succeeded, false if not * @see ReverseFlags for the possible values for @p flags */ - static bool resolve(const KSocketAddress& addr, TQString& node, + static bool resolve(const TDESocketAddress& addr, TQString& node, TQString& serv, int flags = 0); /** diff --git a/tdecore/network/kserversocket.cpp b/tdecore/network/kserversocket.cpp index 007258f6b..d5a1b90bb 100644 --- a/tdecore/network/kserversocket.cpp +++ b/tdecore/network/kserversocket.cpp @@ -37,7 +37,7 @@ using namespace KNetwork; -class KNetwork::KServerSocketPrivate +class KNetwork::TDEServerSocketPrivate { public: KResolver resolver; @@ -49,7 +49,7 @@ public: bool bindWhenFound : 1, listenWhenBound : 1, useKBufferedSocket : 1; - KServerSocketPrivate() + TDEServerSocketPrivate() : state(None), timeout(0), bindWhenFound(false), listenWhenBound(false), useKBufferedSocket(true) { @@ -58,56 +58,56 @@ public: } }; -KServerSocket::KServerSocket(TQObject* parent, const char *name) - : TQObject(parent, name), d(new KServerSocketPrivate) +TDEServerSocket::TDEServerSocket(TQObject* parent, const char *name) + : TQObject(parent, name), d(new TDEServerSocketPrivate) { TQObject::connect(&d->resolver, TQT_SIGNAL(finished(KResolverResults)), this, TQT_SLOT(lookupFinishedSlot())); } -KServerSocket::KServerSocket(const TQString& service, TQObject* parent, const char *name) - : TQObject(parent, name), d(new KServerSocketPrivate) +TDEServerSocket::TDEServerSocket(const TQString& service, TQObject* parent, const char *name) + : TQObject(parent, name), d(new TDEServerSocketPrivate) { TQObject::connect(&d->resolver, TQT_SIGNAL(finished(KResolverResults)), this, TQT_SLOT(lookupFinishedSlot())); d->resolver.setServiceName(service); } -KServerSocket::KServerSocket(const TQString& node, const TQString& service, +TDEServerSocket::TDEServerSocket(const TQString& node, const TQString& service, TQObject* parent, const char* name) - : TQObject(parent, name), d(new KServerSocketPrivate) + : TQObject(parent, name), d(new TDEServerSocketPrivate) { TQObject::connect(&d->resolver, TQT_SIGNAL(finished(KResolverResults)), this, TQT_SLOT(lookupFinishedSlot())); setAddress(node, service); } -KServerSocket::~KServerSocket() +TDEServerSocket::~TDEServerSocket() { close(); delete d; } -bool KServerSocket::setSocketOptions(int opts) +bool TDEServerSocket::setSocketOptions(int opts) { TQMutexLocker locker(mutex()); - KSocketBase::setSocketOptions(opts); // call parent + TDESocketBase::setSocketOptions(opts); // call parent bool result = socketDevice()->setSocketOptions(opts); // and set the implementation copyError(); return result; } -KResolver& KServerSocket::resolver() const +KResolver& TDEServerSocket::resolver() const { return d->resolver; } -const KResolverResults& KServerSocket::resolverResults() const +const KResolverResults& TDEServerSocket::resolverResults() const { return d->resolverResults; } -void KServerSocket::setResolutionEnabled(bool enable) +void TDEServerSocket::setResolutionEnabled(bool enable) { if (enable) d->resolver.setFlags(d->resolver.flags() & ~KResolver::NoResolve); @@ -115,41 +115,41 @@ void KServerSocket::setResolutionEnabled(bool enable) d->resolver.setFlags(d->resolver.flags() | KResolver::NoResolve); } -void KServerSocket::setFamily(int families) +void TDEServerSocket::setFamily(int families) { d->resolver.setFamily(families); } -void KServerSocket::setAddress(const TQString& service) +void TDEServerSocket::setAddress(const TQString& service) { d->resolver.setNodeName(TQString::null); d->resolver.setServiceName(service); d->resolverResults.empty(); - if (d->state <= KServerSocketPrivate::LookupDone) - d->state = KServerSocketPrivate::None; + if (d->state <= TDEServerSocketPrivate::LookupDone) + d->state = TDEServerSocketPrivate::None; } -void KServerSocket::setAddress(const TQString& node, const TQString& service) +void TDEServerSocket::setAddress(const TQString& node, const TQString& service) { d->resolver.setNodeName(node); d->resolver.setServiceName(service); d->resolverResults.empty(); - if (d->state <= KServerSocketPrivate::LookupDone) - d->state = KServerSocketPrivate::None; + if (d->state <= TDEServerSocketPrivate::LookupDone) + d->state = TDEServerSocketPrivate::None; } -void KServerSocket::setTimeout(int msec) +void TDEServerSocket::setTimeout(int msec) { d->timeout = msec; } -bool KServerSocket::lookup() +bool TDEServerSocket::lookup() { setError(NoError); if (d->resolver.isRunning() && !blocking()) return true; // already doing lookup - if (d->state >= KServerSocketPrivate::LookupDone) + if (d->state >= TDEServerSocketPrivate::LookupDone) return true; // results are already available // make sure we have at least one parameter for lookup @@ -179,13 +179,13 @@ bool KServerSocket::lookup() return true; } -bool KServerSocket::bind(const KResolverEntry& address) +bool TDEServerSocket::bind(const KResolverEntry& address) { if (socketDevice()->bind(address)) { setError(NoError); - d->state = KServerSocketPrivate::Bound; + d->state = TDEServerSocketPrivate::Bound; emit bound(address); return true; } @@ -193,30 +193,30 @@ bool KServerSocket::bind(const KResolverEntry& address) return false; } -bool KServerSocket::bind(const TQString& node, const TQString& service) +bool TDEServerSocket::bind(const TQString& node, const TQString& service) { setAddress(node, service); return bind(); } -bool KServerSocket::bind(const TQString& service) +bool TDEServerSocket::bind(const TQString& service) { setAddress(service); return bind(); } -bool KServerSocket::bind() +bool TDEServerSocket::bind() { - if (d->state >= KServerSocketPrivate::Bound) + if (d->state >= TDEServerSocketPrivate::Bound) return true; - if (d->state < KServerSocketPrivate::LookupDone) + if (d->state < TDEServerSocketPrivate::LookupDone) { if (!blocking()) { d->bindWhenFound = true; bool ok = lookup(); // will call doBind - if (d->state >= KServerSocketPrivate::Bound) + if (d->state >= TDEServerSocketPrivate::Bound) d->bindWhenFound = false; return ok; } @@ -229,19 +229,19 @@ bool KServerSocket::bind() return doBind(); } -bool KServerSocket::listen(int backlog) +bool TDEServerSocket::listen(int backlog) { // WARNING // this function has to be reentrant // due to the mechanisms used for binding, this function might // end up calling itself - if (d->state == KServerSocketPrivate::Listening) + if (d->state == TDEServerSocketPrivate::Listening) return true; // already listening d->backlog = backlog; - if (d->state < KServerSocketPrivate::Bound) + if (d->state < TDEServerSocketPrivate::Bound) { // we must bind // note that we can end up calling ourselves here @@ -252,7 +252,7 @@ bool KServerSocket::listen(int backlog) return false; } - if (d->state < KServerSocketPrivate::Bound) + if (d->state < TDEServerSocketPrivate::Bound) // asynchronous lookup in progress... // we can't be blocking here anyways return true; @@ -260,29 +260,29 @@ bool KServerSocket::listen(int backlog) d->listenWhenBound = false; } - if (d->state < KServerSocketPrivate::Listening) + if (d->state < TDEServerSocketPrivate::Listening) return doListen(); return true; } -void KServerSocket::close() +void TDEServerSocket::close() { socketDevice()->close(); if (d->resolver.isRunning()) d->resolver.cancel(false); - d->state = KServerSocketPrivate::None; + d->state = TDEServerSocketPrivate::None; emit closed(); } -void KServerSocket::setAcceptBuffered(bool enable) +void TDEServerSocket::setAcceptBuffered(bool enable) { d->useKBufferedSocket = enable; } -KActiveSocketBase* KServerSocket::accept() +KActiveSocketBase* TDEServerSocket::accept() { - if (d->state < KServerSocketPrivate::Listening) + if (d->state < TDEServerSocketPrivate::Listening) { if (!blocking()) { @@ -310,7 +310,7 @@ KActiveSocketBase* KServerSocket::accept() } // we're listening here - KSocketDevice* accepted = socketDevice()->accept(); + TDESocketDevice* accepted = socketDevice()->accept(); if (!accepted) { // error happened during accept @@ -334,19 +334,19 @@ KActiveSocketBase* KServerSocket::accept() return streamsocket; } -KSocketAddress KServerSocket::localAddress() const +TDESocketAddress TDEServerSocket::localAddress() const { return socketDevice()->localAddress(); } -KSocketAddress KServerSocket::externalAddress() const +TDESocketAddress TDEServerSocket::externalAddress() const { return socketDevice()->externalAddress(); } -void KServerSocket::lookupFinishedSlot() +void TDEServerSocket::lookupFinishedSlot() { - if (d->resolver.isRunning() || d->state > KServerSocketPrivate::LookupDone) + if (d->resolver.isRunning() || d->state > TDEServerSocketPrivate::LookupDone) return; if (d->resolver.status() < 0) @@ -354,25 +354,25 @@ void KServerSocket::lookupFinishedSlot() setError(LookupFailure); emit gotError(LookupFailure); d->bindWhenFound = d->listenWhenBound = false; - d->state = KServerSocketPrivate::None; + d->state = TDEServerSocketPrivate::None; return; } // lookup succeeded d->resolverResults = d->resolver.results(); - d->state = KServerSocketPrivate::LookupDone; + d->state = TDEServerSocketPrivate::LookupDone; emit hostFound(); if (d->bindWhenFound) doBind(); } -void KServerSocket::copyError() +void TDEServerSocket::copyError() { setError(socketDevice()->error()); } -bool KServerSocket::doBind() +bool TDEServerSocket::doBind() { d->bindWhenFound = false; // loop through the results and bind to the first that works @@ -393,7 +393,7 @@ bool KServerSocket::doBind() return false; } -bool KServerSocket::doListen() +bool TDEServerSocket::doListen() { if (!socketDevice()->listen(d->backlog)) { @@ -405,7 +405,7 @@ bool KServerSocket::doListen() // set up ready accept signal TQObject::connect(socketDevice()->readNotifier(), TQT_SIGNAL(activated(int)), this, TQT_SIGNAL(readyAccept())); - d->state = KServerSocketPrivate::Listening; + d->state = TDEServerSocketPrivate::Listening; return true; } diff --git a/tdecore/network/kserversocket.h b/tdecore/network/kserversocket.h index 4f1af33b9..6821a886a 100644 --- a/tdecore/network/kserversocket.h +++ b/tdecore/network/kserversocket.h @@ -30,14 +30,14 @@ namespace KNetwork { -class KSocketDevice; +class TDESocketDevice; class KStreamSocket; class KResolver; class KResolverResults; -class KServerSocketPrivate; +class TDEServerSocketPrivate; /** - * @class KServerSocket kserversocket.h kserversocket.h + * @class TDEServerSocket kserversocket.h kserversocket.h * @brief A server socket for accepting connections. * * This class provides functionality for creating a socket to @@ -49,7 +49,7 @@ class KServerSocketPrivate; * A typical example would look like: * \code * TQString service = "http"; - * KServerSocket *ss = new KServerSocket(service); + * TDEServerSocket *ss = new TDEServerSocket(service); * connect(ss, TQT_SIGNAL(readyAccept()), this, TQT_SLOT(slotReadyAccept())); * connect(ss, TQT_SIGNAL(gotError(int)), this, TQT_SLOT(slotSocketError(int))); * ss->listen(); @@ -70,14 +70,14 @@ class KServerSocketPrivate; * * For another example of usage, this below code attempts to make a connection on any port within a range: * \code - * KServerSocket *ss = new KServerSocket(); + * TDEServerSocket *ss = new TDEServerSocket(); * ss->setFamily(KResolver::InetFamily); * bool found = false; * for( unsigned int port = firstport; port <= lastport; ++port) { * ss->setAddress( TQString::number( port ) ); * bool success = ss->listen(); * if( found = ( success && ss->error() == - * KSocketBase::NoError ) ) + * TDESocketBase::NoError ) ) * break; * ss->close(); * } @@ -98,13 +98,13 @@ class KServerSocketPrivate; * KNetwork::KBufferedSocket (default). If you want to accept a * non-buffered socket, you must first call setAcceptBuffered. * - * @warning If you use KServerSocket in an auxiliary (non-GUI) thread, + * @warning If you use TDEServerSocket in an auxiliary (non-GUI) thread, * you need to accept only KNetwork::KStreamSocket objects. * * @see KNetwork::KStreamSocket, KNetwork::KBufferedSocket * @author Thiago Macieira <thiago@kde.org> */ -class TDECORE_EXPORT KServerSocket: public TQObject, public KPassiveSocketBase +class TDECORE_EXPORT TDEServerSocket: public TQObject, public KPassiveSocketBase { Q_OBJECT @@ -119,7 +119,7 @@ public: * @param parent the parent TQObject object * @param name the name of this object */ - KServerSocket(TQObject* parent = 0L, const char *name = 0L); + TDEServerSocket(TQObject* parent = 0L, const char *name = 0L); /** * Construct this object specifying the service to listen on. @@ -138,7 +138,7 @@ public: * @param parent the parent TQObject object * @param name the name of this object */ - KServerSocket(const TQString& service, TQObject* parent = 0L, const char *name = 0L); + TDEServerSocket(const TQString& service, TQObject* parent = 0L, const char *name = 0L); /** * Construct this object specifying the node and service names to listen on. @@ -158,7 +158,7 @@ public: * @param parent the parent TQObject object * @param name the name of this object */ - KServerSocket(const TQString& node, const TQString& service, + TDEServerSocket(const TQString& node, const TQString& service, TQObject* parent = 0L, const char *name = 0L); /** @@ -167,11 +167,11 @@ public: * Note, however, that accepted sockets do not get closed when this * object closes. */ - ~KServerSocket(); + ~TDEServerSocket(); protected: /** - * Sets the socket options. Reimplemented from KSocketBase. + * Sets the socket options. Reimplemented from TDESocketBase. */ virtual bool setSocketOptions(int opts); @@ -201,7 +201,7 @@ public: * * This is useful, for instance, when IP addresses are in * their string representation (such as "1.2.3.4") or come - * from other sources like @ref KSocketAddress. + * from other sources like @ref TDESocketAddress. * * @param enable whether to enable */ @@ -268,7 +268,7 @@ public: * emitted (only once, even if we're doing a double lookup). * If the lookup failed (for any of the two lookups) the * @ref gotError signal will be emitted with the appropriate - * error condition (see @ref KSocketBase::SocketError). + * error condition (see @ref TDESocketBase::SocketError). * * This function returns true on success and false on error. Note that * this is not the lookup result! @@ -306,7 +306,7 @@ public: virtual bool bind(); /** - * Connect this socket to this specific address. Reimplemented from KSocketBase. + * Connect this socket to this specific address. Reimplemented from TDESocketBase. * * Unlike @ref bind(const TQString&, const TQString&) above, this function * really does bind the socket. No lookup is performed. The @ref bound signal @@ -369,12 +369,12 @@ public: /** * Returns this socket's local address. */ - virtual KSocketAddress localAddress() const; + virtual TDESocketAddress localAddress() const; /** * Returns this socket's externally-visible address if know. */ - virtual KSocketAddress externalAddress() const; + virtual TDESocketAddress externalAddress() const; private slots: void lookupFinishedSlot(); @@ -425,10 +425,10 @@ private: bool doListen(); private: - KServerSocket(const KServerSocket&); - KServerSocket& operator=(const KServerSocket&); + TDEServerSocket(const TDEServerSocket&); + TDEServerSocket& operator=(const TDEServerSocket&); - KServerSocketPrivate *d; + TDEServerSocketPrivate *d; }; } // namespace KNetwork diff --git a/tdecore/network/ksockssocketdevice.cpp b/tdecore/network/ksockssocketdevice.cpp index 6a60ce0a3..c1649c340 100644 --- a/tdecore/network/ksockssocketdevice.cpp +++ b/tdecore/network/ksockssocketdevice.cpp @@ -43,15 +43,15 @@ using namespace KNetwork; // constructor // nothing to do -KSocksSocketDevice::KSocksSocketDevice(const KSocketBase* obj) - : KSocketDevice(obj) +KSocksSocketDevice::KSocksSocketDevice(const TDESocketBase* obj) + : TDESocketDevice(obj) { } // constructor with argument // nothing to do KSocksSocketDevice::KSocksSocketDevice(int fd) - : KSocketDevice(fd) + : TDESocketDevice(fd) { } @@ -67,7 +67,7 @@ int KSocksSocketDevice::capabilities() const return 0; // can do everything! } -// From here on, the code is almost exactly a copy of KSocketDevice +// From here on, the code is almost exactly a copy of TDESocketDevice // the differences are the use of KSocks where appropriate bool KSocksSocketDevice::bind(const KResolverEntry& address) @@ -190,7 +190,7 @@ KSocksSocketDevice* KSocksSocketDevice::accept() return new KSocksSocketDevice(newfd); } -static int socks_read_common(int sockfd, char *data, TQ_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false) +static int socks_read_common(int sockfd, char *data, TQ_ULONG maxlen, TDESocketAddress* from, ssize_t &retval, bool peek = false) { kde_socklen_t len; if (from) @@ -204,9 +204,9 @@ static int socks_read_common(int sockfd, char *data, TQ_ULONG maxlen, KSocketAdd if (retval == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) - return KSocketDevice::WouldBlock; + return TDESocketDevice::WouldBlock; else - return KSocketDevice::UnknownError; + return TDESocketDevice::UnknownError; } if (from) @@ -235,7 +235,7 @@ TQ_LONG KSocksSocketDevice::tqreadBlock(char *data, TQ_ULONG maxlen) return retval; } -TQ_LONG KSocksSocketDevice::tqreadBlock(char *data, TQ_ULONG maxlen, KSocketAddress &from) +TQ_LONG KSocksSocketDevice::tqreadBlock(char *data, TQ_ULONG maxlen, TDESocketAddress &from) { resetError(); if (m_sockfd == -1) @@ -277,7 +277,7 @@ TQ_LONG KSocksSocketDevice::peekBlock(char *data, TQ_ULONG maxlen) return retval; } -TQ_LONG KSocksSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) +TQ_LONG KSocksSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) { resetError(); if (m_sockfd == -1) @@ -300,10 +300,10 @@ TQ_LONG KSocksSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddres TQ_LONG KSocksSocketDevice::tqwriteBlock(const char *data, TQ_ULONG len) { - return tqwriteBlock(data, len, KSocketAddress()); + return tqwriteBlock(data, len, TDESocketAddress()); } -TQ_LONG KSocksSocketDevice::tqwriteBlock(const char *data, TQ_ULONG len, const KSocketAddress& to) +TQ_LONG KSocksSocketDevice::tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to) { resetError(); if (m_sockfd == -1) @@ -325,17 +325,17 @@ TQ_LONG KSocksSocketDevice::tqwriteBlock(const char *data, TQ_ULONG len, const K return retval; } -KSocketAddress KSocksSocketDevice::localAddress() const +TDESocketAddress KSocksSocketDevice::localAddress() const { if (m_sockfd == -1) - return KSocketAddress(); // not open, empty value + return TDESocketAddress(); // not open, empty value kde_socklen_t len; - KSocketAddress localAddress; + TDESocketAddress localAddress; localAddress.setLength(len = 32); // arbitrary value if (KSocks::self()->getsockname(m_sockfd, localAddress.address(), &len) == -1) // error! - return KSocketAddress(); + return TDESocketAddress(); if (len <= localAddress.length()) { @@ -349,22 +349,22 @@ KSocketAddress KSocksSocketDevice::localAddress() const localAddress.setLength(len); if (KSocks::self()->getsockname(m_sockfd, localAddress.address(), &len) == -1) // error! - return KSocketAddress(); + return TDESocketAddress(); return localAddress; } -KSocketAddress KSocksSocketDevice::peerAddress() const +TDESocketAddress KSocksSocketDevice::peerAddress() const { if (m_sockfd == -1) - return KSocketAddress(); // not open, empty value + return TDESocketAddress(); // not open, empty value kde_socklen_t len; - KSocketAddress peerAddress; + TDESocketAddress peerAddress; peerAddress.setLength(len = 32); // arbitrary value if (KSocks::self()->getpeername(m_sockfd, peerAddress.address(), &len) == -1) // error! - return KSocketAddress(); + return TDESocketAddress(); if (len <= peerAddress.length()) { @@ -378,15 +378,15 @@ KSocketAddress KSocksSocketDevice::peerAddress() const peerAddress.setLength(len); if (KSocks::self()->getpeername(m_sockfd, peerAddress.address(), &len) == -1) // error! - return KSocketAddress(); + return TDESocketAddress(); return peerAddress; } -KSocketAddress KSocksSocketDevice::externalAddress() const +TDESocketAddress KSocksSocketDevice::externalAddress() const { // return empty, indicating unknown external address - return KSocketAddress(); + return TDESocketAddress(); } bool KSocksSocketDevice::poll(bool *input, bool *output, bool *exception, @@ -474,13 +474,13 @@ void KSocksSocketDevice::initSocks() init = true; if (KSocks::self()->hasSocks()) - delete KSocketDevice::setDefaultImpl(new KSocketDeviceFactory<KSocksSocketDevice>); + delete TDESocketDevice::setDefaultImpl(new TDESocketDeviceFactory<KSocksSocketDevice>); } #if 0 static bool register() { - KSocketDevice::addNewImpl(new KSocketDeviceFactory<KSocksSocketDevice>, 0); + TDESocketDevice::addNewImpl(new TDESocketDeviceFactory<KSocksSocketDevice>, 0); } static bool register = registered(); diff --git a/tdecore/network/ksockssocketdevice.h b/tdecore/network/ksockssocketdevice.h index 5c93b6d8c..2a83c0adc 100644 --- a/tdecore/network/ksockssocketdevice.h +++ b/tdecore/network/ksockssocketdevice.h @@ -28,7 +28,7 @@ namespace KNetwork { * @class KSocksSocketDevice ksockssocketdevice.h ksockssocketdevice.h * @brief The low-level class for SOCKS proxying. * - * This class reimplements several functions from @ref KSocketDevice in order + * This class reimplements several functions from @ref TDESocketDevice in order * to implement SOCKS support. * * This works by using KSocks. @@ -37,13 +37,13 @@ namespace KNetwork { * * @warning This code is untested! */ -class TDECORE_EXPORT KSocksSocketDevice: public KSocketDevice +class TDECORE_EXPORT KSocksSocketDevice: public TDESocketDevice { public: /** * Constructor. */ - KSocksSocketDevice(const KSocketBase* = 0L); + KSocksSocketDevice(const TDESocketBase* = 0L); /** * Construct from a file descriptor. @@ -84,34 +84,34 @@ public: * Overrides reading. */ virtual TQ_LONG tqreadBlock(char *data, TQ_ULONG maxlen); - virtual TQ_LONG tqreadBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG tqreadBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); /** * Overrides peeking. */ virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen); - virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); /** * Overrides writing. */ virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len); - virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len, const KSocketAddress& to); + virtual TQ_LONG tqwriteBlock(const char *data, TQ_ULONG len, const TDESocketAddress& to); /** * Overrides getting socket address. */ - virtual KSocketAddress localAddress() const; + virtual TDESocketAddress localAddress() const; /** * Overrides getting peer address. */ - virtual KSocketAddress peerAddress() const; + virtual TDESocketAddress peerAddress() const; /** * Overrides getting external address. */ - virtual KSocketAddress externalAddress() const; + virtual TDESocketAddress externalAddress() const; /** * Overrides polling. @@ -121,7 +121,7 @@ public: private: static void initSocks(); - friend class KSocketDevice; + friend class TDESocketDevice; }; } // namespace KNetwork diff --git a/tdecore/network/kstreamsocket.h b/tdecore/network/kstreamsocket.h index ab90e923a..d077296c1 100644 --- a/tdecore/network/kstreamsocket.h +++ b/tdecore/network/kstreamsocket.h @@ -34,7 +34,7 @@ namespace KNetwork { class KResolverEntry; class KResolverResults; -class KServerSocket; +class TDEServerSocket; class KBufferedSocket; class KStreamSocketPrivate; @@ -91,7 +91,7 @@ class KStreamSocketPrivate; * } * \endcode * - * @see KNetwork::KBufferedSocket, KNetwork::KServerSocket + * @see KNetwork::KBufferedSocket, KNetwork::TDEServerSocket * @author Thiago Macieira <thiago@kde.org> */ class TDECORE_EXPORT KStreamSocket: public KClientSocketBase @@ -241,7 +241,7 @@ private: KStreamSocketPrivate *d; - friend class KServerSocket; + friend class TDEServerSocket; friend class KBufferedSocket; }; diff --git a/tdecore/network/tdesocketaddress.cpp b/tdecore/network/tdesocketaddress.cpp index d1234044b..ff97699c8 100644 --- a/tdecore/network/tdesocketaddress.cpp +++ b/tdecore/network/tdesocketaddress.cpp @@ -238,7 +238,7 @@ struct our_sockaddr_in6 #define MIN_SOCKADDR_UN_LEN (sizeof(TQ_UINT16) + sizeof(char)) -class KNetwork::KSocketAddressData +class KNetwork::TDESocketAddressData { public: /* @@ -249,7 +249,7 @@ public: class QMixSocketAddressRef : public KInetSocketAddress, public KUnixSocketAddress { public: - QMixSocketAddressRef(KSocketAddressData* d) + QMixSocketAddressRef(TDESocketAddressData* d) : KInetSocketAddress(d), KUnixSocketAddress(d) { } @@ -265,7 +265,7 @@ public: } addr; TQ_UINT16 curlen, reallen; - KSocketAddressData() + TDESocketAddressData() : ref(this) { addr.generic = 0L; @@ -273,7 +273,7 @@ public: invalidate(); } - ~KSocketAddressData() + ~TDESocketAddressData() { if (addr.generic != 0L) free(addr.generic); @@ -343,7 +343,7 @@ public: }; // create duplicates of -void KSocketAddressData::dup(const sockaddr* sa, TQ_UINT16 len, bool clear) +void TDESocketAddressData::dup(const sockaddr* sa, TQ_UINT16 len, bool clear) { if (len < MIN_SOCKADDR_LEN) { @@ -405,30 +405,30 @@ void KSocketAddressData::dup(const sockaddr* sa, TQ_UINT16 len, bool clear) } // default constructor -KSocketAddress::KSocketAddress() - : d(new KSocketAddressData) +TDESocketAddress::TDESocketAddress() + : d(new TDESocketAddressData) { } // constructor from binary data -KSocketAddress::KSocketAddress(const sockaddr *sa, TQ_UINT16 len) - : d(new KSocketAddressData) +TDESocketAddress::TDESocketAddress(const sockaddr *sa, TQ_UINT16 len) + : d(new TDESocketAddressData) { setAddress(sa, len); } -KSocketAddress::KSocketAddress(const KSocketAddress& other) - : d(new(KSocketAddressData)) +TDESocketAddress::TDESocketAddress(const TDESocketAddress& other) + : d(new(TDESocketAddressData)) { *this = other; } -KSocketAddress::KSocketAddress(KSocketAddressData *d2) +TDESocketAddress::TDESocketAddress(TDESocketAddressData *d2) : d(d2) { } -KSocketAddress::~KSocketAddress() +TDESocketAddress::~TDESocketAddress() { // prevent double-deletion, since we're already being deleted if (d) @@ -439,7 +439,7 @@ KSocketAddress::~KSocketAddress() } } -KSocketAddress& KSocketAddress::operator =(const KSocketAddress& other) +TDESocketAddress& TDESocketAddress::operator =(const TDESocketAddress& other) { if (other.d && !other.d->invalid()) d->dup(other.d->addr.generic, other.d->reallen); @@ -448,21 +448,21 @@ KSocketAddress& KSocketAddress::operator =(const KSocketAddress& other) return *this; } -const sockaddr* KSocketAddress::address() const +const sockaddr* TDESocketAddress::address() const { if (d->invalid()) return 0L; return d->addr.generic; } -sockaddr* KSocketAddress::address() +sockaddr* TDESocketAddress::address() { if (d->invalid()) return 0L; return d->addr.generic; } -KSocketAddress& KSocketAddress::setAddress(const sockaddr* sa, TQ_UINT16 len) +TDESocketAddress& TDESocketAddress::setAddress(const sockaddr* sa, TQ_UINT16 len) { if (sa != 0L && len >= MIN_SOCKADDR_LEN) d->dup(sa, len); @@ -472,28 +472,28 @@ KSocketAddress& KSocketAddress::setAddress(const sockaddr* sa, TQ_UINT16 len) return *this; } -TQ_UINT16 KSocketAddress::length() const +TQ_UINT16 TDESocketAddress::length() const { if (d->invalid()) return 0; return d->reallen; } -KSocketAddress& KSocketAddress::setLength(TQ_UINT16 len) +TDESocketAddress& TDESocketAddress::setLength(TQ_UINT16 len) { d->dup((sockaddr*)0L, len, false); return *this; } -int KSocketAddress::family() const +int TDESocketAddress::family() const { if (d->invalid()) return AF_UNSPEC; return d->addr.generic->sa_family; } -KSocketAddress& KSocketAddress::setFamily(int family) +TDESocketAddress& TDESocketAddress::setFamily(int family) { if (d->invalid()) d->dup((sockaddr*)0L, MIN_SOCKADDR_LEN); @@ -502,7 +502,7 @@ KSocketAddress& KSocketAddress::setFamily(int family) return *this; } -bool KSocketAddress::operator ==(const KSocketAddress& other) const +bool TDESocketAddress::operator ==(const TDESocketAddress& other) const { // if this is invalid, it's only equal if the other one is invalid as well if (d->invalid()) @@ -559,7 +559,7 @@ bool KSocketAddress::operator ==(const KSocketAddress& other) const return false; // not equal in any other case } -TQString KSocketAddress::nodeName() const +TQString TDESocketAddress::nodeName() const { if (d->invalid()) return TQString::null; @@ -585,7 +585,7 @@ TQString KSocketAddress::nodeName() const return TQString::null; } -TQString KSocketAddress::serviceName() const +TQString TDESocketAddress::serviceName() const { if (d->invalid()) return TQString::null; @@ -605,7 +605,7 @@ TQString KSocketAddress::serviceName() const return TQString::null; } -TQString KSocketAddress::toString() const +TQString TDESocketAddress::toString() const { if (d->invalid()) return TQString::null; @@ -627,27 +627,27 @@ TQString KSocketAddress::toString() const return fmt.arg(nodeName()).arg(serviceName()); } -KInetSocketAddress& KSocketAddress::asInet() +KInetSocketAddress& TDESocketAddress::asInet() { return d->ref; } -KInetSocketAddress KSocketAddress::asInet() const +KInetSocketAddress TDESocketAddress::asInet() const { return d->ref; } -KUnixSocketAddress& KSocketAddress::asUnix() +KUnixSocketAddress& TDESocketAddress::asUnix() { return d->ref; } -KUnixSocketAddress KSocketAddress::asUnix() const +KUnixSocketAddress TDESocketAddress::asUnix() const { return d->ref; } -int KSocketAddress::ianaFamily(int af) +int TDESocketAddress::ianaFamily(int af) { switch (af) { @@ -664,7 +664,7 @@ int KSocketAddress::ianaFamily(int af) } } -int KSocketAddress::fromIanaFamily(int iana) +int TDESocketAddress::fromIanaFamily(int iana) { switch (iana) { @@ -688,7 +688,7 @@ KInetSocketAddress::KInetSocketAddress() // binary data constructor KInetSocketAddress::KInetSocketAddress(const sockaddr* sa, TQ_UINT16 len) - : KSocketAddress(sa, len) + : TDESocketAddress(sa, len) { if (!d->invalid()) update(); @@ -703,21 +703,21 @@ KInetSocketAddress::KInetSocketAddress(const KIpAddress& host, TQ_UINT16 port) // copy constructor KInetSocketAddress::KInetSocketAddress(const KInetSocketAddress& other) - : KSocketAddress(other) + : TDESocketAddress(other) { } // special copy constructor -KInetSocketAddress::KInetSocketAddress(const KSocketAddress& other) - : KSocketAddress(other) +KInetSocketAddress::KInetSocketAddress(const TDESocketAddress& other) + : TDESocketAddress(other) { if (!d->invalid()) update(); } // special constructor -KInetSocketAddress::KInetSocketAddress(KSocketAddressData *d) - : KSocketAddress(d) +KInetSocketAddress::KInetSocketAddress(TDESocketAddressData *d) + : TDESocketAddress(d) { } @@ -730,7 +730,7 @@ KInetSocketAddress::~KInetSocketAddress() // copy operator KInetSocketAddress& KInetSocketAddress::operator =(const KInetSocketAddress& other) { - KSocketAddress::operator =(other); + TDESocketAddress::operator =(other); return *this; } @@ -905,14 +905,14 @@ KUnixSocketAddress::KUnixSocketAddress() } KUnixSocketAddress::KUnixSocketAddress(const sockaddr* sa, TQ_UINT16 len) - : KSocketAddress(sa, len) + : TDESocketAddress(sa, len) { if (!d->invalid() && d->addr.un->sun_family != AF_UNIX) d->invalidate(); } KUnixSocketAddress::KUnixSocketAddress(const KUnixSocketAddress& other) - : KSocketAddress(other) + : TDESocketAddress(other) { } @@ -921,8 +921,8 @@ KUnixSocketAddress::KUnixSocketAddress(const TQString& pathname) setPathname(pathname); } -KUnixSocketAddress::KUnixSocketAddress(KSocketAddressData* d) - : KSocketAddress(d) +KUnixSocketAddress::KUnixSocketAddress(TDESocketAddressData* d) + : TDESocketAddress(d) { } @@ -932,7 +932,7 @@ KUnixSocketAddress::~KUnixSocketAddress() KUnixSocketAddress& KUnixSocketAddress::operator =(const KUnixSocketAddress& other) { - KSocketAddress::operator =(other); + TDESocketAddress::operator =(other); return *this; } diff --git a/tdecore/network/tdesocketaddress.h b/tdecore/network/tdesocketaddress.h index 885bb77cb..100e05fb2 100644 --- a/tdecore/network/tdesocketaddress.h +++ b/tdecore/network/tdesocketaddress.h @@ -38,7 +38,7 @@ struct sockaddr_un; namespace KNetwork { class KIpAddress; -class KSocketAddress; +class TDESocketAddress; class KInetSocketAddress; class KUnixSocketAddress; @@ -412,15 +412,15 @@ public: }; -class KSocketAddressData; -/** @class KSocketAddress tdesocketaddress.h tdesocketaddress.h +class TDESocketAddressData; +/** @class TDESocketAddress tdesocketaddress.h tdesocketaddress.h * @brief A generic socket address. * * This class holds one generic socket address. * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KSocketAddress +class TDECORE_EXPORT TDESocketAddress { public: /** @@ -428,7 +428,7 @@ public: * * Creates an empty object */ - KSocketAddress(); + TDESocketAddress(); /** * Creates this object with the given data. @@ -437,7 +437,7 @@ public: * @param sa the socket address structure * @param len the socket address length */ - KSocketAddress(const sockaddr* sa, TQ_UINT16 len); + TDESocketAddress(const sockaddr* sa, TQ_UINT16 len); /** * Copy constructor. This creates a copy of the other @@ -447,12 +447,12 @@ public: * * @param other the object to copy from */ - KSocketAddress(const KSocketAddress& other); + TDESocketAddress(const TDESocketAddress& other); /** * Destructor. Frees any associated resources. */ - virtual ~KSocketAddress(); + virtual ~TDESocketAddress(); /** * Performs a shallow copy of the other object into this one. @@ -460,7 +460,7 @@ public: * * @param other the object to copy from */ - KSocketAddress& operator =(const KSocketAddress& other); + TDESocketAddress& operator =(const TDESocketAddress& other); /** * Returns the socket address structure, to be passed down to @@ -490,7 +490,7 @@ public: * @param sa the socket address structure * @param len the socket address length */ - KSocketAddress& setAddress(const sockaddr *sa, TQ_UINT16 len); + TDESocketAddress& setAddress(const sockaddr *sa, TQ_UINT16 len); /** * Returns the socket address structure, to be passed down to @@ -517,14 +517,14 @@ public: * the family: * * \code - * KSocketAddress qsa; + * TDESocketAddress qsa; * [...] * qsa.setFamily(AF_UNSPEC).setLength(newlen); * \endcode * * @param len the new length */ - KSocketAddress& setLength(TQ_UINT16 len); + TDESocketAddress& setLength(TQ_UINT16 len); /** * Returns the family of this address. @@ -540,7 +540,7 @@ public: * * @param family the new family to set */ - virtual KSocketAddress& setFamily(int family); + virtual TDESocketAddress& setFamily(int family); /** * Returns the IANA family number of this address. @@ -558,7 +558,7 @@ public: * @param other the other socket * @return true if both sockets are equal */ - bool operator ==(const KSocketAddress& other) const; + bool operator ==(const TDESocketAddress& other) const; /** * Returns the node name of this socket. @@ -615,11 +615,11 @@ public: protected: /// @internal /// private data - KSocketAddressData *d; + TDESocketAddressData *d; /// @internal /// extra constructor - KSocketAddress(KSocketAddressData* d); + TDESocketAddress(TDESocketAddressData* d); public: // static /** @@ -648,9 +648,9 @@ public: // static * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KInetSocketAddress: public KSocketAddress +class TDECORE_EXPORT KInetSocketAddress: public TDESocketAddress { - friend class KSocketAddress; + friend class TDESocketAddress; public: /** * Public constructor. Creates an empty object. @@ -693,7 +693,7 @@ public: * * @param other the other object */ - KInetSocketAddress(const KSocketAddress& other); + KInetSocketAddress(const TDESocketAddress& other); /** * Destroys this object. @@ -817,7 +817,7 @@ public: protected: /// @internal /// extra constructor - KInetSocketAddress(KSocketAddressData* d); + KInetSocketAddress(TDESocketAddressData* d); private: void update(); @@ -837,9 +837,9 @@ private: * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KUnixSocketAddress: public KSocketAddress +class TDECORE_EXPORT KUnixSocketAddress: public TDESocketAddress { - friend class KSocketAddress; + friend class TDESocketAddress; public: /** * Default constructor. Creates an empty object. @@ -904,7 +904,7 @@ public: protected: /// @internal /// extra constructor - KUnixSocketAddress(KSocketAddressData* d); + KUnixSocketAddress(TDESocketAddressData* d); }; } // namespace KNetwork diff --git a/tdecore/network/tdesocketbase.cpp b/tdecore/network/tdesocketbase.cpp index 9be0d6e52..0eb31bbc1 100644 --- a/tdecore/network/tdesocketbase.cpp +++ b/tdecore/network/tdesocketbase.cpp @@ -31,24 +31,24 @@ using namespace KNetwork; -class KNetwork::KSocketBasePrivate +class KNetwork::TDESocketBasePrivate { public: int socketOptions; int socketError; int capabilities; - mutable KSocketDevice* device; + mutable TDESocketDevice* device; TQMutex mutex; - KSocketBasePrivate() + TDESocketBasePrivate() : mutex(true) // create recursive { } }; -KSocketBase::KSocketBase() - : d(new KSocketBasePrivate) +TDESocketBase::TDESocketBase() + : d(new TDESocketBasePrivate) { d->socketOptions = Blocking; d->socketError = 0; @@ -56,64 +56,64 @@ KSocketBase::KSocketBase() d->capabilities = 0; } -KSocketBase::~KSocketBase() +TDESocketBase::~TDESocketBase() { delete d->device; delete d; } -bool KSocketBase::setSocketOptions(int opts) +bool TDESocketBase::setSocketOptions(int opts) { d->socketOptions = opts; return true; } -int KSocketBase::socketOptions() const +int TDESocketBase::socketOptions() const { return d->socketOptions; } -bool KSocketBase::setBlocking(bool enable) +bool TDESocketBase::setBlocking(bool enable) { return setSocketOptions((socketOptions() & ~Blocking) | (enable ? Blocking : 0)); } -bool KSocketBase::blocking() const +bool TDESocketBase::blocking() const { return socketOptions() & Blocking; } -bool KSocketBase::setAddressReuseable(bool enable) +bool TDESocketBase::setAddressReuseable(bool enable) { return setSocketOptions((socketOptions() & ~AddressReuseable) | (enable ? AddressReuseable : 0)); } -bool KSocketBase::addressReuseable() const +bool TDESocketBase::addressReuseable() const { return socketOptions() & AddressReuseable; } -bool KSocketBase::setIPv6Only(bool enable) +bool TDESocketBase::setIPv6Only(bool enable) { return setSocketOptions((socketOptions() & ~IPv6Only) | (enable ? IPv6Only : 0)); } -bool KSocketBase::isIPv6Only() const +bool TDESocketBase::isIPv6Only() const { return socketOptions() & IPv6Only; } -bool KSocketBase::setBroadcast(bool enable) +bool TDESocketBase::setBroadcast(bool enable) { return setSocketOptions((socketOptions() & ~Broadcast) | (enable ? Broadcast : 0)); } -bool KSocketBase::broadcast() const +bool TDESocketBase::broadcast() const { return socketOptions() & Broadcast; } -KSocketDevice* KSocketBase::socketDevice() const +TDESocketDevice* TDESocketBase::socketDevice() const { if (d->device) return d->device; @@ -123,47 +123,47 @@ KSocketDevice* KSocketBase::socketDevice() const if (d->device) return d->device; - KSocketBase* that = const_cast<KSocketBase*>(this); - KSocketDevice* dev = 0; + TDESocketBase* that = const_cast<TDESocketBase*>(this); + TDESocketDevice* dev = 0; if (d->capabilities) - dev = KSocketDevice::createDefault(that, d->capabilities); + dev = TDESocketDevice::createDefault(that, d->capabilities); if (!dev) - dev = KSocketDevice::createDefault(that); + dev = TDESocketDevice::createDefault(that); that->setSocketDevice(dev); return d->device; } -void KSocketBase::setSocketDevice(KSocketDevice* device) +void TDESocketBase::setSocketDevice(TDESocketDevice* device) { TQMutexLocker locker(mutex()); if (d->device == 0L) d->device = device; } -int KSocketBase::setRequestedCapabilities(int add, int remove) +int TDESocketBase::setRequestedCapabilities(int add, int remove) { d->capabilities |= add; d->capabilities &= ~remove; return d->capabilities; } -bool KSocketBase::hasDevice() const +bool TDESocketBase::hasDevice() const { return d->device != 0L; } -void KSocketBase::setError(SocketError error) +void TDESocketBase::setError(SocketError error) { d->socketError = error; } -KSocketBase::SocketError KSocketBase::error() const +TDESocketBase::SocketError TDESocketBase::error() const { - return static_cast<KSocketBase::SocketError>(d->socketError); + return static_cast<TDESocketBase::SocketError>(d->socketError); } // static -TQString KSocketBase::errorString(KSocketBase::SocketError code) +TQString TDESocketBase::errorString(TDESocketBase::SocketError code) { TQString reason; switch (code) @@ -256,7 +256,7 @@ TQString KSocketBase::errorString(KSocketBase::SocketError code) } // static -bool KSocketBase::isFatalError(int code) +bool TDESocketBase::isFatalError(int code) { switch (code) { @@ -270,12 +270,12 @@ bool KSocketBase::isFatalError(int code) return true; } -void KSocketBase::unsetSocketDevice() +void TDESocketBase::unsetSocketDevice() { d->device = 0L; } -TQMutex* KSocketBase::mutex() const +TQMutex* TDESocketBase::mutex() const { return &d->mutex; } @@ -308,13 +308,13 @@ int KActiveSocketBase::putch(int ch) void KActiveSocketBase::setError(int status, SocketError error) { - KSocketBase::setError(error); + TDESocketBase::setError(error); setStatus(status); } void KActiveSocketBase::resetError() { - KSocketBase::setError(NoError); + TDESocketBase::setError(NoError); resetStatus(); } diff --git a/tdecore/network/tdesocketbase.h b/tdecore/network/tdesocketbase.h index 48ae15e05..bd0828408 100644 --- a/tdecore/network/tdesocketbase.h +++ b/tdecore/network/tdesocketbase.h @@ -80,10 +80,10 @@ class TQMutex; namespace KNetwork { class KResolverEntry; -class KSocketDevice; +class TDESocketDevice; -class KSocketBasePrivate; -/** @class KSocketBase tdesocketbase.h tdesocketbase.h +class TDESocketBasePrivate; +/** @class TDESocketBase tdesocketbase.h tdesocketbase.h * @brief Basic socket functionality. * * This class provides the basic socket functionlity for descended classes. @@ -94,7 +94,7 @@ class KSocketBasePrivate; * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KSocketBase +class TDECORE_EXPORT TDESocketBase { public: /** @@ -175,12 +175,12 @@ public: /** * Default constructor. */ - KSocketBase(); + TDESocketBase(); /** * Destructor. */ - virtual ~KSocketBase(); + virtual ~TDESocketBase(); /* * The following functions are shared by all descended classes and will have @@ -316,7 +316,7 @@ public: * This function creates the device if none has been set * using the default factory. */ - KSocketDevice* socketDevice() const; + TDESocketDevice* socketDevice() const; /** * Sets the socket implementation to be used on this socket. @@ -331,7 +331,7 @@ public: * This function is called by @ref socketDevice above when the socket is * first created. */ - virtual void setSocketDevice(KSocketDevice* device); + virtual void setSocketDevice(TDESocketDevice* device); /** * Sets the internally requested capabilities for a socket device. @@ -341,16 +341,16 @@ public: * implementation. By using this function, derived classes can request * that a backend with those capabilities be created when necessary. * - * For the possible flags, see @ref KSocketDevice::Capabilities. However, note + * For the possible flags, see @ref TDESocketDevice::Capabilities. However, note * that only the Can* flags make sense in this context. * * @note Since socketDevice must always return a valid backend object, it * is is possible that the created device does not conform to all * requirements requested. Implementations sensitive to this fact * should test the object returned by @ref socketDevice (through - * @ref KSocketDevice::capabilities, for instance) the availability. + * @ref TDESocketDevice::capabilities, for instance) the availability. * - * @param add mask of @ref KSocketDevice::Capabilities to add + * @param add mask of @ref TDESocketDevice::Capabilities to add * @param remove mask of bits to remove from the requirements * @return the current mask of requested capabilities */ @@ -420,15 +420,15 @@ public: private: /// @internal - /// called by KSocketDevice + /// called by TDESocketDevice void unsetSocketDevice(); - KSocketBase(const KSocketBase&); - KSocketBase& operator =(const KSocketBase&); + TDESocketBase(const TDESocketBase&); + TDESocketBase& operator =(const TDESocketBase&); - KSocketBasePrivate *d; + TDESocketBasePrivate *d; - friend class KSocketDevice; + friend class TDESocketDevice; }; /** @@ -440,7 +440,7 @@ private: * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KActiveSocketBase: public TQIODevice, virtual public KSocketBase +class TDECORE_EXPORT KActiveSocketBase: public TQIODevice, virtual public TDESocketBase { public: /** @@ -575,7 +575,7 @@ public: * @param from the address of the sender will be stored here * @returns the actual number of bytes read */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSocketAddress& from) = 0; + virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from) = 0; /** * Peeks the data in the socket. @@ -602,7 +602,7 @@ public: * @param from the address of the sender will be stored here * @returns the actual number of bytes copied into @p data */ - virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) = 0; + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) = 0; /** * Writes the given data to the socket. @@ -623,7 +623,7 @@ public: * @param to the address to send to * @returns the number of bytes actually sent */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const KSocketAddress& to) = 0; + virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to) = 0; /** * Reads one character from the socket. @@ -647,14 +647,14 @@ public: /** * Returns this socket's local address. */ - virtual KSocketAddress localAddress() const = 0; + virtual TDESocketAddress localAddress() const = 0; /** * Return this socket's peer address, if we are connected. * If the address cannot be retrieved, the returned object will contain * an invalid address. */ - virtual KSocketAddress peerAddress() const = 0; + virtual TDESocketAddress peerAddress() const = 0; // FIXME KDE 4.0: // enable this function @@ -662,7 +662,7 @@ public: /** * Returns this socket's externally-visible address, if known. */ - virtual KSocketAddress externalAddress() const = 0; + virtual TDESocketAddress externalAddress() const = 0; #endif protected: @@ -689,7 +689,7 @@ protected: * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KPassiveSocketBase: virtual public KSocketBase +class TDECORE_EXPORT KPassiveSocketBase: virtual public TDESocketBase { public: /** @@ -754,12 +754,12 @@ public: /** * Returns this socket's local address. */ - virtual KSocketAddress localAddress() const = 0; + virtual TDESocketAddress localAddress() const = 0; /** * Returns this socket's externally-visible address if known. */ - virtual KSocketAddress externalAddress() const = 0; + virtual TDESocketAddress externalAddress() const = 0; private: KPassiveSocketBase(const KPassiveSocketBase&); diff --git a/tdecore/network/tdesocketbuffer.cpp b/tdecore/network/tdesocketbuffer.cpp index 0ba18b77b..52988d344 100644 --- a/tdecore/network/tdesocketbuffer.cpp +++ b/tdecore/network/tdesocketbuffer.cpp @@ -33,23 +33,23 @@ using namespace KNetwork; using namespace KNetwork::Internal; -KSocketBuffer::KSocketBuffer(TQ_LONG size) +TDESocketBuffer::TDESocketBuffer(TQ_LONG size) : m_mutex(true), m_offset(0), m_size(size), m_length(0) { } -KSocketBuffer::KSocketBuffer(const KSocketBuffer& other) +TDESocketBuffer::TDESocketBuffer(const TDESocketBuffer& other) : KIOBufferBase(other), m_mutex(true) { *this = other; } -KSocketBuffer::~KSocketBuffer() +TDESocketBuffer::~TDESocketBuffer() { // TQValueList takes care of deallocating memory } -KSocketBuffer& KSocketBuffer::operator=(const KSocketBuffer& other) +TDESocketBuffer& TDESocketBuffer::operator=(const TDESocketBuffer& other) { TQMutexLocker locker1(&m_mutex); TQMutexLocker locker2(&other.m_mutex); @@ -64,7 +64,7 @@ KSocketBuffer& KSocketBuffer::operator=(const KSocketBuffer& other) return *this; } -bool KSocketBuffer::canReadLine() const +bool TDESocketBuffer::canReadLine() const { TQMutexLocker locker(&m_mutex); @@ -85,7 +85,7 @@ bool KSocketBuffer::canReadLine() const return false; // not found } -TQCString KSocketBuffer::readLine() +TQCString TDESocketBuffer::readLine() { if (!canReadLine()) return TQCString(); // empty @@ -120,17 +120,17 @@ TQCString KSocketBuffer::readLine() return result; } -TQ_LONG KSocketBuffer::length() const +TQ_LONG TDESocketBuffer::length() const { return m_length; } -TQ_LONG KSocketBuffer::size() const +TQ_LONG TDESocketBuffer::size() const { return m_size; } -bool KSocketBuffer::setSize(TQ_LONG size) +bool TDESocketBuffer::setSize(TQ_LONG size) { m_size = size; if (size == -1 || m_length < m_size) @@ -147,7 +147,7 @@ bool KSocketBuffer::setSize(TQ_LONG size) return (m_length - m_size) == consumeBuffer(0L, m_length - m_size, true); } -TQ_LONG KSocketBuffer::feedBuffer(const char *data, TQ_LONG len) +TQ_LONG TDESocketBuffer::feedBuffer(const char *data, TQ_LONG len) { if (data == 0L || len == 0) return 0; // nothing to write @@ -168,7 +168,7 @@ TQ_LONG KSocketBuffer::feedBuffer(const char *data, TQ_LONG len) return len; } -TQ_LONG KSocketBuffer::consumeBuffer(char *destbuffer, TQ_LONG maxlen, bool discard) +TQ_LONG TDESocketBuffer::consumeBuffer(char *destbuffer, TQ_LONG maxlen, bool discard) { if (maxlen == 0 || isEmpty()) return 0; @@ -220,7 +220,7 @@ TQ_LONG KSocketBuffer::consumeBuffer(char *destbuffer, TQ_LONG maxlen, bool disc return copied; } -void KSocketBuffer::clear() +void TDESocketBuffer::clear() { TQMutexLocker locker(&m_mutex); m_list.clear(); @@ -228,7 +228,7 @@ void KSocketBuffer::clear() m_length = 0; } -TQ_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, TQ_LONG len) +TQ_LONG TDESocketBuffer::sendTo(KActiveSocketBase* dev, TQ_LONG len) { if (len == 0 || isEmpty()) return 0; @@ -293,7 +293,7 @@ TQ_LONG KSocketBuffer::sendTo(KActiveSocketBase* dev, TQ_LONG len) return written; } -TQ_LONG KSocketBuffer::receiveFrom(KActiveSocketBase* dev, TQ_LONG len) +TQ_LONG TDESocketBuffer::receiveFrom(KActiveSocketBase* dev, TQ_LONG len) { if (len == 0 || isFull()) return 0; diff --git a/tdecore/network/tdesocketbuffer_p.h b/tdecore/network/tdesocketbuffer_p.h index b2c5dc6b2..be71f462e 100644 --- a/tdecore/network/tdesocketbuffer_p.h +++ b/tdecore/network/tdesocketbuffer_p.h @@ -38,14 +38,14 @@ class KActiveSocketBase; /** * @internal - * @class KSocketBuffer tdesocketbuffer_p.h tdesocketbuffer_p.h + * @class TDESocketBuffer tdesocketbuffer_p.h tdesocketbuffer_p.h * @brief generic socket buffering code * * This class implements generic buffering used by @ref KBufferedSocket. * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class KSocketBuffer: public KIOBufferBase +class TDESocketBuffer: public KIOBufferBase { public: /** @@ -53,22 +53,22 @@ public: * * @param size the maximum size of the buffer */ - KSocketBuffer(TQ_LONG size = -1); + TDESocketBuffer(TQ_LONG size = -1); /** * Copy constructor. */ - KSocketBuffer(const KSocketBuffer& other); + TDESocketBuffer(const TDESocketBuffer& other); /** * Virtual destructor. Frees the buffer and discards its contents. */ - virtual ~KSocketBuffer(); + virtual ~TDESocketBuffer(); /** * Assignment operator. */ - KSocketBuffer& operator=(const KSocketBuffer& other); + TDESocketBuffer& operator=(const TDESocketBuffer& other); /** * Returns true if a line can be read from the buffer. diff --git a/tdecore/network/tdesocketdevice.cpp b/tdecore/network/tdesocketdevice.cpp index 064b66b08..e4802bb7c 100644 --- a/tdecore/network/tdesocketdevice.cpp +++ b/tdecore/network/tdesocketdevice.cpp @@ -60,14 +60,14 @@ using namespace KNetwork; -class KNetwork::KSocketDevicePrivate +class KNetwork::TDESocketDevicePrivate { public: mutable TQSocketNotifier *input, *output, *exception; - KSocketAddress local, peer; + TDESocketAddress local, peer; int af; - inline KSocketDevicePrivate() + inline TDESocketDevicePrivate() { input = output = exception = 0L; af = 0; @@ -75,16 +75,16 @@ public: }; -KSocketDevice::KSocketDevice(const KSocketBase* parent) - : m_sockfd(-1), d(new KSocketDevicePrivate) +TDESocketDevice::TDESocketDevice(const TDESocketBase* parent) + : m_sockfd(-1), d(new TDESocketDevicePrivate) { setSocketDevice(this); if (parent) setSocketOptions(parent->socketOptions()); } -KSocketDevice::KSocketDevice(int fd) - : m_sockfd(fd), d(new KSocketDevicePrivate) +TDESocketDevice::TDESocketDevice(int fd) + : m_sockfd(fd), d(new TDESocketDevicePrivate) { setState(IO_Open); setFlags(IO_Sequential | IO_Raw | IO_ReadWrite); @@ -92,26 +92,26 @@ KSocketDevice::KSocketDevice(int fd) d->af = localAddress().family(); } -KSocketDevice::KSocketDevice(bool, const KSocketBase* parent) - : m_sockfd(-1), d(new KSocketDevicePrivate) +TDESocketDevice::TDESocketDevice(bool, const TDESocketBase* parent) + : m_sockfd(-1), d(new TDESocketDevicePrivate) { // do not set parent if (parent) setSocketOptions(parent->socketOptions()); } -KSocketDevice::~KSocketDevice() +TDESocketDevice::~TDESocketDevice() { close(); // deletes the notifiers unsetSocketDevice(); // prevent double deletion delete d; } -bool KSocketDevice::setSocketOptions(int opts) +bool TDESocketDevice::setSocketOptions(int opts) { // must call parent TQMutexLocker locker(mutex()); - KSocketBase::setSocketOptions(opts); + TDESocketBase::setSocketOptions(opts); if (m_sockfd == -1) return true; // flags are stored @@ -171,13 +171,13 @@ bool KSocketDevice::setSocketOptions(int opts) return true; // all went well } -bool KSocketDevice::open(TQ_OpenMode) +bool TDESocketDevice::open(TQ_OpenMode) { resetError(); return false; } -void KSocketDevice::close() +void TDESocketDevice::close() { resetError(); if (m_sockfd != -1) @@ -198,7 +198,7 @@ void KSocketDevice::close() m_sockfd = -1; } -bool KSocketDevice::create(int family, int type, int protocol) +bool TDESocketDevice::create(int family, int type, int protocol) { resetError(); @@ -224,12 +224,12 @@ bool KSocketDevice::create(int family, int type, int protocol) return true; // successfully created } -bool KSocketDevice::create(const KResolverEntry& address) +bool TDESocketDevice::create(const KResolverEntry& address) { return create(address.family(), address.socketType(), address.protocol()); } -bool KSocketDevice::bind(const KResolverEntry& address) +bool TDESocketDevice::bind(const KResolverEntry& address) { resetError(); @@ -252,7 +252,7 @@ bool KSocketDevice::bind(const KResolverEntry& address) return true; } -bool KSocketDevice::listen(int backlog) +bool TDESocketDevice::listen(int backlog) { if (m_sockfd != -1) { @@ -273,7 +273,7 @@ bool KSocketDevice::listen(int backlog) return false; } -bool KSocketDevice::connect(const KResolverEntry& address) +bool TDESocketDevice::connect(const KResolverEntry& address) { resetError(); @@ -306,7 +306,7 @@ bool KSocketDevice::connect(const KResolverEntry& address) return true; // all is well } -KSocketDevice* KSocketDevice::accept() +TDESocketDevice* TDESocketDevice::accept() { if (m_sockfd == -1) { @@ -327,17 +327,17 @@ KSocketDevice* KSocketDevice::accept() return NULL; } - return new KSocketDevice(newfd); + return new TDESocketDevice(newfd); } -bool KSocketDevice::disconnect() +bool TDESocketDevice::disconnect() { resetError(); if (m_sockfd == -1) return false; // can't create - KSocketAddress address; + TDESocketAddress address; address.setFamily(AF_UNSPEC); if (kde_connect(m_sockfd, address.address(), address.length()) == -1) { @@ -365,10 +365,10 @@ bool KSocketDevice::disconnect() } #ifdef USE_QT3 -TQ_LONG KSocketDevice::bytesAvailable() const +TQ_LONG TDESocketDevice::bytesAvailable() const #endif #ifdef USE_QT4 -qint64 KSocketDevice::bytesAvailable() const +qint64 TDESocketDevice::bytesAvailable() const #endif { if (m_sockfd == -1) @@ -381,7 +381,7 @@ qint64 KSocketDevice::bytesAvailable() const return nchars; } -TQ_LONG KSocketDevice::waitForMore(int msecs, bool *timeout) +TQ_LONG TDESocketDevice::waitForMore(int msecs, bool *timeout) { if (m_sockfd == -1) return -1; // there won't ever be anything to read... @@ -393,7 +393,7 @@ TQ_LONG KSocketDevice::waitForMore(int msecs, bool *timeout) return bytesAvailable(); } -static int do_read_common(int sockfd, char *data, TQ_ULONG maxlen, KSocketAddress* from, ssize_t &retval, bool peek = false) +static int do_read_common(int sockfd, char *data, TQ_ULONG maxlen, TDESocketAddress* from, ssize_t &retval, bool peek = false) { socklen_t len; if (from) @@ -407,19 +407,19 @@ static int do_read_common(int sockfd, char *data, TQ_ULONG maxlen, KSocketAddres if (retval == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) - return KSocketDevice::WouldBlock; + return TDESocketDevice::WouldBlock; else - return KSocketDevice::UnknownError; + return TDESocketDevice::UnknownError; } if (retval == 0) - return KSocketDevice::RemotelyDisconnected; + return TDESocketDevice::RemotelyDisconnected; if (from) from->setLength(len); return 0; } -TQT_TQIO_LONG KSocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) +TQT_TQIO_LONG TDESocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -440,7 +440,7 @@ TQT_TQIO_LONG KSocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen) return retval; } -TQT_TQIO_LONG KSocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSocketAddress &from) +TQT_TQIO_LONG TDESocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress &from) { resetError(); if (m_sockfd == -1) @@ -461,7 +461,7 @@ TQT_TQIO_LONG KSocketDevice::tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSoc return retval; } -TQ_LONG KSocketDevice::peekBlock(char *data, TQ_ULONG maxlen) +TQ_LONG TDESocketDevice::peekBlock(char *data, TQ_ULONG maxlen) { resetError(); if (m_sockfd == -1) @@ -482,7 +482,7 @@ TQ_LONG KSocketDevice::peekBlock(char *data, TQ_ULONG maxlen) return retval; } -TQ_LONG KSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from) +TQ_LONG TDESocketDevice::peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from) { resetError(); if (m_sockfd == -1) @@ -503,12 +503,12 @@ TQ_LONG KSocketDevice::peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& fr return retval; } -TQT_TQIO_LONG KSocketDevice::tqwriteBlock(const char *data, TQT_TQIO_ULONG len) +TQT_TQIO_LONG TDESocketDevice::tqwriteBlock(const char *data, TQT_TQIO_ULONG len) { - return tqwriteBlock(data, len, KSocketAddress()); + return tqwriteBlock(data, len, TDESocketAddress()); } -TQT_TQIO_LONG KSocketDevice::tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const KSocketAddress& to) +TQT_TQIO_LONG TDESocketDevice::tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to) { resetError(); if (m_sockfd == -1) @@ -532,20 +532,20 @@ TQT_TQIO_LONG KSocketDevice::tqwriteBlock(const char *data, TQT_TQIO_ULONG len, return retval; } -KSocketAddress KSocketDevice::localAddress() const +TDESocketAddress TDESocketDevice::localAddress() const { if (m_sockfd == -1) - return KSocketAddress(); // not open, empty value + return TDESocketAddress(); // not open, empty value if (d->local.family() != AF_UNSPEC) return d->local; socklen_t len; - KSocketAddress localAddress; + TDESocketAddress localAddress; localAddress.setLength(len = 32); // arbitrary value if (kde_getsockname(m_sockfd, localAddress.address(), &len) == -1) // error! - return d->local = KSocketAddress(); + return d->local = TDESocketAddress(); #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN len = localAddress.address()->sa_len; @@ -563,25 +563,25 @@ KSocketAddress KSocketDevice::localAddress() const localAddress.setLength(len); if (kde_getsockname(m_sockfd, localAddress.address(), &len) == -1) // error! - return d->local = KSocketAddress(); + return d->local = TDESocketAddress(); return d->local = localAddress; } -KSocketAddress KSocketDevice::peerAddress() const +TDESocketAddress TDESocketDevice::peerAddress() const { if (m_sockfd == -1) - return KSocketAddress(); // not open, empty value + return TDESocketAddress(); // not open, empty value if (d->peer.family() != AF_UNSPEC) return d->peer; socklen_t len; - KSocketAddress peerAddress; + TDESocketAddress peerAddress; peerAddress.setLength(len = 32); // arbitrary value if (kde_getpeername(m_sockfd, peerAddress.address(), &len) == -1) // error! - return d->peer = KSocketAddress(); + return d->peer = TDESocketAddress(); #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN len = peerAddress.address()->sa_len; @@ -599,19 +599,19 @@ KSocketAddress KSocketDevice::peerAddress() const peerAddress.setLength(len); if (kde_getpeername(m_sockfd, peerAddress.address(), &len) == -1) // error! - return d->peer = KSocketAddress(); + return d->peer = TDESocketAddress(); return d->peer = peerAddress; } -KSocketAddress KSocketDevice::externalAddress() const +TDESocketAddress TDESocketDevice::externalAddress() const { // for normal sockets, the externally visible address is the same // as the local address return localAddress(); } -TQSocketNotifier* KSocketDevice::readNotifier() const +TQSocketNotifier* TDESocketDevice::readNotifier() const { if (d->input) return d->input; @@ -629,7 +629,7 @@ TQSocketNotifier* KSocketDevice::readNotifier() const return d->input = createNotifier(TQSocketNotifier::Read); } -TQSocketNotifier* KSocketDevice::writeNotifier() const +TQSocketNotifier* TDESocketDevice::writeNotifier() const { if (d->output) return d->output; @@ -647,7 +647,7 @@ TQSocketNotifier* KSocketDevice::writeNotifier() const return d->output = createNotifier(TQSocketNotifier::Write); } -TQSocketNotifier* KSocketDevice::exceptionNotifier() const +TQSocketNotifier* TDESocketDevice::exceptionNotifier() const { if (d->exception) return d->exception; @@ -665,7 +665,7 @@ TQSocketNotifier* KSocketDevice::exceptionNotifier() const return d->exception = createNotifier(TQSocketNotifier::Exception); } -bool KSocketDevice::poll(bool *input, bool *output, bool *exception, +bool TDESocketDevice::poll(bool *input, bool *output, bool *exception, int timeout, bool* timedout) { if (m_sockfd == -1) @@ -787,13 +787,13 @@ bool KSocketDevice::poll(bool *input, bool *output, bool *exception, #endif } -bool KSocketDevice::poll(int timeout, bool *timedout) +bool TDESocketDevice::poll(int timeout, bool *timedout) { bool input, output, exception; return poll(&input, &output, &exception, timeout, timedout); } -TQSocketNotifier* KSocketDevice::createNotifier(TQSocketNotifier::Type type) const +TQSocketNotifier* TDESocketDevice::createNotifier(TQSocketNotifier::Type type) const { if (m_sockfd == -1) return 0L; @@ -836,14 +836,14 @@ namespace }; } -static KSocketDeviceFactoryBase* defaultImplFactory; +static TDESocketDeviceFactoryBase* defaultImplFactory; static TQMutex defaultImplFactoryMutex; -typedef TQMap<int, KSocketDeviceFactoryBase* > factoryMap; +typedef TQMap<int, TDESocketDeviceFactoryBase* > factoryMap; static factoryMap factories; -KSocketDevice* KSocketDevice::createDefault(KSocketBase* parent) +TDESocketDevice* TDESocketDevice::createDefault(TDESocketBase* parent) { - KSocketDevice* device = dynamic_cast<KSocketDevice*>(parent); + TDESocketDevice* device = dynamic_cast<TDESocketDevice*>(parent); if (device != 0L) return device; @@ -853,12 +853,12 @@ KSocketDevice* KSocketDevice::createDefault(KSocketBase* parent) return defaultImplFactory->create(parent); // the really default - return new KSocketDevice(parent); + return new TDESocketDevice(parent); } -KSocketDevice* KSocketDevice::createDefault(KSocketBase* parent, int capabilities) +TDESocketDevice* TDESocketDevice::createDefault(TDESocketBase* parent, int capabilities) { - KSocketDevice* device = dynamic_cast<KSocketDevice*>(parent); + TDESocketDevice* device = dynamic_cast<TDESocketDevice*>(parent); if (device != 0L) return device; @@ -872,16 +872,16 @@ KSocketDevice* KSocketDevice::createDefault(KSocketBase* parent, int capabilitie return 0L; // no default } -KSocketDeviceFactoryBase* -KSocketDevice::setDefaultImpl(KSocketDeviceFactoryBase* factory) +TDESocketDeviceFactoryBase* +TDESocketDevice::setDefaultImpl(TDESocketDeviceFactoryBase* factory) { TQMutexLocker locker(&defaultImplFactoryMutex); - KSocketDeviceFactoryBase* old = defaultImplFactory; + TDESocketDeviceFactoryBase* old = defaultImplFactory; defaultImplFactory = factory; return old; } -void KSocketDevice::addNewImpl(KSocketDeviceFactoryBase* factory, int capabilities) +void TDESocketDevice::addNewImpl(TDESocketDeviceFactoryBase* factory, int capabilities) { TQMutexLocker locker(&defaultImplFactoryMutex); if (factories.contains(capabilities)) diff --git a/tdecore/network/tdesocketdevice.h b/tdecore/network/tdesocketdevice.h index 10856716d..52fe18709 100644 --- a/tdecore/network/tdesocketdevice.h +++ b/tdecore/network/tdesocketdevice.h @@ -30,32 +30,32 @@ namespace KNetwork { -class KSocketDevice; -class KSocketDeviceFactoryBase; +class TDESocketDevice; +class TDESocketDeviceFactoryBase; -class KSocketDevicePrivate; -/** @class KSocketDevice tdesocketdevice.h tdesocketdevice.h +class TDESocketDevicePrivate; +/** @class TDESocketDevice tdesocketdevice.h tdesocketdevice.h * @brief Low-level socket functionality. * * This class provides low-level socket functionality. * * Most users will prefer "cooked" interfaces like those of @ref KStreamSocket or - * @ref KServerSocket. + * @ref TDEServerSocket. * * Descended classes from this one provide some other kinds of socket functionality, * like proxying or specific socket types. * * @author Thiago Macieira <thiago.macieira@kdemail.net> */ -class TDECORE_EXPORT KSocketDevice: public KActiveSocketBase, public KPassiveSocketBase +class TDECORE_EXPORT TDESocketDevice: public KActiveSocketBase, public KPassiveSocketBase { public: /** * Capabilities for the socket implementation. * - * KSocketDevice-derived classes can implement certain capabilities that are not + * TDESocketDevice-derived classes can implement certain capabilities that are not * available in the default class. These capabilities are described by these flags. - * The default KSocketDevice class has none of these capabilities. + * The default TDESocketDevice class has none of these capabilities. * * For the negative capabilities (inabilities, the CanNot* forms), when a capability * is not present, the implementation will default to the original behaviour. @@ -101,7 +101,7 @@ public: * The parameter is used to specify which socket this object is used as * a device for. */ - explicit KSocketDevice(const KSocketBase* = 0L); + explicit TDESocketDevice(const TDESocketBase* = 0L); /** * Constructs a new object around an already-open socket. @@ -109,12 +109,12 @@ public: * Note: you should write programs that create sockets through * the classes whenever possible. */ - explicit KSocketDevice(int fd); + explicit TDESocketDevice(int fd); /** * Destructor. This closes the socket if it's open. */ - virtual ~KSocketDevice(); + virtual ~TDESocketDevice(); /** * Returns the file descriptor for this socket. @@ -186,9 +186,9 @@ public: /** * Accepts a new incoming connection. - * Note: this function returns a socket of type KSocketDevice. + * Note: this function returns a socket of type TDESocketDevice. */ - virtual KSocketDevice* accept(); + virtual TDESocketDevice* accept(); /** * Disconnects this socket. @@ -221,7 +221,7 @@ public: /** * Reads data and the source address from this socket. */ - virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, KSocketAddress& from); + virtual TQT_TQIO_LONG tqreadBlock(char *data, TQT_TQIO_ULONG maxlen, TDESocketAddress& from); /** * Peeks data in the socket. @@ -231,7 +231,7 @@ public: /** * Peeks the data in the socket and the source address. */ - virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, KSocketAddress& from); + virtual TQ_LONG peekBlock(char *data, TQ_ULONG maxlen, TDESocketAddress& from); /** * Writes data to the socket. @@ -241,18 +241,18 @@ public: /** * Writes the given data to the given destination address. */ - virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const KSocketAddress& to); + virtual TQT_TQIO_LONG tqwriteBlock(const char *data, TQT_TQIO_ULONG len, const TDESocketAddress& to); /** * Returns this socket's local address. */ - virtual KSocketAddress localAddress() const; + virtual TDESocketAddress localAddress() const; /** * Returns this socket's peer address. If this implementation does proxying * of some sort, this is the real external address, not the proxy's address. */ - virtual KSocketAddress peerAddress() const; + virtual TDESocketAddress peerAddress() const; /** * Returns this socket's externally visible local address. @@ -265,10 +265,10 @@ public: * addresses different from the local socket values. The default implementation * returns the same value as @ref localAddress. * - * @note This function may return an empty KSocketAddress. In that case, the + * @note This function may return an empty TDESocketAddress. In that case, the * externally visible address could/can not be determined. */ - virtual KSocketAddress externalAddress() const; + virtual TDESocketAddress externalAddress() const; /** * Returns a socket notifier for input on this socket. @@ -337,7 +337,7 @@ protected: * * @param parent the parent, if any */ - KSocketDevice(bool, const KSocketBase* parent = 0L); + TDESocketDevice(bool, const TDESocketBase* parent = 0L); /** * Creates a socket notifier of the given type. @@ -358,16 +358,16 @@ protected: public: /** - * Creates a new default KSocketDevice object given + * Creates a new default TDESocketDevice object given * the parent object. * * The capabilities flag indicates the desired capabilities the object being * created should possess. Those capabilities are not guaranteed: if no factory * can provide such an object, a default object will be created. * - * @param parent the KSocketBase parent + * @param parent the TDESocketBase parent */ - static KSocketDevice* createDefault(KSocketBase* parent); + static TDESocketDevice* createDefault(TDESocketBase* parent); /** * @overload @@ -377,40 +377,40 @@ public: * @param parent the parent * @param capabilities the requested capabilities */ - static KSocketDevice* createDefault(KSocketBase* parent, int capabilities); + static TDESocketDevice* createDefault(TDESocketBase* parent, int capabilities); /** - * Sets the default KSocketDevice implementation to use and + * Sets the default TDESocketDevice implementation to use and * return the old factory. * * @param factory the factory object for the implementation */ - static KSocketDeviceFactoryBase* setDefaultImpl(KSocketDeviceFactoryBase* factory); + static TDESocketDeviceFactoryBase* setDefaultImpl(TDESocketDeviceFactoryBase* factory); /** - * Adds a factory of KSocketDevice objects to the list, along with its + * Adds a factory of TDESocketDevice objects to the list, along with its * capabilities flag. */ - static void addNewImpl(KSocketDeviceFactoryBase* factory, int capabilities); + static void addNewImpl(TDESocketDeviceFactoryBase* factory, int capabilities); private: - KSocketDevice(const KSocketDevice&); - KSocketDevice& operator=(const KSocketDevice&); + TDESocketDevice(const TDESocketDevice&); + TDESocketDevice& operator=(const TDESocketDevice&); - KSocketDevicePrivate *d; + TDESocketDevicePrivate *d; }; /** @internal * This class provides functionality for creating and registering * socket implementations. */ -class KSocketDeviceFactoryBase +class TDESocketDeviceFactoryBase { public: - KSocketDeviceFactoryBase() {} - virtual ~KSocketDeviceFactoryBase() {} + TDESocketDeviceFactoryBase() {} + virtual ~TDESocketDeviceFactoryBase() {} - virtual KSocketDevice* create(KSocketBase*) const = 0; + virtual TDESocketDevice* create(TDESocketBase*) const = 0; }; /** @@ -418,13 +418,13 @@ public: * socket implementations. */ template<class Impl> -class KSocketDeviceFactory: public KSocketDeviceFactoryBase +class TDESocketDeviceFactory: public TDESocketDeviceFactoryBase { public: - KSocketDeviceFactory() {} - virtual ~KSocketDeviceFactory() {} + TDESocketDeviceFactory() {} + virtual ~TDESocketDeviceFactory() {} - virtual KSocketDevice* create(KSocketBase* parent) const + virtual TDESocketDevice* create(TDESocketBase* parent) const { return new Impl(parent); } }; |