MCPcopy Create free account
hub / github.com/rthalley/dnspython / _header_line

Method _header_line

dns/message.py:1455–1494  ·  view source on GitHub ↗

Process one line from the text format header section.

(self, _)

Source from the content-addressed store, hash-verified

1453 self.flags = 0
1454
1455 def _header_line(self, _):
1456 """Process one line from the text format header section."""
1457
1458 token = self.tok.get()
1459 what = token.value
1460 if what == "id":
1461 self.id = self.tok.get_int()
1462 elif what == "flags":
1463 while True:
1464 token = self.tok.get()
1465 if not token.is_identifier():
1466 self.tok.unget(token)
1467 break
1468 self.flags = self.flags | dns.flags.from_text(token.value)
1469 elif what == "edns":
1470 self.edns = self.tok.get_int()
1471 self.ednsflags = self.ednsflags | (self.edns << 16)
1472 elif what == "eflags":
1473 if self.edns < 0:
1474 self.edns = 0
1475 while True:
1476 token = self.tok.get()
1477 if not token.is_identifier():
1478 self.tok.unget(token)
1479 break
1480 self.ednsflags = self.ednsflags | dns.flags.edns_from_text(token.value)
1481 elif what == "payload":
1482 self.payload = self.tok.get_int()
1483 if self.edns < 0:
1484 self.edns = 0
1485 elif what == "opcode":
1486 text = self.tok.get_string()
1487 self.opcode = dns.opcode.from_text(text)
1488 self.flags = self.flags | dns.opcode.to_flags(self.opcode)
1489 elif what == "rcode":
1490 text = self.tok.get_string()
1491 self.rcode = dns.rcode.from_text(text)
1492 else:
1493 raise UnknownHeaderField
1494 self.tok.get_eol()
1495
1496 def _question_line(self, section_number):
1497 """Process one line from the text format question section."""

Callers

nothing calls this directly

Calls 7

get_intMethod · 0.80
is_identifierMethod · 0.80
ungetMethod · 0.80
get_stringMethod · 0.80
get_eolMethod · 0.80
getMethod · 0.45
from_textMethod · 0.45

Tested by

no test coverage detected