This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Hello,

I have added new columns along with default columns like Source,Destination,protocol etc in the epan/prefs.c init_prefs() function but they are not at all being reflected at the runtime.

asked 05 Sep '11, 23:44

Terrestrial%20shark's gravatar image

Terrestrial ...
96212829
accept rate: 42%

edited 06 Sep '11, 16:18

helloworld's gravatar image

helloworld
3.1k42041

1

Why are you trying to do this? Can't you just add a custom column?

(06 Sep '11, 13:18) cmaynard ♦♦

@Prashanth, To be clear, @cmaynard is referring to the GUI Preferences (not code).

From your recent posts, it seems like you're trying to hard-code things that are normally read from the preferences file.

(06 Sep '11, 16:25) helloworld

I guess you are trying to get those preferences even after packaging .... I'm not sure which file would reflect those changes ....

(06 Sep '11, 21:46) flashkicker

@flashkicker Yes you are right. What i want ultimately is just to have an installer with the defaults set by me so that whenever i use wireshark i may need no changes for settings.

(06 Sep '11, 21:50) Terrestrial ...

I would strongly suggest that you do this with a global preferences file. The global preferences file is a file named preferences in Wireshark's "global data directory".

On Windows, the "global data directory" is the installation directory that contains the Wireshark executable.

On UN*X:

  • If the WIRESHARK_DATA_DIR environment variable is set and Wireshark/TShark isn't running set-UID or set-GID, it's the directory specified by that environment variable. That would be the case for the Mac OS X binary package, where it's in the Contents/Resources/share subdirectory of the top-level application bundle directory.
  • If the WIRESHARK_DATA_DIR environment variable is not set (or Wireshark/TShark is running set-UID or set-GID, which it probably shouldn't be!), it's the share/wireshark subdirectory of whatever the "top-level" installation directory is; for example, if Wireshark is installed in /usr/local/bin, the "global data directory" would be /usr/local/share/wireshark, the "top-level" installation directory being /usr/local.

If you insist on doing it with code changes, note that cfmt->custom_field is expected to have been allocated by g_malloc(), so you'd have to do cfmt->custom_field = g_strdup("myprotocol.myfield");. You will, however, probably have fewer difficulties and have to ask fewer questions - and will get more sympathy for your questions - if you do this with a global preferences file.

No matter whether you do it with a global preferences file or a code change, whatever you do will be overridden by the columns in the user preferences file, so you'd have to remove your preferences file or edit it with a text editor so that it doesn't set the columns (remove the column.format preference setting).

permanent link

answered 02 Dec '11, 11:04

Guy%20Harris's gravatar image

Guy Harris ♦♦
17.4k335196
accept rate: 19%

Thanks a lot!! Great. Its working well now.

(04 Dec '11, 23:55) Terrestrial ...

The hardcoded preferences are only used when Wireshark does not find a preferences file. So in order for your changes to take effect, you will need to remove your old preferences file before starting up your version of Wireshark.

If you want to have the same preferences on different systems, you can also distribute your preferences between the systems. Personally I have made my wireshark profiles directory a link to a directory in my dropbox account so I have all profiles available on all my systems.

permanent link

answered 07 Sep '11, 00:15

SYN-bit's gravatar image

SYN-bit ♦♦
17.1k957245
accept rate: 20%

where do we find the old preferences file on windows machine?

(07 Sep '11, 04:12) Terrestrial ...

When you open Wireshark and go to "Help -> About Wireshark" you can click on the "Folders" tab and it will show you where the personal and system-wide settings are stored.

Delete all the files in these directories before starting up your version of Wireshark.

(07 Sep '11, 07:26) SYN-bit ♦♦

I hardcoded custom columns and it is running properly in Windows machine but when it comes to ubuntu it is resulting in "Segmentation Fault" error whenever I click on CANCEL of Preferences Dialog box. My code is:

static void
init_prefs(void) {

....

const gchar *col_fmt[] = { "No.",      "%m", "Time",        "%t",
                        "Source",   "%s", "Destination", "%d",
                        "Protocol", "%p", "Length",      "%L",
                        "Info",     "%Cus"};

...

cfmt->custom_field = "myprotocol.myfield";

... }

& crashes WS

(01 Dec '11, 23:33) Terrestrial ...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×158
×40
×39

question asked: 05 Sep '11, 23:44

question was seen: 4,594 times

last updated: 04 Dec '11, 23:56

p​o​w​e​r​e​d by O​S​Q​A