@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,325 @@
|
|
|
1
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
2
|
+
import { CodecModule } from '../types/CodecModule';
|
|
3
|
+
import { ProtocolFieldJSONSchema } from '../schema/ProtocolFieldJSONSchema';
|
|
4
|
+
import { CodecErrorInfo } from '../types/CodecErrorInfo';
|
|
5
|
+
import { PostHandlerItem } from '../types/PostHandlerItem';
|
|
6
|
+
import { CodecData } from '../types/CodecData';
|
|
7
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
8
|
+
import { FlexibleObject } from '../lib/FlexibleObject';
|
|
9
|
+
import { HeaderTreeNode } from '../types/HeaderTreeNode';
|
|
10
|
+
/** Absolute byte span a field occupies in the packet, collected during a dissect pass. */
|
|
11
|
+
export type FieldByteRange = {
|
|
12
|
+
offset: number;
|
|
13
|
+
length: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The base class every protocol header extends, and the surface a custom-codec author works against.
|
|
17
|
+
*
|
|
18
|
+
* A subclass declares a `SCHEMA` (an executable JSON Schema whose fields carry per-field
|
|
19
|
+
* `decode`/`encode` closures), a stable `id`/`name`/`nickname`, and a `match()` that decides —
|
|
20
|
+
* by inspecting the previously decoded layers (`prevCodecModule`/`prevCodecModules`) — whether
|
|
21
|
+
* this header applies at the current offset. Optional `matchKeys`/`demuxProducers` wire the
|
|
22
|
+
* header into the codec's O(1) dispatch table instead of the content-heuristic chain.
|
|
23
|
+
*
|
|
24
|
+
* Field closures read and write the shared packet buffer through the header-relative helpers
|
|
25
|
+
* `readBytes`/`writeBytes` (whole octets) and `readBits`/`writeBits` (bit fields), which
|
|
26
|
+
* auto-expand the buffer on write, and store values on the path-tracking `instance`. Malformed
|
|
27
|
+
* input is reported via `recordError()` rather than thrown, so decode/encode never crash. Headers
|
|
28
|
+
* register cross-field/cross-layer fixups (lengths, checksums) with the post-handler methods
|
|
29
|
+
* (`addPostSelfEncodeHandler`/`addPostSelfDecodeHandler` for layer-internal, `addPostPacketEncodeHandler`/
|
|
30
|
+
* `addPostPacketDecodeHandler` for packet-level).
|
|
31
|
+
*/
|
|
32
|
+
export declare abstract class BaseHeader {
|
|
33
|
+
#private;
|
|
34
|
+
protected static get CODEC_INSTANCE(): CodecModule;
|
|
35
|
+
protected static CREATE_CODEC_INSTANCE_WITCH_CODEC_MODULES(codecData: CodecData, codecModules: CodecModule[]): CodecModule;
|
|
36
|
+
static get PROTOCOL_ID(): string;
|
|
37
|
+
static get PROTOCOL_NAME(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Demux keys this header registers in the codec dispatch table.
|
|
40
|
+
* Empty (the default) means the header is matched by its content-heuristic
|
|
41
|
+
* match() instead of by an upper-layer demultiplexing value.
|
|
42
|
+
*/
|
|
43
|
+
static get MATCH_KEYS(): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Demux keys this header produces for its child layer (from its own field values). Reversed by the
|
|
46
|
+
* codec to route the next layer, and read by the editor projection. Empty (the default) means this
|
|
47
|
+
* header is a leaf — nothing demuxes off it.
|
|
48
|
+
*/
|
|
49
|
+
static get DEMUX_PRODUCERS(): DemuxProducer[];
|
|
50
|
+
/**
|
|
51
|
+
* When true, this header is also placed in the content-heuristic fallback list even though it has
|
|
52
|
+
* demux matchKeys. Lets a protocol with a reliable content signature (TLS, IEC104) take the O(1)
|
|
53
|
+
* bucket on its well-known port yet still be recognized on any other port via its match(). Default
|
|
54
|
+
* false: matchKeys → bucket only; no matchKeys → heuristic only.
|
|
55
|
+
*/
|
|
56
|
+
static get HEURISTIC_FALLBACK(): boolean;
|
|
57
|
+
/** Higher is tried first within a demux bucket and within the heuristic chain; ties keep registration order. */
|
|
58
|
+
static get MATCH_PRIORITY(): number;
|
|
59
|
+
static get PROTOCOL_SCHEMA(): ProtocolJSONSchema;
|
|
60
|
+
static MATCH(codecData: CodecData, codecModules: CodecModule[]): boolean;
|
|
61
|
+
static CREATE_INSTANCE(codecData: CodecData, codecModules: CodecModule[]): CodecModule;
|
|
62
|
+
/**
|
|
63
|
+
* Protocol schema definition
|
|
64
|
+
*/
|
|
65
|
+
abstract readonly SCHEMA: ProtocolJSONSchema;
|
|
66
|
+
/**
|
|
67
|
+
* Program used header id
|
|
68
|
+
*/
|
|
69
|
+
abstract readonly id: string;
|
|
70
|
+
/**
|
|
71
|
+
* Human-readable header name
|
|
72
|
+
*/
|
|
73
|
+
abstract readonly name: string;
|
|
74
|
+
/**
|
|
75
|
+
* Human-readable header nickname
|
|
76
|
+
*/
|
|
77
|
+
abstract readonly nickname: string;
|
|
78
|
+
/**
|
|
79
|
+
* Current header is a protocol or not
|
|
80
|
+
*/
|
|
81
|
+
readonly isProtocol: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Upper-layer demultiplexing keys that select this header, e.g.
|
|
84
|
+
* ['ethertype:0800'] or ['ipproto:6']. Registered in the codec dispatch
|
|
85
|
+
* table for O(1) selection during decode. Leave empty for headers that
|
|
86
|
+
* must inspect their own bytes to match (TLS, IEC104, tunnels); those fall
|
|
87
|
+
* back to the content-heuristic match() list.
|
|
88
|
+
*/
|
|
89
|
+
readonly matchKeys: string[];
|
|
90
|
+
/**
|
|
91
|
+
* Demux keys this header produces for its child (see DemuxProducer). Declared per-schema so a new
|
|
92
|
+
* demux dimension (port, GUID, …) is a per-protocol declaration, not a core change. Default: none
|
|
93
|
+
* (a leaf header). Example: Ethernet declares `[{field:'etherType', namespace:'ethertype',
|
|
94
|
+
* kind:'string'}]`; IPv4 declares `[{field:'protocol', namespace:'ipproto', kind:'uint'}]`.
|
|
95
|
+
*/
|
|
96
|
+
readonly demuxProducers: DemuxProducer[];
|
|
97
|
+
/**
|
|
98
|
+
* Also register in the content-heuristic fallback list despite having matchKeys — so a
|
|
99
|
+
* content-signed protocol keeps working off its well-known port. See static HEURISTIC_FALLBACK.
|
|
100
|
+
*/
|
|
101
|
+
readonly heuristicFallback: boolean;
|
|
102
|
+
/** Selection priority within a bucket / the heuristic chain (higher first; ties keep registration order). */
|
|
103
|
+
readonly matchPriority: number;
|
|
104
|
+
/**
|
|
105
|
+
* Encode/Decode error info objects
|
|
106
|
+
*/
|
|
107
|
+
errors: CodecErrorInfo[];
|
|
108
|
+
/**
|
|
109
|
+
* Header schema instance
|
|
110
|
+
*/
|
|
111
|
+
instance: FlexibleObject;
|
|
112
|
+
/**
|
|
113
|
+
* Turn on byte-range collection for a dissect pass (call before decode()). Additive and
|
|
114
|
+
* read-only: it changes nothing about the decoded values, only records where each field lives.
|
|
115
|
+
*/
|
|
116
|
+
enableByteRangeTracking(): void;
|
|
117
|
+
/** The byte span each field occupied, or null if this header was not dissected. */
|
|
118
|
+
getByteRanges(): Map<string, FieldByteRange> | null;
|
|
119
|
+
/**
|
|
120
|
+
* Entire packet buffer data getter
|
|
121
|
+
*/
|
|
122
|
+
get packet(): Buffer;
|
|
123
|
+
/**
|
|
124
|
+
* Entire packet buffer data setter
|
|
125
|
+
* @param packet
|
|
126
|
+
*/
|
|
127
|
+
set packet(packet: Buffer);
|
|
128
|
+
/**
|
|
129
|
+
* The start position of this header in the entire packet's buffer
|
|
130
|
+
*/
|
|
131
|
+
startPos: number;
|
|
132
|
+
/**
|
|
133
|
+
* The end position of this header in the entire packet's buffer
|
|
134
|
+
*/
|
|
135
|
+
get endPos(): number;
|
|
136
|
+
/**
|
|
137
|
+
* Readonly Header length
|
|
138
|
+
*/
|
|
139
|
+
get length(): number;
|
|
140
|
+
/**
|
|
141
|
+
* Header length
|
|
142
|
+
* @protected
|
|
143
|
+
*/
|
|
144
|
+
protected headerLength: number;
|
|
145
|
+
/**
|
|
146
|
+
* Previous Codec module
|
|
147
|
+
* @protected
|
|
148
|
+
*/
|
|
149
|
+
protected prevCodecModule: CodecModule;
|
|
150
|
+
/**
|
|
151
|
+
* Codec modules
|
|
152
|
+
* @protected
|
|
153
|
+
*/
|
|
154
|
+
protected codecModules: CodecModule[];
|
|
155
|
+
/**
|
|
156
|
+
* Previous codec modules
|
|
157
|
+
* @protected
|
|
158
|
+
*/
|
|
159
|
+
protected prevCodecModules: CodecModule[];
|
|
160
|
+
/**
|
|
161
|
+
* Current header index in packet headers
|
|
162
|
+
* @protected
|
|
163
|
+
*/
|
|
164
|
+
protected headerIndex: number;
|
|
165
|
+
/**
|
|
166
|
+
* Post packet handlers
|
|
167
|
+
* @protected
|
|
168
|
+
*/
|
|
169
|
+
protected get postPacketHandlers(): PostHandlerItem[];
|
|
170
|
+
/**
|
|
171
|
+
* Registered post encode handlers (CodecModule)
|
|
172
|
+
* @protected
|
|
173
|
+
*/
|
|
174
|
+
protected readonly postSelfEncodeHandlers: PostHandlerItem[];
|
|
175
|
+
/**
|
|
176
|
+
* Registered post decode handlers (CodecModule)
|
|
177
|
+
* @protected
|
|
178
|
+
*/
|
|
179
|
+
protected readonly postSelfDecodeHandlers: PostHandlerItem[];
|
|
180
|
+
/**
|
|
181
|
+
* Codec data
|
|
182
|
+
* @protected
|
|
183
|
+
*/
|
|
184
|
+
protected codecData: CodecData;
|
|
185
|
+
constructor(codecData: CodecData, codecModules: CodecModule[]);
|
|
186
|
+
/**
|
|
187
|
+
* (Re)bind this instance's decode/match context. Extracted from the constructor so the static
|
|
188
|
+
* MATCH probe can reuse a single cached instance across heuristic candidates instead of rebuilding
|
|
189
|
+
* the whole SCHEMA for each — match() only reads the previous layer and the raw buffer.
|
|
190
|
+
*/
|
|
191
|
+
protected bindContext(codecData: CodecData, codecModules: CodecModule[]): void;
|
|
192
|
+
/**
|
|
193
|
+
* Get packet data offset
|
|
194
|
+
* @param offset
|
|
195
|
+
* @protected
|
|
196
|
+
*/
|
|
197
|
+
protected getPacketOffset(offset: number): number;
|
|
198
|
+
/**
|
|
199
|
+
* Is data buffer fits current header codec
|
|
200
|
+
*/
|
|
201
|
+
abstract match(): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Read bytes from buffer
|
|
204
|
+
* @param offset
|
|
205
|
+
* @param length
|
|
206
|
+
* @param dryRun
|
|
207
|
+
* @protected
|
|
208
|
+
*/
|
|
209
|
+
protected readBytes(offset: number, length: number, dryRun?: boolean): Buffer;
|
|
210
|
+
/**
|
|
211
|
+
* Write bytes to buffer
|
|
212
|
+
* @param offset
|
|
213
|
+
* @param buffer
|
|
214
|
+
* @protected
|
|
215
|
+
*/
|
|
216
|
+
protected writeBytes(offset: number, buffer: Buffer): void;
|
|
217
|
+
/**
|
|
218
|
+
* Read bits from buffer
|
|
219
|
+
* @param offset
|
|
220
|
+
* @param length
|
|
221
|
+
* @param bitOffset
|
|
222
|
+
* @param bitLength
|
|
223
|
+
* @protected
|
|
224
|
+
*/
|
|
225
|
+
protected readBits(offset: number, length: number, bitOffset: number, bitLength: number): number;
|
|
226
|
+
/**
|
|
227
|
+
* Write bits to buffer
|
|
228
|
+
* @param offset
|
|
229
|
+
* @param length
|
|
230
|
+
* @param bitOffset
|
|
231
|
+
* @param bitLength
|
|
232
|
+
* @param value
|
|
233
|
+
* @protected
|
|
234
|
+
*/
|
|
235
|
+
protected writeBits(offset: number, length: number, bitOffset: number, bitLength: number, value: number): void;
|
|
236
|
+
/**
|
|
237
|
+
* An unsigned big-endian integer field of `byteLength` octets at `offset`. Decode reads it into
|
|
238
|
+
* `name`; encode clamps to the field's range (recording an error, never throwing) and writes it —
|
|
239
|
+
* byte-for-byte identical to the hand-written pattern it replaces.
|
|
240
|
+
* @protected
|
|
241
|
+
*/
|
|
242
|
+
protected static fieldUInt(name: string, offset: number, byteLength: number, label: string): ProtocolFieldJSONSchema;
|
|
243
|
+
/**
|
|
244
|
+
* A signed 8-bit integer field at `offset` (e.g. NTP poll/precision — power-of-two exponents).
|
|
245
|
+
* Decode reads it as int8 into `name`; encode clamps to [-128, 127] (recording an error, never
|
|
246
|
+
* throwing) and writes it — byte-for-byte identical to a hand-written int8 field for in-range values.
|
|
247
|
+
* @protected
|
|
248
|
+
*/
|
|
249
|
+
protected static fieldInt8(name: string, offset: number, label: string): ProtocolFieldJSONSchema;
|
|
250
|
+
/**
|
|
251
|
+
* A raw byte field of `byteLength` octets at `offset`, kept verbatim as a lower-case hex string
|
|
252
|
+
* (e.g. NTP timestamps / reference id — bytes an editor should see and round-trip untouched).
|
|
253
|
+
* Decode reads the bytes to hex; encode writes the hex back (default: all-zero). Byte-for-byte
|
|
254
|
+
* identical to the hand-written pattern it replaces.
|
|
255
|
+
* @protected
|
|
256
|
+
*/
|
|
257
|
+
protected static fieldHex(name: string, offset: number, byteLength: number, label: string): ProtocolFieldJSONSchema;
|
|
258
|
+
/**
|
|
259
|
+
* A 4-octet IPv4 address field at `offset`, stored as a dotted-quad string (e.g. DHCP
|
|
260
|
+
* ciaddr/yiaddr/siaddr/giaddr). Decode reads it to `a.b.c.d`; encode writes it back (default
|
|
261
|
+
* '0.0.0.0', recording a Not Found error if the value is missing). Byte-for-byte identical to the
|
|
262
|
+
* hand-written IPv4-address pattern (see IPv4.sip/dip).
|
|
263
|
+
* @protected
|
|
264
|
+
*/
|
|
265
|
+
protected static fieldIPv4(name: string, offset: number, label: string): ProtocolFieldJSONSchema;
|
|
266
|
+
/**
|
|
267
|
+
* Get field codecs from schema tree
|
|
268
|
+
* @param schema
|
|
269
|
+
* @param codecName
|
|
270
|
+
* @param execBeforeSubCodecs
|
|
271
|
+
* @param codecs
|
|
272
|
+
* @protected
|
|
273
|
+
*/
|
|
274
|
+
protected getFieldCodecs(schema: ProtocolFieldJSONSchema, codecName: string, execBeforeSubCodecs: boolean, codecs?: (() => void | Promise<void>)[], paths?: string[] | null, pathPrefix?: string): (() => void | Promise<void>)[];
|
|
275
|
+
/**
|
|
276
|
+
* Record encode/decode error
|
|
277
|
+
* @param path
|
|
278
|
+
* @param message
|
|
279
|
+
* @protected
|
|
280
|
+
*/
|
|
281
|
+
protected recordError(path: string, message: string): void;
|
|
282
|
+
/**
|
|
283
|
+
* Register post encode handler for current codec
|
|
284
|
+
* @param handler
|
|
285
|
+
* @param priority
|
|
286
|
+
* @protected
|
|
287
|
+
*/
|
|
288
|
+
protected addPostSelfEncodeHandler(handler: () => void | Promise<void>, priority?: number): void;
|
|
289
|
+
/**
|
|
290
|
+
* Register post decode handler for current codec
|
|
291
|
+
* @param handler
|
|
292
|
+
* @param priority
|
|
293
|
+
* @protected
|
|
294
|
+
*/
|
|
295
|
+
protected addPostSelfDecodeHandler(handler: () => void | Promise<void>, priority?: number): void;
|
|
296
|
+
/**
|
|
297
|
+
* Register post encode handler for packet
|
|
298
|
+
* @description Registered handler call sequence: LIFO (Last In First Out)
|
|
299
|
+
* @param handler
|
|
300
|
+
* @param priority
|
|
301
|
+
* @protected
|
|
302
|
+
*/
|
|
303
|
+
protected addPostPacketEncodeHandler(handler: () => void | Promise<void>, priority?: number): void;
|
|
304
|
+
/**
|
|
305
|
+
* Register post decode handler for packet
|
|
306
|
+
* @description Registered handler call sequence: FIFO (First In First Out)
|
|
307
|
+
* @param handler
|
|
308
|
+
* @param priority
|
|
309
|
+
* @protected
|
|
310
|
+
*/
|
|
311
|
+
protected addPostPacketDecodeHandler(handler: () => void | Promise<void>, priority?: number): void;
|
|
312
|
+
/**
|
|
313
|
+
* Validate input json node is valid
|
|
314
|
+
* @param headerTreeNode
|
|
315
|
+
*/
|
|
316
|
+
validate(headerTreeNode: HeaderTreeNode): HeaderTreeNode;
|
|
317
|
+
/**
|
|
318
|
+
* Decode packet header field by field
|
|
319
|
+
*/
|
|
320
|
+
decode(): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* Encode packet header field by field
|
|
323
|
+
*/
|
|
324
|
+
encode(): Promise<void>;
|
|
325
|
+
}
|