Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Robin Getz | 1a32bf4 | 2009-07-20 14:53:54 -0400 | [diff] [blame] | 2 | /* |
| 3 | * (C) Masami Komiya <mkomiya@sonare.it> 2005 |
| 4 | * Copyright 2009, Robin Getz <rgetz@blackfin.uclinux.org> |
Robin Getz | 1a32bf4 | 2009-07-20 14:53:54 -0400 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __DNS_H__ |
| 8 | #define __DNS_H__ |
| 9 | |
| 10 | #define DNS_SERVICE_PORT 53 |
| 11 | #define DNS_TIMEOUT 10000UL |
| 12 | |
| 13 | /* http://en.wikipedia.org/wiki/List_of_DNS_record_types */ |
| 14 | enum dns_query_type { |
| 15 | DNS_A_RECORD = 0x01, |
| 16 | DNS_CNAME_RECORD = 0x05, |
| 17 | DNS_MX_RECORD = 0x0f, |
| 18 | }; |
| 19 | |
| 20 | /* |
| 21 | * DNS network packet |
| 22 | */ |
| 23 | struct header { |
| 24 | uint16_t tid; /* Transaction ID */ |
| 25 | uint16_t flags; /* Flags */ |
| 26 | uint16_t nqueries; /* Questions */ |
| 27 | uint16_t nanswers; /* Answers */ |
| 28 | uint16_t nauth; /* Authority PRs */ |
| 29 | uint16_t nother; /* Other PRs */ |
| 30 | unsigned char data[1]; /* Data, variable length */ |
Denis Pynkin | 704f3ac | 2017-07-21 19:28:42 +0300 | [diff] [blame] | 31 | } __attribute__((packed)); |
Robin Getz | 1a32bf4 | 2009-07-20 14:53:54 -0400 | [diff] [blame] | 32 | |
Joe Hershberger | 786eac5 | 2015-04-08 01:41:15 -0500 | [diff] [blame] | 33 | void dns_start(void); /* Begin DNS */ |
Robin Getz | 1a32bf4 | 2009-07-20 14:53:54 -0400 | [diff] [blame] | 34 | |
| 35 | #endif |