diff options
author | Tomas Kukosa <tomas.kukosa@siemens.com> | 2007-12-04 11:19:29 +0000 |
---|---|---|
committer | Tomas Kukosa <tomas.kukosa@siemens.com> | 2007-12-04 11:19:29 +0000 |
commit | 08bbd29c71b8068e419f95a7a8cb7332ef0a3a3d (patch) | |
tree | f0bdb59e0947e9cfeac882b6b58a4753af6511be /capture-pcap-util-unix.c | |
parent | 48537a7a6505e68faadbed9837a4159c2758d442 (diff) |
Support for RPCAP features in GUI (from Boris Misenov, see Bug 1366)
- retrieving the list of remote PCAP interfaces
- password authentication support
- UDP data fransfer
- packet sampling (available in WinPcap 4.x)
etc.
fix problem if non-default rpcap port is used
svn path=/trunk/; revision=23750
Diffstat (limited to 'capture-pcap-util-unix.c')
-rw-r--r-- | capture-pcap-util-unix.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/capture-pcap-util-unix.c b/capture-pcap-util-unix.c index ea8968b7d0..d707cc695a 100644 --- a/capture-pcap-util-unix.c +++ b/capture-pcap-util-unix.c @@ -73,11 +73,50 @@ static void search_for_if_cb(gpointer data, gpointer user_data); #endif +#ifdef HAVE_PCAP_REMOTE +GList * +get_remote_interface_list(const char *hostname, const char *port, + int auth_type, const char *username, + const char *passwd, int *err, char **err_str) +{ + struct pcap_rmtauth auth; + char source[PCAP_BUF_SIZE]; + char errbuf[PCAP_ERRBUF_SIZE]; + + auth.type = auth_type; + auth.username = username; + auth.password = passwd; + + if (pcap_createsrcstr(source, PCAP_SRC_IFREMOTE, hostname, port, + NULL, errbuf) == -1) { + *err = CANT_GET_INTERFACE_LIST; + if (err_str != NULL) + *err_str = cant_get_if_list_error_message(errbuf); + return NULL; + } + return get_interface_list_findalldevs_ex(source, &auth, err, err_str); +} +#endif + GList * get_interface_list(int *err, char **err_str) { #ifdef HAVE_PCAP_FINDALLDEVS +#ifdef HAVE_PCAP_REMOTE + char source[PCAP_BUF_SIZE]; + char errbuf[PCAP_ERRBUF_SIZE]; + + if (pcap_createsrcstr(source, PCAP_SRC_IFLOCAL, + NULL, NULL, NULL, errbuf) == -1) { + *err = CANT_GET_INTERFACE_LIST; + if (err_str != NULL) + *err_str = cant_get_if_list_error_message(errbuf); + return NULL; + } + return get_interface_list_findalldevs_ex(source, NULL, err, err_str); +#else return get_interface_list_findalldevs(err, err_str); +#endif #else GList *il = NULL; gint nonloopback_pos = 0; |