netkitty 0.0.17 → 0.0.19
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/dist/CodecExports.d.ts +33 -0
- package/dist/CodecExports.d.ts.map +1 -0
- package/dist/CodecExports.js +23 -0
- package/dist/CodecHeaderExports.d.ts +2 -0
- package/dist/CodecHeaderExports.d.ts.map +1 -0
- package/dist/CodecHeaderExports.js +17 -0
- package/dist/HelperExports.d.ts +11 -0
- package/dist/HelperExports.d.ts.map +1 -0
- package/dist/HelperExports.js +72 -0
- package/dist/NetKitty.d.ts +1 -0
- package/dist/NetKitty.d.ts.map +1 -0
- package/dist/NetKitty.js +90 -0
- package/dist/NetworkExports.d.ts +13 -0
- package/dist/NetworkExports.d.ts.map +1 -0
- package/dist/NetworkExports.js +13 -0
- package/dist/PcapExports.d.ts +17 -0
- package/dist/PcapExports.d.ts.map +1 -0
- package/dist/PcapExports.js +18 -0
- package/dist/errors/ActionNotFoundError.d.ts +5 -0
- package/dist/errors/ActionNotFoundError.d.ts.map +1 -0
- package/dist/errors/ActionNotFoundError.js +12 -0
- package/dist/errors/CodecSchemaValidateError.d.ts +5 -0
- package/dist/errors/CodecSchemaValidateError.d.ts.map +1 -0
- package/dist/errors/CodecSchemaValidateError.js +12 -0
- package/dist/errors/DeviceNotFoundError.d.ts +5 -0
- package/dist/errors/DeviceNotFoundError.d.ts.map +1 -0
- package/dist/errors/DeviceNotFoundError.js +12 -0
- package/dist/errors/NoAvailableCodecError.d.ts +5 -0
- package/dist/errors/NoAvailableCodecError.d.ts.map +1 -0
- package/dist/errors/NoAvailableCodecError.js +12 -0
- package/dist/errors/NpcapLoadError.d.ts +5 -0
- package/dist/errors/NpcapLoadError.d.ts.map +1 -0
- package/dist/errors/NpcapLoadError.js +12 -0
- package/dist/errors/SocketDownError.d.ts +5 -0
- package/dist/errors/SocketDownError.d.ts.map +1 -0
- package/dist/errors/SocketDownError.js +12 -0
- package/dist/errors/UnknownPipeMessageTypeError.d.ts +5 -0
- package/dist/errors/UnknownPipeMessageTypeError.d.ts.map +1 -0
- package/dist/errors/UnknownPipeMessageTypeError.js +12 -0
- package/dist/errors/common/ErrorCode.d.ts +31 -0
- package/dist/errors/common/ErrorCode.d.ts.map +1 -0
- package/dist/errors/common/ErrorCode.js +33 -0
- package/dist/lib/GeneratePipeAddress.d.ts +7 -0
- package/dist/lib/GeneratePipeAddress.d.ts.map +1 -0
- package/dist/lib/GeneratePipeAddress.js +23 -0
- package/dist/lib/GetBinding.d.ts +2 -0
- package/dist/lib/GetBinding.d.ts.map +1 -0
- package/dist/lib/GetBinding.js +6 -0
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts +7 -0
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts.map +1 -0
- package/dist/lib/GetCaptureTemporaryDirectory.js +15 -0
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts +8 -0
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts.map +1 -0
- package/dist/lib/GetDeviceCaptureTemporaryFilename.js +18 -0
- package/dist/lib/codec/Codec.d.ts +32 -0
- package/dist/lib/codec/Codec.d.ts.map +1 -0
- package/dist/lib/codec/Codec.js +183 -0
- package/dist/lib/codec/PacketHeaders.d.ts +14 -0
- package/dist/lib/codec/PacketHeaders.d.ts.map +1 -0
- package/dist/lib/codec/PacketHeaders.js +29 -0
- package/dist/lib/codec/abstracts/BaseHeader.d.ts +217 -0
- package/dist/lib/codec/abstracts/BaseHeader.d.ts.map +1 -0
- package/dist/lib/codec/abstracts/BaseHeader.js +356 -0
- package/dist/lib/codec/headers/ARP.d.ts +10 -0
- package/dist/lib/codec/headers/ARP.d.ts.map +1 -0
- package/dist/lib/codec/headers/ARP.js +224 -0
- package/dist/lib/codec/headers/EthernetII.d.ts +10 -0
- package/dist/lib/codec/headers/EthernetII.d.ts.map +1 -0
- package/dist/lib/codec/headers/EthernetII.js +81 -0
- package/dist/lib/codec/headers/Goose.d.ts +13 -0
- package/dist/lib/codec/headers/Goose.d.ts.map +1 -0
- package/dist/lib/codec/headers/Goose.js +720 -0
- package/dist/lib/codec/headers/ICMP.d.ts +15 -0
- package/dist/lib/codec/headers/ICMP.d.ts.map +1 -0
- package/dist/lib/codec/headers/ICMP.js +147 -0
- package/dist/lib/codec/headers/ICMPv6.d.ts +15 -0
- package/dist/lib/codec/headers/ICMPv6.d.ts.map +1 -0
- package/dist/lib/codec/headers/ICMPv6.js +128 -0
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts +13 -0
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts.map +1 -0
- package/dist/lib/codec/headers/IEC61850SampledValues.js +370 -0
- package/dist/lib/codec/headers/IPv4.d.ts +16 -0
- package/dist/lib/codec/headers/IPv4.d.ts.map +1 -0
- package/dist/lib/codec/headers/IPv4.js +339 -0
- package/dist/lib/codec/headers/IPv6.d.ts +10 -0
- package/dist/lib/codec/headers/IPv6.d.ts.map +1 -0
- package/dist/lib/codec/headers/IPv6.js +177 -0
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts +71 -0
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts.map +1 -0
- package/dist/lib/codec/headers/IPv6HopByHopOptions.js +497 -0
- package/dist/lib/codec/headers/RawData.d.ts +11 -0
- package/dist/lib/codec/headers/RawData.d.ts.map +1 -0
- package/dist/lib/codec/headers/RawData.js +36 -0
- package/dist/lib/codec/headers/TCP.d.ts +16 -0
- package/dist/lib/codec/headers/TCP.d.ts.map +1 -0
- package/dist/lib/codec/headers/TCP.js +899 -0
- package/dist/lib/codec/headers/UDP.d.ts +16 -0
- package/dist/lib/codec/headers/UDP.d.ts.map +1 -0
- package/dist/lib/codec/headers/UDP.js +192 -0
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts +10 -0
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts.map +1 -0
- package/dist/lib/codec/headers/VLAN_802dot1Q.js +78 -0
- package/dist/lib/codec/lib/FlexibleObject.d.ts +28 -0
- package/dist/lib/codec/lib/FlexibleObject.d.ts.map +1 -0
- package/dist/lib/codec/lib/FlexibleObject.js +102 -0
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts +14 -0
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts.map +1 -0
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.js +53 -0
- package/dist/lib/codec/lib/SortPostHandlers.d.ts +8 -0
- package/dist/lib/codec/lib/SortPostHandlers.d.ts.map +1 -0
- package/dist/lib/codec/lib/SortPostHandlers.js +11 -0
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts +11 -0
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts.map +1 -0
- package/dist/lib/codec/lib/StringContentEncodingEnum.js +14 -0
- package/dist/lib/codec/types/CodecData.d.ts +7 -0
- package/dist/lib/codec/types/CodecData.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecData.js +2 -0
- package/dist/lib/codec/types/CodecDecodeResult.d.ts +11 -0
- package/dist/lib/codec/types/CodecDecodeResult.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecDecodeResult.js +2 -0
- package/dist/lib/codec/types/CodecEncodeInput.d.ts +9 -0
- package/dist/lib/codec/types/CodecEncodeInput.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecEncodeInput.js +2 -0
- package/dist/lib/codec/types/CodecEncodeResult.d.ts +6 -0
- package/dist/lib/codec/types/CodecEncodeResult.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecEncodeResult.js +2 -0
- package/dist/lib/codec/types/CodecErrorInfo.d.ts +6 -0
- package/dist/lib/codec/types/CodecErrorInfo.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecErrorInfo.js +2 -0
- package/dist/lib/codec/types/CodecModule.d.ts +3 -0
- package/dist/lib/codec/types/CodecModule.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecModule.js +2 -0
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts +3 -0
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecModuleConstructor.js +2 -0
- package/dist/lib/codec/types/CodecSchema.d.ts +7 -0
- package/dist/lib/codec/types/CodecSchema.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecSchema.js +2 -0
- package/dist/lib/codec/types/HeaderTreeNode.d.ts +5 -0
- package/dist/lib/codec/types/HeaderTreeNode.d.ts.map +1 -0
- package/dist/lib/codec/types/HeaderTreeNode.js +2 -0
- package/dist/lib/codec/types/PostHandlerItem.d.ts +5 -0
- package/dist/lib/codec/types/PostHandlerItem.d.ts.map +1 -0
- package/dist/lib/codec/types/PostHandlerItem.js +2 -0
- package/dist/lib/helper/BufferToHex.d.ts +2 -0
- package/dist/lib/helper/BufferToHex.d.ts.map +1 -0
- package/dist/lib/helper/BufferToHex.js +6 -0
- package/dist/lib/helper/BufferToIP.d.ts +13 -0
- package/dist/lib/helper/BufferToIP.d.ts.map +1 -0
- package/dist/lib/helper/BufferToIP.js +21 -0
- package/dist/lib/helper/BufferToNumber.d.ts +10 -0
- package/dist/lib/helper/BufferToNumber.d.ts.map +1 -0
- package/dist/lib/helper/BufferToNumber.js +22 -0
- package/dist/lib/helper/HexToBuffer.d.ts +8 -0
- package/dist/lib/helper/HexToBuffer.d.ts.map +1 -0
- package/dist/lib/helper/HexToBuffer.js +27 -0
- package/dist/lib/helper/HexToNumber.d.ts +10 -0
- package/dist/lib/helper/HexToNumber.d.ts.map +1 -0
- package/dist/lib/helper/HexToNumber.js +39 -0
- package/dist/lib/helper/IPToBuffer.d.ts +13 -0
- package/dist/lib/helper/IPToBuffer.d.ts.map +1 -0
- package/dist/lib/helper/IPToBuffer.js +28 -0
- package/dist/lib/helper/NumberToBERBuffer.d.ts +9 -0
- package/dist/lib/helper/NumberToBERBuffer.d.ts.map +1 -0
- package/dist/lib/helper/NumberToBERBuffer.js +20 -0
- package/dist/lib/helper/NumberToBERHex.d.ts +9 -0
- package/dist/lib/helper/NumberToBERHex.d.ts.map +1 -0
- package/dist/lib/helper/NumberToBERHex.js +23 -0
- package/dist/lib/helper/NumberToBuffer.d.ts +10 -0
- package/dist/lib/helper/NumberToBuffer.d.ts.map +1 -0
- package/dist/lib/helper/NumberToBuffer.js +22 -0
- package/dist/lib/helper/NumberToHex.d.ts +10 -0
- package/dist/lib/helper/NumberToHex.d.ts.map +1 -0
- package/dist/lib/helper/NumberToHex.js +26 -0
- package/dist/lib/nodepcap/Capture.d.ts +75 -0
- package/dist/lib/nodepcap/Capture.d.ts.map +1 -0
- package/dist/lib/nodepcap/Capture.js +309 -0
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts +7 -0
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts.map +1 -0
- package/dist/lib/nodepcap/GetNetworkInterfaces.js +22 -0
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts +16 -0
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/IBindingCapture.js +2 -0
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts +5 -0
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.js +2 -0
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts +19 -0
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.js +2 -0
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts +5 -0
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/INetworkInterface.js +2 -0
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts +15 -0
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts.map +1 -0
- package/dist/lib/nodepcap/lib/BindingCapture.js +35 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts +2 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts.map +1 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.js +55 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts +3 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts.map +1 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.js +18 -0
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts +2 -0
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts.map +1 -0
- package/dist/lib/nodepcap/workers/CaptureWorker.js +25 -0
- package/dist/lib/pcap/PCAPGenerator.d.ts +34 -0
- package/dist/lib/pcap/PCAPGenerator.d.ts.map +1 -0
- package/dist/lib/pcap/PCAPGenerator.js +95 -0
- package/dist/lib/pcap/PcapParser.d.ts +27 -0
- package/dist/lib/pcap/PcapParser.d.ts.map +1 -0
- package/dist/lib/pcap/PcapParser.js +149 -0
- package/dist/lib/pcap/PcapReader.d.ts +89 -0
- package/dist/lib/pcap/PcapReader.d.ts.map +1 -0
- package/dist/lib/pcap/PcapReader.js +209 -0
- package/dist/lib/pcap/PcapWriter.d.ts +29 -0
- package/dist/lib/pcap/PcapWriter.d.ts.map +1 -0
- package/dist/lib/pcap/PcapWriter.js +80 -0
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts +13 -0
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts.map +1 -0
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.js +2 -0
- package/dist/lib/pipe/PipeClient.d.ts +35 -0
- package/dist/lib/pipe/PipeClient.d.ts.map +1 -0
- package/dist/lib/pipe/PipeClient.js +71 -0
- package/dist/lib/pipe/PipeClientSocket.d.ts +39 -0
- package/dist/lib/pipe/PipeClientSocket.d.ts.map +1 -0
- package/dist/lib/pipe/PipeClientSocket.js +82 -0
- package/dist/lib/pipe/PipeMessage.d.ts +27 -0
- package/dist/lib/pipe/PipeMessage.d.ts.map +1 -0
- package/dist/lib/pipe/PipeMessage.js +61 -0
- package/dist/lib/pipe/PipeMessageHandler.d.ts +16 -0
- package/dist/lib/pipe/PipeMessageHandler.d.ts.map +1 -0
- package/dist/lib/pipe/PipeMessageHandler.js +95 -0
- package/dist/lib/pipe/PipeServer.d.ts +25 -0
- package/dist/lib/pipe/PipeServer.d.ts.map +1 -0
- package/dist/lib/pipe/PipeServer.js +59 -0
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts +35 -0
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts.map +1 -0
- package/dist/lib/schema/ProtocolFieldJSONSchema.js +2 -0
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts +3 -0
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts.map +1 -0
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.js +2 -0
- package/dist/lib/schema/ProtocolJSONSchema.d.ts +32 -0
- package/dist/lib/schema/ProtocolJSONSchema.d.ts.map +1 -0
- package/dist/lib/schema/ProtocolJSONSchema.js +2 -0
- package/dist/tests/Test.spec.d.ts +2 -0
- package/dist/tests/Test.spec.d.ts.map +1 -0
- package/dist/tests/Test.spec.js +25 -0
- package/dist/tests/units/CaptureTest.spec.d.ts +2 -0
- package/dist/tests/units/CaptureTest.spec.d.ts.map +1 -0
- package/dist/tests/units/CaptureTest.spec.js +31 -0
- package/dist/tests/units/Codec.spec.d.ts +2 -0
- package/dist/tests/units/Codec.spec.d.ts.map +1 -0
- package/dist/tests/units/Codec.spec.js +73 -0
- package/dist/tests/units/ReadPCAP.spec.d.ts +2 -0
- package/dist/tests/units/ReadPCAP.spec.d.ts.map +1 -0
- package/dist/tests/units/ReadPCAP.spec.js +14 -0
- package/package.json +6 -6
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IEC61850SampledValues = void 0;
|
|
7
|
+
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
8
|
+
const node_tlv_1 = __importDefault(require("node-tlv"));
|
|
9
|
+
const HexToNumber_1 = require("../../helper/HexToNumber");
|
|
10
|
+
const NumberToBERHex_1 = require("../../helper/NumberToBERHex");
|
|
11
|
+
const NumberToHex_1 = require("../../helper/NumberToHex");
|
|
12
|
+
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
13
|
+
const BufferToNumber_1 = require("../../helper/BufferToNumber");
|
|
14
|
+
const NumberToBuffer_1 = require("../../helper/NumberToBuffer");
|
|
15
|
+
class IEC61850SampledValues extends BaseHeader_1.BaseHeader {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.TLVChild = [];
|
|
19
|
+
this.SCHEMA = {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
appid: {
|
|
23
|
+
type: 'integer',
|
|
24
|
+
minimum: 0,
|
|
25
|
+
maximum: 65535,
|
|
26
|
+
label: 'APPID',
|
|
27
|
+
decode: () => {
|
|
28
|
+
this.instance.appid.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(0, 2)));
|
|
29
|
+
},
|
|
30
|
+
encode: () => {
|
|
31
|
+
const APPID = this.instance.appid.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
32
|
+
this.instance.appid.setValue(APPID);
|
|
33
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(APPID));
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
length: {
|
|
37
|
+
type: 'integer',
|
|
38
|
+
label: 'Length',
|
|
39
|
+
decode: () => {
|
|
40
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(2, 2)));
|
|
41
|
+
},
|
|
42
|
+
encode: () => {
|
|
43
|
+
const length = this.instance.length.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
44
|
+
if (length > 0) {
|
|
45
|
+
this.instance.length.setValue(length);
|
|
46
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(length));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.addPostSelfEncodeHandler(() => {
|
|
50
|
+
const finalLength = parseInt(this.instance.length.getValue().toString());
|
|
51
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(finalLength));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
reserved1: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
label: 'Reserved1',
|
|
59
|
+
properties: {
|
|
60
|
+
simulated: {
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
label: 'Simulated',
|
|
63
|
+
decode: () => {
|
|
64
|
+
this.instance.reserved1.simulated.setValue(!!this.readBits(4, 2, 0, 1));
|
|
65
|
+
},
|
|
66
|
+
encode: () => {
|
|
67
|
+
const simulated = !!this.instance.reserved1.simulated.getValue();
|
|
68
|
+
this.writeBits(4, 2, 0, 1, simulated ? 1 : 0);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
reserved: {
|
|
72
|
+
type: 'number',
|
|
73
|
+
minimum: 0,
|
|
74
|
+
maximum: 32767,
|
|
75
|
+
label: 'Reserved',
|
|
76
|
+
decode: () => {
|
|
77
|
+
this.instance.reserved1.reserved.setValue(this.readBits(4, 2, 1, 16));
|
|
78
|
+
},
|
|
79
|
+
encode: () => {
|
|
80
|
+
const reserved = this.instance.reserved1.reserved.getValue(0);
|
|
81
|
+
this.writeBits(4, 2, 1, 16, reserved);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
reserved2: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
label: 'Reserved2',
|
|
89
|
+
properties: {
|
|
90
|
+
reserved: {
|
|
91
|
+
type: 'number',
|
|
92
|
+
minimum: 0,
|
|
93
|
+
maximum: 65535,
|
|
94
|
+
label: 'Reserved',
|
|
95
|
+
decode: () => {
|
|
96
|
+
this.instance.reserved2.reserved.setValue(this.readBits(4, 2, 0, 16));
|
|
97
|
+
},
|
|
98
|
+
encode: () => {
|
|
99
|
+
const reserved = this.instance.reserved2.reserved.getValue(0);
|
|
100
|
+
this.writeBits(4, 2, 0, 16, reserved);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
svPdu: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
label: 'Sampled Values PDU',
|
|
108
|
+
decode: () => {
|
|
109
|
+
const buffer = this.readBytes(8, (this.instance.length.getValue()) - 8);
|
|
110
|
+
this.TLVInstance = node_tlv_1.default.parse(buffer);
|
|
111
|
+
this.TLVChild = this.TLVInstance.getChild();
|
|
112
|
+
this.instance.svPdu.setValue({});
|
|
113
|
+
},
|
|
114
|
+
encode: () => {
|
|
115
|
+
let buffer = Buffer.from([]);
|
|
116
|
+
this.TLVChild.forEach(TLVItem => buffer = Buffer.concat([buffer, TLVItem.bTag, TLVItem.bLength, TLVItem.bValue]));
|
|
117
|
+
const svPduTLV = new node_tlv_1.default(0x60, buffer);
|
|
118
|
+
let svPduBuffer = Buffer.concat([svPduTLV.bTag, svPduTLV.bLength, svPduTLV.bValue]);
|
|
119
|
+
this.writeBytes(8, svPduBuffer);
|
|
120
|
+
/**
|
|
121
|
+
* Update the length only if it is not set
|
|
122
|
+
* Update length(APPID's length + Length's length + Reserved1's length + Reserved2's length + svPdu's length)
|
|
123
|
+
*/
|
|
124
|
+
if (this.instance.length.getValue() > 0)
|
|
125
|
+
return;
|
|
126
|
+
this.instance.length.setValue(2 + 2 + 2 + 2 + svPduBuffer.length);
|
|
127
|
+
},
|
|
128
|
+
properties: {
|
|
129
|
+
noASDU: {
|
|
130
|
+
type: 'integer',
|
|
131
|
+
minimum: 1,
|
|
132
|
+
maximum: 65535,
|
|
133
|
+
label: 'Number of ASDU',
|
|
134
|
+
decode: () => {
|
|
135
|
+
const noASDUTLV = this.TLVChild.find(tlv => tlv.getTag('number') === 0x80);
|
|
136
|
+
if (!noASDUTLV)
|
|
137
|
+
return this.recordError(this.instance.svPdu.noASDU.getPath(), 'Not Found');
|
|
138
|
+
const noASDUNum = (0, HexToNumber_1.HexToUInt16)(noASDUTLV.getValue('hex'));
|
|
139
|
+
if (!noASDUNum)
|
|
140
|
+
this.recordError(this.instance.svPdu.noASDU.getPath(), 'Number of ASDU should be greater or equal to 1');
|
|
141
|
+
this.instance.svPdu.noASDU.setValue(noASDUNum);
|
|
142
|
+
},
|
|
143
|
+
encode: () => {
|
|
144
|
+
const noASDU = this.instance.svPdu.noASDU.getValue(0, (nodePath) => this.recordError(nodePath, 'noASDU is not set'));
|
|
145
|
+
this.TLVChild.push(new node_tlv_1.default(0x80, (0, NumberToBERHex_1.UInt16ToBERHex)(noASDU)));
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
seqASDU: {
|
|
149
|
+
type: 'array',
|
|
150
|
+
label: 'Sequence ASDU',
|
|
151
|
+
items: {
|
|
152
|
+
type: 'object',
|
|
153
|
+
properties: {
|
|
154
|
+
svID: {
|
|
155
|
+
type: 'string',
|
|
156
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.ASCII,
|
|
157
|
+
label: 'SvID'
|
|
158
|
+
},
|
|
159
|
+
dataSet: {
|
|
160
|
+
type: 'string',
|
|
161
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.ASCII,
|
|
162
|
+
label: 'DatSet'
|
|
163
|
+
},
|
|
164
|
+
smpCnt: {
|
|
165
|
+
type: 'integer',
|
|
166
|
+
label: 'SmpCnt'
|
|
167
|
+
},
|
|
168
|
+
confRev: {
|
|
169
|
+
type: 'integer',
|
|
170
|
+
label: 'ConfRev'
|
|
171
|
+
},
|
|
172
|
+
refrTm: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.BIGINT,
|
|
175
|
+
label: 'RefrTm'
|
|
176
|
+
},
|
|
177
|
+
smpSynch: {
|
|
178
|
+
type: 'integer',
|
|
179
|
+
label: 'SmpSynch'
|
|
180
|
+
},
|
|
181
|
+
smpRate: {
|
|
182
|
+
type: 'integer',
|
|
183
|
+
label: 'SmpRate'
|
|
184
|
+
},
|
|
185
|
+
sample: {
|
|
186
|
+
type: 'string',
|
|
187
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
188
|
+
label: 'Sample'
|
|
189
|
+
},
|
|
190
|
+
smpMod: {
|
|
191
|
+
type: 'integer',
|
|
192
|
+
label: 'SmpMod'
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
decode: () => {
|
|
197
|
+
const seqASDU = [];
|
|
198
|
+
const seqASDUTLV = this.TLVChild.find(tlv => tlv.getTag('number') === 0xa2);
|
|
199
|
+
if (!seqASDUTLV) {
|
|
200
|
+
this.instance.svPdu.seqASDU.setValue(seqASDU);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const ASDUTLVs = seqASDUTLV.getChild();
|
|
204
|
+
ASDUTLVs.forEach((ASDUTLV, index) => {
|
|
205
|
+
const errorNodePath = this.instance.svPdu.seqASDU.getPath(index);
|
|
206
|
+
if (ASDUTLV.getTag('number') !== 0x30)
|
|
207
|
+
this.recordError(errorNodePath, 'Invalid ASDU item tag');
|
|
208
|
+
const ASDUAttributeTLVs = ASDUTLV.getChild();
|
|
209
|
+
let svID;
|
|
210
|
+
let dataSet;
|
|
211
|
+
let smpCnt;
|
|
212
|
+
let confRev;
|
|
213
|
+
let refrTm;
|
|
214
|
+
let smpSynch;
|
|
215
|
+
let smpRate;
|
|
216
|
+
let sample;
|
|
217
|
+
let smpMod;
|
|
218
|
+
//svID
|
|
219
|
+
const svIDTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x80);
|
|
220
|
+
if (svIDTLV) {
|
|
221
|
+
svID = svIDTLV.getValue('buffer').toString('ascii');
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
this.recordError(errorNodePath, 'svID Not Found');
|
|
225
|
+
}
|
|
226
|
+
//dataSet (optional)
|
|
227
|
+
const dataSetTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x81);
|
|
228
|
+
if (dataSetTLV) {
|
|
229
|
+
dataSet = dataSetTLV.getValue('buffer').toString('ascii');
|
|
230
|
+
}
|
|
231
|
+
//smpCnt
|
|
232
|
+
const smpCntTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x82);
|
|
233
|
+
if (smpCntTLV) {
|
|
234
|
+
smpCnt = (0, BufferToNumber_1.BufferToUInt16)(smpCntTLV.getValue('buffer'));
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
this.recordError(errorNodePath, 'smpCnt Not Found');
|
|
238
|
+
}
|
|
239
|
+
//confRev
|
|
240
|
+
const confRevTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x83);
|
|
241
|
+
if (confRevTLV) {
|
|
242
|
+
confRev = (0, BufferToNumber_1.BufferToUInt32)(confRevTLV.getValue('buffer'));
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
this.recordError(errorNodePath, 'confRev Not Found');
|
|
246
|
+
}
|
|
247
|
+
//refrTm (optional)
|
|
248
|
+
const refrTmTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x84);
|
|
249
|
+
if (refrTmTLV) {
|
|
250
|
+
refrTm = (0, BufferToNumber_1.BufferToUInt64)(refrTmTLV.getValue('buffer')).toString();
|
|
251
|
+
}
|
|
252
|
+
//smpSynch
|
|
253
|
+
const smpSynchTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x85);
|
|
254
|
+
if (smpSynchTLV) {
|
|
255
|
+
smpSynch = (0, BufferToNumber_1.BufferToUInt8)(smpSynchTLV.getValue('buffer'));
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
this.recordError(errorNodePath, 'smpSynch Not Found');
|
|
259
|
+
}
|
|
260
|
+
//smpRate (optional)
|
|
261
|
+
const smpRateTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x86);
|
|
262
|
+
if (smpRateTLV) {
|
|
263
|
+
smpRate = (0, BufferToNumber_1.BufferToUInt16)(smpRateTLV.getValue('buffer'));
|
|
264
|
+
}
|
|
265
|
+
//sample
|
|
266
|
+
const sampleTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x87);
|
|
267
|
+
if (sampleTLV) {
|
|
268
|
+
sample = sampleTLV.getValue('hex');
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
this.recordError(errorNodePath, 'sample Not Found');
|
|
272
|
+
}
|
|
273
|
+
//smpMod (optional)
|
|
274
|
+
const smpModTLV = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x86);
|
|
275
|
+
if (smpModTLV) {
|
|
276
|
+
smpMod = (0, BufferToNumber_1.BufferToUInt16)(smpModTLV.getValue('buffer'));
|
|
277
|
+
}
|
|
278
|
+
seqASDU.push({
|
|
279
|
+
svID: svID,
|
|
280
|
+
dataSet: dataSet,
|
|
281
|
+
smpCnt: smpCnt,
|
|
282
|
+
confRev: confRev,
|
|
283
|
+
refrTm: refrTm,
|
|
284
|
+
smpSynch: smpSynch,
|
|
285
|
+
smpRate: smpRate,
|
|
286
|
+
sample: sample,
|
|
287
|
+
smpMod: smpMod
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
this.instance.svPdu.seqASDU.setValue(seqASDU);
|
|
291
|
+
},
|
|
292
|
+
encode: () => {
|
|
293
|
+
const seqASDU = this.instance.svPdu.seqASDU.isUndefined() ? [] : this.instance.svPdu.seqASDU.getValue();
|
|
294
|
+
const seqASDUTLVs = [];
|
|
295
|
+
seqASDU.forEach((seqASDUItem, index) => {
|
|
296
|
+
const errorNodePath = this.instance.svPdu.seqASDU.getPath(index);
|
|
297
|
+
const seqASDUItemTLVs = [];
|
|
298
|
+
//svID
|
|
299
|
+
if (seqASDUItem.svID !== undefined) {
|
|
300
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x80, Buffer.from(seqASDUItem.svID ? seqASDUItem.svID : '', 'ascii')));
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
this.recordError(errorNodePath, 'No svID');
|
|
304
|
+
}
|
|
305
|
+
//dataSet
|
|
306
|
+
if (seqASDUItem.dataSet !== undefined)
|
|
307
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x81, Buffer.from(seqASDUItem.dataSet ? seqASDUItem.dataSet : '', 'ascii')));
|
|
308
|
+
// smpCnt
|
|
309
|
+
if (seqASDUItem.smpCnt !== undefined) {
|
|
310
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x82, (0, NumberToHex_1.UInt16ToHex)(seqASDUItem.smpCnt)));
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this.recordError(errorNodePath, 'No smpCnt');
|
|
314
|
+
}
|
|
315
|
+
// confRev
|
|
316
|
+
if (seqASDUItem.confRev !== undefined) {
|
|
317
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x83, (0, NumberToHex_1.UInt32ToHex)(seqASDUItem.confRev)));
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
this.recordError(errorNodePath, 'No confRev');
|
|
321
|
+
}
|
|
322
|
+
// refrTm
|
|
323
|
+
if (seqASDUItem.refrTm !== undefined)
|
|
324
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x84, Buffer.from(BigInt(seqASDUItem.refrTm).toString(16).padStart(8 * 2, '0'), 'hex')));
|
|
325
|
+
// smpSynch
|
|
326
|
+
if (seqASDUItem.smpSynch !== undefined) {
|
|
327
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x85, (0, NumberToHex_1.UInt8ToHex)(seqASDUItem.smpSynch)));
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.recordError(errorNodePath, 'No smpSynch');
|
|
331
|
+
}
|
|
332
|
+
// smpRate
|
|
333
|
+
if (seqASDUItem.smpRate !== undefined)
|
|
334
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x86, (0, NumberToHex_1.UInt16ToHex)(seqASDUItem.smpRate)));
|
|
335
|
+
// sample
|
|
336
|
+
if (seqASDUItem.sample !== undefined) {
|
|
337
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x87, Buffer.from(seqASDUItem.sample, 'hex')));
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
this.recordError(errorNodePath, 'No sample');
|
|
341
|
+
}
|
|
342
|
+
// smpMod
|
|
343
|
+
if (seqASDUItem.smpMod !== undefined)
|
|
344
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x88, (0, NumberToHex_1.UInt16ToHex)(seqASDUItem.smpMod)));
|
|
345
|
+
if (!seqASDUItemTLVs.length)
|
|
346
|
+
return;
|
|
347
|
+
let seqASDUItemBuffer = Buffer.from([]);
|
|
348
|
+
seqASDUItemTLVs.forEach(seqASDUItemTLV => seqASDUItemBuffer = Buffer.concat([seqASDUItemBuffer, seqASDUItemTLV.bTag, seqASDUItemTLV.bLength, seqASDUItemTLV.bValue]));
|
|
349
|
+
seqASDUTLVs.push(new node_tlv_1.default(0x30, seqASDUItemBuffer));
|
|
350
|
+
});
|
|
351
|
+
let seqASDUBuffer = Buffer.from([]);
|
|
352
|
+
seqASDUTLVs.forEach(seqASDUTLV => seqASDUBuffer = Buffer.concat([seqASDUBuffer, seqASDUTLV.bTag, seqASDUTLV.bLength, seqASDUTLV.bValue]));
|
|
353
|
+
this.TLVChild.push(new node_tlv_1.default(0xa2, seqASDUBuffer));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
this.id = 'sv';
|
|
361
|
+
this.name = 'IEC61850 Sampled Values';
|
|
362
|
+
this.nickname = 'SV';
|
|
363
|
+
}
|
|
364
|
+
match() {
|
|
365
|
+
if (!this.prevCodecModule)
|
|
366
|
+
return false;
|
|
367
|
+
return this.prevCodecModule.instance.etherType.getValue() === (0, NumberToHex_1.UInt16ToHex)(0x88ba);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
exports.IEC61850SampledValues = IEC61850SampledValues;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ProtocolJSONSchema } from '../../schema/ProtocolJSONSchema';
|
|
2
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
+
export declare class IPv4 extends BaseHeader {
|
|
4
|
+
/**
|
|
5
|
+
* Calculate IPv4 header checksum
|
|
6
|
+
* @param headerBuffer
|
|
7
|
+
* @protected
|
|
8
|
+
*/
|
|
9
|
+
protected calculateIPv4Checksum(headerBuffer: Buffer): number;
|
|
10
|
+
SCHEMA: ProtocolJSONSchema;
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly nickname: string;
|
|
14
|
+
match(): boolean;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=IPv4.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPv4.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/headers/IPv4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAWlD,qBAAa,IAAK,SAAQ,UAAU;IAEhC;;;;OAIG;IACH,SAAS,CAAC,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAatD,MAAM,EAAE,kBAAkB,CA8RhC;IAED,SAAgB,EAAE,EAAE,MAAM,CAAS;IAEnC,SAAgB,IAAI,EAAE,MAAM,CAAgC;IAE5D,SAAgB,QAAQ,EAAE,MAAM,CAAS;IAElC,KAAK,IAAI,OAAO;CAI1B"}
|