summaryrefslogtreecommitdiff
path: root/ui/capture_ui_utils.c
AgeCommit message (Collapse)AuthorFilesLines
2017-06-05Allow bigger snapshot lengths for D-Bus captures.Guy Harris1-2/+2
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for them, because that's the largest possible D-Bus message size. See https://bugs.freedesktop.org/show_bug.cgi?id=100220 for an example of the problems caused by limiting the snapshot length to 256KB for D-Bus. Have a snapshot length of 0 in a capture_file structure mean "there is no snapshot length for the file"; we don't need the has_snap field in that case, a value of 0 mean "no, we don't have a snapshot length". In dumpcap, start out with a pipe buffer size of 2KB, and grow it as necessary. When checking for a too-big packet from a pipe, check against the appropriate maximum - 128MB for DLT_DBUS, 256KB for everything else. Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20 Reviewed-on: https://code.wireshark.org/review/21952 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-02Qt: Use uniform interface display nameStig Bjørlykke1-0/+42
Use common function to generate the interface display name, both when scanning for interfaces (scan_local_interfaces()) and when changing Comment in the Manage Interfaces dialog. Change-Id: I3260208856563aaf387ce397d4ae61bddcc89b4f Reviewed-on: https://code.wireshark.org/review/12362 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-04-05Have a common routine for constructing strings listing interfaces.Guy Harris1-0/+50
We have a bunch of duplicated code to make those lists; make a common routine for that. (dumpcap currently doesn't use it, as the routine in question uses a routine in libui, which dumpcap doesn't use. We should probably fix that.) Change-Id: I9058bf3320d420b8713e90743618972da1d1c6ed Reviewed-on: https://code.wireshark.org/review/7934 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-04Let capture_dev_user_pmode_find() say "not found".Guy Harris1-2/+10
"Not found" is different from "found, and false". Have it return a boolean "did I find the property" indication and, if it did, supply the property value through a pointer. Change-Id: Iaa942ea346410b35e512ff1a3821cbf60c88dfd6 Reviewed-on: https://code.wireshark.org/review/7916 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-25Have a #define for whether the capture buffer size can be set.Guy Harris1-1/+1
It can be set if either 1) this is Windows (where we're assumed to be using WinPcap, which includes calls to set the buffer size) or 2) we have pcap_create() (in which case we also have pcap_set_buffer_size(), at least in a normal libpcap release). Use that rather than testing "defined(_WIN32) || defined(HAVE_PCAP_CREATE)"; that makes it a bit more obvious what's being tested. Change-Id: Id9f8455019d19206b04dd6820a748cb97ae5ad12 Reviewed-on: https://code.wireshark.org/review/7816 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-23Centralize the code to set the active_dlt value for a device.Guy Harris1-0/+51
We were doing it similarly, but not the same, in several places; make a common routine for it. Have that code check to make sure the DLT_ value in question is actually supported by the device; if not, pick the first supported DLT_ value, if any; this keeps it from, for example, picking a bad DLT_ value if your defaults were set based on monitor mode being on but monitor mode actually being off, or vice versa. Change-Id: I1722bfeaf60429bc5c6f665fdea3d466052b13bd Reviewed-on: https://code.wireshark.org/review/7795 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-19Try to fix interface property fetching.Gerald Combs1-11/+6
Use g_strdup instead of calculating string lengths manually. Return NULL for empty strings, otherwise lo0 shows up as ": lo0" instead of "Loopback: lo0" here. Change-Id: I143aa5e12c9512b7a9f4729b62b353c13ee3635a Reviewed-on: https://code.wireshark.org/review/7764 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-19Squelch a "no implicit conversions in C++" warning.Guy Harris1-1/+1
Change-Id: Ib2876e055e8bfb1d0de36bbf7bb3b1e52217f108 Reviewed-on: https://code.wireshark.org/review/7748 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-19Fix extracting of parameter.Guy Harris1-9/+9
We have to find the closing parenthesis before overwriting the opening parenthesis, otherwise the end of the string, from which strrchr() searches, is at the point where the opening parenthesis was. Fix incorrect arithmetic (-1 + -1 + 1 = -1, not 1). Change-Id: Ida47dd9670b36269eef28368aa845301a7185c3f Reviewed-on: https://code.wireshark.org/review/7747 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-19Fix a comment.Guy Harris1-1/+1
Change-Id: I6e85f4abdc41ac01296b276f6b394376e75abe47 Reviewed-on: https://code.wireshark.org/review/7746 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-19Patch some memory leaks.Guy Harris1-44/+44
capture_dev_user_descr_find() and capture_dev_user_cfilter_find() return g_malloc()ated strings; we don't need to g_strdup() them to get a g_malloc()ated string, and we *do* need to free them if we aren't going to use them any more. Document that while we're at it, and give more details for the functions returning integer user-specified interface parameters as well. Change-Id: Icf98a48992b1c4168ead54bdc4cc2847da89d665 Reviewed-on: https://code.wireshark.org/review/7745 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-18Fix space before tab.Guy Harris1-1/+1
Change-Id: I8e9de014bd1e69102edb0eb2ec65d8da12ab8311 Reviewed-on: https://code.wireshark.org/review/7742 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-18Fix parsing of interface properties strings.Guy Harris1-150/+152
The first entry in the list does not have a leading comma, so a strstr() for ",{ifname}(" will not work. Instead, use g_strsplit() with a comma for all of the preferences. Have common code for all the "uncomplicated" preferences. Have a specialized handler for the one "complicated" preference. Change-Id: I2144a98ab0cb70db56eaaba88175d6e03885de2a Reviewed-on: https://code.wireshark.org/review/7741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17isdigit -> g_ascii_isdigit to make the build work.AndersBroman1-1/+1
Change-Id: I670b7b83976a9db9491e017015d570a4dc8f433d Reviewed-on: https://code.wireshark.org/review/4771 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-10-17Remove unnecessary includes of <ctype.h>.Guy Harris1-1/+0
Change-Id: I8eacec5fa8d57b10d40a3627197461dae89c6cb2 Reviewed-on: https://code.wireshark.org/review/4768 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-12Add editor modelines; Adjust whitespace as needed.Bill Meier1-0/+13
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad Reviewed-on: https://code.wireshark.org/review/4626 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-29Qt: Rework the "Manage Interfaces" dialog.Gerald Combs1-48/+22
Convert QTableWidget to QTreeWidget. It looks like the GTK+ version has a separate set of apply/save buttons for each tab which *only* operates on that tab. This can result unexpected behavior which throws away changes if the user updates more than one tab. Use a single "OK" button that applies all of our changes instead. Reorder the tabs. Put Local Interfaces first and select it by default. Always show Remote Interfaces. Disable it on platforms that don't have PCAP_REMOTE. Automatically start editing when we add a new pipe. Don't immediately update pipe interface settings. Wait until we hit "OK" instead. Rename NewFileDelegate to PathChooserDelegate. Note that we might want to move it use it elsewhere in the application. Try switching the user-facing terminology from "Hide" to the more positive "Show". Tell the user that we don't save pipe or remote interface settings. Add a help URL for the "Manage Interfaces" dialog box. Use the GLib and Qt string functions and classes to split and join comma-separated preferences. This makes sure capture_dev_user_descr_find doesn't skip over the first interface. It also keeps the Qt code from adding a leading comma to our capture preferences. Add a note about strings to README.qt. Summary: Use QStrings. For another day: - If we *do* save remote settings we need to store credentials securely, e.g. with CryptProtectData. - Get rid of the remote settings dialogs. Their controls should fit in the remote settings tab. - Add an extcap tab. - We need getter/setter functions for global_capture_opts.all_ifaces. We iterate over it *way* too much. Change-Id: Ib7b61972f3ece4325e0230f725e7f2678acbb24b Reviewed-on: https://code.wireshark.org/review/3873 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-07-04Move utility routines for capturing into a libcaputils static library.Guy Harris1-1/+1
Some of those routines are used only in dumpcap; others are used in TShark and Wireshark as well. Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7 Reviewed-on: https://code.wireshark.org/review/2841 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-02Manage InterfacesIrene Ruengeler1-2/+7
- Add dialog to manage interfaces - Add and delete pipes - Hide local interfaces Change-Id: I08323c306c2ea736f99e57c28e2fe3170a0c2216 Reviewed-on: https://code.wireshark.org/review/2613 Tested-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Tüxen <tuexen@wireshark.org>
2014-06-30Get rid of another unused routine.Guy Harris1-20/+0
Change-Id: I58943faaf6e77023ab1fb7bd7a22324a713659da Reviewed-on: https://code.wireshark.org/review/2714 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30Get rid of unused routine.Guy Harris1-33/+0
Change-Id: Iaf12ba7f13804a6d351ea85c0daa52d4489e8c57 Reviewed-on: https://code.wireshark.org/review/2713 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30Make a routine unused outside capture_ui_utils.c static.Guy Harris1-1/+1
Change-Id: I63f1e5fb119a44edf4ee489683e79cb39a746c08 Reviewed-on: https://code.wireshark.org/review/2710 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30Move capture_ui_utils.[ch] to libui.Guy Harris1-0/+571
Change-Id: Id0f3d4d60a1acc7aa64fd3737b8f16df5bca4e5a Reviewed-on: https://code.wireshark.org/review/2708 Reviewed-by: Guy Harris <guy@alum.mit.edu>