blob: 761cf945d09373c54f6a9dafc2d6c9f7ba271d36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright 2017-2022 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#ifndef MUMBLE_HOSTADDRESS_H_
#define MUMBLE_HOSTADDRESS_H_
#include <QtCore/QByteArray>
#include <QtCore/QString>
#include <QtCore/QtGlobal>
#include <QtNetwork/QHostAddress>
#include <QtNetwork/Q_IPV6ADDR>
struct HostAddress {
union {
Q_IPV6ADDR qip6;
quint16 shorts[8];
quint32 hash[4];
quint64 addr[2];
};
HostAddress();
HostAddress(const Q_IPV6ADDR &);
HostAddress(const std::string &);
HostAddress(const QHostAddress &);
HostAddress(const QByteArray &);
HostAddress(const struct sockaddr_storage &);
bool isV6() const;
bool isValid() const;
bool operator<(const HostAddress &) const;
bool operator==(const HostAddress &) const;
bool match(const HostAddress &, int bits) const;
QString toString() const;
std::string toStdString() const;
QHostAddress toAddress() const;
QByteArray toByteArray() const;
void toSockaddr(struct sockaddr_storage *dst) const;
};
Q_DECLARE_TYPEINFO(HostAddress, Q_MOVABLE_TYPE);
quint32 qHash(const HostAddress &);
#endif
|