24 #include <tqcstring.h>
26 #include "tdelibs_export.h"
31 typedef unsigned ksocklen_t;
37 class TDESocketAddressPrivate;
72 virtual TQString pretty()
const;
85 virtual ksocklen_t
size()
const
93 operator const sockaddr*()
const
108 {
return ianaFamily(family()); }
117 {
return isEqual(*other); }
124 {
return isEqual(other); }
149 {
return isCoreEqual(*other); }
158 virtual TQString nodeName()
const;
167 virtual TQString serviceName()
const;
188 static TDESocketAddress* newAddress(
const struct sockaddr *sa, ksocklen_t size);
197 static int ianaFamily(
int af);
203 static int fromIanaFamily(
int iana);
207 virtual void virtual_hook(
int id,
void* data );
209 TDESocketAddressPrivate* d;
221 class KInetSocketAddressPrivate;
304 bool setAddress(
const sockaddr_in* sin, ksocklen_t len);
314 bool setAddress(
const sockaddr_in6* sin6, ksocklen_t len);
322 bool setAddress(
const in_addr& addr,
unsigned short port);
330 bool setAddress(
const in6_addr& addr,
unsigned short port);
349 bool setAddress(
const TQString& addr,
unsigned short port,
int family = -1);
356 bool setHost(
const in_addr& addr);
363 bool setHost(
const in6_addr& addr);
371 bool setHost(
const TQString& addr,
int family = -1);
378 bool setPort(
unsigned short port);
387 bool setFamily(
int family);
394 bool setFlowinfo(TQ_UINT32 flowinfo);
401 bool setScopeId(
int scopeid);
407 virtual TQString
pretty()
const;
431 const sockaddr_in* addressV4()
const;
437 const sockaddr_in6* addressV6()
const;
444 in_addr hostV4()
const;
452 in6_addr hostV6()
const;
458 unsigned short port()
const;
464 TQ_UINT32 flowinfo()
const;
477 virtual ksocklen_t
size()
const;
514 operator const sockaddr_in*()
const
515 {
return addressV4(); }
522 operator const sockaddr_in6*()
const
523 {
return addressV6(); }
529 { setAddress(other);
return *
this; }
544 static TQString addrToString(
int family,
const void *addr);
555 static bool stringToAddr(
int family,
const char *text,
void *dest);
559 virtual void virtual_hook(
int id,
void* data );
561 KInetSocketAddressPrivate* d;
564 extern const ::KInetSocketAddress addressAny, addressLoopback;
571 class KUnixSocketAddressPrivate;
617 bool setAddress(
const sockaddr_un* socket_address, ksocklen_t size);
624 bool setAddress(TQCString path);
631 TQCString pathname()
const;
637 virtual TQString
pretty()
const;
651 const sockaddr_un*
address()
const;
658 operator const sockaddr_un*()
const
678 virtual void virtual_hook(
int id,
void* data );
680 KUnixSocketAddressPrivate* d;
683 #endif // KSOCKADDR_H
virtual TQString pretty() const
Returns a string representation of this socket.
const sockaddr * address() const
Returns a sockaddr structure, for passing down to library functions.
KInetSocketAddress & operator=(const KInetSocketAddress &other)
Sets this object to be the same as the other.
bool operator==(const TDESocketAddress &other) const
Overloaded == operator.
int ianaFamily() const
Returns the IANA family number of this address.
An Inet (IPv4 or IPv6) socket address.
virtual TQString nodeName() const
Returns the node name of this socket, as KExtendedSocket::lookup expects as the first argument.
bool isCoreEqual(const TDESocketAddress *other) const
Some sockets may differ in such things as services or port numbers, like Internet sockets.
virtual ksocklen_t size() const
Returns sockaddr structure size.
TDESocketAddress()
Creates an empty class.
virtual TQString serviceName() const
Returns the service name for this socket, as KExtendedSocket::lookup expects as the service argument.
The extended socket class.