2021-05-10 15:37:23 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2011, 2014 André Hentschel
|
|
|
|
* Copyright 2021 Hans Leidekker for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma makedep unix
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_PCAP_PCAP_H
|
|
|
|
#include <pcap/pcap.h>
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2021-10-04 14:36:39 +02:00
|
|
|
#include <stdlib.h>
|
2021-10-04 14:36:40 +02:00
|
|
|
#include <limits.h>
|
2021-05-10 15:37:23 +02:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winternl.h"
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
#include "wine/unixlib.h"
|
2021-05-10 15:37:23 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "unixlib.h"
|
|
|
|
|
2021-10-04 14:36:40 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wpcap);
|
2021-05-10 15:37:23 +02:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_activate( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
return pcap_activate( pcap->handle );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_breakloop( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
|
|
|
pcap_breakloop( pcap->handle );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_can_set_rfmon( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
return pcap_can_set_rfmon( pcap->handle );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_close( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
pcap_close( pcap->handle );
|
|
|
|
free( pcap );
|
2021-11-23 18:59:25 +01:00
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_compile( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct compile_params *params = args;
|
|
|
|
return pcap_compile( params->pcap->handle, params->program, params->buf, params->optimize, params->mask );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_create( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct create_params *params = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
struct pcap *ret = malloc( sizeof(*ret) );
|
2021-11-23 18:59:25 +01:00
|
|
|
|
|
|
|
if (ret && !(ret->handle = pcap_create( params->src, params->errbuf )))
|
2021-10-04 14:36:39 +02:00
|
|
|
{
|
|
|
|
free( ret );
|
2021-11-23 18:59:25 +01:00
|
|
|
ret = NULL;
|
2021-10-04 14:36:39 +02:00
|
|
|
}
|
2021-11-23 18:59:25 +01:00
|
|
|
*params->ret = ret;
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_datalink( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
return pcap_datalink( pcap->handle );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_datalink_name_to_val( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct datalink_name_to_val_params *params = args;
|
|
|
|
return pcap_datalink_name_to_val( params->name );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_datalink_val_to_description( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct datalink_val_to_description_params *params = args;
|
|
|
|
*params->ret = pcap_datalink_val_to_description( params->link );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_datalink_val_to_name( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct datalink_val_to_name_params *params = args;
|
|
|
|
*params->ret = pcap_datalink_val_to_name( params->link );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_dump( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct dump_params *params = args;
|
2021-10-04 14:36:40 +02:00
|
|
|
struct pcap_pkthdr hdr_unix;
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
hdr_unix.ts.tv_sec = params->hdr->ts.tv_sec;
|
|
|
|
hdr_unix.ts.tv_usec = params->hdr->ts.tv_usec;
|
|
|
|
hdr_unix.caplen = params->hdr->caplen;
|
|
|
|
hdr_unix.len = params->hdr->len;
|
|
|
|
pcap_dump( params->user, &hdr_unix, params->packet );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_dump_open( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct dump_open_params *params = args;
|
|
|
|
*params->ret = pcap_dump_open( params->pcap->handle, params->name );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_findalldevs( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct findalldevs_params *params = args;
|
2021-05-10 15:37:23 +02:00
|
|
|
int ret;
|
2021-11-23 18:59:25 +01:00
|
|
|
ret = pcap_findalldevs( (pcap_if_t **)params->devs, params->errbuf );
|
|
|
|
if (params->devs && !*params->devs)
|
2021-05-10 15:37:23 +02:00
|
|
|
ERR_(winediag)( "Failed to access raw network (pcap), this requires special permissions.\n" );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_free_datalinks( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
int *links = args;
|
2021-05-10 15:37:24 +02:00
|
|
|
pcap_free_datalinks( links );
|
2021-11-23 18:59:25 +01:00
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_free_tstamp_types( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
int *types = args;
|
2021-05-10 15:37:24 +02:00
|
|
|
pcap_free_tstamp_types( types );
|
2021-11-23 18:59:25 +01:00
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_freealldevs( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap_interface *devs = args;
|
2021-05-10 15:37:23 +02:00
|
|
|
pcap_freealldevs( (pcap_if_t *)devs );
|
2021-11-23 18:59:25 +01:00
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_freecode( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
void *program = args;
|
|
|
|
pcap_freecode( program );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_get_tstamp_precision( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
return pcap_get_tstamp_precision( pcap->handle );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_geterr( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct geterr_params *params = args;
|
|
|
|
*params->ret = pcap_geterr( params->pcap->handle );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_getnonblock( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct getnonblock_params *params = args;
|
|
|
|
return pcap_getnonblock( params->pcap->handle, params->errbuf );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_lib_version( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct lib_version_params *params = args;
|
|
|
|
const char *str = pcap_lib_version();
|
|
|
|
unsigned int len = min( strlen(str) + 1, params->size );
|
|
|
|
memcpy( params->version, str, len );
|
|
|
|
params->version[len - 1] = 0;
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_list_datalinks( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct list_datalinks_params *params = args;
|
|
|
|
return pcap_list_datalinks( params->pcap->handle, params->buf );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_list_tstamp_types( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct list_tstamp_types_params *params = args;
|
|
|
|
return pcap_list_tstamp_types( params->pcap->handle, params->types );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_lookupnet( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct lookupnet_params *params = args;
|
|
|
|
return pcap_lookupnet( params->device, params->net, params->mask, params->errbuf );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_major_version( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
return pcap_major_version( pcap->handle );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_minor_version( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
return pcap_minor_version( pcap->handle );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_next_ex( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct next_ex_params *params = args;
|
|
|
|
struct pcap *pcap = params->pcap;
|
2021-10-04 14:36:40 +02:00
|
|
|
struct pcap_pkthdr *hdr_unix;
|
|
|
|
int ret;
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
if ((ret = pcap_next_ex( pcap->handle, &hdr_unix, params->data )) == 1)
|
2021-10-04 14:36:40 +02:00
|
|
|
{
|
|
|
|
if (hdr_unix->ts.tv_sec > INT_MAX || hdr_unix->ts.tv_usec > INT_MAX) WARN( "truncating timeval values(s)\n" );
|
|
|
|
pcap->hdr.ts.tv_sec = hdr_unix->ts.tv_sec;
|
|
|
|
pcap->hdr.ts.tv_usec = hdr_unix->ts.tv_usec;
|
|
|
|
pcap->hdr.caplen = hdr_unix->caplen;
|
|
|
|
pcap->hdr.len = hdr_unix->len;
|
2021-11-23 18:59:25 +01:00
|
|
|
*params->hdr = &pcap->hdr;
|
2021-10-04 14:36:40 +02:00
|
|
|
}
|
|
|
|
return ret;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_open_live( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct open_live_params *params = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
struct pcap *ret = malloc( sizeof(*ret) );
|
2021-11-23 18:59:25 +01:00
|
|
|
if (ret && !(ret->handle = pcap_open_live( params->source, params->snaplen, params->promisc,
|
|
|
|
params->to_ms, params->errbuf )))
|
2021-10-04 14:36:39 +02:00
|
|
|
{
|
|
|
|
free( ret );
|
2021-11-23 18:59:25 +01:00
|
|
|
ret = NULL;
|
2021-10-04 14:36:39 +02:00
|
|
|
}
|
2021-11-23 18:59:25 +01:00
|
|
|
*params->ret = ret;
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_sendpacket( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct sendpacket_params *params = args;
|
|
|
|
return pcap_sendpacket( params->pcap->handle, params->buf, params->size );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_buffer_size( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_buffer_size_params *params = args;
|
|
|
|
return pcap_set_buffer_size( params->pcap->handle, params->size );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_datalink( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_datalink_params *params = args;
|
|
|
|
return pcap_set_datalink( params->pcap->handle, params->link );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_promisc( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_promisc_params *params = args;
|
|
|
|
return pcap_set_promisc( params->pcap->handle, params->enable );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_rfmon( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_rfmon_params *params = args;
|
|
|
|
return pcap_set_rfmon( params->pcap->handle, params->enable );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_snaplen( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_snaplen_params *params = args;
|
|
|
|
return pcap_set_snaplen( params->pcap->handle, params->len );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_timeout( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_timeout_params *params = args;
|
|
|
|
return pcap_set_timeout( params->pcap->handle, params->timeout );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_tstamp_precision( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_tstamp_precision_params *params = args;
|
|
|
|
return pcap_set_tstamp_precision( params->pcap->handle, params->precision );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_set_tstamp_type( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct set_tstamp_type_params *params = args;
|
|
|
|
return pcap_set_tstamp_type( params->pcap->handle, params->type );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_setfilter( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct setfilter_params *params = args;
|
|
|
|
return pcap_setfilter( params->pcap->handle, params->program );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_setnonblock( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct setnonblock_params *params = args;
|
|
|
|
return pcap_setnonblock( params->pcap->handle, params->nonblock, params->errbuf );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_snapshot( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
struct pcap *pcap = args;
|
2021-10-04 14:36:39 +02:00
|
|
|
return pcap_snapshot( pcap->handle );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_stats( void *args )
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct stats_params *params = args;
|
|
|
|
return pcap_stats( params->pcap->handle, params->stats );
|
2021-05-10 15:37:23 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_statustostr( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct statustostr_params *params = args;
|
|
|
|
*params->ret = pcap_statustostr( params->status );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_tstamp_type_name_to_val( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct tstamp_type_name_to_val_params *params = args;
|
|
|
|
return pcap_tstamp_type_name_to_val( params->name );
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_tstamp_type_val_to_description( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct tstamp_type_val_to_description_params *params = args;
|
|
|
|
*params->ret = pcap_tstamp_type_val_to_description( params->val );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
static NTSTATUS wrap_tstamp_type_val_to_name( void *args )
|
2021-05-10 15:37:24 +02:00
|
|
|
{
|
2021-11-23 18:59:25 +01:00
|
|
|
const struct tstamp_type_val_to_name_params *params = args;
|
|
|
|
*params->ret = pcap_tstamp_type_val_to_name( params->val );
|
|
|
|
return STATUS_SUCCESS;
|
2021-05-10 15:37:24 +02:00
|
|
|
}
|
|
|
|
|
2021-11-23 18:59:25 +01:00
|
|
|
const unixlib_entry_t __wine_unix_call_funcs[] =
|
2021-05-10 15:37:23 +02:00
|
|
|
{
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_activate,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_breakloop,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_can_set_rfmon,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_close,
|
|
|
|
wrap_compile,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_create,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_datalink,
|
|
|
|
wrap_datalink_name_to_val,
|
|
|
|
wrap_datalink_val_to_description,
|
|
|
|
wrap_datalink_val_to_name,
|
2021-11-23 18:59:25 +01:00
|
|
|
/* wrap_dispatch, */
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_dump,
|
|
|
|
wrap_dump_open,
|
|
|
|
wrap_findalldevs,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_free_datalinks,
|
|
|
|
wrap_free_tstamp_types,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_freealldevs,
|
|
|
|
wrap_freecode,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_get_tstamp_precision,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_geterr,
|
|
|
|
wrap_getnonblock,
|
|
|
|
wrap_lib_version,
|
|
|
|
wrap_list_datalinks,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_list_tstamp_types,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_lookupnet,
|
2021-11-23 18:59:25 +01:00
|
|
|
/* wrap_loop, */
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_major_version,
|
|
|
|
wrap_minor_version,
|
|
|
|
wrap_next_ex,
|
|
|
|
wrap_open_live,
|
|
|
|
wrap_sendpacket,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_set_buffer_size,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_set_datalink,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_set_promisc,
|
|
|
|
wrap_set_rfmon,
|
|
|
|
wrap_set_snaplen,
|
|
|
|
wrap_set_timeout,
|
|
|
|
wrap_set_tstamp_precision,
|
|
|
|
wrap_set_tstamp_type,
|
2021-05-10 15:37:23 +02:00
|
|
|
wrap_setfilter,
|
|
|
|
wrap_setnonblock,
|
|
|
|
wrap_snapshot,
|
|
|
|
wrap_stats,
|
2021-05-10 15:37:24 +02:00
|
|
|
wrap_statustostr,
|
|
|
|
wrap_tstamp_type_name_to_val,
|
|
|
|
wrap_tstamp_type_val_to_description,
|
|
|
|
wrap_tstamp_type_val_to_name,
|
2021-05-10 15:37:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* HAVE_PCAP_PCAP_H */
|