@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,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OPCUA = 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
|
+
/** The eight OPC UA TCP message types (IEC 62541-6). A valid message begins with one of these. */
|
|
9
|
+
const OPCUA_MESSAGE_TYPES = ['HEL', 'ACK', 'ERR', 'OPN', 'MSG', 'CLO', 'RHE', 'RHF'];
|
|
10
|
+
/** The IsFinal / chunk indicator: F (final), C (intermediate chunk), A (abort). */
|
|
11
|
+
const OPCUA_CHUNK_TYPES = ['F', 'C', 'A'];
|
|
12
|
+
/**
|
|
13
|
+
* OPC UA Connection Protocol — the OPC UA TCP transport mapping (IEC 62541-6), TCP port 4840. Every OPC
|
|
14
|
+
* UA TCP message is framed by a fixed 8-byte header: a 3-byte ASCII MessageType (HEL/ACK/ERR/OPN/MSG/
|
|
15
|
+
* CLO/RHE/RHF), a 1-byte ASCII Chunk/IsFinal indicator (F final, C intermediate chunk, A abort), and a
|
|
16
|
+
* LITTLE-ENDIAN uint32 MessageSize that counts the WHOLE message including the 8-byte header. The header
|
|
17
|
+
* is followed by MessageSize − 8 bytes of message body.
|
|
18
|
+
*
|
|
19
|
+
* ⚠️ MessageSize is LITTLE-ENDIAN (the only multi-byte field in this header), and there is no
|
|
20
|
+
* little-endian helper in this codebase, so it is read/written byte-by-byte in its closure. The `| ... <<`
|
|
21
|
+
* expression yields a signed int32, so `>>> 0` is applied to the whole expression to keep a MessageSize
|
|
22
|
+
* with the high bit set unsigned. MessageType/Chunk are ASCII text kept as strings.
|
|
23
|
+
*
|
|
24
|
+
* The body is message-type-dependent (HEL/ACK carry a protocol version + buffer sizes + endpoint URL;
|
|
25
|
+
* OPN/MSG/CLO carry a SecureChannelId + security/sequence headers + an encoded body), and much of it is
|
|
26
|
+
* cross-message / security-context state. So this single-message codec keeps the body verbatim as `body`
|
|
27
|
+
* hex (byte-perfect), bounded by MessageSize (the body ends at offset MessageSize, clamped to the
|
|
28
|
+
* captured bytes) so a pipelined/trailing message is left to the codec's recursion / RawData. The
|
|
29
|
+
* MessageSize is honored when supplied (a crafted message may lie), else derived as 8 + body bytes. A
|
|
30
|
+
* well-formed message round-trips byte-for-byte. Structuring the per-message-type body is a later slice.
|
|
31
|
+
*/
|
|
32
|
+
class OPCUA extends BaseHeader_1.BaseHeader {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.id = 'opcua';
|
|
36
|
+
this.name = 'OPC UA Connection Protocol';
|
|
37
|
+
this.nickname = 'OPC UA';
|
|
38
|
+
this.matchKeys = ['tcpport:4840'];
|
|
39
|
+
//A leaf header — the per-message-type body requires message-dependent, cross-message parsing.
|
|
40
|
+
this.demuxProducers = [];
|
|
41
|
+
}
|
|
42
|
+
static #schemaCache;
|
|
43
|
+
get SCHEMA() {
|
|
44
|
+
return (OPCUA.#schemaCache ??= OPCUA.#buildSchema());
|
|
45
|
+
}
|
|
46
|
+
static #buildSchema() {
|
|
47
|
+
return {
|
|
48
|
+
type: 'object',
|
|
49
|
+
summary: 'OPC UA ${messageType}',
|
|
50
|
+
properties: {
|
|
51
|
+
//3-byte ASCII message type (HEL/ACK/ERR/OPN/MSG/CLO/RHE/RHF). Kept as a string; encode
|
|
52
|
+
//writes exactly 3 bytes (a decoded value is always 3 chars; a crafted value is truncated
|
|
53
|
+
//or zero-padded to 3) so a well-formed message round-trips byte-for-byte.
|
|
54
|
+
messageType: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
label: 'Message Type',
|
|
57
|
+
minLength: 3,
|
|
58
|
+
maxLength: 3,
|
|
59
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.ASCII,
|
|
60
|
+
decode: function () {
|
|
61
|
+
this.instance.messageType.setValue(this.readBytes(0, 3).toString('latin1'));
|
|
62
|
+
},
|
|
63
|
+
encode: function () {
|
|
64
|
+
const node = this.instance.messageType;
|
|
65
|
+
const value = node.getValue('', (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
66
|
+
node.setValue(value);
|
|
67
|
+
const buffer = Buffer.alloc(3);
|
|
68
|
+
Buffer.from(value, 'latin1').copy(buffer, 0, 0, 3);
|
|
69
|
+
this.writeBytes(0, buffer);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
//1-byte ASCII chunk / IsFinal indicator (F/C/A). Kept as a string; encode writes exactly
|
|
73
|
+
//1 byte.
|
|
74
|
+
chunk: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
label: 'Chunk',
|
|
77
|
+
minLength: 1,
|
|
78
|
+
maxLength: 1,
|
|
79
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.ASCII,
|
|
80
|
+
decode: function () {
|
|
81
|
+
this.instance.chunk.setValue(this.readBytes(3, 1).toString('latin1'));
|
|
82
|
+
},
|
|
83
|
+
encode: function () {
|
|
84
|
+
const node = this.instance.chunk;
|
|
85
|
+
const value = node.getValue('', (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
86
|
+
node.setValue(value);
|
|
87
|
+
const buffer = Buffer.alloc(1);
|
|
88
|
+
Buffer.from(value, 'latin1').copy(buffer, 0, 0, 1);
|
|
89
|
+
this.writeBytes(3, buffer);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
//LITTLE-ENDIAN uint32: the total message length INCLUDING the 8-byte header. Honored when
|
|
93
|
+
//supplied (a crafted message may lie); else derived as 8 + body bytes.
|
|
94
|
+
messageSize: {
|
|
95
|
+
type: 'integer',
|
|
96
|
+
label: 'Message Size',
|
|
97
|
+
minimum: 0,
|
|
98
|
+
maximum: 4294967295,
|
|
99
|
+
decode: function () {
|
|
100
|
+
const b = this.readBytes(4, 4);
|
|
101
|
+
//`|` yields a signed int32, so apply `>>> 0` to the WHOLE expression to get an
|
|
102
|
+
//unsigned 32-bit value — otherwise a size with the high bit set decodes negative.
|
|
103
|
+
this.instance.messageSize.setValue((b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)) >>> 0);
|
|
104
|
+
},
|
|
105
|
+
encode: function () {
|
|
106
|
+
const provided = this.instance.messageSize.getValue();
|
|
107
|
+
let value = (provided !== undefined && provided !== null)
|
|
108
|
+
? provided
|
|
109
|
+
: 8 + (0, HexToBuffer_1.HexToBuffer)(this.instance.body.getValue('')).length;
|
|
110
|
+
if (value > 4294967295) {
|
|
111
|
+
this.recordError(this.instance.messageSize.getPath(), 'Maximum value is 4294967295');
|
|
112
|
+
value = 4294967295;
|
|
113
|
+
}
|
|
114
|
+
if (value < 0) {
|
|
115
|
+
this.recordError(this.instance.messageSize.getPath(), 'Minimum value is 0');
|
|
116
|
+
value = 0;
|
|
117
|
+
}
|
|
118
|
+
this.instance.messageSize.setValue(value);
|
|
119
|
+
this.writeBytes(4, Buffer.from([value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, (value >>> 24) & 0xff]));
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
//The message body after the 8-byte header, kept verbatim. Bounded by MessageSize (the body
|
|
123
|
+
//ends at offset MessageSize) and the captured bytes, so trailing/pipelined data is left to
|
|
124
|
+
//the codec's recursion / RawData.
|
|
125
|
+
body: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
label: 'Body',
|
|
128
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
129
|
+
decode: function () {
|
|
130
|
+
const remaining = this.packet.length - this.startPos;
|
|
131
|
+
const size = this.instance.messageSize.getValue(0);
|
|
132
|
+
let end = size;
|
|
133
|
+
if (end < 8)
|
|
134
|
+
end = 8;
|
|
135
|
+
if (end > remaining)
|
|
136
|
+
end = remaining;
|
|
137
|
+
this.instance.body.setValue(end > 8 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(8, end - 8)) : '');
|
|
138
|
+
},
|
|
139
|
+
encode: function () {
|
|
140
|
+
const body = this.instance.body.getValue('');
|
|
141
|
+
if (body)
|
|
142
|
+
this.writeBytes(8, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
match() {
|
|
149
|
+
//OPC UA TCP rides on TCP port 4840. Beyond the port bucket, require the content signature: a
|
|
150
|
+
//valid 3-char message type plus a valid 1-char chunk indicator — enough to separate OPC UA from
|
|
151
|
+
//arbitrary port-4840 traffic. No heuristicFallback: 3+1 ASCII chars is a weaker signature than a
|
|
152
|
+
//magic cookie, so this stays a port-bucket protocol (unlike STUN, whose Magic Cookie is strong
|
|
153
|
+
//enough for any-port recognition).
|
|
154
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'tcp')
|
|
155
|
+
return false;
|
|
156
|
+
if (this.packet.length - this.startPos < 8)
|
|
157
|
+
return false;
|
|
158
|
+
const messageType = this.readBytes(0, 3, true).toString('latin1');
|
|
159
|
+
if (!OPCUA_MESSAGE_TYPES.includes(messageType))
|
|
160
|
+
return false;
|
|
161
|
+
const chunk = this.readBytes(3, 1, true).toString('latin1');
|
|
162
|
+
return OPCUA_CHUNK_TYPES.includes(chunk);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.OPCUA = OPCUA;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* OPC UA PubSub — UADP NetworkMessage (IEC 62541-14 / OPC 10000-14), UDP port 4840. A UADP
|
|
6
|
+
* NetworkMessage begins with a single UADPFlags octet: the low nibble is the UADPVersion (1 in the
|
|
7
|
+
* current spec) and the four high bits are enable flags — PublisherId (bit 4, 0x10), GroupHeader
|
|
8
|
+
* (bit 5, 0x20), PayloadHeader (bit 6, 0x40) and ExtendedFlags1 (bit 7, 0x80). What follows the
|
|
9
|
+
* UADPFlags octet is entirely conditional on those flags (and on the ExtendedFlags1 / ExtendedFlags2 /
|
|
10
|
+
* GroupHeader / PayloadHeader sub-flag chains): an optional ExtendedFlags1/2, a variable-length
|
|
11
|
+
* PublisherId whose width is chosen by ExtendedFlags1 bits 0..2, an optional DataSetClassId GUID, the
|
|
12
|
+
* GroupHeader, the PayloadHeader, Timestamp/PicoSeconds, promoted fields, the security header and
|
|
13
|
+
* finally the DataSetMessage payload(s) — all little-endian.
|
|
14
|
+
*
|
|
15
|
+
* That layout is too flag-dependent (and cross-message, for chunked/security cases) to slice safely in a
|
|
16
|
+
* single-message codec, so this header takes the deliberate minimal cut mandated by the design: it
|
|
17
|
+
* decomposes only the one always-present UADPFlags octet into its version + four enable bits (each bit
|
|
18
|
+
* of the octet is covered, so it round-trips byte-for-byte), and keeps everything after it verbatim as
|
|
19
|
+
* `body` hex. The body is bounded by the UDP payload length (so Ethernet padding on a short frame is not
|
|
20
|
+
* swallowed) and by the captured bytes, leaving any trailing bytes to the codec's recursion / RawData. A
|
|
21
|
+
* well-formed message round-trips byte-for-byte; per-field UADP dissection (PublisherId, GroupHeader,
|
|
22
|
+
* DataSetMessages, IEC 62541-14 §7.2) is a later enrichment layered on this faithful base.
|
|
23
|
+
*/
|
|
24
|
+
export declare class OPCUAPubSub extends BaseHeader {
|
|
25
|
+
#private;
|
|
26
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly nickname: string;
|
|
30
|
+
readonly matchKeys: string[];
|
|
31
|
+
match(): boolean;
|
|
32
|
+
readonly demuxProducers: DemuxProducer[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OPCUAPubSub = 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
|
+
* OPC UA PubSub — UADP NetworkMessage (IEC 62541-14 / OPC 10000-14), UDP port 4840. A UADP
|
|
10
|
+
* NetworkMessage begins with a single UADPFlags octet: the low nibble is the UADPVersion (1 in the
|
|
11
|
+
* current spec) and the four high bits are enable flags — PublisherId (bit 4, 0x10), GroupHeader
|
|
12
|
+
* (bit 5, 0x20), PayloadHeader (bit 6, 0x40) and ExtendedFlags1 (bit 7, 0x80). What follows the
|
|
13
|
+
* UADPFlags octet is entirely conditional on those flags (and on the ExtendedFlags1 / ExtendedFlags2 /
|
|
14
|
+
* GroupHeader / PayloadHeader sub-flag chains): an optional ExtendedFlags1/2, a variable-length
|
|
15
|
+
* PublisherId whose width is chosen by ExtendedFlags1 bits 0..2, an optional DataSetClassId GUID, the
|
|
16
|
+
* GroupHeader, the PayloadHeader, Timestamp/PicoSeconds, promoted fields, the security header and
|
|
17
|
+
* finally the DataSetMessage payload(s) — all little-endian.
|
|
18
|
+
*
|
|
19
|
+
* That layout is too flag-dependent (and cross-message, for chunked/security cases) to slice safely in a
|
|
20
|
+
* single-message codec, so this header takes the deliberate minimal cut mandated by the design: it
|
|
21
|
+
* decomposes only the one always-present UADPFlags octet into its version + four enable bits (each bit
|
|
22
|
+
* of the octet is covered, so it round-trips byte-for-byte), and keeps everything after it verbatim as
|
|
23
|
+
* `body` hex. The body is bounded by the UDP payload length (so Ethernet padding on a short frame is not
|
|
24
|
+
* swallowed) and by the captured bytes, leaving any trailing bytes to the codec's recursion / RawData. A
|
|
25
|
+
* well-formed message round-trips byte-for-byte; per-field UADP dissection (PublisherId, GroupHeader,
|
|
26
|
+
* DataSetMessages, IEC 62541-14 §7.2) is a later enrichment layered on this faithful base.
|
|
27
|
+
*/
|
|
28
|
+
class OPCUAPubSub extends BaseHeader_1.BaseHeader {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.id = 'opcua-pubsub';
|
|
32
|
+
this.name = 'OPC UA PubSub';
|
|
33
|
+
this.nickname = 'OPCUAPubSub';
|
|
34
|
+
this.matchKeys = ['udpport:4840'];
|
|
35
|
+
//A leaf header — the flag-conditional UADP body requires cross-field / cross-message parsing.
|
|
36
|
+
this.demuxProducers = [];
|
|
37
|
+
}
|
|
38
|
+
static #schemaCache;
|
|
39
|
+
get SCHEMA() {
|
|
40
|
+
return (OPCUAPubSub.#schemaCache ??= OPCUAPubSub.#buildSchema());
|
|
41
|
+
}
|
|
42
|
+
/** A single enable bit of the UADPFlags octet at byte 0 (MSB-first bitOffset; 0/1 value). */
|
|
43
|
+
static #fieldFlagBit(name, bitOffset, label) {
|
|
44
|
+
return {
|
|
45
|
+
type: 'integer',
|
|
46
|
+
label: label,
|
|
47
|
+
minimum: 0,
|
|
48
|
+
maximum: 1,
|
|
49
|
+
decode: function () {
|
|
50
|
+
this.instance[name].setValue(this.readBits(0, 1, bitOffset, 1));
|
|
51
|
+
},
|
|
52
|
+
encode: function () {
|
|
53
|
+
const node = this.instance[name];
|
|
54
|
+
//Line values are clamped in the closure (never rejected by Ajv) so any decoded value
|
|
55
|
+
//re-encodes; only bit 0 of the supplied value is written into the flag position.
|
|
56
|
+
let value = node.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
57
|
+
if (value < 0)
|
|
58
|
+
value = 0;
|
|
59
|
+
node.setValue(value & 1);
|
|
60
|
+
this.writeBits(0, 1, bitOffset, 1, value & 1);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static #buildSchema() {
|
|
65
|
+
return {
|
|
66
|
+
type: 'object',
|
|
67
|
+
summary: 'OPC UA PubSub UADP v${version}',
|
|
68
|
+
properties: {
|
|
69
|
+
//UADPFlags low nibble (bits 3..0): the UADPVersion, 1 in the current spec. Kept as a
|
|
70
|
+
//clamped uint (0..15) so a crafted/other version still round-trips rather than being
|
|
71
|
+
//rejected on re-encode.
|
|
72
|
+
version: {
|
|
73
|
+
type: 'integer',
|
|
74
|
+
label: 'UADP Version',
|
|
75
|
+
minimum: 0,
|
|
76
|
+
maximum: 15,
|
|
77
|
+
decode: function () {
|
|
78
|
+
this.instance.version.setValue(this.readBits(0, 1, 4, 4));
|
|
79
|
+
},
|
|
80
|
+
encode: function () {
|
|
81
|
+
let value = this.instance.version.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
82
|
+
if (value > 15) {
|
|
83
|
+
this.recordError(this.instance.version.getPath(), 'Maximum value is 15');
|
|
84
|
+
value = 15;
|
|
85
|
+
}
|
|
86
|
+
if (value < 0)
|
|
87
|
+
value = 0;
|
|
88
|
+
this.instance.version.setValue(value);
|
|
89
|
+
this.writeBits(0, 1, 4, 4, value);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
//The four UADPFlags enable bits (bits 4..7). Together with the version nibble they cover
|
|
93
|
+
//all 8 bits of the octet, so the UADPFlags byte is reproduced exactly.
|
|
94
|
+
publisherIdEnabled: this.#fieldFlagBit('publisherIdEnabled', 3, 'PublisherId Enabled'),
|
|
95
|
+
groupHeaderEnabled: this.#fieldFlagBit('groupHeaderEnabled', 2, 'GroupHeader Enabled'),
|
|
96
|
+
payloadHeaderEnabled: this.#fieldFlagBit('payloadHeaderEnabled', 1, 'PayloadHeader Enabled'),
|
|
97
|
+
extendedFlags1Enabled: this.#fieldFlagBit('extendedFlags1Enabled', 0, 'ExtendedFlags1 Enabled'),
|
|
98
|
+
//Everything after the UADPFlags octet, kept verbatim. Its layout is fully conditional on
|
|
99
|
+
//the flag chain and is not sliced here. Bounded by the UDP payload length (so trailing
|
|
100
|
+
//Ethernet padding on a short frame is not absorbed) and by the captured bytes.
|
|
101
|
+
body: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
label: 'Body',
|
|
104
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
105
|
+
decode: function () {
|
|
106
|
+
const available = this.#available();
|
|
107
|
+
this.instance.body.setValue(available > 1 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(1, available - 1)) : '');
|
|
108
|
+
},
|
|
109
|
+
encode: function () {
|
|
110
|
+
const body = this.instance.body.getValue('');
|
|
111
|
+
if (body)
|
|
112
|
+
this.writeBytes(1, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Bytes of UADP available in this message: the UDP payload (UDP total length minus the 8-byte UDP
|
|
120
|
+
* header, read from the layer below) clamped to the bytes actually captured. Bounding by the UDP
|
|
121
|
+
* length keeps a short-frame's Ethernet padding out of the body so the frame round-trips exactly.
|
|
122
|
+
*/
|
|
123
|
+
#available() {
|
|
124
|
+
const remaining = this.packet.length - this.startPos;
|
|
125
|
+
let available = remaining;
|
|
126
|
+
const prev = this.prevCodecModule;
|
|
127
|
+
if (prev && prev.id === 'udp') {
|
|
128
|
+
const udpTotalLength = prev.instance.length.getValue(0);
|
|
129
|
+
const payload = udpTotalLength - 8;
|
|
130
|
+
if (payload >= 0 && payload < available)
|
|
131
|
+
available = payload;
|
|
132
|
+
}
|
|
133
|
+
return available;
|
|
134
|
+
}
|
|
135
|
+
match() {
|
|
136
|
+
//OPC UA PubSub UADP rides on UDP port 4840 (opc.tcp binary is the TCP variant and is not this
|
|
137
|
+
//header). No strong content magic — the UADPFlags octet is only weakly distinctive — so the
|
|
138
|
+
//well-known UDP port is the signature. Require at least the single always-present UADPFlags octet.
|
|
139
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'udp')
|
|
140
|
+
return false;
|
|
141
|
+
return this.packet.length - this.startPos >= 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.OPCUAPubSub = OPCUAPubSub;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
2
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* OSPF — Open Shortest Path First (OSPFv2, RFC 2328), carried directly on IP as protocol 89. This codec
|
|
6
|
+
* decodes the 24-octet common header: an 8-bit Version (`version`, offset 0), an 8-bit Message Type
|
|
7
|
+
* (`type`, offset 1; 1 Hello, 2 Database Description, 3 LS Request, 4 LS Update, 5 LS Ack), a 16-bit
|
|
8
|
+
* Packet Length (`packetLength`, offset 2), the Source Router ID (`routerId`, IPv4, offset 4), the Area
|
|
9
|
+
* ID (`areaId`, IPv4, offset 8), a 16-bit Checksum (`checksum`, offset 12, honored verbatim and never
|
|
10
|
+
* recomputed so a captured packet round-trips), a 16-bit Auth Type (`auType`, offset 14) and the 8-octet
|
|
11
|
+
* Authentication field (`auth`, hex, offset 16).
|
|
12
|
+
*
|
|
13
|
+
* For a Hello (type 1) the body is decoded field-by-field: Network Mask (offset 24), 16-bit Hello Interval
|
|
14
|
+
* (offset 28), 8-bit Options (offset 30), 8-bit Router Priority (offset 31), 32-bit Router Dead Interval
|
|
15
|
+
* (offset 32), Designated and Backup Designated Routers (IPv4, offsets 36 and 40), then the Active
|
|
16
|
+
* Neighbors list (4-octet Router IDs from offset 44 onward). For all other types the payload is kept
|
|
17
|
+
* verbatim as `rawBody` hex from offset 24. Both are bounded by min(Packet Length, the bytes the IP layer
|
|
18
|
+
* below actually made available) and never below the 24-octet header, so a lying length field can't read
|
|
19
|
+
* past the real IP payload. match() fires on IPv4 protocol 89 or IPv6 Next Header 89 with a full common
|
|
20
|
+
* header present.
|
|
21
|
+
*/
|
|
22
|
+
export declare class OSPF extends BaseHeader {
|
|
23
|
+
#private;
|
|
24
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly matchKeys: string[];
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly nickname: string;
|
|
29
|
+
readonly demuxProducers: DemuxProducer[];
|
|
30
|
+
match(): boolean;
|
|
31
|
+
}
|