diff --git a/server/drone.pro b/server/drone.pro index 2c544a1..10842a6 100644 --- a/server/drone.pro +++ b/server/drone.pro @@ -61,6 +61,7 @@ SOURCES += \ linuxhostdevice.cpp \ linuxport.cpp \ params.cpp \ + turbo.cpp \ winhostdevice.cpp \ winpcapport.cpp SOURCES += myservice.cpp diff --git a/server/portmanager.cpp b/server/portmanager.cpp index 80a8b10..723da76 100644 --- a/server/portmanager.cpp +++ b/server/portmanager.cpp @@ -17,10 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see */ -#ifdef TURBO -#include "xdpport.h" // MUST be included first - see why in xdpport.h -#endif - #include "portmanager.h" #include "bsdport.h" @@ -28,6 +24,7 @@ along with this program. If not, see #include "linuxport.h" #include "pcapport.h" #include "settings.h" +#include "turbo.h" #include "winpcapport.h" #include @@ -97,18 +94,17 @@ PortManager::PortManager() #if defined(Q_OS_WIN32) port = new WinPcapPort(i, device->name, device->description); #elif defined(Q_OS_LINUX) -#ifdef TURBO - port = new XdpPort(i, device->name); -#else - port = new LinuxPort(i, device->name); -#endif + if (isTurboPort(device->name)) + port = createTurboPort(i, device->name); + else + port = new LinuxPort(i, device->name); #elif defined(Q_OS_BSD4) port = new BsdPort(i, device->name); #else port = new PcapPort(i, device->name); #endif - if (!port->isUsable()) + if (port && !port->isUsable()) { qDebug("%s: unable to open %s. Skipping!", __FUNCTION__, device->name); diff --git a/server/turbo.cpp b/server/turbo.cpp new file mode 100644 index 0000000..75bef99 --- /dev/null +++ b/server/turbo.cpp @@ -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 +*/ + +#include "turbo.h" + +bool isTurboPort(const char* device) +{ + return false; +} + +AbstractPort* createTurboPort(int id, const char* device) +{ + return nullptr; +} + +#endif + diff --git a/server/turbo.h b/server/turbo.h new file mode 100644 index 0000000..c967c5f --- /dev/null +++ b/server/turbo.h @@ -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 +*/ + +#ifndef _TURBO_H +#define _TURBO_H + +class AbstractPort; + +bool isTurboPort(const char* device); +AbstractPort* createTurboPort(int id, const char* device); + +#endif +