23 #include <netinet/in.h>
24 #include <QHostAddress>
25 #include <util/constants.h>
26 #include <ktorrent_export.h>
40 class KTORRENT_EXPORT Address :
public QHostAddress
44 Address(quint32 ip4Addr, Uint16 port);
45 Address(quint8* ip6Addr, Uint16 port);
46 Address(
const Q_IPV6ADDR & ip6Addr, Uint16 port);
47 Address(
const struct sockaddr_storage* ss);
48 Address(
const QString & host, Uint16 port);
49 Address(
const QHostAddress & addr, Uint16 port);
50 Address(
const Address & addr);
54 Uint16 port()
const {
return port_number;}
57 void setPort(Uint16 p) {port_number = p;}
60 void toSocketAddress(
struct sockaddr_storage* ss,
int & length)
const;
63 int ipVersion()
const {
return protocol() == QAbstractSocket::IPv4Protocol ? 4 : 6;}
75 Address & operator = (
const struct sockaddr_storage & ss);
78 bool isIPv4Mapped()
const;