2010-06-01 23:27:16 +00:00
|
|
|
/* Do not modify this file. */
|
|
|
|
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
|
|
|
|
/* packet-sv.c */
|
2011-10-15 19:27:27 +00:00
|
|
|
/* ../../tools/asn2wrs.py -b -p sv -c ./sv.cnf -s ./packet-sv-template -D . -O ../../epan/dissectors sv.asn */
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/* Input file: packet-sv-template.c */
|
|
|
|
|
2011-05-13 08:12:27 +00:00
|
|
|
#line 1 "../../asn1/sv/packet-sv-template.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
/* packet-sv.c
|
|
|
|
* Routines for IEC 61850 Sampled Vales packet dissection
|
|
|
|
* Michael Bernhard 2008
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2010-06-01 23:27:16 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/asn1.h>
|
|
|
|
#include <epan/etypes.h>
|
2013-01-10 12:13:16 +00:00
|
|
|
#include <epan/expert.h>
|
|
|
|
#include <epan/nstime.h>
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "packet-ber.h"
|
|
|
|
#include "packet-acse.h"
|
|
|
|
|
|
|
|
#include "tap.h"
|
|
|
|
|
|
|
|
#include "packet-sv.h"
|
|
|
|
|
|
|
|
#define PNAME "IEC61850 Sampled Values"
|
|
|
|
#define PSNAME "SV"
|
|
|
|
#define PFNAME "sv"
|
|
|
|
|
|
|
|
/* see IEC61850-8-1 8.2 */
|
|
|
|
#define Q_VALIDITY_GOOD (0x0 << 0)
|
|
|
|
#define Q_VALIDITY_INVALID (0x1 << 0)
|
|
|
|
#define Q_VALIDITY_QUESTIONABLE (0x3 << 0)
|
|
|
|
#define Q_VALIDITY_MASK (0x3 << 0)
|
|
|
|
|
|
|
|
#define Q_OVERFLOW (1 << 2)
|
|
|
|
#define Q_OUTOFRANGE (1 << 3)
|
|
|
|
#define Q_BADREFERENCE (1 << 4)
|
|
|
|
#define Q_OSCILLATORY (1 << 5)
|
|
|
|
#define Q_FAILURE (1 << 6)
|
|
|
|
#define Q_OLDDATA (1 << 7)
|
|
|
|
#define Q_INCONSISTENT (1 << 8)
|
|
|
|
#define Q_INACCURATE (1 << 9)
|
|
|
|
|
|
|
|
#define Q_SOURCE_PROCESS (0 << 10)
|
|
|
|
#define Q_SOURCE_SUBSTITUTED (1 << 10)
|
|
|
|
#define Q_SOURCE_MASK (1 << 10)
|
|
|
|
|
|
|
|
#define Q_TEST (1 << 11)
|
|
|
|
#define Q_OPERATORBLOCKED (1 << 12)
|
|
|
|
|
|
|
|
/* see UCA Implementation Guideline for IEC 61850-9-2 */
|
|
|
|
#define Q_DERIVED (1 << 13)
|
|
|
|
|
2013-03-28 07:34:13 +00:00
|
|
|
void proto_register_sv(void);
|
|
|
|
void proto_reg_handoff_sv(void);
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/* Data for SV tap */
|
|
|
|
static int sv_tap = -1;
|
|
|
|
static sv_frame_data sv_data;
|
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_sv = -1;
|
|
|
|
static int hf_sv_appid = -1;
|
|
|
|
static int hf_sv_length = -1;
|
|
|
|
static int hf_sv_reserve1 = -1;
|
|
|
|
static int hf_sv_reserve2 = -1;
|
2013-01-10 12:42:07 +00:00
|
|
|
#if 0
|
2010-06-01 23:27:16 +00:00
|
|
|
static int hf_sv_phmeas_instmag_i = -1;
|
|
|
|
static int hf_sv_phsmeas_q = -1;
|
|
|
|
static int hf_sv_phsmeas_q_validity = -1;
|
|
|
|
static int hf_sv_phsmeas_q_overflow = -1;
|
|
|
|
static int hf_sv_phsmeas_q_outofrange = -1;
|
|
|
|
static int hf_sv_phsmeas_q_badreference = -1;
|
|
|
|
static int hf_sv_phsmeas_q_oscillatory = -1;
|
|
|
|
static int hf_sv_phsmeas_q_failure = -1;
|
|
|
|
static int hf_sv_phsmeas_q_olddata = -1;
|
|
|
|
static int hf_sv_phsmeas_q_inconsistent = -1;
|
|
|
|
static int hf_sv_phsmeas_q_inaccurate = -1;
|
|
|
|
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;
|
2013-01-10 12:42:07 +00:00
|
|
|
#endif
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/*--- Included file: packet-sv-hf.c ---*/
|
2011-05-13 08:12:27 +00:00
|
|
|
#line 1 "../../asn1/sv/packet-sv-hf.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
static int hf_sv_savPdu = -1; /* SavPdu */
|
|
|
|
static int hf_sv_noASDU = -1; /* INTEGER_0_65535 */
|
|
|
|
static int hf_sv_seqASDU = -1; /* SEQUENCE_OF_ASDU */
|
|
|
|
static int hf_sv_seqASDU_item = -1; /* ASDU */
|
|
|
|
static int hf_sv_svID = -1; /* VisibleString */
|
2013-01-10 12:13:16 +00:00
|
|
|
static int hf_sv_datSet = -1; /* VisibleString */
|
2010-06-01 23:27:16 +00:00
|
|
|
static int hf_sv_smpCnt = -1; /* T_smpCnt */
|
|
|
|
static int hf_sv_confRef = -1; /* INTEGER_0_4294967295 */
|
2013-01-10 12:13:16 +00:00
|
|
|
static int hf_sv_refrTm = -1; /* UtcTime */
|
2010-06-01 23:27:16 +00:00
|
|
|
static int hf_sv_smpSynch = -1; /* T_smpSynch */
|
2013-01-10 12:13:16 +00:00
|
|
|
static int hf_sv_smpRate = -1; /* INTEGER_0_65535 */
|
2010-06-01 23:27:16 +00:00
|
|
|
static int hf_sv_seqData = -1; /* Data */
|
2013-01-10 12:13:16 +00:00
|
|
|
static int hf_sv_smpMod = -1; /* T_smpMod */
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/*--- End of included file: packet-sv-hf.c ---*/
|
2013-03-28 07:34:13 +00:00
|
|
|
#line 105 "../../asn1/sv/packet-sv-template.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static int ett_sv = -1;
|
|
|
|
static int ett_phsmeas = -1;
|
|
|
|
static int ett_phsmeas_q = -1;
|
|
|
|
|
|
|
|
|
|
|
|
/*--- Included file: packet-sv-ett.c ---*/
|
2011-05-13 08:12:27 +00:00
|
|
|
#line 1 "../../asn1/sv/packet-sv-ett.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
static gint ett_sv_SampledValues = -1;
|
|
|
|
static gint ett_sv_SavPdu = -1;
|
|
|
|
static gint ett_sv_SEQUENCE_OF_ASDU = -1;
|
|
|
|
static gint ett_sv_ASDU = -1;
|
|
|
|
|
|
|
|
/*--- End of included file: packet-sv-ett.c ---*/
|
2013-03-28 07:34:13 +00:00
|
|
|
#line 112 "../../asn1/sv/packet-sv-template.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
|
2013-01-10 12:42:07 +00:00
|
|
|
#if 0
|
2010-06-01 23:27:16 +00:00
|
|
|
static const value_string sv_q_validity_vals[] = {
|
|
|
|
{ 0, "good" },
|
|
|
|
{ 1, "invalid" },
|
|
|
|
{ 3, "questionable" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string sv_q_source_vals[] = {
|
|
|
|
{ 0, "process" },
|
|
|
|
{ 1, "substituted" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_PhsMeas1(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, int hf_id _U_)
|
|
|
|
{
|
|
|
|
gint8 class;
|
|
|
|
gboolean pc;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len;
|
|
|
|
proto_item *it;
|
|
|
|
proto_tree *subtree = NULL;
|
|
|
|
gint32 value;
|
|
|
|
guint32 qual;
|
|
|
|
guint32 i;
|
|
|
|
|
|
|
|
static const int *q_flags[] = {
|
|
|
|
&hf_sv_phsmeas_q_validity,
|
|
|
|
&hf_sv_phsmeas_q_overflow,
|
|
|
|
&hf_sv_phsmeas_q_outofrange,
|
|
|
|
&hf_sv_phsmeas_q_badreference,
|
|
|
|
&hf_sv_phsmeas_q_oscillatory,
|
|
|
|
&hf_sv_phsmeas_q_failure,
|
|
|
|
&hf_sv_phsmeas_q_olddata,
|
|
|
|
&hf_sv_phsmeas_q_inconsistent,
|
|
|
|
&hf_sv_phsmeas_q_inaccurate,
|
|
|
|
&hf_sv_phsmeas_q_source,
|
|
|
|
&hf_sv_phsmeas_q_test,
|
|
|
|
&hf_sv_phsmeas_q_operatorblocked,
|
|
|
|
&hf_sv_phsmeas_q_derived,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!implicit_tag) {
|
|
|
|
offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag);
|
|
|
|
offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL);
|
|
|
|
} else {
|
|
|
|
len=tvb_length_remaining(tvb, offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
it = proto_tree_add_text(tree, tvb, offset, len, "PhsMeas1");
|
|
|
|
subtree = proto_item_add_subtree(it, ett_phsmeas);
|
|
|
|
}
|
|
|
|
|
|
|
|
sv_data.num_phsMeas = 0;
|
|
|
|
for (i = 0; i < len/8; i++) {
|
|
|
|
if (tree && subtree) {
|
|
|
|
value = tvb_get_ntohl(tvb, offset);
|
|
|
|
qual = tvb_get_ntohl(tvb, offset + 4);
|
|
|
|
|
2011-10-06 16:50:13 +00:00
|
|
|
proto_tree_add_item(subtree, hf_sv_phmeas_instmag_i, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2011-10-24 20:18:01 +00:00
|
|
|
proto_tree_add_bitmask(subtree, tvb, offset + 4, hf_sv_phsmeas_q, ett_phsmeas_q, q_flags, ENC_BIG_ENDIAN);
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
if (i < IEC61850_SV_MAX_PHSMEAS_ENTRIES) {
|
|
|
|
sv_data.phsMeas[i].value = value;
|
|
|
|
sv_data.phsMeas[i].qual = qual;
|
|
|
|
sv_data.num_phsMeas++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2013-01-10 12:42:07 +00:00
|
|
|
#endif
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/*--- Included file: packet-sv-fn.c ---*/
|
2011-05-13 08:12:27 +00:00
|
|
|
#line 1 "../../asn1/sv/packet-sv-fn.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_INTEGER_0_65535(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_VisibleString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_VisibleString,
|
|
|
|
actx, tree, tvb, offset, hf_index,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_T_smpCnt(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2011-05-13 08:12:27 +00:00
|
|
|
#line 19 "../../asn1/sv/sv.cnf"
|
2010-06-01 23:27:16 +00:00
|
|
|
guint32 value;
|
2013-01-10 12:13:16 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
|
|
|
&value);
|
|
|
|
|
2010-06-01 23:27:16 +00:00
|
|
|
sv_data.smpCnt = value;
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_INTEGER_0_4294967295(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-01-10 12:13:16 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_UtcTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
#line 25 "../../asn1/sv/sv.cnf"
|
|
|
|
guint32 len;
|
|
|
|
proto_item *cause;
|
|
|
|
guint32 seconds;
|
|
|
|
guint32 fraction;
|
|
|
|
guint32 nanoseconds;
|
|
|
|
nstime_t ts;
|
|
|
|
gchar * ptime;
|
|
|
|
|
|
|
|
len = tvb_length_remaining(tvb, offset);
|
|
|
|
|
|
|
|
if(len != 8)
|
|
|
|
{
|
|
|
|
cause = proto_tree_add_text(tree, tvb, offset, len,
|
|
|
|
"BER Error: malformed UTCTime encoding, "
|
|
|
|
"length must be 8 bytes");
|
|
|
|
proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN);
|
|
|
|
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: malformed UTCTime encoding");
|
|
|
|
if(hf_index >= 0)
|
|
|
|
{
|
|
|
|
proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
|
|
|
|
}
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
seconds = tvb_get_ntohl(tvb, offset);
|
|
|
|
fraction = tvb_get_ntoh24(tvb, offset+4) * 0x100; /* Only 3 bytes are recommended */
|
|
|
|
nanoseconds = (guint32)( ((guint64)fraction * G_GINT64_CONSTANT(1000000000U)) / G_GINT64_CONSTANT(0x100000000U) ) ;
|
|
|
|
|
|
|
|
ts.secs = seconds;
|
|
|
|
ts.nsecs = nanoseconds;
|
|
|
|
|
|
|
|
ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE);
|
|
|
|
|
|
|
|
if(hf_index >= 0)
|
|
|
|
{
|
|
|
|
proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
|
|
|
|
}
|
|
|
|
offset += 8;
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-01 23:27:16 +00:00
|
|
|
static const value_string sv_T_smpSynch_vals[] = {
|
|
|
|
{ 0, "none" },
|
|
|
|
{ 1, "local" },
|
|
|
|
{ 2, "global" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_T_smpSynch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2013-01-10 12:13:16 +00:00
|
|
|
#line 70 "../../asn1/sv/sv.cnf"
|
2010-06-01 23:27:16 +00:00
|
|
|
guint32 value;
|
2013-01-10 12:13:16 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
|
|
|
&value);
|
|
|
|
|
2010-06-01 23:27:16 +00:00
|
|
|
sv_data.smpSynch = value;
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_Data(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2013-01-10 12:13:16 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string sv_T_smpMod_vals[] = {
|
|
|
|
{ 0, "samplesPerNormalPeriod" },
|
|
|
|
{ 1, "samplesPerSecond" },
|
|
|
|
{ 2, "secondsPerSample" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_T_smpMod(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
#line 76 "../../asn1/sv/sv.cnf"
|
|
|
|
guint32 value;
|
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
|
|
|
&value);
|
|
|
|
|
|
|
|
sv_data.smpMod = value;
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const ber_sequence_t ASDU_sequence[] = {
|
|
|
|
{ &hf_sv_svID , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_sv_VisibleString },
|
2013-01-10 12:13:16 +00:00
|
|
|
{ &hf_sv_datSet , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_sv_VisibleString },
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_smpCnt , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_sv_T_smpCnt },
|
|
|
|
{ &hf_sv_confRef , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_sv_INTEGER_0_4294967295 },
|
2013-01-10 12:13:16 +00:00
|
|
|
{ &hf_sv_refrTm , BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_sv_UtcTime },
|
|
|
|
{ &hf_sv_smpSynch , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_sv_T_smpSynch },
|
|
|
|
{ &hf_sv_smpRate , BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_sv_INTEGER_0_65535 },
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_seqData , BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_sv_Data },
|
2013-01-10 12:13:16 +00:00
|
|
|
{ &hf_sv_smpMod , BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_sv_T_smpMod },
|
2010-06-01 23:27:16 +00:00
|
|
|
{ NULL, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_ASDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
ASDU_sequence, hf_index, ett_sv_ASDU);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const ber_sequence_t SEQUENCE_OF_ASDU_sequence_of[1] = {
|
|
|
|
{ &hf_sv_seqASDU_item , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_sv_ASDU },
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_SEQUENCE_OF_ASDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
SEQUENCE_OF_ASDU_sequence_of, hf_index, ett_sv_SEQUENCE_OF_ASDU);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const ber_sequence_t SavPdu_sequence[] = {
|
|
|
|
{ &hf_sv_noASDU , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_sv_INTEGER_0_65535 },
|
|
|
|
{ &hf_sv_seqASDU , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_sv_SEQUENCE_OF_ASDU },
|
|
|
|
{ NULL, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_SavPdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
SavPdu_sequence, hf_index, ett_sv_SavPdu);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string sv_SampledValues_vals[] = {
|
|
|
|
{ 0, "savPdu" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ber_choice_t SampledValues_choice[] = {
|
|
|
|
{ 0, &hf_sv_savPdu , BER_CLASS_APP, 0, BER_FLAGS_IMPLTAG, dissect_sv_SavPdu },
|
|
|
|
{ 0, NULL, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
|
|
|
dissect_sv_SampledValues(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
|
|
|
offset = dissect_ber_choice(actx, tree, tvb, offset,
|
|
|
|
SampledValues_choice, hf_index, ett_sv_SampledValues,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--- End of included file: packet-sv-fn.c ---*/
|
2013-03-28 07:34:13 +00:00
|
|
|
#line 193 "../../asn1/sv/packet-sv-template.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Dissect SV PDUs inside a PPDU.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
dissect_sv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
|
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
int old_offset;
|
|
|
|
proto_item *item = NULL;
|
|
|
|
proto_tree *tree = NULL;
|
|
|
|
asn1_ctx_t asn1_ctx;
|
|
|
|
|
|
|
|
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
|
|
|
|
|
|
|
|
if (parent_tree){
|
2011-10-21 02:10:19 +00:00
|
|
|
item = proto_tree_add_item(parent_tree, proto_sv, tvb, 0, -1, ENC_NA);
|
2010-06-01 23:27:16 +00:00
|
|
|
tree = proto_item_add_subtree(item, ett_sv);
|
|
|
|
}
|
2010-06-02 00:20:12 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME);
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/* APPID */
|
|
|
|
if (tree && tvb_reported_length_remaining(tvb, offset) >= 2)
|
2011-10-06 16:50:13 +00:00
|
|
|
proto_tree_add_item(tree, hf_sv_appid, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/* Length */
|
|
|
|
if (tree && tvb_reported_length_remaining(tvb, offset) >= 4)
|
2011-10-06 16:50:13 +00:00
|
|
|
proto_tree_add_item(tree, hf_sv_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/* Reserved 1 */
|
|
|
|
if (tree && tvb_reported_length_remaining(tvb, offset) >= 6)
|
2011-10-06 16:50:13 +00:00
|
|
|
proto_tree_add_item(tree, hf_sv_reserve1, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/* Reserved 2 */
|
|
|
|
if (tree && tvb_reported_length_remaining(tvb, offset) >= 8)
|
2011-10-06 16:50:13 +00:00
|
|
|
proto_tree_add_item(tree, hf_sv_reserve2, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
offset = 8;
|
|
|
|
while (tree && tvb_reported_length_remaining(tvb, offset) > 0){
|
|
|
|
old_offset = offset;
|
|
|
|
offset = dissect_sv_SampledValues(FALSE, tvb, offset, &asn1_ctx , tree, -1);
|
|
|
|
if (offset == old_offset) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, -1, "Internal error, zero-byte SV PDU");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(tree)
|
|
|
|
tap_queue_packet(sv_tap, pinfo, &sv_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--- proto_register_sv -------------------------------------------*/
|
|
|
|
void proto_register_sv(void) {
|
|
|
|
|
|
|
|
/* List of fields */
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_sv_appid,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "APPID", "sv.appid", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_length,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "Length", "sv.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_reserve1,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "Reserved 1", "sv.reserve1", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_reserve2,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "Reserved 2", "sv.reserve2", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
|
2013-01-10 12:42:07 +00:00
|
|
|
#if 0
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_phmeas_instmag_i,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "value", "sv.meas_value", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "quality", "sv.meas_quality", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_validity,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "validity", "sv.meas_quality.validity", FT_UINT32, BASE_HEX, VALS(sv_q_validity_vals), Q_VALIDITY_MASK, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_overflow,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "overflow", "sv.meas_quality.overflow", FT_BOOLEAN, 32, NULL, Q_OVERFLOW, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_outofrange,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "out of range", "sv.meas_quality.outofrange", FT_BOOLEAN, 32, NULL, Q_OUTOFRANGE, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_badreference,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "bad reference", "sv.meas_quality.badreference", FT_BOOLEAN, 32, NULL, Q_BADREFERENCE, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_oscillatory,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "oscillatory", "sv.meas_quality.oscillatory", FT_BOOLEAN, 32, NULL, Q_OSCILLATORY, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_failure,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "failure", "sv.meas_quality.failure", FT_BOOLEAN, 32, NULL, Q_FAILURE, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_olddata,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "old data", "sv.meas_quality.olddata", FT_BOOLEAN, 32, NULL, Q_OLDDATA, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_inconsistent,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "inconsistent", "sv.meas_quality.inconsistent", FT_BOOLEAN, 32, NULL, Q_INCONSISTENT, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_inaccurate,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "inaccurate", "sv.meas_quality.inaccurate", FT_BOOLEAN, 32, NULL, Q_INACCURATE, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_source,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "source", "sv.meas_quality.source", FT_UINT32, BASE_HEX, VALS(sv_q_source_vals), Q_SOURCE_MASK, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_test,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "test", "sv.meas_quality.teset", FT_BOOLEAN, 32, NULL, Q_TEST, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_operatorblocked,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "operator blocked", "sv.meas_quality.operatorblocked", FT_BOOLEAN, 32, NULL, Q_OPERATORBLOCKED, NULL, HFILL}},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
{ &hf_sv_phsmeas_q_derived,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "derived", "sv.meas_quality.derived", FT_BOOLEAN, 32, NULL, Q_DERIVED, NULL, HFILL}},
|
2013-01-10 12:42:07 +00:00
|
|
|
#endif
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*--- Included file: packet-sv-hfarr.c ---*/
|
2011-05-13 08:12:27 +00:00
|
|
|
#line 1 "../../asn1/sv/packet-sv-hfarr.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_savPdu,
|
|
|
|
{ "savPdu", "sv.savPdu",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
NULL, HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_noASDU,
|
|
|
|
{ "noASDU", "sv.noASDU",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
"INTEGER_0_65535", HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_seqASDU,
|
|
|
|
{ "seqASDU", "sv.seqASDU",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
"SEQUENCE_OF_ASDU", HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_seqASDU_item,
|
2010-06-02 00:20:12 +00:00
|
|
|
{ "ASDU", "sv.ASDU",
|
2010-06-01 23:27:16 +00:00
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
NULL, HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_svID,
|
|
|
|
{ "svID", "sv.svID",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
"VisibleString", HFILL }},
|
2013-01-10 12:13:16 +00:00
|
|
|
{ &hf_sv_datSet,
|
|
|
|
{ "datSet", "sv.datSet",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0,
|
|
|
|
"VisibleString", HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_smpCnt,
|
|
|
|
{ "smpCnt", "sv.smpCnt",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
NULL, HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_confRef,
|
|
|
|
{ "confRef", "sv.confRef",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
"INTEGER_0_4294967295", HFILL }},
|
2013-01-10 12:13:16 +00:00
|
|
|
{ &hf_sv_refrTm,
|
|
|
|
{ "refrTm", "sv.refrTm",
|
|
|
|
FT_STRING, BASE_NONE, NULL, 0,
|
|
|
|
"UtcTime", HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_smpSynch,
|
|
|
|
{ "smpSynch", "sv.smpSynch",
|
|
|
|
FT_INT32, BASE_DEC, VALS(sv_T_smpSynch_vals), 0,
|
2010-06-02 00:20:12 +00:00
|
|
|
NULL, HFILL }},
|
2013-01-10 12:13:16 +00:00
|
|
|
{ &hf_sv_smpRate,
|
|
|
|
{ "smpRate", "sv.smpRate",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
|
|
|
"INTEGER_0_65535", HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
{ &hf_sv_seqData,
|
|
|
|
{ "seqData", "sv.seqData",
|
2010-06-02 00:20:12 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0,
|
|
|
|
"Data", HFILL }},
|
2013-01-10 12:13:16 +00:00
|
|
|
{ &hf_sv_smpMod,
|
|
|
|
{ "smpMod", "sv.smpMod",
|
|
|
|
FT_INT32, BASE_DEC, VALS(sv_T_smpMod_vals), 0,
|
|
|
|
NULL, HFILL }},
|
2010-06-01 23:27:16 +00:00
|
|
|
|
|
|
|
/*--- End of included file: packet-sv-hfarr.c ---*/
|
2013-03-28 07:34:13 +00:00
|
|
|
#line 310 "../../asn1/sv/packet-sv-template.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* List of subtrees */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_sv,
|
|
|
|
&ett_phsmeas,
|
|
|
|
&ett_phsmeas_q,
|
|
|
|
|
|
|
|
/*--- Included file: packet-sv-ettarr.c ---*/
|
2011-05-13 08:12:27 +00:00
|
|
|
#line 1 "../../asn1/sv/packet-sv-ettarr.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
&ett_sv_SampledValues,
|
|
|
|
&ett_sv_SavPdu,
|
|
|
|
&ett_sv_SEQUENCE_OF_ASDU,
|
|
|
|
&ett_sv_ASDU,
|
|
|
|
|
|
|
|
/*--- End of included file: packet-sv-ettarr.c ---*/
|
2013-03-28 07:34:13 +00:00
|
|
|
#line 318 "../../asn1/sv/packet-sv-template.c"
|
2010-06-01 23:27:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Register protocol */
|
|
|
|
proto_sv = proto_register_protocol(PNAME, PSNAME, PFNAME);
|
|
|
|
register_dissector("sv", dissect_sv, proto_sv);
|
|
|
|
|
|
|
|
/* Register fields and subtrees */
|
|
|
|
proto_register_field_array(proto_sv, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
/* Register tap */
|
|
|
|
sv_tap = register_tap("sv");
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--- proto_reg_handoff_sv --- */
|
|
|
|
void proto_reg_handoff_sv(void) {
|
|
|
|
|
|
|
|
dissector_handle_t sv_handle;
|
|
|
|
sv_handle = find_dissector("sv");
|
|
|
|
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_IEC61850_SV, sv_handle);
|
2013-01-10 12:42:07 +00:00
|
|
|
}
|