Commit Graph

20 Commits

Author SHA1 Message Date
João Valverde 5e6d45ca98 Make address_to_display() use proper (non-)constness
Don't return allocated memory as a const pointer.

Fixes multiple [-Wcast-qual] warnings.

Change-Id: Ie9ceac27fa2a5eba41a5392ac983ff28c3939239
Reviewed-on: https://code.wireshark.org/review/12267
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-29 00:25:11 +00:00
João Valverde 3df2333155 Remaining ADDRESS macro to address function conversions
Change-Id: I8bc9af431e70243b05f4f0ce8c2b8ee451383788
Reviewed-on: https://code.wireshark.org/review/11463
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-03 12:20:34 +00:00
João Valverde 26ebfef4bb Don't display duplicate addresses without name resolution enabled
Change-Id: Ieb88e2632401cbf50c4ae51768a64df64d54a45d
Reviewed-on: https://code.wireshark.org/review/10497
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-25 21:12:01 +00:00
Guy Harris df5a315048 Fix address resolution for columns.
Have address_to_name() be a routine that takes an address and returns a
string with a "sufficiently long" lifetime for use in columns, using the
address type's addr_name_res_str routine for most address types, rather
than having a too-small set of address types wired into it.  It replaces
both the internal solve_address_to_name() routine and get_addr_name(),
and can, for example, handle the special WLAN address types rather than
leaving them unresolved even with an ethers file.

Change-Id: Id09bc412adf5d2752155650a14a77c5378af2e42
Reviewed-on: https://code.wireshark.org/review/9475
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-03 02:21:20 +00:00
Alexis La Goutte d2720ecca7 Address types: fix no previous prototype for ... [-Wmissing-prototypes]
address_types.c:230:14: warning: no previous prototype for 'ipv4_name_res_str' [-Wmissing-prototypes]
address_types.c:237:5: warning: no previous prototype for 'ipv4_name_res_len' [-Wmissing-prototypes]
address_types.c:386:14: warning: no previous prototype for 'ipv6_name_res_str' [-Wmissing-prototypes]
address_types.c:393:5: warning: no previous prototype for 'ipv6_name_res_len' [-Wmissing-prototypes]
address_types.c:509:14: warning: no previous prototype for 'fcwwn_name_res_str' [-Wmissing-prototypes]
address_types.c:538:5: warning: no previous prototype for 'fcwwn_name_res_len' [-Wmissing-prototypes]

Change-Id: I6cf44b887d9e35fb76bd1840444074c9102b4d2b
Reviewed-on: https://code.wireshark.org/review/7508
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-03 15:36:23 +00:00
Guy Harris 3108bf8d2e Fix typo caught by Coverity - wrong structure members being tested.
CID 1271732

Change-Id: I12b610a0a28fcc790ffb041ca88624e014f68ab5
Reviewed-on: https://code.wireshark.org/review/7465
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-02 03:00:14 +00:00
Guy Harris 9ac60ff0df address_to_string routines need to remember the beginning of the buffer.
Either they don't have a pointer into the buffer that they advance, in
which case strlen(buf)+1 works just fine, or they do, in which case

	1) they'd better save the pointer to the beginning of the
	   buffer, so they can figure out how long the string is when
	   they're done

and

	2) they don't need to use strlen(), they can just subtract the
	   pointers.

Bug: 11016
Change-Id: I81ce9d517336a15bd81f0c6225756ce5178ec6cf
Reviewed-on: https://code.wireshark.org/review/7424
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-27 04:16:57 +00:00
Guy Harris 6765bf722a Fix generation of address-with-resolution strings.
XXX_to_str routines should return the length, in bytes, of the generated
string, including the terminating '\0'.

As their reutrn values include the terminating '\0', we need to subtract
1 from the return value if, when appending the ")" after the address
string, we want to skip past the address string rather than skipping
past the terminating '\0'.

Change-Id: Ibfd41e6d7152d05070706e6d76fc3e56a097a75b
Reviewed-on: https://code.wireshark.org/review/7324
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-23 02:51:17 +00:00
Michael Mann 8d5da72ff9 Add tvb_address_with_resolution_to_str.
Convert dissectors to using the API where appropriate.

Change-Id: I059582f73a75635d4a0338d02d4c4b212162480b
Reviewed-on: https://code.wireshark.org/review/7296
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-22 02:53:48 +00:00
Pascal Quantin a99cc2fd0b address_types.c: fix a "conditional jump or move depends on uninitialised value" error found by Valgrind
Change-Id: Ic752bb6aa1ba56e113895fcbed52f417ac0128f7
Reviewed-on: https://code.wireshark.org/review/7272
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-02-20 11:37:52 +00:00
AndersBroman ca68a7adc3 Add some casts to satisfy the various compilers.
Change-Id: I7687fc0b433774fe447757af00bdaa2fc44ac59d
Reviewed-on: https://code.wireshark.org/review/7254
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-19 14:23:03 +00:00
Michael Mann 8d16ac46d5 Add name resolution support to address type.
Add address_with_resolution_to_str API that returns address string + name resolution in the format %s (%s), first string is resolved name (if available) and second string is raw address string.

Convert AT_FCWWN to using proper name resolution format

First use of address_with_resolution_to_str with field types in proto.c

Change-Id: I2ae77c29a4ffc30bb919fbec00f06629830898c2
Reviewed-on: https://code.wireshark.org/review/7196
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-19 13:09:41 +00:00
Michael Mann b2c81bb9e8 Make get_manuf_name return a const string.
Model get_manuf_name after get_ether_name so that a string (either name resolved or colon-separated bytes) is always stored in a hash table.  This will make name resolution of addresses perform a little better because it doesn't have to worry about the wmem_allocator.

Change-Id: If976fe7b0c3f9cd053225096c2ac05418f061af6
Reviewed-on: https://code.wireshark.org/review/7081
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-16 12:47:02 +00:00
Bill Meier 9c866ff971 Replace tabs by spaces when editor modelines has "expandtab"
Change-Id: If7a6f2697be732ae4f94ed8b845fd293c32510f7
Also: tabs-stops should be 8
Reviewed-on: https://code.wireshark.org/review/7100
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-13 17:34:53 +00:00
Anders Broman 53228c4bd8 Revert "Make get_manuf_name return a const string."
This reverts commit 797ea88aef.

Change-Id: I9bc2cef0051d88c6374c6f1868b0250cba3edbd4
Reviewed-on: https://code.wireshark.org/review/7076
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-12 08:34:05 +00:00
Michael Mann 797ea88aef Make get_manuf_name return a const string.
Model get_manuf_name after get_ether_name so that a string (either name resolved or colon-separated bytes) is always stored in a hash table.  This will make name resolution of addresses perform a little better because it doesn't have to work about the wmem_allocator.

Change-Id: I80f465ae0845290255a659ab63310ac3cc35506e
Reviewed-on: https://code.wireshark.org/review/7075
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-12 07:36:20 +00:00
Michael Mann 8ff944d4ab Add fixed length function for address types.
This allows for even more cleanup with respect to how address types are handled, including removing address_to_str.c.  Most of the functionality was folded into address_types.c, but the remainder was just dispersed because it didn't make sense to keep the file.

Change-Id: Id4e9391f0c3c26eff8c27b362e4f7a1970d718b4
Reviewed-on: https://code.wireshark.org/review/7038
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 03:49:13 +00:00
Michael Mann 2875cd382f Eliminate the hf member out of the address structure.
Using the new address type registration, dissectors can create their own address types with their own (column) filters attached to them, eliminating the need for an address to keep track of a hf_ field.

Change-Id: I2bbec256a056f403a7ac9880d5d76a0b2a21b221
Ping-Bug: 7728
Reviewed-on: https://code.wireshark.org/review/7037
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 03:48:53 +00:00
Michael Mann 2042385ac9 Add "column filter string" support to address types.
Information about dissector (filter) fields should be kept in a dissector as much as possible. Supporting "column filter string" also allows other dissectors to create their own "address types" with different column filters (because AT_ETHER isn't always an "Ethernet" address).

This feature also allowed a few "dissector specific" address types to be moved to their own dissector.

Change-Id: Ie9024af4db62bc2ee4f8c9d28a1d807f706f45bf
Ping-Bug:7728
Reviewed-on: https://code.wireshark.org/review/7029
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 01:13:28 +00:00
Michael Mann 4497bb48fd Add address type registration.
Now address types are setup just like field types and must be registered with a structure that provides its string representation (and more things in the future).  Address types that are limited to a single dissector are registered by the dissector.  More "common" ones are globally registered.  There are still a few that really belong in a dissector, but have other dependencies currently not accounted for in the address type support.

Many of the "address to string" conversions that involved g_sprintf have be changed to use more "performance friendly" methods (some at the cost of needing to_str-int.h)

Leaving all comments regarding this "solution" in address_to_str.c in until all have been implemented

Change-Id: I494f413e016b22859c44675def11135f228796e0
Reviewed-on: https://code.wireshark.org/review/7019
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09 01:12:01 +00:00