(data, offset, question=False)
| 149 | # / / |
| 150 | # +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
| 151 | def parse_record(data, offset, question=False): |
| 152 | nlen, name = parse_name(data, offset) |
| 153 | if not question: |
| 154 | record_type, record_class, record_ttl, record_rdlength = struct.unpack( |
| 155 | '!HHiH', data[offset + nlen:offset + nlen + 10] |
| 156 | ) |
| 157 | ip = parse_ip(record_type, data, record_rdlength, offset + nlen + 10) |
| 158 | return nlen + 10 + record_rdlength, \ |
| 159 | (name, ip, record_type, record_class, record_ttl) |
| 160 | else: |
| 161 | record_type, record_class = struct.unpack( |
| 162 | '!HH', data[offset + nlen:offset + nlen + 4] |
| 163 | ) |
| 164 | return nlen + 4, (name, None, record_type, record_class, None, None) |
| 165 | |
| 166 | |
| 167 | def parse_header(data): |
no test coverage detected