@netkitty/codec 1.2.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +295 -0
- package/README.md +62 -10
- package/README.zh-CN.md +55 -9
- package/dist/Codec.d.ts +3 -2
- package/dist/Codec.js +109 -10
- package/dist/abstracts/BaseHeader.d.ts +54 -2
- package/dist/abstracts/BaseHeader.js +185 -43
- package/dist/errors/CodecSchemaValidateError.d.ts +34 -1
- package/dist/errors/CodecSchemaValidateError.js +26 -3
- package/dist/headers/ADSAMS.js +2 -0
- package/dist/headers/AH.js +4 -2
- package/dist/headers/AMQP.js +2 -1
- package/dist/headers/ARP.js +16 -10
- package/dist/headers/BACnetIP.js +1 -0
- package/dist/headers/BFD.d.ts +2 -1
- package/dist/headers/BFD.js +30 -4
- package/dist/headers/BGP.js +6 -1
- package/dist/headers/Babel.js +2 -1
- package/dist/headers/BitTorrent.d.ts +2 -0
- package/dist/headers/BitTorrent.js +4 -2
- package/dist/headers/C37118.d.ts +3 -2
- package/dist/headers/C37118.js +35 -15
- package/dist/headers/CAPWAP.js +1 -0
- package/dist/headers/CDP.d.ts +3 -3
- package/dist/headers/CDP.js +47 -11
- package/dist/headers/CMS.js +27 -12
- package/dist/headers/COTP.d.ts +2 -0
- package/dist/headers/COTP.js +8 -4
- package/dist/headers/CassandraCQL.js +1 -0
- package/dist/headers/CoAP.js +20 -2
- package/dist/headers/Codesys.js +1 -0
- package/dist/headers/Collectd.js +1 -1
- package/dist/headers/DCCP.d.ts +3 -2
- package/dist/headers/DCCP.js +61 -8
- package/dist/headers/DHCPFailover.js +1 -0
- package/dist/headers/DNP3.d.ts +5 -3
- package/dist/headers/DNP3.js +62 -7
- package/dist/headers/DNS.js +3 -3
- package/dist/headers/DTLS.js +1 -0
- package/dist/headers/Diameter.js +3 -2
- package/dist/headers/EAPOL.js +1 -1
- package/dist/headers/EIGRP.d.ts +3 -2
- package/dist/headers/EIGRP.js +32 -6
- package/dist/headers/ENIP.js +1 -0
- package/dist/headers/Elasticsearch.js +1 -0
- package/dist/headers/EtherCAT.js +1 -0
- package/dist/headers/EthernetII.js +7 -0
- package/dist/headers/FTP.js +6 -6
- package/dist/headers/Finger.js +3 -3
- package/dist/headers/FoundationFieldbusHSE.js +1 -0
- package/dist/headers/GELF.js +8 -1
- package/dist/headers/GENEVE.js +2 -1
- package/dist/headers/GLBP.js +1 -1
- package/dist/headers/GRE.js +1 -0
- package/dist/headers/GTPU.js +1 -0
- package/dist/headers/GTPv2C.js +2 -0
- package/dist/headers/GitProtocol.js +2 -2
- package/dist/headers/Goose.js +24 -12
- package/dist/headers/Gopher.js +6 -6
- package/dist/headers/HARTIP.js +1 -0
- package/dist/headers/HSR.js +3 -0
- package/dist/headers/HTTP.js +6 -6
- package/dist/headers/HTTP2.js +2 -0
- package/dist/headers/ICMP.js +3 -1
- package/dist/headers/ICMPv6.js +11 -16
- package/dist/headers/IEC104_I_Frame.js +215 -163
- package/dist/headers/IEC104_S_Frame.js +26 -3
- package/dist/headers/IEC104_U_Frame.js +33 -4
- package/dist/headers/IEC61850SampledValues.js +6 -5
- package/dist/headers/IGMP.d.ts +8 -7
- package/dist/headers/IGMP.js +58 -19
- package/dist/headers/IMAP.js +5 -5
- package/dist/headers/IPFIX.js +3 -2
- package/dist/headers/IPv4.js +41 -21
- package/dist/headers/IPv6.js +5 -1
- package/dist/headers/IPv6HopByHopOptions.js +15 -12
- package/dist/headers/IRC.js +4 -4
- package/dist/headers/ISAKMP.js +3 -1
- package/dist/headers/ISCSI.js +2 -0
- package/dist/headers/ISIS.js +2 -1
- package/dist/headers/ISOSession.d.ts +2 -0
- package/dist/headers/ISOSession.js +14 -10
- package/dist/headers/Ident.js +8 -8
- package/dist/headers/KNXnetIP.js +1 -0
- package/dist/headers/Kafka.js +1 -0
- package/dist/headers/Kerberos.js +2 -0
- package/dist/headers/L2TP.js +3 -2
- package/dist/headers/LACP.js +1 -1
- package/dist/headers/LDAP.js +3 -4
- package/dist/headers/LDP.js +1 -0
- package/dist/headers/LLC.d.ts +2 -0
- package/dist/headers/LLC.js +3 -0
- package/dist/headers/LPD.js +3 -3
- package/dist/headers/MGCP.js +7 -7
- package/dist/headers/MMS.d.ts +2 -0
- package/dist/headers/MMS.js +10 -6
- package/dist/headers/MQTT.js +1 -0
- package/dist/headers/MQTTSN.js +1 -0
- package/dist/headers/MarkerProtocol.js +1 -1
- package/dist/headers/Megaco.js +3 -3
- package/dist/headers/Memcached.js +3 -2
- package/dist/headers/ModbusTCP.js +1 -0
- package/dist/headers/ModbusUDP.js +1 -0
- package/dist/headers/MongoDB.js +1 -0
- package/dist/headers/MySQL.js +1 -0
- package/dist/headers/NATS.js +2 -2
- package/dist/headers/NBDS.js +1 -0
- package/dist/headers/NBSS.js +1 -0
- package/dist/headers/NFS.js +1 -0
- package/dist/headers/NHRP.d.ts +1 -1
- package/dist/headers/NHRP.js +30 -4
- package/dist/headers/NNTP.js +6 -6
- package/dist/headers/NetFlowV5.js +1 -0
- package/dist/headers/OLSR.js +2 -1
- package/dist/headers/OPCUA.js +1 -0
- package/dist/headers/OSPF.d.ts +3 -3
- package/dist/headers/OSPF.js +72 -7
- package/dist/headers/OpenFlow.js +1 -0
- package/dist/headers/OpenVPN.js +1 -0
- package/dist/headers/PCWorx.js +1 -0
- package/dist/headers/PIM.d.ts +3 -3
- package/dist/headers/PIM.js +55 -6
- package/dist/headers/POP3.js +5 -5
- package/dist/headers/PPPoEDiscovery.js +4 -1
- package/dist/headers/PPPoESession.js +1 -0
- package/dist/headers/PPTP.js +1 -0
- package/dist/headers/PTP.js +6 -1
- package/dist/headers/PostgreSQL.js +2 -0
- package/dist/headers/QUIC.js +2 -0
- package/dist/headers/RADIUS.js +1 -0
- package/dist/headers/RDP.d.ts +2 -0
- package/dist/headers/RDP.js +6 -1
- package/dist/headers/RFB.js +4 -4
- package/dist/headers/RGoose.js +8 -1
- package/dist/headers/RSVP.d.ts +3 -3
- package/dist/headers/RSVP.js +59 -44
- package/dist/headers/RTCP.js +2 -0
- package/dist/headers/RTP.js +2 -1
- package/dist/headers/RTPS.d.ts +2 -0
- package/dist/headers/RTPS.js +4 -1
- package/dist/headers/RTSP.js +7 -7
- package/dist/headers/RawData.js +1 -1
- package/dist/headers/Redis.js +4 -4
- package/dist/headers/Rlogin.js +5 -5
- package/dist/headers/Rsync.js +2 -2
- package/dist/headers/S7comm.d.ts +2 -0
- package/dist/headers/S7comm.js +5 -1
- package/dist/headers/SCTP.d.ts +2 -2
- package/dist/headers/SCTP.js +31 -7
- package/dist/headers/SFlow.js +2 -1
- package/dist/headers/SIP.js +6 -6
- package/dist/headers/SLMP.js +1 -0
- package/dist/headers/SLP.js +2 -0
- package/dist/headers/SLPv1.js +1 -0
- package/dist/headers/SMB1.js +1 -0
- package/dist/headers/SMB2.js +1 -0
- package/dist/headers/SMPP.js +1 -0
- package/dist/headers/SMTP.js +6 -6
- package/dist/headers/SNAP.js +18 -5
- package/dist/headers/SNMP.js +6 -6
- package/dist/headers/SOCKS4.js +11 -5
- package/dist/headers/SSDP.js +7 -7
- package/dist/headers/SSH.js +5 -4
- package/dist/headers/STOMP.js +5 -5
- package/dist/headers/STUN.js +3 -1
- package/dist/headers/SercosIII.d.ts +3 -2
- package/dist/headers/SercosIII.js +41 -5
- package/dist/headers/Skinny.js +1 -0
- package/dist/headers/StatsD.js +4 -4
- package/dist/headers/SunRPC.js +1 -0
- package/dist/headers/Syslog.js +2 -2
- package/dist/headers/TCP.js +31 -64
- package/dist/headers/TLS_Alert.js +42 -12
- package/dist/headers/TLS_ApplicationData.d.ts +3 -3
- package/dist/headers/TLS_ApplicationData.js +32 -8
- package/dist/headers/TLS_ChangeCipherSpec.d.ts +2 -2
- package/dist/headers/TLS_ChangeCipherSpec.js +33 -8
- package/dist/headers/TLS_Handshake.js +78 -30
- package/dist/headers/TLS_Heartbeat.d.ts +4 -3
- package/dist/headers/TLS_Heartbeat.js +50 -8
- package/dist/headers/TPKT.js +4 -2
- package/dist/headers/TacacsPlus.js +1 -0
- package/dist/headers/Telnet.js +2 -1
- package/dist/headers/Teredo.js +2 -2
- package/dist/headers/UDP.js +20 -56
- package/dist/headers/VLAN_802dot1Q.js +8 -0
- package/dist/headers/VRRP.d.ts +2 -1
- package/dist/headers/VRRP.js +45 -9
- package/dist/headers/WCCP.js +1 -0
- package/dist/headers/WHOIS.js +3 -3
- package/dist/headers/WSDiscovery.js +2 -2
- package/dist/headers/XMPP.js +3 -3
- package/dist/headers/Zabbix.js +1 -0
- package/dist/helper/Checksum.d.ts +15 -0
- package/dist/helper/Checksum.js +56 -0
- package/dist/helper/Crc.d.ts +18 -0
- package/dist/helper/Crc.js +58 -0
- package/dist/index.d.ts +3 -3
- package/dist/lib/SchemaValidator.d.ts +31 -0
- package/dist/lib/SchemaValidator.js +137 -0
- package/dist/schema/ProtocolFieldJSONSchema.d.ts +4 -1
- package/dist/schema/ProtocolJSONSchema.d.ts +1 -1
- package/dist/types/CodecErrorInfo.d.ts +11 -0
- package/dist/types/LayerGraph.d.ts +14 -1
- package/package.json +2 -2
package/dist/headers/CDP.js
CHANGED
|
@@ -6,6 +6,7 @@ const BufferToHex_1 = require("../helper/BufferToHex");
|
|
|
6
6
|
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
7
7
|
const BufferToNumber_1 = require("../helper/BufferToNumber");
|
|
8
8
|
const NumberToBuffer_1 = require("../helper/NumberToBuffer");
|
|
9
|
+
const Checksum_1 = require("../helper/Checksum");
|
|
9
10
|
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
10
11
|
/**
|
|
11
12
|
* CDP — Cisco Discovery Protocol, carried in an 802.3 frame over LLC/SNAP with OUI 0x00000C and PID
|
|
@@ -15,9 +16,9 @@ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
|
15
16
|
* Capabilities, 0x0005 Software Version, 0x0006 Platform.
|
|
16
17
|
*
|
|
17
18
|
* The TLV values are kept verbatim as hex (device names, address lists and capability bitmaps need no
|
|
18
|
-
* form structure), the
|
|
19
|
-
* the
|
|
20
|
-
* byte-for-byte.
|
|
19
|
+
* form structure), and the TLV walk is bounded by the captured bytes so a corrupt Length can't run past
|
|
20
|
+
* the frame. The Checksum and each TLV Length are computed on encode when left out and written as given
|
|
21
|
+
* otherwise. A well-formed CDP frame round-trips byte-for-byte.
|
|
21
22
|
*/
|
|
22
23
|
class CDP extends BaseHeader_1.BaseHeader {
|
|
23
24
|
constructor() {
|
|
@@ -33,6 +34,21 @@ class CDP extends BaseHeader_1.BaseHeader {
|
|
|
33
34
|
get SCHEMA() {
|
|
34
35
|
return (CDP.#schemaCache ??= CDP.#buildSchema());
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The CDP checksum: the Internet checksum of the whole CDP message, except for an odd trailing
|
|
39
|
+
* octet. RFC 1071 pads it with a zero octet (word 0xXX00); Cisco adds it as a signed low byte
|
|
40
|
+
* instead, which comes out as the word 0x00XX below 0x80 and 0xFF(XX-1) from 0x80 on. This is what
|
|
41
|
+
* Wireshark's CDP dissector checks, and real Cisco captures carry it.
|
|
42
|
+
* @param message the CDP message with the checksum field zeroed
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
static #checksum(message) {
|
|
46
|
+
if (message.length % 2 === 0)
|
|
47
|
+
return (0, Checksum_1.InternetChecksum)(message);
|
|
48
|
+
const last = message[message.length - 1];
|
|
49
|
+
const finalWord = (last & 0x80) ? Buffer.from([0xFF, last - 1]) : Buffer.from([0x00, last]);
|
|
50
|
+
return (0, Checksum_1.InternetChecksum)(message.subarray(0, message.length - 1), finalWord);
|
|
51
|
+
}
|
|
36
52
|
static #buildSchema() {
|
|
37
53
|
return {
|
|
38
54
|
type: 'object',
|
|
@@ -40,9 +56,29 @@ class CDP extends BaseHeader_1.BaseHeader {
|
|
|
40
56
|
properties: {
|
|
41
57
|
version: this.fieldUInt('version', 0, 1, 'Version'),
|
|
42
58
|
ttl: this.fieldUInt('ttl', 1, 1, 'TTL'),
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
59
|
+
//Left out, computed once every TLV is written (#checksum); a given value is written as given.
|
|
60
|
+
checksum: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
autoCalculated: true,
|
|
63
|
+
label: 'Checksum',
|
|
64
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
65
|
+
decode: function () {
|
|
66
|
+
this.instance.checksum.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(2, 2)));
|
|
67
|
+
},
|
|
68
|
+
encode: function () {
|
|
69
|
+
if (!this.isLeftOut(this.instance.checksum)) {
|
|
70
|
+
this.writeBytes(2, (0, HexToBuffer_1.HexToBuffer)(this.instance.checksum.getValue('0000')));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.instance.checksum.setValue('0000');
|
|
74
|
+
this.writeBytes(2, Buffer.alloc(2, 0));
|
|
75
|
+
this.addPostSelfEncodeHandler(() => {
|
|
76
|
+
const checksum = (0, NumberToBuffer_1.UInt16ToBuffer)(CDP.#checksum(this.packet.subarray(this.startPos, this.endPos)));
|
|
77
|
+
this.instance.checksum.setValue((0, BufferToHex_1.BufferToHex)(checksum));
|
|
78
|
+
this.writeBytes(2, checksum);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
},
|
|
46
82
|
tlvs: {
|
|
47
83
|
type: 'array',
|
|
48
84
|
label: 'TLVs',
|
|
@@ -50,7 +86,7 @@ class CDP extends BaseHeader_1.BaseHeader {
|
|
|
50
86
|
type: 'object',
|
|
51
87
|
properties: {
|
|
52
88
|
type: { type: 'integer', label: 'Type', minimum: 0, maximum: 65535 },
|
|
53
|
-
length: { type: 'integer', label: 'Length', minimum: 0, maximum: 65535 },
|
|
89
|
+
length: { type: 'integer', label: 'Length', autoCalculated: true, minimum: 0, maximum: 65535 },
|
|
54
90
|
value: { type: 'string', label: 'Value', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
55
91
|
}
|
|
56
92
|
},
|
|
@@ -87,10 +123,10 @@ class CDP extends BaseHeader_1.BaseHeader {
|
|
|
87
123
|
let offset = 4;
|
|
88
124
|
for (const tlv of tlvs) {
|
|
89
125
|
const valueBuffer = (0, HexToBuffer_1.HexToBuffer)(tlv && tlv.value ? String(tlv.value) : '');
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
126
|
+
//Length written as given, 0 included (a crafted TLV may lie); left out, derived
|
|
127
|
+
//from the 4-byte header + value.
|
|
128
|
+
const lengthLeftOut = !tlv || tlv.length === undefined || tlv.length === null;
|
|
129
|
+
const lengthValue = lengthLeftOut ? 4 + valueBuffer.length : (Number(tlv.length) || 0);
|
|
94
130
|
const type = Number(tlv && tlv.type) || 0;
|
|
95
131
|
this.writeBytes(offset, (0, NumberToBuffer_1.UInt16ToBuffer)(type & 0xffff));
|
|
96
132
|
this.writeBytes(offset + 2, (0, NumberToBuffer_1.UInt16ToBuffer)(lengthValue > 65535 ? 65535 : lengthValue));
|
package/dist/headers/CMS.js
CHANGED
|
@@ -66,9 +66,9 @@ class CMS extends BaseHeader_1.BaseHeader {
|
|
|
66
66
|
err: this.#bit('err', 2, 'Err'),
|
|
67
67
|
//bak: reserved.
|
|
68
68
|
bak: this.#bit('bak', 3, 'bak'),
|
|
69
|
-
//Protocol type PI — the low nibble, 0x01 for DL/T 2811.
|
|
69
|
+
//Protocol type PI — the low nibble, 0x01 for DL/T 2811 (the default, and what match() requires).
|
|
70
70
|
protocolType: {
|
|
71
|
-
type: 'integer', label: 'Protocol Type', minimum: 0, maximum: 15,
|
|
71
|
+
type: 'integer', label: 'Protocol Type', minimum: 0, maximum: 15, default: 1,
|
|
72
72
|
decode: function () {
|
|
73
73
|
this.instance.protocolType.setValue(this.readBits(0, 1, 4, 4));
|
|
74
74
|
},
|
|
@@ -79,20 +79,35 @@ class CMS extends BaseHeader_1.BaseHeader {
|
|
|
79
79
|
//Service Code SC (byte 2) — the service in the data area (Table 1).
|
|
80
80
|
serviceCode: this.fieldUInt('serviceCode', 1, 1, 'Service Code'),
|
|
81
81
|
//Frame Length FL (bytes 3-4, LITTLE-ENDIAN) — the APDU length excluding the 4-byte APCH,
|
|
82
|
-
//i.e. the ASDU length.
|
|
82
|
+
//i.e. the ASDU length. Written as given; left out, it is the ASDU this layer writes
|
|
83
|
+
//(ReqID + service data), known once the whole layer is encoded.
|
|
83
84
|
frameLength: {
|
|
84
|
-
type: 'integer', label: 'Frame Length', minimum: 0, maximum: 65535,
|
|
85
|
+
type: 'integer', autoCalculated: true, label: 'Frame Length', minimum: 0, maximum: 65535,
|
|
85
86
|
decode: function () {
|
|
86
87
|
const b = this.readBytes(2, 2);
|
|
87
88
|
this.instance.frameLength.setValue((b[0] | (b[1] << 8)) & 0xffff);
|
|
88
89
|
},
|
|
89
90
|
encode: function () {
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
value =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
const write = (value) => this.writeBytes(2, Buffer.from([value & 0xff, (value >> 8) & 0xff]));
|
|
92
|
+
if (!this.isLeftOut(this.instance.frameLength)) {
|
|
93
|
+
let value = this.instance.frameLength.getValue(0);
|
|
94
|
+
if (value > 65535)
|
|
95
|
+
value = 65535;
|
|
96
|
+
if (value < 0)
|
|
97
|
+
value = 0;
|
|
98
|
+
write(value);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
write(0);
|
|
102
|
+
this.addPostSelfEncodeHandler(() => {
|
|
103
|
+
let value = this.length - 4;
|
|
104
|
+
if (value > 65535) {
|
|
105
|
+
this.recordError(this.instance.frameLength.getPath(), 'Maximum value is 65535');
|
|
106
|
+
value = 65535;
|
|
107
|
+
}
|
|
108
|
+
this.instance.frameLength.setValue(value);
|
|
109
|
+
write(value);
|
|
110
|
+
});
|
|
96
111
|
}
|
|
97
112
|
},
|
|
98
113
|
//==== ASDU ====
|
|
@@ -157,10 +172,10 @@ class CMS extends BaseHeader_1.BaseHeader {
|
|
|
157
172
|
//(DL/T 2811 §6.10) per the Service Code. Populated on decode by the serviceData closure
|
|
158
173
|
//above; it has no encode closure, so `serviceData` (hex) stays the authoritative encode
|
|
159
174
|
//form and the structured view can never perturb the re-emitted bytes.
|
|
160
|
-
serviceDataDecoded: { type: 'object', label: 'Service Data (decoded)' },
|
|
175
|
+
serviceDataDecoded: { type: 'object', label: 'Service Data (decoded)', readOnly: true, properties: {}, additionalProperties: true },
|
|
161
176
|
//Display-only best-effort readable identifiers extracted from a service data area that has
|
|
162
177
|
//no transcribed structure (the GB/T 33603 M-coded responses). No encode closure.
|
|
163
|
-
serviceDataStrings: { type: 'array', label: 'Readable Identifiers', items: { type: 'string' } }
|
|
178
|
+
serviceDataStrings: { type: 'array', label: 'Readable Identifiers', readOnly: true, items: { type: 'string' } }
|
|
164
179
|
}
|
|
165
180
|
};
|
|
166
181
|
}
|
package/dist/headers/COTP.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { HeuristicParent } from '../types/LayerGraph';
|
|
2
3
|
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
4
|
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
5
|
/**
|
|
@@ -25,6 +26,7 @@ export declare class COTP extends BaseHeader {
|
|
|
25
26
|
readonly name: string;
|
|
26
27
|
readonly nickname: string;
|
|
27
28
|
readonly matchKeys: string[];
|
|
29
|
+
readonly heuristicParents: HeuristicParent[];
|
|
28
30
|
match(): boolean;
|
|
29
31
|
readonly demuxProducers: DemuxProducer[];
|
|
30
32
|
}
|
package/dist/headers/COTP.js
CHANGED
|
@@ -32,6 +32,8 @@ class COTP extends BaseHeader_1.BaseHeader {
|
|
|
32
32
|
this.nickname = 'COTP';
|
|
33
33
|
//No demux keys: COTP is an unkeyed content-heuristic child that only rides on top of TPKT.
|
|
34
34
|
this.matchKeys = [];
|
|
35
|
+
//Editor graph: matched by content, so list it under these parents in allowedNextLayers().
|
|
36
|
+
this.heuristicParents = ['tpkt'];
|
|
35
37
|
//Effectively a leaf for now — the session/MMS layers above are kept verbatim and decoded later.
|
|
36
38
|
this.demuxProducers = [];
|
|
37
39
|
}
|
|
@@ -52,6 +54,7 @@ class COTP extends BaseHeader_1.BaseHeader {
|
|
|
52
54
|
//Honoured when supplied; else derived from the PDU Type + any verbatim header bytes.
|
|
53
55
|
li: {
|
|
54
56
|
type: 'integer',
|
|
57
|
+
autoCalculated: true,
|
|
55
58
|
label: 'Length Indicator',
|
|
56
59
|
minimum: 0,
|
|
57
60
|
maximum: 255,
|
|
@@ -59,9 +62,8 @@ class COTP extends BaseHeader_1.BaseHeader {
|
|
|
59
62
|
this.instance.li.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(0, 1)));
|
|
60
63
|
},
|
|
61
64
|
encode: function () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (!value) {
|
|
65
|
+
let value = this.instance.li.getValue(0);
|
|
66
|
+
if (this.isLeftOut(this.instance.li)) {
|
|
65
67
|
const dt = COTP.#isDT(this.instance.pduType.getValue(0));
|
|
66
68
|
const headerRest = (0, HexToBuffer_1.HexToBuffer)(this.instance.headerRest.getValue(''));
|
|
67
69
|
//pduType(1) + (DT ? the EOT/TPDU-NR octet(1) : 0) + verbatim header bytes.
|
|
@@ -76,11 +78,13 @@ class COTP extends BaseHeader_1.BaseHeader {
|
|
|
76
78
|
}
|
|
77
79
|
},
|
|
78
80
|
//Full PDU Type octet (high nibble = type code, low nibble kept verbatim), e.g. DT = 0xF0 = 240.
|
|
79
|
-
|
|
81
|
+
//Default DT (0xF0) with EOT set: the TPDU that carries S7comm / ISO-Session / MMS above it.
|
|
82
|
+
pduType: { ...this.fieldUInt('pduType', 1, 1, 'PDU Type'), default: 0xf0 },
|
|
80
83
|
//DT only: bit 7 of the octet at offset 2 — "end of TSDU". Meaningless for other types (left false).
|
|
81
84
|
eot: {
|
|
82
85
|
type: 'boolean',
|
|
83
86
|
label: 'EOT',
|
|
87
|
+
default: true,
|
|
84
88
|
decode: function () {
|
|
85
89
|
const dt = COTP.#isDT(this.instance.pduType.getValue(0));
|
|
86
90
|
this.instance.eot.setValue(dt ? !!this.readBits(2, 1, 0, 1) : false);
|
package/dist/headers/CoAP.js
CHANGED
|
@@ -78,9 +78,27 @@ class CoAP extends BaseHeader_1.BaseHeader {
|
|
|
78
78
|
summary: 'CoAP type=${type} code=${code}',
|
|
79
79
|
properties: {
|
|
80
80
|
//Byte 0 (MSB first): Version (bits 7:6, always 1), Type (bits 5:4), Token Length (bits 3:0).
|
|
81
|
-
version:
|
|
81
|
+
//Default version 1: the only CoAP version (RFC 7252), and what match() requires.
|
|
82
|
+
version: { ...this.#bitField('version', 0, 2, 3, 'Version'), default: 1 },
|
|
82
83
|
type: this.#bitField('type', 2, 2, 3, 'Type'),
|
|
83
|
-
|
|
84
|
+
//Written as given (a crafted TKL may disagree with the token); left out, the token's octet count.
|
|
85
|
+
tokenLength: {
|
|
86
|
+
...this.#bitField('tokenLength', 4, 4, 15, 'Token Length'),
|
|
87
|
+
autoCalculated: true,
|
|
88
|
+
encode: function () {
|
|
89
|
+
if (!this.isLeftOut(this.instance.tokenLength)) {
|
|
90
|
+
this.writeBits(0, 1, 4, 4, this.instance.tokenLength.getValue(0));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
let tokenLength = (0, HexToBuffer_1.HexToBuffer)(this.instance.token.getValue('')).length;
|
|
94
|
+
if (tokenLength > 8)
|
|
95
|
+
this.recordError(this.instance.tokenLength.getPath(), 'A CoAP token is at most 8 octets (RFC 7252 section 3)');
|
|
96
|
+
if (tokenLength > 15)
|
|
97
|
+
tokenLength = 15;
|
|
98
|
+
this.instance.tokenLength.setValue(tokenLength);
|
|
99
|
+
this.writeBits(0, 1, 4, 4, tokenLength);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
84
102
|
//Byte 1: Code — a 3-bit class and 5-bit detail packed as one octet (e.g. 0x01 = 0.01 GET).
|
|
85
103
|
code: this.fieldUInt('code', 1, 1, 'Code'),
|
|
86
104
|
//Bytes 2-3: Message ID (big-endian uint16).
|
package/dist/headers/Codesys.js
CHANGED
package/dist/headers/Collectd.js
CHANGED
|
@@ -51,7 +51,7 @@ class Collectd extends BaseHeader_1.BaseHeader {
|
|
|
51
51
|
type: { type: 'integer', label: 'Type', minimum: 0, maximum: 65535 },
|
|
52
52
|
//On-wire Length INCLUDING the 4-byte part header (Type + Length). Honored
|
|
53
53
|
//verbatim on encode; derived as 4 + value bytes when omitted.
|
|
54
|
-
length: { type: 'integer', label: 'Length', minimum: 0, maximum: 65535 },
|
|
54
|
+
length: { type: 'integer', label: 'Length', autoCalculated: true, minimum: 0, maximum: 65535 },
|
|
55
55
|
value: { type: 'string', label: 'Value', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
56
56
|
}
|
|
57
57
|
},
|
package/dist/headers/DCCP.d.ts
CHANGED
|
@@ -15,8 +15,9 @@ import { DemuxProducer } from '../types/DemuxProducer';
|
|
|
15
15
|
* the header — Reserved, the Sequence/Ack numbers, per-type fields and options — verbatim as
|
|
16
16
|
* `headerOptions` hex (bytes 9 .. DataOffset*4). Application data after the header is kept as `payload`
|
|
17
17
|
* hex, bounded by the enclosing IP datagram so an inflated Data Offset can't read past the IP payload.
|
|
18
|
-
* The Checksum
|
|
19
|
-
* from the actual bytes. A well-formed datagram round-trips
|
|
18
|
+
* The Checksum and Data Offset are computed on encode when left out (the checksum per RFC 4340 §9, Data
|
|
19
|
+
* Offset from the actual bytes) and written as given otherwise. A well-formed datagram round-trips
|
|
20
|
+
* byte-for-byte.
|
|
20
21
|
*/
|
|
21
22
|
export declare class DCCP extends BaseHeader {
|
|
22
23
|
#private;
|
package/dist/headers/DCCP.js
CHANGED
|
@@ -4,7 +4,9 @@ exports.DCCP = void 0;
|
|
|
4
4
|
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
5
5
|
const BufferToHex_1 = require("../helper/BufferToHex");
|
|
6
6
|
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
7
|
+
const BufferToNumber_1 = require("../helper/BufferToNumber");
|
|
7
8
|
const NumberToBuffer_1 = require("../helper/NumberToBuffer");
|
|
9
|
+
const Checksum_1 = require("../helper/Checksum");
|
|
8
10
|
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
9
11
|
/**
|
|
10
12
|
* DCCP — Datagram Congestion Control Protocol (RFC 4340), carried directly over IP as protocol 33. The
|
|
@@ -20,8 +22,9 @@ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
|
20
22
|
* the header — Reserved, the Sequence/Ack numbers, per-type fields and options — verbatim as
|
|
21
23
|
* `headerOptions` hex (bytes 9 .. DataOffset*4). Application data after the header is kept as `payload`
|
|
22
24
|
* hex, bounded by the enclosing IP datagram so an inflated Data Offset can't read past the IP payload.
|
|
23
|
-
* The Checksum
|
|
24
|
-
* from the actual bytes. A well-formed datagram round-trips
|
|
25
|
+
* The Checksum and Data Offset are computed on encode when left out (the checksum per RFC 4340 §9, Data
|
|
26
|
+
* Offset from the actual bytes) and written as given otherwise. A well-formed datagram round-trips
|
|
27
|
+
* byte-for-byte.
|
|
25
28
|
*/
|
|
26
29
|
class DCCP extends BaseHeader_1.BaseHeader {
|
|
27
30
|
constructor() {
|
|
@@ -73,6 +76,28 @@ class DCCP extends BaseHeader_1.BaseHeader {
|
|
|
73
76
|
end = 0;
|
|
74
77
|
return end;
|
|
75
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* The DCCP checksum (RFC 4340 §9): the Internet checksum of the nearest IP layer's pseudo-header
|
|
81
|
+
* (protocol 33, length = the whole DCCP packet), the DCCP header and the application data Checksum
|
|
82
|
+
* Coverage selects — all of it when CsCov is 0, else the first (CsCov - 1) × 4 bytes after the Data
|
|
83
|
+
* Offset × 4 header, capped at the packet. Called once every field is written, checksum still zero.
|
|
84
|
+
*/
|
|
85
|
+
#calculateChecksum() {
|
|
86
|
+
const packet = this.packet.subarray(this.startPos, this.endPos);
|
|
87
|
+
const pseudoHeader = this.ipPseudoHeader(33, packet.length);
|
|
88
|
+
if (!pseudoHeader) {
|
|
89
|
+
this.recordError(this.instance.checksum.getPath(), 'Cannot compute DCCP checksum: no IP layer beneath DCCP');
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
const cscov = this.instance.cscov.getValue(0);
|
|
93
|
+
let covered = packet.length;
|
|
94
|
+
if (cscov) {
|
|
95
|
+
const coverage = (this.instance.dataOffset.getValue(0) + cscov - 1) * 4;
|
|
96
|
+
if (coverage < covered)
|
|
97
|
+
covered = coverage;
|
|
98
|
+
}
|
|
99
|
+
return (0, Checksum_1.InternetChecksum)(pseudoHeader, packet.subarray(0, covered));
|
|
100
|
+
}
|
|
76
101
|
/** A big-endian bit-slice within a single octet at `offset`, read/written in place. */
|
|
77
102
|
static #bitField(name, offset, bitOffset, bitLength, label) {
|
|
78
103
|
const maximum = (2 ** bitLength) - 1;
|
|
@@ -105,9 +130,11 @@ class DCCP extends BaseHeader_1.BaseHeader {
|
|
|
105
130
|
dstPort: this.fieldUInt('dstPort', 2, 2, 'Destination Port'),
|
|
106
131
|
//Data Offset (32-bit words) = the length of the whole DCCP header incl. options. Honored
|
|
107
132
|
//when supplied (a crafted datagram may lie); else derived from the fixed 9-byte prefix
|
|
108
|
-
//plus the verbatim headerOptions bytes, rounded up to a word
|
|
133
|
+
//plus the verbatim headerOptions bytes, rounded up to a word, and the header is
|
|
134
|
+
//zero-filled up to that word so it is as long as the Data Offset says.
|
|
109
135
|
dataOffset: {
|
|
110
136
|
type: 'integer',
|
|
137
|
+
autoCalculated: true,
|
|
111
138
|
label: 'Data Offset',
|
|
112
139
|
minimum: 0,
|
|
113
140
|
maximum: 255,
|
|
@@ -121,8 +148,10 @@ class DCCP extends BaseHeader_1.BaseHeader {
|
|
|
121
148
|
value = provided;
|
|
122
149
|
}
|
|
123
150
|
else {
|
|
124
|
-
const
|
|
125
|
-
value = Math.ceil(
|
|
151
|
+
const headerBytes = 9 + (0, HexToBuffer_1.HexToBuffer)(this.instance.headerOptions.getValue('')).length;
|
|
152
|
+
value = Math.ceil(headerBytes / 4);
|
|
153
|
+
if (value * 4 > headerBytes)
|
|
154
|
+
this.writeBytes(headerBytes, Buffer.alloc(value * 4 - headerBytes, 0));
|
|
126
155
|
}
|
|
127
156
|
if (value > 255) {
|
|
128
157
|
this.recordError(this.instance.dataOffset.getPath(), 'Maximum value is 255');
|
|
@@ -137,9 +166,33 @@ class DCCP extends BaseHeader_1.BaseHeader {
|
|
|
137
166
|
//Byte 5: CCVal (high 4 bits) + CsCov (low 4 bits).
|
|
138
167
|
ccval: this.#bitField('ccval', 5, 0, 4, 'CCVal'),
|
|
139
168
|
cscov: this.#bitField('cscov', 5, 4, 4, 'Checksum Coverage'),
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
checksum:
|
|
169
|
+
//Left out, computed once every field is written (#calculateChecksum); a given value is
|
|
170
|
+
//written as given, so a captured datagram round-trips byte-for-byte.
|
|
171
|
+
checksum: {
|
|
172
|
+
type: 'integer',
|
|
173
|
+
autoCalculated: true,
|
|
174
|
+
label: 'Checksum',
|
|
175
|
+
minimum: 0,
|
|
176
|
+
maximum: 65535,
|
|
177
|
+
decode: function () {
|
|
178
|
+
this.instance.checksum.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(6, 2)));
|
|
179
|
+
},
|
|
180
|
+
encode: function () {
|
|
181
|
+
if (!this.isLeftOut(this.instance.checksum)) {
|
|
182
|
+
const checksum = this.instance.checksum.getValue(0);
|
|
183
|
+
this.instance.checksum.setValue(checksum);
|
|
184
|
+
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.instance.checksum.setValue(0);
|
|
188
|
+
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(0));
|
|
189
|
+
this.addPostSelfEncodeHandler(() => {
|
|
190
|
+
const checksum = this.#calculateChecksum();
|
|
191
|
+
this.instance.checksum.setValue(checksum);
|
|
192
|
+
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
},
|
|
143
196
|
//Byte 8: Res (3 bits) + Type (4 bits) + X (1 bit, Extended Sequence Numbers).
|
|
144
197
|
res: this.#bitField('res', 8, 0, 3, 'Reserved'),
|
|
145
198
|
type: this.#bitField('type', 8, 3, 4, 'Type'),
|
package/dist/headers/DNP3.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ import { DemuxProducer } from '../types/DemuxProducer';
|
|
|
11
11
|
*
|
|
12
12
|
* This codec decodes the link header structurally and keeps the data-block region (transport header +
|
|
13
13
|
* application data + the per-block CRCs) verbatim as `payload` hex — de-blocking those CRCs to recover
|
|
14
|
-
* the transport/application layer is a cross-frame reassembly concern, not a single-packet one. The
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* the transport/application layer is a cross-frame reassembly concern, not a single-packet one. The block
|
|
15
|
+
* CRCs stay inside `payload` exactly as given. Length and the header CRC are written as given; left out,
|
|
16
|
+
* Length counts the payload's data octets (its block CRCs excluded) and the header CRC is computed
|
|
17
|
+
* (CRC-16/DNP over the first 8 octets). A well-formed frame round-trips byte-for-byte; the frame's extent is
|
|
18
|
+
* derived from the Length field so a pipelined/trailing frame is left to RawData.
|
|
17
19
|
*/
|
|
18
20
|
export declare class DNP3 extends BaseHeader {
|
|
19
21
|
#private;
|
package/dist/headers/DNP3.js
CHANGED
|
@@ -5,6 +5,9 @@ const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
|
5
5
|
const BufferToHex_1 = require("../helper/BufferToHex");
|
|
6
6
|
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
7
7
|
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
8
|
+
const BufferToNumber_1 = require("../helper/BufferToNumber");
|
|
9
|
+
const NumberToBuffer_1 = require("../helper/NumberToBuffer");
|
|
10
|
+
const Crc_1 = require("../helper/Crc");
|
|
8
11
|
/**
|
|
9
12
|
* DNP3 — Distributed Network Protocol 3 (IEEE 1815), a SCADA protocol common in electric/water
|
|
10
13
|
* utilities, on TCP/UDP port 20000. Each frame begins with a 10-byte Data Link Layer header: the start
|
|
@@ -15,9 +18,11 @@ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
|
15
18
|
*
|
|
16
19
|
* This codec decodes the link header structurally and keeps the data-block region (transport header +
|
|
17
20
|
* application data + the per-block CRCs) verbatim as `payload` hex — de-blocking those CRCs to recover
|
|
18
|
-
* the transport/application layer is a cross-frame reassembly concern, not a single-packet one. The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
+
* the transport/application layer is a cross-frame reassembly concern, not a single-packet one. The block
|
|
22
|
+
* CRCs stay inside `payload` exactly as given. Length and the header CRC are written as given; left out,
|
|
23
|
+
* Length counts the payload's data octets (its block CRCs excluded) and the header CRC is computed
|
|
24
|
+
* (CRC-16/DNP over the first 8 octets). A well-formed frame round-trips byte-for-byte; the frame's extent is
|
|
25
|
+
* derived from the Length field so a pipelined/trailing frame is left to RawData.
|
|
21
26
|
*/
|
|
22
27
|
class DNP3 extends BaseHeader_1.BaseHeader {
|
|
23
28
|
constructor() {
|
|
@@ -56,13 +61,44 @@ class DNP3 extends BaseHeader_1.BaseHeader {
|
|
|
56
61
|
const blocks = Math.ceil(userData / 16);
|
|
57
62
|
return 10 + userData + blocks * 2;
|
|
58
63
|
}
|
|
64
|
+
/** The user data octets a data-block region of `payloadOctets` carries: every block is up to 16 data
|
|
65
|
+
* octets followed by their 2-octet CRC. A trailing block too short to hold a data octet and its CRC
|
|
66
|
+
* (malformed) contributes none. */
|
|
67
|
+
static #userDataOctets(payloadOctets) {
|
|
68
|
+
const rest = payloadOctets % 18;
|
|
69
|
+
return Math.floor(payloadOctets / 18) * 16 + (rest > 2 ? rest - 2 : 0);
|
|
70
|
+
}
|
|
59
71
|
static #buildSchema() {
|
|
60
72
|
return {
|
|
61
73
|
type: 'object',
|
|
62
74
|
summary: 'DNP3 func=${control.functionCode} ${source}->${destination}',
|
|
63
75
|
properties: {
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
//Default 0x0564: the start octets every DNP3 frame begins with, and what match() requires.
|
|
77
|
+
start: { ...this.fieldHex('start', 0, 2, 'Start'), default: '0564' },
|
|
78
|
+
//Octets from Control through the user data, the block CRCs excluded: 5 + user data octets.
|
|
79
|
+
length: {
|
|
80
|
+
type: 'integer',
|
|
81
|
+
autoCalculated: true,
|
|
82
|
+
label: 'Length',
|
|
83
|
+
minimum: 0,
|
|
84
|
+
maximum: 255,
|
|
85
|
+
decode: function () {
|
|
86
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(2, 1)));
|
|
87
|
+
},
|
|
88
|
+
encode: function () {
|
|
89
|
+
if (!this.isLeftOut(this.instance.length)) {
|
|
90
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.length.getValue(0)));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
let length = 5 + DNP3.#userDataOctets((0, HexToBuffer_1.HexToBuffer)(this.instance.payload.getValue('')).length);
|
|
94
|
+
if (length > 255) {
|
|
95
|
+
this.recordError(this.instance.length.getPath(), 'Maximum value is 255');
|
|
96
|
+
length = 255;
|
|
97
|
+
}
|
|
98
|
+
this.instance.length.setValue(length);
|
|
99
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt8ToBuffer)(length));
|
|
100
|
+
}
|
|
101
|
+
},
|
|
66
102
|
//Control octet (byte 3, MSB first): DIR / PRM / FCB / FCV(or DFC) / Function Code(4 bits).
|
|
67
103
|
control: {
|
|
68
104
|
type: 'object',
|
|
@@ -111,8 +147,27 @@ class DNP3 extends BaseHeader_1.BaseHeader {
|
|
|
111
147
|
this.writeBytes(6, Buffer.from([value & 0xff, (value >> 8) & 0xff]));
|
|
112
148
|
}
|
|
113
149
|
},
|
|
114
|
-
//Header CRC over the preceding 8 octets,
|
|
115
|
-
|
|
150
|
+
//Header CRC: CRC-16/DNP over the preceding 8 octets (start through source), low octet first.
|
|
151
|
+
//Those octets are all written when this runs, so a left-out CRC is computed right here.
|
|
152
|
+
headerCrc: {
|
|
153
|
+
type: 'string',
|
|
154
|
+
autoCalculated: true,
|
|
155
|
+
label: 'Header CRC',
|
|
156
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
157
|
+
decode: function () {
|
|
158
|
+
this.instance.headerCrc.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(8, 2)));
|
|
159
|
+
},
|
|
160
|
+
encode: function () {
|
|
161
|
+
if (!this.isLeftOut(this.instance.headerCrc)) {
|
|
162
|
+
this.writeBytes(8, (0, HexToBuffer_1.HexToBuffer)(this.instance.headerCrc.getValue()));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const crc = (0, Crc_1.Crc16Dnp)(this.readBytes(0, 8));
|
|
166
|
+
const crcBuffer = Buffer.from([crc & 0xff, (crc >> 8) & 0xff]);
|
|
167
|
+
this.instance.headerCrc.setValue((0, BufferToHex_1.BufferToHex)(crcBuffer));
|
|
168
|
+
this.writeBytes(8, crcBuffer);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
116
171
|
//The data-block region: transport header + application data + per-block CRCs, kept verbatim.
|
|
117
172
|
//Bounded by the Length-derived frame extent so a pipelined/trailing frame is left to raw.
|
|
118
173
|
payload: {
|
package/dist/headers/DNS.js
CHANGED
|
@@ -76,7 +76,7 @@ class DNS extends BaseHeader_1.BaseHeader {
|
|
|
76
76
|
label: 'Name',
|
|
77
77
|
properties: {
|
|
78
78
|
value: { type: 'string', label: 'Name' },
|
|
79
|
-
raw: { type: 'string', label: 'Raw', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true }
|
|
79
|
+
raw: { type: 'string', label: 'Raw', autoCalculated: true, contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true }
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
return {
|
|
@@ -164,7 +164,7 @@ class DNS extends BaseHeader_1.BaseHeader {
|
|
|
164
164
|
label: 'Name',
|
|
165
165
|
properties: {
|
|
166
166
|
value: { type: 'string', label: 'Name' },
|
|
167
|
-
raw: { type: 'string', label: 'Raw', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true }
|
|
167
|
+
raw: { type: 'string', label: 'Raw', autoCalculated: true, contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true }
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
return {
|
|
@@ -178,7 +178,7 @@ class DNS extends BaseHeader_1.BaseHeader {
|
|
|
178
178
|
type: { type: 'integer', label: 'Type', minimum: 0, maximum: 65535 },
|
|
179
179
|
class: { type: 'integer', label: 'Class', minimum: 0, maximum: 65535 },
|
|
180
180
|
ttl: { type: 'integer', label: 'Time to Live', minimum: 0, maximum: 4294967295 },
|
|
181
|
-
rdlength: { type: 'integer', label: 'Data Length', minimum: 0, maximum: 65535 },
|
|
181
|
+
rdlength: { type: 'integer', label: 'Data Length', readOnly: true, minimum: 0, maximum: 65535 },
|
|
182
182
|
rdata: { type: 'string', label: 'Data', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
183
183
|
}
|
|
184
184
|
},
|
package/dist/headers/DTLS.js
CHANGED
package/dist/headers/Diameter.js
CHANGED
|
@@ -68,6 +68,7 @@ class Diameter extends BaseHeader_1.BaseHeader {
|
|
|
68
68
|
version: this.fieldUInt('version', 0, 1, 'Version'),
|
|
69
69
|
messageLength: {
|
|
70
70
|
type: 'integer',
|
|
71
|
+
autoCalculated: true,
|
|
71
72
|
label: 'Message Length',
|
|
72
73
|
minimum: 0,
|
|
73
74
|
maximum: 16777215,
|
|
@@ -129,10 +130,10 @@ class Diameter extends BaseHeader_1.BaseHeader {
|
|
|
129
130
|
properties: {
|
|
130
131
|
code: { type: 'integer', label: 'AVP Code', minimum: 0, maximum: 4294967295 },
|
|
131
132
|
flags: { type: 'integer', label: 'AVP Flags', minimum: 0, maximum: 255 },
|
|
132
|
-
length: { type: 'integer', label: 'AVP Length', minimum: 0, maximum: 16777215 },
|
|
133
|
+
length: { type: 'integer', label: 'AVP Length', autoCalculated: true, minimum: 0, maximum: 16777215 },
|
|
133
134
|
vendorId: { type: 'integer', label: 'Vendor-Id', minimum: 0, maximum: 4294967295 },
|
|
134
135
|
data: { type: 'string', label: 'Data', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX },
|
|
135
|
-
padding: { type: 'string', label: 'Padding', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
136
|
+
padding: { type: 'string', label: 'Padding', autoCalculated: true, contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
136
137
|
}
|
|
137
138
|
},
|
|
138
139
|
decode: function () {
|
package/dist/headers/EAPOL.js
CHANGED
|
@@ -52,7 +52,6 @@ class EAPOL extends BaseHeader_1.BaseHeader {
|
|
|
52
52
|
label: 'Packet Type',
|
|
53
53
|
minimum: 0,
|
|
54
54
|
maximum: 255,
|
|
55
|
-
enum: [0, 1, 2, 3, 4],
|
|
56
55
|
decode: function () {
|
|
57
56
|
this.instance.packetType.setValue(this.readBytes(1, 1)[0]);
|
|
58
57
|
},
|
|
@@ -72,6 +71,7 @@ class EAPOL extends BaseHeader_1.BaseHeader {
|
|
|
72
71
|
},
|
|
73
72
|
bodyLength: {
|
|
74
73
|
type: 'integer',
|
|
74
|
+
autoCalculated: true,
|
|
75
75
|
label: 'Body Length',
|
|
76
76
|
minimum: 0,
|
|
77
77
|
maximum: 65535,
|