Commit Graph

36 Commits

Author SHA1 Message Date
Guy Harris 319891ade3 Put the code to convert a GUID string to a GUID structure into a routine
of its own.  Export that routine from capture_win_ifnames.c.

Rename GetInterfaceFriendlyNameFromDeviceGuid() to
get_interface_friendly_name_from_device_guid(), to match the style of
names of the other routines exported from capture_win_ifnames.c, and
export it as well.

Have if_info_new() use those routines, and, if parse_as_guid() fails,
treat the "description" as a friendly name rather than a vendor
description, so that we don't have a vendor description for, for
example, the device offered on some versions of Windows to handle
dial-up devices.

svn path=/trunk/; revision=46170
2012-11-24 18:55:06 +00:00
Guy Harris 5290b60ab3 Rename get_windows_interface_friendlyname() to
get_windows_interface_friendly_name(), and have it return the friendly
name on success and NULL on failure.

Get rid of the logging in get_windows_interface_friendly_name().

svn path=/trunk/; revision=46161
2012-11-24 00:05:32 +00:00
Guy Harris 7ed474bc27 Hoist all the friendly-name/vendor-description stuff up into
if_info_new().

svn path=/trunk/; revision=46159
2012-11-23 22:28:06 +00:00
Guy Harris c8fc50e817 It's get_windows_interface_friendlyname(), not
get_windows_interface_friendly_name().

svn path=/trunk/; revision=46138
2012-11-22 08:08:52 +00:00
Guy Harris bd976ae6c0 On UN*X, if an interface has a description, use it as the "friendly
name".  If it doesn't have a description, on OS X, use the System
Configuration framework to attempt to get a "friendly name" for
interfaces.

If a loopback device doesn't have a friendly name, give it "Loopback" as
the friendly name.

Move the "turn a CFString into a mallocated C string" routine into
common code, as it's used in more than one place.

svn path=/trunk/; revision=46131
2012-11-22 06:02:49 +00:00
Anders Broman 28474fe8ef From Mike Garratt:
Friendly Names for interfaces on Windows

Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
  + Win32: "dumpcap -D" shows friendly_name in place of descript if known
  + All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
  + When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name). 
  + console_display_name is used as the basis of the autogenerated temp
filenames
  + console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
  + Can now specify the interface using its name and friendly_name
  + Interface name matching is case insenstive
  + Name matching first attempts exact matching, then falls back to prefix
matching
    (e.g. dumpcap -i local)
  + Validates interface names, instead of blindly sending them off to
winpcap/libpcap
  + Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
  + Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
  + Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name.  Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
  + void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
  + Now uses wireshark_pcapng_* or  wireshark_pcap_* depending on file format
  + Basis temp filename format on console_display_name
  + Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing) 

GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
  + "Friendly Name" renamed to "NDIS Friendly Name"
  + Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
  + The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
    Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces. 
  + Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"

svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris d2a72bbc87 Cast away warnings about "struct sockaddr" -> "struct sockaddr_XXX"
casts that are actually safe.

svn path=/trunk/; revision=36861
2011-04-26 02:47:52 +00:00
Guy Harris 1bf60839c9 Move get_pcap_linktype() into dumpcap - it's not used elsewhere.
svn path=/trunk/; revision=32853
2010-05-18 02:36:02 +00:00
Guy Harris 9307251bb8 Um, no, the problem with the Leopard x86 build is that we first do a
build without libpcap, to make sure that works, and then do a build with
libpcap, to put into a binary release.  It's the former that's failing;
I'll back out the previous change and then work on that.

svn path=/trunk/; revision=32801
2010-05-14 00:49:28 +00:00
Guy Harris 0e54136213 See whether the Leopard x86 buildbot is upset because of the name
if_capabilities_t - it doesn't fail on Snow Leopard, even if I undefine
HAVE_PCAP_CREATE, and doesn't fail on the Leopard PPC buildbot, either.

svn path=/trunk/; revision=32799
2010-05-14 00:10:15 +00:00
Guy Harris 1c18115bd3 Fetch an indication of whether the interface supports capturing in
monitor mode at the same time that we fetch its list of link-layer
types.  Support fetching that list in monitor mode, as the list may be
different in regular and monitor mode.  If the interface supports
monitor mode, when printing the list of link-layer types, indicate
whether they're fetched in monitor mode or not, as tcpdump 4.1.x does.

svn path=/trunk/; revision=32789
2010-05-13 17:37:39 +00:00
Guy Harris cc05b9250d For TShark and Wireshark, get the list of link-layer types for an
interface by running dumpcap, so that if you need privileges to open an
interface, and dumpcap has those privileges, neither TShark nor
Wireshark need them.

svn path=/trunk/; revision=32710
2010-05-07 08:06:25 +00:00
Guy Harris f05fb51aba Squelch some compiler warnings.
svn path=/trunk/; revision=32111
2010-03-04 09:37:05 +00:00
Guy Harris 167ab3a98c In Wireshark and TShark, run dumpcap to get interface lists and lists of
link-layer header types for interfaces; if special privileges are
necessary to open capture devices, Wireshark and TShark shouldn't have
those privileges, but dumpcap should.

svn path=/trunk/; revision=32104
2010-03-04 01:12:04 +00:00
Guy Harris 3b845dcce0 Move a routine into dumpcap - it's not used outside dumpcap.
svn path=/trunk/; revision=32042
2010-02-27 23:32:08 +00:00
Bill Meier 77310e2bb0 Hack toprevent checkAPIs complaining about use of 'free'
svn path=/trunk/; revision=27745
2009-03-16 19:34:02 +00:00
Stig Bjørlykke 0258be0b05 From Jakub Zawadzki:
More remove checking for NULL before g_free().

svn path=/trunk/; revision=27728
2009-03-15 18:08:46 +00:00
Guy Harris 44f8cae6ab If we don't have any of the pcap_datalink_XXX_to_YYY routines,
substitute our own (I wrote them all, so I can steal them from the
BSD-licensed libpcap if I want :-)).  This means that
linktype_name_to_val() and linktype_val_to_name() are always available,
and we don't need to #ifdef use of them.

Use pcap_datalink_val_to_description() to get the description for a
particular DLT_ value, rather than mapping the DLT_ value to a
WTAP_ENCAP_ value and getting the description for the latter.

svn path=/trunk/; revision=27074
2008-12-21 23:22:12 +00:00
Stig Bjørlykke 1655ca17d0 Do not use functions for remote capture on local interfaces.
This makes it possible to compile with remote capture features on unix.

svn path=/trunk/; revision=26681
2008-11-03 20:04:01 +00:00
Bill Meier e1a5e58ac1 Fix benign usage of incorrect symbol in #ifdef
svn path=/trunk/; revision=25669
2008-07-04 12:52:16 +00:00
Guy Harris e82d99d2b4 If we have pcap_free_datalinks(), use it. If not, then, on Windows,
just leak the list returned by pcap_list_datalinks(), as there's no
guarantee that if you have a library built with one version of the
MSVC++ run-time library, and it returns a pointer to allocated data, you
can free that data from a program linked with another version of the
MSVC++ run-time library.  (This is not an issue on UN*X.)

This should fix bug 2677.

svn path=/trunk/; revision=25668
2008-07-04 03:33:00 +00:00
Guy Harris b7c2ead26a Constify some arguments.
svn path=/trunk/; revision=24407
2008-02-21 12:30:26 +00:00
Tomas Kukosa 08bbd29c71 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
2007-12-04 11:19:29 +00:00
Ulf Lamping 99d60cce59 first steps to support MSVC 2008 Express Edition
svn path=/trunk/; revision=23691
2007-11-30 22:01:05 +00:00
Gerald Combs 34e8aec5b0 Include libpcap.h so that we can use wtap_pcap_encap_to_wtap_encap()
in its new location.

svn path=/trunk/; revision=22604
2007-08-23 17:49:47 +00:00
Sebastien Tandel 2371ad2eb0 fix gcc warning about qualifier types (const) which are discarded when arriving
at the pcap interface.

svn path=/trunk/; revision=21417
2007-04-13 20:59:20 +00:00
Guy Harris cc22748169 Have the routines to get interface lists take a pointer to a "gchar *"
as an argument, and, on an error, if they have an error message, have
them set that "gchar *" to point to a g_malloc()ed string containing the
error message, rather than taking a pointer to a buffer for that message
as an argument.  That's more like what's done in Wiretap, and doesn't
impose an upper limit on the lengths of those error messages.  If that
pointer is null, don't allocate the message string and return it.

Have that error message already have the "cant_get" processing applied
to it, so nobody other than those routines need to call the "cant_get"
routines to process the error messages.

Have get_airpcap_interface_list() explicitly set "*err" to the
appropriate error code.

Clean up indentation.

svn path=/trunk/; revision=20521
2007-01-21 23:45:36 +00:00
Jörg Mayer 23ce819952 Frederic Heem:
Fix some memleaks and overflows.

I haven't committed the changes that are not bug fixes.

svn path=/trunk/; revision=19777
2006-11-02 09:45:12 +00:00
Anders Broman f68d6e4c8c Ethereal->Wireshark
svn path=/trunk/; revision=18235
2006-05-28 20:28:20 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Ulf Lamping f5661a9970 an error return was missing a pcap_close() call
svn path=/trunk/; revision=17404
2006-02-25 00:02:26 +00:00
Ulf Lamping 79053183c5 remove dependencies to pcap.h, so getting an idea what needs to be done by dumpcap in addition to the things already done now
various dumpcap related code cleanup: mainly #include's and capture engine related stuff

svn path=/trunk/; revision=17327
2006-02-17 02:18:48 +00:00
Guy Harris eaee2b68c5 Constify a bunch of arguments and variables, to squelch compiler
warnings.

Include "wiretap/libpcap.h" in "capture_loop.h", to get its declarations
of data structures for headers in libpcap files.  This lets us remove
the includes of "wiretap/libpcap.h from files including
"capture_loop.h".

Make "log_func_ignore()" in "tethereal.c" static, and declare some of
its arguments unused.  Also get rid of an unused variable.

Include <pcap.h> before including "wiretap/wtap-capture.h", to declare
"struct pcap_pkthdr".

svn path=/trunk/; revision=16791
2005-12-14 07:29:38 +00:00
Ulf Lamping 7e3a24418c rename pcap-....c/.h files to capture-pcap-....c/.h
this way, the capture prefix will "logically" group the files together and file browsers will also group them

we may want to move the files into a subdir capture later

svn path=/trunk/; revision=16691
2005-12-06 00:07:13 +00:00