MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / sectionToWire

Method sectionToWire

src/main/java/core/org/xbill/DNS/Message.java:411–440  ·  view source on GitHub ↗
(DNSOutput out, int section, Compression c,
	      int maxLength)

Source from the content-addressed store, hash-verified

409
410/* Returns the number of records not successfully rendered. */
411private int
412sectionToWire(DNSOutput out, int section, Compression c,
413 int maxLength)
414{
415 int n = sections[section].size();
416 int pos = out.current();
417 int rendered = 0;
418 int skipped = 0;
419 Record lastrec = null;
420
421 for (int i = 0; i < n; i++) {
422 Record rec = (Record)sections[section].get(i);
423 if (section == Section.ADDITIONAL && rec instanceof OPTRecord) {
424 skipped++;
425 continue;
426 }
427
428 if (lastrec != null && !sameSet(rec, lastrec)) {
429 pos = out.current();
430 rendered = i;
431 }
432 lastrec = rec;
433 rec.toWire(out, section, c);
434 if (out.current() > maxLength) {
435 out.jump(pos);
436 return n - rendered + skipped;
437 }
438 }
439 return skipped;
440}
441
442/* Returns true if the message could be rendered. */
443private boolean

Callers 1

toWireMethod · 0.95

Calls 6

sameSetMethod · 0.95
toWireMethod · 0.95
sizeMethod · 0.45
currentMethod · 0.45
getMethod · 0.45
jumpMethod · 0.45

Tested by

no test coverage detected