MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / writeRecord

Method writeRecord

modules/network/dns/dnsserializer.js:213–234  ·  view source on GitHub ↗
(record)

Source from the content-addressed store, hash-verified

211 this.writeBytes(data);
212 }
213 writeRecord(record) {
214 this.writeName(record.name);
215 this.writeU16(record.type);
216 this.writeU16(record.clss);
217
218 if (undefined === record.ttl)
219 return;
220
221 this.writeU32(record.ttl);
222
223 const state = this.state;
224 const position = state.position;
225 this.writeU16(0);
226 let length = state.position;
227 this.writeRData(record.type, record.data);
228
229 if (state.result) {
230 length = state.position - length;
231 state.result[position] = length >> 8;
232 state.result[position + 1] = length;
233 }
234 }
235 writeSections() {
236 for (let i = 0, sections = this.sections, length = sections.length; i < length; i++)
237 sections[i].forEach(record => this.writeRecord(record));

Callers 1

writeSectionsMethod · 0.95

Calls 4

writeNameMethod · 0.95
writeU16Method · 0.95
writeU32Method · 0.95
writeRDataMethod · 0.95

Tested by

no test coverage detected