Wireshark-bugs: [Wireshark-bugs] [Bug 8467] New: Need functions to mirror val_to_str

Date: Wed, 13 Mar 2013 12:43:44 +0000
Bug ID 8467
Summary Need functions to mirror val_to_str
Classification Unclassified
Product Wireshark
Version SVN
Hardware All
OS All
Status CONFIRMED
Severity Enhancement
Priority Low
Component Dissection engine (libwireshark)
Assignee [email protected]
Reporter [email protected]
CC [email protected]
Blocks 8461

Build Information:

--
As described in bug #8461, we apparently have need of the opposite of our
current value_string set of functions - we need something to map strings to
integers instead of integers to strings.

The obvious way to do this leads to some naming conflicts though with the
existing match functions.

Proposal:
- rename the match_* functions into try_* functions and use the same x_to_y
format for all names.
- no need for an extra structure type for str_to_val, we can just use
value_string structures still (the order of the fields in the structure is not
important, after all)

So the resulting functions would be (in theory):
val_to_str
val_to_str_const
try_val_to_str
try_val_to_str_idx

str_to_val
str_to_val_const
try_str_to_val
try_str_to_val_idx

str_to_str
str_to_str_const
try_str_to_str
try_str_to_str_idx

rval_to_str
rval_to_str_const
try_rval_to_str
try_rval_to_str_idx

Note that we currently don't implement all of these (even excluding the
str_to_val family).

Also note that this lends itself to potentially adding str_to_rval functions
and val_to_val functions at some point, though I would have a hard time
imagining a dissector that needs either.

Sebastiano, once we have agreed on a solution (be it this one or another one)
I'd like to get buy-in from a few other developers on -dev, then simply do a
search/replace style bulk-rename of the API. We're not changing any function
prototypes or behaviours so it should be safe and avoids some extra messyness
with compatibility wrapper functions.


You are receiving this mail because:
  • You are watching all bug changes.