@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.
Files changed (463) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +352 -0
  4. package/README.zh-CN.md +342 -0
  5. package/dist/Codec.d.ts +133 -0
  6. package/dist/Codec.js +632 -0
  7. package/dist/PacketHeaders.d.ts +189 -0
  8. package/dist/PacketHeaders.js +384 -0
  9. package/dist/abstracts/BaseHeader.d.ts +325 -0
  10. package/dist/abstracts/BaseHeader.js +734 -0
  11. package/dist/errors/CodecSchemaValidateError.d.ts +4 -0
  12. package/dist/errors/CodecSchemaValidateError.js +11 -0
  13. package/dist/headers/ADSAMS.d.ts +33 -0
  14. package/dist/headers/ADSAMS.js +208 -0
  15. package/dist/headers/AH.d.ts +28 -0
  16. package/dist/headers/AH.js +137 -0
  17. package/dist/headers/AMQP.d.ts +31 -0
  18. package/dist/headers/AMQP.js +316 -0
  19. package/dist/headers/ARP.d.ts +26 -0
  20. package/dist/headers/ARP.js +243 -0
  21. package/dist/headers/BACnetIP.d.ts +27 -0
  22. package/dist/headers/BACnetIP.js +97 -0
  23. package/dist/headers/BFD.d.ts +28 -0
  24. package/dist/headers/BFD.js +155 -0
  25. package/dist/headers/BGP.d.ts +27 -0
  26. package/dist/headers/BGP.js +111 -0
  27. package/dist/headers/BSAPIP.d.ts +33 -0
  28. package/dist/headers/BSAPIP.js +78 -0
  29. package/dist/headers/Babel.d.ts +32 -0
  30. package/dist/headers/Babel.js +224 -0
  31. package/dist/headers/BitTorrent.d.ts +28 -0
  32. package/dist/headers/BitTorrent.js +72 -0
  33. package/dist/headers/C37118.d.ts +26 -0
  34. package/dist/headers/C37118.js +147 -0
  35. package/dist/headers/CAPWAP.d.ts +38 -0
  36. package/dist/headers/CAPWAP.js +275 -0
  37. package/dist/headers/CDP.d.ts +25 -0
  38. package/dist/headers/CDP.js +117 -0
  39. package/dist/headers/CMS.d.ts +33 -0
  40. package/dist/headers/CMS.js +238 -0
  41. package/dist/headers/COTP.d.ts +30 -0
  42. package/dist/headers/COTP.js +193 -0
  43. package/dist/headers/CassandraCQL.d.ts +28 -0
  44. package/dist/headers/CassandraCQL.js +117 -0
  45. package/dist/headers/CoAP.d.ts +29 -0
  46. package/dist/headers/CoAP.js +140 -0
  47. package/dist/headers/Codesys.d.ts +32 -0
  48. package/dist/headers/Codesys.js +119 -0
  49. package/dist/headers/Collectd.d.ts +29 -0
  50. package/dist/headers/Collectd.js +154 -0
  51. package/dist/headers/DCCP.d.ts +30 -0
  52. package/dist/headers/DCCP.js +204 -0
  53. package/dist/headers/DHCP.d.ts +26 -0
  54. package/dist/headers/DHCP.js +148 -0
  55. package/dist/headers/DHCPFailover.d.ts +30 -0
  56. package/dist/headers/DHCPFailover.js +104 -0
  57. package/dist/headers/DHCPv6.d.ts +25 -0
  58. package/dist/headers/DHCPv6.js +145 -0
  59. package/dist/headers/DNP3.d.ts +27 -0
  60. package/dist/headers/DNP3.js +150 -0
  61. package/dist/headers/DNS.d.ts +55 -0
  62. package/dist/headers/DNS.js +309 -0
  63. package/dist/headers/DTLS.d.ts +33 -0
  64. package/dist/headers/DTLS.js +142 -0
  65. package/dist/headers/Diameter.d.ts +34 -0
  66. package/dist/headers/Diameter.js +229 -0
  67. package/dist/headers/EAPOL.d.ts +32 -0
  68. package/dist/headers/EAPOL.js +135 -0
  69. package/dist/headers/EIGRP.d.ts +28 -0
  70. package/dist/headers/EIGRP.js +165 -0
  71. package/dist/headers/ENIP.d.ts +31 -0
  72. package/dist/headers/ENIP.js +164 -0
  73. package/dist/headers/ESP.d.ts +27 -0
  74. package/dist/headers/ESP.js +140 -0
  75. package/dist/headers/Elasticsearch.d.ts +30 -0
  76. package/dist/headers/Elasticsearch.js +125 -0
  77. package/dist/headers/EtherCAT.d.ts +35 -0
  78. package/dist/headers/EtherCAT.js +150 -0
  79. package/dist/headers/EthernetII.d.ts +28 -0
  80. package/dist/headers/EthernetII.js +117 -0
  81. package/dist/headers/FCoE.d.ts +38 -0
  82. package/dist/headers/FCoE.js +210 -0
  83. package/dist/headers/FTP.d.ts +34 -0
  84. package/dist/headers/FTP.js +158 -0
  85. package/dist/headers/Finger.d.ts +41 -0
  86. package/dist/headers/Finger.js +135 -0
  87. package/dist/headers/FoundationFieldbusHSE.d.ts +43 -0
  88. package/dist/headers/FoundationFieldbusHSE.js +163 -0
  89. package/dist/headers/GELF.d.ts +35 -0
  90. package/dist/headers/GELF.js +261 -0
  91. package/dist/headers/GENEVE.d.ts +26 -0
  92. package/dist/headers/GENEVE.js +209 -0
  93. package/dist/headers/GESRTP.d.ts +32 -0
  94. package/dist/headers/GESRTP.js +141 -0
  95. package/dist/headers/GLBP.d.ts +29 -0
  96. package/dist/headers/GLBP.js +159 -0
  97. package/dist/headers/GRE.d.ts +27 -0
  98. package/dist/headers/GRE.js +181 -0
  99. package/dist/headers/GTPU.d.ts +25 -0
  100. package/dist/headers/GTPU.js +203 -0
  101. package/dist/headers/GTPv2C.d.ts +30 -0
  102. package/dist/headers/GTPv2C.js +281 -0
  103. package/dist/headers/GitProtocol.d.ts +34 -0
  104. package/dist/headers/GitProtocol.js +141 -0
  105. package/dist/headers/Goose.d.ts +115 -0
  106. package/dist/headers/Goose.js +1067 -0
  107. package/dist/headers/Gopher.d.ts +43 -0
  108. package/dist/headers/Gopher.js +182 -0
  109. package/dist/headers/HARTIP.d.ts +30 -0
  110. package/dist/headers/HARTIP.js +145 -0
  111. package/dist/headers/HSR.d.ts +27 -0
  112. package/dist/headers/HSR.js +105 -0
  113. package/dist/headers/HSRP.d.ts +26 -0
  114. package/dist/headers/HSRP.js +173 -0
  115. package/dist/headers/HTTP.d.ts +32 -0
  116. package/dist/headers/HTTP.js +153 -0
  117. package/dist/headers/HTTP2.d.ts +34 -0
  118. package/dist/headers/HTTP2.js +190 -0
  119. package/dist/headers/IAX2.d.ts +33 -0
  120. package/dist/headers/IAX2.js +274 -0
  121. package/dist/headers/ICMP.d.ts +15 -0
  122. package/dist/headers/ICMP.js +148 -0
  123. package/dist/headers/ICMPv6.d.ts +15 -0
  124. package/dist/headers/ICMPv6.js +129 -0
  125. package/dist/headers/IEC104_I_Frame.d.ts +23 -0
  126. package/dist/headers/IEC104_I_Frame.js +6489 -0
  127. package/dist/headers/IEC104_S_Frame.d.ts +26 -0
  128. package/dist/headers/IEC104_S_Frame.js +135 -0
  129. package/dist/headers/IEC104_U_Frame.d.ts +27 -0
  130. package/dist/headers/IEC104_U_Frame.js +176 -0
  131. package/dist/headers/IEC61850SampledValues.d.ts +20 -0
  132. package/dist/headers/IEC61850SampledValues.js +420 -0
  133. package/dist/headers/IGMP.d.ts +31 -0
  134. package/dist/headers/IGMP.js +274 -0
  135. package/dist/headers/IMAP.d.ts +32 -0
  136. package/dist/headers/IMAP.js +185 -0
  137. package/dist/headers/IPFIX.d.ts +29 -0
  138. package/dist/headers/IPFIX.js +156 -0
  139. package/dist/headers/IPv4.d.ts +20 -0
  140. package/dist/headers/IPv4.js +370 -0
  141. package/dist/headers/IPv6.d.ts +29 -0
  142. package/dist/headers/IPv6.js +209 -0
  143. package/dist/headers/IPv6HopByHopOptions.d.ts +81 -0
  144. package/dist/headers/IPv6HopByHopOptions.js +495 -0
  145. package/dist/headers/IRC.d.ts +34 -0
  146. package/dist/headers/IRC.js +175 -0
  147. package/dist/headers/ISAKMP.d.ts +29 -0
  148. package/dist/headers/ISAKMP.js +197 -0
  149. package/dist/headers/ISCSI.d.ts +39 -0
  150. package/dist/headers/ISCSI.js +289 -0
  151. package/dist/headers/ISIS.d.ts +25 -0
  152. package/dist/headers/ISIS.js +79 -0
  153. package/dist/headers/ISOSession.d.ts +27 -0
  154. package/dist/headers/ISOSession.js +343 -0
  155. package/dist/headers/Ident.d.ts +42 -0
  156. package/dist/headers/Ident.js +184 -0
  157. package/dist/headers/KNXnetIP.d.ts +30 -0
  158. package/dist/headers/KNXnetIP.js +135 -0
  159. package/dist/headers/Kafka.d.ts +35 -0
  160. package/dist/headers/Kafka.js +128 -0
  161. package/dist/headers/Kerberos.d.ts +30 -0
  162. package/dist/headers/Kerberos.js +217 -0
  163. package/dist/headers/L2TP.d.ts +26 -0
  164. package/dist/headers/L2TP.js +297 -0
  165. package/dist/headers/LACP.d.ts +31 -0
  166. package/dist/headers/LACP.js +151 -0
  167. package/dist/headers/LDAP.d.ts +31 -0
  168. package/dist/headers/LDAP.js +226 -0
  169. package/dist/headers/LDP.d.ts +31 -0
  170. package/dist/headers/LDP.js +138 -0
  171. package/dist/headers/LISP.d.ts +30 -0
  172. package/dist/headers/LISP.js +103 -0
  173. package/dist/headers/LLC.d.ts +27 -0
  174. package/dist/headers/LLC.js +81 -0
  175. package/dist/headers/LLDP.d.ts +26 -0
  176. package/dist/headers/LLDP.js +126 -0
  177. package/dist/headers/LLMNR.d.ts +23 -0
  178. package/dist/headers/LLMNR.js +40 -0
  179. package/dist/headers/LPD.d.ts +31 -0
  180. package/dist/headers/LPD.js +159 -0
  181. package/dist/headers/MACsec.d.ts +34 -0
  182. package/dist/headers/MACsec.js +178 -0
  183. package/dist/headers/MDNS.d.ts +26 -0
  184. package/dist/headers/MDNS.js +45 -0
  185. package/dist/headers/MGCP.d.ts +30 -0
  186. package/dist/headers/MGCP.js +155 -0
  187. package/dist/headers/MMS.d.ts +29 -0
  188. package/dist/headers/MMS.js +243 -0
  189. package/dist/headers/MPLS.d.ts +31 -0
  190. package/dist/headers/MPLS.js +145 -0
  191. package/dist/headers/MQTT.d.ts +30 -0
  192. package/dist/headers/MQTT.js +173 -0
  193. package/dist/headers/MQTTSN.d.ts +34 -0
  194. package/dist/headers/MQTTSN.js +177 -0
  195. package/dist/headers/MarkerProtocol.d.ts +32 -0
  196. package/dist/headers/MarkerProtocol.js +153 -0
  197. package/dist/headers/Megaco.d.ts +32 -0
  198. package/dist/headers/Megaco.js +144 -0
  199. package/dist/headers/Memcached.d.ts +44 -0
  200. package/dist/headers/Memcached.js +285 -0
  201. package/dist/headers/ModbusTCP.d.ts +25 -0
  202. package/dist/headers/ModbusTCP.js +99 -0
  203. package/dist/headers/ModbusUDP.d.ts +26 -0
  204. package/dist/headers/ModbusUDP.js +100 -0
  205. package/dist/headers/MongoDB.d.ts +33 -0
  206. package/dist/headers/MongoDB.js +143 -0
  207. package/dist/headers/MySQL.d.ts +30 -0
  208. package/dist/headers/MySQL.js +114 -0
  209. package/dist/headers/NATS.d.ts +29 -0
  210. package/dist/headers/NATS.js +135 -0
  211. package/dist/headers/NBDS.d.ts +34 -0
  212. package/dist/headers/NBDS.js +176 -0
  213. package/dist/headers/NBNS.d.ts +34 -0
  214. package/dist/headers/NBNS.js +78 -0
  215. package/dist/headers/NBSS.d.ts +36 -0
  216. package/dist/headers/NBSS.js +137 -0
  217. package/dist/headers/NFS.d.ts +36 -0
  218. package/dist/headers/NFS.js +273 -0
  219. package/dist/headers/NHRP.d.ts +32 -0
  220. package/dist/headers/NHRP.js +154 -0
  221. package/dist/headers/NNTP.d.ts +35 -0
  222. package/dist/headers/NNTP.js +162 -0
  223. package/dist/headers/NTP.d.ts +18 -0
  224. package/dist/headers/NTP.js +73 -0
  225. package/dist/headers/NetFlowV5.d.ts +28 -0
  226. package/dist/headers/NetFlowV5.js +205 -0
  227. package/dist/headers/OLSR.d.ts +31 -0
  228. package/dist/headers/OLSR.js +213 -0
  229. package/dist/headers/OPCUA.d.ts +33 -0
  230. package/dist/headers/OPCUA.js +165 -0
  231. package/dist/headers/OPCUAPubSub.d.ts +33 -0
  232. package/dist/headers/OPCUAPubSub.js +144 -0
  233. package/dist/headers/OSPF.d.ts +31 -0
  234. package/dist/headers/OSPF.js +365 -0
  235. package/dist/headers/OmronFINS.d.ts +31 -0
  236. package/dist/headers/OmronFINS.js +90 -0
  237. package/dist/headers/OpenFlow.d.ts +30 -0
  238. package/dist/headers/OpenFlow.js +113 -0
  239. package/dist/headers/OpenVPN.d.ts +35 -0
  240. package/dist/headers/OpenVPN.js +214 -0
  241. package/dist/headers/PCWorx.d.ts +35 -0
  242. package/dist/headers/PCWorx.js +115 -0
  243. package/dist/headers/PIM.d.ts +27 -0
  244. package/dist/headers/PIM.js +129 -0
  245. package/dist/headers/POP3.d.ts +31 -0
  246. package/dist/headers/POP3.js +152 -0
  247. package/dist/headers/POWERLINK.d.ts +28 -0
  248. package/dist/headers/POWERLINK.js +116 -0
  249. package/dist/headers/PPPoEDiscovery.d.ts +29 -0
  250. package/dist/headers/PPPoEDiscovery.js +198 -0
  251. package/dist/headers/PPPoESession.d.ts +28 -0
  252. package/dist/headers/PPPoESession.js +125 -0
  253. package/dist/headers/PPTP.d.ts +30 -0
  254. package/dist/headers/PPTP.js +122 -0
  255. package/dist/headers/PROFINETRT.d.ts +28 -0
  256. package/dist/headers/PROFINETRT.js +74 -0
  257. package/dist/headers/PTP.d.ts +34 -0
  258. package/dist/headers/PTP.js +213 -0
  259. package/dist/headers/PostgreSQL.d.ts +40 -0
  260. package/dist/headers/PostgreSQL.js +236 -0
  261. package/dist/headers/QUIC.d.ts +34 -0
  262. package/dist/headers/QUIC.js +308 -0
  263. package/dist/headers/RADIUS.d.ts +24 -0
  264. package/dist/headers/RADIUS.js +138 -0
  265. package/dist/headers/RDP.d.ts +27 -0
  266. package/dist/headers/RDP.js +93 -0
  267. package/dist/headers/RFB.d.ts +39 -0
  268. package/dist/headers/RFB.js +151 -0
  269. package/dist/headers/RGoose.d.ts +72 -0
  270. package/dist/headers/RGoose.js +340 -0
  271. package/dist/headers/RIP.d.ts +29 -0
  272. package/dist/headers/RIP.js +133 -0
  273. package/dist/headers/RIPng.d.ts +26 -0
  274. package/dist/headers/RIPng.js +140 -0
  275. package/dist/headers/RMCP.d.ts +26 -0
  276. package/dist/headers/RMCP.js +155 -0
  277. package/dist/headers/RSVP.d.ts +31 -0
  278. package/dist/headers/RSVP.js +263 -0
  279. package/dist/headers/RTCP.d.ts +34 -0
  280. package/dist/headers/RTCP.js +217 -0
  281. package/dist/headers/RTP.d.ts +33 -0
  282. package/dist/headers/RTP.js +291 -0
  283. package/dist/headers/RTPS.d.ts +33 -0
  284. package/dist/headers/RTPS.js +182 -0
  285. package/dist/headers/RTSP.d.ts +36 -0
  286. package/dist/headers/RTSP.js +184 -0
  287. package/dist/headers/RawData.d.ts +17 -0
  288. package/dist/headers/RawData.js +43 -0
  289. package/dist/headers/Redis.d.ts +32 -0
  290. package/dist/headers/Redis.js +202 -0
  291. package/dist/headers/Rlogin.d.ts +42 -0
  292. package/dist/headers/Rlogin.js +139 -0
  293. package/dist/headers/Rsync.d.ts +28 -0
  294. package/dist/headers/Rsync.js +117 -0
  295. package/dist/headers/S7comm.d.ts +36 -0
  296. package/dist/headers/S7comm.js +244 -0
  297. package/dist/headers/SCTP.d.ts +35 -0
  298. package/dist/headers/SCTP.js +174 -0
  299. package/dist/headers/SFlow.d.ts +29 -0
  300. package/dist/headers/SFlow.js +242 -0
  301. package/dist/headers/SIP.d.ts +27 -0
  302. package/dist/headers/SIP.js +146 -0
  303. package/dist/headers/SLMP.d.ts +36 -0
  304. package/dist/headers/SLMP.js +154 -0
  305. package/dist/headers/SLP.d.ts +30 -0
  306. package/dist/headers/SLP.js +207 -0
  307. package/dist/headers/SLPv1.d.ts +32 -0
  308. package/dist/headers/SLPv1.js +138 -0
  309. package/dist/headers/SMB1.d.ts +37 -0
  310. package/dist/headers/SMB1.js +200 -0
  311. package/dist/headers/SMB2.d.ts +36 -0
  312. package/dist/headers/SMB2.js +203 -0
  313. package/dist/headers/SMPP.d.ts +33 -0
  314. package/dist/headers/SMPP.js +119 -0
  315. package/dist/headers/SMTP.d.ts +33 -0
  316. package/dist/headers/SMTP.js +157 -0
  317. package/dist/headers/SNAP.d.ts +22 -0
  318. package/dist/headers/SNAP.js +68 -0
  319. package/dist/headers/SNMP.d.ts +28 -0
  320. package/dist/headers/SNMP.js +302 -0
  321. package/dist/headers/SOCKS4.d.ts +42 -0
  322. package/dist/headers/SOCKS4.js +302 -0
  323. package/dist/headers/SOCKS5.d.ts +45 -0
  324. package/dist/headers/SOCKS5.js +223 -0
  325. package/dist/headers/SSDP.d.ts +27 -0
  326. package/dist/headers/SSDP.js +161 -0
  327. package/dist/headers/SSH.d.ts +44 -0
  328. package/dist/headers/SSH.js +274 -0
  329. package/dist/headers/STOMP.d.ts +48 -0
  330. package/dist/headers/STOMP.js +177 -0
  331. package/dist/headers/STP.d.ts +26 -0
  332. package/dist/headers/STP.js +150 -0
  333. package/dist/headers/STUN.d.ts +25 -0
  334. package/dist/headers/STUN.js +183 -0
  335. package/dist/headers/SercosIII.d.ts +43 -0
  336. package/dist/headers/SercosIII.js +199 -0
  337. package/dist/headers/Skinny.d.ts +32 -0
  338. package/dist/headers/Skinny.js +139 -0
  339. package/dist/headers/StatsD.d.ts +27 -0
  340. package/dist/headers/StatsD.js +134 -0
  341. package/dist/headers/SunRPC.d.ts +34 -0
  342. package/dist/headers/SunRPC.js +268 -0
  343. package/dist/headers/Syslog.d.ts +21 -0
  344. package/dist/headers/Syslog.js +91 -0
  345. package/dist/headers/TCP.d.ts +19 -0
  346. package/dist/headers/TCP.js +905 -0
  347. package/dist/headers/TFTP.d.ts +28 -0
  348. package/dist/headers/TFTP.js +224 -0
  349. package/dist/headers/TLS_Alert.d.ts +24 -0
  350. package/dist/headers/TLS_Alert.js +639 -0
  351. package/dist/headers/TLS_ApplicationData.d.ts +24 -0
  352. package/dist/headers/TLS_ApplicationData.js +170 -0
  353. package/dist/headers/TLS_ChangeCipherSpec.d.ts +23 -0
  354. package/dist/headers/TLS_ChangeCipherSpec.js +168 -0
  355. package/dist/headers/TLS_Handshake.d.ts +65 -0
  356. package/dist/headers/TLS_Handshake.js +860 -0
  357. package/dist/headers/TLS_Heartbeat.d.ts +27 -0
  358. package/dist/headers/TLS_Heartbeat.js +247 -0
  359. package/dist/headers/TPKT.d.ts +26 -0
  360. package/dist/headers/TPKT.js +99 -0
  361. package/dist/headers/TacacsPlus.d.ts +27 -0
  362. package/dist/headers/TacacsPlus.js +133 -0
  363. package/dist/headers/Telnet.d.ts +40 -0
  364. package/dist/headers/Telnet.js +193 -0
  365. package/dist/headers/Teredo.d.ts +40 -0
  366. package/dist/headers/Teredo.js +251 -0
  367. package/dist/headers/TimeProtocol.d.ts +25 -0
  368. package/dist/headers/TimeProtocol.js +53 -0
  369. package/dist/headers/UDP.d.ts +19 -0
  370. package/dist/headers/UDP.js +171 -0
  371. package/dist/headers/VLAN_802dot1Q.d.ts +24 -0
  372. package/dist/headers/VLAN_802dot1Q.js +96 -0
  373. package/dist/headers/VRRP.d.ts +26 -0
  374. package/dist/headers/VRRP.js +309 -0
  375. package/dist/headers/VXLAN.d.ts +24 -0
  376. package/dist/headers/VXLAN.js +75 -0
  377. package/dist/headers/WCCP.d.ts +29 -0
  378. package/dist/headers/WCCP.js +117 -0
  379. package/dist/headers/WHOIS.d.ts +37 -0
  380. package/dist/headers/WHOIS.js +126 -0
  381. package/dist/headers/WSDiscovery.d.ts +29 -0
  382. package/dist/headers/WSDiscovery.js +118 -0
  383. package/dist/headers/WakeOnLAN.d.ts +30 -0
  384. package/dist/headers/WakeOnLAN.js +126 -0
  385. package/dist/headers/WebSocket.d.ts +26 -0
  386. package/dist/headers/WebSocket.js +173 -0
  387. package/dist/headers/WireGuard.d.ts +38 -0
  388. package/dist/headers/WireGuard.js +216 -0
  389. package/dist/headers/XMPP.d.ts +37 -0
  390. package/dist/headers/XMPP.js +149 -0
  391. package/dist/headers/Zabbix.d.ts +35 -0
  392. package/dist/headers/Zabbix.js +153 -0
  393. package/dist/headers/cms/AcsiPdu.d.ts +45 -0
  394. package/dist/headers/cms/AcsiPdu.js +112 -0
  395. package/dist/headers/cms/PerDecoder.d.ts +68 -0
  396. package/dist/headers/cms/PerDecoder.js +211 -0
  397. package/dist/headers/cms/PerReader.d.ts +64 -0
  398. package/dist/headers/cms/PerReader.js +155 -0
  399. package/dist/helper/BufferToHex.d.ts +5 -0
  400. package/dist/helper/BufferToHex.js +10 -0
  401. package/dist/helper/BufferToIP.d.ts +12 -0
  402. package/dist/helper/BufferToIP.js +23 -0
  403. package/dist/helper/BufferToNumber.d.ts +18 -0
  404. package/dist/helper/BufferToNumber.js +47 -0
  405. package/dist/helper/HexToBuffer.d.ts +7 -0
  406. package/dist/helper/HexToBuffer.js +27 -0
  407. package/dist/helper/HexToNumber.d.ts +18 -0
  408. package/dist/helper/HexToNumber.js +48 -0
  409. package/dist/helper/IPToBuffer.d.ts +12 -0
  410. package/dist/helper/IPToBuffer.js +34 -0
  411. package/dist/helper/NumberToBERBuffer.d.ts +18 -0
  412. package/dist/helper/NumberToBERBuffer.js +31 -0
  413. package/dist/helper/NumberToBERHex.d.ts +18 -0
  414. package/dist/helper/NumberToBERHex.js +52 -0
  415. package/dist/helper/NumberToBuffer.d.ts +18 -0
  416. package/dist/helper/NumberToBuffer.js +38 -0
  417. package/dist/helper/NumberToHex.d.ts +18 -0
  418. package/dist/helper/NumberToHex.js +35 -0
  419. package/dist/index.d.ts +52 -0
  420. package/dist/index.js +113 -0
  421. package/dist/lib/FlexibleObject.d.ts +27 -0
  422. package/dist/lib/FlexibleObject.js +113 -0
  423. package/dist/lib/GetBERIntegerLengthFromBuffer.d.ts +6 -0
  424. package/dist/lib/GetBERIntegerLengthFromBuffer.js +16 -0
  425. package/dist/lib/ProcessPacketPostHandlers.d.ts +13 -0
  426. package/dist/lib/ProcessPacketPostHandlers.js +53 -0
  427. package/dist/lib/SortPostHandlers.d.ts +7 -0
  428. package/dist/lib/SortPostHandlers.js +11 -0
  429. package/dist/lib/StringContentEncodingEnum.d.ts +10 -0
  430. package/dist/lib/StringContentEncodingEnum.js +14 -0
  431. package/dist/schema/ProtocolFieldJSONSchema.d.ts +35 -0
  432. package/dist/schema/ProtocolFieldJSONSchema.js +2 -0
  433. package/dist/schema/ProtocolFieldJSONSchemaDefinition.d.ts +2 -0
  434. package/dist/schema/ProtocolFieldJSONSchemaDefinition.js +2 -0
  435. package/dist/schema/ProtocolJSONSchema.d.ts +32 -0
  436. package/dist/schema/ProtocolJSONSchema.js +2 -0
  437. package/dist/types/CodecData.d.ts +7 -0
  438. package/dist/types/CodecData.js +2 -0
  439. package/dist/types/CodecDecodeResult.d.ts +10 -0
  440. package/dist/types/CodecDecodeResult.js +2 -0
  441. package/dist/types/CodecEncodeInput.d.ts +2 -0
  442. package/dist/types/CodecEncodeInput.js +2 -0
  443. package/dist/types/CodecEncodeResult.d.ts +5 -0
  444. package/dist/types/CodecEncodeResult.js +2 -0
  445. package/dist/types/CodecErrorInfo.d.ts +5 -0
  446. package/dist/types/CodecErrorInfo.js +2 -0
  447. package/dist/types/CodecModule.d.ts +2 -0
  448. package/dist/types/CodecModule.js +2 -0
  449. package/dist/types/CodecModuleConstructor.d.ts +2 -0
  450. package/dist/types/CodecModuleConstructor.js +2 -0
  451. package/dist/types/CodecSchema.d.ts +6 -0
  452. package/dist/types/CodecSchema.js +2 -0
  453. package/dist/types/DemuxProducer.d.ts +23 -0
  454. package/dist/types/DemuxProducer.js +2 -0
  455. package/dist/types/Dissection.d.ts +23 -0
  456. package/dist/types/Dissection.js +2 -0
  457. package/dist/types/HeaderTreeNode.d.ts +4 -0
  458. package/dist/types/HeaderTreeNode.js +2 -0
  459. package/dist/types/LayerGraph.d.ts +32 -0
  460. package/dist/types/LayerGraph.js +2 -0
  461. package/dist/types/PostHandlerItem.d.ts +4 -0
  462. package/dist/types/PostHandlerItem.js +2 -0
  463. package/package.json +141 -0
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VXLAN = void 0;
4
+ const BaseHeader_1 = require("../abstracts/BaseHeader");
5
+ /**
6
+ * VXLAN — Virtual eXtensible LAN (RFC 7348), a Layer-2-over-UDP overlay on UDP port 4789. An 8-byte
7
+ * header — Flags(1, the 'I' bit marks the VNI valid), 3 reserved bytes, the 24-bit VNI (VXLAN Network
8
+ * Identifier), and 1 reserved byte — is followed by a COMPLETE inner Ethernet frame.
9
+ *
10
+ * This codec decodes only its own 8-byte header (headerLength = 8); the inner Ethernet frame is left to
11
+ * the codec's normal recursion, which decodes it as a fresh eth/ip/… stack. That works because
12
+ * EthernetII.match() already accepts a tunnel (vxlan/gre/geneve/…) as its parent — the demux
13
+ * generalization anticipates tunnels — so an inner Ethernet frame after VXLAN is dispatched to
14
+ * EthernetII automatically. The whole nested packet round-trips byte-for-byte layer by layer.
15
+ */
16
+ class VXLAN extends BaseHeader_1.BaseHeader {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.id = 'vxlan';
20
+ this.name = 'Virtual eXtensible Local Area Network';
21
+ this.nickname = 'VXLAN';
22
+ this.matchKeys = ['udpport:4789'];
23
+ //Produces no demux key of its own; the inner Ethernet frame is matched by EthernetII's tunnel-aware
24
+ //match() (which lists 'vxlan' as an accepted parent), so recursion decodes the inner stack.
25
+ this.demuxProducers = [];
26
+ }
27
+ static #schemaCache;
28
+ get SCHEMA() {
29
+ return (VXLAN.#schemaCache ??= VXLAN.#buildSchema());
30
+ }
31
+ static #buildSchema() {
32
+ return {
33
+ type: 'object',
34
+ summary: 'VXLAN vni=${vni}',
35
+ properties: {
36
+ flags: this.fieldUInt('flags', 0, 1, 'Flags'),
37
+ reserved1: this.fieldHex('reserved1', 1, 3, 'Reserved'),
38
+ vni: {
39
+ type: 'integer',
40
+ label: 'VNI',
41
+ minimum: 0,
42
+ maximum: 16777215,
43
+ decode: function () {
44
+ this.instance.vni.setValue(this.readBits(4, 3, 0, 24));
45
+ },
46
+ encode: function () {
47
+ let vni = this.instance.vni.getValue(0);
48
+ if (vni > 16777215) {
49
+ this.recordError(this.instance.vni.getPath(), 'Maximum value is 16777215');
50
+ vni = 16777215;
51
+ }
52
+ if (vni < 0) {
53
+ this.recordError(this.instance.vni.getPath(), 'Minimum value is 0');
54
+ vni = 0;
55
+ }
56
+ this.instance.vni.setValue(vni);
57
+ this.writeBits(4, 3, 0, 24, vni);
58
+ }
59
+ },
60
+ reserved2: this.fieldHex('reserved2', 7, 1, 'Reserved')
61
+ }
62
+ };
63
+ }
64
+ match() {
65
+ if (!this.prevCodecModule || this.prevCodecModule.id !== 'udp')
66
+ return false;
67
+ //Require the 8-byte header within the UDP payload (not just the captured frame — see RADIUS).
68
+ let available = this.packet.length - this.startPos;
69
+ const udpLength = this.prevCodecModule.instance.length.getValue(0);
70
+ if (udpLength >= 8 && udpLength - 8 < available)
71
+ available = udpLength - 8;
72
+ return available >= 8;
73
+ }
74
+ }
75
+ exports.VXLAN = VXLAN;
@@ -0,0 +1,29 @@
1
+ import { BaseHeader } from '../abstracts/BaseHeader';
2
+ import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
3
+ import { DemuxProducer } from '../types/DemuxProducer';
4
+ /**
5
+ * WCCP v2 — Web Cache Communication Protocol version 2 (Cisco, draft-wilson-wrec-wccp-v2), carried over
6
+ * UDP port 2048. Every WCCP v2 message begins with a fixed 8-byte header — a 4-byte message Type
7
+ * (0x0000000A Here-I-Am, 0x0000000B I-See-You, 0x0000000C Redirect-Assign, 0x0000000D Removal-Query),
8
+ * a 2-byte Version (0x0200 for WCCP v2) and a 2-byte Length (the octet count of the component data that
9
+ * follows the header, NOT including these 8 bytes) — followed by a sequence of component TLVs (each a
10
+ * 2-byte component Type, a 2-byte component Length, and a value).
11
+ *
12
+ * The component layout differs per message type and per component (Security Info, Service Info,
13
+ * Web-Cache/Router Identity, Assignment, Capabilities, Command Extension) and several sub-structures
14
+ * need cross-message context, so this codec keeps the component region verbatim as `components` hex
15
+ * (byte-perfect) and does not sub-decode it. The Length is honored when supplied (a crafted message may
16
+ * lie) and derived from the component bytes only when absent; the message is bounded by BOTH Length and
17
+ * the UDP payload so a trailing datagram / padding is left to the codec's recursion / RawData. A
18
+ * well-formed message round-trips byte-for-byte. This is a leaf header — nothing demuxes off WCCP.
19
+ */
20
+ export declare class WCCP extends BaseHeader {
21
+ #private;
22
+ get SCHEMA(): ProtocolJSONSchema;
23
+ readonly id: string;
24
+ readonly name: string;
25
+ readonly nickname: string;
26
+ readonly matchKeys: string[];
27
+ match(): boolean;
28
+ readonly demuxProducers: DemuxProducer[];
29
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WCCP = 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 NumberToBuffer_1 = require("../helper/NumberToBuffer");
8
+ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
9
+ /**
10
+ * WCCP v2 — Web Cache Communication Protocol version 2 (Cisco, draft-wilson-wrec-wccp-v2), carried over
11
+ * UDP port 2048. Every WCCP v2 message begins with a fixed 8-byte header — a 4-byte message Type
12
+ * (0x0000000A Here-I-Am, 0x0000000B I-See-You, 0x0000000C Redirect-Assign, 0x0000000D Removal-Query),
13
+ * a 2-byte Version (0x0200 for WCCP v2) and a 2-byte Length (the octet count of the component data that
14
+ * follows the header, NOT including these 8 bytes) — followed by a sequence of component TLVs (each a
15
+ * 2-byte component Type, a 2-byte component Length, and a value).
16
+ *
17
+ * The component layout differs per message type and per component (Security Info, Service Info,
18
+ * Web-Cache/Router Identity, Assignment, Capabilities, Command Extension) and several sub-structures
19
+ * need cross-message context, so this codec keeps the component region verbatim as `components` hex
20
+ * (byte-perfect) and does not sub-decode it. The Length is honored when supplied (a crafted message may
21
+ * lie) and derived from the component bytes only when absent; the message is bounded by BOTH Length and
22
+ * the UDP payload so a trailing datagram / padding is left to the codec's recursion / RawData. A
23
+ * well-formed message round-trips byte-for-byte. This is a leaf header — nothing demuxes off WCCP.
24
+ */
25
+ class WCCP extends BaseHeader_1.BaseHeader {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.id = 'wccp';
29
+ this.name = 'Web Cache Communication Protocol';
30
+ this.nickname = 'WCCP';
31
+ //Port-defined (udp:2048). WCCP v2 does carry a content signature (Version = 0x0200), but that alone
32
+ //is weak, so it stays a plain bucket entry (no heuristicFallback): WCCP only when it rides UDP/2048.
33
+ this.matchKeys = ['udpport:2048'];
34
+ //A leaf header — the component TLVs require per-type, cross-message parsing and are kept verbatim.
35
+ this.demuxProducers = [];
36
+ }
37
+ static #schemaCache;
38
+ get SCHEMA() {
39
+ return (WCCP.#schemaCache ??= WCCP.#buildSchema());
40
+ }
41
+ /** Bytes available for this WCCP message: the frame end, clamped by the UDP payload length. */
42
+ #available() {
43
+ let available = this.packet.length - this.startPos;
44
+ if (this.prevCodecModule && this.prevCodecModule.id === 'udp') {
45
+ const udpLength = this.prevCodecModule.instance.length.getValue(0);
46
+ if (udpLength >= 8 && udpLength - 8 < available)
47
+ available = udpLength - 8;
48
+ }
49
+ return available < 0 ? 0 : available;
50
+ }
51
+ static #buildSchema() {
52
+ return {
53
+ type: 'object',
54
+ summary: 'WCCP type=${type} len=${length}',
55
+ properties: {
56
+ type: this.fieldUInt('type', 0, 4, 'Type'),
57
+ version: this.fieldUInt('version', 4, 2, 'Version'),
58
+ length: {
59
+ type: 'integer',
60
+ label: 'Length',
61
+ minimum: 0,
62
+ maximum: 65535,
63
+ decode: function () {
64
+ this.instance.length.setValue(this.readBytes(6, 2).readUInt16BE(0));
65
+ },
66
+ encode: function () {
67
+ //Length counts only the component data after the 8-byte header. Honored when
68
+ //supplied (a crafted message may lie); else derived from the component bytes.
69
+ const provided = this.instance.length.getValue();
70
+ let value = (provided !== undefined && provided !== null)
71
+ ? provided
72
+ : (0, HexToBuffer_1.HexToBuffer)(this.instance.components.getValue('')).length;
73
+ if (value > 65535) {
74
+ this.recordError(this.instance.length.getPath(), 'Maximum value is 65535');
75
+ value = 65535;
76
+ }
77
+ if (value < 0) {
78
+ this.recordError(this.instance.length.getPath(), 'Minimum value is 0');
79
+ value = 0;
80
+ }
81
+ this.instance.length.setValue(value);
82
+ this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
83
+ }
84
+ },
85
+ //The component TLV region after the 8-byte header, kept verbatim. Bounded by BOTH the
86
+ //message Length (the message ends at 8 + Length) and the UDP payload, so trailing /
87
+ //pipelined data is left to the codec's recursion / RawData.
88
+ components: {
89
+ type: 'string',
90
+ label: 'Components',
91
+ contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
92
+ decode: function () {
93
+ const available = this.#available();
94
+ const length = this.instance.length.getValue(0);
95
+ let end = 8 + length;
96
+ if (end > available)
97
+ end = available;
98
+ this.instance.components.setValue(end > 8 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(8, end - 8)) : '');
99
+ },
100
+ encode: function () {
101
+ const components = this.instance.components.getValue('');
102
+ if (components)
103
+ this.writeBytes(8, (0, HexToBuffer_1.HexToBuffer)(components));
104
+ }
105
+ }
106
+ }
107
+ };
108
+ }
109
+ match() {
110
+ //WCCP rides on UDP port 2048. Require the full 8-byte header within the UDP payload (bounded by
111
+ //udp.length, not the whole frame remainder, so Ethernet padding is not mis-claimed).
112
+ if (!this.prevCodecModule || this.prevCodecModule.id !== 'udp')
113
+ return false;
114
+ return this.#available() >= 8;
115
+ }
116
+ }
117
+ exports.WCCP = WCCP;
@@ -0,0 +1,37 @@
1
+ import { BaseHeader } from '../abstracts/BaseHeader';
2
+ import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
3
+ import { DemuxProducer } from '../types/DemuxProducer';
4
+ /**
5
+ * WHOIS — the WHOIS Protocol (RFC 3912), carried over TCP well-known port 43. WHOIS is deliberately
6
+ * trivial on the wire: the client opens the connection and sends a single US-ASCII request line
7
+ * `<query>\r\n` (e.g. `example.com\r\n`); the server replies with free-form US-ASCII text (the registry
8
+ * record, terminated by the server closing the connection). There is no framing, no length prefix, and
9
+ * no content magic in either direction — a request is just a line of text and a response is just text.
10
+ *
11
+ * MINIMAL slice (mirrors the SSH-identification / Telnet verbatim-message pattern): the stream has no
12
+ * per-message structure, so the ENTIRE payload is the single source of truth — decoded verbatim to hex
13
+ * in the authoritative `message` field and re-emitted byte-for-byte on encode. On top of that, the first
14
+ * line of the payload is parsed into a DISPLAY-ONLY `query` field (the request domain, or the first line
15
+ * of a response) and an `isQuery` flag (true when the whole payload is a single CR-LF-terminated line —
16
+ * the classic request shape). Those display fields carry no codec of their own and never reconstruct the
17
+ * bytes — the `message` owns them. So any WHOIS payload (a request line, a multi-line response record, or
18
+ * a truncated fragment) round-trips exactly.
19
+ *
20
+ * Matching rationale (NO heuristicFallback): WHOIS is claimed ONLY on the tcp:43 bucket. WHOIS has NO
21
+ * distinctive off-port content signature — a request is an arbitrary domain line and a response is
22
+ * arbitrary text, indistinguishable from any other line-oriented TCP payload — so recognizing it relies
23
+ * entirely on the well-known port. Joining the global content-heuristic chain would let WHOIS mislabel
24
+ * arbitrary TCP payloads on any port. Confining WHOIS to tcp:43 keeps that impossible; alt-port WHOIS is
25
+ * rare and falls losslessly to raw. For the same reason match() does NOT gate on printable text: on the
26
+ * port-43 bucket every payload IS WHOIS, so any non-empty payload is kept verbatim rather than dropped.
27
+ */
28
+ export declare class WHOIS extends BaseHeader {
29
+ #private;
30
+ get SCHEMA(): ProtocolJSONSchema;
31
+ readonly id: string;
32
+ readonly name: string;
33
+ readonly nickname: string;
34
+ readonly matchKeys: string[];
35
+ match(): boolean;
36
+ readonly demuxProducers: DemuxProducer[];
37
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WHOIS = 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
+ * WHOIS — the WHOIS Protocol (RFC 3912), carried over TCP well-known port 43. WHOIS is deliberately
10
+ * trivial on the wire: the client opens the connection and sends a single US-ASCII request line
11
+ * `<query>\r\n` (e.g. `example.com\r\n`); the server replies with free-form US-ASCII text (the registry
12
+ * record, terminated by the server closing the connection). There is no framing, no length prefix, and
13
+ * no content magic in either direction — a request is just a line of text and a response is just text.
14
+ *
15
+ * MINIMAL slice (mirrors the SSH-identification / Telnet verbatim-message pattern): the stream has no
16
+ * per-message structure, so the ENTIRE payload is the single source of truth — decoded verbatim to hex
17
+ * in the authoritative `message` field and re-emitted byte-for-byte on encode. On top of that, the first
18
+ * line of the payload is parsed into a DISPLAY-ONLY `query` field (the request domain, or the first line
19
+ * of a response) and an `isQuery` flag (true when the whole payload is a single CR-LF-terminated line —
20
+ * the classic request shape). Those display fields carry no codec of their own and never reconstruct the
21
+ * bytes — the `message` owns them. So any WHOIS payload (a request line, a multi-line response record, or
22
+ * a truncated fragment) round-trips exactly.
23
+ *
24
+ * Matching rationale (NO heuristicFallback): WHOIS is claimed ONLY on the tcp:43 bucket. WHOIS has NO
25
+ * distinctive off-port content signature — a request is an arbitrary domain line and a response is
26
+ * arbitrary text, indistinguishable from any other line-oriented TCP payload — so recognizing it relies
27
+ * entirely on the well-known port. Joining the global content-heuristic chain would let WHOIS mislabel
28
+ * arbitrary TCP payloads on any port. Confining WHOIS to tcp:43 keeps that impossible; alt-port WHOIS is
29
+ * rare and falls losslessly to raw. For the same reason match() does NOT gate on printable text: on the
30
+ * port-43 bucket every payload IS WHOIS, so any non-empty payload is kept verbatim rather than dropped.
31
+ */
32
+ class WHOIS extends BaseHeader_1.BaseHeader {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.id = 'whois';
36
+ this.name = 'WHOIS';
37
+ this.nickname = 'WHOIS';
38
+ //WHOIS is recognized ONLY on the well-known port 43 — deliberately NOT via heuristicFallback. WHOIS
39
+ //is a line-oriented text stream with no distinctive off-port content signature (a request is an
40
+ //arbitrary domain and a response is arbitrary text), so its recognition depends entirely on the port
41
+ //bucket; joining the global heuristic chain would mislabel arbitrary TCP traffic. See the class doc.
42
+ this.matchKeys = ['tcpport:43'];
43
+ //A leaf header — a WHOIS request/response is the application data itself; nothing demuxes off it.
44
+ this.demuxProducers = [];
45
+ }
46
+ static #schemaCache;
47
+ get SCHEMA() {
48
+ return (WHOIS.#schemaCache ??= WHOIS.#buildSchema());
49
+ }
50
+ /** Bytes available to this header: WHOIS rides on TCP, which has no per-message length. */
51
+ #payloadLength() {
52
+ const available = this.packet.length - this.startPos;
53
+ return available < 0 ? 0 : available;
54
+ }
55
+ /**
56
+ * Parse the display-only metadata from the verbatim payload. `query` is the first line with its
57
+ * trailing CR/LF stripped (the request domain, or the opening line of a response). `isQuery` is true
58
+ * when the whole payload is exactly one CR-LF-terminated line — the classic client request shape.
59
+ * Populated on decode only — these fields have no encode, so they never affect the re-emitted bytes
60
+ * and never mutate `message`. Never throws: an empty or line-less payload yields an empty query.
61
+ */
62
+ #parseQuery(raw) {
63
+ const text = raw.toString('latin1');
64
+ let firstLine = text;
65
+ const lf = firstLine.indexOf('\n');
66
+ if (lf >= 0)
67
+ firstLine = firstLine.slice(0, lf);
68
+ if (firstLine.endsWith('\r'))
69
+ firstLine = firstLine.slice(0, -1);
70
+ this.instance.query.setValue(firstLine);
71
+ //The classic request is a single `<query>\r\n` line: exactly one line ending, at the very end.
72
+ const isQuery = (text.endsWith('\r\n') || text.endsWith('\n')) && text.indexOf('\n') === text.length - 1;
73
+ this.instance.isQuery.setValue(isQuery);
74
+ this.instance.summaryInfo.setValue(firstLine ? firstLine : (raw.length > 0 ? 'response' : ''));
75
+ }
76
+ static #buildSchema() {
77
+ return {
78
+ type: 'object',
79
+ summary: 'WHOIS ${summaryInfo}',
80
+ properties: {
81
+ //Display-only metadata parsed from the verbatim payload on decode (no encode — populated
82
+ //by the `message` field below, never read back). `query` is the first line (the request
83
+ //domain or a response's opening line); `isQuery` flags the single-line request shape.
84
+ isQuery: { type: 'boolean', label: 'Is Query', default: false },
85
+ query: { type: 'string', label: 'Query', default: '' },
86
+ //Drives the one-line summary: the first line of the payload, else 'response'.
87
+ summaryInfo: { type: 'string', label: 'Summary', hidden: true, default: '' },
88
+ //The whole raw payload is the single source of truth: decoded verbatim to hex and
89
+ //re-emitted untouched (byte-perfect for any WHOIS payload). The first line is parsed into
90
+ //the display-only metadata above, which carry no codec of their own.
91
+ message: {
92
+ type: 'string',
93
+ label: 'Message',
94
+ contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
95
+ default: '',
96
+ decode: function () {
97
+ const available = this.#payloadLength();
98
+ if (available <= 0) {
99
+ this.instance.message.setValue('');
100
+ this.#parseQuery(Buffer.alloc(0));
101
+ return;
102
+ }
103
+ const raw = this.readBytes(0, available);
104
+ this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
105
+ this.#parseQuery(raw);
106
+ },
107
+ encode: function () {
108
+ //Re-emit the authoritative payload verbatim — never reconstruct from metadata.
109
+ this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
110
+ }
111
+ }
112
+ }
113
+ };
114
+ }
115
+ match() {
116
+ //Reached only on the tcp:43 bucket. Port 43 IS WHOIS's, so any non-empty payload over TCP is
117
+ //claimed and kept verbatim (byte-perfect) — deliberately without a printable-text gate, so a
118
+ //non-ASCII fragment is never wrongly dropped to raw. An empty payload is not claimed.
119
+ if (!this.prevCodecModule)
120
+ return false;
121
+ if (this.prevCodecModule.id !== 'tcp')
122
+ return false;
123
+ return this.#payloadLength() >= 1;
124
+ }
125
+ }
126
+ exports.WHOIS = WHOIS;
@@ -0,0 +1,29 @@
1
+ import { BaseHeader } from '../abstracts/BaseHeader';
2
+ import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
3
+ import { DemuxProducer } from '../types/DemuxProducer';
4
+ /**
5
+ * WS-Discovery — Web Services Dynamic Discovery (OASIS, WS-Discovery 1.0/1.1), the multicast SOAP
6
+ * protocol devices use to announce themselves and find each other on a local link. Messages are SOAP
7
+ * 1.2 envelopes (XML) carried in UDP datagrams to the multicast group 239.255.255.250:3702 (IPv4) or
8
+ * [FF02::C]:3702 (IPv6). The five message kinds — Hello / Bye / Probe / ProbeMatches / Resolve /
9
+ * ResolveMatches — are distinguished only by the WS-Addressing `Action` URI inside the envelope, not by
10
+ * any binary framing.
11
+ *
12
+ * Like SIP and HTTP, the message body is XML whose full internal structure (namespaces, header blocks,
13
+ * an arbitrary SOAP body) is far richer than a form needs — and byte-exact whitespace/attribute ordering
14
+ * is significant to some peers and to any signature. So the ENTIRE raw datagram payload is kept verbatim
15
+ * as the authoritative `message` field (hex) and re-emitted untouched; only the WS-Addressing `Action`
16
+ * URI is parsed on decode into display-only metadata (the full Action and its short message type). Encode
17
+ * never reconstructs the XML from the parsed fields — it writes `message` back byte-for-byte — so any
18
+ * conformant (or even malformed) WS-Discovery datagram round-trips exactly.
19
+ */
20
+ export declare class WSDiscovery extends BaseHeader {
21
+ #private;
22
+ get SCHEMA(): ProtocolJSONSchema;
23
+ readonly id: string;
24
+ readonly name: string;
25
+ readonly nickname: string;
26
+ readonly matchKeys: string[];
27
+ match(): boolean;
28
+ readonly demuxProducers: DemuxProducer[];
29
+ }
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WSDiscovery = 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
+ * WS-Discovery — Web Services Dynamic Discovery (OASIS, WS-Discovery 1.0/1.1), the multicast SOAP
10
+ * protocol devices use to announce themselves and find each other on a local link. Messages are SOAP
11
+ * 1.2 envelopes (XML) carried in UDP datagrams to the multicast group 239.255.255.250:3702 (IPv4) or
12
+ * [FF02::C]:3702 (IPv6). The five message kinds — Hello / Bye / Probe / ProbeMatches / Resolve /
13
+ * ResolveMatches — are distinguished only by the WS-Addressing `Action` URI inside the envelope, not by
14
+ * any binary framing.
15
+ *
16
+ * Like SIP and HTTP, the message body is XML whose full internal structure (namespaces, header blocks,
17
+ * an arbitrary SOAP body) is far richer than a form needs — and byte-exact whitespace/attribute ordering
18
+ * is significant to some peers and to any signature. So the ENTIRE raw datagram payload is kept verbatim
19
+ * as the authoritative `message` field (hex) and re-emitted untouched; only the WS-Addressing `Action`
20
+ * URI is parsed on decode into display-only metadata (the full Action and its short message type). Encode
21
+ * never reconstructs the XML from the parsed fields — it writes `message` back byte-for-byte — so any
22
+ * conformant (or even malformed) WS-Discovery datagram round-trips exactly.
23
+ */
24
+ class WSDiscovery extends BaseHeader_1.BaseHeader {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.id = 'wsdiscovery';
28
+ this.name = 'Web Services Dynamic Discovery';
29
+ this.nickname = 'WS-Discovery';
30
+ this.matchKeys = ['udpport:3702'];
31
+ //A leaf header — the SOAP envelope's internals and the discovery exchange it belongs to are a
32
+ //higher-layer concern.
33
+ this.demuxProducers = [];
34
+ }
35
+ static #schemaCache;
36
+ get SCHEMA() {
37
+ return (WSDiscovery.#schemaCache ??= WSDiscovery.#buildSchema());
38
+ }
39
+ /**
40
+ * Bytes of this header: WS-Discovery rides on UDP, so the payload is bounded by the datagram length
41
+ * (so a retained FCS/padding is not absorbed); falls back to the rest of the packet if the UDP length
42
+ * is implausible. Never negative.
43
+ */
44
+ #payloadLength() {
45
+ let available = this.packet.length - this.startPos;
46
+ if (this.prevCodecModule && this.prevCodecModule.id === 'udp') {
47
+ const udpLength = this.prevCodecModule.instance.length.getValue(0);
48
+ if (udpLength >= 8 && udpLength - 8 < available)
49
+ available = udpLength - 8;
50
+ }
51
+ return available < 0 ? 0 : available;
52
+ }
53
+ /**
54
+ * Parse the WS-Addressing Action URI into the display-only metadata. The Action element is
55
+ * namespace-prefixed (e.g. `<wsa:Action>` or `<a:Action>`), so the prefix is matched loosely; the
56
+ * short message type is the last path segment of the URI (Probe / Hello / Bye / ProbeMatches / …).
57
+ * Populated on decode only — these fields have no encode, so they never affect the re-emitted bytes.
58
+ * Never throws: a missing Action yields empty strings.
59
+ */
60
+ #parseAction(text) {
61
+ const match = text.match(/<(?:[\w.-]+:)?Action\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?Action\s*>/);
62
+ const action = match ? match[1].trim() : '';
63
+ this.instance.action.setValue(action);
64
+ //Short message type = last non-empty path segment of the Action URI.
65
+ const segments = action.split('/').filter((segment) => segment.length > 0);
66
+ this.instance.messageType.setValue(segments.length > 0 ? segments[segments.length - 1] : '');
67
+ }
68
+ static #buildSchema() {
69
+ return {
70
+ type: 'object',
71
+ summary: 'WS-Discovery ${messageType}',
72
+ properties: {
73
+ //The whole raw datagram payload is the single source of truth: decoded verbatim to hex and
74
+ //re-emitted untouched (byte-perfect for any WS-Discovery message). The WS-Addressing
75
+ //Action is parsed into the display-only metadata below, which carry no codec of their own.
76
+ message: {
77
+ type: 'string',
78
+ label: 'Message',
79
+ contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
80
+ decode: function () {
81
+ const available = this.#payloadLength();
82
+ if (available <= 0) {
83
+ this.instance.message.setValue('');
84
+ this.#parseAction('');
85
+ return;
86
+ }
87
+ const raw = this.readBytes(0, available);
88
+ this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
89
+ this.#parseAction(raw.toString('latin1'));
90
+ },
91
+ encode: function () {
92
+ //Re-emit the authoritative message verbatim — never reconstruct from metadata.
93
+ this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
94
+ }
95
+ },
96
+ //Display-only metadata parsed from the WS-Addressing Action on decode (no encode —
97
+ //populated by the message field above, never read back). action is the full Action URI;
98
+ //messageType is its short trailing segment (Probe / Hello / Bye / …).
99
+ action: { type: 'string', label: 'Action' },
100
+ messageType: { type: 'string', label: 'Message Type' }
101
+ }
102
+ };
103
+ }
104
+ match() {
105
+ //WS-Discovery rides on UDP port 3702 as a SOAP/XML datagram. Recognize it by the XML signature:
106
+ //the payload's first non-whitespace byte is '<' (an XML declaration or the SOAP Envelope) — so
107
+ //non-XML traffic on port 3702 falls through to raw rather than claiming an un-decodable layer.
108
+ if (!this.prevCodecModule)
109
+ return false;
110
+ if (this.prevCodecModule.id !== 'udp')
111
+ return false;
112
+ if (this.#payloadLength() <= 0)
113
+ return false;
114
+ const lead = this.readBytes(0, 16, true).toString('latin1').replace(/^[\s\uFEFF]+/, '');
115
+ return lead.startsWith('<');
116
+ }
117
+ }
118
+ exports.WSDiscovery = WSDiscovery;
@@ -0,0 +1,30 @@
1
+ import { BaseHeader } from '../abstracts/BaseHeader';
2
+ import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
3
+ import { DemuxProducer } from '../types/DemuxProducer';
4
+ /**
5
+ * Wake-on-LAN "magic packet" (AMD Magic Packet Technology), carried directly in an Ethernet II frame
6
+ * with EtherType 0x0842 (an Ethernet child — no IP/UDP). The magic packet has a fixed shape: a 6-byte
7
+ * synchronization stream of all ones (0xFF ×6), followed by the target adapter's 6-byte MAC address
8
+ * repeated exactly 16 times (96 bytes), optionally followed by a 0/4/6-byte SecureOn password. There is
9
+ * no length field — the payload runs to the end of the frame.
10
+ *
11
+ * The 16 MAC repetitions are, by definition, identical, so the target MAC is surfaced once (decoded from
12
+ * the first repetition) and re-emitted 16× on encode — a well-formed magic packet round-trips
13
+ * byte-for-byte. The 6-byte sync stream is kept verbatim as hex (so an odd/crafted stream still
14
+ * reproduces) and any trailing SecureOn password bytes are kept verbatim as hex (0/4/6 bytes; taken to
15
+ * the end of the frame). Nothing is recomputed on encode. WoL is a leaf header — nothing rides above it.
16
+ *
17
+ * Note: WoL magic packets are also frequently sent as the payload of a UDP datagram (well-known ports 9
18
+ * and 7, or 0). This codec handles only the EtherType 0x0842 direct-on-Ethernet framing; the UDP-carried
19
+ * form is a separate demux (udpport) and is not attempted here.
20
+ */
21
+ export declare class WakeOnLAN 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
+ }