diff options
-rw-r--r-- | pcap-int.h | 11 | ||||
-rw-r--r-- | pcap-rpcap.c | 4 | ||||
-rw-r--r-- | pcap.c | 16 |
3 files changed, 22 insertions, 9 deletions
@@ -526,11 +526,14 @@ int install_bpf_program(pcap_t *, struct bpf_program *); int pcap_strcasecmp(const char *, const char *); /* - * Internal interface for pcap_parsesrcstr with the additional bit of - * information regarding SSL support (rpcap:// vs rpcaps://) + * Internal interfaces for pcap_createsrcstr and pcap_parsesrcstr with + * the additional bit of information regarding SSL support (rpcap:// vs. + * rpcaps://). */ -int pcap_parsesrcstr_ex(const char *source, int *type, char *host, char *port, - char *name, unsigned char *uses_ssl, char *errbuf); +int pcap_createsrcstr_ex(char *, int, const char *, const char *, + const char *, unsigned char, char *); +int pcap_parsesrcstr_ex(const char *, int *, char *, char *, + char *, unsigned char *, char *); #ifdef YYDEBUG extern int pcap_debug; diff --git a/pcap-rpcap.c b/pcap-rpcap.c index 64b66c99..5b285004 100644 --- a/pcap-rpcap.c +++ b/pcap-rpcap.c @@ -2566,8 +2566,8 @@ pcap_findalldevs_ex_remote(const char *source, struct pcap_rmtauth *auth, pcap_i tmpstring[findalldevs_if.namelen] = 0; /* Create the new device identifier */ - if (pcap_createsrcstr(tmpstring2, PCAP_SRC_IFREMOTE, - host, port, tmpstring, errbuf) == -1) + if (pcap_createsrcstr_ex(tmpstring2, PCAP_SRC_IFREMOTE, + host, port, tmpstring, uses_ssl, errbuf) == -1) goto error; stringlen = strlen(tmpstring2); @@ -1806,8 +1806,8 @@ pcap_parse_source(const char *source, char **schemep, char **userinfop, } int -pcap_createsrcstr(char *source, int type, const char *host, const char *port, - const char *name, char *errbuf) +pcap_createsrcstr_ex(char *source, int type, const char *host, const char *port, + const char *name, unsigned char uses_ssl, char *errbuf) { switch (type) { @@ -1823,7 +1823,9 @@ pcap_createsrcstr(char *source, int type, const char *host, const char *port, } case PCAP_SRC_IFREMOTE: - pcap_strlcpy(source, PCAP_SRC_IF_STRING, PCAP_BUF_SIZE); + pcap_strlcpy(source, + (uses_ssl ? "rpcaps://" : PCAP_SRC_IF_STRING), + PCAP_BUF_SIZE); if (host != NULL && *host != '\0') { if (strchr(host, ':') != NULL) { /* @@ -1869,6 +1871,14 @@ pcap_createsrcstr(char *source, int type, const char *host, const char *port, } } + +int +pcap_createsrcstr(char *source, int type, const char *host, const char *port, + const char *name, char *errbuf) +{ + return (pcap_createsrcstr_ex(source, type, host, port, name, 0, errbuf)); +} + int pcap_parsesrcstr_ex(const char *source, int *type, char *host, char *port, char *name, unsigned char *uses_ssl, char *errbuf) |