@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,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DHCPv6 = void 0;
|
|
4
|
+
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
5
|
+
const BufferToHex_1 = require("../helper/BufferToHex");
|
|
6
|
+
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
7
|
+
const BufferToNumber_1 = require("../helper/BufferToNumber");
|
|
8
|
+
const NumberToBuffer_1 = require("../helper/NumberToBuffer");
|
|
9
|
+
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
10
|
+
/**
|
|
11
|
+
* DHCPv6 — Dynamic Host Configuration Protocol for IPv6 (RFC 8415). A client/server message is a
|
|
12
|
+
* 1-byte message-type, a 3-byte transaction-id, then options in a regular code-length-value form:
|
|
13
|
+
* option-code(2) + option-len(2) + option-data(option-len), no padding. Rides UDP, client port 546 and
|
|
14
|
+
* server port 547 (over IPv6, multicast ff02::1:2).
|
|
15
|
+
*
|
|
16
|
+
* Options are carried generically (code + verbatim hex data) so every option — including ones whose
|
|
17
|
+
* data is itself nested options (IA_NA/IA_PD) — round-trips byte-for-byte; per-option / nested decoding
|
|
18
|
+
* is a later enrichment. Relay-agent messages (RELAY-FORW 12 / RELAY-REPL 13) have a DIFFERENT body
|
|
19
|
+
* (hop-count + 2 IPv6 addresses + options), so their body is kept verbatim (rawBody) rather than
|
|
20
|
+
* misparsed as a transaction-id, preserving a byte-perfect round-trip.
|
|
21
|
+
*/
|
|
22
|
+
class DHCPv6 extends BaseHeader_1.BaseHeader {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.id = 'dhcpv6';
|
|
26
|
+
this.name = 'Dynamic Host Configuration Protocol for IPv6';
|
|
27
|
+
this.nickname = 'DHCPv6';
|
|
28
|
+
//Client port 546, server port 547 (both UDP, over IPv6). Port-defined (no content signature).
|
|
29
|
+
this.matchKeys = ['udpport:546', 'udpport:547'];
|
|
30
|
+
//A leaf header — nothing demuxes above DHCPv6.
|
|
31
|
+
this.demuxProducers = [];
|
|
32
|
+
}
|
|
33
|
+
static #schemaCache;
|
|
34
|
+
static #RELAY_MESSAGE_TYPES = new Set([12, 13]);
|
|
35
|
+
get SCHEMA() {
|
|
36
|
+
return (DHCPv6.#schemaCache ??= DHCPv6.#buildSchema());
|
|
37
|
+
}
|
|
38
|
+
static #buildSchema() {
|
|
39
|
+
return {
|
|
40
|
+
type: 'object',
|
|
41
|
+
summary: 'DHCPv6 type=${msgType} xid=${transactionId}',
|
|
42
|
+
properties: {
|
|
43
|
+
//DHCPv6 is message-type-driven (the transaction-id vs relay body shape depends on it), so
|
|
44
|
+
//the whole message is parsed/emitted here; the fields below carry only schema metadata.
|
|
45
|
+
msgType: {
|
|
46
|
+
type: 'integer',
|
|
47
|
+
label: 'Message Type',
|
|
48
|
+
minimum: 0,
|
|
49
|
+
maximum: 255,
|
|
50
|
+
decode: function () {
|
|
51
|
+
let available = this.packet.length - this.startPos;
|
|
52
|
+
if (available < 1)
|
|
53
|
+
return;
|
|
54
|
+
//Bound options/body by the UDP payload length, not the whole captured frame, so a
|
|
55
|
+
//retained Ethernet FCS or L2 padding after the datagram is not swallowed as bogus
|
|
56
|
+
//options — it spills to the raw layer and the packet still round-trips byte-perfect.
|
|
57
|
+
if (this.prevCodecModule && this.prevCodecModule.id === 'udp') {
|
|
58
|
+
const udpLength = this.prevCodecModule.instance.length.getValue(0);
|
|
59
|
+
if (udpLength >= 8 && udpLength - 8 < available)
|
|
60
|
+
available = udpLength - 8;
|
|
61
|
+
}
|
|
62
|
+
const msgType = (0, BufferToNumber_1.BufferToUInt8)(this.readBytes(0, 1));
|
|
63
|
+
this.instance.msgType.setValue(msgType);
|
|
64
|
+
if (DHCPv6.#RELAY_MESSAGE_TYPES.has(msgType)) {
|
|
65
|
+
//Relay-agent message: hop-count(1) + link-address(16) + peer-address(16) +
|
|
66
|
+
//options — a different shape, kept verbatim for a byte-perfect round-trip.
|
|
67
|
+
if (available > 1)
|
|
68
|
+
this.instance.rawBody.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(1, available - 1)));
|
|
69
|
+
else
|
|
70
|
+
this.instance.rawBody.setValue('');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.instance.transactionId.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(1, 3)));
|
|
74
|
+
const options = [];
|
|
75
|
+
let offset = 4;
|
|
76
|
+
//Each option is code(2) len(2) data(len), no terminator. Peek the header (dry-run,
|
|
77
|
+
//so it does not extend headerLength), and if the option data would overrun the
|
|
78
|
+
//payload, stop and leave the tail to the raw layer — keeping both truncated
|
|
79
|
+
//captures and trailing padding byte-perfect. offset advances ≥4 each iteration.
|
|
80
|
+
while (offset + 4 <= available) {
|
|
81
|
+
const header = this.readBytes(offset, 4, true);
|
|
82
|
+
const code = (0, BufferToNumber_1.BufferToUInt16)(header.subarray(0, 2));
|
|
83
|
+
const length = (0, BufferToNumber_1.BufferToUInt16)(header.subarray(2, 4));
|
|
84
|
+
if (offset + 4 + length > available)
|
|
85
|
+
break;
|
|
86
|
+
const optionBuffer = this.readBytes(offset, 4 + length);
|
|
87
|
+
options.push({ code: code, value: length ? (0, BufferToHex_1.BufferToHex)(optionBuffer.subarray(4)) : '' });
|
|
88
|
+
offset += 4 + length;
|
|
89
|
+
}
|
|
90
|
+
this.instance.options.setValue(options);
|
|
91
|
+
},
|
|
92
|
+
encode: function () {
|
|
93
|
+
const msgType = this.instance.msgType.getValue(0);
|
|
94
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt8ToBuffer)(msgType));
|
|
95
|
+
const rawBody = this.instance.rawBody.getValue('');
|
|
96
|
+
//Relay-agent messages (and any message carrying a verbatim body) re-emit rawBody
|
|
97
|
+
//as-is — keyed on the message type so a degenerate empty-body relay stays 1 byte.
|
|
98
|
+
if (rawBody || DHCPv6.#RELAY_MESSAGE_TYPES.has(msgType)) {
|
|
99
|
+
if (rawBody)
|
|
100
|
+
this.writeBytes(1, (0, HexToBuffer_1.HexToBuffer)(rawBody));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
//transaction-id is a fixed 3 bytes — fit any crafted hex to exactly 3 so it never
|
|
104
|
+
//shifts the following options (short is left-padded, long is truncated).
|
|
105
|
+
this.writeBytes(1, (0, HexToBuffer_1.HexToBuffer)(this.instance.transactionId.getValue('000000'), 3).subarray(0, 3));
|
|
106
|
+
let offset = 4;
|
|
107
|
+
const options = this.instance.options.getValue([]);
|
|
108
|
+
if (options) {
|
|
109
|
+
for (const option of options) {
|
|
110
|
+
const value = (0, HexToBuffer_1.HexToBuffer)(option.value ? option.value : '');
|
|
111
|
+
this.writeBytes(offset, (0, NumberToBuffer_1.UInt16ToBuffer)(option.code ? option.code : 0));
|
|
112
|
+
this.writeBytes(offset + 2, (0, NumberToBuffer_1.UInt16ToBuffer)(value.length));
|
|
113
|
+
offset += 4;
|
|
114
|
+
if (value.length) {
|
|
115
|
+
this.writeBytes(offset, value);
|
|
116
|
+
offset += value.length;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
transactionId: { type: 'string', label: 'Transaction ID', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX },
|
|
123
|
+
//Verbatim body for relay-agent messages (RELAY-FORW/RELAY-REPL); empty and hidden for the
|
|
124
|
+
//common client/server messages, which use transactionId + options.
|
|
125
|
+
rawBody: { type: 'string', label: 'Relay Body', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true },
|
|
126
|
+
options: {
|
|
127
|
+
type: 'array',
|
|
128
|
+
label: 'Options',
|
|
129
|
+
items: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
label: 'Option',
|
|
132
|
+
properties: {
|
|
133
|
+
code: { type: 'integer', label: 'Option Code', minimum: 0, maximum: 65535 },
|
|
134
|
+
value: { type: 'string', label: 'Option Data', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
match() {
|
|
142
|
+
return !!this.prevCodecModule && this.prevCodecModule.id === 'udp';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.DHCPv6 = DHCPv6;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* DNP3 — Distributed Network Protocol 3 (IEEE 1815), a SCADA protocol common in electric/water
|
|
6
|
+
* utilities, on TCP/UDP port 20000. Each frame begins with a 10-byte Data Link Layer header: the start
|
|
7
|
+
* bytes 0x0564, a Length (count of the octets from Control through the user data, excluding CRCs), a
|
|
8
|
+
* Control octet (DIR / PRM / FCB / FCV(or DFC) / 4-bit Function Code), a little-endian Destination and
|
|
9
|
+
* Source address, and a header CRC. The user data that follows is carried in blocks of up to 16 octets
|
|
10
|
+
* each with its own trailing 2-byte CRC.
|
|
11
|
+
*
|
|
12
|
+
* This codec decodes the link header structurally and keeps the data-block region (transport header +
|
|
13
|
+
* application data + the per-block CRCs) verbatim as `payload` hex — de-blocking those CRCs to recover
|
|
14
|
+
* the transport/application layer is a cross-frame reassembly concern, not a single-packet one. The CRCs
|
|
15
|
+
* are honored verbatim (never recomputed), so a well-formed frame round-trips byte-for-byte; the frame's
|
|
16
|
+
* extent is derived from the Length field so a pipelined/trailing frame is left to RawData.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DNP3 extends BaseHeader {
|
|
19
|
+
#private;
|
|
20
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly nickname: string;
|
|
24
|
+
readonly matchKeys: string[];
|
|
25
|
+
match(): boolean;
|
|
26
|
+
readonly demuxProducers: DemuxProducer[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DNP3 = void 0;
|
|
4
|
+
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
5
|
+
const BufferToHex_1 = require("../helper/BufferToHex");
|
|
6
|
+
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
7
|
+
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
8
|
+
/**
|
|
9
|
+
* DNP3 — Distributed Network Protocol 3 (IEEE 1815), a SCADA protocol common in electric/water
|
|
10
|
+
* utilities, on TCP/UDP port 20000. Each frame begins with a 10-byte Data Link Layer header: the start
|
|
11
|
+
* bytes 0x0564, a Length (count of the octets from Control through the user data, excluding CRCs), a
|
|
12
|
+
* Control octet (DIR / PRM / FCB / FCV(or DFC) / 4-bit Function Code), a little-endian Destination and
|
|
13
|
+
* Source address, and a header CRC. The user data that follows is carried in blocks of up to 16 octets
|
|
14
|
+
* each with its own trailing 2-byte CRC.
|
|
15
|
+
*
|
|
16
|
+
* This codec decodes the link header structurally and keeps the data-block region (transport header +
|
|
17
|
+
* application data + the per-block CRCs) verbatim as `payload` hex — de-blocking those CRCs to recover
|
|
18
|
+
* the transport/application layer is a cross-frame reassembly concern, not a single-packet one. The CRCs
|
|
19
|
+
* are honored verbatim (never recomputed), so a well-formed frame round-trips byte-for-byte; the frame's
|
|
20
|
+
* extent is derived from the Length field so a pipelined/trailing frame is left to RawData.
|
|
21
|
+
*/
|
|
22
|
+
class DNP3 extends BaseHeader_1.BaseHeader {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.id = 'dnp3';
|
|
26
|
+
this.name = 'Distributed Network Protocol 3';
|
|
27
|
+
this.nickname = 'DNP3';
|
|
28
|
+
this.matchKeys = ['tcpport:20000', 'udpport:20000'];
|
|
29
|
+
//A leaf header — the transport/application layers require de-blocking (a reassembly concern).
|
|
30
|
+
this.demuxProducers = [];
|
|
31
|
+
}
|
|
32
|
+
static #schemaCache;
|
|
33
|
+
get SCHEMA() {
|
|
34
|
+
return (DNP3.#schemaCache ??= DNP3.#buildSchema());
|
|
35
|
+
}
|
|
36
|
+
/** A single bit of the Control octet (byte 3, bit 0 = MSB). */
|
|
37
|
+
static #flagBit(name, bitOffset, label) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
label: label,
|
|
41
|
+
decode: function () {
|
|
42
|
+
this.instance.control[name].setValue(!!this.readBits(3, 1, bitOffset, 1));
|
|
43
|
+
},
|
|
44
|
+
encode: function () {
|
|
45
|
+
const value = !!this.instance.control[name].getValue();
|
|
46
|
+
this.instance.control[name].setValue(value);
|
|
47
|
+
this.writeBits(3, 1, bitOffset, 1, value ? 1 : 0);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** The total on-wire frame length derived from the Length field: 10-byte header + data blocks (each
|
|
52
|
+
* up to 16 data octets plus a 2-byte CRC). */
|
|
53
|
+
#frameLength() {
|
|
54
|
+
const length = this.instance.length.getValue(0);
|
|
55
|
+
const userData = length > 5 ? length - 5 : 0;
|
|
56
|
+
const blocks = Math.ceil(userData / 16);
|
|
57
|
+
return 10 + userData + blocks * 2;
|
|
58
|
+
}
|
|
59
|
+
static #buildSchema() {
|
|
60
|
+
return {
|
|
61
|
+
type: 'object',
|
|
62
|
+
summary: 'DNP3 func=${control.functionCode} ${source}->${destination}',
|
|
63
|
+
properties: {
|
|
64
|
+
start: this.fieldHex('start', 0, 2, 'Start'),
|
|
65
|
+
length: this.fieldUInt('length', 2, 1, 'Length'),
|
|
66
|
+
//Control octet (byte 3, MSB first): DIR / PRM / FCB / FCV(or DFC) / Function Code(4 bits).
|
|
67
|
+
control: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
label: 'Control',
|
|
70
|
+
properties: {
|
|
71
|
+
dir: this.#flagBit('dir', 0, 'Direction'),
|
|
72
|
+
prm: this.#flagBit('prm', 1, 'Primary'),
|
|
73
|
+
fcb: this.#flagBit('fcb', 2, 'Frame Count Bit'),
|
|
74
|
+
fcv: this.#flagBit('fcv', 3, 'Frame Count Valid'),
|
|
75
|
+
functionCode: {
|
|
76
|
+
type: 'integer',
|
|
77
|
+
label: 'Function Code',
|
|
78
|
+
minimum: 0,
|
|
79
|
+
maximum: 15,
|
|
80
|
+
decode: function () { this.instance.control.functionCode.setValue(this.readBits(3, 1, 4, 4)); },
|
|
81
|
+
encode: function () { this.writeBits(3, 1, 4, 4, this.instance.control.functionCode.getValue(0)); }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
//Destination and Source are 16-bit little-endian link addresses.
|
|
86
|
+
destination: {
|
|
87
|
+
type: 'integer',
|
|
88
|
+
label: 'Destination',
|
|
89
|
+
minimum: 0,
|
|
90
|
+
maximum: 65535,
|
|
91
|
+
decode: function () {
|
|
92
|
+
const bytes = this.readBytes(4, 2);
|
|
93
|
+
this.instance.destination.setValue(bytes[0] | (bytes[1] << 8));
|
|
94
|
+
},
|
|
95
|
+
encode: function () {
|
|
96
|
+
const value = this.instance.destination.getValue(0);
|
|
97
|
+
this.writeBytes(4, Buffer.from([value & 0xff, (value >> 8) & 0xff]));
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
source: {
|
|
101
|
+
type: 'integer',
|
|
102
|
+
label: 'Source',
|
|
103
|
+
minimum: 0,
|
|
104
|
+
maximum: 65535,
|
|
105
|
+
decode: function () {
|
|
106
|
+
const bytes = this.readBytes(6, 2);
|
|
107
|
+
this.instance.source.setValue(bytes[0] | (bytes[1] << 8));
|
|
108
|
+
},
|
|
109
|
+
encode: function () {
|
|
110
|
+
const value = this.instance.source.getValue(0);
|
|
111
|
+
this.writeBytes(6, Buffer.from([value & 0xff, (value >> 8) & 0xff]));
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
//Header CRC over the preceding 8 octets, honored verbatim (never recomputed).
|
|
115
|
+
headerCrc: this.fieldHex('headerCrc', 8, 2, 'Header CRC'),
|
|
116
|
+
//The data-block region: transport header + application data + per-block CRCs, kept verbatim.
|
|
117
|
+
//Bounded by the Length-derived frame extent so a pipelined/trailing frame is left to raw.
|
|
118
|
+
payload: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
label: 'Payload',
|
|
121
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
122
|
+
decode: function () {
|
|
123
|
+
const remaining = this.packet.length - this.startPos;
|
|
124
|
+
let end = this.#frameLength();
|
|
125
|
+
if (end > remaining)
|
|
126
|
+
end = remaining;
|
|
127
|
+
this.instance.payload.setValue(end > 10 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(10, end - 10)) : '');
|
|
128
|
+
},
|
|
129
|
+
encode: function () {
|
|
130
|
+
const payload = this.instance.payload.getValue('');
|
|
131
|
+
if (payload)
|
|
132
|
+
this.writeBytes(10, (0, HexToBuffer_1.HexToBuffer)(payload));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
match() {
|
|
139
|
+
//DNP3 rides on TCP/UDP port 20000. Require the 10-byte link header and the 0x0564 start signature.
|
|
140
|
+
if (!this.prevCodecModule)
|
|
141
|
+
return false;
|
|
142
|
+
if (this.prevCodecModule.id !== 'tcp' && this.prevCodecModule.id !== 'udp')
|
|
143
|
+
return false;
|
|
144
|
+
if (this.packet.length - this.startPos < 10)
|
|
145
|
+
return false;
|
|
146
|
+
const start = this.readBytes(0, 2, true);
|
|
147
|
+
return start[0] === 0x05 && start[1] === 0x64;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.DNP3 = DNP3;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* A domain name. `value` is the resolved dotted string (following any compression pointers) for
|
|
6
|
+
* display and differential checks; `raw` is the EXACT on-wire bytes of the name at its physical
|
|
7
|
+
* position (local labels + either a null terminator or a 2-byte compression pointer), which is what
|
|
8
|
+
* encode re-emits — so a compressed name round-trips byte-for-byte without having to reconstruct the
|
|
9
|
+
* compression. When crafting a name from scratch (no `raw`), encode falls back to an uncompressed
|
|
10
|
+
* encoding built from `value`.
|
|
11
|
+
*/
|
|
12
|
+
type DnsName = {
|
|
13
|
+
value: string;
|
|
14
|
+
raw: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* DNS — Domain Name System (RFC 1035), the message carried over UDP port 53. A 12-byte header (ID,
|
|
18
|
+
* flags, and the four section counts) followed by the Question, Answer, Authority and Additional
|
|
19
|
+
* sections. Names use label compression (RFC 1035 §4.1.4): a length octet with its top two bits set
|
|
20
|
+
* (0xC0) is a 14-bit pointer to an earlier offset in the message.
|
|
21
|
+
*
|
|
22
|
+
* Byte-perfect strategy: every name keeps its exact wire bytes (`raw`) and every record's RDATA is
|
|
23
|
+
* kept as raw hex, so compression pointers — inside names and inside RDATA (CNAME/NS/SOA/MX targets) —
|
|
24
|
+
* are reproduced verbatim; the resolved dotted name (`value`) is a decoded convenience. Per-RDATA
|
|
25
|
+
* semantic decoding (A → address, etc.) is a later enrichment on top of this faithful base. DNS over
|
|
26
|
+
* TCP (which prefixes a 2-byte length and can span segments) is out of scope for this single-packet
|
|
27
|
+
* codec and belongs to the reassembly layer.
|
|
28
|
+
*/
|
|
29
|
+
export declare class DNS extends BaseHeader {
|
|
30
|
+
#private;
|
|
31
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
32
|
+
/**
|
|
33
|
+
* Parse the name at header-relative `offset`. Returns the resolved value + exact physical raw bytes
|
|
34
|
+
* and the offset just past the physical name. Compression pointers are followed only to build the
|
|
35
|
+
* resolved value (dry-run reads that never grow headerLength); the physical bytes are the local
|
|
36
|
+
* labels plus the terminating null OR the 2-byte pointer, so endPos stays exact.
|
|
37
|
+
*/
|
|
38
|
+
protected readName(offset: number): {
|
|
39
|
+
name: DnsName;
|
|
40
|
+
next: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Write a name at `offset`. Re-emits the exact `raw` wire bytes when present (byte-perfect for a
|
|
44
|
+
* decoded name, including its compression pointer); otherwise builds an uncompressed encoding from
|
|
45
|
+
* the dotted `value` (for names crafted from scratch). Returns the offset past the written name.
|
|
46
|
+
*/
|
|
47
|
+
protected writeName(offset: number, name: DnsName | undefined): number;
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly nickname: string;
|
|
51
|
+
readonly matchKeys: string[];
|
|
52
|
+
match(): boolean;
|
|
53
|
+
readonly demuxProducers: DemuxProducer[];
|
|
54
|
+
}
|
|
55
|
+
export {};
|