blob: c55a5c1b04660ab4bf49a73d26a71f1005f2e2b3 [file] [log] [blame]
Robin Getz82f0d232009-07-20 14:53:54 -04001/*
2 * (C) Masami Komiya <mkomiya@sonare.it> 2005
3 * Copyright 2009, Robin Getz <rgetz@blackfin.uclinux.org>
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Robin Getz82f0d232009-07-20 14:53:54 -04006 */
7
8#ifndef __DNS_H__
9#define __DNS_H__
10
11#define DNS_SERVICE_PORT 53
12#define DNS_TIMEOUT 10000UL
13
14/* http://en.wikipedia.org/wiki/List_of_DNS_record_types */
15enum dns_query_type {
16 DNS_A_RECORD = 0x01,
17 DNS_CNAME_RECORD = 0x05,
18 DNS_MX_RECORD = 0x0f,
19};
20
21/*
22 * DNS network packet
23 */
24struct header {
25 uint16_t tid; /* Transaction ID */
26 uint16_t flags; /* Flags */
27 uint16_t nqueries; /* Questions */
28 uint16_t nanswers; /* Answers */
29 uint16_t nauth; /* Authority PRs */
30 uint16_t nother; /* Other PRs */
31 unsigned char data[1]; /* Data, variable length */
Denis Pynkin4c7a6e02017-07-21 19:28:42 +030032} __attribute__((packed));
Robin Getz82f0d232009-07-20 14:53:54 -040033
Joe Hershbergerf725e342015-04-08 01:41:15 -050034void dns_start(void); /* Begin DNS */
Robin Getz82f0d232009-07-20 14:53:54 -040035
36#endif