netkitty 0.0.34 → 1.0.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 +13 -0
- package/README.md +91 -2
- package/README.zh-CN.md +89 -0
- package/dist/analysis.d.ts +4 -0
- package/dist/{CodecHeaderExports.js → analysis.js} +4 -1
- package/dist/capture.d.ts +5 -0
- package/dist/capture.js +21 -0
- package/dist/codec.d.ts +5 -0
- package/dist/codec.js +21 -0
- package/dist/iface.d.ts +4 -0
- package/dist/iface.js +20 -0
- package/dist/pcap.d.ts +10 -0
- package/dist/pcap.js +27 -0
- package/dist/replay.d.ts +5 -0
- package/dist/replay.js +21 -0
- package/package.json +65 -57
- package/.eslintrc.json +0 -53
- package/.idea/codeStyles/Project.xml +0 -18
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -11
- package/.idea/modules.xml +0 -8
- package/.idea/netkitty.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/assets/NetKitty.png +0 -0
- package/binding.gyp +0 -5
- package/cpp/nodepcap/deps/include/Packet32.h +0 -429
- package/cpp/nodepcap/deps/include/pcap/bluetooth.h +0 -56
- package/cpp/nodepcap/deps/include/pcap/bpf.h +0 -292
- package/cpp/nodepcap/deps/include/pcap/can_socketcan.h +0 -56
- package/cpp/nodepcap/deps/include/pcap/compiler-tests.h +0 -163
- package/cpp/nodepcap/deps/include/pcap/dlt.h +0 -1514
- package/cpp/nodepcap/deps/include/pcap/funcattrs.h +0 -325
- package/cpp/nodepcap/deps/include/pcap/ipnet.h +0 -43
- package/cpp/nodepcap/deps/include/pcap/namedb.h +0 -84
- package/cpp/nodepcap/deps/include/pcap/nflog.h +0 -94
- package/cpp/nodepcap/deps/include/pcap/pcap-inttypes.h +0 -101
- package/cpp/nodepcap/deps/include/pcap/pcap.h +0 -1219
- package/cpp/nodepcap/deps/include/pcap/sll.h +0 -149
- package/cpp/nodepcap/deps/include/pcap/socket.h +0 -84
- package/cpp/nodepcap/deps/include/pcap/usb.h +0 -143
- package/cpp/nodepcap/deps/include/pcap/vlan.h +0 -46
- package/cpp/nodepcap/deps/include/pcap-bpf.h +0 -45
- package/cpp/nodepcap/deps/include/pcap-namedb.h +0 -40
- package/cpp/nodepcap/deps/include/pcap.h +0 -43
- package/cpp/nodepcap/deps/lib/ARM64/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/wpcap.lib +0 -0
- package/cpp/nodepcap/deps/lib/x64/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/x64/wpcap.lib +0 -0
- package/cpp/nodepcap/nodepcap.gypi +0 -104
- package/cpp/nodepcap/src/binding.cc +0 -14
- package/cpp/nodepcap/src/capture.cc +0 -400
- package/cpp/nodepcap/src/capture.h +0 -53
- package/cpp/nodepcap/src/utils.cc +0 -218
- package/cpp/nodepcap/src/utils.h +0 -13
- package/dist/CodecExports.d.ts +0 -34
- package/dist/CodecExports.d.ts.map +0 -1
- package/dist/CodecExports.js +0 -23
- package/dist/CodecHeaderExports.d.ts +0 -2
- package/dist/CodecHeaderExports.d.ts.map +0 -1
- package/dist/HelperExports.d.ts +0 -11
- package/dist/HelperExports.d.ts.map +0 -1
- package/dist/HelperExports.js +0 -72
- package/dist/NetworkExports.d.ts +0 -13
- package/dist/NetworkExports.d.ts.map +0 -1
- package/dist/NetworkExports.js +0 -13
- package/dist/PcapExports.d.ts +0 -30
- package/dist/PcapExports.d.ts.map +0 -1
- package/dist/PcapExports.js +0 -33
- package/dist/errors/ActionNotFoundError.d.ts +0 -5
- package/dist/errors/ActionNotFoundError.d.ts.map +0 -1
- package/dist/errors/ActionNotFoundError.js +0 -12
- package/dist/errors/CodecSchemaValidateError.d.ts +0 -5
- package/dist/errors/CodecSchemaValidateError.d.ts.map +0 -1
- package/dist/errors/CodecSchemaValidateError.js +0 -12
- package/dist/errors/DeviceNotFoundError.d.ts +0 -5
- package/dist/errors/DeviceNotFoundError.d.ts.map +0 -1
- package/dist/errors/DeviceNotFoundError.js +0 -12
- package/dist/errors/NoAvailableCodecError.d.ts +0 -5
- package/dist/errors/NoAvailableCodecError.d.ts.map +0 -1
- package/dist/errors/NoAvailableCodecError.js +0 -12
- package/dist/errors/NpcapLoadError.d.ts +0 -5
- package/dist/errors/NpcapLoadError.d.ts.map +0 -1
- package/dist/errors/NpcapLoadError.js +0 -12
- package/dist/errors/SocketDownError.d.ts +0 -5
- package/dist/errors/SocketDownError.d.ts.map +0 -1
- package/dist/errors/SocketDownError.js +0 -12
- package/dist/errors/UnknownPipeMessageTypeError.d.ts +0 -5
- package/dist/errors/UnknownPipeMessageTypeError.d.ts.map +0 -1
- package/dist/errors/UnknownPipeMessageTypeError.js +0 -12
- package/dist/errors/common/ErrorCode.d.ts +0 -31
- package/dist/errors/common/ErrorCode.d.ts.map +0 -1
- package/dist/errors/common/ErrorCode.js +0 -33
- package/dist/lib/GeneratePipeAddress.d.ts +0 -7
- package/dist/lib/GeneratePipeAddress.d.ts.map +0 -1
- package/dist/lib/GeneratePipeAddress.js +0 -23
- package/dist/lib/GetBinding.d.ts +0 -2
- package/dist/lib/GetBinding.d.ts.map +0 -1
- package/dist/lib/GetBinding.js +0 -6
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts +0 -7
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts.map +0 -1
- package/dist/lib/GetCaptureTemporaryDirectory.js +0 -15
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts +0 -8
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts.map +0 -1
- package/dist/lib/GetDeviceCaptureTemporaryFilename.js +0 -18
- package/dist/lib/codec/Codec.d.ts +0 -32
- package/dist/lib/codec/Codec.d.ts.map +0 -1
- package/dist/lib/codec/Codec.js +0 -183
- package/dist/lib/codec/PacketHeaders.d.ts +0 -22
- package/dist/lib/codec/PacketHeaders.d.ts.map +0 -1
- package/dist/lib/codec/PacketHeaders.js +0 -47
- package/dist/lib/codec/abstracts/BaseHeader.d.ts +0 -217
- package/dist/lib/codec/abstracts/BaseHeader.d.ts.map +0 -1
- package/dist/lib/codec/abstracts/BaseHeader.js +0 -356
- package/dist/lib/codec/headers/ARP.d.ts +0 -10
- package/dist/lib/codec/headers/ARP.d.ts.map +0 -1
- package/dist/lib/codec/headers/ARP.js +0 -224
- package/dist/lib/codec/headers/EthernetII.d.ts +0 -10
- package/dist/lib/codec/headers/EthernetII.d.ts.map +0 -1
- package/dist/lib/codec/headers/EthernetII.js +0 -81
- package/dist/lib/codec/headers/Goose.d.ts +0 -104
- package/dist/lib/codec/headers/Goose.d.ts.map +0 -1
- package/dist/lib/codec/headers/Goose.js +0 -975
- package/dist/lib/codec/headers/ICMP.d.ts +0 -15
- package/dist/lib/codec/headers/ICMP.d.ts.map +0 -1
- package/dist/lib/codec/headers/ICMP.js +0 -147
- package/dist/lib/codec/headers/ICMPv6.d.ts +0 -15
- package/dist/lib/codec/headers/ICMPv6.d.ts.map +0 -1
- package/dist/lib/codec/headers/ICMPv6.js +0 -128
- package/dist/lib/codec/headers/IEC104_I_Frame.d.ts +0 -10
- package/dist/lib/codec/headers/IEC104_I_Frame.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC104_I_Frame.js +0 -6411
- package/dist/lib/codec/headers/IEC104_S_Frame.d.ts +0 -10
- package/dist/lib/codec/headers/IEC104_S_Frame.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC104_S_Frame.js +0 -105
- package/dist/lib/codec/headers/IEC104_U_Frame.d.ts +0 -10
- package/dist/lib/codec/headers/IEC104_U_Frame.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC104_U_Frame.js +0 -155
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts +0 -13
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC61850SampledValues.js +0 -370
- package/dist/lib/codec/headers/IPv4.d.ts +0 -16
- package/dist/lib/codec/headers/IPv4.d.ts.map +0 -1
- package/dist/lib/codec/headers/IPv4.js +0 -339
- package/dist/lib/codec/headers/IPv6.d.ts +0 -10
- package/dist/lib/codec/headers/IPv6.d.ts.map +0 -1
- package/dist/lib/codec/headers/IPv6.js +0 -177
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts +0 -71
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts.map +0 -1
- package/dist/lib/codec/headers/IPv6HopByHopOptions.js +0 -497
- package/dist/lib/codec/headers/RawData.d.ts +0 -11
- package/dist/lib/codec/headers/RawData.d.ts.map +0 -1
- package/dist/lib/codec/headers/RawData.js +0 -36
- package/dist/lib/codec/headers/TCP.d.ts +0 -16
- package/dist/lib/codec/headers/TCP.d.ts.map +0 -1
- package/dist/lib/codec/headers/TCP.js +0 -899
- package/dist/lib/codec/headers/TLS_Alert.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_Alert.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_Alert.js +0 -624
- package/dist/lib/codec/headers/TLS_ApplicationData.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_ApplicationData.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_ApplicationData.js +0 -155
- package/dist/lib/codec/headers/TLS_ChangeCipherSpec.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_ChangeCipherSpec.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_ChangeCipherSpec.js +0 -154
- package/dist/lib/codec/headers/TLS_Handshake.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_Handshake.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_Handshake.js +0 -339
- package/dist/lib/codec/headers/TLS_Heartbeat.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_Heartbeat.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_Heartbeat.js +0 -206
- package/dist/lib/codec/headers/UDP.d.ts +0 -16
- package/dist/lib/codec/headers/UDP.d.ts.map +0 -1
- package/dist/lib/codec/headers/UDP.js +0 -192
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts +0 -10
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts.map +0 -1
- package/dist/lib/codec/headers/VLAN_802dot1Q.js +0 -82
- package/dist/lib/codec/lib/FlexibleObject.d.ts +0 -28
- package/dist/lib/codec/lib/FlexibleObject.d.ts.map +0 -1
- package/dist/lib/codec/lib/FlexibleObject.js +0 -102
- package/dist/lib/codec/lib/GetBERIntegerLengthFromBuffer.d.ts +0 -7
- package/dist/lib/codec/lib/GetBERIntegerLengthFromBuffer.d.ts.map +0 -1
- package/dist/lib/codec/lib/GetBERIntegerLengthFromBuffer.js +0 -16
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts +0 -14
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts.map +0 -1
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.js +0 -53
- package/dist/lib/codec/lib/SortPostHandlers.d.ts +0 -8
- package/dist/lib/codec/lib/SortPostHandlers.d.ts.map +0 -1
- package/dist/lib/codec/lib/SortPostHandlers.js +0 -11
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts +0 -11
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts.map +0 -1
- package/dist/lib/codec/lib/StringContentEncodingEnum.js +0 -14
- package/dist/lib/codec/types/CodecData.d.ts +0 -7
- package/dist/lib/codec/types/CodecData.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecData.js +0 -2
- package/dist/lib/codec/types/CodecDecodeResult.d.ts +0 -11
- package/dist/lib/codec/types/CodecDecodeResult.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecDecodeResult.js +0 -2
- package/dist/lib/codec/types/CodecEncodeInput.d.ts +0 -9
- package/dist/lib/codec/types/CodecEncodeInput.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecEncodeInput.js +0 -2
- package/dist/lib/codec/types/CodecEncodeResult.d.ts +0 -6
- package/dist/lib/codec/types/CodecEncodeResult.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecEncodeResult.js +0 -2
- package/dist/lib/codec/types/CodecErrorInfo.d.ts +0 -6
- package/dist/lib/codec/types/CodecErrorInfo.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecErrorInfo.js +0 -2
- package/dist/lib/codec/types/CodecModule.d.ts +0 -3
- package/dist/lib/codec/types/CodecModule.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecModule.js +0 -2
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts +0 -3
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecModuleConstructor.js +0 -2
- package/dist/lib/codec/types/CodecSchema.d.ts +0 -7
- package/dist/lib/codec/types/CodecSchema.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecSchema.js +0 -2
- package/dist/lib/codec/types/HeaderTreeNode.d.ts +0 -5
- package/dist/lib/codec/types/HeaderTreeNode.d.ts.map +0 -1
- package/dist/lib/codec/types/HeaderTreeNode.js +0 -2
- package/dist/lib/codec/types/PostHandlerItem.d.ts +0 -5
- package/dist/lib/codec/types/PostHandlerItem.d.ts.map +0 -1
- package/dist/lib/codec/types/PostHandlerItem.js +0 -2
- package/dist/lib/helper/BufferToHex.d.ts +0 -2
- package/dist/lib/helper/BufferToHex.d.ts.map +0 -1
- package/dist/lib/helper/BufferToHex.js +0 -6
- package/dist/lib/helper/BufferToIP.d.ts +0 -13
- package/dist/lib/helper/BufferToIP.d.ts.map +0 -1
- package/dist/lib/helper/BufferToIP.js +0 -21
- package/dist/lib/helper/BufferToNumber.d.ts +0 -10
- package/dist/lib/helper/BufferToNumber.d.ts.map +0 -1
- package/dist/lib/helper/BufferToNumber.js +0 -22
- package/dist/lib/helper/HexToBuffer.d.ts +0 -8
- package/dist/lib/helper/HexToBuffer.d.ts.map +0 -1
- package/dist/lib/helper/HexToBuffer.js +0 -27
- package/dist/lib/helper/HexToNumber.d.ts +0 -10
- package/dist/lib/helper/HexToNumber.d.ts.map +0 -1
- package/dist/lib/helper/HexToNumber.js +0 -39
- package/dist/lib/helper/IPToBuffer.d.ts +0 -13
- package/dist/lib/helper/IPToBuffer.d.ts.map +0 -1
- package/dist/lib/helper/IPToBuffer.js +0 -28
- package/dist/lib/helper/NumberToBERBuffer.d.ts +0 -10
- package/dist/lib/helper/NumberToBERBuffer.d.ts.map +0 -1
- package/dist/lib/helper/NumberToBERBuffer.js +0 -22
- package/dist/lib/helper/NumberToBERHex.d.ts +0 -10
- package/dist/lib/helper/NumberToBERHex.d.ts.map +0 -1
- package/dist/lib/helper/NumberToBERHex.js +0 -27
- package/dist/lib/helper/NumberToBuffer.d.ts +0 -10
- package/dist/lib/helper/NumberToBuffer.d.ts.map +0 -1
- package/dist/lib/helper/NumberToBuffer.js +0 -22
- package/dist/lib/helper/NumberToHex.d.ts +0 -10
- package/dist/lib/helper/NumberToHex.d.ts.map +0 -1
- package/dist/lib/helper/NumberToHex.js +0 -26
- package/dist/lib/nodepcap/Capture.d.ts +0 -81
- package/dist/lib/nodepcap/Capture.d.ts.map +0 -1
- package/dist/lib/nodepcap/Capture.js +0 -323
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts +0 -7
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts.map +0 -1
- package/dist/lib/nodepcap/GetNetworkInterfaces.js +0 -22
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts +0 -16
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/IBindingCapture.js +0 -2
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts +0 -5
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.js +0 -2
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts +0 -23
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.js +0 -2
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts +0 -5
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/INetworkInterface.js +0 -2
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts +0 -15
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts.map +0 -1
- package/dist/lib/nodepcap/lib/BindingCapture.js +0 -35
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts +0 -2
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts.map +0 -1
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.js +0 -55
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts +0 -3
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts.map +0 -1
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.js +0 -18
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts +0 -2
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts.map +0 -1
- package/dist/lib/nodepcap/workers/CaptureWorker.js +0 -25
- package/dist/lib/pcap/PCAPGenerator.d.ts +0 -34
- package/dist/lib/pcap/PCAPGenerator.d.ts.map +0 -1
- package/dist/lib/pcap/PCAPGenerator.js +0 -101
- package/dist/lib/pcap/PcapParser.d.ts +0 -27
- package/dist/lib/pcap/PcapParser.d.ts.map +0 -1
- package/dist/lib/pcap/PcapParser.js +0 -149
- package/dist/lib/pcap/PcapReader.d.ts +0 -112
- package/dist/lib/pcap/PcapReader.d.ts.map +0 -1
- package/dist/lib/pcap/PcapReader.js +0 -263
- package/dist/lib/pcap/PcapWriter.d.ts +0 -29
- package/dist/lib/pcap/PcapWriter.d.ts.map +0 -1
- package/dist/lib/pcap/PcapWriter.js +0 -86
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts +0 -13
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts.map +0 -1
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.js +0 -2
- package/dist/lib/pipe/PipeClient.d.ts +0 -35
- package/dist/lib/pipe/PipeClient.d.ts.map +0 -1
- package/dist/lib/pipe/PipeClient.js +0 -71
- package/dist/lib/pipe/PipeClientSocket.d.ts +0 -39
- package/dist/lib/pipe/PipeClientSocket.d.ts.map +0 -1
- package/dist/lib/pipe/PipeClientSocket.js +0 -82
- package/dist/lib/pipe/PipeMessage.d.ts +0 -27
- package/dist/lib/pipe/PipeMessage.d.ts.map +0 -1
- package/dist/lib/pipe/PipeMessage.js +0 -61
- package/dist/lib/pipe/PipeMessageHandler.d.ts +0 -16
- package/dist/lib/pipe/PipeMessageHandler.d.ts.map +0 -1
- package/dist/lib/pipe/PipeMessageHandler.js +0 -95
- package/dist/lib/pipe/PipeServer.d.ts +0 -25
- package/dist/lib/pipe/PipeServer.d.ts.map +0 -1
- package/dist/lib/pipe/PipeServer.js +0 -59
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts +0 -35
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts.map +0 -1
- package/dist/lib/schema/ProtocolFieldJSONSchema.js +0 -2
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts +0 -3
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts.map +0 -1
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.js +0 -2
- package/dist/lib/schema/ProtocolJSONSchema.d.ts +0 -32
- package/dist/lib/schema/ProtocolJSONSchema.d.ts.map +0 -1
- package/dist/lib/schema/ProtocolJSONSchema.js +0 -2
- package/dist/tests/Test.spec.d.ts +0 -2
- package/dist/tests/Test.spec.d.ts.map +0 -1
- package/dist/tests/Test.spec.js +0 -25
- package/dist/tests/units/CaptureTest.spec.d.ts +0 -2
- package/dist/tests/units/CaptureTest.spec.d.ts.map +0 -1
- package/dist/tests/units/CaptureTest.spec.js +0 -32
- package/dist/tests/units/Codec.spec.d.ts +0 -2
- package/dist/tests/units/Codec.spec.d.ts.map +0 -1
- package/dist/tests/units/Codec.spec.js +0 -86
- package/dist/tests/units/ReadPCAP.spec.d.ts +0 -2
- package/dist/tests/units/ReadPCAP.spec.d.ts.map +0 -1
- package/dist/tests/units/ReadPCAP.spec.js +0 -14
- package/src/CodecExports.ts +0 -33
- package/src/CodecHeaderExports.ts +0 -1
- package/src/HelperExports.ts +0 -78
- package/src/NetworkExports.ts +0 -12
- package/src/PcapExports.ts +0 -32
- package/src/errors/ActionNotFoundError.ts +0 -6
- package/src/errors/CodecSchemaValidateError.ts +0 -6
- package/src/errors/DeviceNotFoundError.ts +0 -6
- package/src/errors/NoAvailableCodecError.ts +0 -6
- package/src/errors/NpcapLoadError.ts +0 -6
- package/src/errors/SocketDownError.ts +0 -6
- package/src/errors/UnknownPipeMessageTypeError.ts +0 -6
- package/src/errors/common/ErrorCode.ts +0 -30
- package/src/lib/GeneratePipeAddress.ts +0 -17
- package/src/lib/GetBinding.ts +0 -3
- package/src/lib/GetCaptureTemporaryDirectory.ts +0 -12
- package/src/lib/GetDeviceCaptureTemporaryFilename.ts +0 -13
- package/src/lib/codec/Codec.ts +0 -164
- package/src/lib/codec/PacketHeaders.ts +0 -23
- package/src/lib/codec/abstracts/BaseHeader.ts +0 -435
- package/src/lib/codec/headers/ARP.ts +0 -220
- package/src/lib/codec/headers/EthernetII.ts +0 -79
- package/src/lib/codec/headers/Goose.ts +0 -1003
- package/src/lib/codec/headers/ICMP.ts +0 -151
- package/src/lib/codec/headers/ICMPv6.ts +0 -128
- package/src/lib/codec/headers/IEC104_I_Frame.ts +0 -7373
- package/src/lib/codec/headers/IEC104_S_Frame.ts +0 -97
- package/src/lib/codec/headers/IEC104_U_Frame.ts +0 -139
- package/src/lib/codec/headers/IEC61850SampledValues.ts +0 -361
- package/src/lib/codec/headers/IPv4.ts +0 -331
- package/src/lib/codec/headers/IPv6.ts +0 -176
- package/src/lib/codec/headers/IPv6HopByHopOptions.ts +0 -532
- package/src/lib/codec/headers/RawData.ts +0 -38
- package/src/lib/codec/headers/TCP.ts +0 -934
- package/src/lib/codec/headers/TLS_Alert.ts +0 -539
- package/src/lib/codec/headers/TLS_ApplicationData.ts +0 -145
- package/src/lib/codec/headers/TLS_ChangeCipherSpec.ts +0 -146
- package/src/lib/codec/headers/TLS_Handshake.ts +0 -313
- package/src/lib/codec/headers/TLS_Heartbeat.ts +0 -188
- package/src/lib/codec/headers/UDP.ts +0 -182
- package/src/lib/codec/headers/VLAN_802dot1Q.ts +0 -79
- package/src/lib/codec/lib/FlexibleObject.ts +0 -100
- package/src/lib/codec/lib/GetBERIntegerLengthFromBuffer.ts +0 -12
- package/src/lib/codec/lib/ProcessPacketPostHandlers.ts +0 -53
- package/src/lib/codec/lib/SortPostHandlers.ts +0 -10
- package/src/lib/codec/lib/StringContentEncodingEnum.ts +0 -10
- package/src/lib/codec/types/CodecData.ts +0 -7
- package/src/lib/codec/types/CodecDecodeResult.ts +0 -11
- package/src/lib/codec/types/CodecEncodeInput.ts +0 -9
- package/src/lib/codec/types/CodecEncodeResult.ts +0 -6
- package/src/lib/codec/types/CodecErrorInfo.ts +0 -5
- package/src/lib/codec/types/CodecModule.ts +0 -3
- package/src/lib/codec/types/CodecModuleConstructor.ts +0 -3
- package/src/lib/codec/types/CodecSchema.ts +0 -7
- package/src/lib/codec/types/HeaderTreeNode.ts +0 -5
- package/src/lib/codec/types/PostHandlerItem.ts +0 -4
- package/src/lib/helper/BufferToHex.ts +0 -3
- package/src/lib/helper/BufferToIP.ts +0 -19
- package/src/lib/helper/BufferToNumber.ts +0 -31
- package/src/lib/helper/HexToBuffer.ts +0 -22
- package/src/lib/helper/HexToNumber.ts +0 -25
- package/src/lib/helper/IPToBuffer.ts +0 -25
- package/src/lib/helper/NumberToBERBuffer.ts +0 -21
- package/src/lib/helper/NumberToBERHex.ts +0 -17
- package/src/lib/helper/NumberToBuffer.ts +0 -21
- package/src/lib/helper/NumberToHex.ts +0 -15
- package/src/lib/nodepcap/Capture.ts +0 -304
- package/src/lib/nodepcap/GetNetworkInterfaces.ts +0 -18
- package/src/lib/nodepcap/interfaces/IBindingCapture.ts +0 -27
- package/src/lib/nodepcap/interfaces/IBindingCaptureOptions.ts +0 -4
- package/src/lib/nodepcap/interfaces/ICaptureOptions.ts +0 -24
- package/src/lib/nodepcap/interfaces/INetworkInterface.ts +0 -4
- package/src/lib/nodepcap/lib/BindingCapture.ts +0 -46
- package/src/lib/nodepcap/lib/GetNodePcapBinding.ts +0 -17
- package/src/lib/nodepcap/lib/GetNodePcapBindingCapture.ts +0 -15
- package/src/lib/nodepcap/workers/CaptureWorker.ts +0 -30
- package/src/lib/pcap/PCAPGenerator.ts +0 -123
- package/src/lib/pcap/PcapParser.ts +0 -170
- package/src/lib/pcap/PcapReader.ts +0 -306
- package/src/lib/pcap/PcapWriter.ts +0 -98
- package/src/lib/pcap/interfaces/IPcapPacketInfo.ts +0 -12
- package/src/lib/pipe/PipeClient.ts +0 -91
- package/src/lib/pipe/PipeClientSocket.ts +0 -99
- package/src/lib/pipe/PipeMessage.ts +0 -74
- package/src/lib/pipe/PipeMessageHandler.ts +0 -91
- package/src/lib/pipe/PipeServer.ts +0 -74
- package/src/lib/schema/ProtocolFieldJSONSchema.ts +0 -45
- package/src/lib/schema/ProtocolFieldJSONSchemaDefinition.ts +0 -3
- package/src/lib/schema/ProtocolJSONSchema.ts +0 -37
- package/src/tests/Test.spec.ts +0 -22
- package/src/tests/units/CaptureTest.spec.ts +0 -31
- package/src/tests/units/Codec.spec.ts +0 -102
- package/src/tests/units/ReadPCAP.spec.ts +0 -13
- package/test.pcap +0 -0
- package/tsconfig.json +0 -42
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {ProtocolJSONSchema} from '../../schema/ProtocolJSONSchema'
|
|
2
|
-
import {BufferToUInt8} from '../../helper/BufferToNumber'
|
|
3
|
-
import {BufferToHex} from '../../helper/BufferToHex'
|
|
4
|
-
import {HexToBuffer} from '../../helper/HexToBuffer'
|
|
5
|
-
import {BaseHeader} from '../abstracts/BaseHeader'
|
|
6
|
-
import {UInt8ToBuffer} from '../../helper/NumberToBuffer'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export class IEC104_S_Frame extends BaseHeader {
|
|
10
|
-
public SCHEMA: ProtocolJSONSchema = {
|
|
11
|
-
type: 'object',
|
|
12
|
-
properties: {
|
|
13
|
-
startByte: {
|
|
14
|
-
type: 'integer',
|
|
15
|
-
label: 'Start Byte',
|
|
16
|
-
minimum: 0,
|
|
17
|
-
maximum: 255,
|
|
18
|
-
decode: (): void => {
|
|
19
|
-
this.instance.startByte.setValue(BufferToUInt8(this.readBytes(0, 1)))
|
|
20
|
-
},
|
|
21
|
-
encode: (): void => {
|
|
22
|
-
this.writeBytes(0, UInt8ToBuffer(this.instance.startByte.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found'))))
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
apduLength: {
|
|
26
|
-
type: 'integer',
|
|
27
|
-
label: 'APDU Length',
|
|
28
|
-
minimum: 0,
|
|
29
|
-
maximum: 255,
|
|
30
|
-
decode: (): void => {
|
|
31
|
-
this.instance.apduLength.setValue(BufferToUInt8(this.readBytes(1, 1)))
|
|
32
|
-
},
|
|
33
|
-
encode: (): void => {
|
|
34
|
-
this.writeBytes(1, UInt8ToBuffer(this.instance.apduLength.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found'))))
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
controlField: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
label: 'Control Field',
|
|
40
|
-
decode: (): void => {
|
|
41
|
-
this.instance.controlField.setValue(BufferToHex(this.readBytes(2, 4)))
|
|
42
|
-
},
|
|
43
|
-
encode: (): void => {
|
|
44
|
-
this.writeBytes(2, HexToBuffer(this.instance.controlField.getValue('0', (nodePath: string): void => this.recordError(nodePath, 'Not Found'))))
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
apciType: {
|
|
48
|
-
type: 'string',
|
|
49
|
-
label: 'APCI Type',
|
|
50
|
-
minimum: 0,
|
|
51
|
-
maximum: 3,
|
|
52
|
-
decode: (): void => {
|
|
53
|
-
const controlType: number = this.readBits(2, 1, 7, 1)
|
|
54
|
-
switch (controlType) {
|
|
55
|
-
case 1: {
|
|
56
|
-
this.instance.apciType.setValue('S-Format')
|
|
57
|
-
}
|
|
58
|
-
break
|
|
59
|
-
default: {
|
|
60
|
-
this.recordError(this.instance.apciType.getPath(), 'Illegal acpiType!')
|
|
61
|
-
this.instance.apciType.setValue(controlType)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
encode: (): void => {
|
|
66
|
-
const controlType: string = this.instance.apciType.getValue('0', (nodePath: string): void => this.recordError(nodePath, 'Not Found'))
|
|
67
|
-
switch (controlType) {
|
|
68
|
-
case 'S-Format': {
|
|
69
|
-
this.writeBits(2, 1, 7, 1, 1)
|
|
70
|
-
}
|
|
71
|
-
break
|
|
72
|
-
default: {
|
|
73
|
-
this.writeBits(2, 1, 7, 1, this.instance.apciType.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found')))
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
public id: string = 'IEC104_S_Frame'
|
|
81
|
-
public name: string = 'IEC 60870-5-104'
|
|
82
|
-
public nickname: string = 'iec60870_104'
|
|
83
|
-
|
|
84
|
-
public match(): boolean {
|
|
85
|
-
if (!this.prevCodecModules) return false
|
|
86
|
-
if (BufferToUInt8(this.readBytes(0, 1)) != 104) return false
|
|
87
|
-
const type: number = this.readBits(2, 1, 6, 2)
|
|
88
|
-
switch (type) {
|
|
89
|
-
case 1: {
|
|
90
|
-
return true
|
|
91
|
-
}
|
|
92
|
-
default: {
|
|
93
|
-
return false
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import {ProtocolJSONSchema} from '../../schema/ProtocolJSONSchema'
|
|
2
|
-
import {BufferToUInt8} from '../../helper/BufferToNumber'
|
|
3
|
-
import {BufferToHex} from '../../helper/BufferToHex'
|
|
4
|
-
import {HexToBuffer} from '../../helper/HexToBuffer'
|
|
5
|
-
import {BaseHeader} from '../abstracts/BaseHeader'
|
|
6
|
-
import {UInt32ToBuffer, UInt8ToBuffer} from '../../helper/NumberToBuffer'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export class IEC104_U_Frame extends BaseHeader {
|
|
10
|
-
public SCHEMA: ProtocolJSONSchema = {
|
|
11
|
-
type: 'object',
|
|
12
|
-
properties: {
|
|
13
|
-
startByte: {
|
|
14
|
-
type: 'integer',
|
|
15
|
-
label: 'Start Byte',
|
|
16
|
-
minimum: 0,
|
|
17
|
-
maximum: 255,
|
|
18
|
-
decode: (): void => {
|
|
19
|
-
this.instance.startByte.setValue(BufferToUInt8(this.readBytes(0, 1)))
|
|
20
|
-
},
|
|
21
|
-
encode: (): void => {
|
|
22
|
-
this.writeBytes(0, UInt8ToBuffer(this.instance.startByte.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found'))))
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
apduLength: {
|
|
26
|
-
type: 'integer',
|
|
27
|
-
label: 'APDU Length',
|
|
28
|
-
minimum: 0,
|
|
29
|
-
maximum: 255,
|
|
30
|
-
decode: (): void => {
|
|
31
|
-
this.instance.apduLength.setValue(BufferToUInt8(this.readBytes(1, 1)))
|
|
32
|
-
},
|
|
33
|
-
encode: (): void => {
|
|
34
|
-
this.writeBytes(1, UInt8ToBuffer(this.instance.apduLength.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found'))))
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
controlField: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
label: 'Control Field',
|
|
40
|
-
decode: (): void => {
|
|
41
|
-
this.instance.controlField.setValue(BufferToHex(this.readBytes(2, 4)))
|
|
42
|
-
},
|
|
43
|
-
encode: (): void => {
|
|
44
|
-
this.writeBytes(2, HexToBuffer(this.instance.controlField.getValue('0', (nodePath: string): void => this.recordError(nodePath, 'Not Found'))))
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
apciType: {
|
|
48
|
-
type: 'string',
|
|
49
|
-
label: 'APCI Type',
|
|
50
|
-
minimum: 0,
|
|
51
|
-
maximum: 3,
|
|
52
|
-
decode: (): void => {
|
|
53
|
-
const uframeType: string = BufferToHex(this.readBytes(2, 4))
|
|
54
|
-
switch (uframeType) {
|
|
55
|
-
case '43000000': {
|
|
56
|
-
this.instance.apciType.setValue('U-Format Type:Test Frame Activation')
|
|
57
|
-
}
|
|
58
|
-
break
|
|
59
|
-
case '83000000': {
|
|
60
|
-
this.instance.apciType.setValue('U-Format Type:Test Frame Confirmation')
|
|
61
|
-
}
|
|
62
|
-
break
|
|
63
|
-
case '13000000': {
|
|
64
|
-
this.instance.apciType.setValue('U-Format Type:Stop Data Transfer Activation')
|
|
65
|
-
}
|
|
66
|
-
break
|
|
67
|
-
case '23000000': {
|
|
68
|
-
this.instance.apciType.setValue('U-Format Type:Stop Data Transfer Confirmation')
|
|
69
|
-
}
|
|
70
|
-
break
|
|
71
|
-
case '07000000': {
|
|
72
|
-
this.instance.apciType.setValue('U-Format Type:Start Data Transfer Activation')
|
|
73
|
-
}
|
|
74
|
-
break
|
|
75
|
-
case '0B000000': {
|
|
76
|
-
this.instance.apciType.setValue('U-Format Type:Start Data Transfer Confirmation')
|
|
77
|
-
}
|
|
78
|
-
break
|
|
79
|
-
default: {
|
|
80
|
-
this.recordError(this.instance.apciType.getPath(), 'Illegal acpiType!')
|
|
81
|
-
this.instance.apciType.setValue(uframeType)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
encode: (): void => {
|
|
86
|
-
const controlType: string = this.instance.apciType.getValue('0', (nodePath: string): void => this.recordError(nodePath, 'Not Found'))
|
|
87
|
-
switch (controlType) {
|
|
88
|
-
case 'U-Format Type:Test Frame Activation': {
|
|
89
|
-
this.writeBytes(2, UInt32ToBuffer(1124073472))
|
|
90
|
-
}
|
|
91
|
-
break
|
|
92
|
-
case 'U-Format Type:Test Frame Confirmation': {
|
|
93
|
-
this.writeBytes(2, UInt32ToBuffer(2197815296))
|
|
94
|
-
}
|
|
95
|
-
break
|
|
96
|
-
case 'U-Format Type:Stop Data Transfer Activation': {
|
|
97
|
-
this.writeBytes(2, UInt32ToBuffer(318767104))
|
|
98
|
-
}
|
|
99
|
-
break
|
|
100
|
-
case 'U-Format Type:Stop Data Transfer Confirmation': {
|
|
101
|
-
this.writeBytes(2, UInt32ToBuffer(587202560))
|
|
102
|
-
}
|
|
103
|
-
break
|
|
104
|
-
case 'U-Format Type:Start Data Transfer Activation': {
|
|
105
|
-
this.writeBytes(2, UInt32ToBuffer(117440512))
|
|
106
|
-
}
|
|
107
|
-
break
|
|
108
|
-
case 'U-Format Type:Start Data Transfer Confirmation': {
|
|
109
|
-
this.writeBytes(2, UInt32ToBuffer(184549376))
|
|
110
|
-
}
|
|
111
|
-
break
|
|
112
|
-
default: {
|
|
113
|
-
this.writeBytes(2, HexToBuffer(this.instance.apciType.getValue('0', (nodePath: string): void => this.recordError(nodePath, 'Not Found'))))
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
public id: string = 'IEC104_U_Frame'
|
|
123
|
-
public name: string = 'IEC 60870-5-104'
|
|
124
|
-
public nickname: string = 'iec60870_104'
|
|
125
|
-
|
|
126
|
-
public match(): boolean {
|
|
127
|
-
if (!this.prevCodecModules) return false
|
|
128
|
-
if (BufferToUInt8(this.readBytes(0, 1)) != 104) return false
|
|
129
|
-
const type: number = this.readBits(2, 1, 6, 2)
|
|
130
|
-
switch (type) {
|
|
131
|
-
case 3: {
|
|
132
|
-
return true
|
|
133
|
-
}
|
|
134
|
-
default: {
|
|
135
|
-
return false
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import {ProtocolJSONSchema} from '../../schema/ProtocolJSONSchema'
|
|
2
|
-
import {BaseHeader} from '../abstracts/BaseHeader'
|
|
3
|
-
import TLV from 'node-tlv'
|
|
4
|
-
import {HexToUInt16} from '../../helper/HexToNumber'
|
|
5
|
-
import {UInt16ToBERHex} from '../../helper/NumberToBERHex'
|
|
6
|
-
import {UInt16ToHex, UInt32ToHex, UInt8ToHex} from '../../helper/NumberToHex'
|
|
7
|
-
import {StringContentEncodingEnum} from '../lib/StringContentEncodingEnum'
|
|
8
|
-
import {BufferToUInt16, BufferToUInt32, BufferToUInt64, BufferToUInt8} from '../../helper/BufferToNumber'
|
|
9
|
-
import {UInt16ToBuffer} from '../../helper/NumberToBuffer'
|
|
10
|
-
|
|
11
|
-
type ASDUItem = {
|
|
12
|
-
svID: string
|
|
13
|
-
dataSet?: string
|
|
14
|
-
smpCnt: number
|
|
15
|
-
confRev: number
|
|
16
|
-
refrTm?: string
|
|
17
|
-
smpSynch: number
|
|
18
|
-
smpRate?: number
|
|
19
|
-
sample: string
|
|
20
|
-
smpMod?: number
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class IEC61850SampledValues extends BaseHeader {
|
|
24
|
-
|
|
25
|
-
protected TLVInstance: TLV
|
|
26
|
-
|
|
27
|
-
protected TLVChild: TLV[] = []
|
|
28
|
-
|
|
29
|
-
public SCHEMA: ProtocolJSONSchema = {
|
|
30
|
-
type: 'object',
|
|
31
|
-
properties: {
|
|
32
|
-
appid: {
|
|
33
|
-
type: 'integer',
|
|
34
|
-
minimum: 0,
|
|
35
|
-
maximum: 65535,
|
|
36
|
-
label: 'APPID',
|
|
37
|
-
decode: (): void => {
|
|
38
|
-
this.instance.appid.setValue(BufferToUInt16(this.readBytes(0, 2)))
|
|
39
|
-
},
|
|
40
|
-
encode: (): void => {
|
|
41
|
-
const APPID: number = this.instance.appid.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found'))
|
|
42
|
-
this.instance.appid.setValue(APPID)
|
|
43
|
-
this.writeBytes(0, UInt16ToBuffer(APPID))
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
length: {
|
|
47
|
-
type: 'integer',
|
|
48
|
-
label: 'Length',
|
|
49
|
-
decode: (): void => {
|
|
50
|
-
this.instance.length.setValue(BufferToUInt16(this.readBytes(2, 2)))
|
|
51
|
-
},
|
|
52
|
-
encode: (): void => {
|
|
53
|
-
const length: number = this.instance.length.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found'))
|
|
54
|
-
if (length > 0) {
|
|
55
|
-
this.instance.length.setValue(length)
|
|
56
|
-
this.writeBytes(2, UInt16ToBuffer(length))
|
|
57
|
-
} else {
|
|
58
|
-
this.addPostSelfEncodeHandler((): void => {
|
|
59
|
-
const finalLength: number = parseInt(this.instance.length.getValue().toString())
|
|
60
|
-
this.writeBytes(2, UInt16ToBuffer(finalLength))
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
reserved1: {
|
|
66
|
-
type: 'object',
|
|
67
|
-
label: 'Reserved1',
|
|
68
|
-
properties: {
|
|
69
|
-
simulated: {
|
|
70
|
-
type: 'boolean',
|
|
71
|
-
label: 'Simulated',
|
|
72
|
-
decode: (): void => {
|
|
73
|
-
this.instance.reserved1.simulated.setValue(!!this.readBits(4, 2, 0, 1))
|
|
74
|
-
},
|
|
75
|
-
encode: (): void => {
|
|
76
|
-
const simulated: boolean = !!this.instance.reserved1.simulated.getValue()
|
|
77
|
-
this.writeBits(4, 2, 0, 1, simulated ? 1 : 0)
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
reserved: {
|
|
81
|
-
type: 'number',
|
|
82
|
-
minimum: 0,
|
|
83
|
-
maximum: 32767,
|
|
84
|
-
label: 'Reserved',
|
|
85
|
-
decode: (): void => {
|
|
86
|
-
this.instance.reserved1.reserved.setValue(this.readBits(4, 2, 1, 16))
|
|
87
|
-
},
|
|
88
|
-
encode: (): void => {
|
|
89
|
-
const reserved: number = this.instance.reserved1.reserved.getValue(0)
|
|
90
|
-
this.writeBits(4, 2, 1, 16, reserved)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
reserved2: {
|
|
96
|
-
type: 'object',
|
|
97
|
-
label: 'Reserved2',
|
|
98
|
-
properties: {
|
|
99
|
-
reserved: {
|
|
100
|
-
type: 'number',
|
|
101
|
-
minimum: 0,
|
|
102
|
-
maximum: 65535,
|
|
103
|
-
label: 'Reserved',
|
|
104
|
-
decode: (): void => {
|
|
105
|
-
this.instance.reserved2.reserved.setValue(this.readBits(4, 2, 0, 16))
|
|
106
|
-
},
|
|
107
|
-
encode: (): void => {
|
|
108
|
-
const reserved: number = this.instance.reserved2.reserved.getValue(0)
|
|
109
|
-
this.writeBits(4, 2, 0, 16, reserved)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
svPdu: {
|
|
115
|
-
type: 'object',
|
|
116
|
-
label: 'Sampled Values PDU',
|
|
117
|
-
decode: (): void => {
|
|
118
|
-
const buffer: Buffer = this.readBytes(8, (this.instance.length.getValue()) - 8)
|
|
119
|
-
this.TLVInstance = TLV.parse(buffer)
|
|
120
|
-
this.TLVChild = this.TLVInstance.getChild()
|
|
121
|
-
this.instance.svPdu.setValue({})
|
|
122
|
-
},
|
|
123
|
-
encode: (): void => {
|
|
124
|
-
let buffer: Buffer = Buffer.from([])
|
|
125
|
-
this.TLVChild.forEach(TLVItem => buffer = Buffer.concat([buffer, TLVItem.bTag, TLVItem.bLength, TLVItem.bValue]))
|
|
126
|
-
const svPduTLV: TLV = new TLV(0x60, buffer)
|
|
127
|
-
const svPduBuffer: Buffer = Buffer.concat([svPduTLV.bTag, svPduTLV.bLength, svPduTLV.bValue])
|
|
128
|
-
this.writeBytes(8, svPduBuffer)
|
|
129
|
-
/**
|
|
130
|
-
* Update the length only if it is not set
|
|
131
|
-
* Update length(APPID's length + Length's length + Reserved1's length + Reserved2's length + svPdu's length)
|
|
132
|
-
*/
|
|
133
|
-
if (this.instance.length.getValue() > 0) return
|
|
134
|
-
this.instance.length.setValue(2 + 2 + 2 + 2 + svPduBuffer.length)
|
|
135
|
-
},
|
|
136
|
-
properties: {
|
|
137
|
-
noASDU: {
|
|
138
|
-
type: 'integer',
|
|
139
|
-
minimum: 1,
|
|
140
|
-
maximum: 65535,
|
|
141
|
-
label: 'Number of ASDU',
|
|
142
|
-
decode: (): void => {
|
|
143
|
-
const noASDUTLV: TLV | undefined = this.TLVChild.find(tlv => tlv.getTag('number') === 0x80)
|
|
144
|
-
if (!noASDUTLV) return this.recordError(this.instance.svPdu.noASDU.getPath(), 'Not Found')
|
|
145
|
-
const noASDUNum: number = HexToUInt16(noASDUTLV.getValue('hex'))
|
|
146
|
-
if (!noASDUNum) this.recordError(this.instance.svPdu.noASDU.getPath(), 'Number of ASDU should be greater or equal to 1')
|
|
147
|
-
this.instance.svPdu.noASDU.setValue(noASDUNum)
|
|
148
|
-
},
|
|
149
|
-
encode: (): void => {
|
|
150
|
-
const noASDU: number = this.instance.svPdu.noASDU.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'noASDU is not set'))
|
|
151
|
-
this.TLVChild.push(new TLV(0x80, UInt16ToBERHex(noASDU)))
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
seqASDU: {
|
|
155
|
-
type: 'array',
|
|
156
|
-
label: 'Sequence ASDU',
|
|
157
|
-
items: {
|
|
158
|
-
type: 'object',
|
|
159
|
-
properties: {
|
|
160
|
-
svID: {
|
|
161
|
-
type: 'string',
|
|
162
|
-
contentEncoding: StringContentEncodingEnum.ASCII,
|
|
163
|
-
label: 'SvID'
|
|
164
|
-
},
|
|
165
|
-
dataSet: {
|
|
166
|
-
type: 'string',
|
|
167
|
-
contentEncoding: StringContentEncodingEnum.ASCII,
|
|
168
|
-
label: 'DatSet'
|
|
169
|
-
},
|
|
170
|
-
smpCnt: {
|
|
171
|
-
type: 'integer',
|
|
172
|
-
label: 'SmpCnt'
|
|
173
|
-
},
|
|
174
|
-
confRev: {
|
|
175
|
-
type: 'integer',
|
|
176
|
-
label: 'ConfRev'
|
|
177
|
-
},
|
|
178
|
-
refrTm: {
|
|
179
|
-
type: 'string',
|
|
180
|
-
contentEncoding: StringContentEncodingEnum.BIGINT,
|
|
181
|
-
label: 'RefrTm'
|
|
182
|
-
},
|
|
183
|
-
smpSynch: {
|
|
184
|
-
type: 'integer',
|
|
185
|
-
label: 'SmpSynch'
|
|
186
|
-
},
|
|
187
|
-
smpRate: {
|
|
188
|
-
type: 'integer',
|
|
189
|
-
label: 'SmpRate'
|
|
190
|
-
},
|
|
191
|
-
sample: {
|
|
192
|
-
type: 'string',
|
|
193
|
-
contentEncoding: StringContentEncodingEnum.HEX,
|
|
194
|
-
label: 'Sample'
|
|
195
|
-
},
|
|
196
|
-
smpMod: {
|
|
197
|
-
type: 'integer',
|
|
198
|
-
label: 'SmpMod'
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
decode: (): void => {
|
|
203
|
-
const seqASDU: ASDUItem[] = []
|
|
204
|
-
const seqASDUTLV: TLV | undefined = this.TLVChild.find(tlv => tlv.getTag('number') === 0xa2)
|
|
205
|
-
if (!seqASDUTLV) {
|
|
206
|
-
this.instance.svPdu.seqASDU.setValue(seqASDU)
|
|
207
|
-
return
|
|
208
|
-
}
|
|
209
|
-
const ASDUTLVs: TLV[] = seqASDUTLV.getChild()
|
|
210
|
-
ASDUTLVs.forEach((ASDUTLV: TLV, index: number): void => {
|
|
211
|
-
const errorNodePath: string = this.instance.svPdu.seqASDU.getPath(index)
|
|
212
|
-
if (ASDUTLV.getTag('number') !== 0x30) this.recordError(errorNodePath, 'Invalid ASDU item tag')
|
|
213
|
-
const ASDUAttributeTLVs: TLV[] = ASDUTLV.getChild()
|
|
214
|
-
let svID: string
|
|
215
|
-
let dataSet: string
|
|
216
|
-
let smpCnt: number
|
|
217
|
-
let confRev: number
|
|
218
|
-
let refrTm: string
|
|
219
|
-
let smpSynch: number
|
|
220
|
-
let smpRate: number
|
|
221
|
-
let sample: string
|
|
222
|
-
let smpMod: number
|
|
223
|
-
//svID
|
|
224
|
-
const svIDTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x80)
|
|
225
|
-
if (svIDTLV) {
|
|
226
|
-
svID = svIDTLV.getValue('buffer').toString('ascii')
|
|
227
|
-
} else {
|
|
228
|
-
this.recordError(errorNodePath, 'svID Not Found')
|
|
229
|
-
}
|
|
230
|
-
//dataSet (optional)
|
|
231
|
-
const dataSetTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x81)
|
|
232
|
-
if (dataSetTLV) {
|
|
233
|
-
dataSet = dataSetTLV.getValue('buffer').toString('ascii')
|
|
234
|
-
}
|
|
235
|
-
//smpCnt
|
|
236
|
-
const smpCntTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x82)
|
|
237
|
-
if (smpCntTLV) {
|
|
238
|
-
smpCnt = BufferToUInt16(smpCntTLV.getValue('buffer'))
|
|
239
|
-
} else {
|
|
240
|
-
this.recordError(errorNodePath, 'smpCnt Not Found')
|
|
241
|
-
}
|
|
242
|
-
//confRev
|
|
243
|
-
const confRevTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x83)
|
|
244
|
-
if (confRevTLV) {
|
|
245
|
-
confRev = BufferToUInt32(confRevTLV.getValue('buffer'))
|
|
246
|
-
} else {
|
|
247
|
-
this.recordError(errorNodePath, 'confRev Not Found')
|
|
248
|
-
}
|
|
249
|
-
//refrTm (optional)
|
|
250
|
-
const refrTmTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x84)
|
|
251
|
-
if (refrTmTLV) {
|
|
252
|
-
refrTm = BufferToUInt64(refrTmTLV.getValue('buffer')).toString()
|
|
253
|
-
}
|
|
254
|
-
//smpSynch
|
|
255
|
-
const smpSynchTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x85)
|
|
256
|
-
if (smpSynchTLV) {
|
|
257
|
-
smpSynch = BufferToUInt8(smpSynchTLV.getValue('buffer'))
|
|
258
|
-
} else {
|
|
259
|
-
this.recordError(errorNodePath, 'smpSynch Not Found')
|
|
260
|
-
}
|
|
261
|
-
//smpRate (optional)
|
|
262
|
-
const smpRateTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x86)
|
|
263
|
-
if (smpRateTLV) {
|
|
264
|
-
smpRate = BufferToUInt16(smpRateTLV.getValue('buffer'))
|
|
265
|
-
}
|
|
266
|
-
//sample
|
|
267
|
-
const sampleTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x87)
|
|
268
|
-
if (sampleTLV) {
|
|
269
|
-
sample = sampleTLV.getValue('hex')
|
|
270
|
-
} else {
|
|
271
|
-
this.recordError(errorNodePath, 'sample Not Found')
|
|
272
|
-
}
|
|
273
|
-
//smpMod (optional)
|
|
274
|
-
const smpModTLV: TLV | undefined = ASDUAttributeTLVs.find(tlv => tlv.getTag('number') === 0x86)
|
|
275
|
-
if (smpModTLV) {
|
|
276
|
-
smpMod = 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: (): void => {
|
|
293
|
-
const seqASDU: ASDUItem[] = this.instance.svPdu.seqASDU.isUndefined() ? [] : this.instance.svPdu.seqASDU.getValue()
|
|
294
|
-
const seqASDUTLVs: TLV[] = []
|
|
295
|
-
seqASDU.forEach((seqASDUItem: ASDUItem, index: number): void => {
|
|
296
|
-
const errorNodePath: string = this.instance.svPdu.seqASDU.getPath(index)
|
|
297
|
-
const seqASDUItemTLVs: TLV[] = []
|
|
298
|
-
//svID
|
|
299
|
-
if (seqASDUItem.svID !== undefined) {
|
|
300
|
-
seqASDUItemTLVs.push(new TLV(0x80, Buffer.from(seqASDUItem.svID ? seqASDUItem.svID : '', 'ascii')))
|
|
301
|
-
} else {
|
|
302
|
-
this.recordError(errorNodePath, 'No svID')
|
|
303
|
-
}
|
|
304
|
-
//dataSet
|
|
305
|
-
if (seqASDUItem.dataSet !== undefined) seqASDUItemTLVs.push(new TLV(0x81, Buffer.from(seqASDUItem.dataSet ? seqASDUItem.dataSet : '', 'ascii')))
|
|
306
|
-
// smpCnt
|
|
307
|
-
if (seqASDUItem.smpCnt !== undefined) {
|
|
308
|
-
seqASDUItemTLVs.push(new TLV(0x82, UInt16ToHex(seqASDUItem.smpCnt)))
|
|
309
|
-
} else {
|
|
310
|
-
this.recordError(errorNodePath, 'No smpCnt')
|
|
311
|
-
}
|
|
312
|
-
// confRev
|
|
313
|
-
if (seqASDUItem.confRev !== undefined) {
|
|
314
|
-
seqASDUItemTLVs.push(new TLV(0x83, UInt32ToHex(seqASDUItem.confRev)))
|
|
315
|
-
} else {
|
|
316
|
-
this.recordError(errorNodePath, 'No confRev')
|
|
317
|
-
}
|
|
318
|
-
// refrTm
|
|
319
|
-
if (seqASDUItem.refrTm !== undefined) seqASDUItemTLVs.push(new TLV(0x84, Buffer.from(BigInt(seqASDUItem.refrTm).toString(16).padStart(8 * 2, '0'), 'hex')))
|
|
320
|
-
// smpSynch
|
|
321
|
-
if (seqASDUItem.smpSynch !== undefined) {
|
|
322
|
-
seqASDUItemTLVs.push(new TLV(0x85, UInt8ToHex(seqASDUItem.smpSynch)))
|
|
323
|
-
} else {
|
|
324
|
-
this.recordError(errorNodePath, 'No smpSynch')
|
|
325
|
-
}
|
|
326
|
-
// smpRate
|
|
327
|
-
if (seqASDUItem.smpRate !== undefined) seqASDUItemTLVs.push(new TLV(0x86, UInt16ToHex(seqASDUItem.smpRate)))
|
|
328
|
-
// sample
|
|
329
|
-
if (seqASDUItem.sample !== undefined) {
|
|
330
|
-
seqASDUItemTLVs.push(new TLV(0x87, Buffer.from(seqASDUItem.sample, 'hex')))
|
|
331
|
-
} else {
|
|
332
|
-
this.recordError(errorNodePath, 'No sample')
|
|
333
|
-
}
|
|
334
|
-
// smpMod
|
|
335
|
-
if (seqASDUItem.smpMod !== undefined) seqASDUItemTLVs.push(new TLV(0x88, UInt16ToHex(seqASDUItem.smpMod)))
|
|
336
|
-
if (!seqASDUItemTLVs.length) return
|
|
337
|
-
let seqASDUItemBuffer: Buffer = Buffer.from([])
|
|
338
|
-
seqASDUItemTLVs.forEach(seqASDUItemTLV => seqASDUItemBuffer = Buffer.concat([seqASDUItemBuffer, seqASDUItemTLV.bTag, seqASDUItemTLV.bLength, seqASDUItemTLV.bValue]))
|
|
339
|
-
seqASDUTLVs.push(new TLV(0x30, seqASDUItemBuffer))
|
|
340
|
-
})
|
|
341
|
-
let seqASDUBuffer: Buffer = Buffer.from([])
|
|
342
|
-
seqASDUTLVs.forEach(seqASDUTLV => seqASDUBuffer = Buffer.concat([seqASDUBuffer, seqASDUTLV.bTag, seqASDUTLV.bLength, seqASDUTLV.bValue]))
|
|
343
|
-
this.TLVChild.push(new TLV(0xa2, seqASDUBuffer))
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
public readonly id: string = 'sv'
|
|
352
|
-
|
|
353
|
-
public readonly name: string = 'IEC61850 Sampled Values'
|
|
354
|
-
|
|
355
|
-
public readonly nickname: string = 'SV'
|
|
356
|
-
|
|
357
|
-
public match(): boolean {
|
|
358
|
-
if (!this.prevCodecModule) return false
|
|
359
|
-
return this.prevCodecModule.instance.etherType.getValue() === UInt16ToHex(0x88ba)
|
|
360
|
-
}
|
|
361
|
-
}
|