aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/sv
diff options
context:
space:
mode:
authorIsmael PĂ©rez <ismael.perez@omicronenergy.com>2020-10-16 13:44:20 +0200
committerAndersBroman <a.broman58@gmail.com>2020-10-25 14:07:32 +0000
commitb694ad77e4517837474608025c41674383cb35d8 (patch)
tree5092a4e74b8848a3697b5475cf773e881531da22 /epan/dissectors/asn1/sv
parent6e35d38c2dc54b68cd862afb4e645aad039a0ee9 (diff)
sv dissector: dissect optional field "gmIdentity"
The information regarding the VendorID in gmIdentity is also decoded.
Diffstat (limited to 'epan/dissectors/asn1/sv')
-rw-r--r--epan/dissectors/asn1/sv/packet-sv-template.c13
-rw-r--r--epan/dissectors/asn1/sv/sv.asn2
-rw-r--r--epan/dissectors/asn1/sv/sv.cnf32
3 files changed, 47 insertions, 0 deletions
diff --git a/epan/dissectors/asn1/sv/packet-sv-template.c b/epan/dissectors/asn1/sv/packet-sv-template.c
index 2eccb3cd45..76e1494691 100644
--- a/epan/dissectors/asn1/sv/packet-sv-template.c
+++ b/epan/dissectors/asn1/sv/packet-sv-template.c
@@ -16,6 +16,7 @@
#include <epan/etypes.h>
#include <epan/expert.h>
#include <epan/prefs.h>
+#include <epan/addr_resolv.h>
#include "packet-ber.h"
#include "packet-acse.h"
@@ -81,6 +82,8 @@ static int hf_sv_phsmeas_q_source = -1;
static int hf_sv_phsmeas_q_test = -1;
static int hf_sv_phsmeas_q_operatorblocked = -1;
static int hf_sv_phsmeas_q_derived = -1;
+static int hf_sv_gmidentity = -1;
+static int hf_sv_gmidentity_manuf = -1;
#include "packet-sv-hf.c"
@@ -88,11 +91,13 @@ static int hf_sv_phsmeas_q_derived = -1;
static int ett_sv = -1;
static int ett_phsmeas = -1;
static int ett_phsmeas_q = -1;
+static int ett_gmidentity = -1;
#include "packet-sv-ett.c"
static expert_field ei_sv_mal_utctime = EI_INIT;
static expert_field ei_sv_zero_pdu = EI_INIT;
+static expert_field ei_sv_mal_gmidentity = EI_INIT;
static gboolean sv_decode_data_as_phsmeas = FALSE;
@@ -283,6 +288,12 @@ void proto_register_sv(void) {
{ &hf_sv_phsmeas_q_derived,
{ "derived", "sv.meas_quality.derived", FT_BOOLEAN, 32, NULL, Q_DERIVED, NULL, HFILL}},
+ { &hf_sv_gmidentity,
+ { "gmIdentity", "sv.gmidentity", FT_UINT64, BASE_HEX, NULL, 0x00, NULL, HFILL}},
+
+ { &hf_sv_gmidentity_manuf,
+ { "MAC Vendor", "sv.gmidentity_manuf", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL}},
+
#include "packet-sv-hfarr.c"
};
@@ -292,12 +303,14 @@ void proto_register_sv(void) {
&ett_sv,
&ett_phsmeas,
&ett_phsmeas_q,
+ &ett_gmidentity,
#include "packet-sv-ettarr.c"
};
static ei_register_info ei[] = {
{ &ei_sv_mal_utctime, { "sv.malformed.utctime", PI_MALFORMED, PI_WARN, "BER Error: malformed UTCTime encoding", EXPFILL }},
{ &ei_sv_zero_pdu, { "sv.zero_pdu", PI_PROTOCOL, PI_ERROR, "Internal error, zero-byte SV PDU", EXPFILL }},
+ { &ei_sv_mal_gmidentity, { "sv.malformed.gmidentity", PI_MALFORMED, PI_WARN, "BER Error: malformed gmIdentity encoding", EXPFILL }},
};
expert_module_t* expert_sv;
diff --git a/epan/dissectors/asn1/sv/sv.asn b/epan/dissectors/asn1/sv/sv.asn
index cf67100d3e..fa89bfa3db 100644
--- a/epan/dissectors/asn1/sv/sv.asn
+++ b/epan/dissectors/asn1/sv/sv.asn
@@ -20,9 +20,11 @@ ASDU ::= SEQUENCE {
smpRate [6] IMPLICIT INTEGER(0..65535) OPTIONAL,
seqData [7] IMPLICIT Data,
smpMod [8] IMPLICIT INTEGER{samplesPerNormalPeriod(0),samplesPerSecond(1),secondsPerSample(2)} OPTIONAL,
+ gmidData [9] IMPLICIT GmidData OPTIONAL,
...
}
UtcTime ::= OCTET STRING
Data ::= OCTET STRING
+GmidData ::= OCTET STRING
END
diff --git a/epan/dissectors/asn1/sv/sv.cnf b/epan/dissectors/asn1/sv/sv.cnf
index 4b96de73e1..c8fe256d38 100644
--- a/epan/dissectors/asn1/sv/sv.cnf
+++ b/epan/dissectors/asn1/sv/sv.cnf
@@ -81,4 +81,36 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE
}
#.END
+#.FN_BODY GmidData
+ guint32 len;
+ proto_item *gmidentity_ti;
+ proto_tree *gmidentity_tree;
+ const gchar *manuf_name;
+
+ len = tvb_reported_length_remaining(tvb, offset);
+
+ if(len != 8)
+ {
+ proto_tree_add_expert_format(tree, actx->pinfo, &ei_sv_mal_gmidentity, tvb, offset, len,
+ "BER Error: malformed gmIdentity encoding, length must be 8 bytes");
+ if(hf_index >= 0)
+ {
+ proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
+ }
+ return offset;
+ }
+
+ gmidentity_ti = proto_tree_add_item(tree, hf_sv_gmidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
+
+ /* EUI-64: vendor ID | 0xFF - 0xFE | card ID */
+ if (tvb_get_ntohs(tvb, offset + 3) == 0xFFFE) {
+ gmidentity_tree = proto_item_add_subtree(gmidentity_ti, ett_gmidentity);
+
+ manuf_name = tvb_get_manuf_name(tvb, offset);
+ proto_tree_add_bytes_format_value(gmidentity_tree, hf_sv_gmidentity_manuf, tvb, offset, 3, NULL, "%%s", manuf_name);
+ }
+
+ offset += 8;
+#.END
+
#.END_OF_CNF