Wireshark-dev: Re: [Wireshark-dev] Issues in synphasor dissector
From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Mon, 6 Jul 2020 23:50:50 +0200
Hi,

So, you want to keep this function call:

proto_tree_add_item(wgs84_tree, hf_conf_pmu_lat, tvb, offset, 4, ENC_BIG_ENDIAN);

with this header field definition:

{ &hf_conf_pmu_lat, { "PMU Latitude", "synphasor.conf.pmu_latitude", FT_FLOAT,
    BASE_NONE | BASE_UNIT_STRING, &units_degree_degrees, 0x0, NULL, HFILL }}

but have it output "Unspecified Location" in case the value is +/- infinity.

Unfortunately the use of BASE_CUSTOM is not available for FT_FLOAT, so I see no other way than this:

if (isinf(pmu_lat)) {
    proto_tree_add_float_format_value(wgs84_tree, hf_conf_pmu_lat_unknown, tvb, offset, 4, INFINITY, unspecified_location);
} else {
    proto_tree_add_item(wgs84_tree, hf_conf_pmu_lat, tvb, offset, 4, ENC_BIG_ENDIAN);
}

and these header field definitions:

{ &hf_conf_pmu_lat_unknown, { "PMU Latitude", "synphasor.conf.pmu_latitude", FT_FLOAT,
    BASE_NONE, NULL, 0x0, NULL, HFILL }}
{ &hf_conf_pmu_lat, { "PMU Latitude", "synphasor.conf.pmu_latitude", FT_FLOAT,
    BASE_NONE | BASE_UNIT_STRING, &units_degree_degrees, 0x0, NULL, HFILL }}

Now at least the field abbrev "synphasor.conf.pmu_latitude" has a constant type FT_FLOAT.

I hope I got this right.
Jaap


On 7/6/20 10:12 PM, Елисеев Дмитрий Алексеевич wrote:
Hello, Jaap Keuter!
I made some fast cheks and need some help.
I need some function like:
proto_tree_add_item(wgs84_tree, hf_conf_pmu_lat, tvb, offset, 4, ENC_BIG_ENDIAN);
{ &hf_conf_pmu_lat, { "PMU Latitude", "synphasor.conf.pmu_latitude", FT_FLOAT,
          BASE_NONE | BASE_UNIT_STRING, &units_degree_degrees, 0x0, NULL, HFILL }}

witch replace Infinity with text: "Unspecified Location"

С уважением

Дмитрий Елисеев
инженер
сектора испытаний систем управления и автоматики
АО «НТЦ ЕЭС»
т: 29-29-499 доб. 214
a: ул. Курчатова, д. 1, лит.А , Санкт-Петербург, Россия, 194223
e: eliseev@xxxxxxxxx



От: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Кому: Dmitriy Eliseev <eliseev_d@xxxxxxxxx>, Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Отправлено: 06.07.2020 19:10
Тема: Issues in synphasor dissector

Hi Dmitriy,

There are still some issues with the synphasor dissector. There are a number of fields with the same field abbreviation, but incompatible type.
These are lines from the 'conflict check' run by the buildbot:

'synphasor.conf.chnam_len' exists multiple times with NOT compatible types: FT_STRING and FT_UINT8
'synphasor.conf.phasor_flags' exists multiple times with NOT compatible types: FT_UINT16 and FT_BOOLEAN
'synphasor.conf.pmu_latitude' exists multiple times with NOT compatible types: FT_STRING and FT_FLOAT
'synphasor.conf.pmu_longitude' exists multiple times with NOT compatible types: FT_STRING and FT_FLOAT
'synphasor.conf.pmu_elevation' exists multiple times with NOT compatible types: FT_STRING and FT_FLOAT

https://buildbot.wireshark.org/petri-dish/builders/Ubuntu%20Petri%20Dish%20x64/builds/12010/steps/conflict%20check/logs/stdio

You seem to be knowledgeable about this protocol and dissector. Would you be able to address these reported issues?

Thanks,
Jaap