1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the network module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#ifndef QHOSTADDRESS_H
30
#define QHOSTADDRESS_H
32
#include "QtCore/qstring.h"
33
#include "QtNetwork/qabstractsocket.h"
35
class QHostAddressPrivate;
37
class Q_NETWORK_EXPORT QIPv6Address
40
inline quint8 &operator [](int index) { return c[index]; }
41
inline quint8 operator [](int index) const { return c[index]; }
45
typedef QIPv6Address Q_IPV6ADDR;
47
class Q_NETWORK_EXPORT QHostAddress
60
explicit QHostAddress(quint32 ip4Addr);
61
explicit QHostAddress(quint8 *ip6Addr);
62
explicit QHostAddress(const Q_IPV6ADDR &ip6Addr);
63
explicit QHostAddress(const QString &address);
64
QHostAddress(const QHostAddress ©);
65
QHostAddress(SpecialAddress address);
68
QHostAddress &operator=(const QHostAddress &);
70
void setAddress(quint32 ip4Addr);
71
void setAddress(quint8 *ip6Addr);
72
void setAddress(const Q_IPV6ADDR &ip6Addr);
73
bool setAddress(const QString &address);
75
QAbstractSocket::NetworkLayerProtocol protocol() const;
76
quint32 toIPv4Address() const;
77
Q_IPV6ADDR toIPv6Address() const;
79
QString toString() const;
81
bool operator ==(const QHostAddress &address) const;
82
bool operator ==(SpecialAddress address) const;
87
inline QT3_SUPPORT quint32 ip4Addr() const { return toIPv4Address(); }
88
inline QT3_SUPPORT bool isIPv4Address() const { return protocol() == QAbstractSocket::IPv4Protocol
89
|| protocol() == QAbstractSocket::UnknownNetworkLayerProtocol; }
90
inline QT3_SUPPORT bool isIp4Addr() const { return protocol() == QAbstractSocket::IPv4Protocol
91
|| protocol() == QAbstractSocket::UnknownNetworkLayerProtocol; }
92
inline QT3_SUPPORT bool isIPv6Address() const { return protocol() == QAbstractSocket::IPv6Protocol; }
96
QHostAddressPrivate *d;
99
#endif // QHOSTADDRESS_H