@netkitty/codec 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 +17 -0
- package/LICENSE +21 -0
- package/README.md +352 -0
- package/README.zh-CN.md +342 -0
- package/dist/Codec.d.ts +133 -0
- package/dist/Codec.js +632 -0
- package/dist/PacketHeaders.d.ts +189 -0
- package/dist/PacketHeaders.js +384 -0
- package/dist/abstracts/BaseHeader.d.ts +325 -0
- package/dist/abstracts/BaseHeader.js +734 -0
- package/dist/errors/CodecSchemaValidateError.d.ts +4 -0
- package/dist/errors/CodecSchemaValidateError.js +11 -0
- package/dist/headers/ADSAMS.d.ts +33 -0
- package/dist/headers/ADSAMS.js +208 -0
- package/dist/headers/AH.d.ts +28 -0
- package/dist/headers/AH.js +137 -0
- package/dist/headers/AMQP.d.ts +31 -0
- package/dist/headers/AMQP.js +316 -0
- package/dist/headers/ARP.d.ts +26 -0
- package/dist/headers/ARP.js +243 -0
- package/dist/headers/BACnetIP.d.ts +27 -0
- package/dist/headers/BACnetIP.js +97 -0
- package/dist/headers/BFD.d.ts +28 -0
- package/dist/headers/BFD.js +155 -0
- package/dist/headers/BGP.d.ts +27 -0
- package/dist/headers/BGP.js +111 -0
- package/dist/headers/BSAPIP.d.ts +33 -0
- package/dist/headers/BSAPIP.js +78 -0
- package/dist/headers/Babel.d.ts +32 -0
- package/dist/headers/Babel.js +224 -0
- package/dist/headers/BitTorrent.d.ts +28 -0
- package/dist/headers/BitTorrent.js +72 -0
- package/dist/headers/C37118.d.ts +26 -0
- package/dist/headers/C37118.js +147 -0
- package/dist/headers/CAPWAP.d.ts +38 -0
- package/dist/headers/CAPWAP.js +275 -0
- package/dist/headers/CDP.d.ts +25 -0
- package/dist/headers/CDP.js +117 -0
- package/dist/headers/CMS.d.ts +33 -0
- package/dist/headers/CMS.js +238 -0
- package/dist/headers/COTP.d.ts +30 -0
- package/dist/headers/COTP.js +193 -0
- package/dist/headers/CassandraCQL.d.ts +28 -0
- package/dist/headers/CassandraCQL.js +117 -0
- package/dist/headers/CoAP.d.ts +29 -0
- package/dist/headers/CoAP.js +140 -0
- package/dist/headers/Codesys.d.ts +32 -0
- package/dist/headers/Codesys.js +119 -0
- package/dist/headers/Collectd.d.ts +29 -0
- package/dist/headers/Collectd.js +154 -0
- package/dist/headers/DCCP.d.ts +30 -0
- package/dist/headers/DCCP.js +204 -0
- package/dist/headers/DHCP.d.ts +26 -0
- package/dist/headers/DHCP.js +148 -0
- package/dist/headers/DHCPFailover.d.ts +30 -0
- package/dist/headers/DHCPFailover.js +104 -0
- package/dist/headers/DHCPv6.d.ts +25 -0
- package/dist/headers/DHCPv6.js +145 -0
- package/dist/headers/DNP3.d.ts +27 -0
- package/dist/headers/DNP3.js +150 -0
- package/dist/headers/DNS.d.ts +55 -0
- package/dist/headers/DNS.js +309 -0
- package/dist/headers/DTLS.d.ts +33 -0
- package/dist/headers/DTLS.js +142 -0
- package/dist/headers/Diameter.d.ts +34 -0
- package/dist/headers/Diameter.js +229 -0
- package/dist/headers/EAPOL.d.ts +32 -0
- package/dist/headers/EAPOL.js +135 -0
- package/dist/headers/EIGRP.d.ts +28 -0
- package/dist/headers/EIGRP.js +165 -0
- package/dist/headers/ENIP.d.ts +31 -0
- package/dist/headers/ENIP.js +164 -0
- package/dist/headers/ESP.d.ts +27 -0
- package/dist/headers/ESP.js +140 -0
- package/dist/headers/Elasticsearch.d.ts +30 -0
- package/dist/headers/Elasticsearch.js +125 -0
- package/dist/headers/EtherCAT.d.ts +35 -0
- package/dist/headers/EtherCAT.js +150 -0
- package/dist/headers/EthernetII.d.ts +28 -0
- package/dist/headers/EthernetII.js +117 -0
- package/dist/headers/FCoE.d.ts +38 -0
- package/dist/headers/FCoE.js +210 -0
- package/dist/headers/FTP.d.ts +34 -0
- package/dist/headers/FTP.js +158 -0
- package/dist/headers/Finger.d.ts +41 -0
- package/dist/headers/Finger.js +135 -0
- package/dist/headers/FoundationFieldbusHSE.d.ts +43 -0
- package/dist/headers/FoundationFieldbusHSE.js +163 -0
- package/dist/headers/GELF.d.ts +35 -0
- package/dist/headers/GELF.js +261 -0
- package/dist/headers/GENEVE.d.ts +26 -0
- package/dist/headers/GENEVE.js +209 -0
- package/dist/headers/GESRTP.d.ts +32 -0
- package/dist/headers/GESRTP.js +141 -0
- package/dist/headers/GLBP.d.ts +29 -0
- package/dist/headers/GLBP.js +159 -0
- package/dist/headers/GRE.d.ts +27 -0
- package/dist/headers/GRE.js +181 -0
- package/dist/headers/GTPU.d.ts +25 -0
- package/dist/headers/GTPU.js +203 -0
- package/dist/headers/GTPv2C.d.ts +30 -0
- package/dist/headers/GTPv2C.js +281 -0
- package/dist/headers/GitProtocol.d.ts +34 -0
- package/dist/headers/GitProtocol.js +141 -0
- package/dist/headers/Goose.d.ts +115 -0
- package/dist/headers/Goose.js +1067 -0
- package/dist/headers/Gopher.d.ts +43 -0
- package/dist/headers/Gopher.js +182 -0
- package/dist/headers/HARTIP.d.ts +30 -0
- package/dist/headers/HARTIP.js +145 -0
- package/dist/headers/HSR.d.ts +27 -0
- package/dist/headers/HSR.js +105 -0
- package/dist/headers/HSRP.d.ts +26 -0
- package/dist/headers/HSRP.js +173 -0
- package/dist/headers/HTTP.d.ts +32 -0
- package/dist/headers/HTTP.js +153 -0
- package/dist/headers/HTTP2.d.ts +34 -0
- package/dist/headers/HTTP2.js +190 -0
- package/dist/headers/IAX2.d.ts +33 -0
- package/dist/headers/IAX2.js +274 -0
- package/dist/headers/ICMP.d.ts +15 -0
- package/dist/headers/ICMP.js +148 -0
- package/dist/headers/ICMPv6.d.ts +15 -0
- package/dist/headers/ICMPv6.js +129 -0
- package/dist/headers/IEC104_I_Frame.d.ts +23 -0
- package/dist/headers/IEC104_I_Frame.js +6489 -0
- package/dist/headers/IEC104_S_Frame.d.ts +26 -0
- package/dist/headers/IEC104_S_Frame.js +135 -0
- package/dist/headers/IEC104_U_Frame.d.ts +27 -0
- package/dist/headers/IEC104_U_Frame.js +176 -0
- package/dist/headers/IEC61850SampledValues.d.ts +20 -0
- package/dist/headers/IEC61850SampledValues.js +420 -0
- package/dist/headers/IGMP.d.ts +31 -0
- package/dist/headers/IGMP.js +274 -0
- package/dist/headers/IMAP.d.ts +32 -0
- package/dist/headers/IMAP.js +185 -0
- package/dist/headers/IPFIX.d.ts +29 -0
- package/dist/headers/IPFIX.js +156 -0
- package/dist/headers/IPv4.d.ts +20 -0
- package/dist/headers/IPv4.js +370 -0
- package/dist/headers/IPv6.d.ts +29 -0
- package/dist/headers/IPv6.js +209 -0
- package/dist/headers/IPv6HopByHopOptions.d.ts +81 -0
- package/dist/headers/IPv6HopByHopOptions.js +495 -0
- package/dist/headers/IRC.d.ts +34 -0
- package/dist/headers/IRC.js +175 -0
- package/dist/headers/ISAKMP.d.ts +29 -0
- package/dist/headers/ISAKMP.js +197 -0
- package/dist/headers/ISCSI.d.ts +39 -0
- package/dist/headers/ISCSI.js +289 -0
- package/dist/headers/ISIS.d.ts +25 -0
- package/dist/headers/ISIS.js +79 -0
- package/dist/headers/ISOSession.d.ts +27 -0
- package/dist/headers/ISOSession.js +343 -0
- package/dist/headers/Ident.d.ts +42 -0
- package/dist/headers/Ident.js +184 -0
- package/dist/headers/KNXnetIP.d.ts +30 -0
- package/dist/headers/KNXnetIP.js +135 -0
- package/dist/headers/Kafka.d.ts +35 -0
- package/dist/headers/Kafka.js +128 -0
- package/dist/headers/Kerberos.d.ts +30 -0
- package/dist/headers/Kerberos.js +217 -0
- package/dist/headers/L2TP.d.ts +26 -0
- package/dist/headers/L2TP.js +297 -0
- package/dist/headers/LACP.d.ts +31 -0
- package/dist/headers/LACP.js +151 -0
- package/dist/headers/LDAP.d.ts +31 -0
- package/dist/headers/LDAP.js +226 -0
- package/dist/headers/LDP.d.ts +31 -0
- package/dist/headers/LDP.js +138 -0
- package/dist/headers/LISP.d.ts +30 -0
- package/dist/headers/LISP.js +103 -0
- package/dist/headers/LLC.d.ts +27 -0
- package/dist/headers/LLC.js +81 -0
- package/dist/headers/LLDP.d.ts +26 -0
- package/dist/headers/LLDP.js +126 -0
- package/dist/headers/LLMNR.d.ts +23 -0
- package/dist/headers/LLMNR.js +40 -0
- package/dist/headers/LPD.d.ts +31 -0
- package/dist/headers/LPD.js +159 -0
- package/dist/headers/MACsec.d.ts +34 -0
- package/dist/headers/MACsec.js +178 -0
- package/dist/headers/MDNS.d.ts +26 -0
- package/dist/headers/MDNS.js +45 -0
- package/dist/headers/MGCP.d.ts +30 -0
- package/dist/headers/MGCP.js +155 -0
- package/dist/headers/MMS.d.ts +29 -0
- package/dist/headers/MMS.js +243 -0
- package/dist/headers/MPLS.d.ts +31 -0
- package/dist/headers/MPLS.js +145 -0
- package/dist/headers/MQTT.d.ts +30 -0
- package/dist/headers/MQTT.js +173 -0
- package/dist/headers/MQTTSN.d.ts +34 -0
- package/dist/headers/MQTTSN.js +177 -0
- package/dist/headers/MarkerProtocol.d.ts +32 -0
- package/dist/headers/MarkerProtocol.js +153 -0
- package/dist/headers/Megaco.d.ts +32 -0
- package/dist/headers/Megaco.js +144 -0
- package/dist/headers/Memcached.d.ts +44 -0
- package/dist/headers/Memcached.js +285 -0
- package/dist/headers/ModbusTCP.d.ts +25 -0
- package/dist/headers/ModbusTCP.js +99 -0
- package/dist/headers/ModbusUDP.d.ts +26 -0
- package/dist/headers/ModbusUDP.js +100 -0
- package/dist/headers/MongoDB.d.ts +33 -0
- package/dist/headers/MongoDB.js +143 -0
- package/dist/headers/MySQL.d.ts +30 -0
- package/dist/headers/MySQL.js +114 -0
- package/dist/headers/NATS.d.ts +29 -0
- package/dist/headers/NATS.js +135 -0
- package/dist/headers/NBDS.d.ts +34 -0
- package/dist/headers/NBDS.js +176 -0
- package/dist/headers/NBNS.d.ts +34 -0
- package/dist/headers/NBNS.js +78 -0
- package/dist/headers/NBSS.d.ts +36 -0
- package/dist/headers/NBSS.js +137 -0
- package/dist/headers/NFS.d.ts +36 -0
- package/dist/headers/NFS.js +273 -0
- package/dist/headers/NHRP.d.ts +32 -0
- package/dist/headers/NHRP.js +154 -0
- package/dist/headers/NNTP.d.ts +35 -0
- package/dist/headers/NNTP.js +162 -0
- package/dist/headers/NTP.d.ts +18 -0
- package/dist/headers/NTP.js +73 -0
- package/dist/headers/NetFlowV5.d.ts +28 -0
- package/dist/headers/NetFlowV5.js +205 -0
- package/dist/headers/OLSR.d.ts +31 -0
- package/dist/headers/OLSR.js +213 -0
- package/dist/headers/OPCUA.d.ts +33 -0
- package/dist/headers/OPCUA.js +165 -0
- package/dist/headers/OPCUAPubSub.d.ts +33 -0
- package/dist/headers/OPCUAPubSub.js +144 -0
- package/dist/headers/OSPF.d.ts +31 -0
- package/dist/headers/OSPF.js +365 -0
- package/dist/headers/OmronFINS.d.ts +31 -0
- package/dist/headers/OmronFINS.js +90 -0
- package/dist/headers/OpenFlow.d.ts +30 -0
- package/dist/headers/OpenFlow.js +113 -0
- package/dist/headers/OpenVPN.d.ts +35 -0
- package/dist/headers/OpenVPN.js +214 -0
- package/dist/headers/PCWorx.d.ts +35 -0
- package/dist/headers/PCWorx.js +115 -0
- package/dist/headers/PIM.d.ts +27 -0
- package/dist/headers/PIM.js +129 -0
- package/dist/headers/POP3.d.ts +31 -0
- package/dist/headers/POP3.js +152 -0
- package/dist/headers/POWERLINK.d.ts +28 -0
- package/dist/headers/POWERLINK.js +116 -0
- package/dist/headers/PPPoEDiscovery.d.ts +29 -0
- package/dist/headers/PPPoEDiscovery.js +198 -0
- package/dist/headers/PPPoESession.d.ts +28 -0
- package/dist/headers/PPPoESession.js +125 -0
- package/dist/headers/PPTP.d.ts +30 -0
- package/dist/headers/PPTP.js +122 -0
- package/dist/headers/PROFINETRT.d.ts +28 -0
- package/dist/headers/PROFINETRT.js +74 -0
- package/dist/headers/PTP.d.ts +34 -0
- package/dist/headers/PTP.js +213 -0
- package/dist/headers/PostgreSQL.d.ts +40 -0
- package/dist/headers/PostgreSQL.js +236 -0
- package/dist/headers/QUIC.d.ts +34 -0
- package/dist/headers/QUIC.js +308 -0
- package/dist/headers/RADIUS.d.ts +24 -0
- package/dist/headers/RADIUS.js +138 -0
- package/dist/headers/RDP.d.ts +27 -0
- package/dist/headers/RDP.js +93 -0
- package/dist/headers/RFB.d.ts +39 -0
- package/dist/headers/RFB.js +151 -0
- package/dist/headers/RGoose.d.ts +72 -0
- package/dist/headers/RGoose.js +340 -0
- package/dist/headers/RIP.d.ts +29 -0
- package/dist/headers/RIP.js +133 -0
- package/dist/headers/RIPng.d.ts +26 -0
- package/dist/headers/RIPng.js +140 -0
- package/dist/headers/RMCP.d.ts +26 -0
- package/dist/headers/RMCP.js +155 -0
- package/dist/headers/RSVP.d.ts +31 -0
- package/dist/headers/RSVP.js +263 -0
- package/dist/headers/RTCP.d.ts +34 -0
- package/dist/headers/RTCP.js +217 -0
- package/dist/headers/RTP.d.ts +33 -0
- package/dist/headers/RTP.js +291 -0
- package/dist/headers/RTPS.d.ts +33 -0
- package/dist/headers/RTPS.js +182 -0
- package/dist/headers/RTSP.d.ts +36 -0
- package/dist/headers/RTSP.js +184 -0
- package/dist/headers/RawData.d.ts +17 -0
- package/dist/headers/RawData.js +43 -0
- package/dist/headers/Redis.d.ts +32 -0
- package/dist/headers/Redis.js +202 -0
- package/dist/headers/Rlogin.d.ts +42 -0
- package/dist/headers/Rlogin.js +139 -0
- package/dist/headers/Rsync.d.ts +28 -0
- package/dist/headers/Rsync.js +117 -0
- package/dist/headers/S7comm.d.ts +36 -0
- package/dist/headers/S7comm.js +244 -0
- package/dist/headers/SCTP.d.ts +35 -0
- package/dist/headers/SCTP.js +174 -0
- package/dist/headers/SFlow.d.ts +29 -0
- package/dist/headers/SFlow.js +242 -0
- package/dist/headers/SIP.d.ts +27 -0
- package/dist/headers/SIP.js +146 -0
- package/dist/headers/SLMP.d.ts +36 -0
- package/dist/headers/SLMP.js +154 -0
- package/dist/headers/SLP.d.ts +30 -0
- package/dist/headers/SLP.js +207 -0
- package/dist/headers/SLPv1.d.ts +32 -0
- package/dist/headers/SLPv1.js +138 -0
- package/dist/headers/SMB1.d.ts +37 -0
- package/dist/headers/SMB1.js +200 -0
- package/dist/headers/SMB2.d.ts +36 -0
- package/dist/headers/SMB2.js +203 -0
- package/dist/headers/SMPP.d.ts +33 -0
- package/dist/headers/SMPP.js +119 -0
- package/dist/headers/SMTP.d.ts +33 -0
- package/dist/headers/SMTP.js +157 -0
- package/dist/headers/SNAP.d.ts +22 -0
- package/dist/headers/SNAP.js +68 -0
- package/dist/headers/SNMP.d.ts +28 -0
- package/dist/headers/SNMP.js +302 -0
- package/dist/headers/SOCKS4.d.ts +42 -0
- package/dist/headers/SOCKS4.js +302 -0
- package/dist/headers/SOCKS5.d.ts +45 -0
- package/dist/headers/SOCKS5.js +223 -0
- package/dist/headers/SSDP.d.ts +27 -0
- package/dist/headers/SSDP.js +161 -0
- package/dist/headers/SSH.d.ts +44 -0
- package/dist/headers/SSH.js +274 -0
- package/dist/headers/STOMP.d.ts +48 -0
- package/dist/headers/STOMP.js +177 -0
- package/dist/headers/STP.d.ts +26 -0
- package/dist/headers/STP.js +150 -0
- package/dist/headers/STUN.d.ts +25 -0
- package/dist/headers/STUN.js +183 -0
- package/dist/headers/SercosIII.d.ts +43 -0
- package/dist/headers/SercosIII.js +199 -0
- package/dist/headers/Skinny.d.ts +32 -0
- package/dist/headers/Skinny.js +139 -0
- package/dist/headers/StatsD.d.ts +27 -0
- package/dist/headers/StatsD.js +134 -0
- package/dist/headers/SunRPC.d.ts +34 -0
- package/dist/headers/SunRPC.js +268 -0
- package/dist/headers/Syslog.d.ts +21 -0
- package/dist/headers/Syslog.js +91 -0
- package/dist/headers/TCP.d.ts +19 -0
- package/dist/headers/TCP.js +905 -0
- package/dist/headers/TFTP.d.ts +28 -0
- package/dist/headers/TFTP.js +224 -0
- package/dist/headers/TLS_Alert.d.ts +24 -0
- package/dist/headers/TLS_Alert.js +639 -0
- package/dist/headers/TLS_ApplicationData.d.ts +24 -0
- package/dist/headers/TLS_ApplicationData.js +170 -0
- package/dist/headers/TLS_ChangeCipherSpec.d.ts +23 -0
- package/dist/headers/TLS_ChangeCipherSpec.js +168 -0
- package/dist/headers/TLS_Handshake.d.ts +65 -0
- package/dist/headers/TLS_Handshake.js +860 -0
- package/dist/headers/TLS_Heartbeat.d.ts +27 -0
- package/dist/headers/TLS_Heartbeat.js +247 -0
- package/dist/headers/TPKT.d.ts +26 -0
- package/dist/headers/TPKT.js +99 -0
- package/dist/headers/TacacsPlus.d.ts +27 -0
- package/dist/headers/TacacsPlus.js +133 -0
- package/dist/headers/Telnet.d.ts +40 -0
- package/dist/headers/Telnet.js +193 -0
- package/dist/headers/Teredo.d.ts +40 -0
- package/dist/headers/Teredo.js +251 -0
- package/dist/headers/TimeProtocol.d.ts +25 -0
- package/dist/headers/TimeProtocol.js +53 -0
- package/dist/headers/UDP.d.ts +19 -0
- package/dist/headers/UDP.js +171 -0
- package/dist/headers/VLAN_802dot1Q.d.ts +24 -0
- package/dist/headers/VLAN_802dot1Q.js +96 -0
- package/dist/headers/VRRP.d.ts +26 -0
- package/dist/headers/VRRP.js +309 -0
- package/dist/headers/VXLAN.d.ts +24 -0
- package/dist/headers/VXLAN.js +75 -0
- package/dist/headers/WCCP.d.ts +29 -0
- package/dist/headers/WCCP.js +117 -0
- package/dist/headers/WHOIS.d.ts +37 -0
- package/dist/headers/WHOIS.js +126 -0
- package/dist/headers/WSDiscovery.d.ts +29 -0
- package/dist/headers/WSDiscovery.js +118 -0
- package/dist/headers/WakeOnLAN.d.ts +30 -0
- package/dist/headers/WakeOnLAN.js +126 -0
- package/dist/headers/WebSocket.d.ts +26 -0
- package/dist/headers/WebSocket.js +173 -0
- package/dist/headers/WireGuard.d.ts +38 -0
- package/dist/headers/WireGuard.js +216 -0
- package/dist/headers/XMPP.d.ts +37 -0
- package/dist/headers/XMPP.js +149 -0
- package/dist/headers/Zabbix.d.ts +35 -0
- package/dist/headers/Zabbix.js +153 -0
- package/dist/headers/cms/AcsiPdu.d.ts +45 -0
- package/dist/headers/cms/AcsiPdu.js +112 -0
- package/dist/headers/cms/PerDecoder.d.ts +68 -0
- package/dist/headers/cms/PerDecoder.js +211 -0
- package/dist/headers/cms/PerReader.d.ts +64 -0
- package/dist/headers/cms/PerReader.js +155 -0
- package/dist/helper/BufferToHex.d.ts +5 -0
- package/dist/helper/BufferToHex.js +10 -0
- package/dist/helper/BufferToIP.d.ts +12 -0
- package/dist/helper/BufferToIP.js +23 -0
- package/dist/helper/BufferToNumber.d.ts +18 -0
- package/dist/helper/BufferToNumber.js +47 -0
- package/dist/helper/HexToBuffer.d.ts +7 -0
- package/dist/helper/HexToBuffer.js +27 -0
- package/dist/helper/HexToNumber.d.ts +18 -0
- package/dist/helper/HexToNumber.js +48 -0
- package/dist/helper/IPToBuffer.d.ts +12 -0
- package/dist/helper/IPToBuffer.js +34 -0
- package/dist/helper/NumberToBERBuffer.d.ts +18 -0
- package/dist/helper/NumberToBERBuffer.js +31 -0
- package/dist/helper/NumberToBERHex.d.ts +18 -0
- package/dist/helper/NumberToBERHex.js +52 -0
- package/dist/helper/NumberToBuffer.d.ts +18 -0
- package/dist/helper/NumberToBuffer.js +38 -0
- package/dist/helper/NumberToHex.d.ts +18 -0
- package/dist/helper/NumberToHex.js +35 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +113 -0
- package/dist/lib/FlexibleObject.d.ts +27 -0
- package/dist/lib/FlexibleObject.js +113 -0
- package/dist/lib/GetBERIntegerLengthFromBuffer.d.ts +6 -0
- package/dist/lib/GetBERIntegerLengthFromBuffer.js +16 -0
- package/dist/lib/ProcessPacketPostHandlers.d.ts +13 -0
- package/dist/lib/ProcessPacketPostHandlers.js +53 -0
- package/dist/lib/SortPostHandlers.d.ts +7 -0
- package/dist/lib/SortPostHandlers.js +11 -0
- package/dist/lib/StringContentEncodingEnum.d.ts +10 -0
- package/dist/lib/StringContentEncodingEnum.js +14 -0
- package/dist/schema/ProtocolFieldJSONSchema.d.ts +35 -0
- package/dist/schema/ProtocolFieldJSONSchema.js +2 -0
- package/dist/schema/ProtocolFieldJSONSchemaDefinition.d.ts +2 -0
- package/dist/schema/ProtocolFieldJSONSchemaDefinition.js +2 -0
- package/dist/schema/ProtocolJSONSchema.d.ts +32 -0
- package/dist/schema/ProtocolJSONSchema.js +2 -0
- package/dist/types/CodecData.d.ts +7 -0
- package/dist/types/CodecData.js +2 -0
- package/dist/types/CodecDecodeResult.d.ts +10 -0
- package/dist/types/CodecDecodeResult.js +2 -0
- package/dist/types/CodecEncodeInput.d.ts +2 -0
- package/dist/types/CodecEncodeInput.js +2 -0
- package/dist/types/CodecEncodeResult.d.ts +5 -0
- package/dist/types/CodecEncodeResult.js +2 -0
- package/dist/types/CodecErrorInfo.d.ts +5 -0
- package/dist/types/CodecErrorInfo.js +2 -0
- package/dist/types/CodecModule.d.ts +2 -0
- package/dist/types/CodecModule.js +2 -0
- package/dist/types/CodecModuleConstructor.d.ts +2 -0
- package/dist/types/CodecModuleConstructor.js +2 -0
- package/dist/types/CodecSchema.d.ts +6 -0
- package/dist/types/CodecSchema.js +2 -0
- package/dist/types/DemuxProducer.d.ts +23 -0
- package/dist/types/DemuxProducer.js +2 -0
- package/dist/types/Dissection.d.ts +23 -0
- package/dist/types/Dissection.js +2 -0
- package/dist/types/HeaderTreeNode.d.ts +4 -0
- package/dist/types/HeaderTreeNode.js +2 -0
- package/dist/types/LayerGraph.d.ts +32 -0
- package/dist/types/LayerGraph.js +2 -0
- package/dist/types/PostHandlerItem.d.ts +4 -0
- package/dist/types/PostHandlerItem.js +2 -0
- package/package.json +141 -0
|
@@ -0,0 +1,420 @@
|
|
|
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 BufferToHex_1 = require("../helper/BufferToHex");
|
|
15
|
+
const NumberToBuffer_1 = require("../helper/NumberToBuffer");
|
|
16
|
+
class IEC61850SampledValues extends BaseHeader_1.BaseHeader {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.TLVChild = [];
|
|
20
|
+
this.SCHEMA = {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
appid: {
|
|
24
|
+
type: 'integer',
|
|
25
|
+
minimum: 0,
|
|
26
|
+
maximum: 65535,
|
|
27
|
+
label: 'APPID',
|
|
28
|
+
decode: () => {
|
|
29
|
+
this.instance.appid.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(0, 2)));
|
|
30
|
+
},
|
|
31
|
+
encode: () => {
|
|
32
|
+
const APPID = this.instance.appid.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
33
|
+
this.instance.appid.setValue(APPID);
|
|
34
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(APPID));
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
length: {
|
|
38
|
+
type: 'integer',
|
|
39
|
+
label: 'Length',
|
|
40
|
+
decode: () => {
|
|
41
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(2, 2)));
|
|
42
|
+
},
|
|
43
|
+
encode: () => {
|
|
44
|
+
const length = this.instance.length.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
45
|
+
if (length > 0) {
|
|
46
|
+
this.instance.length.setValue(length);
|
|
47
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(length));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.addPostSelfEncodeHandler(() => {
|
|
51
|
+
const finalLength = parseInt(this.instance.length.getValue().toString());
|
|
52
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(finalLength));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
reserved1: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
label: 'Reserved1',
|
|
60
|
+
properties: {
|
|
61
|
+
simulated: {
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
label: 'Simulated',
|
|
64
|
+
decode: () => {
|
|
65
|
+
this.instance.reserved1.simulated.setValue(!!this.readBits(4, 2, 0, 1));
|
|
66
|
+
},
|
|
67
|
+
encode: () => {
|
|
68
|
+
const simulated = !!this.instance.reserved1.simulated.getValue();
|
|
69
|
+
this.writeBits(4, 2, 0, 1, simulated ? 1 : 0);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
reserved: {
|
|
73
|
+
type: 'number',
|
|
74
|
+
minimum: 0,
|
|
75
|
+
maximum: 32767,
|
|
76
|
+
label: 'Reserved',
|
|
77
|
+
decode: () => {
|
|
78
|
+
this.instance.reserved1.reserved.setValue(this.readBits(4, 2, 1, 15));
|
|
79
|
+
},
|
|
80
|
+
encode: () => {
|
|
81
|
+
const reserved = this.instance.reserved1.reserved.getValue(0);
|
|
82
|
+
this.writeBits(4, 2, 1, 15, reserved);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
reserved2: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
label: 'Reserved2',
|
|
90
|
+
properties: {
|
|
91
|
+
reserved: {
|
|
92
|
+
type: 'number',
|
|
93
|
+
minimum: 0,
|
|
94
|
+
maximum: 65535,
|
|
95
|
+
label: 'Reserved',
|
|
96
|
+
decode: () => {
|
|
97
|
+
this.instance.reserved2.reserved.setValue(this.readBits(6, 2, 0, 16));
|
|
98
|
+
},
|
|
99
|
+
encode: () => {
|
|
100
|
+
const reserved = this.instance.reserved2.reserved.getValue(0);
|
|
101
|
+
this.writeBits(6, 2, 0, 16, reserved);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
svPdu: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
label: 'Sampled Values PDU',
|
|
109
|
+
decode: () => {
|
|
110
|
+
this.instance.svPdu.setValue({});
|
|
111
|
+
//Decode must never throw (error-accumulation contract): a truncated or
|
|
112
|
+
//non-standard SV PDU whose BER cannot be parsed is recorded as an error.
|
|
113
|
+
const buffer = this.readBytes(8, (this.instance.length.getValue()) - 8);
|
|
114
|
+
try {
|
|
115
|
+
this.TLVInstance = node_tlv_1.default.parse(buffer);
|
|
116
|
+
this.TLVChild = this.TLVInstance.getChild();
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
this.TLVChild = [];
|
|
120
|
+
//Surface the bytes we could not parse as a visible `raw` field rather than
|
|
121
|
+
//an empty-looking PDU, so a capture analyst SEES the malformed region (and
|
|
122
|
+
//so encode can reproduce it verbatim).
|
|
123
|
+
this.instance.svPdu.raw.setValue((0, BufferToHex_1.BufferToHex)(buffer));
|
|
124
|
+
this.recordError(this.instance.svPdu.getPath(), `Failed to parse Sampled Values PDU: ${e.message}`);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
encode: () => {
|
|
128
|
+
if (this.svPduRawFallbackActive()) {
|
|
129
|
+
//Re-emit the unparsed bytes exactly as captured. length is preserved as
|
|
130
|
+
//decoded (it may itself be inconsistent in a malformed frame — reproducing
|
|
131
|
+
//the original bytes means keeping it).
|
|
132
|
+
const rawBuffer = Buffer.from(this.instance.svPdu.raw.getValue().toString(), 'hex');
|
|
133
|
+
this.writeBytes(8, rawBuffer);
|
|
134
|
+
if (this.instance.length.getValue() > 0)
|
|
135
|
+
return;
|
|
136
|
+
this.instance.length.setValue(8 + rawBuffer.length);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
let buffer = Buffer.from([]);
|
|
140
|
+
this.TLVChild.forEach((TLVItem) => buffer = Buffer.concat([buffer, TLVItem.bTag, TLVItem.bLength, TLVItem.bValue]));
|
|
141
|
+
const svPduTLV = new node_tlv_1.default(0x60, buffer);
|
|
142
|
+
const svPduBuffer = Buffer.concat([svPduTLV.bTag, svPduTLV.bLength, svPduTLV.bValue]);
|
|
143
|
+
this.writeBytes(8, svPduBuffer);
|
|
144
|
+
/**
|
|
145
|
+
* Update the length only if it is not set
|
|
146
|
+
* Update length(APPID's length + Length's length + Reserved1's length + Reserved2's length + svPdu's length)
|
|
147
|
+
*/
|
|
148
|
+
if (this.instance.length.getValue() > 0)
|
|
149
|
+
return;
|
|
150
|
+
this.instance.length.setValue(2 + 2 + 2 + 2 + svPduBuffer.length);
|
|
151
|
+
},
|
|
152
|
+
properties: {
|
|
153
|
+
noASDU: {
|
|
154
|
+
type: 'integer',
|
|
155
|
+
minimum: 1,
|
|
156
|
+
maximum: 65535,
|
|
157
|
+
label: 'Number of ASDU',
|
|
158
|
+
decode: () => {
|
|
159
|
+
const noASDUTLV = this.TLVChild.find((tlv) => tlv.getTag('number') === 0x80);
|
|
160
|
+
if (!noASDUTLV)
|
|
161
|
+
return this.recordError(this.instance.svPdu.noASDU.getPath(), 'Not Found');
|
|
162
|
+
const noASDUNum = (0, HexToNumber_1.HexToUInt16)(noASDUTLV.getValue('hex'));
|
|
163
|
+
if (!noASDUNum)
|
|
164
|
+
this.recordError(this.instance.svPdu.noASDU.getPath(), 'Number of ASDU should be greater or equal to 1');
|
|
165
|
+
this.instance.svPdu.noASDU.setValue(noASDUNum);
|
|
166
|
+
},
|
|
167
|
+
encode: () => {
|
|
168
|
+
if (this.svPduRawFallbackActive())
|
|
169
|
+
return;
|
|
170
|
+
const noASDU = this.instance.svPdu.noASDU.getValue(0, (nodePath) => this.recordError(nodePath, 'noASDU is not set'));
|
|
171
|
+
this.TLVChild.push(new node_tlv_1.default(0x80, (0, NumberToBERHex_1.UInt16ToBERHex)(noASDU)));
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
seqASDU: {
|
|
175
|
+
type: 'array',
|
|
176
|
+
label: 'Sequence ASDU',
|
|
177
|
+
items: {
|
|
178
|
+
type: 'object',
|
|
179
|
+
properties: {
|
|
180
|
+
svID: {
|
|
181
|
+
type: 'string',
|
|
182
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.ASCII,
|
|
183
|
+
label: 'SvID'
|
|
184
|
+
},
|
|
185
|
+
dataSet: {
|
|
186
|
+
type: 'string',
|
|
187
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.ASCII,
|
|
188
|
+
label: 'DatSet'
|
|
189
|
+
},
|
|
190
|
+
smpCnt: {
|
|
191
|
+
type: 'integer',
|
|
192
|
+
label: 'SmpCnt'
|
|
193
|
+
},
|
|
194
|
+
confRev: {
|
|
195
|
+
type: 'integer',
|
|
196
|
+
label: 'ConfRev'
|
|
197
|
+
},
|
|
198
|
+
refrTm: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.BIGINT,
|
|
201
|
+
label: 'RefrTm'
|
|
202
|
+
},
|
|
203
|
+
smpSynch: {
|
|
204
|
+
type: 'integer',
|
|
205
|
+
label: 'SmpSynch'
|
|
206
|
+
},
|
|
207
|
+
smpRate: {
|
|
208
|
+
type: 'integer',
|
|
209
|
+
label: 'SmpRate'
|
|
210
|
+
},
|
|
211
|
+
sample: {
|
|
212
|
+
type: 'string',
|
|
213
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
214
|
+
label: 'Sample'
|
|
215
|
+
},
|
|
216
|
+
smpMod: {
|
|
217
|
+
type: 'integer',
|
|
218
|
+
label: 'SmpMod'
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
decode: () => {
|
|
223
|
+
const seqASDU = [];
|
|
224
|
+
const seqASDUTLV = this.TLVChild.find((tlv) => tlv.getTag('number') === 0xa2);
|
|
225
|
+
if (!seqASDUTLV) {
|
|
226
|
+
this.instance.svPdu.seqASDU.setValue(seqASDU);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const ASDUTLVs = seqASDUTLV.getChild();
|
|
230
|
+
ASDUTLVs.forEach((ASDUTLV, index) => {
|
|
231
|
+
const errorNodePath = this.instance.svPdu.seqASDU.getPath(index);
|
|
232
|
+
if (ASDUTLV.getTag('number') !== 0x30)
|
|
233
|
+
this.recordError(errorNodePath, 'Invalid ASDU item tag');
|
|
234
|
+
const ASDUAttributeTLVs = ASDUTLV.getChild();
|
|
235
|
+
let svID;
|
|
236
|
+
let dataSet;
|
|
237
|
+
let smpCnt;
|
|
238
|
+
let confRev;
|
|
239
|
+
let refrTm;
|
|
240
|
+
let smpSynch;
|
|
241
|
+
let smpRate;
|
|
242
|
+
let sample;
|
|
243
|
+
let smpMod;
|
|
244
|
+
//svID
|
|
245
|
+
const svIDTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x80);
|
|
246
|
+
if (svIDTLV) {
|
|
247
|
+
svID = svIDTLV.getValue('buffer').toString('ascii');
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
this.recordError(errorNodePath, 'svID Not Found');
|
|
251
|
+
}
|
|
252
|
+
//dataSet (optional)
|
|
253
|
+
const dataSetTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x81);
|
|
254
|
+
if (dataSetTLV) {
|
|
255
|
+
dataSet = dataSetTLV.getValue('buffer').toString('ascii');
|
|
256
|
+
}
|
|
257
|
+
//smpCnt
|
|
258
|
+
const smpCntTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x82);
|
|
259
|
+
if (smpCntTLV) {
|
|
260
|
+
smpCnt = (0, BufferToNumber_1.BufferToUInt16)(smpCntTLV.getValue('buffer'));
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
this.recordError(errorNodePath, 'smpCnt Not Found');
|
|
264
|
+
}
|
|
265
|
+
//confRev
|
|
266
|
+
const confRevTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x83);
|
|
267
|
+
if (confRevTLV) {
|
|
268
|
+
confRev = (0, BufferToNumber_1.BufferToUInt32)(confRevTLV.getValue('buffer'));
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
this.recordError(errorNodePath, 'confRev Not Found');
|
|
272
|
+
}
|
|
273
|
+
//refrTm (optional)
|
|
274
|
+
const refrTmTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x84);
|
|
275
|
+
if (refrTmTLV) {
|
|
276
|
+
refrTm = (0, BufferToNumber_1.BufferToUInt64)(refrTmTLV.getValue('buffer')).toString();
|
|
277
|
+
}
|
|
278
|
+
//smpSynch
|
|
279
|
+
const smpSynchTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x85);
|
|
280
|
+
if (smpSynchTLV) {
|
|
281
|
+
smpSynch = (0, BufferToNumber_1.BufferToUInt8)(smpSynchTLV.getValue('buffer'));
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.recordError(errorNodePath, 'smpSynch Not Found');
|
|
285
|
+
}
|
|
286
|
+
//smpRate (optional)
|
|
287
|
+
const smpRateTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x86);
|
|
288
|
+
if (smpRateTLV) {
|
|
289
|
+
smpRate = (0, BufferToNumber_1.BufferToUInt16)(smpRateTLV.getValue('buffer'));
|
|
290
|
+
}
|
|
291
|
+
//sample
|
|
292
|
+
const sampleTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x87);
|
|
293
|
+
if (sampleTLV) {
|
|
294
|
+
sample = sampleTLV.getValue('hex');
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.recordError(errorNodePath, 'sample Not Found');
|
|
298
|
+
}
|
|
299
|
+
//smpMod (optional) - tag 0x88; 0x86 is smpRate's tag
|
|
300
|
+
const smpModTLV = ASDUAttributeTLVs.find((tlv) => tlv.getTag('number') === 0x88);
|
|
301
|
+
if (smpModTLV) {
|
|
302
|
+
smpMod = (0, BufferToNumber_1.BufferToUInt16)(smpModTLV.getValue('buffer'));
|
|
303
|
+
}
|
|
304
|
+
seqASDU.push({
|
|
305
|
+
svID: svID,
|
|
306
|
+
dataSet: dataSet,
|
|
307
|
+
smpCnt: smpCnt,
|
|
308
|
+
confRev: confRev,
|
|
309
|
+
refrTm: refrTm,
|
|
310
|
+
smpSynch: smpSynch,
|
|
311
|
+
smpRate: smpRate,
|
|
312
|
+
sample: sample,
|
|
313
|
+
smpMod: smpMod
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
this.instance.svPdu.seqASDU.setValue(seqASDU);
|
|
317
|
+
},
|
|
318
|
+
encode: () => {
|
|
319
|
+
if (this.svPduRawFallbackActive())
|
|
320
|
+
return;
|
|
321
|
+
const seqASDU = this.instance.svPdu.seqASDU.isUndefined() ? [] : this.instance.svPdu.seqASDU.getValue();
|
|
322
|
+
const seqASDUTLVs = [];
|
|
323
|
+
seqASDU.forEach((seqASDUItem, index) => {
|
|
324
|
+
const errorNodePath = this.instance.svPdu.seqASDU.getPath(index);
|
|
325
|
+
const seqASDUItemTLVs = [];
|
|
326
|
+
//svID
|
|
327
|
+
if (seqASDUItem.svID !== undefined) {
|
|
328
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x80, Buffer.from(seqASDUItem.svID ? seqASDUItem.svID : '', 'ascii')));
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
this.recordError(errorNodePath, 'No svID');
|
|
332
|
+
}
|
|
333
|
+
//dataSet
|
|
334
|
+
if (seqASDUItem.dataSet !== undefined)
|
|
335
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x81, Buffer.from(seqASDUItem.dataSet ? seqASDUItem.dataSet : '', 'ascii')));
|
|
336
|
+
// smpCnt
|
|
337
|
+
if (seqASDUItem.smpCnt !== undefined) {
|
|
338
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x82, (0, NumberToHex_1.UInt16ToHex)(seqASDUItem.smpCnt)));
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
this.recordError(errorNodePath, 'No smpCnt');
|
|
342
|
+
}
|
|
343
|
+
// confRev
|
|
344
|
+
if (seqASDUItem.confRev !== undefined) {
|
|
345
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x83, (0, NumberToHex_1.UInt32ToHex)(seqASDUItem.confRev)));
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.recordError(errorNodePath, 'No confRev');
|
|
349
|
+
}
|
|
350
|
+
// refrTm
|
|
351
|
+
if (seqASDUItem.refrTm !== undefined)
|
|
352
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x84, Buffer.from(BigInt(seqASDUItem.refrTm).toString(16).padStart(8 * 2, '0'), 'hex')));
|
|
353
|
+
// smpSynch
|
|
354
|
+
if (seqASDUItem.smpSynch !== undefined) {
|
|
355
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x85, (0, NumberToHex_1.UInt8ToHex)(seqASDUItem.smpSynch)));
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
this.recordError(errorNodePath, 'No smpSynch');
|
|
359
|
+
}
|
|
360
|
+
// smpRate
|
|
361
|
+
if (seqASDUItem.smpRate !== undefined)
|
|
362
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x86, (0, NumberToHex_1.UInt16ToHex)(seqASDUItem.smpRate)));
|
|
363
|
+
// sample
|
|
364
|
+
if (seqASDUItem.sample !== undefined) {
|
|
365
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x87, Buffer.from(seqASDUItem.sample, 'hex')));
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
this.recordError(errorNodePath, 'No sample');
|
|
369
|
+
}
|
|
370
|
+
// smpMod
|
|
371
|
+
if (seqASDUItem.smpMod !== undefined)
|
|
372
|
+
seqASDUItemTLVs.push(new node_tlv_1.default(0x88, (0, NumberToHex_1.UInt16ToHex)(seqASDUItem.smpMod)));
|
|
373
|
+
if (!seqASDUItemTLVs.length)
|
|
374
|
+
return;
|
|
375
|
+
let seqASDUItemBuffer = Buffer.from([]);
|
|
376
|
+
seqASDUItemTLVs.forEach((seqASDUItemTLV) => seqASDUItemBuffer = Buffer.concat([seqASDUItemBuffer, seqASDUItemTLV.bTag, seqASDUItemTLV.bLength, seqASDUItemTLV.bValue]));
|
|
377
|
+
seqASDUTLVs.push(new node_tlv_1.default(0x30, seqASDUItemBuffer));
|
|
378
|
+
});
|
|
379
|
+
let seqASDUBuffer = Buffer.from([]);
|
|
380
|
+
seqASDUTLVs.forEach((seqASDUTLV) => seqASDUBuffer = Buffer.concat([seqASDUBuffer, seqASDUTLV.bTag, seqASDUTLV.bLength, seqASDUTLV.bValue]));
|
|
381
|
+
this.TLVChild.push(new node_tlv_1.default(0xa2, seqASDUBuffer));
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
raw: {
|
|
385
|
+
type: 'string',
|
|
386
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
387
|
+
label: 'Unparsed Raw'
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
this.id = 'sv';
|
|
394
|
+
this.matchKeys = ['ethertype:88ba'];
|
|
395
|
+
this.name = 'IEC61850 Sampled Values';
|
|
396
|
+
this.nickname = 'SV';
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* True when decode preserved an unparsed raw svPdu region and the caller has not
|
|
400
|
+
* supplied any structured PDU content. In that state encode re-emits the raw bytes
|
|
401
|
+
* verbatim (faithful passthrough of a malformed capture); the moment a structured
|
|
402
|
+
* field is set, this turns false and encode rebuilds the PDU from fields instead.
|
|
403
|
+
*/
|
|
404
|
+
svPduRawFallbackActive() {
|
|
405
|
+
if (this.instance.svPdu.raw.isUndefined())
|
|
406
|
+
return false;
|
|
407
|
+
if (!this.instance.svPdu.raw.getValue(''))
|
|
408
|
+
return false;
|
|
409
|
+
if (!this.instance.svPdu.noASDU.isUndefined())
|
|
410
|
+
return false;
|
|
411
|
+
const seqASDU = this.instance.svPdu.seqASDU.isUndefined() ? [] : this.instance.svPdu.seqASDU.getValue([]);
|
|
412
|
+
return !Array.isArray(seqASDU) || seqASDU.length === 0;
|
|
413
|
+
}
|
|
414
|
+
match() {
|
|
415
|
+
if (!this.prevCodecModule)
|
|
416
|
+
return false;
|
|
417
|
+
return this.prevCodecModule.instance.etherType.getValue() === (0, NumberToHex_1.UInt16ToHex)(0x88ba);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
exports.IEC61850SampledValues = IEC61850SampledValues;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* IGMP — Internet Group Management Protocol (IGMPv2 RFC 2236, IGMPv3 RFC 3376), carried directly over
|
|
6
|
+
* IPv4 as protocol 2. Every message opens with a fixed 4-byte header — Type (1), Max Resp Code (1) and
|
|
7
|
+
* a 16-bit Checksum (ones-complement over the whole IGMP message) — followed by a type-driven body:
|
|
8
|
+
*
|
|
9
|
+
* - v1/v2 (Membership Query with total length 8 / Report 0x12 / Report 0x16 / Leave 0x17): a single
|
|
10
|
+
* 4-byte Group Address (dotted-quad).
|
|
11
|
+
* - v3 Membership Query (Type 0x11 with an IP payload ≥ 12 bytes): Group Address (4) + Resv/S/QRV (1) +
|
|
12
|
+
* QQIC (1) + Number of Sources (2) + that many 4-byte source addresses, kept verbatim as `sources`
|
|
13
|
+
* hex (bounded by the source count and the IP payload).
|
|
14
|
+
* - v3 Membership Report (Type 0x22): 2 reserved bytes + Number of Group Records (2) + the group
|
|
15
|
+
* records, kept verbatim as `records` hex (bounded by the IP payload).
|
|
16
|
+
*
|
|
17
|
+
* The Checksum is honored verbatim, never recomputed (encode is a faithful executor); a well-formed
|
|
18
|
+
* message round-trips byte-for-byte. The message is bounded by the enclosing IPv4 datagram (total
|
|
19
|
+
* length − IP header length) so trailing padding is left to the codec's recursion / RawData. The v3
|
|
20
|
+
* source/record counts are honor-else-derive; the v3 record structures are kept as bounded hex.
|
|
21
|
+
*/
|
|
22
|
+
export declare class IGMP extends BaseHeader {
|
|
23
|
+
#private;
|
|
24
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly nickname: string;
|
|
28
|
+
readonly matchKeys: string[];
|
|
29
|
+
match(): boolean;
|
|
30
|
+
readonly demuxProducers: DemuxProducer[];
|
|
31
|
+
}
|