2014-08-06 22:15:00 +00:00
|
|
|
/*
|
|
|
|
* WPcap.dll Proxy.
|
|
|
|
*
|
|
|
|
* Copyright 2011 André Hentschel
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <pcap/pcap.h>
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wpcap);
|
2014-08-10 21:08:40 +00:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
|
|
|
|
2014-08-11 22:32:05 +00:00
|
|
|
int CDECL wine_pcap_datalink(pcap_t *p)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", p);
|
|
|
|
return pcap_datalink(p);
|
|
|
|
}
|
|
|
|
|
2014-08-10 21:08:40 +00:00
|
|
|
int CDECL wine_pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
TRACE("(%p %p)\n", alldevsp, errbuf);
|
|
|
|
ret = pcap_findalldevs(alldevsp, errbuf);
|
|
|
|
if(alldevsp && !*alldevsp)
|
|
|
|
ERR_(winediag)("Failed to access raw network (pcap), this requires special permissions.\n");
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2014-08-06 22:15:00 +00:00
|
|
|
|
2014-08-10 21:09:22 +00:00
|
|
|
void CDECL wine_pcap_freealldevs(pcap_if_t *alldevs)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", alldevs);
|
|
|
|
pcap_freealldevs(alldevs);
|
|
|
|
}
|
|
|
|
|
2014-08-11 22:28:59 +00:00
|
|
|
char* CDECL wine_pcap_geterr(pcap_t *p)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", p);
|
|
|
|
return pcap_geterr(p);
|
|
|
|
}
|
|
|
|
|
2014-08-06 22:15:00 +00:00
|
|
|
const char* CDECL wine_pcap_lib_version(void)
|
|
|
|
{
|
|
|
|
const char* ret = pcap_lib_version();
|
|
|
|
TRACE("%s\n", debugstr_a(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
2014-08-10 21:08:20 +00:00
|
|
|
|
|
|
|
int CDECL wine_pcap_major_version(pcap_t *p)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", p);
|
|
|
|
return pcap_major_version(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
int CDECL wine_pcap_minor_version(pcap_t *p)
|
|
|
|
{
|
|
|
|
TRACE("(%p)\n", p);
|
|
|
|
return pcap_minor_version(p);
|
|
|
|
}
|
2014-08-11 22:29:46 +00:00
|
|
|
|
|
|
|
pcap_t* CDECL wine_pcap_open_live(const char *source, int snaplen, int promisc, int to_ms,
|
|
|
|
char *errbuf)
|
|
|
|
{
|
|
|
|
TRACE("(%p %i %i %i %p)\n", source, snaplen, promisc, to_ms, errbuf);
|
|
|
|
return pcap_open_live(source, snaplen, promisc, to_ms, errbuf);
|
|
|
|
}
|
2014-08-11 22:30:47 +00:00
|
|
|
|
2014-08-11 22:31:25 +00:00
|
|
|
int CDECL wine_pcap_setbuff(pcap_t * p, int dim)
|
|
|
|
{
|
|
|
|
FIXME("(%p %i) stub\n", p, dim);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-11 22:30:47 +00:00
|
|
|
int CDECL wine_pcap_stats(pcap_t *p, struct pcap_stat *ps)
|
|
|
|
{
|
|
|
|
TRACE("(%p %p)\n", p, ps);
|
|
|
|
return pcap_stats(p, ps);
|
|
|
|
}
|