From 08bbd29c71b8068e419f95a7a8cb7332ef0a3a3d Mon Sep 17 00:00:00 2001 From: Tomas Kukosa Date: Tue, 4 Dec 2007 11:19:29 +0000 Subject: 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 --- capture-pcap-util-unix.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'capture-pcap-util-unix.c') 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; -- cgit v1.2.3