1 |
27 |
unneback |
#ifndef CYGONCE_NS_DNS_DNS_PRIV_H
|
2 |
|
|
#define CYGONCE_NS_DNS_DNS_PRIV_H
|
3 |
|
|
//=============================================================================
|
4 |
|
|
//
|
5 |
|
|
// dns-priv.h
|
6 |
|
|
//
|
7 |
|
|
// Private DNS client definitions.
|
8 |
|
|
//
|
9 |
|
|
//=============================================================================
|
10 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
18 |
|
|
//
|
19 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
20 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
21 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
22 |
|
|
// for more details.
|
23 |
|
|
//
|
24 |
|
|
// You should have received a copy of the GNU General Public License along
|
25 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
26 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
27 |
|
|
//
|
28 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
29 |
|
|
// or inline functions from this file, or you compile this file and link it
|
30 |
|
|
// with other works to produce a work based on this file, this file does not
|
31 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
32 |
|
|
// License. However the source code for this file must still be made available
|
33 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
36 |
|
|
// this file might be covered by the GNU General Public License.
|
37 |
|
|
//
|
38 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
39 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//=============================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): andrew.lunn
|
46 |
|
|
// Contributors:andrew.lunn, jskov
|
47 |
|
|
// Date: 2001-09-18
|
48 |
|
|
//
|
49 |
|
|
//####DESCRIPTIONEND####
|
50 |
|
|
//
|
51 |
|
|
//=============================================================================
|
52 |
|
|
|
53 |
|
|
struct dns_header {
|
54 |
|
|
#if (CYG_BYTEORDER == CYG_LSBFIRST)
|
55 |
|
|
unsigned id :16; /* query identification number */
|
56 |
|
|
/* fields in third byte */
|
57 |
|
|
unsigned rd :1; /* recursion desired */
|
58 |
|
|
unsigned tc :1; /* truncated message */
|
59 |
|
|
unsigned aa :1; /* authoritive answer */
|
60 |
|
|
unsigned opcode :4; /* purpose of message */
|
61 |
|
|
unsigned qr :1; /* response flag */
|
62 |
|
|
/* fields in fourth byte */
|
63 |
|
|
unsigned rcode :4; /* response code */
|
64 |
|
|
unsigned cd: 1; /* checking disabled by resolver */
|
65 |
|
|
unsigned ad: 1; /* authentic data from named */
|
66 |
|
|
unsigned unused :1; /* unused bits */
|
67 |
|
|
unsigned ra :1; /* recursion available */
|
68 |
|
|
/* remaining bytes */
|
69 |
|
|
unsigned qdcount :16; /* number of question entries */
|
70 |
|
|
unsigned ancount :16; /* number of answer entries */
|
71 |
|
|
unsigned nscount :16; /* number of authority entries */
|
72 |
|
|
unsigned arcount :16; /* number of resource entries */
|
73 |
|
|
#else
|
74 |
|
|
unsigned id :16; /* query identification number */
|
75 |
|
|
/* fields in third byte */
|
76 |
|
|
unsigned qr :1; /* response flag */
|
77 |
|
|
unsigned opcode :4; /* purpose of message */
|
78 |
|
|
unsigned aa :1; /* authoritive answer */
|
79 |
|
|
unsigned tc :1; /* truncated message */
|
80 |
|
|
unsigned rd :1; /* recursion desired */
|
81 |
|
|
/* fields in fourth byte */
|
82 |
|
|
unsigned ra :1; /* recursion available */
|
83 |
|
|
unsigned unused :1; /* unused bits */
|
84 |
|
|
unsigned ad: 1; /* authentic data from named */
|
85 |
|
|
unsigned cd: 1; /* checking disabled by resolver */
|
86 |
|
|
unsigned rcode :4; /* response code */
|
87 |
|
|
/* remaining bytes */
|
88 |
|
|
unsigned qdcount :16; /* number of question entries */
|
89 |
|
|
unsigned ancount :16; /* number of answer entries */
|
90 |
|
|
unsigned nscount :16; /* number of authority entries */
|
91 |
|
|
unsigned arcount :16; /* number of resource entries */
|
92 |
|
|
#endif
|
93 |
|
|
};
|
94 |
|
|
|
95 |
|
|
struct resource_record {
|
96 |
|
|
unsigned rr_type : 16; /* Type of resourse */
|
97 |
|
|
unsigned class : 16; /* Class of resource */
|
98 |
|
|
unsigned ttl : 32; /* Time to live of this record */
|
99 |
|
|
unsigned rdlength: 16; /* Lenght of data to follow */
|
100 |
|
|
char rdata [2]; /* Resource DATA */
|
101 |
|
|
};
|
102 |
|
|
|
103 |
|
|
/* Opcodes */
|
104 |
|
|
#define DNS_QUERY 0 /* Standard query */
|
105 |
|
|
#define DNS_IQUERY 1 /* Inverse query */
|
106 |
|
|
#define DNS_STATUS 2 /* Name server status */
|
107 |
|
|
#define DNS_NOTIFY 4 /* Zone change notification */
|
108 |
|
|
#define DNS_UPDATE 5 /* Zone update message */
|
109 |
|
|
|
110 |
|
|
/* DNS TYPEs */
|
111 |
|
|
#define DNS_TYPE_A 1 /* Host address */
|
112 |
|
|
#define DNS_TYPE_NS 2 /* Authoritative name server */
|
113 |
|
|
#define DNS_TYPE_CNAME 5 /* Canonical name for an alias */
|
114 |
|
|
#define DNS_TYPE_PTR 12 /* Domain name pointer */
|
115 |
|
|
|
116 |
|
|
/* DNS CLASSs */
|
117 |
|
|
#define DNS_CLASS_IN 1 /* Internet */
|
118 |
|
|
|
119 |
|
|
/* DNS reply codes */
|
120 |
|
|
#define DNS_REPLY_NOERR 0
|
121 |
|
|
#define DNS_REPLY_NAME_ERROR 3
|
122 |
|
|
|
123 |
|
|
#define MAXDNSMSGSIZE 512
|
124 |
|
|
|
125 |
|
|
//-----------------------------------------------------------------------------
|
126 |
|
|
#endif // CYGONCE_NS_DNS_DNS_PRIV_H
|
127 |
|
|
// End of dns-priv.h
|