diff options
Diffstat (limited to 'kdecore/network/ksocketaddress.cpp')
-rw-r--r-- | kdecore/network/ksocketaddress.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/kdecore/network/ksocketaddress.cpp b/kdecore/network/ksocketaddress.cpp index adfc76b06..a6fd14cf5 100644 --- a/kdecore/network/ksocketaddress.cpp +++ b/kdecore/network/ksocketaddress.cpp @@ -74,7 +74,7 @@ const KIpAddress KIpAddress::anyhostV4(0L, 4); const KIpAddress KIpAddress::anyhostV6(0L, 6); // helper function to test if an IPv6 v4-mapped address is equal to its IPv4 counterpart -static bool check_v4mapped(const Q_UINT32* v6addr, Q_UINT32 v4addr) +static bool check_v4mapped(const TQ_UINT32* v6addr, TQ_UINT32 v4addr) { // check that the v6 is a v4-mapped address if (!(v6addr[0] == 0 && v6addr[1] == 0 && v6addr[2] == htonl(0x0000ffff))) @@ -131,12 +131,12 @@ bool KIpAddress::setAddress(const TQString& address) m_version = 0; // try to guess the address version - if (address.find(':') != -1) + if (address.tqfind(':') != -1) { #ifdef AF_INET6 // guessing IPv6 - Q_UINT32 buf[4]; + TQ_UINT32 buf[4]; if (inet_pton(AF_INET6, address.latin1(), buf)) { memcpy(m_data, buf, sizeof(m_data)); @@ -149,7 +149,7 @@ bool KIpAddress::setAddress(const TQString& address) } else { - Q_UINT32 buf; + TQ_UINT32 buf; if (inet_pton(AF_INET, address.latin1(), &buf)) { *m_data = buf; @@ -165,7 +165,7 @@ bool KIpAddress::setAddress(const TQString& address) bool KIpAddress::setAddress(const char* address) { - return setAddress(TQString::fromLatin1(address)); + return setAddress(TQString::tqfromLatin1(address)); } // set from binary data @@ -194,21 +194,21 @@ TQString KIpAddress::toString() const { case 4: inet_ntop(AF_INET, m_data, buf, sizeof(buf) - 1); - return TQString::fromLatin1(buf); + return TQString::tqfromLatin1(buf); case 6: #ifdef AF_INET6 inet_ntop(AF_INET6, m_data, buf, sizeof(buf) - 1); #endif - return TQString::fromLatin1(buf); + return TQString::tqfromLatin1(buf); } return TQString::null; } -Q_UINT32 KIpAddress::hostIPv4Addr(bool convertMapped) const +TQ_UINT32 KIpAddress::hostIPv4Addr(bool convertMapped) const { - Q_UINT32 addr = IPv4Addr(convertMapped); + TQ_UINT32 addr = IPv4Addr(convertMapped); return ntohl(addr); } @@ -219,23 +219,23 @@ Q_UINT32 KIpAddress::hostIPv4Addr(bool convertMapped) const struct our_sockaddr_in6 { # ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - Q_UINT8 sin6_len; - Q_UINT8 sin6_family; + TQ_UINT8 sin6_len; + TQ_UINT8 sin6_family; # else //!HAVE_STRUCT_SOCKADDR_SA_LEN - Q_UINT16 sin6_family; + TQ_UINT16 sin6_family; # endif - Q_UINT16 sin6_port; /* RFC says in_port_t */ - Q_UINT32 sin6_flowinfo; - Q_UINT8 sin6_addr[16]; // 24 bytes up to here - Q_UINT32 sin6_scope_id; // 28 bytes total + TQ_UINT16 sin6_port; /* RFC says in_port_t */ + TQ_UINT32 sin6_flowinfo; + TQ_UINT8 sin6_addr[16]; // 24 bytes up to here + TQ_UINT32 sin6_scope_id; // 28 bytes total }; // useful definitions -#define MIN_SOCKADDR_LEN sizeof(Q_UINT16) +#define MIN_SOCKADDR_LEN sizeof(TQ_UINT16) #define SOCKADDR_IN_LEN sizeof(sockaddr_in) #define MIN_SOCKADDR_IN6_LEN ((unsigned long) &(((our_sockaddr_in6*)0)->sin6_scope_id)) #define SOCKADDR_IN6_LEN sizeof(our_sockaddr_in6) -#define MIN_SOCKADDR_UN_LEN (sizeof(Q_UINT16) + sizeof(char)) +#define MIN_SOCKADDR_UN_LEN (sizeof(TQ_UINT16) + sizeof(char)) class KNetwork::KSocketAddressData @@ -263,14 +263,14 @@ public: struct our_sockaddr_in6 *in6; struct sockaddr_un *un; } addr; - Q_UINT16 curlen, reallen; + TQ_UINT16 curlen, reallen; KSocketAddressData() : ref(this) { addr.generic = 0L; curlen = 0; - invalidate(); + tqinvalidate(); } ~KSocketAddressData() @@ -282,10 +282,10 @@ public: inline bool invalid() const { return reallen == 0; } - inline void invalidate() + inline void tqinvalidate() { reallen = 0; } - void dup(const sockaddr* sa, Q_UINT16 len, bool clear = true); + void dup(const sockaddr* sa, TQ_UINT16 len, bool clear = true); void makeipv4() { @@ -343,12 +343,12 @@ public: }; // create duplicates of -void KSocketAddressData::dup(const sockaddr* sa, Q_UINT16 len, bool clear) +void KSocketAddressData::dup(const sockaddr* sa, TQ_UINT16 len, bool clear) { if (len < MIN_SOCKADDR_LEN) { // certainly invalid - invalidate(); + tqinvalidate(); return; } @@ -359,7 +359,7 @@ void KSocketAddressData::dup(const sockaddr* sa, Q_UINT16 len, bool clear) (sa->sa_family == AF_UNIX && len < MIN_SOCKADDR_UN_LEN))) { // also invalid - invalidate(); + tqinvalidate(); return; } @@ -411,7 +411,7 @@ KSocketAddress::KSocketAddress() } // constructor from binary data -KSocketAddress::KSocketAddress(const sockaddr *sa, Q_UINT16 len) +KSocketAddress::KSocketAddress(const sockaddr *sa, TQ_UINT16 len) : d(new KSocketAddressData) { setAddress(sa, len); @@ -444,7 +444,7 @@ KSocketAddress& KSocketAddress::operator =(const KSocketAddress& other) if (other.d && !other.d->invalid()) d->dup(other.d->addr.generic, other.d->reallen); else - d->invalidate(); + d->tqinvalidate(); return *this; } @@ -462,24 +462,24 @@ sockaddr* KSocketAddress::address() return d->addr.generic; } -KSocketAddress& KSocketAddress::setAddress(const sockaddr* sa, Q_UINT16 len) +KSocketAddress& KSocketAddress::setAddress(const sockaddr* sa, TQ_UINT16 len) { if (sa != 0L && len >= MIN_SOCKADDR_LEN) d->dup(sa, len); else - d->invalidate(); + d->tqinvalidate(); return *this; } -Q_UINT16 KSocketAddress::length() const +TQ_UINT16 KSocketAddress::length() const { if (d->invalid()) return 0; return d->reallen; } -KSocketAddress& KSocketAddress::setLength(Q_UINT16 len) +KSocketAddress& KSocketAddress::setLength(TQ_UINT16 len) { d->dup((sockaddr*)0L, len, false); @@ -619,7 +619,7 @@ TQString KSocketAddress::toString() const fmt = "[%1]:%2"; #endif else if (d->addr.generic->sa_family == AF_UNIX) - return TQString::fromLatin1("unix:%1").arg(serviceName()); + return TQString::tqfromLatin1("unix:%1").arg(serviceName()); else return i18n("1: the unknown socket address family number", "Unknown family %1").arg(d->addr.generic->sa_family); @@ -687,7 +687,7 @@ KInetSocketAddress::KInetSocketAddress() } // binary data constructor -KInetSocketAddress::KInetSocketAddress(const sockaddr* sa, Q_UINT16 len) +KInetSocketAddress::KInetSocketAddress(const sockaddr* sa, TQ_UINT16 len) : KSocketAddress(sa, len) { if (!d->invalid()) @@ -695,7 +695,7 @@ KInetSocketAddress::KInetSocketAddress(const sockaddr* sa, Q_UINT16 len) } // create from IP and port -KInetSocketAddress::KInetSocketAddress(const KIpAddress& host, Q_UINT16 port) +KInetSocketAddress::KInetSocketAddress(const KIpAddress& host, TQ_UINT16 port) { setHost(host); setPort(port); @@ -788,14 +788,14 @@ KInetSocketAddress& KInetSocketAddress::setHost(const KIpAddress& ip) default: // empty - d->invalidate(); + d->tqinvalidate(); } return *this; } // returns the port -Q_UINT16 KInetSocketAddress::port() const +TQ_UINT16 KInetSocketAddress::port() const { if (d->invalid()) return 0; @@ -814,7 +814,7 @@ Q_UINT16 KInetSocketAddress::port() const return 0; } -KInetSocketAddress& KInetSocketAddress::setPort(Q_UINT16 port) +KInetSocketAddress& KInetSocketAddress::setPort(TQ_UINT16 port) { if (d->invalid()) makeIPv4(); @@ -832,7 +832,7 @@ KInetSocketAddress& KInetSocketAddress::setPort(Q_UINT16 port) #endif default: - d->invalidate(); // setting the port on something else + d->tqinvalidate(); // setting the port on something else } return *this; @@ -850,7 +850,7 @@ KInetSocketAddress& KInetSocketAddress::makeIPv6() return *this; } -Q_UINT32 KInetSocketAddress::flowinfo() const +TQ_UINT32 KInetSocketAddress::flowinfo() const { #ifndef AF_INET6 return 0; @@ -862,7 +862,7 @@ Q_UINT32 KInetSocketAddress::flowinfo() const #endif } -KInetSocketAddress& KInetSocketAddress::setFlowinfo(Q_UINT32 flowinfo) +KInetSocketAddress& KInetSocketAddress::setFlowinfo(TQ_UINT32 flowinfo) { makeIPv6(); // must set here d->addr.in6->sin6_flowinfo = flowinfo; @@ -897,18 +897,18 @@ void KInetSocketAddress::update() return; #endif else - d->invalidate(); + d->tqinvalidate(); } KUnixSocketAddress::KUnixSocketAddress() { } -KUnixSocketAddress::KUnixSocketAddress(const sockaddr* sa, Q_UINT16 len) +KUnixSocketAddress::KUnixSocketAddress(const sockaddr* sa, TQ_UINT16 len) : KSocketAddress(sa, len) { if (!d->invalid() && d->addr.un->sun_family != AF_UNIX) - d->invalidate(); + d->tqinvalidate(); } KUnixSocketAddress::KUnixSocketAddress(const KUnixSocketAddress& other) |