@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,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RIPng = 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
|
+
* RIPng — RIP for IPv6 (RFC 2080), carried over UDP port 521 (the RIPng process address ff02::9). A
|
|
12
|
+
* RIPng message is a 4-byte fixed header — Command (1 Request, 2 Response), Version (= 1) and a 2-byte
|
|
13
|
+
* reserved field (kept verbatim) — followed by zero or more 20-byte Route Table Entries (RTEs). Each
|
|
14
|
+
* RTE is an IPv6 Prefix (16 bytes), a Route Tag (2 bytes), a Prefix Length (1 byte) and a Metric
|
|
15
|
+
* (1 byte). An RTE with Metric 255 and Prefix Length 0 is a Next Hop RTE (RFC 2080 §2.1.1) carrying the
|
|
16
|
+
* next-hop address for the RTEs that follow it; it is carried structurally like any other RTE.
|
|
17
|
+
*
|
|
18
|
+
* The message has no length field of its own — the RTE array runs to the end of the UDP payload
|
|
19
|
+
* (udp.length - 8), which bounds the walk so retained Ethernet padding / trailing bytes are not
|
|
20
|
+
* absorbed. The IPv6 Prefix is kept verbatim as a lower-case hex string so any prefix (including a
|
|
21
|
+
* zero prefix, or a next-hop address) round-trips byte-for-byte. RIPng is a leaf — nothing rides on it.
|
|
22
|
+
*/
|
|
23
|
+
class RIPng extends BaseHeader_1.BaseHeader {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.id = 'ripng';
|
|
27
|
+
this.name = 'RIP for IPv6';
|
|
28
|
+
this.nickname = 'RIPng';
|
|
29
|
+
this.matchKeys = ['udpport:521'];
|
|
30
|
+
//A leaf header — nothing is carried on top of a RIPng message.
|
|
31
|
+
this.demuxProducers = [];
|
|
32
|
+
}
|
|
33
|
+
static #schemaCache;
|
|
34
|
+
get SCHEMA() {
|
|
35
|
+
return (RIPng.#schemaCache ??= RIPng.#buildSchema());
|
|
36
|
+
}
|
|
37
|
+
/** The payload length bounded by the UDP datagram (so retained padding/FCS is not absorbed). */
|
|
38
|
+
#payloadLength() {
|
|
39
|
+
let available = this.packet.length - this.startPos;
|
|
40
|
+
if (this.prevCodecModule && this.prevCodecModule.id === 'udp') {
|
|
41
|
+
const udpLength = this.prevCodecModule.instance.length.getValue(0);
|
|
42
|
+
if (udpLength >= 8 && udpLength - 8 < available)
|
|
43
|
+
available = udpLength - 8;
|
|
44
|
+
}
|
|
45
|
+
return available < 0 ? 0 : available;
|
|
46
|
+
}
|
|
47
|
+
static #buildSchema() {
|
|
48
|
+
return {
|
|
49
|
+
type: 'object',
|
|
50
|
+
summary: 'RIPng cmd=${command} ${rtes.length} RTEs',
|
|
51
|
+
properties: {
|
|
52
|
+
//Fixed 4-byte header: Command (1 Request / 2 Response), Version (= 1), 2-byte reserved.
|
|
53
|
+
command: this.fieldUInt('command', 0, 1, 'Command'),
|
|
54
|
+
version: this.fieldUInt('version', 1, 1, 'Version'),
|
|
55
|
+
//Reserved (2 bytes, must be zero per RFC 2080 but kept verbatim so a non-zero value in a
|
|
56
|
+
//crafted/non-conformant message still round-trips byte-for-byte).
|
|
57
|
+
reserved: this.fieldUInt('reserved', 2, 2, 'Reserved'),
|
|
58
|
+
//Route Table Entries — 20 bytes each, running from offset 4 to the end of the UDP payload.
|
|
59
|
+
rtes: {
|
|
60
|
+
type: 'array',
|
|
61
|
+
label: 'Route Table Entries',
|
|
62
|
+
items: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
label: 'RTE',
|
|
65
|
+
properties: {
|
|
66
|
+
prefix: { type: 'string', label: 'IPv6 Prefix', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX },
|
|
67
|
+
routeTag: { type: 'integer', label: 'Route Tag', minimum: 0, maximum: 65535 },
|
|
68
|
+
prefixLength: { type: 'integer', label: 'Prefix Length', minimum: 0, maximum: 255 },
|
|
69
|
+
metric: { type: 'integer', label: 'Metric', minimum: 0, maximum: 255 }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
decode: function () {
|
|
73
|
+
//No length field: the RTE array runs to the end of the UDP payload, 20 bytes each.
|
|
74
|
+
//A trailing fragment shorter than 20 bytes (truncation/padding) is not consumed.
|
|
75
|
+
const end = this.#payloadLength();
|
|
76
|
+
const rtes = [];
|
|
77
|
+
let offset = 4;
|
|
78
|
+
while (offset + 20 <= end) {
|
|
79
|
+
rtes.push({
|
|
80
|
+
prefix: (0, BufferToHex_1.BufferToHex)(this.readBytes(offset, 16)),
|
|
81
|
+
routeTag: (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(offset + 16, 2)),
|
|
82
|
+
prefixLength: (0, BufferToNumber_1.BufferToUInt8)(this.readBytes(offset + 18, 1)),
|
|
83
|
+
metric: (0, BufferToNumber_1.BufferToUInt8)(this.readBytes(offset + 19, 1))
|
|
84
|
+
});
|
|
85
|
+
offset += 20;
|
|
86
|
+
}
|
|
87
|
+
this.instance.rtes.setValue(rtes);
|
|
88
|
+
},
|
|
89
|
+
encode: function () {
|
|
90
|
+
const rtes = this.instance.rtes.getValue([]);
|
|
91
|
+
if (!rtes)
|
|
92
|
+
return;
|
|
93
|
+
let offset = 4;
|
|
94
|
+
for (let i = 0; i < rtes.length; i++) {
|
|
95
|
+
const rte = rtes[i];
|
|
96
|
+
//The Prefix is a fixed 16 bytes: pad/truncate a crafted value to exactly 16
|
|
97
|
+
//(32 hex chars) so a malformed input can never shift the following RTEs.
|
|
98
|
+
const prefix = (rte.prefix ? rte.prefix : '').padStart(32, '0').slice(-32);
|
|
99
|
+
this.writeBytes(offset, (0, HexToBuffer_1.HexToBuffer)(prefix));
|
|
100
|
+
this.writeBytes(offset + 16, (0, NumberToBuffer_1.UInt16ToBuffer)(this.#clamp(`rtes[${i}].routeTag`, rte.routeTag, 65535)));
|
|
101
|
+
this.writeBytes(offset + 18, (0, NumberToBuffer_1.UInt8ToBuffer)(this.#clamp(`rtes[${i}].prefixLength`, rte.prefixLength, 255)));
|
|
102
|
+
this.writeBytes(offset + 19, (0, NumberToBuffer_1.UInt8ToBuffer)(this.#clamp(`rtes[${i}].metric`, rte.metric, 255)));
|
|
103
|
+
offset += 20;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** Clamp a crafted RTE field to [0, max], recording an error rather than throwing or wrapping. */
|
|
111
|
+
#clamp(path, value, max) {
|
|
112
|
+
let v = (value === undefined || value === null) ? 0 : value;
|
|
113
|
+
if (v > max) {
|
|
114
|
+
this.recordError(path, `Maximum value is ${max}`);
|
|
115
|
+
v = max;
|
|
116
|
+
}
|
|
117
|
+
if (v < 0) {
|
|
118
|
+
this.recordError(path, 'Minimum value is 0');
|
|
119
|
+
v = 0;
|
|
120
|
+
}
|
|
121
|
+
return v;
|
|
122
|
+
}
|
|
123
|
+
match() {
|
|
124
|
+
//RIPng rides on UDP port 521. Require the full 4-byte fixed header within the UDP payload and a
|
|
125
|
+
//conformant Command (1 Request / 2 Response) + Version (1) signature, so non-RIPng traffic on
|
|
126
|
+
//port 521 falls through to raw rather than claiming a layer.
|
|
127
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'udp')
|
|
128
|
+
return false;
|
|
129
|
+
if (this.#payloadLength() < 4)
|
|
130
|
+
return false;
|
|
131
|
+
const command = (0, BufferToNumber_1.BufferToUInt8)(this.readBytes(0, 1, true));
|
|
132
|
+
const version = (0, BufferToNumber_1.BufferToUInt8)(this.readBytes(1, 1, true));
|
|
133
|
+
if (command !== 1 && command !== 2)
|
|
134
|
+
return false;
|
|
135
|
+
if (version !== 1)
|
|
136
|
+
return false;
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.RIPng = RIPng;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* RMCP — Remote Management Control Protocol (ASF 2.0 / DSP0136, IPMI 2.0), UDP port 623. The 4-byte
|
|
6
|
+
* header is Version (0x06 = RMCP 1.0), a Reserved byte, a Sequence Number (0xFF = no ACK requested),
|
|
7
|
+
* and a Class-of-Message byte whose top bit is the ACK flag, bit 6 is reserved, and the low 6 bits are
|
|
8
|
+
* the message class (6 = ASF, 7 = IPMI, 8 = OEM).
|
|
9
|
+
*
|
|
10
|
+
* The payload after the header depends on the class. For an ASF message (class 6) the payload is an
|
|
11
|
+
* ASF frame — IANA Enterprise Number (4542 for ASF), Message Type, Message Tag, a reserved byte, a
|
|
12
|
+
* Data Length, and the data — which this codec decodes structurally (the trailing data is kept as raw
|
|
13
|
+
* hex so any length rounds-trips). For IPMI (7, a session-wrapped message) and OEM (8) classes the
|
|
14
|
+
* payload is kept verbatim (rawBody) — those are stateful session protocols for a higher layer. A
|
|
15
|
+
* well-formed message round-trips byte-for-byte.
|
|
16
|
+
*/
|
|
17
|
+
export declare class RMCP extends BaseHeader {
|
|
18
|
+
#private;
|
|
19
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly nickname: string;
|
|
23
|
+
readonly matchKeys: string[];
|
|
24
|
+
match(): boolean;
|
|
25
|
+
readonly demuxProducers: DemuxProducer[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RMCP = 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
|
+
* RMCP — Remote Management Control Protocol (ASF 2.0 / DSP0136, IPMI 2.0), UDP port 623. The 4-byte
|
|
12
|
+
* header is Version (0x06 = RMCP 1.0), a Reserved byte, a Sequence Number (0xFF = no ACK requested),
|
|
13
|
+
* and a Class-of-Message byte whose top bit is the ACK flag, bit 6 is reserved, and the low 6 bits are
|
|
14
|
+
* the message class (6 = ASF, 7 = IPMI, 8 = OEM).
|
|
15
|
+
*
|
|
16
|
+
* The payload after the header depends on the class. For an ASF message (class 6) the payload is an
|
|
17
|
+
* ASF frame — IANA Enterprise Number (4542 for ASF), Message Type, Message Tag, a reserved byte, a
|
|
18
|
+
* Data Length, and the data — which this codec decodes structurally (the trailing data is kept as raw
|
|
19
|
+
* hex so any length rounds-trips). For IPMI (7, a session-wrapped message) and OEM (8) classes the
|
|
20
|
+
* payload is kept verbatim (rawBody) — those are stateful session protocols for a higher layer. A
|
|
21
|
+
* well-formed message round-trips byte-for-byte.
|
|
22
|
+
*/
|
|
23
|
+
class RMCP extends BaseHeader_1.BaseHeader {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.id = 'rmcp';
|
|
27
|
+
this.name = 'Remote Management Control Protocol';
|
|
28
|
+
this.nickname = 'RMCP';
|
|
29
|
+
this.matchKeys = ['udpport:623'];
|
|
30
|
+
//A leaf header — the IPMI session/OEM payloads are stateful and belong to a higher layer.
|
|
31
|
+
this.demuxProducers = [];
|
|
32
|
+
}
|
|
33
|
+
static #schemaCache;
|
|
34
|
+
get SCHEMA() {
|
|
35
|
+
return (RMCP.#schemaCache ??= RMCP.#buildSchema());
|
|
36
|
+
}
|
|
37
|
+
/** The payload length bounded by the UDP datagram (so a retained FCS/padding is not absorbed). */
|
|
38
|
+
#payloadLength() {
|
|
39
|
+
let available = this.packet.length - this.startPos;
|
|
40
|
+
if (this.prevCodecModule && this.prevCodecModule.id === 'udp') {
|
|
41
|
+
const udpLength = this.prevCodecModule.instance.length.getValue(0);
|
|
42
|
+
if (udpLength >= 8 && udpLength - 8 < available)
|
|
43
|
+
available = udpLength - 8;
|
|
44
|
+
}
|
|
45
|
+
return available < 0 ? 0 : available;
|
|
46
|
+
}
|
|
47
|
+
static #buildSchema() {
|
|
48
|
+
return {
|
|
49
|
+
type: 'object',
|
|
50
|
+
summary: 'RMCP class=${messageClass.class} seq=${sequence}',
|
|
51
|
+
properties: {
|
|
52
|
+
version: this.fieldUInt('version', 0, 1, 'Version'),
|
|
53
|
+
reserved: this.fieldHex('reserved', 1, 1, 'Reserved'),
|
|
54
|
+
sequence: this.fieldUInt('sequence', 2, 1, 'Sequence Number'),
|
|
55
|
+
//Class-of-Message byte (ASF DSP0136 / IPMI, MSB first): bit 7 = ACK flag, bits 6:5 =
|
|
56
|
+
//reserved (2 bits, kept for byte-perfect), bits 4:0 = message class (6 = ASF, 7 = IPMI,
|
|
57
|
+
//8 = OEM). readBits' bitOffset 0 = MSB, so ACK is bitOffset 0, reserved 1..2, class 3..7.
|
|
58
|
+
messageClass: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
label: 'Class of Message',
|
|
61
|
+
properties: {
|
|
62
|
+
ack: {
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
label: 'ACK',
|
|
65
|
+
decode: function () { this.instance.messageClass.ack.setValue(!!this.readBits(3, 1, 0, 1)); },
|
|
66
|
+
encode: function () {
|
|
67
|
+
const ack = !!this.instance.messageClass.ack.getValue();
|
|
68
|
+
this.instance.messageClass.ack.setValue(ack);
|
|
69
|
+
this.writeBits(3, 1, 0, 1, ack ? 1 : 0);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
reserved: {
|
|
73
|
+
type: 'integer',
|
|
74
|
+
label: 'Reserved',
|
|
75
|
+
minimum: 0,
|
|
76
|
+
maximum: 3,
|
|
77
|
+
hidden: true,
|
|
78
|
+
decode: function () { this.instance.messageClass.reserved.setValue(this.readBits(3, 1, 1, 2)); },
|
|
79
|
+
encode: function () { this.writeBits(3, 1, 1, 2, this.instance.messageClass.reserved.getValue(0)); }
|
|
80
|
+
},
|
|
81
|
+
class: {
|
|
82
|
+
type: 'integer',
|
|
83
|
+
label: 'Message Class',
|
|
84
|
+
minimum: 0,
|
|
85
|
+
maximum: 31,
|
|
86
|
+
decode: function () { this.instance.messageClass.class.setValue(this.readBits(3, 1, 3, 5)); },
|
|
87
|
+
encode: function () { this.writeBits(3, 1, 3, 5, this.instance.messageClass.class.getValue(0)); }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
//Class-driven payload: an ASF message (class 6) is decoded structurally; every other class
|
|
92
|
+
//(IPMI session, OEM) is kept verbatim. Runs after messageClass so the class is known.
|
|
93
|
+
asf: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
label: 'ASF Message',
|
|
96
|
+
properties: {
|
|
97
|
+
enterprise: { type: 'integer', label: 'IANA Enterprise Number', minimum: 0, maximum: 4294967295 },
|
|
98
|
+
type: { type: 'integer', label: 'Message Type', minimum: 0, maximum: 255 },
|
|
99
|
+
tag: { type: 'integer', label: 'Message Tag', minimum: 0, maximum: 255 },
|
|
100
|
+
reserved: { type: 'string', label: 'Reserved', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX },
|
|
101
|
+
dataLength: { type: 'integer', label: 'Data Length', minimum: 0, maximum: 255 },
|
|
102
|
+
data: { type: 'string', label: 'Data', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
103
|
+
},
|
|
104
|
+
decode: function () {
|
|
105
|
+
const available = this.#payloadLength();
|
|
106
|
+
const classValue = this.instance.messageClass.class.getValue(0);
|
|
107
|
+
//ASF class with a full 8-byte ASF header present (enterprise+type+tag+reserved+len).
|
|
108
|
+
if (classValue === 6 && available >= 12) {
|
|
109
|
+
this.instance.asf.enterprise.setValue((0, BufferToNumber_1.BufferToUInt32)(this.readBytes(4, 4)));
|
|
110
|
+
this.instance.asf.type.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(8, 1)));
|
|
111
|
+
this.instance.asf.tag.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(9, 1)));
|
|
112
|
+
this.instance.asf.reserved.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(10, 1)));
|
|
113
|
+
this.instance.asf.dataLength.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(11, 1)));
|
|
114
|
+
this.instance.asf.data.setValue(available > 12 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(12, available - 12)) : '');
|
|
115
|
+
this.instance.rawBody.setValue('');
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
//IPMI / OEM / a too-short ASF frame: keep the payload verbatim.
|
|
119
|
+
this.instance.rawBody.setValue(available > 4 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(4, available - 4)) : '');
|
|
120
|
+
},
|
|
121
|
+
encode: function () {
|
|
122
|
+
//A verbatim body (IPMI/OEM, or a short-ASF fallback) is re-emitted as-is and wins.
|
|
123
|
+
const rawBody = this.instance.rawBody.getValue('');
|
|
124
|
+
if (rawBody) {
|
|
125
|
+
this.writeBytes(4, (0, HexToBuffer_1.HexToBuffer)(rawBody));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
//Only emit an ASF header when one was actually decoded/provided (the mandatory
|
|
129
|
+
//Enterprise Number is present). A bare 4-byte class-6 payload (e.g. an ASF-class
|
|
130
|
+
//RMCP ACK: 06 00 seq 86) has no ASF message and must NOT gain phantom bytes.
|
|
131
|
+
const classValue = this.instance.messageClass.class.getValue(0);
|
|
132
|
+
const enterprise = this.instance.asf.enterprise.getValue();
|
|
133
|
+
if (classValue !== 6 || enterprise === undefined || enterprise === null)
|
|
134
|
+
return;
|
|
135
|
+
this.writeBytes(4, (0, NumberToBuffer_1.UInt32ToBuffer)(enterprise));
|
|
136
|
+
this.writeBytes(8, (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.asf.type.getValue(0)));
|
|
137
|
+
this.writeBytes(9, (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.asf.tag.getValue(0)));
|
|
138
|
+
this.writeBytes(10, (0, HexToBuffer_1.HexToBuffer)(this.instance.asf.reserved.getValue('00')));
|
|
139
|
+
this.writeBytes(11, (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.asf.dataLength.getValue(0)));
|
|
140
|
+
const data = this.instance.asf.data.getValue('');
|
|
141
|
+
if (data)
|
|
142
|
+
this.writeBytes(12, (0, HexToBuffer_1.HexToBuffer)(data));
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
rawBody: { type: 'string', label: 'Body', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true }
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
match() {
|
|
150
|
+
//Require the 4-byte RMCP header within the UDP payload (a shorter datagram on port 623 is not
|
|
151
|
+
//an RMCP message and must fall through to raw rather than claim an un-decodable layer).
|
|
152
|
+
return !!this.prevCodecModule && this.prevCodecModule.id === 'udp' && this.#payloadLength() >= 4;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.RMCP = RMCP;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* RSVP — Resource ReSerVation Protocol (RFC 2205), carried directly over IP as protocol 46. Every RSVP
|
|
6
|
+
* message opens with an 8-byte common header: a byte splitting Version (high 4 bits, 1 for RFC 2205) and
|
|
7
|
+
* Flags (low 4 bits), a Message Type (1 Path, 2 Resv, 3 PathErr, 4 ResvErr, 5 PathTear, 6 ResvTear, 7
|
|
8
|
+
* ResvConf), a 2-byte RSVP Checksum, a 1-byte Send_TTL, a 1-byte Reserved, and a 2-byte RSVP Length (the
|
|
9
|
+
* whole message octet count including this common header). The header is followed by a sequence of
|
|
10
|
+
* objects, each a 2-byte Length (the object octet count including its own 4-byte header) + 1-byte
|
|
11
|
+
* Class-Num + 1-byte C-Type + contents.
|
|
12
|
+
*
|
|
13
|
+
* The object contents are class/C-Type specific and several (SESSION, SENDER_TSPEC, FLOWSPEC, …) need
|
|
14
|
+
* cross-object and policy context, so this codec keeps each object's contents verbatim as `data` hex
|
|
15
|
+
* (byte-perfect) and does not sub-decode them. The RSVP Length is honored verbatim when supplied on
|
|
16
|
+
* encode (a crafted message may lie) and derived from the objects otherwise; each object's Length is
|
|
17
|
+
* likewise honored-else-derived. The Checksum is honored verbatim, never recomputed. Object walking is
|
|
18
|
+
* doubly bounded — by the RSVP Length field and by the bytes the IP layer actually made available — so a
|
|
19
|
+
* lying length can't read past the datagram, and trailing / pipelined bytes are left to the codec's
|
|
20
|
+
* recursion / RawData. A well-formed message round-trips byte-for-byte.
|
|
21
|
+
*/
|
|
22
|
+
export declare class RSVP extends BaseHeader {
|
|
23
|
+
#private;
|
|
24
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly nickname: string;
|
|
28
|
+
readonly matchKeys: string[];
|
|
29
|
+
match(): boolean;
|
|
30
|
+
readonly demuxProducers: DemuxProducer[];
|
|
31
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RSVP = 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
|
+
* RSVP — Resource ReSerVation Protocol (RFC 2205), carried directly over IP as protocol 46. Every RSVP
|
|
12
|
+
* message opens with an 8-byte common header: a byte splitting Version (high 4 bits, 1 for RFC 2205) and
|
|
13
|
+
* Flags (low 4 bits), a Message Type (1 Path, 2 Resv, 3 PathErr, 4 ResvErr, 5 PathTear, 6 ResvTear, 7
|
|
14
|
+
* ResvConf), a 2-byte RSVP Checksum, a 1-byte Send_TTL, a 1-byte Reserved, and a 2-byte RSVP Length (the
|
|
15
|
+
* whole message octet count including this common header). The header is followed by a sequence of
|
|
16
|
+
* objects, each a 2-byte Length (the object octet count including its own 4-byte header) + 1-byte
|
|
17
|
+
* Class-Num + 1-byte C-Type + contents.
|
|
18
|
+
*
|
|
19
|
+
* The object contents are class/C-Type specific and several (SESSION, SENDER_TSPEC, FLOWSPEC, …) need
|
|
20
|
+
* cross-object and policy context, so this codec keeps each object's contents verbatim as `data` hex
|
|
21
|
+
* (byte-perfect) and does not sub-decode them. The RSVP Length is honored verbatim when supplied on
|
|
22
|
+
* encode (a crafted message may lie) and derived from the objects otherwise; each object's Length is
|
|
23
|
+
* likewise honored-else-derived. The Checksum is honored verbatim, never recomputed. Object walking is
|
|
24
|
+
* doubly bounded — by the RSVP Length field and by the bytes the IP layer actually made available — so a
|
|
25
|
+
* lying length can't read past the datagram, and trailing / pipelined bytes are left to the codec's
|
|
26
|
+
* recursion / RawData. A well-formed message round-trips byte-for-byte.
|
|
27
|
+
*/
|
|
28
|
+
class RSVP extends BaseHeader_1.BaseHeader {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.id = 'rsvp';
|
|
32
|
+
this.name = 'Resource ReSerVation Protocol';
|
|
33
|
+
this.nickname = 'RSVP';
|
|
34
|
+
this.matchKeys = ['ipproto:46'];
|
|
35
|
+
//A leaf header — object contents require per-class, policy-dependent parsing.
|
|
36
|
+
this.demuxProducers = [];
|
|
37
|
+
}
|
|
38
|
+
static #schemaCache;
|
|
39
|
+
get SCHEMA() {
|
|
40
|
+
return (RSVP.#schemaCache ??= RSVP.#buildSchema());
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Bytes of RSVP the IP layer below says are available. IPv4 carries a total-length field, so the
|
|
44
|
+
* RSVP payload is (total length - IP header length); IPv6 carries the payload length directly (plen).
|
|
45
|
+
* Mirrors the OSPF/GRE #available() pattern so object walking is bounded by the real on-wire length
|
|
46
|
+
* rather than trusting the RSVP Length field alone (which a malformed packet may overstate). Falls
|
|
47
|
+
* back to the captured bytes after this header when neither IP length is present.
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
#available() {
|
|
51
|
+
let available = this.packet.length - this.startPos;
|
|
52
|
+
const prev = this.prevCodecModule;
|
|
53
|
+
if (prev && prev.id === 'ipv4') {
|
|
54
|
+
const ipPayload = prev.instance.length.getValue(0) - prev.length;
|
|
55
|
+
if (ipPayload >= 0 && ipPayload < available)
|
|
56
|
+
available = ipPayload;
|
|
57
|
+
}
|
|
58
|
+
else if (prev && prev.id === 'ipv6') {
|
|
59
|
+
const ipPayload = prev.instance.plen.getValue(0);
|
|
60
|
+
if (ipPayload >= 0 && ipPayload < available)
|
|
61
|
+
available = ipPayload;
|
|
62
|
+
}
|
|
63
|
+
return available < 0 ? 0 : available;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Header-relative end offset of the RSVP message: the RSVP Length field, clamped down to the bytes
|
|
67
|
+
* the IP layer actually made available (#available), and never below the 8-byte common header. Object
|
|
68
|
+
* walking is bounded by this so a corrupt Length can't read past the IP payload, and any bytes beyond
|
|
69
|
+
* it (padding / a pipelined message) fall through to the codec's recursion / RawData.
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
#messageEnd() {
|
|
73
|
+
let end = this.instance.length.getValue(0);
|
|
74
|
+
const available = this.#available();
|
|
75
|
+
if (available && available < end)
|
|
76
|
+
end = available;
|
|
77
|
+
if (!end || end < 8)
|
|
78
|
+
end = 8;
|
|
79
|
+
if (available && end > available)
|
|
80
|
+
end = available;
|
|
81
|
+
return end;
|
|
82
|
+
}
|
|
83
|
+
/** Effective on-wire byte length of one object: its Length field when supplied, else 4 + its data. */
|
|
84
|
+
static #objectLength(object) {
|
|
85
|
+
const provided = Number(object && object.length);
|
|
86
|
+
if (Number.isFinite(provided) && provided > 0)
|
|
87
|
+
return provided;
|
|
88
|
+
const data = object && object.data ? String(object.data) : '';
|
|
89
|
+
return 4 + (0, HexToBuffer_1.HexToBuffer)(data).length;
|
|
90
|
+
}
|
|
91
|
+
static #buildSchema() {
|
|
92
|
+
return {
|
|
93
|
+
type: 'object',
|
|
94
|
+
summary: 'RSVP msgType=${msgType} len=${length}',
|
|
95
|
+
properties: {
|
|
96
|
+
//==== Common header (8 bytes, RFC 2205 §3.1.1) ====
|
|
97
|
+
//Byte 0 high nibble: Version (1 for RFC 2205). Read/written as its own bit field so the
|
|
98
|
+
//Flags nibble below is preserved (writeBits is read-modify-write).
|
|
99
|
+
version: {
|
|
100
|
+
type: 'integer',
|
|
101
|
+
label: 'Version',
|
|
102
|
+
minimum: 0,
|
|
103
|
+
maximum: 15,
|
|
104
|
+
decode: function () {
|
|
105
|
+
this.instance.version.setValue(this.readBits(0, 1, 0, 4));
|
|
106
|
+
},
|
|
107
|
+
encode: function () {
|
|
108
|
+
const value = this.instance.version.getValue(1);
|
|
109
|
+
this.instance.version.setValue(value);
|
|
110
|
+
this.writeBits(0, 1, 0, 4, value);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
//Byte 0 low nibble: Flags. Reserved bits are kept verbatim so a non-canonical frame still
|
|
114
|
+
//round-trips byte-for-byte.
|
|
115
|
+
flags: {
|
|
116
|
+
type: 'integer',
|
|
117
|
+
label: 'Flags',
|
|
118
|
+
minimum: 0,
|
|
119
|
+
maximum: 15,
|
|
120
|
+
decode: function () {
|
|
121
|
+
this.instance.flags.setValue(this.readBits(0, 1, 4, 4));
|
|
122
|
+
},
|
|
123
|
+
encode: function () {
|
|
124
|
+
const value = this.instance.flags.getValue(0);
|
|
125
|
+
this.instance.flags.setValue(value);
|
|
126
|
+
this.writeBits(0, 1, 4, 4, value);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
msgType: this.fieldUInt('msgType', 1, 1, 'Message Type'),
|
|
130
|
+
//Honored verbatim: the RSVP checksum (ones-complement over the message) is never
|
|
131
|
+
//recomputed, so a captured message round-trips byte-for-byte. A zero value means no
|
|
132
|
+
//checksum was transmitted (RFC 2205 §3.1.1).
|
|
133
|
+
checksum: this.fieldUInt('checksum', 2, 2, 'Checksum'),
|
|
134
|
+
sendTTL: this.fieldUInt('sendTTL', 4, 1, 'Send TTL'),
|
|
135
|
+
//Reserved byte — kept verbatim and re-emitted for byte-perfect.
|
|
136
|
+
reserved: this.fieldUInt('reserved', 5, 1, 'Reserved'),
|
|
137
|
+
length: {
|
|
138
|
+
type: 'integer',
|
|
139
|
+
label: 'Length',
|
|
140
|
+
minimum: 8,
|
|
141
|
+
maximum: 65535,
|
|
142
|
+
decode: function () {
|
|
143
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(6, 2)));
|
|
144
|
+
},
|
|
145
|
+
encode: function () {
|
|
146
|
+
//RSVP Length counts the whole message = 8-byte common header + all objects. Honored
|
|
147
|
+
//when supplied (a crafted message may lie); else derived from the objects.
|
|
148
|
+
const provided = this.instance.length.getValue();
|
|
149
|
+
let value;
|
|
150
|
+
if (provided !== undefined && provided !== null) {
|
|
151
|
+
value = provided;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const objects = this.instance.objects.getValue();
|
|
155
|
+
let total = 8;
|
|
156
|
+
if (Array.isArray(objects)) {
|
|
157
|
+
for (const object of objects)
|
|
158
|
+
total += RSVP.#objectLength(object);
|
|
159
|
+
}
|
|
160
|
+
value = total;
|
|
161
|
+
}
|
|
162
|
+
if (value > 65535) {
|
|
163
|
+
this.recordError(this.instance.length.getPath(), 'Maximum value is 65535');
|
|
164
|
+
value = 65535;
|
|
165
|
+
}
|
|
166
|
+
if (value < 8)
|
|
167
|
+
value = 8;
|
|
168
|
+
this.instance.length.setValue(value);
|
|
169
|
+
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
//==== Objects (RFC 2205 §3.1.2) ====
|
|
173
|
+
//Each object: Length(2) + Class-Num(1) + C-Type(1) + contents. Contents kept verbatim as
|
|
174
|
+
//`data` hex (byte-perfect); class/C-Type specific parsing is deliberately not attempted.
|
|
175
|
+
//Walking is bounded by #messageEnd (RSVP Length ∧ IP payload), so a lying object Length
|
|
176
|
+
//can't run past the datagram and trailing bytes are left to the codec.
|
|
177
|
+
objects: {
|
|
178
|
+
type: 'array',
|
|
179
|
+
label: 'Objects',
|
|
180
|
+
items: {
|
|
181
|
+
type: 'object',
|
|
182
|
+
properties: {
|
|
183
|
+
length: { type: 'integer', label: 'Length', minimum: 0, maximum: 65535 },
|
|
184
|
+
classNum: { type: 'integer', label: 'Class-Num', minimum: 0, maximum: 255 },
|
|
185
|
+
cType: { type: 'integer', label: 'C-Type', minimum: 0, maximum: 255 },
|
|
186
|
+
data: { type: 'string', label: 'Data', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
decode: function () {
|
|
190
|
+
const end = this.#messageEnd();
|
|
191
|
+
const objects = [];
|
|
192
|
+
let offset = 8;
|
|
193
|
+
//Each object needs at least its own 4-byte header within the message.
|
|
194
|
+
while (offset + 4 <= end) {
|
|
195
|
+
const objectLength = (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(offset, 2, true));
|
|
196
|
+
const classNum = this.readBytes(offset + 2, 1, true)[0];
|
|
197
|
+
const cType = this.readBytes(offset + 3, 1, true)[0];
|
|
198
|
+
//A Length below the 4-byte header is malformed and would stall the walk —
|
|
199
|
+
//record it and stop (decode never throws).
|
|
200
|
+
if (objectLength < 4) {
|
|
201
|
+
this.recordError(this.instance.objects.getPath(), `Invalid object length ${objectLength}`);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
//Contents run to the object's Length but never past the message end.
|
|
205
|
+
let dataEnd = offset + objectLength;
|
|
206
|
+
if (dataEnd > end)
|
|
207
|
+
dataEnd = end;
|
|
208
|
+
const dataStart = offset + 4;
|
|
209
|
+
const data = dataEnd > dataStart ? (0, BufferToHex_1.BufferToHex)(this.readBytes(dataStart, dataEnd - dataStart)) : '';
|
|
210
|
+
objects.push({ length: objectLength, classNum: classNum, cType: cType, data: data });
|
|
211
|
+
offset += objectLength;
|
|
212
|
+
}
|
|
213
|
+
//The object header bytes are peeked dryRun (so a malformed-length break leaves
|
|
214
|
+
//them to trailing RawData), and an empty object (Length 4, no contents) does no
|
|
215
|
+
//non-dry data read of its own. Mark the whole consumed object region with one
|
|
216
|
+
//non-dry read so headerLength covers every byte the walk captured — otherwise an
|
|
217
|
+
//empty trailing object is re-decoded as trailing RawData and duplicated on encode.
|
|
218
|
+
const consumedEnd = offset < end ? offset : end;
|
|
219
|
+
if (consumedEnd > 8)
|
|
220
|
+
this.readBytes(8, consumedEnd - 8);
|
|
221
|
+
this.instance.objects.setValue(objects);
|
|
222
|
+
},
|
|
223
|
+
encode: function () {
|
|
224
|
+
const objects = this.instance.objects.getValue();
|
|
225
|
+
if (!Array.isArray(objects))
|
|
226
|
+
return;
|
|
227
|
+
let offset = 8;
|
|
228
|
+
for (const object of objects) {
|
|
229
|
+
const dataBuffer = (0, HexToBuffer_1.HexToBuffer)(object && object.data ? String(object.data) : '');
|
|
230
|
+
//Object Length honored when supplied (may lie), else derived from contents.
|
|
231
|
+
const providedLength = Number(object && object.length);
|
|
232
|
+
const lengthValue = (Number.isFinite(providedLength) && providedLength > 0)
|
|
233
|
+
? providedLength
|
|
234
|
+
: 4 + dataBuffer.length;
|
|
235
|
+
const classNum = Number(object && object.classNum) || 0;
|
|
236
|
+
const cType = Number(object && object.cType) || 0;
|
|
237
|
+
this.writeBytes(offset, (0, NumberToBuffer_1.UInt16ToBuffer)(lengthValue > 65535 ? 65535 : lengthValue));
|
|
238
|
+
this.writeBytes(offset + 2, Buffer.from([classNum & 0xff, cType & 0xff]));
|
|
239
|
+
if (dataBuffer.length)
|
|
240
|
+
this.writeBytes(offset + 4, dataBuffer);
|
|
241
|
+
//Physical layout always advances by the actual bytes written (4 + contents),
|
|
242
|
+
//independent of a lying Length field — mirrors BGP's honor-else-derive body.
|
|
243
|
+
offset += 4 + dataBuffer.length;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
match() {
|
|
251
|
+
if (!this.prevCodecModule)
|
|
252
|
+
return false;
|
|
253
|
+
//RSVP sits directly on IP (protocol 46). Accept the demux value from either the IPv4 protocol
|
|
254
|
+
//field or the IPv6 next-header field, and require at least the full 8-byte common header of IP
|
|
255
|
+
//payload to be present.
|
|
256
|
+
const protocol = this.prevCodecModule.instance.protocol.getValue(0);
|
|
257
|
+
const nextHeader = this.prevCodecModule.instance.nxt.getValue(0);
|
|
258
|
+
if (protocol !== 46 && nextHeader !== 46)
|
|
259
|
+
return false;
|
|
260
|
+
return this.#available() >= 8;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.RSVP = RSVP;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* RTCP — RTP Control Protocol (RFC 3550 §6), the companion control channel to RTP. Rides UDP on
|
|
6
|
+
* dynamically negotiated ports (classically the RTP media port + 1, or multiplexed onto the media port
|
|
7
|
+
* with rtcp-mux, RFC 5761), so there is no fixed well-known port; a small set of common defaults is
|
|
8
|
+
* declared as matchKeys and selection stays strictly port-bucketed (see match()).
|
|
9
|
+
*
|
|
10
|
+
* Every RTCP packet begins with a 4-byte common header — Version (2 bits, always 2), Padding (1 bit),
|
|
11
|
+
* a 5-bit count whose meaning is packet-type-specific (Reception Report Count for SR/RR, Source Count
|
|
12
|
+
* for SDES/BYE), an 8-bit Packet Type (200 SR, 201 RR, 202 SDES, 203 BYE, 204 APP, 205 RTPFB, 206
|
|
13
|
+
* PSFB, 207 XR) and a 16-bit Length in 32-bit words minus one (RFC 3550 §6.4.1) — and, for the
|
|
14
|
+
* report-bearing types, an SSRC of the sender. RTCP packets are transmitted as COMPOUND packets:
|
|
15
|
+
* several stacked back-to-back in a single UDP datagram (RFC 3550 §6.1).
|
|
16
|
+
*
|
|
17
|
+
* This minimal codec structures the FIRST packet's common header (version/padding/count/packetType/
|
|
18
|
+
* length) plus its SSRC, then keeps that first packet's remaining body verbatim as `body` hex (bounded
|
|
19
|
+
* by the Length field — packet-type-specific decoding of SR sender info / report blocks / SDES chunks
|
|
20
|
+
* is a later enrichment), and keeps any further compound packets verbatim as `rest` hex (bounded by
|
|
21
|
+
* the UDP payload). The Length is honored when supplied (a crafted packet may lie) else derived from
|
|
22
|
+
* the body; every field is width-clamped so a decoded value always re-encodes. A well-formed datagram
|
|
23
|
+
* round-trips byte-for-byte.
|
|
24
|
+
*/
|
|
25
|
+
export declare class RTCP extends BaseHeader {
|
|
26
|
+
#private;
|
|
27
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly nickname: string;
|
|
31
|
+
readonly matchKeys: string[];
|
|
32
|
+
match(): boolean;
|
|
33
|
+
readonly demuxProducers: DemuxProducer[];
|
|
34
|
+
}
|