Oh no! Some styles failed to load. 😵 Please try reloading this page
Menu â–¾ â–´

[r3602]: / trunk / desmume / src / windows / winpcap.h  Maximize  Restore  History

Download this file

72 lines (54 with data), 2.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
Copyright (C) 2010 DeSmuME team
This file is part of DeSmuME
DeSmuME 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 2 of the License, or
(at your option) any later version.
DeSmuME 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 DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef WINPCAP_H
#define WINPCAP_H
#define HAVE_REMOTE
#define WPCAP
#define PACKET_SIZE 65535
#include <pcap.h>
static bool bWinPCapAvailable = false;
typedef int (__cdecl *T_pcap_findalldevs)(pcap_if_t** alldevs, char* errbuf);
typedef void (__cdecl *T_pcap_freealldevs)(pcap_if_t* alldevs);
typedef pcap_t* (__cdecl *T_pcap_open_live)(const char* source, int snaplen, int flags, int readtimeout, char* errbuf);
typedef void (__cdecl *T_pcap_close)(pcap_t* dev);
typedef int (__cdecl *T_pcap_setnonblock)(pcap_t* dev, int nonblock, char* errbuf);
typedef int (__cdecl *T_pcap_send)(pcap_t* dev, const u_char* data, int len);
typedef int (__cdecl *T_pcap_dispatch)(pcap_t* dev, int num, pcap_handler callback, u_char* userdata);
T_pcap_findalldevs _pcap_findalldevs = NULL;
T_pcap_freealldevs _pcap_freealldevs = NULL;
T_pcap_open_live _pcap_open_live = NULL;
T_pcap_close _pcap_close = NULL;
T_pcap_setnonblock _pcap_setnonblock = NULL;
T_pcap_send _pcap_send = NULL;
T_pcap_dispatch _pcap_dispatch = NULL;
#define LOADSYMBOL(name) \
_##name = (T_##name)GetProcAddress(wpcap, #name); \
if (_##name == NULL) return;
static void LoadWinPCap()
{
HMODULE wpcap = LoadLibrary("wpcap.dll");
if (wpcap == NULL)
return;
LOADSYMBOL(pcap_findalldevs);
LOADSYMBOL(pcap_freealldevs);
LOADSYMBOL(pcap_open_live);
LOADSYMBOL(pcap_close);
LOADSYMBOL(pcap_setnonblock);
LOADSYMBOL(pcap_send);
LOADSYMBOL(pcap_dispatch);
bWinPCapAvailable = true;
}
#endif

Get latest updates about Open Source Projects, Conferences and News.

Sign Up No, Thank you