Tap driver basically builds in VS2012... fork of tap-windows from OpenVPN (compatible license).

This commit is contained in:
Adam Ierymenko 2013-08-23 17:39:21 -04:00
parent b6248c7cb7
commit e2effbd1ce
29 changed files with 6762 additions and 200 deletions

View file

@ -43,33 +43,21 @@
#include "InetAddress.hpp"
#include "MAC.hpp"
#include "Mutex.hpp"
#include "Condition.hpp"
#include "MulticastGroup.hpp"
#include "Thread.hpp"
#include "Buffer.hpp"
#include "Array.hpp"
#ifdef __WINDOWS__
#include <pcap/pcap.h>
#include <pcap/bpf.h>
#include <Win32-Extensions.h>
#endif
namespace ZeroTier {
class RuntimeEnvironment;
#ifdef __WINDOWS__
class _WinEthernetTapPcapIOThread;
#endif
/**
* System ethernet tap device
*/
class EthernetTap
{
#ifdef __WINDOWS__
friend class _WinEthernetTapPcapIOThread;
#endif
public:
/**
* Construct a new TAP device
@ -189,13 +177,11 @@ public:
*/
bool updateMulticastGroups(std::set<MulticastGroup> &groups);
#ifdef __UNIX_LIKE__
/**
* Thread main method; do not call elsewhere
*/
void threadMain()
throw();
#endif
private:
const MAC _mac;
@ -217,11 +203,10 @@ private:
#endif
#ifdef __WINDOWS__
pcap_t *_pcap;
std::string _myDeviceInstanceId;
std::queue< std::pair< Array<char,ZT_IF_MTU + 32>,unsigned int > > _injectPending;
Mutex _injectPending_m;
static void _pcapHandler(u_char *user,const struct pcap_pkthdr *pkt_header,const u_char *pkt_data);
Condition _injectPending_c;
#endif
};