@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,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PPPoESession = 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
|
+
* PPPoE Session Stage (RFC 2516), carried directly in an Ethernet II frame with EtherType 0x8864 (an
|
|
12
|
+
* Ethernet child — no IP/UDP). The 6-byte PPPoE header is a byte holding Version (high 4 bits, 1) and
|
|
13
|
+
* Type (low 4 bits, 1), a 1-byte Code (0x00 in the Session Stage), a 2-byte Session ID (non-zero), and
|
|
14
|
+
* a 2-byte Length (the octet count of the PPPoE payload — i.e. the PPP portion, which starts with the
|
|
15
|
+
* 2-byte PPP Protocol field). The payload follows: a 2-byte PPP Protocol (e.g. 0x0021 IPv4, 0x0057
|
|
16
|
+
* IPv6, 0xc021 LCP, 0x8021 IPCP) and its data.
|
|
17
|
+
*
|
|
18
|
+
* This minimal slice decodes the 6-byte header plus the 2-byte PPP Protocol and keeps the PPP data
|
|
19
|
+
* verbatim as `payload` hex (byte-perfect), bounded by the Length field so trailing Ethernet padding is
|
|
20
|
+
* left to the codec's recursion / RawData. The Length is honored verbatim when supplied (a crafted
|
|
21
|
+
* frame may lie) else derived from the actual payload (2-byte Protocol + data). A well-formed frame
|
|
22
|
+
* round-trips byte-for-byte. Inner IPv4/IPv6/LCP recursion is deferred to a serial follow-up (it needs
|
|
23
|
+
* a pppProtocol-driven demux into IPv4/IPv6.match); for now the PPP payload is a bounded-hex leaf.
|
|
24
|
+
*/
|
|
25
|
+
class PPPoESession extends BaseHeader_1.BaseHeader {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.id = 'pppoe-sess';
|
|
29
|
+
this.name = 'PPP-over-Ethernet Session';
|
|
30
|
+
this.nickname = 'PPPoE Session';
|
|
31
|
+
this.matchKeys = ['ethertype:8864'];
|
|
32
|
+
//A leaf header for this slice — the inner PPP payload (IPv4/IPv6/LCP) is deferred to a serial
|
|
33
|
+
//follow-up that will add a pppProtocol-driven demux; for now it is kept as bounded-hex `payload`.
|
|
34
|
+
this.demuxProducers = [];
|
|
35
|
+
}
|
|
36
|
+
static #schemaCache;
|
|
37
|
+
get SCHEMA() {
|
|
38
|
+
return (PPPoESession.#schemaCache ??= PPPoESession.#buildSchema());
|
|
39
|
+
}
|
|
40
|
+
static #buildSchema() {
|
|
41
|
+
return {
|
|
42
|
+
type: 'object',
|
|
43
|
+
summary: 'PPPoE Session id=${sessionId} proto=${pppProtocol}',
|
|
44
|
+
properties: {
|
|
45
|
+
//Byte 0: Version in the high 4 bits, Type in the low 4 bits (both 1 in RFC 2516). Split
|
|
46
|
+
//into two nibble fields so the editor sees them, kept verbatim for byte-perfect.
|
|
47
|
+
version: {
|
|
48
|
+
type: 'integer', label: 'Version', minimum: 0, maximum: 15,
|
|
49
|
+
decode: function () { this.instance.version.setValue(this.readBits(0, 1, 0, 4)); },
|
|
50
|
+
encode: function () { this.writeBits(0, 1, 0, 4, this.instance.version.getValue(0)); }
|
|
51
|
+
},
|
|
52
|
+
type: {
|
|
53
|
+
type: 'integer', label: 'Type', minimum: 0, maximum: 15,
|
|
54
|
+
decode: function () { this.instance.type.setValue(this.readBits(0, 1, 4, 4)); },
|
|
55
|
+
encode: function () { this.writeBits(0, 1, 4, 4, this.instance.type.getValue(0)); }
|
|
56
|
+
},
|
|
57
|
+
//Code — 0x00 in the Session Stage (Discovery Stage codes live in a separate header).
|
|
58
|
+
code: this.fieldUInt('code', 1, 1, 'Code'),
|
|
59
|
+
//Session ID — assigned during Discovery; non-zero for an established session.
|
|
60
|
+
sessionId: this.fieldUInt('sessionId', 2, 2, 'Session ID'),
|
|
61
|
+
length: {
|
|
62
|
+
type: 'integer',
|
|
63
|
+
label: 'Length',
|
|
64
|
+
minimum: 0,
|
|
65
|
+
maximum: 65535,
|
|
66
|
+
decode: function () {
|
|
67
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(4, 2)));
|
|
68
|
+
},
|
|
69
|
+
encode: function () {
|
|
70
|
+
//Length counts the PPPoE payload = 2-byte PPP Protocol + data. Honored when
|
|
71
|
+
//supplied (a crafted frame may lie); else derived from the actual payload.
|
|
72
|
+
const provided = this.instance.length.getValue();
|
|
73
|
+
let value = (provided !== undefined && provided !== null)
|
|
74
|
+
? provided
|
|
75
|
+
: 2 + (0, HexToBuffer_1.HexToBuffer)(this.instance.payload.getValue('')).length;
|
|
76
|
+
if (value > 65535) {
|
|
77
|
+
this.recordError(this.instance.length.getPath(), 'Maximum value is 65535');
|
|
78
|
+
value = 65535;
|
|
79
|
+
}
|
|
80
|
+
if (value < 0) {
|
|
81
|
+
this.recordError(this.instance.length.getPath(), 'Minimum value is 0');
|
|
82
|
+
value = 0;
|
|
83
|
+
}
|
|
84
|
+
this.instance.length.setValue(value);
|
|
85
|
+
this.writeBytes(4, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
//The 2-byte PPP Protocol at the start of the payload (offset 6), kept as a lowercase hex
|
|
89
|
+
//string. A serial follow-up will make this a demux producer into the inner IPv4/IPv6/LCP.
|
|
90
|
+
pppProtocol: this.fieldHex('pppProtocol', 6, 2, 'PPP Protocol'),
|
|
91
|
+
//The PPP data after the Protocol field (offset 8), kept verbatim. Bounded by the Length
|
|
92
|
+
//field (payload ends at header offset 6 + Length) and the captured bytes, so trailing
|
|
93
|
+
//Ethernet padding / pipelined data is left to the codec's recursion / RawData.
|
|
94
|
+
payload: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
label: 'Payload',
|
|
97
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
98
|
+
decode: function () {
|
|
99
|
+
const remaining = this.packet.length - this.startPos;
|
|
100
|
+
const length = this.instance.length.getValue(0);
|
|
101
|
+
let end = 6 + length;
|
|
102
|
+
if (end > remaining)
|
|
103
|
+
end = remaining;
|
|
104
|
+
this.instance.payload.setValue(end > 8 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(8, end - 8)) : '');
|
|
105
|
+
},
|
|
106
|
+
encode: function () {
|
|
107
|
+
const payload = this.instance.payload.getValue('');
|
|
108
|
+
if (payload)
|
|
109
|
+
this.writeBytes(8, (0, HexToBuffer_1.HexToBuffer)(payload));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
match() {
|
|
116
|
+
//An Ethernet (or VLAN) child selected by EtherType 0x8864 (stored as a lowercase 4-hex string).
|
|
117
|
+
//Require the 6-byte PPPoE header minimum.
|
|
118
|
+
if (!this.prevCodecModule)
|
|
119
|
+
return false;
|
|
120
|
+
if (this.prevCodecModule.instance.etherType.getValue() !== '8864')
|
|
121
|
+
return false;
|
|
122
|
+
return this.packet.length - this.startPos >= 6;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.PPPoESession = PPPoESession;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* Point-to-Point Tunnelling Protocol (PPTP, RFC 2637), TCP port 1723 — the control connection. Every
|
|
6
|
+
* PPTP control message begins with a fixed 8-byte common header — a 2-byte Length (the total octet
|
|
7
|
+
* count of this control message, including the header), a 2-byte PDU type (1 = control message), and a
|
|
8
|
+
* 4-byte Magic Cookie (the constant 0x1A2B3C4D) — followed, for control messages, by a 2-byte Control
|
|
9
|
+
* Message Type (1 Start-Control-Connection-Request, 2 …-Reply, 3 Stop-Control-Connection-Request,
|
|
10
|
+
* 7 Outgoing-Call-Request, 8 …-Reply, etc.) and a 2-byte Reserved0 field, then the type-specific body.
|
|
11
|
+
*
|
|
12
|
+
* The body layout differs per control message type (SCCRQ's protocol version / framing & bearer
|
|
13
|
+
* capabilities / host & vendor strings, Outgoing-Call's call id & bearer type, …) and several fields
|
|
14
|
+
* carry negotiation context, so this single-message codec keeps the body verbatim as `body` hex
|
|
15
|
+
* (byte-perfect) and does not sub-decode it. The Length is auto-computed from the structured header +
|
|
16
|
+
* body on encode when not supplied, else honored verbatim (a crafted message may lie); the message is
|
|
17
|
+
* bounded by Length so a second pipelined control message or trailing bytes are left to the codec's
|
|
18
|
+
* recursion / RawData. The Magic Cookie is kept verbatim (honored) rather than re-derived, and the
|
|
19
|
+
* Reserved0 field is preserved and re-emitted untouched. A well-formed message round-trips byte-for-byte.
|
|
20
|
+
*/
|
|
21
|
+
export declare class PPTP extends BaseHeader {
|
|
22
|
+
#private;
|
|
23
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly nickname: string;
|
|
27
|
+
readonly matchKeys: string[];
|
|
28
|
+
match(): boolean;
|
|
29
|
+
readonly demuxProducers: DemuxProducer[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PPTP = 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
|
+
/** PPTP magic cookie (RFC 2637 §2.1): a constant 0x1A2B3C4D used to sync/verify the control channel. */
|
|
11
|
+
const PPTP_MAGIC_COOKIE = 0x1a2b3c4d;
|
|
12
|
+
/**
|
|
13
|
+
* Point-to-Point Tunnelling Protocol (PPTP, RFC 2637), TCP port 1723 — the control connection. Every
|
|
14
|
+
* PPTP control message begins with a fixed 8-byte common header — a 2-byte Length (the total octet
|
|
15
|
+
* count of this control message, including the header), a 2-byte PDU type (1 = control message), and a
|
|
16
|
+
* 4-byte Magic Cookie (the constant 0x1A2B3C4D) — followed, for control messages, by a 2-byte Control
|
|
17
|
+
* Message Type (1 Start-Control-Connection-Request, 2 …-Reply, 3 Stop-Control-Connection-Request,
|
|
18
|
+
* 7 Outgoing-Call-Request, 8 …-Reply, etc.) and a 2-byte Reserved0 field, then the type-specific body.
|
|
19
|
+
*
|
|
20
|
+
* The body layout differs per control message type (SCCRQ's protocol version / framing & bearer
|
|
21
|
+
* capabilities / host & vendor strings, Outgoing-Call's call id & bearer type, …) and several fields
|
|
22
|
+
* carry negotiation context, so this single-message codec keeps the body verbatim as `body` hex
|
|
23
|
+
* (byte-perfect) and does not sub-decode it. The Length is auto-computed from the structured header +
|
|
24
|
+
* body on encode when not supplied, else honored verbatim (a crafted message may lie); the message is
|
|
25
|
+
* bounded by Length so a second pipelined control message or trailing bytes are left to the codec's
|
|
26
|
+
* recursion / RawData. The Magic Cookie is kept verbatim (honored) rather than re-derived, and the
|
|
27
|
+
* Reserved0 field is preserved and re-emitted untouched. A well-formed message round-trips byte-for-byte.
|
|
28
|
+
*/
|
|
29
|
+
class PPTP extends BaseHeader_1.BaseHeader {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.id = 'pptp';
|
|
33
|
+
this.name = 'Point-to-Point Tunnelling Protocol';
|
|
34
|
+
this.nickname = 'PPTP';
|
|
35
|
+
this.matchKeys = ['tcpport:1723'];
|
|
36
|
+
//A leaf header — the type-specific control-message body requires per-type parsing.
|
|
37
|
+
this.demuxProducers = [];
|
|
38
|
+
}
|
|
39
|
+
static #schemaCache;
|
|
40
|
+
get SCHEMA() {
|
|
41
|
+
return (PPTP.#schemaCache ??= PPTP.#buildSchema());
|
|
42
|
+
}
|
|
43
|
+
static #buildSchema() {
|
|
44
|
+
return {
|
|
45
|
+
type: 'object',
|
|
46
|
+
summary: 'PPTP ctrlType=${controlMessageType} len=${length}',
|
|
47
|
+
properties: {
|
|
48
|
+
length: {
|
|
49
|
+
type: 'integer',
|
|
50
|
+
label: 'Length',
|
|
51
|
+
minimum: 0,
|
|
52
|
+
maximum: 65535,
|
|
53
|
+
decode: function () {
|
|
54
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(0, 2)));
|
|
55
|
+
},
|
|
56
|
+
encode: function () {
|
|
57
|
+
//Length counts the whole control message = 12-byte structured header
|
|
58
|
+
//(length + pduType + magicCookie + controlMessageType + reserved0) + body. Honored
|
|
59
|
+
//when supplied (a crafted message may lie); else derived from the body.
|
|
60
|
+
const provided = this.instance.length.getValue();
|
|
61
|
+
let value = (provided !== undefined && provided !== null)
|
|
62
|
+
? provided
|
|
63
|
+
: 12 + (0, HexToBuffer_1.HexToBuffer)(this.instance.body.getValue('')).length;
|
|
64
|
+
if (value > 65535) {
|
|
65
|
+
this.recordError(this.instance.length.getPath(), 'Maximum value is 65535');
|
|
66
|
+
value = 65535;
|
|
67
|
+
}
|
|
68
|
+
if (value < 0) {
|
|
69
|
+
this.recordError(this.instance.length.getPath(), 'Minimum value is 0');
|
|
70
|
+
value = 0;
|
|
71
|
+
}
|
|
72
|
+
this.instance.length.setValue(value);
|
|
73
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
//The PDU type (RFC 2637 §2.1). 1 = control message; this codec structures control
|
|
77
|
+
//messages, the only PDU type carried on the TCP control connection.
|
|
78
|
+
pduType: this.fieldUInt('pduType', 2, 2, 'PDU Type'),
|
|
79
|
+
//The Magic Cookie constant 0x1A2B3C4D. Kept verbatim (honored, not re-derived) so a
|
|
80
|
+
//crafted/desynced cookie still round-trips.
|
|
81
|
+
magicCookie: this.fieldHex('magicCookie', 4, 4, 'Magic Cookie'),
|
|
82
|
+
controlMessageType: this.fieldUInt('controlMessageType', 8, 2, 'Control Message Type'),
|
|
83
|
+
//Reserved (MUST be 0 per RFC 2637); preserved and re-emitted untouched.
|
|
84
|
+
reserved0: this.fieldHex('reserved0', 10, 2, 'Reserved0'),
|
|
85
|
+
//The type-specific body after the 12-byte structured header, kept verbatim. Bounded by the
|
|
86
|
+
//message Length (the message ends at offset Length) and the captured bytes, so trailing /
|
|
87
|
+
//pipelined control messages are left to the codec's recursion / RawData.
|
|
88
|
+
body: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
label: 'Body',
|
|
91
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
92
|
+
decode: function () {
|
|
93
|
+
const remaining = this.packet.length - this.startPos;
|
|
94
|
+
const length = this.instance.length.getValue(0);
|
|
95
|
+
let end = length;
|
|
96
|
+
if (end > remaining)
|
|
97
|
+
end = remaining;
|
|
98
|
+
this.instance.body.setValue(end > 12 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(12, end - 12)) : '');
|
|
99
|
+
},
|
|
100
|
+
encode: function () {
|
|
101
|
+
const body = this.instance.body.getValue('');
|
|
102
|
+
if (body)
|
|
103
|
+
this.writeBytes(12, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
match() {
|
|
110
|
+
//PPTP's control connection rides on TCP port 1723. Require the full 12-byte structured header and
|
|
111
|
+
//the Magic Cookie signature (0x1A2B3C4D at offset 4) so non-PPTP 1723 traffic falls through to
|
|
112
|
+
//raw. The cookie is a strong, distinctive content signature, but selection stays port-bucketed
|
|
113
|
+
//(matchKeys) to stay conservative like the other length-bounded TCP payload codecs.
|
|
114
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'tcp')
|
|
115
|
+
return false;
|
|
116
|
+
if (this.packet.length - this.startPos < 12)
|
|
117
|
+
return false;
|
|
118
|
+
return (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(4, 2, true)) === (PPTP_MAGIC_COOKIE >>> 16)
|
|
119
|
+
&& (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(6, 2, true)) === (PPTP_MAGIC_COOKIE & 0xffff);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.PPTP = PPTP;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* PROFINET Real-Time (PROFINET-RT / PN-IO cyclic) — IEC 61158-6-10 / IEC 61784, carried directly in an
|
|
6
|
+
* Ethernet II frame with EtherType 0x8892 (an Ethernet child — no IP/UDP). The frame opens with a 2-byte
|
|
7
|
+
* big-endian FrameID that identifies the frame's type/purpose; the FrameID value ranges select the class
|
|
8
|
+
* of traffic (0x0100-0x06FF isochronous RT_CLASS_3, 0x8000-0xBFFF cyclic RT_CLASS_1/2, 0xFC00-0xFCFF DCP,
|
|
9
|
+
* 0xFF00-0xFF43 acyclic/alarms, etc.). Everything after the FrameID is the frame's data.
|
|
10
|
+
*
|
|
11
|
+
* For cyclic frames the data is the IO data followed — at the very end, before any Ethernet padding — by
|
|
12
|
+
* a 4-byte APDU-Status (CycleCounter uint16 BE, DataStatus, TransferStatus). Because trailing Ethernet
|
|
13
|
+
* padding on short frames sits AFTER the APDU-Status, splitting it out reliably needs the true data
|
|
14
|
+
* length (from the GSD / IO configuration), which this minimal slice does not have. So everything after
|
|
15
|
+
* the FrameID is kept verbatim as `data` (hex) and re-emitted untouched, so every frame — cyclic or
|
|
16
|
+
* acyclic — round-trips byte-for-byte. Structuring the APDU-Status (and distinguishing it from padding)
|
|
17
|
+
* is a deferred slice. PROFINET-RT is a leaf here — nothing demuxes above it.
|
|
18
|
+
*/
|
|
19
|
+
export declare class PROFINETRT extends BaseHeader {
|
|
20
|
+
#private;
|
|
21
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly nickname: string;
|
|
25
|
+
readonly matchKeys: string[];
|
|
26
|
+
match(): boolean;
|
|
27
|
+
readonly demuxProducers: DemuxProducer[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROFINETRT = 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
|
+
* PROFINET Real-Time (PROFINET-RT / PN-IO cyclic) — IEC 61158-6-10 / IEC 61784, carried directly in an
|
|
10
|
+
* Ethernet II frame with EtherType 0x8892 (an Ethernet child — no IP/UDP). The frame opens with a 2-byte
|
|
11
|
+
* big-endian FrameID that identifies the frame's type/purpose; the FrameID value ranges select the class
|
|
12
|
+
* of traffic (0x0100-0x06FF isochronous RT_CLASS_3, 0x8000-0xBFFF cyclic RT_CLASS_1/2, 0xFC00-0xFCFF DCP,
|
|
13
|
+
* 0xFF00-0xFF43 acyclic/alarms, etc.). Everything after the FrameID is the frame's data.
|
|
14
|
+
*
|
|
15
|
+
* For cyclic frames the data is the IO data followed — at the very end, before any Ethernet padding — by
|
|
16
|
+
* a 4-byte APDU-Status (CycleCounter uint16 BE, DataStatus, TransferStatus). Because trailing Ethernet
|
|
17
|
+
* padding on short frames sits AFTER the APDU-Status, splitting it out reliably needs the true data
|
|
18
|
+
* length (from the GSD / IO configuration), which this minimal slice does not have. So everything after
|
|
19
|
+
* the FrameID is kept verbatim as `data` (hex) and re-emitted untouched, so every frame — cyclic or
|
|
20
|
+
* acyclic — round-trips byte-for-byte. Structuring the APDU-Status (and distinguishing it from padding)
|
|
21
|
+
* is a deferred slice. PROFINET-RT is a leaf here — nothing demuxes above it.
|
|
22
|
+
*/
|
|
23
|
+
class PROFINETRT extends BaseHeader_1.BaseHeader {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.id = 'pnio';
|
|
27
|
+
this.name = 'PROFINET Real-Time';
|
|
28
|
+
this.nickname = 'PROFINET-RT';
|
|
29
|
+
this.matchKeys = ['ethertype:8892'];
|
|
30
|
+
//A leaf header — nothing demuxes above PROFINET-RT.
|
|
31
|
+
this.demuxProducers = [];
|
|
32
|
+
}
|
|
33
|
+
static #schemaCache;
|
|
34
|
+
get SCHEMA() {
|
|
35
|
+
return (PROFINETRT.#schemaCache ??= PROFINETRT.#buildSchema());
|
|
36
|
+
}
|
|
37
|
+
static #buildSchema() {
|
|
38
|
+
return {
|
|
39
|
+
type: 'object',
|
|
40
|
+
summary: 'PROFINET-RT frameId=${frameId}',
|
|
41
|
+
properties: {
|
|
42
|
+
frameId: this.fieldUInt('frameId', 0, 2, 'Frame ID'),
|
|
43
|
+
//Everything after the 2-byte FrameID, kept verbatim as hex so the IO data + APDU-Status
|
|
44
|
+
//(+ any Ethernet padding) round-trip byte-for-byte. Structuring the APDU-Status is a
|
|
45
|
+
//deferred slice (see the class doc): it cannot be split from trailing padding without the
|
|
46
|
+
//true data length from the IO configuration.
|
|
47
|
+
data: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
label: 'Data',
|
|
50
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
51
|
+
decode: function () {
|
|
52
|
+
const remaining = this.packet.length - this.startPos;
|
|
53
|
+
this.instance.data.setValue(remaining > 2 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(2, remaining - 2)) : '');
|
|
54
|
+
},
|
|
55
|
+
encode: function () {
|
|
56
|
+
const data = this.instance.data.getValue('');
|
|
57
|
+
if (data)
|
|
58
|
+
this.writeBytes(2, (0, HexToBuffer_1.HexToBuffer)(data));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
match() {
|
|
65
|
+
//An Ethernet child selected by EtherType 0x8892 (stored as a lowercase 4-hex string). Require the
|
|
66
|
+
//2-byte minimum for the FrameID.
|
|
67
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'eth')
|
|
68
|
+
return false;
|
|
69
|
+
if (this.prevCodecModule.instance.etherType.getValue() !== '8892')
|
|
70
|
+
return false;
|
|
71
|
+
return this.packet.length - this.startPos >= 2;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.PROFINETRT = PROFINETRT;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* PTP — the Precision Time Protocol version 2 (IEEE 1588-2008, with 1588-2019 field naming). A
|
|
6
|
+
* sub-microsecond clock-synchronization protocol widely deployed in power-system substations (IEC 61850
|
|
7
|
+
* / IEEE C37.238 power profile) and industrial automation. It is dual-carried: directly over Ethernet
|
|
8
|
+
* with EtherType 0x88F7 (an Ethernet child — no IP), or over UDP/IPv4/6 on the event port 319 and the
|
|
9
|
+
* general port 320.
|
|
10
|
+
*
|
|
11
|
+
* Every PTP message begins with the same 34-byte common header (IEEE 1588-2008 §13.3): a
|
|
12
|
+
* messageType / majorSdoId(transportSpecific) nibble pair, a versionPTP / minorVersionPTP nibble pair,
|
|
13
|
+
* the total messageLength, domainNumber, a minorSdoId(reserved) octet, a 2-byte flagField, an 8-byte
|
|
14
|
+
* correctionField, a 4-byte reserved(messageTypeSpecific) field, the 10-byte sourcePortIdentity
|
|
15
|
+
* (8-byte clockIdentity + 2-byte portNumber), sequenceId, controlField, and the signed
|
|
16
|
+
* logMessageInterval — followed by the message-type-specific body.
|
|
17
|
+
*
|
|
18
|
+
* The per-type body (Sync/Follow_Up timestamps, Announce clock-quality, Delay/Pdelay, Signaling and
|
|
19
|
+
* Management TLVs) is kept verbatim as `body` hex (byte-perfect) and not sub-decoded in this slice. The
|
|
20
|
+
* messageLength is honored verbatim on encode when supplied (a crafted message may lie) else derived
|
|
21
|
+
* from the body; the message is bounded by messageLength and the transport payload, so a min-size
|
|
22
|
+
* Ethernet frame's trailing padding is left to the codec's recursion / RawData. The correctionField is
|
|
23
|
+
* kept verbatim (never recomputed) — a well-formed message round-trips byte-for-byte.
|
|
24
|
+
*/
|
|
25
|
+
export declare class PTP 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
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PTP = 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
|
+
* PTP — the Precision Time Protocol version 2 (IEEE 1588-2008, with 1588-2019 field naming). A
|
|
12
|
+
* sub-microsecond clock-synchronization protocol widely deployed in power-system substations (IEC 61850
|
|
13
|
+
* / IEEE C37.238 power profile) and industrial automation. It is dual-carried: directly over Ethernet
|
|
14
|
+
* with EtherType 0x88F7 (an Ethernet child — no IP), or over UDP/IPv4/6 on the event port 319 and the
|
|
15
|
+
* general port 320.
|
|
16
|
+
*
|
|
17
|
+
* Every PTP message begins with the same 34-byte common header (IEEE 1588-2008 §13.3): a
|
|
18
|
+
* messageType / majorSdoId(transportSpecific) nibble pair, a versionPTP / minorVersionPTP nibble pair,
|
|
19
|
+
* the total messageLength, domainNumber, a minorSdoId(reserved) octet, a 2-byte flagField, an 8-byte
|
|
20
|
+
* correctionField, a 4-byte reserved(messageTypeSpecific) field, the 10-byte sourcePortIdentity
|
|
21
|
+
* (8-byte clockIdentity + 2-byte portNumber), sequenceId, controlField, and the signed
|
|
22
|
+
* logMessageInterval — followed by the message-type-specific body.
|
|
23
|
+
*
|
|
24
|
+
* The per-type body (Sync/Follow_Up timestamps, Announce clock-quality, Delay/Pdelay, Signaling and
|
|
25
|
+
* Management TLVs) is kept verbatim as `body` hex (byte-perfect) and not sub-decoded in this slice. The
|
|
26
|
+
* messageLength is honored verbatim on encode when supplied (a crafted message may lie) else derived
|
|
27
|
+
* from the body; the message is bounded by messageLength and the transport payload, so a min-size
|
|
28
|
+
* Ethernet frame's trailing padding is left to the codec's recursion / RawData. The correctionField is
|
|
29
|
+
* kept verbatim (never recomputed) — a well-formed message round-trips byte-for-byte.
|
|
30
|
+
*/
|
|
31
|
+
class PTP extends BaseHeader_1.BaseHeader {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.id = 'ptp';
|
|
35
|
+
this.name = 'Precision Time Protocol';
|
|
36
|
+
this.nickname = 'PTP';
|
|
37
|
+
this.matchKeys = ['ethertype:88f7', 'udpport:319', 'udpport:320'];
|
|
38
|
+
//A leaf header — the per-message-type body (timestamps, Announce clock-quality, Signaling/Management
|
|
39
|
+
//TLVs) is kept verbatim and sub-decoding is deferred to a later slice.
|
|
40
|
+
this.demuxProducers = [];
|
|
41
|
+
}
|
|
42
|
+
static #schemaCache;
|
|
43
|
+
get SCHEMA() {
|
|
44
|
+
return (PTP.#schemaCache ??= PTP.#buildSchema());
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Bytes of PTP available in the enclosing transport. Over UDP the datagram length bounds the message
|
|
48
|
+
* (so retained Ethernet padding / a trailing FCS is not absorbed); over raw Ethernet there is no
|
|
49
|
+
* transport length field, so take the rest of the captured frame (messageLength then bounds the body).
|
|
50
|
+
*/
|
|
51
|
+
#available() {
|
|
52
|
+
let available = this.packet.length - this.startPos;
|
|
53
|
+
const prev = this.prevCodecModule;
|
|
54
|
+
if (prev && prev.id === 'udp') {
|
|
55
|
+
const udpLength = prev.instance.length.getValue(0);
|
|
56
|
+
if (udpLength >= 8 && udpLength - 8 < available)
|
|
57
|
+
available = udpLength - 8;
|
|
58
|
+
}
|
|
59
|
+
return available < 0 ? 0 : available;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Header-relative end offset of the PTP message: the messageLength field, clamped down to the bytes
|
|
63
|
+
* the transport actually made available (#available). Never less than the 34-byte common header, so
|
|
64
|
+
* the body walk is bounded even when a malformed messageLength overstates the message.
|
|
65
|
+
*/
|
|
66
|
+
#bodyEnd() {
|
|
67
|
+
let end = this.instance.messageLength.getValue(0);
|
|
68
|
+
const available = this.#available();
|
|
69
|
+
if (available && available < end)
|
|
70
|
+
end = available;
|
|
71
|
+
if (end < 34)
|
|
72
|
+
end = 34;
|
|
73
|
+
return end;
|
|
74
|
+
}
|
|
75
|
+
/** A 4-bit nibble within a single octet (bitOffset 0 = the high nibble, MSB-first). */
|
|
76
|
+
static #nibble(name, byteOffset, bitOffset, label) {
|
|
77
|
+
return {
|
|
78
|
+
type: 'integer',
|
|
79
|
+
label: label,
|
|
80
|
+
minimum: 0,
|
|
81
|
+
maximum: 15,
|
|
82
|
+
decode: function () {
|
|
83
|
+
this.instance[name].setValue(this.readBits(byteOffset, 1, bitOffset, 4));
|
|
84
|
+
},
|
|
85
|
+
encode: function () {
|
|
86
|
+
//writeBits masks the field, so the two nibbles of the same octet never clobber each other.
|
|
87
|
+
this.writeBits(byteOffset, 1, bitOffset, 4, this.instance[name].getValue(0));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static #buildSchema() {
|
|
92
|
+
return {
|
|
93
|
+
type: 'object',
|
|
94
|
+
summary: 'PTPv2 msgType=${messageType} seq=${sequenceId}',
|
|
95
|
+
properties: {
|
|
96
|
+
//Byte 0 (MSB first): majorSdoId/transportSpecific (high nibble), messageType (low nibble).
|
|
97
|
+
//messageType: 0 Sync, 1 Delay_Req, 2 Pdelay_Req, 3 Pdelay_Resp, 8 Follow_Up, 9 Delay_Resp,
|
|
98
|
+
//0xA Pdelay_Resp_Follow_Up, 0xB Announce, 0xC Signaling, 0xD Management.
|
|
99
|
+
majorSdoId: this.#nibble('majorSdoId', 0, 0, 'Major SDO ID / Transport Specific'),
|
|
100
|
+
messageType: this.#nibble('messageType', 0, 4, 'Message Type'),
|
|
101
|
+
//Byte 1 (MSB first): minorVersionPTP (high nibble, reserved/0 in 1588-2008), versionPTP
|
|
102
|
+
//(low nibble, 2 for PTPv2).
|
|
103
|
+
minorVersionPTP: this.#nibble('minorVersionPTP', 1, 0, 'Minor Version PTP'),
|
|
104
|
+
versionPTP: this.#nibble('versionPTP', 1, 4, 'Version PTP'),
|
|
105
|
+
messageLength: {
|
|
106
|
+
type: 'integer',
|
|
107
|
+
label: 'Message Length',
|
|
108
|
+
minimum: 34,
|
|
109
|
+
maximum: 65535,
|
|
110
|
+
decode: function () {
|
|
111
|
+
this.instance.messageLength.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(2, 2)));
|
|
112
|
+
},
|
|
113
|
+
encode: function () {
|
|
114
|
+
//messageLength counts the whole message = 34-byte header + body. Honored when
|
|
115
|
+
//supplied (a crafted message may lie); else derived from the body.
|
|
116
|
+
const provided = this.instance.messageLength.getValue();
|
|
117
|
+
let value = (provided !== undefined && provided !== null)
|
|
118
|
+
? provided
|
|
119
|
+
: 34 + (0, HexToBuffer_1.HexToBuffer)(this.instance.body.getValue('')).length;
|
|
120
|
+
if (value > 65535) {
|
|
121
|
+
this.recordError(this.instance.messageLength.getPath(), 'Maximum value is 65535');
|
|
122
|
+
value = 65535;
|
|
123
|
+
}
|
|
124
|
+
this.instance.messageLength.setValue(value);
|
|
125
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
domainNumber: this.fieldUInt('domainNumber', 4, 1, 'Domain Number'),
|
|
129
|
+
//minorSdoId (1588-2019) / reserved (1588-2008), byte 5 — kept verbatim for byte-perfect.
|
|
130
|
+
minorSdoId: this.fieldUInt('minorSdoId', 5, 1, 'Minor SDO ID'),
|
|
131
|
+
//flagField (bytes 6-7): alternateMaster/twoStep/unicast/PTP-profile/security/etc. Kept as
|
|
132
|
+
//hex — the per-bit meaning is message-type dependent; a form still round-trips it exactly.
|
|
133
|
+
flags: this.fieldHex('flags', 6, 2, 'Flags'),
|
|
134
|
+
//correctionField (bytes 8-15): signed 64-bit scaled nanoseconds. Kept verbatim (never
|
|
135
|
+
//recomputed), so a captured message round-trips byte-for-byte.
|
|
136
|
+
correctionField: this.fieldHex('correctionField', 8, 8, 'Correction Field'),
|
|
137
|
+
//reserved (bytes 16-19) / messageTypeSpecific in 1588-2019 — kept verbatim.
|
|
138
|
+
reserved: this.fieldHex('reserved', 16, 4, 'Reserved'),
|
|
139
|
+
//sourcePortIdentity (bytes 20-29): the 8-byte clockIdentity + 2-byte portNumber of the
|
|
140
|
+
//originating port.
|
|
141
|
+
sourcePortIdentity: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
label: 'Source Port Identity',
|
|
144
|
+
properties: {
|
|
145
|
+
clockIdentity: {
|
|
146
|
+
type: 'string',
|
|
147
|
+
label: 'Clock Identity',
|
|
148
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
149
|
+
decode: function () {
|
|
150
|
+
this.instance.sourcePortIdentity.clockIdentity.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(20, 8)));
|
|
151
|
+
},
|
|
152
|
+
encode: function () {
|
|
153
|
+
this.writeBytes(20, (0, HexToBuffer_1.HexToBuffer)(this.instance.sourcePortIdentity.clockIdentity.getValue('0000000000000000')));
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
portNumber: {
|
|
157
|
+
type: 'integer',
|
|
158
|
+
label: 'Source Port Number',
|
|
159
|
+
minimum: 0,
|
|
160
|
+
maximum: 65535,
|
|
161
|
+
decode: function () {
|
|
162
|
+
this.instance.sourcePortIdentity.portNumber.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(28, 2)));
|
|
163
|
+
},
|
|
164
|
+
encode: function () {
|
|
165
|
+
this.writeBytes(28, (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.sourcePortIdentity.portNumber.getValue(0)));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
sequenceId: this.fieldUInt('sequenceId', 30, 2, 'Sequence ID'),
|
|
171
|
+
controlField: this.fieldUInt('controlField', 32, 1, 'Control Field'),
|
|
172
|
+
logMessageInterval: this.fieldInt8('logMessageInterval', 33, 'Log Message Interval'),
|
|
173
|
+
//The message-type-specific body after the 34-byte header, kept verbatim. Bounded by the
|
|
174
|
+
//messageLength (the message ends at offset messageLength) and the transport payload, so
|
|
175
|
+
//Ethernet padding / a pipelined message is left to the codec's recursion / RawData.
|
|
176
|
+
body: {
|
|
177
|
+
type: 'string',
|
|
178
|
+
label: 'Body',
|
|
179
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
180
|
+
decode: function () {
|
|
181
|
+
const end = this.#bodyEnd();
|
|
182
|
+
this.instance.body.setValue(end > 34 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(34, end - 34)) : '');
|
|
183
|
+
},
|
|
184
|
+
encode: function () {
|
|
185
|
+
const body = this.instance.body.getValue('');
|
|
186
|
+
if (body)
|
|
187
|
+
this.writeBytes(34, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
match() {
|
|
194
|
+
//PTP is dual-carried: directly over Ethernet (EtherType 0x88F7) or over UDP on the event port
|
|
195
|
+
//319 / general port 320 (accept src too, to catch responses). Require the full 34-byte common
|
|
196
|
+
//header within the transport payload.
|
|
197
|
+
if (!this.prevCodecModule)
|
|
198
|
+
return false;
|
|
199
|
+
const prev = this.prevCodecModule;
|
|
200
|
+
if (prev.id === 'udp') {
|
|
201
|
+
const dstport = prev.instance.dstport.getValue(0);
|
|
202
|
+
const srcport = prev.instance.srcport.getValue(0);
|
|
203
|
+
if (dstport !== 319 && dstport !== 320 && srcport !== 319 && srcport !== 320)
|
|
204
|
+
return false;
|
|
205
|
+
return this.#available() >= 34;
|
|
206
|
+
}
|
|
207
|
+
//Ethernet (or a VLAN/HSR parent) child selected by EtherType 0x88F7 (a lowercase 4-hex string).
|
|
208
|
+
if (prev.instance.etherType.getValue() !== '88f7')
|
|
209
|
+
return false;
|
|
210
|
+
return this.packet.length - this.startPos >= 34;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.PTP = PTP;
|