epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / asn1 / sv / sv.cnf
blobfd2634e0f525e68f906b1f982f17cc9553bc4f05
1 # sv.cnf
2 # SampledValue conformation file
4 #.MODULE_IMPORT
6 #.EXPORTS
8 #.PDU
10 #.NO_EMIT ONLY_VALS
11 SampledValues
13 #.TYPE_RENAME
15 #.FIELD_RENAME
17 #.FN_BODY ASDU/smpCnt VAL_PTR = &value
18         uint32_t value;
19 %(DEFAULT_BODY)s
20         sv_data.smpCnt = value;
21 #.END
23 #.FN_BODY UtcTime
24         uint32_t len;
25         uint32_t seconds;
26         uint32_t        fraction;
27         uint32_t nanoseconds;
28         nstime_t ts;
29         char *  ptime;
31         len = tvb_reported_length_remaining(tvb, offset);
33         if(len != 8)
34         {
35                 proto_tree_add_expert_format(tree, actx->pinfo, &ei_sv_mal_utctime, tvb, offset, len,
36                                 "BER Error: malformed UTCTime encoding, length must be 8 bytes");
37                 if(hf_index > 0)
38                 {
39                         proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
40                 }
41                 return offset;
42         }
44         seconds = tvb_get_ntohl(tvb, offset);
45         fraction = tvb_get_ntoh24(tvb, offset+4) * 0x100; /* Only 3 bytes are recommended */
46         nanoseconds = (uint32_t)( ((uint64_t)fraction * UINT64_C(1000000000)) / UINT64_C(0x100000000) ) ;
48         ts.secs = seconds;
49         ts.nsecs = nanoseconds;
51         ptime = abs_time_to_str(actx->pinfo->pool, &ts, ABSOLUTE_TIME_UTC, true);
53         if(hf_index > 0)
54         {
55                 proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
56         }
57         offset += 8;
58 #.END
60 #.TYPE_ATTR
61 UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE
63 #.FN_BODY ASDU/smpSynch VAL_PTR = &value
64         uint32_t value;
65 %(DEFAULT_BODY)s
66         sv_data.smpSynch = value;
67 #.END
69 #.FN_BODY ASDU/smpMod  VAL_PTR = &value
70         uint32_t value;
71 %(DEFAULT_BODY)s
72         sv_data.smpMod = value;
73 #.END
75 #.FN_BODY Data
76         if (sv_decode_data_as_phsmeas) {
77                 offset = dissect_PhsMeas1(implicit_tag, actx->pinfo, tree, tvb, offset, hf_index);
78         } else {
79                 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
80         }
81 #.END
83 #.FN_BODY GmidData
84         uint32_t len;
85         proto_item  *gmidentity_ti;
86         proto_tree  *gmidentity_tree;
87         const char *manuf_name;
89         len = tvb_reported_length_remaining(tvb, offset);
91         if(len != 8)
92         {
93                 proto_tree_add_expert_format(tree, actx->pinfo, &ei_sv_mal_gmidentity, tvb, offset, len,
94                                 "BER Error: malformed gmIdentity encoding, length must be 8 bytes");
95                 if(hf_index > 0)
96                 {
97                         proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
98                 }
99                 return offset;
100         }
102         gmidentity_ti = proto_tree_add_item(tree, hf_sv_gmidentity, tvb, offset, 8, ENC_BIG_ENDIAN);
104         /* EUI-64: vendor ID | 0xFF - 0xFE | card ID */
105         if (tvb_get_ntohs(tvb, offset + 3) == 0xFFFE) {
106                 gmidentity_tree = proto_item_add_subtree(gmidentity_ti, ett_gmidentity);
108                 manuf_name = tvb_get_manuf_name(tvb, offset);
109                 proto_tree_add_bytes_format_value(gmidentity_tree, hf_sv_gmidentity_manuf, tvb, offset, 3, NULL, "%%s", manuf_name);
110         }
112         offset += 8;
113 #.END
115 #.END_OF_CNF