mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-11-04 12:59:07 +01:00
All: Remove deprecated Drivers
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
#ifndef __CDCACM_WINDOWS_H_
|
||||
#define __CDCACM_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/driver.h"
|
||||
#include "icsneo/device/founddevice.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class CDCACM : public Driver {
|
||||
public:
|
||||
CDCACM(const device_eventhandler_t& err, const std::wstring& path);
|
||||
static void Find(std::vector<FoundDevice>& found);
|
||||
bool open() override;
|
||||
bool isOpen() override;
|
||||
bool close() override;
|
||||
driver_finder_t getFinder() override { return CDCACM::Find; }
|
||||
|
||||
private:
|
||||
void read();
|
||||
void write();
|
||||
std::wstring path;
|
||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||
std::thread readThread;
|
||||
std::thread writeThread;
|
||||
OVERLAPPED readOverlapped = {};
|
||||
OVERLAPPED writeOverlapped = {};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef __PCAPDLL_WINDOWS_H_
|
||||
#define __PCAPDLL_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#include <pcap.h>
|
||||
#include <memory>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
// Helper loader for the PCAP DLL
|
||||
class PCAPDLL {
|
||||
public:
|
||||
// The first time we use the DLL we keep it in here and it won't get freed until the user unloads us (for speed reasons)
|
||||
static const PCAPDLL& getInstance();
|
||||
|
||||
// Functions
|
||||
typedef int(__cdecl* PCAPFINDDEVICE)(char* source, struct pcap_rmtauth* auth, pcap_if_t** alldevs, char* errbuf);
|
||||
typedef pcap_t*(__cdecl* PCAPOPEN)(const char* source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth* auth, char* errbuf);
|
||||
typedef void(__cdecl* PCAPFREEDEVS)(pcap_if_t* alldevsp);
|
||||
typedef void(__cdecl* PCAPCLOSE)(pcap_t* p);
|
||||
typedef int(__cdecl* PCAPSTATS)(pcap_t* p, struct pcap_stat* ps);
|
||||
typedef int(__cdecl* PCAPNEXTEX)(pcap_t* p, struct pcap_pkthdr** pkt_header, const unsigned char** pkt_data);
|
||||
typedef int(__cdecl* PCAPSENDPACKET)(pcap_t* p, const unsigned char* buf, int size);
|
||||
typedef pcap_send_queue*(__cdecl* PCAPSENDQUEUEALLOC)(unsigned int memsize);
|
||||
typedef int(__cdecl* PCAPSENDQUEUEQUEUE)(pcap_send_queue* queue, const struct pcap_pkthdr* pkt_header, const unsigned char* pkt_data);
|
||||
typedef void(__cdecl* PCAPSENDQUEUEDESTROY)(pcap_send_queue* queue);
|
||||
typedef unsigned int(__cdecl* PCAPSENDQUEUETRANSMIT)(pcap_t* p, pcap_send_queue* queue, int sync);
|
||||
typedef int(__cdecl* PCAPDATALINK)(pcap_t* p);
|
||||
typedef int(__cdecl* PCAPCREATESRCSTR)(char* source, int type, const char* host, const char* port, const char* name, char* errbuf);
|
||||
typedef int(__cdecl* PCAPSETBUFF)(pcap_t* p, int dim);
|
||||
PCAPFINDDEVICE findalldevs_ex;
|
||||
PCAPOPEN open;
|
||||
PCAPFREEDEVS freealldevs;
|
||||
PCAPCLOSE close;
|
||||
PCAPSTATS stats;
|
||||
PCAPNEXTEX next_ex;
|
||||
PCAPSENDPACKET sendpacket;
|
||||
PCAPSENDQUEUEALLOC sendqueue_alloc;
|
||||
PCAPSENDQUEUEQUEUE sendqueue_queue;
|
||||
PCAPSENDQUEUEDESTROY sendqueue_destroy;
|
||||
PCAPSENDQUEUETRANSMIT sendqueue_transmit;
|
||||
PCAPDATALINK datalink;
|
||||
PCAPCREATESRCSTR createsrcstr;
|
||||
PCAPSETBUFF setbuff;
|
||||
|
||||
|
||||
~PCAPDLL();
|
||||
bool ok() const;
|
||||
private:
|
||||
PCAPDLL();
|
||||
HINSTANCE dll = nullptr;
|
||||
void closeDLL();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
#ifndef __PCAP_WINDOWS_H_
|
||||
#define __PCAP_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/platform/windows/internal/pcapdll.h"
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/communication/driver.h"
|
||||
#include "icsneo/device/founddevice.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
#include "icsneo/communication/ethernetpacketizer.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace icsneo {
|
||||
|
||||
class PCAP : public Driver {
|
||||
public:
|
||||
static void Find(std::vector<FoundDevice>& foundDevices);
|
||||
static std::string GetEthDevSerialFromMacAddress(uint8_t product, uint16_t macSerial);
|
||||
static bool IsHandleValid(neodevice_handle_t handle);
|
||||
|
||||
PCAP(const device_eventhandler_t& err, neodevice_t& forDevice);
|
||||
bool open() override;
|
||||
bool isOpen() override;
|
||||
bool close() override;
|
||||
bool isEthernet() const override { return true; }
|
||||
driver_finder_t getFinder() override { return PCAP::Find; }
|
||||
|
||||
private:
|
||||
const PCAPDLL& pcap;
|
||||
char errbuf[PCAP_ERRBUF_SIZE] = { 0 };
|
||||
neodevice_t& device;
|
||||
uint8_t deviceMAC[6];
|
||||
bool openable = true;
|
||||
EthernetPacketizer ethPacketizer;
|
||||
|
||||
std::thread readThread, writeThread;
|
||||
std::thread transmitThread;
|
||||
pcap_send_queue* transmitQueue = nullptr;
|
||||
std::condition_variable transmitQueueCV;
|
||||
std::mutex transmitQueueMutex;
|
||||
|
||||
void readTask();
|
||||
void writeTask();
|
||||
void transmitTask();
|
||||
|
||||
class NetworkInterface {
|
||||
public:
|
||||
uint8_t uuid;
|
||||
uint8_t macAddress[6];
|
||||
std::string nameFromWinPCAP;
|
||||
std::string nameFromWin32API;
|
||||
std::string descriptionFromWinPCAP;
|
||||
std::string descriptionFromWin32API;
|
||||
std::string friendlyNameFromWin32API;
|
||||
std::string fullName;
|
||||
pcap_t* fp = nullptr;
|
||||
pcap_stat stats;
|
||||
};
|
||||
static std::vector<NetworkInterface> knownInterfaces;
|
||||
NetworkInterface iface;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef __REGISTRY_WINDOWS_H_
|
||||
#define __REGISTRY_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Registry {
|
||||
public:
|
||||
static bool EnumerateSubkeys(std::wstring path, std::vector<std::wstring>& subkeys);
|
||||
|
||||
// Get string value
|
||||
static bool Get(std::wstring path, std::wstring key, std::wstring& value);
|
||||
static bool Get(std::string path, std::string key, std::string& value);
|
||||
|
||||
// Get DWORD value
|
||||
static bool Get(std::wstring path, std::wstring key, uint32_t& value);
|
||||
static bool Get(std::string path, std::string key, uint32_t& value);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef __WINDOWS_STRINGS_H__
|
||||
#define __WINDOWS_STRINGS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
// Helper function to convert UTF-16 to UTF-8 strings (wide to standard)
|
||||
std::string convertWideString(const std::wstring& value);
|
||||
|
||||
// Helper function to convert UTF-8 to UTF-16 strings (standard to wide)
|
||||
std::wstring convertStringToWide(const std::string& value);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __WINDOWS_STRINGS_H__
|
||||
Reference in New Issue
Block a user