@netkitty/codec 1.2.1 → 2.1.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 (205) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/README.md +62 -10
  3. package/README.zh-CN.md +55 -9
  4. package/dist/Codec.d.ts +3 -2
  5. package/dist/Codec.js +109 -10
  6. package/dist/abstracts/BaseHeader.d.ts +54 -2
  7. package/dist/abstracts/BaseHeader.js +185 -43
  8. package/dist/errors/CodecSchemaValidateError.d.ts +34 -1
  9. package/dist/errors/CodecSchemaValidateError.js +26 -3
  10. package/dist/headers/ADSAMS.js +2 -0
  11. package/dist/headers/AH.js +4 -2
  12. package/dist/headers/AMQP.js +2 -1
  13. package/dist/headers/ARP.js +16 -10
  14. package/dist/headers/BACnetIP.js +1 -0
  15. package/dist/headers/BFD.d.ts +2 -1
  16. package/dist/headers/BFD.js +30 -4
  17. package/dist/headers/BGP.js +6 -1
  18. package/dist/headers/Babel.js +2 -1
  19. package/dist/headers/BitTorrent.d.ts +2 -0
  20. package/dist/headers/BitTorrent.js +4 -2
  21. package/dist/headers/C37118.d.ts +3 -2
  22. package/dist/headers/C37118.js +35 -15
  23. package/dist/headers/CAPWAP.js +1 -0
  24. package/dist/headers/CDP.d.ts +3 -3
  25. package/dist/headers/CDP.js +47 -11
  26. package/dist/headers/CMS.js +27 -12
  27. package/dist/headers/COTP.d.ts +2 -0
  28. package/dist/headers/COTP.js +8 -4
  29. package/dist/headers/CassandraCQL.js +1 -0
  30. package/dist/headers/CoAP.js +20 -2
  31. package/dist/headers/Codesys.js +1 -0
  32. package/dist/headers/Collectd.js +1 -1
  33. package/dist/headers/DCCP.d.ts +3 -2
  34. package/dist/headers/DCCP.js +61 -8
  35. package/dist/headers/DHCPFailover.js +1 -0
  36. package/dist/headers/DNP3.d.ts +5 -3
  37. package/dist/headers/DNP3.js +62 -7
  38. package/dist/headers/DNS.js +3 -3
  39. package/dist/headers/DTLS.js +1 -0
  40. package/dist/headers/Diameter.js +3 -2
  41. package/dist/headers/EAPOL.js +1 -1
  42. package/dist/headers/EIGRP.d.ts +3 -2
  43. package/dist/headers/EIGRP.js +32 -6
  44. package/dist/headers/ENIP.js +1 -0
  45. package/dist/headers/Elasticsearch.js +1 -0
  46. package/dist/headers/EtherCAT.js +1 -0
  47. package/dist/headers/EthernetII.js +7 -0
  48. package/dist/headers/FTP.js +6 -6
  49. package/dist/headers/Finger.js +3 -3
  50. package/dist/headers/FoundationFieldbusHSE.js +1 -0
  51. package/dist/headers/GELF.js +8 -1
  52. package/dist/headers/GENEVE.js +2 -1
  53. package/dist/headers/GLBP.js +1 -1
  54. package/dist/headers/GRE.js +1 -0
  55. package/dist/headers/GTPU.js +1 -0
  56. package/dist/headers/GTPv2C.js +2 -0
  57. package/dist/headers/GitProtocol.js +2 -2
  58. package/dist/headers/Goose.js +24 -12
  59. package/dist/headers/Gopher.js +6 -6
  60. package/dist/headers/HARTIP.js +1 -0
  61. package/dist/headers/HSR.js +3 -0
  62. package/dist/headers/HTTP.js +6 -6
  63. package/dist/headers/HTTP2.js +2 -0
  64. package/dist/headers/ICMP.js +3 -1
  65. package/dist/headers/ICMPv6.js +11 -16
  66. package/dist/headers/IEC104_I_Frame.js +215 -163
  67. package/dist/headers/IEC104_S_Frame.js +26 -3
  68. package/dist/headers/IEC104_U_Frame.js +33 -4
  69. package/dist/headers/IEC61850SampledValues.js +6 -5
  70. package/dist/headers/IGMP.d.ts +8 -7
  71. package/dist/headers/IGMP.js +58 -19
  72. package/dist/headers/IMAP.js +5 -5
  73. package/dist/headers/IPFIX.js +3 -2
  74. package/dist/headers/IPv4.js +41 -21
  75. package/dist/headers/IPv6.js +5 -1
  76. package/dist/headers/IPv6HopByHopOptions.js +15 -12
  77. package/dist/headers/IRC.js +4 -4
  78. package/dist/headers/ISAKMP.js +3 -1
  79. package/dist/headers/ISCSI.js +2 -0
  80. package/dist/headers/ISIS.js +2 -1
  81. package/dist/headers/ISOSession.d.ts +2 -0
  82. package/dist/headers/ISOSession.js +14 -10
  83. package/dist/headers/Ident.js +8 -8
  84. package/dist/headers/KNXnetIP.js +1 -0
  85. package/dist/headers/Kafka.js +1 -0
  86. package/dist/headers/Kerberos.js +2 -0
  87. package/dist/headers/L2TP.js +3 -2
  88. package/dist/headers/LACP.js +1 -1
  89. package/dist/headers/LDAP.js +3 -4
  90. package/dist/headers/LDP.js +1 -0
  91. package/dist/headers/LLC.d.ts +2 -0
  92. package/dist/headers/LLC.js +3 -0
  93. package/dist/headers/LPD.js +3 -3
  94. package/dist/headers/MGCP.js +7 -7
  95. package/dist/headers/MMS.d.ts +2 -0
  96. package/dist/headers/MMS.js +10 -6
  97. package/dist/headers/MQTT.js +1 -0
  98. package/dist/headers/MQTTSN.js +1 -0
  99. package/dist/headers/MarkerProtocol.js +1 -1
  100. package/dist/headers/Megaco.js +3 -3
  101. package/dist/headers/Memcached.js +3 -2
  102. package/dist/headers/ModbusTCP.js +1 -0
  103. package/dist/headers/ModbusUDP.js +1 -0
  104. package/dist/headers/MongoDB.js +1 -0
  105. package/dist/headers/MySQL.js +1 -0
  106. package/dist/headers/NATS.js +2 -2
  107. package/dist/headers/NBDS.js +1 -0
  108. package/dist/headers/NBSS.js +1 -0
  109. package/dist/headers/NFS.js +1 -0
  110. package/dist/headers/NHRP.d.ts +1 -1
  111. package/dist/headers/NHRP.js +30 -4
  112. package/dist/headers/NNTP.js +6 -6
  113. package/dist/headers/NetFlowV5.js +1 -0
  114. package/dist/headers/OLSR.js +2 -1
  115. package/dist/headers/OPCUA.js +1 -0
  116. package/dist/headers/OSPF.d.ts +3 -3
  117. package/dist/headers/OSPF.js +72 -7
  118. package/dist/headers/OpenFlow.js +1 -0
  119. package/dist/headers/OpenVPN.js +1 -0
  120. package/dist/headers/PCWorx.js +1 -0
  121. package/dist/headers/PIM.d.ts +3 -3
  122. package/dist/headers/PIM.js +55 -6
  123. package/dist/headers/POP3.js +5 -5
  124. package/dist/headers/PPPoEDiscovery.js +4 -1
  125. package/dist/headers/PPPoESession.js +1 -0
  126. package/dist/headers/PPTP.js +1 -0
  127. package/dist/headers/PTP.js +6 -1
  128. package/dist/headers/PostgreSQL.js +2 -0
  129. package/dist/headers/QUIC.js +2 -0
  130. package/dist/headers/RADIUS.js +1 -0
  131. package/dist/headers/RDP.d.ts +2 -0
  132. package/dist/headers/RDP.js +6 -1
  133. package/dist/headers/RFB.js +4 -4
  134. package/dist/headers/RGoose.js +8 -1
  135. package/dist/headers/RSVP.d.ts +3 -3
  136. package/dist/headers/RSVP.js +59 -44
  137. package/dist/headers/RTCP.js +2 -0
  138. package/dist/headers/RTP.js +2 -1
  139. package/dist/headers/RTPS.d.ts +2 -0
  140. package/dist/headers/RTPS.js +4 -1
  141. package/dist/headers/RTSP.js +7 -7
  142. package/dist/headers/RawData.js +1 -1
  143. package/dist/headers/Redis.js +4 -4
  144. package/dist/headers/Rlogin.js +5 -5
  145. package/dist/headers/Rsync.js +2 -2
  146. package/dist/headers/S7comm.d.ts +2 -0
  147. package/dist/headers/S7comm.js +5 -1
  148. package/dist/headers/SCTP.d.ts +2 -2
  149. package/dist/headers/SCTP.js +31 -7
  150. package/dist/headers/SFlow.js +2 -1
  151. package/dist/headers/SIP.js +6 -6
  152. package/dist/headers/SLMP.js +1 -0
  153. package/dist/headers/SLP.js +2 -0
  154. package/dist/headers/SLPv1.js +1 -0
  155. package/dist/headers/SMB1.js +1 -0
  156. package/dist/headers/SMB2.js +1 -0
  157. package/dist/headers/SMPP.js +1 -0
  158. package/dist/headers/SMTP.js +6 -6
  159. package/dist/headers/SNAP.js +18 -5
  160. package/dist/headers/SNMP.js +6 -6
  161. package/dist/headers/SOCKS4.js +11 -5
  162. package/dist/headers/SSDP.js +7 -7
  163. package/dist/headers/SSH.js +5 -4
  164. package/dist/headers/STOMP.js +5 -5
  165. package/dist/headers/STUN.js +3 -1
  166. package/dist/headers/SercosIII.d.ts +3 -2
  167. package/dist/headers/SercosIII.js +41 -5
  168. package/dist/headers/Skinny.js +1 -0
  169. package/dist/headers/StatsD.js +4 -4
  170. package/dist/headers/SunRPC.js +1 -0
  171. package/dist/headers/Syslog.js +2 -2
  172. package/dist/headers/TCP.js +31 -64
  173. package/dist/headers/TLS_Alert.js +42 -12
  174. package/dist/headers/TLS_ApplicationData.d.ts +3 -3
  175. package/dist/headers/TLS_ApplicationData.js +32 -8
  176. package/dist/headers/TLS_ChangeCipherSpec.d.ts +2 -2
  177. package/dist/headers/TLS_ChangeCipherSpec.js +33 -8
  178. package/dist/headers/TLS_Handshake.js +78 -30
  179. package/dist/headers/TLS_Heartbeat.d.ts +4 -3
  180. package/dist/headers/TLS_Heartbeat.js +50 -8
  181. package/dist/headers/TPKT.js +4 -2
  182. package/dist/headers/TacacsPlus.js +1 -0
  183. package/dist/headers/Telnet.js +2 -1
  184. package/dist/headers/Teredo.js +2 -2
  185. package/dist/headers/UDP.js +20 -56
  186. package/dist/headers/VLAN_802dot1Q.js +8 -0
  187. package/dist/headers/VRRP.d.ts +2 -1
  188. package/dist/headers/VRRP.js +45 -9
  189. package/dist/headers/WCCP.js +1 -0
  190. package/dist/headers/WHOIS.js +3 -3
  191. package/dist/headers/WSDiscovery.js +2 -2
  192. package/dist/headers/XMPP.js +3 -3
  193. package/dist/headers/Zabbix.js +1 -0
  194. package/dist/helper/Checksum.d.ts +15 -0
  195. package/dist/helper/Checksum.js +56 -0
  196. package/dist/helper/Crc.d.ts +18 -0
  197. package/dist/helper/Crc.js +58 -0
  198. package/dist/index.d.ts +3 -3
  199. package/dist/lib/SchemaValidator.d.ts +31 -0
  200. package/dist/lib/SchemaValidator.js +137 -0
  201. package/dist/schema/ProtocolFieldJSONSchema.d.ts +4 -1
  202. package/dist/schema/ProtocolJSONSchema.d.ts +1 -1
  203. package/dist/types/CodecErrorInfo.d.ts +11 -0
  204. package/dist/types/LayerGraph.d.ts +14 -1
  205. package/package.json +2 -2
@@ -48,6 +48,7 @@ class SMPP extends BaseHeader_1.BaseHeader {
48
48
  properties: {
49
49
  commandLength: {
50
50
  type: 'integer',
51
+ autoCalculated: true,
51
52
  label: 'Command Length',
52
53
  //minimum 0 (not 16): a crafted/corrupt PDU may carry a command_length below the 16-byte
53
54
  //header, and that value must round-trip (honored verbatim) rather than being rejected by
@@ -125,12 +125,12 @@ class SMTP extends BaseHeader_1.BaseHeader {
125
125
  //message field above, never read back). isReply distinguishes a server reply from a
126
126
  //client command; replyCode/isMultiline/replyText describe a reply, command/argument a
127
127
  //command.
128
- isReply: { type: 'boolean', label: 'Is Reply' },
129
- replyCode: { type: 'integer', label: 'Reply Code', minimum: 0, maximum: 999 },
130
- isMultiline: { type: 'boolean', label: 'Is Multiline' },
131
- replyText: { type: 'string', label: 'Reply Text' },
132
- command: { type: 'string', label: 'Command' },
133
- argument: { type: 'string', label: 'Argument' }
128
+ isReply: { type: 'boolean', label: 'Is Reply', readOnly: true },
129
+ replyCode: { type: 'integer', label: 'Reply Code', readOnly: true, minimum: 0, maximum: 999 },
130
+ isMultiline: { type: 'boolean', label: 'Is Multiline', readOnly: true },
131
+ replyText: { type: 'string', label: 'Reply Text', readOnly: true },
132
+ command: { type: 'string', label: 'Command', readOnly: true },
133
+ argument: { type: 'string', label: 'Argument', readOnly: true }
134
134
  }
135
135
  };
136
136
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SNAP = void 0;
4
4
  const BaseHeader_1 = require("../abstracts/BaseHeader");
5
+ const HexToBuffer_1 = require("../helper/HexToBuffer");
5
6
  /**
6
7
  * SNAP — Sub-Network Access Protocol (IEEE 802.2), the 5-byte header that follows an LLC header whose
7
8
  * DSAP/SSAP are 0xAA. It carries a 3-byte OUI (Organizationally Unique Identifier) and a 2-byte Protocol
@@ -34,14 +35,26 @@ class SNAP extends BaseHeader_1.BaseHeader {
34
35
  type: 'object',
35
36
  summary: 'SNAP oui=${oui} type=${etherType}',
36
37
  properties: {
37
- oui: this.fieldHex('oui', 0, 3, 'OUI'),
38
+ //When oui / etherType are left out they are taken from ouiProtocol — the field the editor
39
+ //graph sets to route a vendor child (snap→cdp is ouiProtocol '00000c2000').
40
+ oui: { ...this.fieldHex('oui', 0, 3, 'OUI'), autoCalculated: true, encode: function () {
41
+ const ouiProtocol = this.instance.ouiProtocol.getValue('');
42
+ const oui = this.instance.oui.getValue(ouiProtocol.length === 10 ? ouiProtocol.substring(0, 6) : '000000');
43
+ this.instance.oui.setValue(oui);
44
+ this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(oui));
45
+ } },
38
46
  //Named `etherType` (not `pid`) so the existing ethertype demux + IPv4/ARP/IPv6 match() —
39
47
  //which read the parent's `etherType` field literally — route through SNAP unchanged, exactly
40
48
  //as they do through Ethernet II and 802.1Q.
41
- etherType: this.fieldHex('etherType', 3, 2, 'Protocol Type'),
42
- //Display/demux-only: OUI+PID concatenated, the `snapoui` key for vendor protocols (CDP/VTP
43
- //under Cisco 0x00000C). No encode closure — the bytes are written by oui + etherType, this
44
- //is derived — so it never affects the re-emitted frame.
49
+ etherType: { ...this.fieldHex('etherType', 3, 2, 'Protocol Type'), autoCalculated: true, encode: function () {
50
+ const ouiProtocol = this.instance.ouiProtocol.getValue('');
51
+ const etherType = this.instance.etherType.getValue(ouiProtocol.length === 10 ? ouiProtocol.substring(6, 10) : '0000');
52
+ this.instance.etherType.setValue(etherType);
53
+ this.writeBytes(3, (0, HexToBuffer_1.HexToBuffer)(etherType));
54
+ } },
55
+ //Demux key: OUI+PID concatenated, the `snapoui` key for vendor protocols (CDP/VTP under Cisco
56
+ //0x00000C). No encode closure — the bytes are written by oui + etherType — but it supplies
57
+ //them when they are left out (see oui), so the editor can route a child by setting it.
45
58
  ouiProtocol: {
46
59
  type: 'string',
47
60
  label: 'OUI Protocol',
@@ -164,8 +164,8 @@ class SNMP extends BaseHeader_1.BaseHeader {
164
164
  version: {
165
165
  type: 'integer',
166
166
  label: 'Version',
167
- minimum: 0,
168
- maximum: 3,
167
+ //A BER INTEGER (0 v1, 1 v2c, 3 v3): any decoded value must re-encode, so the bounds
168
+ //are left open (a long INTEGER decodes to a large number), not the defined versions.
169
169
  decode: function () {
170
170
  const available = this.packet.length - this.startPos;
171
171
  if (available <= 0)
@@ -272,13 +272,13 @@ class SNMP extends BaseHeader_1.BaseHeader {
272
272
  community: { type: 'string', label: 'Community' },
273
273
  //The PDU context tag: 0xa0 get-request, 0xa1 get-next-request, 0xa2 get-response,
274
274
  //0xa3 set-request, 0xa5 get-bulk-request, 0xa6 inform-request, 0xa7 snmpV2-trap, 0xa8 report.
275
- pduType: { type: 'integer', label: 'PDU Type', minimum: 0, maximum: 255 },
275
+ pduType: { type: 'integer', label: 'PDU Type', minimum: 0, maximum: 255, default: 0xa0 },
276
276
  //Verbatim PDU body for non-RFC-3416 PDUs (SNMPv1 Trap 0xa4 / unknown tags). Hidden and
277
277
  //empty for the common request/response PDUs, which use the structured fields below.
278
278
  pduRaw: { type: 'string', label: 'PDU Body', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true },
279
279
  requestId: { type: 'integer', label: 'Request ID' },
280
- errorStatus: { type: 'integer', label: 'Error Status', minimum: 0 },
281
- errorIndex: { type: 'integer', label: 'Error Index', minimum: 0 },
280
+ errorStatus: { type: 'integer', label: 'Error Status' },
281
+ errorIndex: { type: 'integer', label: 'Error Index' },
282
282
  variableBindings: {
283
283
  type: 'array',
284
284
  label: 'Variable Bindings',
@@ -287,7 +287,7 @@ class SNMP extends BaseHeader_1.BaseHeader {
287
287
  label: 'Variable Binding',
288
288
  properties: {
289
289
  oid: { type: 'string', label: 'Object Identifier' },
290
- valueType: { type: 'integer', label: 'Value Type', minimum: 0, maximum: 255 },
290
+ valueType: { type: 'integer', label: 'Value Type', minimum: 0, maximum: 255, default: 0x05 },
291
291
  value: { type: 'string', label: 'Value', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX }
292
292
  }
293
293
  }
@@ -6,6 +6,7 @@ const BufferToNumber_1 = require("../helper/BufferToNumber");
6
6
  const NumberToBuffer_1 = require("../helper/NumberToBuffer");
7
7
  const BufferToIP_1 = require("../helper/BufferToIP");
8
8
  const IPToBuffer_1 = require("../helper/IPToBuffer");
9
+ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
9
10
  /**
10
11
  * SOCKS4 — the SOCKS Protocol Version 4 (and the SOCKS4a extension), carried over TCP well-known
11
12
  * port 1080. Only two message shapes travel on the wire, discriminated by their leading octet:
@@ -62,6 +63,11 @@ class SOCKS4 extends BaseHeader_1.BaseHeader {
62
63
  #isRequest() {
63
64
  return this.instance.messageType.getValue('request') === 'request';
64
65
  }
66
+ /** True for a SOCKS4a request: dstIp is 0.0.0.x with x != 0, so a domain follows the user-id. */
67
+ #isSocks4a() {
68
+ const octets = this.instance.dstIp.getValue('').split('.');
69
+ return octets.length === 4 && octets[0] === '0' && octets[1] === '0' && octets[2] === '0' && octets[3] !== '0';
70
+ }
65
71
  /**
66
72
  * Read a null-terminated latin1 string at `offset` (bounded by the captured length); returns its
67
73
  * value plus the offset one past the terminator (or the end of buffer if never terminated).
@@ -133,7 +139,6 @@ class SOCKS4 extends BaseHeader_1.BaseHeader {
133
139
  command: {
134
140
  type: 'integer',
135
141
  label: 'Command',
136
- enum: [1, 2],
137
142
  minimum: 0,
138
143
  maximum: 255,
139
144
  default: 1,
@@ -166,7 +171,6 @@ class SOCKS4 extends BaseHeader_1.BaseHeader {
166
171
  status: {
167
172
  type: 'integer',
168
173
  label: 'Status',
169
- enum: [0x5a, 0x5b, 0x5c, 0x5d],
170
174
  minimum: 0,
171
175
  maximum: 255,
172
176
  default: 0x5a,
@@ -227,6 +231,7 @@ class SOCKS4 extends BaseHeader_1.BaseHeader {
227
231
  type: 'string',
228
232
  label: 'Destination IP',
229
233
  default: '0.0.0.0',
234
+ contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.IPv4,
230
235
  decode: function () {
231
236
  this.instance.dstIp.setValue(this.#payloadLength() >= 8 ? (0, BufferToIP_1.BufferToIPv4)(this.readBytes(4, 4)) : '0.0.0.0');
232
237
  },
@@ -256,14 +261,15 @@ class SOCKS4 extends BaseHeader_1.BaseHeader {
256
261
  }
257
262
  },
258
263
  //REQUEST shape (SOCKS4a): the null-terminated destination domain that follows the
259
- //user-id when the client could not resolve the host (dstIp 0.0.0.x). Structured
260
- //whenever bytes remain after the user-id terminator, so SOCKS4a round-trips exactly.
264
+ //user-id when the client could not resolve the host (dstIp 0.0.0.x, x != 0). Only
265
+ //decoded for such a SOCKS4a request, so bytes trailing a plain SOCKS4 request (e.g.
266
+ //padding) fall to raw instead of being misread as a domain; SOCKS4a round-trips exactly.
261
267
  domain: {
262
268
  type: 'string',
263
269
  label: 'Domain',
264
270
  default: '',
265
271
  decode: function () {
266
- if (!this.#isRequest()) {
272
+ if (!this.#isRequest() || !this.#isSocks4a()) {
267
273
  this.instance.domain.setValue('');
268
274
  return;
269
275
  }
@@ -124,15 +124,15 @@ class SSDP extends BaseHeader_1.BaseHeader {
124
124
  //Display-only metadata parsed from the start-line on decode (no encode — populated by the
125
125
  //message field above, never read back). isRequest distinguishes a Request-Line from a
126
126
  //Status-Line; method/requestUri are for requests, statusCode/reasonPhrase for responses.
127
- isRequest: { type: 'boolean', label: 'Is Request' },
127
+ isRequest: { type: 'boolean', label: 'Is Request', readOnly: true },
128
128
  //Display-only Info-column text ("M-SEARCH *" / "200 OK"), set on decode; no encode, so it
129
129
  //never affects the re-emitted bytes.
130
- info: { type: 'string', label: 'Info' },
131
- method: { type: 'string', label: 'Method' },
132
- requestUri: { type: 'string', label: 'Request URI' },
133
- version: { type: 'string', label: 'Version' },
134
- statusCode: { type: 'integer', label: 'Status Code', minimum: 0, maximum: 999 },
135
- reasonPhrase: { type: 'string', label: 'Reason Phrase' }
130
+ info: { type: 'string', label: 'Info', readOnly: true },
131
+ method: { type: 'string', label: 'Method', readOnly: true },
132
+ requestUri: { type: 'string', label: 'Request URI', readOnly: true },
133
+ version: { type: 'string', label: 'Version', readOnly: true },
134
+ statusCode: { type: 'integer', label: 'Status Code', readOnly: true, minimum: 0, maximum: 999 },
135
+ reasonPhrase: { type: 'string', label: 'Reason Phrase', readOnly: true }
136
136
  }
137
137
  };
138
138
  }
@@ -109,11 +109,11 @@ class SSH extends BaseHeader_1.BaseHeader {
109
109
  },
110
110
  //Display-only metadata parsed from the identification line on decode (no encode —
111
111
  //populated by `message` below for the identification shape, empty for a binary packet).
112
- protoVersion: { type: 'string', label: 'Protocol Version', default: '' },
113
- softwareVersion: { type: 'string', label: 'Software Version', default: '' },
114
- identString: { type: 'string', label: 'Identification String', default: '' },
112
+ protoVersion: { type: 'string', label: 'Protocol Version', readOnly: true, default: '' },
113
+ softwareVersion: { type: 'string', label: 'Software Version', readOnly: true, default: '' },
114
+ identString: { type: 'string', label: 'Identification String', readOnly: true, default: '' },
115
115
  //Drives the one-line summary: the software version for an identification, else 'packet'.
116
- summaryInfo: { type: 'string', label: 'Summary', hidden: true, default: '' },
116
+ summaryInfo: { type: 'string', label: 'Summary', readOnly: true, hidden: true, default: '' },
117
117
  //IDENTIFICATION shape: the whole line kept verbatim (byte-perfect) and re-emitted
118
118
  //untouched. The display metadata above is parsed from it on decode; encode never
119
119
  //reconstructs the line from that metadata.
@@ -148,6 +148,7 @@ class SSH extends BaseHeader_1.BaseHeader {
148
148
  //whole message spans packet_length + 4 bytes. Big-endian (unlike ENIP's CIP order).
149
149
  packetLength: {
150
150
  type: 'integer',
151
+ autoCalculated: true,
151
152
  label: 'Packet Length',
152
153
  minimum: 0,
153
154
  maximum: 4294967295,
@@ -124,12 +124,12 @@ class STOMP extends BaseHeader_1.BaseHeader {
124
124
  //`message` field below, never read back). command is the frame's COMMAND line;
125
125
  //destination/content-type/content-length are the common headers, present when the frame
126
126
  //carries them.
127
- command: { type: 'string', label: 'Command', default: '' },
128
- destination: { type: 'string', label: 'Destination', default: '' },
129
- contentType: { type: 'string', label: 'Content Type', default: '' },
130
- contentLength: { type: 'integer', label: 'Content Length', minimum: 0, default: 0 },
127
+ command: { type: 'string', label: 'Command', readOnly: true, default: '' },
128
+ destination: { type: 'string', label: 'Destination', readOnly: true, default: '' },
129
+ contentType: { type: 'string', label: 'Content Type', readOnly: true, default: '' },
130
+ contentLength: { type: 'integer', label: 'Content Length', readOnly: true, minimum: 0, default: 0 },
131
131
  //Drives the one-line summary (COMMAND + destination when present).
132
- summaryInfo: { type: 'string', label: 'Summary', hidden: true, default: '' },
132
+ summaryInfo: { type: 'string', label: 'Summary', readOnly: true, hidden: true, default: '' },
133
133
  //The whole raw payload is the single source of truth: decoded verbatim to hex and
134
134
  //re-emitted untouched (byte-perfect for any STOMP frame). The COMMAND line and common
135
135
  //headers are parsed into the display-only metadata above, which carry no codec of their own.
@@ -48,6 +48,7 @@ class STUN extends BaseHeader_1.BaseHeader {
48
48
  //from the encoded attributes after they are written.
49
49
  messageLength: {
50
50
  type: 'integer',
51
+ autoCalculated: true,
51
52
  label: 'Message Length',
52
53
  minimum: 0,
53
54
  maximum: 65535,
@@ -56,7 +57,7 @@ class STUN extends BaseHeader_1.BaseHeader {
56
57
  },
57
58
  encode: function () {
58
59
  const messageLength = this.instance.messageLength.getValue(0);
59
- if (messageLength) {
60
+ if (!this.isLeftOut(this.instance.messageLength)) {
60
61
  this.instance.messageLength.setValue(messageLength);
61
62
  this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(messageLength));
62
63
  }
@@ -90,6 +91,7 @@ class STUN extends BaseHeader_1.BaseHeader {
90
91
  },
91
92
  value: {
92
93
  type: 'string',
94
+ byteAlignment: 4,
93
95
  label: 'Value',
94
96
  contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX
95
97
  },
@@ -20,8 +20,9 @@ import { DemuxProducer } from '../types/DemuxProducer';
20
20
  * Byte 1 — Phase field (the Master Sync Telegram, MST):
21
21
  * - the Phase occupies mask 0x8f (bit 7 = phase switching, bits 0..3 = communication phase CP0..CP4),
22
22
  * a non-contiguous field kept as one value; the Cycle Count occupies mask 0x70 (bits 4..6).
23
- * Bytes 2..5 — CRC32 of the MST, kept verbatim (little-endian on the wire per the dissector) and never
24
- * recomputed, so a captured frame round-trips byte-for-byte.
23
+ * Bytes 2..5 — CRC32 of the MST, little-endian on the wire (per the dissector): CRC-32 (IEEE 802.3) over
24
+ * the Ethernet header (destination, source, EtherType) and bytes 0..1. Written as given; computed only
25
+ * when left out (checked against a real capture: the openSAFETY-over-Sercos III Wireshark sample).
25
26
  *
26
27
  * Everything after the 6-byte header (the phase-dependent per-device connection / service-channel data) is
27
28
  * command- and topology-dependent, so this slice keeps it verbatim as `data` hex (byte-perfect), bounded by
@@ -5,6 +5,7 @@ const BaseHeader_1 = require("../abstracts/BaseHeader");
5
5
  const BufferToHex_1 = require("../helper/BufferToHex");
6
6
  const HexToBuffer_1 = require("../helper/HexToBuffer");
7
7
  const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
8
+ const Crc_1 = require("../helper/Crc");
8
9
  /**
9
10
  * Sercos III — the real-time industrial Ethernet of the Sercos automation bus (IEC 61491 / IEC 61158,
10
11
  * IEC 61784 CPF-16), carried directly in an Ethernet II frame with EtherType 0x88CD (an Ethernet child —
@@ -24,8 +25,9 @@ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
24
25
  * Byte 1 — Phase field (the Master Sync Telegram, MST):
25
26
  * - the Phase occupies mask 0x8f (bit 7 = phase switching, bits 0..3 = communication phase CP0..CP4),
26
27
  * a non-contiguous field kept as one value; the Cycle Count occupies mask 0x70 (bits 4..6).
27
- * Bytes 2..5 — CRC32 of the MST, kept verbatim (little-endian on the wire per the dissector) and never
28
- * recomputed, so a captured frame round-trips byte-for-byte.
28
+ * Bytes 2..5 — CRC32 of the MST, little-endian on the wire (per the dissector): CRC-32 (IEEE 802.3) over
29
+ * the Ethernet header (destination, source, EtherType) and bytes 0..1. Written as given; computed only
30
+ * when left out (checked against a real capture: the openSAFETY-over-Sercos III Wireshark sample).
29
31
  *
30
32
  * Everything after the 6-byte header (the phase-dependent per-device connection / service-channel data) is
31
33
  * command- and topology-dependent, so this slice keeps it verbatim as `data` hex (byte-perfect), bounded by
@@ -50,6 +52,16 @@ class SercosIII extends BaseHeader_1.BaseHeader {
50
52
  get SCHEMA() {
51
53
  return (SercosIII.#schemaCache ??= SercosIII.#buildSchema());
52
54
  }
55
+ /**
56
+ * The octets the MST CRC32 covers: the 14-byte Ethernet header beneath (destination, source, EtherType)
57
+ * followed by the Telegram Type and Phase octets. undefined when this layer does not sit directly on
58
+ * an Ethernet header.
59
+ */
60
+ #mstCrcCoverage() {
61
+ if (!this.prevCodecModule || this.prevCodecModule.id !== 'eth' || this.startPos < 14)
62
+ return undefined;
63
+ return this.packet.subarray(this.startPos - 14, this.startPos + 2);
64
+ }
53
65
  static #buildSchema() {
54
66
  return {
55
67
  type: 'object',
@@ -161,9 +173,33 @@ class SercosIII extends BaseHeader_1.BaseHeader {
161
173
  }
162
174
  },
163
175
  //==== Bytes 2..5: MST CRC32 ====
164
- //Honored verbatim (little-endian on the wire) and never recomputed, so a captured frame
165
- //round-trips byte-for-byte.
166
- crc32: this.fieldHex('crc32', 2, 4, 'CRC32'),
176
+ //Little-endian on the wire. Bytes 0..1 are already written when this runs, so a left-out
177
+ //CRC is computed right here; a given one (any value, a wrong one included) is written as is.
178
+ crc32: {
179
+ type: 'string',
180
+ autoCalculated: true,
181
+ label: 'CRC32',
182
+ contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
183
+ decode: function () {
184
+ this.instance.crc32.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(2, 4)));
185
+ },
186
+ encode: function () {
187
+ if (!this.isLeftOut(this.instance.crc32)) {
188
+ this.writeBytes(2, (0, HexToBuffer_1.HexToBuffer)(this.instance.crc32.getValue()));
189
+ return;
190
+ }
191
+ const crc = Buffer.alloc(4);
192
+ const covered = this.#mstCrcCoverage();
193
+ if (covered) {
194
+ crc.writeUInt32LE((0, Crc_1.Crc32)(covered), 0);
195
+ }
196
+ else {
197
+ this.recordError(this.instance.crc32.getPath(), 'Cannot compute CRC32: no Ethernet header beneath Sercos III');
198
+ }
199
+ this.instance.crc32.setValue((0, BufferToHex_1.BufferToHex)(crc));
200
+ this.writeBytes(2, crc);
201
+ }
202
+ },
167
203
  //==== Bytes 6..end: per-device payload ====
168
204
  //Kept verbatim (byte-perfect). Sercos III has no length field of its own — it runs to the end
169
205
  //of the Ethernet payload (like LLDP/GOOSE), so the body is bounded by the captured frame.
@@ -73,6 +73,7 @@ class Skinny extends BaseHeader_1.BaseHeader {
73
73
  //All multi-byte Skinny fields are LITTLE-ENDIAN.
74
74
  dataLength: {
75
75
  type: 'integer',
76
+ autoCalculated: true,
76
77
  label: 'Data Length',
77
78
  minimum: 0,
78
79
  maximum: 4294967295,
@@ -108,10 +108,10 @@ class StatsD extends BaseHeader_1.BaseHeader {
108
108
  },
109
109
  //Display-only metadata parsed from the first metric line on decode (no encode — populated
110
110
  //by the message field above, never read back). sampleRate is empty when absent.
111
- metricName: { type: 'string', label: 'Metric Name' },
112
- metricValue: { type: 'string', label: 'Metric Value' },
113
- metricType: { type: 'string', label: 'Metric Type' },
114
- sampleRate: { type: 'string', label: 'Sample Rate' }
111
+ metricName: { type: 'string', label: 'Metric Name', readOnly: true },
112
+ metricValue: { type: 'string', label: 'Metric Value', readOnly: true },
113
+ metricType: { type: 'string', label: 'Metric Type', readOnly: true },
114
+ sampleRate: { type: 'string', label: 'Sample Rate', readOnly: true }
115
115
  }
116
116
  };
117
117
  }
@@ -133,6 +133,7 @@ class SunRPC extends BaseHeader_1.BaseHeader {
133
133
  },
134
134
  fragmentLength: {
135
135
  type: 'integer',
136
+ autoCalculated: true,
136
137
  label: 'Fragment Length',
137
138
  minimum: 0,
138
139
  maximum: 2147483647,
@@ -78,8 +78,8 @@ class Syslog extends BaseHeader_1.BaseHeader {
78
78
  },
79
79
  //Derived from PRI (display only; encode reconstructs PRI, not these): facility = PRI>>3,
80
80
  //severity = PRI&7.
81
- facility: { type: 'integer', label: 'Facility', minimum: 0, maximum: 23 },
82
- severity: { type: 'integer', label: 'Severity', minimum: 0, maximum: 7 },
81
+ facility: { type: 'integer', label: 'Facility', readOnly: true, minimum: 0, maximum: 23 },
82
+ severity: { type: 'integer', label: 'Severity', readOnly: true, minimum: 0, maximum: 7 },
83
83
  message: { type: 'string', label: 'Message' }
84
84
  }
85
85
  };
@@ -4,7 +4,7 @@ exports.TCP = void 0;
4
4
  const BaseHeader_1 = require("../abstracts/BaseHeader");
5
5
  const BufferToNumber_1 = require("../helper/BufferToNumber");
6
6
  const NumberToBuffer_1 = require("../helper/NumberToBuffer");
7
- const IPToBuffer_1 = require("../helper/IPToBuffer");
7
+ const Checksum_1 = require("../helper/Checksum");
8
8
  const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
9
9
  const NumberToHex_1 = require("../helper/NumberToHex");
10
10
  const HexToNumber_1 = require("../helper/HexToNumber");
@@ -39,59 +39,14 @@ class TCP extends BaseHeader_1.BaseHeader {
39
39
  * @protected
40
40
  */
41
41
  calculateTCPChecksum(tcpHeaderBuffer) {
42
- const tcpHeaderLength = tcpHeaderBuffer.length;
43
- //The checksum needs the IP pseudo-header from the layer below. Building a malformed
44
- //stack (e.g. TCP with no IP beneath) is a legitimate use case, so record an error and
45
- //skip the checksum rather than dereferencing a missing previous layer and throwing.
46
- if (!this.prevCodecModule) {
42
+ //The pseudo-header comes from the nearest IPv4/IPv6 layer beneath, past AH or IPv6 extension
43
+ //headers. A TCP layer with no IP beneath is a legitimate crafted stack: record it and leave 0.
44
+ const pseudoHeader = this.ipPseudoHeader(6, tcpHeaderBuffer.length);
45
+ if (!pseudoHeader) {
47
46
  this.recordError(this.instance.checksum.getPath(), 'Cannot compute TCP checksum: no IP layer beneath TCP');
48
47
  return 0;
49
48
  }
50
- const ipVersion = this.prevCodecModule.instance.version.getValue();
51
- let pseudoHeaderBuffer = Buffer.from([]);
52
- const sourceIp = this.prevCodecModule.instance.sip.getValue();
53
- const destinationIp = this.prevCodecModule.instance.dip.getValue();
54
- if (ipVersion === 4) {
55
- //4 Bytes
56
- const sourceIPv4Buffer = Buffer.from(sourceIp.split('.').map((value) => parseInt(value)));
57
- const destinationIPv4Buffer = Buffer.from(destinationIp.split('.').map((value) => parseInt(value)));
58
- //IPv4 Pseudo header
59
- pseudoHeaderBuffer = Buffer.concat([
60
- sourceIPv4Buffer,
61
- destinationIPv4Buffer,
62
- (0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
63
- (0, NumberToBuffer_1.UInt8ToBuffer)(6), //Protocol type (TCP = 6)
64
- Buffer.from([(tcpHeaderLength >> 8) & 0xFF]),
65
- Buffer.from([tcpHeaderLength & 0xFF])
66
- ]);
67
- }
68
- else if (ipVersion === 6) {
69
- //16 Bytes
70
- const sourceIPv6Buffer = (0, IPToBuffer_1.IPv6ToBuffer)(sourceIp);
71
- const destinationIPv6Buffer = (0, IPToBuffer_1.IPv6ToBuffer)(destinationIp);
72
- //IPv6 Pseudo header
73
- pseudoHeaderBuffer = Buffer.concat([
74
- sourceIPv6Buffer,
75
- destinationIPv6Buffer,
76
- (0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
77
- (0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
78
- (0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
79
- (0, NumberToBuffer_1.UInt8ToBuffer)(6), //Protocol type (TCP = 6)
80
- Buffer.from([(tcpHeaderLength >> 8) & 0xFF]),
81
- Buffer.from([tcpHeaderLength & 0xFF])
82
- ]);
83
- }
84
- else {
85
- return 0;
86
- }
87
- const dataBuffer = Buffer.concat([pseudoHeaderBuffer, tcpHeaderBuffer]);
88
- const data = Uint8Array.from(dataBuffer);
89
- let sum = 0;
90
- for (let i = 0; i < data.length; i += 2)
91
- sum += (data[i] << 8) + (data[i + 1] || 0);
92
- while (sum >>> 16)
93
- sum = (sum & 0xFFFF) + (sum >>> 16);
94
- return (~sum) & 0xFFFF;
49
+ return (0, Checksum_1.InternetChecksum)(pseudoHeader, tcpHeaderBuffer);
95
50
  }
96
51
  static #schemaCache;
97
52
  //Class-cached SCHEMA (④): field closures are functions taking dynamic `this` via .call(this).
@@ -153,6 +108,7 @@ class TCP extends BaseHeader_1.BaseHeader {
153
108
  },
154
109
  hdrLen: {
155
110
  type: 'integer',
111
+ autoCalculated: true,
156
112
  label: 'Header Length',
157
113
  minimum: 0,
158
114
  maximum: 60,
@@ -160,10 +116,10 @@ class TCP extends BaseHeader_1.BaseHeader {
160
116
  this.instance.hdrLen.setValue(this.readBits(12, 1, 0, 4) * 4);
161
117
  },
162
118
  encode: function () {
163
- const hdrLen = this.instance.hdrLen.getValue(0);
164
- if (hdrLen) {
119
+ if (!this.isLeftOut(this.instance.hdrLen)) {
120
+ const hdrLen = this.instance.hdrLen.getValue(0);
165
121
  this.instance.hdrLen.setValue(hdrLen);
166
- this.writeBits(12, 1, 0, 4, hdrLen ? Math.floor(hdrLen / 4) : 0);
122
+ this.writeBits(12, 1, 0, 4, Math.floor(hdrLen / 4));
167
123
  }
168
124
  else {
169
125
  this.addPostSelfEncodeHandler(() => {
@@ -333,6 +289,7 @@ class TCP extends BaseHeader_1.BaseHeader {
333
289
  },
334
290
  checksum: {
335
291
  type: 'integer',
292
+ autoCalculated: true,
336
293
  label: 'Checksum',
337
294
  minimum: 0,
338
295
  maximum: 65535,
@@ -340,14 +297,14 @@ class TCP extends BaseHeader_1.BaseHeader {
340
297
  this.instance.checksum.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(16, 2)));
341
298
  },
342
299
  encode: function () {
343
- const checksum = this.instance.checksum.getValue(0);
344
- if (checksum) {
300
+ if (!this.isLeftOut(this.instance.checksum)) {
301
+ const checksum = this.instance.checksum.getValue(0);
345
302
  this.instance.checksum.setValue(checksum);
346
303
  this.writeBytes(16, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
347
304
  }
348
305
  else {
349
- this.instance.checksum.setValue(checksum);
350
- this.writeBytes(16, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
306
+ this.instance.checksum.setValue(0);
307
+ this.writeBytes(16, (0, NumberToBuffer_1.UInt16ToBuffer)(0));
351
308
  this.addPostPacketEncodeHandler(() => {
352
309
  //Calculate checksum after packet encoded
353
310
  let startPos = 0;
@@ -388,6 +345,7 @@ class TCP extends BaseHeader_1.BaseHeader {
388
345
  },
389
346
  options: {
390
347
  type: 'array',
348
+ byteAlignment: 4,
391
349
  label: 'Options',
392
350
  items: {
393
351
  anyOf: [
@@ -790,7 +748,7 @@ class TCP extends BaseHeader_1.BaseHeader {
790
748
  const mssBuffer = Buffer.concat([
791
749
  (0, NumberToBuffer_1.UInt8ToBuffer)(2),
792
750
  (0, NumberToBuffer_1.UInt8ToBuffer)(4),
793
- (0, NumberToBuffer_1.UInt16ToBuffer)(optionMSS.mss)
751
+ (0, NumberToBuffer_1.UInt16ToBuffer)(optionMSS.mss ?? 0)
794
752
  ]);
795
753
  this.writeBytes(optionOffset, mssBuffer);
796
754
  optionOffset += mssBuffer.length;
@@ -801,7 +759,7 @@ class TCP extends BaseHeader_1.BaseHeader {
801
759
  const wsBuffer = Buffer.concat([
802
760
  (0, NumberToBuffer_1.UInt8ToBuffer)(3),
803
761
  (0, NumberToBuffer_1.UInt8ToBuffer)(3),
804
- (0, NumberToBuffer_1.UInt8ToBuffer)(optionWS.shift)
762
+ (0, NumberToBuffer_1.UInt8ToBuffer)(optionWS.shift ?? 0)
805
763
  ]);
806
764
  this.writeBytes(optionOffset, wsBuffer);
807
765
  optionOffset += wsBuffer.length;
@@ -822,7 +780,8 @@ class TCP extends BaseHeader_1.BaseHeader {
822
780
  const kindBuffer = (0, NumberToBuffer_1.UInt8ToBuffer)(5);
823
781
  const length = 2;
824
782
  let blocksBuffer = Buffer.from([]);
825
- optionSack.blocks.forEach((block) => {
783
+ const sackBlocks = optionSack.blocks ?? [];
784
+ sackBlocks.forEach((block) => {
826
785
  blocksBuffer = Buffer.concat([blocksBuffer, (0, NumberToBuffer_1.UInt64ToBuffer)((0, HexToNumber_1.HexToUInt64)(block))]);
827
786
  });
828
787
  const sackBuffer = Buffer.concat([kindBuffer, (0, NumberToBuffer_1.UInt8ToBuffer)(length + blocksBuffer.length), blocksBuffer]);
@@ -860,7 +819,7 @@ class TCP extends BaseHeader_1.BaseHeader {
860
819
  case TCPOption.TCP_Authentication_Option: {
861
820
  const optionTcpAo = optionItem;
862
821
  const kindBuffer = (0, NumberToBuffer_1.UInt8ToBuffer)(29);
863
- const dataBuffer = Buffer.from(optionTcpAo.data, 'hex');
822
+ const dataBuffer = Buffer.from(optionTcpAo.data ?? '', 'hex');
864
823
  const lengthBuffer = (0, NumberToBuffer_1.UInt8ToBuffer)(dataBuffer.length + 2);
865
824
  const tcpAoBuffer = Buffer.concat([kindBuffer, lengthBuffer, dataBuffer]);
866
825
  this.writeBytes(optionOffset, tcpAoBuffer);
@@ -869,8 +828,16 @@ class TCP extends BaseHeader_1.BaseHeader {
869
828
  }
870
829
  default: {
871
830
  const defaultOptionItem = optionItem;
872
- const kind = defaultOptionItem.kind;
873
- const hexBuffer = Buffer.from(defaultOptionItem.data.toString(), 'hex');
831
+ const kind = defaultOptionItem.kind ?? 0;
832
+ //Kinds 0 (EOL) and 1 (NOP) are single-octet options with no length/data
833
+ //(RFC 9293 §3.1), so a generic {kind: 0|1} emits just the kind octet.
834
+ if (kind === 0 || kind === 1) {
835
+ this.writeBytes(optionOffset, (0, NumberToBuffer_1.UInt8ToBuffer)(kind));
836
+ optionOffset += 1;
837
+ return;
838
+ }
839
+ //Data is optional: a generic option without data is the bare kind+length pair.
840
+ const hexBuffer = Buffer.from(defaultOptionItem.data === undefined || defaultOptionItem.data === null ? '' : defaultOptionItem.data.toString(), 'hex');
874
841
  const length = hexBuffer.length + 2;
875
842
  const defaultOptionBuffer = Buffer.concat([(0, NumberToBuffer_1.UInt8ToBuffer)(kind), (0, NumberToBuffer_1.UInt8ToBuffer)(length), hexBuffer]);
876
843
  this.writeBytes(optionOffset, defaultOptionBuffer);