Qt 4.8
Classes | Functions
qnlaengine.cpp File Reference
#include "qnlaengine.h"
#include "../qnetworksession_impl.h"
#include <QtNetwork/private/qnetworkconfiguration_p.h>
#include <QtCore/qthread.h>
#include <QtCore/qmutex.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
#include "../platformdefs_win.h"
#include "qnlaengine.moc"

Go to the source code of this file.

Classes

class  QNlaThread
 

Functions

static QNetworkConfiguration::BearerType qGetInterfaceType (const QString &interface)
 

Function Documentation

◆ qGetInterfaceType()

static QNetworkConfiguration::BearerType qGetInterfaceType ( const QString interface)
static

Definition at line 122 of file qnlaengine.cpp.

Referenced by QNlaThread::parseQuerySet().

123 {
124 #ifdef Q_OS_WINCE
125  Q_UNUSED(interface)
126 #else
127  unsigned long oid;
128  DWORD bytesWritten;
129 
130  NDIS_MEDIUM medium;
131  NDIS_PHYSICAL_MEDIUM physicalMedium;
132 
133  HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0,
134  FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
135  if (handle == INVALID_HANDLE_VALUE)
137 
139  bytesWritten = 0;
140  bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
141  &medium, sizeof(medium), &bytesWritten, 0);
142  if (!result) {
143  CloseHandle(handle);
145  }
146 
148  bytesWritten = 0;
149  result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
150  &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0);
151  if (!result) {
152  CloseHandle(handle);
153 
154  if (medium == NdisMedium802_3)
156  else
158  }
159 
160  CloseHandle(handle);
161 
162  if (medium == NdisMedium802_3) {
163  switch (physicalMedium) {
170  default:
171 #ifdef BEARER_MANAGEMENT_DEBUG
172  qDebug() << "Physical Medium" << physicalMedium;
173 #endif
175  }
176  }
177 
178 #ifdef BEARER_MANAGEMENT_DEBUG
179  qDebug() << medium << physicalMedium;
180 #endif
181 
182 #endif
183 
185 }
#define IOCTL_NDIS_QUERY_GLOBAL_STATS
NDIS_PHYSICAL_MEDIUM
#define OID_GEN_PHYSICAL_MEDIUM
Q_CORE_EXPORT void qDebug(const char *,...)
void * HANDLE
Definition: qnamespace.h:1671
NDIS_MEDIUM
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
#define OID_GEN_MEDIA_SUPPORTED
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729