@netkitty/codec 2.1.0 → 2.3.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 +249 -0
- package/README.md +30 -1
- package/README.zh-CN.md +26 -1
- package/dist/Codec.d.ts +25 -7
- package/dist/Codec.js +151 -18
- package/dist/PacketHeaders.d.ts +2 -0
- package/dist/PacketHeaders.js +8 -4
- package/dist/abstracts/BaseHeader.d.ts +34 -0
- package/dist/abstracts/BaseHeader.js +43 -0
- package/dist/headers/ARP.d.ts +3 -1
- package/dist/headers/ARP.js +8 -1
- package/dist/headers/BACnetIP.js +2 -1
- package/dist/headers/BGP.js +3 -2
- package/dist/headers/Babel.js +1 -1
- package/dist/headers/Codesys.js +3 -2
- package/dist/headers/DHCP.js +2 -1
- package/dist/headers/DNP3.d.ts +12 -7
- package/dist/headers/DNP3.js +98 -18
- package/dist/headers/DTLS.js +5 -3
- package/dist/headers/Diameter.js +2 -1
- package/dist/headers/Elasticsearch.js +3 -2
- package/dist/headers/EthernetII.d.ts +1 -0
- package/dist/headers/EthernetII.js +3 -0
- package/dist/headers/Goose.d.ts +31 -7
- package/dist/headers/Goose.js +409 -168
- package/dist/headers/HARTIP.js +2 -2
- package/dist/headers/ICMP.d.ts +1 -0
- package/dist/headers/ICMP.js +9 -1
- package/dist/headers/ICMPv6.d.ts +1 -0
- package/dist/headers/ICMPv6.js +1 -0
- package/dist/headers/IEC104_I_Frame.d.ts +28 -0
- package/dist/headers/IEC104_I_Frame.js +246 -160
- package/dist/headers/IEC104_S_Frame.js +3 -3
- package/dist/headers/IEC104_U_Frame.js +5 -3
- package/dist/headers/IEC61850SampledValues.d.ts +1 -0
- package/dist/headers/IEC61850SampledValues.js +16 -1
- package/dist/headers/IPFIX.js +2 -1
- package/dist/headers/IPv4.d.ts +1 -0
- package/dist/headers/IPv4.js +6 -0
- package/dist/headers/IPv6.d.ts +1 -0
- package/dist/headers/IPv6.js +6 -0
- package/dist/headers/IPv6HopByHopOptions.d.ts +2 -0
- package/dist/headers/IPv6HopByHopOptions.js +11 -0
- package/dist/headers/KNXnetIP.js +3 -2
- package/dist/headers/LACP.js +2 -1
- package/dist/headers/LDP.js +2 -2
- package/dist/headers/MQTT.js +3 -1
- package/dist/headers/MarkerProtocol.js +2 -1
- package/dist/headers/NHRP.js +7 -15
- package/dist/headers/NetFlowV5.js +2 -1
- package/dist/headers/OPCUA.js +4 -0
- package/dist/headers/OSPF.d.ts +2 -2
- package/dist/headers/OSPF.js +32 -20
- package/dist/headers/OSPFv3.d.ts +38 -0
- package/dist/headers/OSPFv3.js +316 -0
- package/dist/headers/PPTP.js +2 -2
- package/dist/headers/QUIC.js +8 -3
- package/dist/headers/RGoose.js +2 -1
- package/dist/headers/RIP.js +3 -2
- package/dist/headers/RIPng.js +3 -2
- package/dist/headers/RTCP.js +3 -2
- package/dist/headers/RTP.js +3 -2
- package/dist/headers/SFlow.js +4 -2
- package/dist/headers/SLMP.js +2 -1
- package/dist/headers/SLP.js +2 -1
- package/dist/headers/SLPv1.js +2 -1
- package/dist/headers/SMB1.js +3 -2
- package/dist/headers/SMB2.js +3 -2
- package/dist/headers/STUN.js +2 -1
- package/dist/headers/TLS_Handshake.d.ts +6 -0
- package/dist/headers/TLS_Handshake.js +28 -3
- package/dist/headers/TacacsPlus.js +3 -1
- package/dist/headers/Trailer.d.ts +30 -0
- package/dist/headers/Trailer.js +63 -0
- package/dist/headers/VLAN_802dot1Q.d.ts +1 -0
- package/dist/headers/VLAN_802dot1Q.js +3 -0
- package/dist/headers/WakeOnLAN.js +2 -1
- package/dist/headers/WireGuard.js +3 -2
- package/dist/headers/Zabbix.js +2 -2
- package/dist/lib/BERElement.d.ts +51 -0
- package/dist/lib/BERElement.js +125 -0
- package/dist/types/LayerGraph.d.ts +10 -5
- package/package.json +2 -2
package/dist/headers/HARTIP.js
CHANGED
|
@@ -61,8 +61,8 @@ class HARTIP extends BaseHeader_1.BaseHeader {
|
|
|
61
61
|
summary: 'HART-IP type=${messageType} id=${messageId} seq=${sequenceNumber}',
|
|
62
62
|
properties: {
|
|
63
63
|
//Protocol version — 1 for the current HART-IP specification. Kept verbatim so a crafted
|
|
64
|
-
//message with any version still round-trips.
|
|
65
|
-
version: this.fieldUInt('version', 0, 1, 'Version'),
|
|
64
|
+
//message with any version still round-trips. Default 1: what match() requires.
|
|
65
|
+
version: { ...this.fieldUInt('version', 0, 1, 'Version'), default: 1 },
|
|
66
66
|
//0 Request, 1 Response, 2 Publish/Notify, 3 NAK. Kept as a plain clamped byte (not an Ajv
|
|
67
67
|
//enum) so any non-conformant / crafted value decoded from the wire still re-encodes
|
|
68
68
|
//without throwing — decode never fails and encode is a faithful executor.
|
package/dist/headers/ICMP.d.ts
CHANGED
package/dist/headers/ICMP.js
CHANGED
|
@@ -107,6 +107,8 @@ class ICMP extends BaseHeader_1.BaseHeader {
|
|
|
107
107
|
};
|
|
108
108
|
this.id = 'icmp';
|
|
109
109
|
this.matchKeys = ['ipproto:1'];
|
|
110
|
+
//ICMP is for IPv4 (ICMPv6 is a separate protocol, 58).
|
|
111
|
+
this.ipVersions = [4];
|
|
110
112
|
this.name = 'Internet Control Message Protocol';
|
|
111
113
|
this.nickname = 'ICMP';
|
|
112
114
|
}
|
|
@@ -144,7 +146,13 @@ class ICMP extends BaseHeader_1.BaseHeader {
|
|
|
144
146
|
match() {
|
|
145
147
|
if (!this.prevCodecModule)
|
|
146
148
|
return false;
|
|
147
|
-
|
|
149
|
+
//Protocol 1 from the IPv4 header itself, or Next Header 1 from AH after an IPv4 header.
|
|
150
|
+
if (this.prevCodecModule.instance.protocol.getValue() === 0x01)
|
|
151
|
+
return true;
|
|
152
|
+
if (this.prevCodecModule.instance.nxt.getValue() !== 0x01)
|
|
153
|
+
return false;
|
|
154
|
+
const ip = this.nearestIPModule();
|
|
155
|
+
return !!ip && ip.id === 'ipv4';
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
158
|
exports.ICMP = ICMP;
|
package/dist/headers/ICMPv6.d.ts
CHANGED
package/dist/headers/ICMPv6.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
2
2
|
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
+
/** The fields of a CP56Time2a time tag, as the time-tagged IOA items carry them. */
|
|
4
|
+
type CP56Time2a = {
|
|
5
|
+
Milliseconds: number;
|
|
6
|
+
Minutes: number;
|
|
7
|
+
GEN: number;
|
|
8
|
+
MIN_IV: number;
|
|
9
|
+
Hours: number;
|
|
10
|
+
SU: number;
|
|
11
|
+
Day: number;
|
|
12
|
+
DOW: number;
|
|
13
|
+
Month: number;
|
|
14
|
+
Year: number;
|
|
15
|
+
};
|
|
3
16
|
export declare class IEC104_I_Frame extends BaseHeader {
|
|
4
17
|
/**
|
|
5
18
|
* True when decode preserved an unparsed ASDU (unknown/unsupported type id) and no
|
|
@@ -7,12 +20,26 @@ export declare class IEC104_I_Frame extends BaseHeader {
|
|
|
7
20
|
* supplying structured IOA turns this false and encode rebuilds from fields.
|
|
8
21
|
*/
|
|
9
22
|
protected asduRawFallbackActive(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The number of IOA items encode writes: one per information object (SQ=0) or element (SQ=1).
|
|
25
|
+
*/
|
|
26
|
+
protected ioaItemCount(): number;
|
|
10
27
|
/**
|
|
11
28
|
* Write an information object's 3-octet address. SQ=0 frames carry a per-object address; SQ=1
|
|
12
29
|
* frames carry a single base address (before the first element) with the rest implied by
|
|
13
30
|
* incrementing, so only object 1 writes it.
|
|
14
31
|
*/
|
|
15
32
|
protected writeIOAAddress(offset: number, buffer: Buffer, i: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Read a 7-octet CP56Time2a (IEC 60870-5-4, IEC 60870-5-101 7.2.6.18) at `offset`: milliseconds (2
|
|
35
|
+
* octets, little-endian), minutes with GEN and IV in bits 7 and 8, hours with SU in bit 8, day of month
|
|
36
|
+
* with day of week in bits 6-8, month, year.
|
|
37
|
+
*/
|
|
38
|
+
protected readCP56Time2a(offset: number): CP56Time2a;
|
|
39
|
+
/**
|
|
40
|
+
* Write a 7-octet CP56Time2a at `offset`, the inverse of readCP56Time2a.
|
|
41
|
+
*/
|
|
42
|
+
protected writeCP56Time2a(offset: number, time: CP56Time2a): void;
|
|
16
43
|
SCHEMA: ProtocolJSONSchema;
|
|
17
44
|
id: string;
|
|
18
45
|
readonly matchKeys: string[];
|
|
@@ -21,3 +48,4 @@ export declare class IEC104_I_Frame extends BaseHeader {
|
|
|
21
48
|
nickname: string;
|
|
22
49
|
match(): boolean;
|
|
23
50
|
}
|
|
51
|
+
export {};
|