start work on libpcap shit

This commit is contained in:
StapleButter
2017-12-17 17:21:50 +01:00
parent e4e8d775c0
commit 17087a1ece
16 changed files with 3827 additions and 1 deletions

View File

@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <SDL2/SDL.h>
#include <pcap/pcap.h>
#include "../Platform.h"
#include "../Config.h"
@ -75,6 +76,17 @@ u8 PacketBuffer[2048];
#define NIFI_VER 1
const char* PCapLibNames[] =
{
#ifdef __WIN32__
"wpcap.dll",
#else
// TODO: Linux lib names
#endif
NULL
};
void StopEmu()
{
Stop(true);
@ -259,4 +271,24 @@ int MP_RecvPacket(u8* data, bool block)
}
// LAN interface. Currently powered by libpcap, may change.
bool LAN_Init()
{
for (int i = 0; PCapLibNames[i]; i++)
{
void* lib = SDL_LoadObject(PCapLibNames[i]);
if (!lib) continue;
printf("loaded lib %s\n", PCapLibNames[i]);
SDL_UnloadObject(lib);
}
}
void LAN_DeInit()
{
//
}
}