24 #include <tqcstring.h> 26 #include "kdelibs_export.h" 31 typedef unsigned ksocklen_t;
37 class KSocketAddressPrivate;
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 KSocketAddress* 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 KSocketAddressPrivate* 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 An Inet (IPv4 or IPv6) socket address.
const sockaddr * address() const
Returns a sockaddr structure, for passing down to library functions.
bool operator==(const KSocketAddress &other) const
Overloaded == operator.
virtual TQString pretty() const
Returns a string representation of this socket.
virtual TQString nodeName() const
Returns the node name of this socket, as KExtendedSocket::lookup expects as the first argument...
virtual ksocklen_t size() const
Returns sockaddr structure size.
KSocketAddress()
Creates an empty class.
KInetSocketAddress & operator=(const KInetSocketAddress &other)
Sets this object to be the same as the other.
The extended socket class.
int ianaFamily() const
Returns the IANA family number of this address.
virtual TQString serviceName() const
Returns the service name for this socket, as KExtendedSocket::lookup expects as the service argument...
bool isCoreEqual(const KSocketAddress *other) const
Some sockets may differ in such things as services or port numbers, like Internet sockets...