@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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessPacketEncodePostHandlers = ProcessPacketEncodePostHandlers;
|
|
4
|
+
exports.ProcessPacketDecodePostHandlers = ProcessPacketDecodePostHandlers;
|
|
5
|
+
const SortPostHandlers_1 = require("./SortPostHandlers");
|
|
6
|
+
/**
|
|
7
|
+
* Process packet post handlers
|
|
8
|
+
* @param handlerItemsArray
|
|
9
|
+
* @param asc
|
|
10
|
+
*/
|
|
11
|
+
function processPacketPostHandlers(handlerItemsArray, asc) {
|
|
12
|
+
let indexFactor = 10;
|
|
13
|
+
return handlerItemsArray
|
|
14
|
+
.map((handlerItems) => {
|
|
15
|
+
return (0, SortPostHandlers_1.SortPostHandlers)(handlerItems).map((handlerItem, index) => {
|
|
16
|
+
handlerItem.priority = index + 1;
|
|
17
|
+
let factor = 10;
|
|
18
|
+
let priority = handlerItem.priority;
|
|
19
|
+
while (priority > 1) {
|
|
20
|
+
priority /= 10;
|
|
21
|
+
factor *= 10;
|
|
22
|
+
}
|
|
23
|
+
indexFactor = indexFactor < factor ? factor : indexFactor;
|
|
24
|
+
return handlerItem;
|
|
25
|
+
});
|
|
26
|
+
})
|
|
27
|
+
.map((handlerItems, headerIndex) => {
|
|
28
|
+
const basePriority = (headerIndex + 1) * indexFactor;
|
|
29
|
+
const unsortedItems = handlerItems.map((handlerItem) => {
|
|
30
|
+
handlerItem.priority = basePriority + handlerItem.priority;
|
|
31
|
+
return handlerItem;
|
|
32
|
+
});
|
|
33
|
+
return asc ?
|
|
34
|
+
unsortedItems.sort((a, b) => a.priority - b.priority) :
|
|
35
|
+
unsortedItems.sort((a, b) => b.priority - a.priority);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Process packet post encode handlers
|
|
40
|
+
* @param handlerItemsArray
|
|
41
|
+
* @constructor
|
|
42
|
+
*/
|
|
43
|
+
function ProcessPacketEncodePostHandlers(handlerItemsArray) {
|
|
44
|
+
return processPacketPostHandlers(handlerItemsArray, true).reverse().flat();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Process packet post decode handlers
|
|
48
|
+
* @param handlerItemsArray
|
|
49
|
+
* @constructor
|
|
50
|
+
*/
|
|
51
|
+
function ProcessPacketDecodePostHandlers(handlerItemsArray) {
|
|
52
|
+
return processPacketPostHandlers(handlerItemsArray, true).flat();
|
|
53
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SortPostHandlers = SortPostHandlers;
|
|
4
|
+
/**
|
|
5
|
+
* Sort post handlers
|
|
6
|
+
* @param handlers
|
|
7
|
+
* @constructor
|
|
8
|
+
*/
|
|
9
|
+
function SortPostHandlers(handlers) {
|
|
10
|
+
return handlers.sort((a, b) => a.priority - b.priority);
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringContentEncodingEnum = void 0;
|
|
4
|
+
var StringContentEncodingEnum;
|
|
5
|
+
(function (StringContentEncodingEnum) {
|
|
6
|
+
StringContentEncodingEnum["BINARY"] = "binary";
|
|
7
|
+
StringContentEncodingEnum["HEX"] = "hex";
|
|
8
|
+
StringContentEncodingEnum["IPv4"] = "ipv4";
|
|
9
|
+
StringContentEncodingEnum["IPv6"] = "ipv6";
|
|
10
|
+
StringContentEncodingEnum["MAC"] = "mac";
|
|
11
|
+
StringContentEncodingEnum["ASCII"] = "ascii";
|
|
12
|
+
StringContentEncodingEnum["UTF8"] = "utf8";
|
|
13
|
+
StringContentEncodingEnum["BIGINT"] = "bigint";
|
|
14
|
+
})(StringContentEncodingEnum || (exports.StringContentEncodingEnum = StringContentEncodingEnum = {}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { JSONSchema7 } from 'json-schema';
|
|
2
|
+
import { ProtocolFieldJSONSchemaDefinition } from './ProtocolFieldJSONSchemaDefinition';
|
|
3
|
+
export interface ProtocolFieldJSONSchema extends JSONSchema7 {
|
|
4
|
+
encode?: () => void | Promise<void>;
|
|
5
|
+
decode?: () => void | Promise<void>;
|
|
6
|
+
label?: string;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
$defs?: {
|
|
9
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition;
|
|
10
|
+
} | undefined;
|
|
11
|
+
items?: ProtocolFieldJSONSchemaDefinition | ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
12
|
+
additionalItems?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
13
|
+
contains?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
14
|
+
properties?: {
|
|
15
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition;
|
|
16
|
+
} | undefined;
|
|
17
|
+
patternProperties?: {
|
|
18
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition;
|
|
19
|
+
} | undefined;
|
|
20
|
+
additionalProperties?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
21
|
+
dependencies?: {
|
|
22
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition | string[];
|
|
23
|
+
} | undefined;
|
|
24
|
+
propertyNames?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
25
|
+
if?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
26
|
+
then?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
27
|
+
else?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
28
|
+
allOf?: ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
29
|
+
anyOf?: ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
30
|
+
oneOf?: ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
31
|
+
not?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
32
|
+
definitions?: {
|
|
33
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition;
|
|
34
|
+
} | undefined;
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JSONSchema7, JSONSchema7Definition } from 'json-schema';
|
|
2
|
+
import { ProtocolFieldJSONSchemaDefinition } from './ProtocolFieldJSONSchemaDefinition';
|
|
3
|
+
export interface ProtocolJSONSchema extends JSONSchema7 {
|
|
4
|
+
summary?: string;
|
|
5
|
+
$defs?: {
|
|
6
|
+
[key: string]: JSONSchema7Definition;
|
|
7
|
+
} | undefined;
|
|
8
|
+
items?: ProtocolFieldJSONSchemaDefinition | ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
9
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
10
|
+
contains?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
11
|
+
properties?: {
|
|
12
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition;
|
|
13
|
+
} | undefined;
|
|
14
|
+
patternProperties?: {
|
|
15
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition;
|
|
16
|
+
} | undefined;
|
|
17
|
+
additionalProperties?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
18
|
+
dependencies?: {
|
|
19
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition | string[];
|
|
20
|
+
} | undefined;
|
|
21
|
+
propertyNames?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
22
|
+
if?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
23
|
+
then?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
24
|
+
else?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
25
|
+
allOf?: ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
26
|
+
anyOf?: ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
27
|
+
oneOf?: ProtocolFieldJSONSchemaDefinition[] | undefined;
|
|
28
|
+
not?: ProtocolFieldJSONSchemaDefinition | undefined;
|
|
29
|
+
definitions?: {
|
|
30
|
+
[key: string]: ProtocolFieldJSONSchemaDefinition;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HeaderTreeNode } from './HeaderTreeNode';
|
|
2
|
+
import { CodecErrorInfo } from './CodecErrorInfo';
|
|
3
|
+
export type CodecDecodeResult = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
nickname: string;
|
|
7
|
+
protocol: boolean;
|
|
8
|
+
errors: CodecErrorInfo[];
|
|
9
|
+
data: HeaderTreeNode;
|
|
10
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kind of a demux value, deciding how it is normalized into a dispatch key. Normalization is
|
|
3
|
+
* defined by the field's STORAGE representation, not by an output radix:
|
|
4
|
+
* - `uint` : the field stores a number (e.g. IPv4 `protocol`, IPv6 `nxt`, TCP/UDP ports) → decimal.
|
|
5
|
+
* - `string` : the field already stores a normalized string (e.g. Ethernet `etherType`, a lower-case
|
|
6
|
+
* fixed-width hex string) → identity. Case-sensitive string keys (media_type, ALPN) are
|
|
7
|
+
* preserved verbatim per their standard.
|
|
8
|
+
* - `guid` : a UUID string → lower-cased.
|
|
9
|
+
* - `bytes` : a byte/hex string → lower-cased.
|
|
10
|
+
*/
|
|
11
|
+
export type DemuxProducerKind = 'uint' | 'string' | 'guid' | 'bytes';
|
|
12
|
+
/**
|
|
13
|
+
* A demux key a layer produces for its child: the value of `field` on this layer, placed into the
|
|
14
|
+
* `namespace` (e.g. `ethertype`, `ipproto`, `tcpport`). The codec reverses these declarations to route
|
|
15
|
+
* the next layer, so ordering is decided entirely at runtime by the field values a packet carries.
|
|
16
|
+
* Declared per-schema (replacing the old central hard-coded producer list), so adding a new demux
|
|
17
|
+
* dimension is a per-protocol declaration, not a core change.
|
|
18
|
+
*/
|
|
19
|
+
export type DemuxProducer = {
|
|
20
|
+
field: string;
|
|
21
|
+
namespace: string;
|
|
22
|
+
kind: DemuxProducerKind;
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CodecErrorInfo } from './CodecErrorInfo';
|
|
2
|
+
/**
|
|
3
|
+
* A node in the Wireshark-style dissection tree: a field (or a container of fields) with the value,
|
|
4
|
+
* its human label, the exact bytes it occupies in the packet, and a severity for expert-info
|
|
5
|
+
* highlighting. This is a read-only projection over the same decode — no second parser.
|
|
6
|
+
*/
|
|
7
|
+
export type DissectionField = {
|
|
8
|
+
name: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
value?: unknown;
|
|
11
|
+
offset?: number;
|
|
12
|
+
length?: number;
|
|
13
|
+
rawBytes?: string;
|
|
14
|
+
severity: 'ok' | 'error';
|
|
15
|
+
children?: DissectionField[];
|
|
16
|
+
};
|
|
17
|
+
/** One decoded layer's dissection: its id/name, the field tree, and any accumulated errors. */
|
|
18
|
+
export type DissectionLayer = {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
fields: DissectionField[];
|
|
22
|
+
errors: CodecErrorInfo[];
|
|
23
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A layer that may follow a given parent layer in the editor's "add next layer" menu. `discriminator`
|
|
3
|
+
* tells the caller which parent field to set (and to what) so decode would route to this layer;
|
|
4
|
+
* it is null for RawData, which may always follow any layer.
|
|
5
|
+
*/
|
|
6
|
+
export type NextLayer = {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
discriminator: {
|
|
10
|
+
field: string;
|
|
11
|
+
value: string | number;
|
|
12
|
+
} | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A parent layer whose discriminator field does not point at the child that actually follows it
|
|
16
|
+
* (e.g. eth.etherType=0x86dd "IPv6" but the next layer is IPv4). Surfaced by the editor as a warning;
|
|
17
|
+
* `suggestion` is the {field,value} that would align the parent with the actual child, or null when
|
|
18
|
+
* the child is not reachable from that parent at all. Never blocks encoding — a lying packet is a
|
|
19
|
+
* valid crafted packet.
|
|
20
|
+
*/
|
|
21
|
+
export type ConsistencyIssue = {
|
|
22
|
+
index: number;
|
|
23
|
+
parentId: string;
|
|
24
|
+
childId: string;
|
|
25
|
+
field: string;
|
|
26
|
+
actual: string | number;
|
|
27
|
+
suggestion: {
|
|
28
|
+
field: string;
|
|
29
|
+
value: string | number;
|
|
30
|
+
} | null;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@netkitty/codec",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Schema-driven packet codec: encode/decode 180+ network and industrial (OT/ICS/SCADA) protocol headers — TCP/IP, TLS, HTTP/2, DNS, MQTT, plus Modbus, DNP3, IEC 61850 (GOOSE/SV/MMS), IEC 104, S7comm, OPC UA, PROFINET, EtherCAT, BACnet and more.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"require": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"README.zh-CN.md",
|
|
17
|
+
"CHANGELOG.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "shx rm -rf ./dist ./dist-test",
|
|
21
|
+
"build": "npm run clean && tsc -p tsconfig.json",
|
|
22
|
+
"build:test": "tsc -p tsconfig.test.json",
|
|
23
|
+
"test": "npm run build:test && node --test \"dist-test/**/*.spec.js\"",
|
|
24
|
+
"test:only": "node --test \"dist-test/**/*.spec.js\""
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"netkitty",
|
|
28
|
+
"codec",
|
|
29
|
+
"packet",
|
|
30
|
+
"packet-decoder",
|
|
31
|
+
"packet-encoder",
|
|
32
|
+
"packet-parser",
|
|
33
|
+
"protocol-decoder",
|
|
34
|
+
"protocol-parser",
|
|
35
|
+
"protocol-dissector",
|
|
36
|
+
"dissector",
|
|
37
|
+
"encode",
|
|
38
|
+
"decode",
|
|
39
|
+
"network-protocol",
|
|
40
|
+
"deep-packet-inspection",
|
|
41
|
+
"dpi",
|
|
42
|
+
"wireshark",
|
|
43
|
+
"pcap",
|
|
44
|
+
"tlv",
|
|
45
|
+
"ber",
|
|
46
|
+
"asn1",
|
|
47
|
+
"industrial-protocol",
|
|
48
|
+
"ot",
|
|
49
|
+
"scada",
|
|
50
|
+
"ics",
|
|
51
|
+
"iiot",
|
|
52
|
+
"iec61850",
|
|
53
|
+
"iec-61850",
|
|
54
|
+
"goose",
|
|
55
|
+
"sampled-values",
|
|
56
|
+
"sv",
|
|
57
|
+
"mms",
|
|
58
|
+
"iec104",
|
|
59
|
+
"iec-104",
|
|
60
|
+
"modbus",
|
|
61
|
+
"modbus-tcp",
|
|
62
|
+
"dnp3",
|
|
63
|
+
"s7comm",
|
|
64
|
+
"opcua",
|
|
65
|
+
"opc-ua",
|
|
66
|
+
"profinet",
|
|
67
|
+
"ethercat",
|
|
68
|
+
"ethernet-ip",
|
|
69
|
+
"enip",
|
|
70
|
+
"cip",
|
|
71
|
+
"bacnet",
|
|
72
|
+
"powerlink",
|
|
73
|
+
"omron-fins",
|
|
74
|
+
"slmp",
|
|
75
|
+
"melsec",
|
|
76
|
+
"codesys",
|
|
77
|
+
"beckhoff-ads",
|
|
78
|
+
"c37118",
|
|
79
|
+
"ethernet",
|
|
80
|
+
"arp",
|
|
81
|
+
"ipv4",
|
|
82
|
+
"ipv6",
|
|
83
|
+
"icmp",
|
|
84
|
+
"tcp",
|
|
85
|
+
"udp",
|
|
86
|
+
"sctp",
|
|
87
|
+
"quic",
|
|
88
|
+
"tls",
|
|
89
|
+
"dtls",
|
|
90
|
+
"dns",
|
|
91
|
+
"dhcp",
|
|
92
|
+
"http",
|
|
93
|
+
"http2",
|
|
94
|
+
"mqtt",
|
|
95
|
+
"coap",
|
|
96
|
+
"amqp",
|
|
97
|
+
"kafka",
|
|
98
|
+
"snmp",
|
|
99
|
+
"ntp",
|
|
100
|
+
"sip",
|
|
101
|
+
"rtp",
|
|
102
|
+
"bgp",
|
|
103
|
+
"ospf",
|
|
104
|
+
"ssh",
|
|
105
|
+
"ldap",
|
|
106
|
+
"kerberos",
|
|
107
|
+
"wireguard",
|
|
108
|
+
"gtp",
|
|
109
|
+
"smb",
|
|
110
|
+
"slp",
|
|
111
|
+
"srvloc",
|
|
112
|
+
"service-location"
|
|
113
|
+
],
|
|
114
|
+
"author": "alex.ma",
|
|
115
|
+
"license": "MIT",
|
|
116
|
+
"publishConfig": {
|
|
117
|
+
"access": "public",
|
|
118
|
+
"registry": "https://registry.npmjs.org/"
|
|
119
|
+
},
|
|
120
|
+
"dependencies": {
|
|
121
|
+
"ajv": "^8.20.0",
|
|
122
|
+
"ip-address": "^10.0.1",
|
|
123
|
+
"json-schema": "^0.4.0",
|
|
124
|
+
"node-tlv": "^1.5.14"
|
|
125
|
+
},
|
|
126
|
+
"devDependencies": {
|
|
127
|
+
"@types/json-schema": "^7.0.15",
|
|
128
|
+
"@types/node": "^22.13.10",
|
|
129
|
+
"@types/node-tlv": "^1.5.4",
|
|
130
|
+
"shx": "^0.3.4",
|
|
131
|
+
"typescript": "^5.8.2"
|
|
132
|
+
},
|
|
133
|
+
"repository": {
|
|
134
|
+
"type": "git",
|
|
135
|
+
"url": "git+https://github.com/myq1991/netkitty.git",
|
|
136
|
+
"directory": "packages/codec"
|
|
137
|
+
},
|
|
138
|
+
"homepage": "https://github.com/myq1991/netkitty/tree/main/packages/codec#readme",
|
|
139
|
+
"bugs": "https://github.com/myq1991/netkitty/issues",
|
|
140
|
+
"gitHead": "d71e793d2017c0f207f7b829adfcce11b56fe7ee"
|
|
141
|
+
}
|