Integrate XdpPort more cleanly into port manager
* No ugly #ifdef TURBO * Turbo ports need to be specified explicitly in drone.ini * If a port is not a turbo port, fall back to LinuxPort * Turbo ports set their description as 'Turbo' which shows up in GUI * Some XdpPort creation/destruction error checks
This commit is contained in:
parent
eb2ca12f32
commit
c949dc6682
@ -61,6 +61,7 @@ SOURCES += \
|
|||||||
linuxhostdevice.cpp \
|
linuxhostdevice.cpp \
|
||||||
linuxport.cpp \
|
linuxport.cpp \
|
||||||
params.cpp \
|
params.cpp \
|
||||||
|
turbo.cpp \
|
||||||
winhostdevice.cpp \
|
winhostdevice.cpp \
|
||||||
winpcapport.cpp
|
winpcapport.cpp
|
||||||
SOURCES += myservice.cpp
|
SOURCES += myservice.cpp
|
||||||
|
@ -17,10 +17,6 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef TURBO
|
|
||||||
#include "xdpport.h" // MUST be included first - see why in xdpport.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "portmanager.h"
|
#include "portmanager.h"
|
||||||
|
|
||||||
#include "bsdport.h"
|
#include "bsdport.h"
|
||||||
@ -28,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|||||||
#include "linuxport.h"
|
#include "linuxport.h"
|
||||||
#include "pcapport.h"
|
#include "pcapport.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "turbo.h"
|
||||||
#include "winpcapport.h"
|
#include "winpcapport.h"
|
||||||
|
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
@ -97,18 +94,17 @@ PortManager::PortManager()
|
|||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
port = new WinPcapPort(i, device->name, device->description);
|
port = new WinPcapPort(i, device->name, device->description);
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
#ifdef TURBO
|
if (isTurboPort(device->name))
|
||||||
port = new XdpPort(i, device->name);
|
port = createTurboPort(i, device->name);
|
||||||
#else
|
else
|
||||||
port = new LinuxPort(i, device->name);
|
port = new LinuxPort(i, device->name);
|
||||||
#endif
|
|
||||||
#elif defined(Q_OS_BSD4)
|
#elif defined(Q_OS_BSD4)
|
||||||
port = new BsdPort(i, device->name);
|
port = new BsdPort(i, device->name);
|
||||||
#else
|
#else
|
||||||
port = new PcapPort(i, device->name);
|
port = new PcapPort(i, device->name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!port->isUsable())
|
if (port && !port->isUsable())
|
||||||
{
|
{
|
||||||
qDebug("%s: unable to open %s. Skipping!", __FUNCTION__,
|
qDebug("%s: unable to open %s. Skipping!", __FUNCTION__,
|
||||||
device->name);
|
device->name);
|
||||||
|
33
server/turbo.cpp
Normal file
33
server/turbo.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2021 Srivats P.
|
||||||
|
|
||||||
|
This file is part of "Ostinato"
|
||||||
|
|
||||||
|
This is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "turbo.h"
|
||||||
|
|
||||||
|
bool isTurboPort(const char* device)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractPort* createTurboPort(int id, const char* device)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
29
server/turbo.h
Normal file
29
server/turbo.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2021 Srivats P.
|
||||||
|
|
||||||
|
This file is part of "Ostinato"
|
||||||
|
|
||||||
|
This is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _TURBO_H
|
||||||
|
#define _TURBO_H
|
||||||
|
|
||||||
|
class AbstractPort;
|
||||||
|
|
||||||
|
bool isTurboPort(const char* device);
|
||||||
|
AbstractPort* createTurboPort(int id, const char* device);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user