Write the DNS message header. Writing the DNS message header is done after all sections have been rendered, but before the optional TSIG signature is added.
(self)
| 315 | self.output.write(struct.pack("!H", self.counts[ADDITIONAL])) |
| 316 | |
| 317 | def write_header(self): |
| 318 | """Write the DNS message header. |
| 319 | |
| 320 | Writing the DNS message header is done after all sections |
| 321 | have been rendered, but before the optional TSIG signature |
| 322 | is added. |
| 323 | """ |
| 324 | |
| 325 | with self._temporarily_seek_to(0): |
| 326 | self.output.write( |
| 327 | struct.pack( |
| 328 | "!HHHHHH", |
| 329 | self.id, |
| 330 | self.flags, |
| 331 | self.counts[0], |
| 332 | self.counts[1], |
| 333 | self.counts[2], |
| 334 | self.counts[3], |
| 335 | ) |
| 336 | ) |
| 337 | |
| 338 | def get_wire(self): |
| 339 | """Return the wire format message.""" |