Commit 1fc4d54c authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wpcap: Implement some more functions.

parent 67b95d4a
......@@ -40,11 +40,21 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
static const struct pcap_callbacks *callbacks;
static int CDECL wrap_activate( void *handle )
{
return pcap_activate( handle );
}
static void CDECL wrap_breakloop( void *handle )
{
return pcap_breakloop( handle );
}
static int CDECL wrap_can_set_rfmon( void *handle )
{
return pcap_can_set_rfmon( handle );
}
static void CDECL wrap_close( void *handle )
{
pcap_close( handle );
......@@ -55,6 +65,11 @@ static int CDECL wrap_compile( void *handle, void *program, const char *buf, int
return pcap_compile( handle, program, buf, optimize, mask );
}
static void * CDECL wrap_create( const char *src, char *errbuf )
{
return pcap_create( src, errbuf );
}
static int CDECL wrap_datalink( void *handle )
{
return pcap_datalink( handle );
......@@ -114,6 +129,16 @@ static int CDECL wrap_findalldevs( struct pcap_if_hdr **devs, char *errbuf )
return ret;
}
static void CDECL wrap_free_datalinks( int *links )
{
pcap_free_datalinks( links );
}
static void CDECL wrap_free_tstamp_types( int *types )
{
pcap_free_tstamp_types( types );
}
static void CDECL wrap_freealldevs( struct pcap_if_hdr *devs )
{
pcap_freealldevs( (pcap_if_t *)devs );
......@@ -124,6 +149,11 @@ static void CDECL wrap_freecode( void *program )
return pcap_freecode( program );
}
static int CDECL wrap_get_tstamp_precision( void *handle )
{
return pcap_get_tstamp_precision( handle );
}
static char * CDECL wrap_geterr( void *handle )
{
return pcap_geterr( handle );
......@@ -144,6 +174,11 @@ static int CDECL wrap_list_datalinks( void *handle, int **buf )
return pcap_list_datalinks( handle, buf );
}
static int CDECL wrap_list_tstamp_types( void *handle, int **types )
{
return pcap_list_tstamp_types( handle, types );
}
static int CDECL wrap_lookupnet( const char *device, unsigned int *net, unsigned int *mask, char *errbuf )
{
return pcap_lookupnet( device, net, mask, errbuf );
......@@ -193,11 +228,46 @@ static int CDECL wrap_sendpacket( void *handle, const unsigned char *buf, int si
return pcap_sendpacket( handle, buf, size );
}
static int CDECL wrap_set_buffer_size( void *handle, int size )
{
return pcap_set_buffer_size( handle, size );
}
static int CDECL wrap_set_datalink( void *handle, int link )
{
return pcap_set_datalink( handle, link );
}
static int CDECL wrap_set_promisc( void *handle, int enable )
{
return pcap_set_promisc( handle, enable );
}
static int CDECL wrap_set_rfmon( void *handle, int enable )
{
return pcap_set_rfmon( handle, enable );
}
static int CDECL wrap_set_snaplen( void *handle, int len )
{
return pcap_set_snaplen( handle, len );
}
static int CDECL wrap_set_timeout( void *handle, int timeout )
{
return pcap_set_timeout( handle, timeout );
}
static int CDECL wrap_set_tstamp_precision( void *handle, int precision )
{
return pcap_set_tstamp_precision( handle, precision );
}
static int CDECL wrap_set_tstamp_type( void *handle, int type )
{
return pcap_set_tstamp_type( handle, type );
}
static int CDECL wrap_setfilter( void *handle, void *program )
{
return pcap_setfilter( handle, program );
......@@ -218,11 +288,34 @@ static int CDECL wrap_stats( void *handle, void *stats )
return pcap_stats( handle, stats );
}
static const char * CDECL wrap_statustostr( int status )
{
return pcap_statustostr( status );
}
static int CDECL wrap_tstamp_type_name_to_val( const char *name )
{
return pcap_tstamp_type_name_to_val( name );
}
static const char * CDECL wrap_tstamp_type_val_to_description( int val )
{
return pcap_tstamp_type_val_to_description( val );
}
static const char * CDECL wrap_tstamp_type_val_to_name( int val )
{
return pcap_tstamp_type_val_to_name( val );
}
static const struct pcap_funcs funcs =
{
wrap_activate,
wrap_breakloop,
wrap_can_set_rfmon,
wrap_close,
wrap_compile,
wrap_create,
wrap_datalink,
wrap_datalink_name_to_val,
wrap_datalink_val_to_description,
......@@ -231,12 +324,16 @@ static const struct pcap_funcs funcs =
wrap_dump,
wrap_dump_open,
wrap_findalldevs,
wrap_free_datalinks,
wrap_free_tstamp_types,
wrap_freealldevs,
wrap_freecode,
wrap_get_tstamp_precision,
wrap_geterr,
wrap_getnonblock,
wrap_lib_version,
wrap_list_datalinks,
wrap_list_tstamp_types,
wrap_lookupnet,
wrap_loop,
wrap_major_version,
......@@ -245,11 +342,22 @@ static const struct pcap_funcs funcs =
wrap_next_ex,
wrap_open_live,
wrap_sendpacket,
wrap_set_buffer_size,
wrap_set_datalink,
wrap_set_promisc,
wrap_set_rfmon,
wrap_set_snaplen,
wrap_set_timeout,
wrap_set_tstamp_precision,
wrap_set_tstamp_type,
wrap_setfilter,
wrap_setnonblock,
wrap_snapshot,
wrap_stats,
wrap_statustostr,
wrap_tstamp_type_name_to_val,
wrap_tstamp_type_val_to_description,
wrap_tstamp_type_val_to_name,
};
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
......
......@@ -31,9 +31,12 @@ struct handler_callback
struct pcap_funcs
{
int (CDECL *activate)( void * );
void (CDECL *breakloop)( void * );
int (CDECL *can_set_rfmon)( void * );
void (CDECL *close)( void * );
int (CDECL *compile)( void *, void *, const char *, int, unsigned int );
void * (CDECL *create)( const char *, char * );
int (CDECL *datalink)( void * );
int (CDECL *datalink_name_to_val)( const char * );
const char * (CDECL *datalink_val_to_description)( int );
......@@ -43,12 +46,16 @@ struct pcap_funcs
void (CDECL *dump)( unsigned char *, const void *, const unsigned char * );
void * (CDECL *dump_open)( void *, const char * );
int (CDECL *findalldevs)( struct pcap_if_hdr **, char * );
void (CDECL *free_datalinks)( int * );
void (CDECL *free_tstamp_types)( int * );
void (CDECL *freealldevs)( struct pcap_if_hdr * );
void (CDECL *freecode)( void * );
int (CDECL *get_tstamp_precision)( void * );
char * (CDECL *geterr)( void * );
int (CDECL *getnonblock)( void *, char * );
const char * (CDECL *lib_version)( void );
int (CDECL *list_datalinks)( void *, int ** );
int (CDECL *list_tstamp_types)( void *, int ** );
int (CDECL *lookupnet)( const char *, unsigned int *, unsigned int *, char * );
int (CDECL *loop)( void *, int, void (CALLBACK *)(unsigned char *, const void *, const unsigned char *),
unsigned char * );
......@@ -58,11 +65,22 @@ struct pcap_funcs
int (CDECL *next_ex)( void *, void **, const unsigned char ** );
void * (CDECL *open_live)( const char *, int, int, int, char * );
int (CDECL *sendpacket)( void *, const unsigned char *, int );
int (CDECL *set_buffer_size)( void *, int );
int (CDECL *set_datalink)( void *, int );
int (CDECL *set_promisc)( void *, int );
int (CDECL *set_rfmon)( void *, int );
int (CDECL *set_snaplen)( void *, int );
int (CDECL *set_timeout)( void *, int );
int (CDECL *set_tstamp_precision)( void *, int );
int (CDECL *set_tstamp_type)( void *, int );
int (CDECL *setfilter)( void *, void * );
int (CDECL *setnonblock)( void *, int, char * );
int (CDECL *snapshot)( void * );
int (CDECL *stats)( void *, void * );
const char * (CDECL *statustostr)( int );
int (CDECL *tstamp_type_name_to_val)( const char * );
const char * (CDECL *tstamp_type_val_to_description)( int );
const char * (CDECL *tstamp_type_val_to_name)( int );
};
struct pcap_callbacks
......
......@@ -50,12 +50,24 @@ static inline WCHAR *heap_strdupAtoW(const char *str)
return ret;
}
int CDECL wine_pcap_activate( void *handle )
{
TRACE( "%p\n", handle );
return pcap_funcs->activate( handle );
}
void CDECL wine_pcap_breakloop( void *handle )
{
TRACE( "%p\n", handle );
pcap_funcs->breakloop( handle );
}
int CDECL wine_pcap_can_set_rfmon( void *handle )
{
TRACE( "%p\n", handle );
return pcap_funcs->can_set_rfmon( handle );
}
void CDECL wine_pcap_close( void *handle )
{
TRACE( "%p\n", handle );
......@@ -68,6 +80,12 @@ int CDECL wine_pcap_compile( void *handle, void *program, const char *buf, int o
return pcap_funcs->compile( handle, program, buf, optimize, mask );
}
void * CDECL wine_pcap_create( const char *src, char *errbuf )
{
TRACE( "%s, %p\n", src, errbuf );
return pcap_funcs->create( src, errbuf );
}
int CDECL wine_pcap_datalink( void *handle )
{
TRACE( "%p\n", handle );
......@@ -138,6 +156,18 @@ int CDECL wine_pcap_findalldevs_ex( char *source, void *auth, struct pcap_if_hdr
return pcap_funcs->findalldevs( devs, errbuf );
}
void CDECL wine_pcap_free_datalinks( int *links )
{
TRACE( "%p\n", links );
pcap_funcs->free_datalinks( links );
}
void CDECL wine_pcap_free_tstamp_types( int *types )
{
TRACE( "%p\n", types );
pcap_funcs->free_tstamp_types( types );
}
void CDECL wine_pcap_freealldevs( struct pcap_if_hdr *devs )
{
TRACE( "%p\n", devs );
......@@ -156,6 +186,12 @@ void * CDECL wine_pcap_get_airpcap_handle( void *handle )
return NULL;
}
int CDECL wine_pcap_get_tstamp_precision( void *handle )
{
TRACE( "%p\n", handle );
return pcap_funcs->get_tstamp_precision( handle );
}
char * CDECL wine_pcap_geterr( void *handle )
{
TRACE( "%p\n", handle );
......@@ -190,6 +226,12 @@ int CDECL wine_pcap_list_datalinks( void *handle, int **buf )
return pcap_funcs->list_datalinks( handle, buf );
}
int CDECL wine_pcap_list_tstamp_types( void *handle, int **types )
{
TRACE( "%p, %p\n", handle, types );
return pcap_funcs->list_tstamp_types( handle, types );
}
char * CDECL wine_pcap_lookupdev( char *errbuf )
{
static char *ret;
......@@ -304,12 +346,54 @@ int CDECL wine_pcap_sendpacket( void *handle, const unsigned char *buf, int size
return pcap_funcs->sendpacket( handle, buf, size );
}
int CDECL wine_pcap_set_buffer_size( void *handle, int size )
{
TRACE( "%p, %d\n", handle, size );
return pcap_funcs->set_buffer_size( handle, size );
}
int CDECL wine_pcap_set_datalink( void *handle, int link )
{
TRACE( "%p, %d\n", handle, link );
return pcap_funcs->set_datalink( handle, link );
}
int CDECL wine_pcap_set_promisc( void *handle, int enable )
{
TRACE( "%p, %d\n", handle, enable );
return pcap_funcs->set_promisc( handle, enable );
}
int CDECL wine_pcap_set_rfmon( void *handle, int enable )
{
TRACE( "%p, %d\n", handle, enable );
return pcap_funcs->set_rfmon( handle, enable );
}
int CDECL wine_pcap_set_snaplen( void *handle, int len )
{
TRACE( "%p, %d\n", handle, len );
return pcap_funcs->set_snaplen( handle, len );
}
int CDECL wine_pcap_set_timeout( void *handle, int timeout )
{
TRACE( "%p, %d\n", handle, timeout );
return pcap_funcs->set_timeout( handle, timeout );
}
int CDECL wine_pcap_set_tstamp_precision( void *handle, int precision )
{
TRACE( "%p, %d\n", handle, precision );
return pcap_funcs->set_tstamp_precision( handle, precision );
}
int CDECL wine_pcap_set_tstamp_type( void *handle, int type )
{
TRACE( "%p, %d\n", handle, type );
return pcap_funcs->set_tstamp_type( handle, type );
}
int CDECL wine_pcap_setbuff( void *handle, int size )
{
FIXME( "%p, %d\n", handle, size );
......@@ -340,6 +424,30 @@ int CDECL wine_pcap_stats( void *handle, void *stats )
return pcap_funcs->stats( handle, stats );
}
const char * CDECL wine_pcap_statustostr( int status )
{
TRACE( "%d\n", status );
return pcap_funcs->statustostr( status );
}
int CDECL wine_pcap_tstamp_type_name_to_val( const char *name )
{
TRACE( "%s\n", debugstr_a(name) );
return pcap_funcs->tstamp_type_name_to_val( name );
}
const char * CDECL wine_pcap_tstamp_type_val_to_description( int val )
{
TRACE( "%d\n", val );
return pcap_funcs->tstamp_type_val_to_description( val );
}
const char * CDECL wine_pcap_tstamp_type_val_to_name( int val )
{
TRACE( "%d\n", val );
return pcap_funcs->tstamp_type_val_to_name( val );
}
int CDECL wsockinit( void )
{
WSADATA wsadata;
......
......@@ -6,10 +6,13 @@
@ stub eproto_db
@ stub getservent
@ stub install_bpf_program
@ cdecl pcap_activate(ptr) wine_pcap_activate
@ cdecl pcap_breakloop(ptr) wine_pcap_breakloop
@ cdecl pcap_can_set_rfmon(ptr) wine_pcap_can_set_rfmon
@ cdecl pcap_close(ptr) wine_pcap_close
@ cdecl pcap_compile(ptr ptr str long long) wine_pcap_compile
@ stub pcap_compile_nopcap
@ cdecl pcap_create(str ptr) wine_pcap_create
@ stub pcap_createsrcstr
@ cdecl pcap_datalink(ptr) wine_pcap_datalink
@ cdecl pcap_datalink_name_to_val(str) wine_pcap_datalink_name_to_val
......@@ -26,15 +29,19 @@
@ stub pcap_fileno
@ cdecl pcap_findalldevs(ptr ptr) wine_pcap_findalldevs
@ cdecl pcap_findalldevs_ex(ptr ptr ptr ptr) wine_pcap_findalldevs_ex
@ cdecl pcap_free_datalinks(ptr) wine_pcap_free_datalinks
@ cdecl pcap_free_tstamp_types(ptr) wine_pcap_free_tstamp_types
@ cdecl pcap_freealldevs(ptr) wine_pcap_freealldevs
@ cdecl pcap_freecode(ptr) wine_pcap_freecode
@ cdecl pcap_get_airpcap_handle(ptr) wine_pcap_get_airpcap_handle
@ cdecl pcap_get_tstamp_precision(ptr) wine_pcap_get_tstamp_precision
@ cdecl pcap_geterr(ptr) wine_pcap_geterr
@ stub pcap_getevent
@ cdecl pcap_getnonblock(ptr ptr) wine_pcap_getnonblock
@ stub pcap_is_swapped
@ cdecl pcap_lib_version() wine_pcap_lib_version
@ cdecl pcap_list_datalinks(ptr ptr) wine_pcap_list_datalinks
@ cdecl pcap_list_tstamp_types(ptr ptr) wine_pcap_list_tstamp_types
@ stub pcap_live_dump
@ stub pcap_live_dump_ended
@ cdecl pcap_lookupdev(ptr) wine_pcap_lookupdev
......@@ -63,7 +70,14 @@
@ stub pcap_sendqueue_destroy
@ stub pcap_sendqueue_queue
@ stub pcap_sendqueue_transmit
@ cdecl pcap_set_buffer_size(ptr long) wine_pcap_set_buffer_size
@ cdecl pcap_set_datalink(ptr long) wine_pcap_set_datalink
@ cdecl pcap_set_promisc(ptr long) wine_pcap_set_promisc
@ cdecl pcap_set_rfmon(ptr long) wine_pcap_set_rfmon
@ cdecl pcap_set_snaplen(ptr long) wine_pcap_set_snaplen
@ cdecl pcap_set_timeout(ptr long) wine_pcap_set_timeout
@ cdecl pcap_set_tstamp_precision(ptr long) wine_pcap_set_tstamp_precision
@ cdecl pcap_set_tstamp_type(ptr long) wine_pcap_set_tstamp_type
@ cdecl pcap_setbuff(ptr long) wine_pcap_setbuff
@ cdecl pcap_setfilter(ptr ptr) wine_pcap_setfilter
@ stub pcap_setmintocopy
......@@ -74,5 +88,9 @@
@ cdecl pcap_snapshot(ptr) wine_pcap_snapshot
@ cdecl pcap_stats(ptr ptr) wine_pcap_stats
@ stub pcap_stats_ex
@ cdecl pcap_statustostr(long) wine_pcap_statustostr
@ cdecl pcap_strerror(long) msvcrt.strerror
@ cdecl pcap_tstamp_type_name_to_val(str) wine_pcap_tstamp_type_name_to_val
@ cdecl pcap_tstamp_type_val_to_description(long) wine_pcap_tstamp_type_val_to_description
@ cdecl pcap_tstamp_type_val_to_name(long) wine_pcap_tstamp_type_val_to_name
@ cdecl wsockinit()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment