@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,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitProtocol = 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
|
+
* Git Smart Transport over the native `git://` protocol (git-daemon, TCP port 9418). The wire format is
|
|
10
|
+
* a stream of pkt-lines: each pkt-line is a 4-character ASCII hexadecimal length prefix (the length
|
|
11
|
+
* COUNTS those 4 characters) followed by that many minus four bytes of payload; the special value
|
|
12
|
+
* "0000" is a flush-pkt (an empty delimiter, no payload). A git-daemon session opens with a single
|
|
13
|
+
* request pkt-line such as `0032git-upload-pack /project.git\0host=example.com\0` — a length prefix,
|
|
14
|
+
* the service command and repository path, then NUL-delimited extra parameters (host, and for v2 an
|
|
15
|
+
* extra NUL plus capabilities).
|
|
16
|
+
*
|
|
17
|
+
* Like SIP/HTTP, the message body is a text-ish framed stream whose full internal structure (an
|
|
18
|
+
* arbitrary number of pkt-lines, service negotiation, ref advertisements, packfile data) is far richer
|
|
19
|
+
* than a form needs, and byte layout is significant. So the ENTIRE payload of the current segment is
|
|
20
|
+
* kept verbatim as the authoritative `message` field (hex) and re-emitted untouched; only the FIRST
|
|
21
|
+
* pkt-line is parsed on decode into display-only metadata (its declared length and command line).
|
|
22
|
+
* Encode never reconstructs the stream from the parsed fields — it writes `message` back byte-for-byte
|
|
23
|
+
* — so any conformant (or even malformed) git segment round-trips exactly.
|
|
24
|
+
*
|
|
25
|
+
* Note: a git session spans many TCP segments (request, ref advertisement, want/have negotiation, the
|
|
26
|
+
* packfile); reassembly across segments is out of scope. This single-segment codec keeps whatever bytes
|
|
27
|
+
* are present in the current segment verbatim, which is byte-perfect for the single-packet case.
|
|
28
|
+
*/
|
|
29
|
+
class GitProtocol extends BaseHeader_1.BaseHeader {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.id = 'git';
|
|
33
|
+
this.name = 'Git Smart Protocol';
|
|
34
|
+
this.nickname = 'Git';
|
|
35
|
+
this.matchKeys = ['tcpport:9418'];
|
|
36
|
+
//A leaf header — the pkt-line stream (ref advertisement, negotiation, packfile) is a higher-layer
|
|
37
|
+
//concern and spans multiple segments; the payload is kept verbatim as `message`.
|
|
38
|
+
this.demuxProducers = [];
|
|
39
|
+
}
|
|
40
|
+
static #schemaCache;
|
|
41
|
+
get SCHEMA() {
|
|
42
|
+
return (GitProtocol.#schemaCache ??= GitProtocol.#buildSchema());
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Bytes of this header: git rides on TCP, which has no per-message length, so take the rest of the
|
|
46
|
+
* segment. Stream reassembly across segments is out of scope (see class doc).
|
|
47
|
+
*/
|
|
48
|
+
#payloadLength() {
|
|
49
|
+
const available = this.packet.length - this.startPos;
|
|
50
|
+
return available < 0 ? 0 : available;
|
|
51
|
+
}
|
|
52
|
+
/** True if the byte is an ASCII hexadecimal digit (0-9, a-f, A-F) — the pkt-line length alphabet. */
|
|
53
|
+
static #isHexDigit(byte) {
|
|
54
|
+
return (byte >= 0x30 && byte <= 0x39) || (byte >= 0x61 && byte <= 0x66) || (byte >= 0x41 && byte <= 0x46);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse the first pkt-line into the display-only metadata fields. The first 4 bytes are the ASCII
|
|
58
|
+
* hex length prefix (counting themselves); "0000" is a flush-pkt (length 0, empty command). The
|
|
59
|
+
* command is the pkt-line payload up to the first NUL (for a request pkt-line that is
|
|
60
|
+
* `<service> <path>`). Populated on decode only — these fields have no encode, so they never affect
|
|
61
|
+
* the re-emitted bytes. Never throws: a short/invalid prefix yields length 0 and an empty command.
|
|
62
|
+
*/
|
|
63
|
+
#parseFirstPktLine(payload) {
|
|
64
|
+
if (payload.length < 4) {
|
|
65
|
+
this.instance.firstPktLineLength.setValue(0);
|
|
66
|
+
this.instance.firstCommand.setValue('');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const prefix = payload.subarray(0, 4).toString('latin1');
|
|
70
|
+
const declared = parseInt(prefix, 16);
|
|
71
|
+
const length = Number.isNaN(declared) ? 0 : declared;
|
|
72
|
+
this.instance.firstPktLineLength.setValue(length);
|
|
73
|
+
//flush-pkt (0000) or a length that does not exceed the prefix itself carries no payload.
|
|
74
|
+
if (length <= 4) {
|
|
75
|
+
this.instance.firstCommand.setValue('');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let end = length;
|
|
79
|
+
if (end > payload.length)
|
|
80
|
+
end = payload.length;
|
|
81
|
+
const body = payload.subarray(4, end);
|
|
82
|
+
//The command is the text up to the first NUL (extra parameters follow NUL-delimited).
|
|
83
|
+
const nul = body.indexOf(0x00);
|
|
84
|
+
const command = nul >= 0 ? body.subarray(0, nul) : body;
|
|
85
|
+
this.instance.firstCommand.setValue(command.toString('latin1'));
|
|
86
|
+
}
|
|
87
|
+
static #buildSchema() {
|
|
88
|
+
return {
|
|
89
|
+
type: 'object',
|
|
90
|
+
summary: 'Git ${firstCommand}',
|
|
91
|
+
properties: {
|
|
92
|
+
//The whole segment payload is the single source of truth: decoded verbatim to hex and
|
|
93
|
+
//re-emitted untouched (byte-perfect for any git segment). The first pkt-line is parsed
|
|
94
|
+
//into the display-only metadata below, which carry no codec of their own.
|
|
95
|
+
message: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
label: 'Message',
|
|
98
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
99
|
+
decode: function () {
|
|
100
|
+
const available = this.#payloadLength();
|
|
101
|
+
if (available <= 0) {
|
|
102
|
+
this.instance.message.setValue('');
|
|
103
|
+
this.#parseFirstPktLine(Buffer.alloc(0));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const raw = this.readBytes(0, available);
|
|
107
|
+
this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
|
|
108
|
+
this.#parseFirstPktLine(raw);
|
|
109
|
+
},
|
|
110
|
+
encode: function () {
|
|
111
|
+
//Re-emit the authoritative message verbatim — never reconstruct from metadata.
|
|
112
|
+
this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
//Display-only metadata parsed from the first pkt-line on decode (no encode — populated by
|
|
116
|
+
//the message field above, never read back). firstPktLineLength is the declared 4-hex-char
|
|
117
|
+
//length prefix; firstCommand is the pkt-line payload up to the first NUL (the service
|
|
118
|
+
//command + repository path for a request line).
|
|
119
|
+
firstPktLineLength: { type: 'integer', label: 'First pkt-line Length', minimum: 0, maximum: 65535 },
|
|
120
|
+
firstCommand: { type: 'string', label: 'First Command' }
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
match() {
|
|
125
|
+
//Git rides on TCP port 9418 (git-daemon) as a pkt-line stream. Port 9418 is dedicated to git,
|
|
126
|
+
//but require the pkt-line signature — at least a 4-byte ASCII-hex length prefix — so non-git
|
|
127
|
+
//traffic on the port falls through to raw rather than claiming an un-decodable text layer. Text
|
|
128
|
+
//protocols do not open a heuristicFallback, so this stays port-bucketed.
|
|
129
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'tcp')
|
|
130
|
+
return false;
|
|
131
|
+
if (this.#payloadLength() < 4)
|
|
132
|
+
return false;
|
|
133
|
+
const prefix = this.readBytes(0, 4, true);
|
|
134
|
+
for (let i = 0; i < 4; i++) {
|
|
135
|
+
if (!GitProtocol.#isHexDigit(prefix[i]))
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.GitProtocol = GitProtocol;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
2
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
+
import TLV from 'node-tlv';
|
|
4
|
+
declare enum ItemDataType {
|
|
5
|
+
Boolean = "Boolean",
|
|
6
|
+
INT8 = "INT8",
|
|
7
|
+
INT16 = "INT16",
|
|
8
|
+
INT32 = "INT32",
|
|
9
|
+
INT64 = "INT64",
|
|
10
|
+
INT8U = "INT8U",
|
|
11
|
+
INT16U = "INT16U",
|
|
12
|
+
INT32U = "INT32U",
|
|
13
|
+
FLOAT32 = "FLOAT32",
|
|
14
|
+
CODEDENUM = "CODED-ENUM",
|
|
15
|
+
OCTETSTRING = "OCTET-STRING",
|
|
16
|
+
VISIBLESTRING = "VISIBLE-STRING",
|
|
17
|
+
TimeStamp = "TimeStamp",
|
|
18
|
+
Quality = "Quality",
|
|
19
|
+
Structure = "Structure"
|
|
20
|
+
}
|
|
21
|
+
type BooleanDataItem = {
|
|
22
|
+
dataType: ItemDataType.Boolean;
|
|
23
|
+
value: boolean;
|
|
24
|
+
};
|
|
25
|
+
type INT8DataItem = {
|
|
26
|
+
dataType: ItemDataType.INT8;
|
|
27
|
+
value: number;
|
|
28
|
+
};
|
|
29
|
+
type INT16DataItem = {
|
|
30
|
+
dataType: ItemDataType.INT16;
|
|
31
|
+
value: number;
|
|
32
|
+
};
|
|
33
|
+
type INT32DataItem = {
|
|
34
|
+
dataType: ItemDataType.INT32;
|
|
35
|
+
value: number;
|
|
36
|
+
};
|
|
37
|
+
type INT64DataItem = {
|
|
38
|
+
dataType: ItemDataType.INT64;
|
|
39
|
+
value: bigint;
|
|
40
|
+
};
|
|
41
|
+
type INT8UDataItem = {
|
|
42
|
+
dataType: ItemDataType.INT8U;
|
|
43
|
+
value: number;
|
|
44
|
+
};
|
|
45
|
+
type INT16UDataItem = {
|
|
46
|
+
dataType: ItemDataType.INT16U;
|
|
47
|
+
value: number;
|
|
48
|
+
};
|
|
49
|
+
type INT32UDataItem = {
|
|
50
|
+
dataType: ItemDataType.INT32U;
|
|
51
|
+
value: number;
|
|
52
|
+
};
|
|
53
|
+
type FLOAT32DataItem = {
|
|
54
|
+
dataType: ItemDataType.FLOAT32;
|
|
55
|
+
value: number;
|
|
56
|
+
};
|
|
57
|
+
type CODEDENUMDataItem = {
|
|
58
|
+
dataType: ItemDataType.CODEDENUM;
|
|
59
|
+
value: number;
|
|
60
|
+
};
|
|
61
|
+
type OCTETSTRINGDataItem = {
|
|
62
|
+
dataType: ItemDataType.OCTETSTRING;
|
|
63
|
+
value: string;
|
|
64
|
+
};
|
|
65
|
+
type VISIBLESTRINGDataItem = {
|
|
66
|
+
dataType: ItemDataType.VISIBLESTRING;
|
|
67
|
+
value: string;
|
|
68
|
+
};
|
|
69
|
+
type TimeStampDataItem = {
|
|
70
|
+
dataType: ItemDataType.TimeStamp;
|
|
71
|
+
value: string;
|
|
72
|
+
};
|
|
73
|
+
type QualityDataItem = {
|
|
74
|
+
dataType: ItemDataType.Quality;
|
|
75
|
+
value: string;
|
|
76
|
+
};
|
|
77
|
+
type StructureDataItem = {
|
|
78
|
+
dataType: ItemDataType.Structure;
|
|
79
|
+
value: DataItem[];
|
|
80
|
+
};
|
|
81
|
+
type DataItem = BooleanDataItem | INT8DataItem | INT16DataItem | INT32DataItem | INT64DataItem | INT8UDataItem | INT16UDataItem | INT32UDataItem | FLOAT32DataItem | CODEDENUMDataItem | OCTETSTRINGDataItem | VISIBLESTRINGDataItem | TimeStampDataItem | QualityDataItem | StructureDataItem;
|
|
82
|
+
export declare class Goose extends BaseHeader {
|
|
83
|
+
protected TLVInstance: TLV;
|
|
84
|
+
protected TLVChild: TLV[];
|
|
85
|
+
/**
|
|
86
|
+
* True when at least one structured goosePdu field decoded/was supplied. Used to
|
|
87
|
+
* decide whether the raw-passthrough fallback applies.
|
|
88
|
+
*/
|
|
89
|
+
protected goosePduHasStructuredContent(): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* True when decode preserved an unparsed goosePdu region and no structured field is
|
|
92
|
+
* present: encode then re-emits the raw bytes verbatim. Setting any structured field
|
|
93
|
+
* turns this false and encode rebuilds the PDU from fields instead.
|
|
94
|
+
*/
|
|
95
|
+
protected goosePduRawFallbackActive(): boolean;
|
|
96
|
+
SCHEMA: ProtocolJSONSchema;
|
|
97
|
+
/**
|
|
98
|
+
* Decode data TLV items
|
|
99
|
+
* @param dataTLVs
|
|
100
|
+
* @protected
|
|
101
|
+
*/
|
|
102
|
+
protected decodeDataTLVItem(dataTLVs: TLV[]): DataItem[];
|
|
103
|
+
/**
|
|
104
|
+
* Encode data TLV items
|
|
105
|
+
* @param dataItems
|
|
106
|
+
* @protected
|
|
107
|
+
*/
|
|
108
|
+
protected encodeDataTLVItem(dataItems: DataItem[]): TLV[];
|
|
109
|
+
readonly id: string;
|
|
110
|
+
readonly matchKeys: string[];
|
|
111
|
+
readonly name: string;
|
|
112
|
+
readonly nickname: string;
|
|
113
|
+
match(): boolean;
|
|
114
|
+
}
|
|
115
|
+
export {};
|