Wireshark mailing list archives
Re: proto.h extension (unit strings)
From: Michael Mann <mmann78 () netscape net>
Date: Sun, 11 Dec 2016 22:17:11 -0500
I thought this was a good idea, just took a while to get around to it: https://code.wireshark.org/review/19211 -----Original Message----- From: Guy Harris <guy () alum mit edu> To: Developer support list for Wireshark <wireshark-dev () wireshark org> Sent: Fri, May 8, 2015 3:09 pm Subject: Re: [Wireshark-dev] proto.h extension On May 8, 2015, at 7:06 AM, "John Dill" <John.Dill () greenfieldeng com> wrote:
Message: 3 Date: Thu, 7 May 2015 11:29:22 -0700 From: Guy Harris <guy () alum mit edu> To: Developer support list for Wireshark <wireshark-dev () wireshark org> Subject: Re: [Wireshark-dev] proto.h extension Message-ID: <CF2E7490-F023-49C2-8383-6C1A1394B4E7 () alum mit edu> Content-Type: text/plain; charset=iso-8859-1 On May 7, 2015, at 8:13 AM, "John Dill" <John.Dill () greenfieldeng com> wrote:I have a couple of extensions that I created for the Wireshark baselinethat we're using (1.10.x). The diffs to proto.h and proto.c show the code changes to add a couple of features that I've found useful, unit strings and hiding the bits for bitmask header fields.http://codepad.org/KTGdEL1tYou need more than /* Following constants have to be ORed with a base_display_e when dissector * want to control aspects of the display string for a header_field_info */ as a comment there - you need comments explaining what each of those flags actually *does*.Guy, Sorry it wasn't clear. Starting from this snippet... /* * BASE_UNIT_STRING - Append a unit string to the numeric value
That one's reasonable; I've thought of a similar option.
* * When active, Wireshark will append a unit string declared as a * simple 'char *' for the 'strings' to the numeric value.
You might want to, instead, have it be a structure with a pair of strings, so that if the field has the value 1, you
can print the singular rather than the plural, e.g.:
struct unit_names {
char *singular; /* name to use for 1 unit */
char *plural; /* name to use for < 1 or > 1 units */
};
struct unit_names feet {
"foot",
"feet"
};
{
&hf_MFD_State_Data_Slew_Elevation_Ch1,
{
"Slew_Elevation_Ch1",
"ndo.MFD_State_Data.Slew_Elevation_Ch1",
FT_FLOAT,
BASE_NONE | BASE_UNIT_STRING,
&feet,
0x0,
NULL,
HFILL
}
},
(For floating-point numbers, "1 unit" means "*exactly* 1 unit", i.e. an exact floating-point comparison with 1x2^0.)
We could either
1) require that both be non-null
or
2) assume that, if the plural is null, you can pluralize using the standard rules of English.
Does anybody have a preference there?
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Re: proto.h extension (unit strings) Michael Mann (Dec 11)
- Re: proto.h extension (unit strings) Michal Labedzki (Dec 11)
- Re: proto.h extension (unit strings) Guy Harris (Dec 12)
- <Possible follow-ups>
- Re: proto.h extension (unit strings) Michael Mann (Dec 12)
- Re: proto.h extension (unit strings) John Dill (Dec 12)
- Re: proto.h extension (unit strings) Michael Mann (Dec 16)
- Re: proto.h extension (unit strings) Pascal Quantin (Dec 16)
- Re: proto.h extension (unit strings) Michael Mann (Dec 16)
- Re: proto.h extension (unit strings) Pascal Quantin (Dec 16)
- Re: proto.h extension (unit strings) Pascal Quantin (Dec 16)
- Re: proto.h extension (unit strings) Stig Bjørlykke (Dec 16)
- Re: proto.h extension (unit strings) Michal Labedzki (Dec 11)
