4 * Copyright 2011 André Hentschel
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <pcap/pcap.h>
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(wpcap
);
25 WINE_DECLARE_DEBUG_CHANNEL(winediag
);
27 int CDECL
wine_pcap_compile(pcap_t
*p
, struct bpf_program
*program
, const char *buf
, int optimize
,
30 TRACE("(%p %p %s %i %u)\n", p
, program
, debugstr_a(buf
), optimize
, mask
);
31 return pcap_compile(p
, program
, buf
, optimize
, mask
);
34 int CDECL
wine_pcap_datalink(pcap_t
*p
)
37 return pcap_datalink(p
);
40 int CDECL
wine_pcap_findalldevs(pcap_if_t
**alldevsp
, char *errbuf
)
44 TRACE("(%p %p)\n", alldevsp
, errbuf
);
45 ret
= pcap_findalldevs(alldevsp
, errbuf
);
46 if(alldevsp
&& !*alldevsp
)
47 ERR_(winediag
)("Failed to access raw network (pcap), this requires special permissions.\n");
52 void CDECL
wine_pcap_freealldevs(pcap_if_t
*alldevs
)
54 TRACE("(%p)\n", alldevs
);
55 pcap_freealldevs(alldevs
);
58 char* CDECL
wine_pcap_geterr(pcap_t
*p
)
61 return pcap_geterr(p
);
64 const char* CDECL
wine_pcap_lib_version(void)
66 const char* ret
= pcap_lib_version();
67 TRACE("%s\n", debugstr_a(ret
));
71 char* CDECL
wine_pcap_lookupdev(char *errbuf
)
73 TRACE("(%p)\n", errbuf
);
74 return pcap_lookupdev(errbuf
);
77 int CDECL
wine_pcap_lookupnet(const char *device
, unsigned int *netp
, unsigned int *maskp
,
80 TRACE("(%s %p %p %p)\n", debugstr_a(device
), netp
, maskp
, errbuf
);
81 return pcap_lookupnet(device
, netp
, maskp
, errbuf
);
84 int CDECL
wine_pcap_major_version(pcap_t
*p
)
87 return pcap_major_version(p
);
90 int CDECL
wine_pcap_minor_version(pcap_t
*p
)
93 return pcap_minor_version(p
);
96 pcap_t
* CDECL
wine_pcap_open_live(const char *source
, int snaplen
, int promisc
, int to_ms
,
99 TRACE("(%s %i %i %i %p)\n", debugstr_a(source
), snaplen
, promisc
, to_ms
, errbuf
);
100 return pcap_open_live(source
, snaplen
, promisc
, to_ms
, errbuf
);
103 int CDECL
wine_pcap_setbuff(pcap_t
* p
, int dim
)
105 FIXME("(%p %i) stub\n", p
, dim
);
109 int CDECL
wine_pcap_setfilter(pcap_t
*p
, struct bpf_program
*fp
)
111 TRACE("(%p %p)\n", p
, fp
);
112 return pcap_setfilter(p
, fp
);
115 int CDECL
wine_pcap_stats(pcap_t
*p
, struct pcap_stat
*ps
)
117 TRACE("(%p %p)\n", p
, ps
);
118 return pcap_stats(p
, ps
);