On Jan 24, 2016, at 8:30 AM, Yang Luo <hslu...@gmail.com> wrote:

> I forgot about one most important thing that libpcap seemingly doesn't
> compile under Windows, even if there's a Win32\Prj in it. Actually I got
> many errors when I build libpcap under VS2005.
> 
> I am quite confused with some lines like this in pcap-int.h:

The current version of libpcap's pcap-int.h doesn't look like:

> typedef int (*activate_op_t)(pcap_t *);
> typedef int (*can_set_rfmon_op_t)(pcap_t *);
> typedef int (*read_op_t)(pcap_t *, int cnt, pcap_handler, u_char *);
> typedef int (*inject_op_t)(pcap_t *, const void *, size_t);
> typedef int (*setfilter_op_t)(pcap_t *, struct bpf_program *);
> typedef int (*setdirection_op_t)(pcap_t *, pcap_direction_t);
> typedef int (*set_datalink_op_t)(pcap_t *, int);
> typedef int (*getnonblock_op_t)(pcap_t *, char *);
> typedef int (*setnonblock_op_t)(pcap_t *, int, char *);
> typedef int (*stats_op_t)(pcap_t *, struct pcap_stat *);
> #ifdef WIN32
> typedef int (*setbuff_op_t)(pcap_t *, int);
> typedef int (*setmode_op_t)(pcap_t *, int);
> typedef int (*setmintocopy_op_t)(pcap_t *, int);
> typedef Adapter *(*getadapter_op_t)(pcap_t *);
> #endif
> typedef void (*cleanup_op_t)(pcap_t *);

it looks like:

typedef int     (*activate_op_t)(pcap_t *);
typedef int     (*can_set_rfmon_op_t)(pcap_t *);
typedef int     (*read_op_t)(pcap_t *, int cnt, pcap_handler, u_char *);
typedef int     (*inject_op_t)(pcap_t *, const void *, size_t);
typedef int     (*setfilter_op_t)(pcap_t *, struct bpf_program *);
typedef int     (*setdirection_op_t)(pcap_t *, pcap_direction_t);
typedef int     (*set_datalink_op_t)(pcap_t *, int);
typedef int     (*getnonblock_op_t)(pcap_t *, char *);
typedef int     (*setnonblock_op_t)(pcap_t *, int, char *);
typedef int     (*stats_op_t)(pcap_t *, struct pcap_stat *);
#ifdef _WIN32
typedef struct pcap_stat *(*stats_ex_op_t)(pcap_t *, int *);
typedef int     (*setbuff_op_t)(pcap_t *, int);
typedef int     (*setmode_op_t)(pcap_t *, int);
typedef int     (*setmintocopy_op_t)(pcap_t *, int);
typedef HANDLE  (*getevent_op_t)(pcap_t *);
typedef int     (*oid_get_request_op_t)(pcap_t *, bpf_u_int32, void *, size_t);
typedef int     (*oid_set_request_op_t)(pcap_t *, bpf_u_int32, const void *, 
size_t);
typedef u_int   (*sendqueue_transmit_op_t)(pcap_t *, pcap_send_queue *, int);
typedef int     (*setuserbuffer_op_t)(pcap_t *, int);
typedef int     (*live_dump_op_t)(pcap_t *, char *, int, int);
typedef int     (*live_dump_ended_op_t)(pcap_t *, int);
typedef PAirpcapHandle  (*get_airpcap_handle_op_t)(pcap_t *);
#endif
typedef void    (*cleanup_op_t)(pcap_t *);

which, among other things, doesn't use "Adapter" at all.

And, speaking of Win32\Prj, that's now deprecated - get CMake:

        https://cmake.org

and use that.  autotools are also supported (and are the main build mechanisms 
supported) on UN*X, but the old Windows projects aren't being kept up-to-date.

> It seems that libpcap has considered Windows as there's WIN32 macro, but
> Adapter is not defined as VS2005 error shows.

You should use the *current* version of libpcap, not whatever older version 
you're using (the one that comes with WinPcap?).

_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Reply via email to