Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkinterface_unix_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// Copyright (C) 2017 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QNETWORKINTERFACE_UNIX_P_H
7#define QNETWORKINTERFACE_UNIX_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
21#include "private/qnet_unix_p.h"
22
23#ifndef QT_NO_NETWORKINTERFACE
24
25#define IP_MULTICAST // make AIX happy and define IFF_MULTICAST
26
27#include <sys/types.h>
28#include <sys/socket.h>
29#ifdef Q_OS_SOLARIS
30# include <sys/sockio.h>
31#endif
32#ifdef Q_OS_HAIKU
33# include <sys/sockio.h>
34# define IFF_RUNNING 0x0001
35#endif
36#if QT_CONFIG(linux_netlink)
37// Same as net/if.h but contains other things we need in
38// qnetworkinterface_linux.cpp.
39# include <linux/if.h>
40#else
41# include <net/if.h>
42#endif
43
44QT_BEGIN_NAMESPACE
45
46static QNetworkInterface::InterfaceFlags convertFlags(uint rawFlags)
47{
48 QNetworkInterface::InterfaceFlags flags;
49 flags |= (rawFlags & IFF_UP) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0);
50 flags |= (rawFlags & IFF_RUNNING) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0);
51 flags |= (rawFlags & IFF_BROADCAST) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0);
52 flags |= (rawFlags & IFF_LOOPBACK) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0);
53#ifdef IFF_POINTOPOINT //cygwin doesn't define IFF_POINTOPOINT
54 flags |= (rawFlags & IFF_POINTOPOINT) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0);
55#endif
56
57#ifdef IFF_MULTICAST
58 flags |= (rawFlags & IFF_MULTICAST) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0);
59#endif
60 return flags;
61}
62
63QT_END_NAMESPACE
64
65#endif // QT_NO_NETWORKINTERFACE
66
67#endif // QNETWORKINTERFACE_UNIX_P_H
The QNetworkAddressEntry class stores one IP address supported by a network interface,...
#define AF_INET6
#define ARPHRD_PHONET
#define ARPHRD_PHONET_PIPE
static void getAddresses(int sock, char *buf, QList< QNetworkInterfacePrivate * > &result)
static QNetworkInterface::InterfaceType probeIfType(int socket, struct ifreq *req, short arptype)
#define ARPHRD_IEEE802154
#define ARPHRD_6LOWPAN
static QList< QNetworkInterfacePrivate * > getInterfaces(int sock, char *buf)