wpcap: Partially implement pcap_parsesrcstr.

This commit is contained in:
André Hentschel 2015-08-31 20:52:13 +02:00 committed by Alexandre Julliard
parent 2b42ddf68a
commit 04d72a3e47
2 changed files with 52 additions and 1 deletions

View File

@ -27,6 +27,19 @@
WINE_DEFAULT_DEBUG_CHANNEL(wpcap);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
#ifndef PCAP_SRC_FILE_STRING
#define PCAP_SRC_FILE_STRING "file://"
#endif
#ifndef PCAP_SRC_FILE
#define PCAP_SRC_FILE 2
#endif
#ifndef PCAP_SRC_IF_STRING
#define PCAP_SRC_IF_STRING "rpcap://"
#endif
#ifndef PCAP_SRC_IFLOCAL
#define PCAP_SRC_IFLOCAL 3
#endif
void CDECL wine_pcap_breakloop(pcap_t *p)
{
TRACE("(%p)\n", p);
@ -239,6 +252,44 @@ pcap_t* CDECL wine_pcap_open_live(const char *source, int snaplen, int promisc,
return pcap_open_live(source, snaplen, promisc, to_ms, errbuf);
}
int CDECL wine_pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf)
{
int t = PCAP_SRC_IFLOCAL;
const char *p = source;
FIXME("(%s %p %p %p %p %p): partial stub\n", debugstr_a(source), type, host, port, name, errbuf);
if (host)
*host = '\0';
if (port)
*port = '\0';
if (name)
*name = '\0';
if (!strncmp(p, PCAP_SRC_IF_STRING, strlen(PCAP_SRC_IF_STRING)))
p += strlen(PCAP_SRC_IF_STRING);
else if (!strncmp(p, PCAP_SRC_FILE_STRING, strlen(PCAP_SRC_FILE_STRING)))
{
p += strlen(PCAP_SRC_FILE_STRING);
t = PCAP_SRC_FILE;
}
if (type)
*type = t;
if (!*p)
{
if (errbuf)
sprintf(errbuf, "The name has not been specified in the source string.");
return -1;
}
if (name)
strcpy(name, p);
return 0;
}
int CDECL wine_pcap_sendpacket(pcap_t *p, const unsigned char *buf, int size)
{
TRACE("(%p %p %i)\n", p, buf, size);

View File

@ -51,7 +51,7 @@
@ stub pcap_open_dead
@ cdecl pcap_open_live(str long long long ptr) wine_pcap_open_live
@ stub pcap_open_offline
@ stub pcap_parsesrcstr
@ cdecl pcap_parsesrcstr(str ptr ptr ptr ptr ptr) wine_pcap_parsesrcstr
@ stub pcap_perror
@ stub pcap_read
@ stub pcap_remoteact_accept