1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SMBSRV_DYNDNS_H
#define _SMBSRV_DYNDNS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <smbsrv/libsmbns.h>
/*
* Header section format:
*
* The header contains the following fields:
*
* 1 1 1 1 1 1
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ID |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | QDCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ANCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | NSCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ARCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* where:
*
* ID A 16 bit identifier assigned by the program that
* generates any kind of query. This identifier is copied
* the corresponding reply and can be used by the requester
* to match up replies to outstanding queries.
*
* QR A one bit field that specifies whether this message is a
* query (0), or a response (1).
*
* OPCODE A four bit field that specifies kind of query in this
* message. This value is set by the originator of a query
* and copied into the response. The values are:
*
* 0 a standard query (QUERY)
*
* 1 an inverse query (IQUERY)
*
* 2 a server status request (STATUS)
*
* 3-15 reserved for future use
*
* AA Authoritative Answer - this bit is valid in responses,
* and specifies that the responding name server is an
* authority for the domain name in question section.
*
* Note that the contents of the answer section may have
* multiple owner names because of aliases. The AA bit
*
* corresponds to the name which matches the query name, or
* the first owner name in the answer section.
*
* TC TrunCation - specifies that this message was truncated
* due to length greater than that permitted on the
* transmission channel.
*
* RD Recursion Desired - this bit may be set in a query and
* is copied into the response. If RD is set, it directs
* the name server to pursue the query recursively.
* Recursive query support is optional.
*
* RA Recursion Available - this be is set or cleared in a
* response, and denotes whether recursive query support is
* available in the name server.
*
* Z Reserved for future use. Must be zero in all queries
* and responses.
*
* RCODE Response code - this 4 bit field is set as part of
* responses. The values have the following
* interpretation:
*
* 0 No error condition
*
* 1 Format error - The name server was
* unable to interpret the query.
*
* 2 Server failure - The name server was
* unable to process this query due to a
* problem with the name server.
*
* 3 Name Error - Meaningful only for
* responses from an authoritative name
* server, this code signifies that the
* domain name referenced in the query does
* not exist.
*
* 4 Not Implemented - The name server does
* not support the requested kind of query.
*
* 5 Refused - The name server refuses to
* perform the specified operation for
* policy reasons. For example, a name
* server may not wish to provide the
* information to the particular requester,
* or a name server may not wish to perform
* a particular operation (e.g., zone
*
* transfer) for particular data.
*
* 6-15 Reserved for future use.
*
* QDCOUNT an unsigned 16 bit integer specifying the number of
* entries in the question section.
*
* ANCOUNT an unsigned 16 bit integer specifying the number of
* resource records in the answer section.
*
* NSCOUNT an unsigned 16 bit integer specifying the number of name
* server resource records in the authority records
* section.
*
* ARCOUNT an unsigned 16 bit integer specifying the number of
* resource records in the additional records section.
*/
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Other definitions: */
#define REQ_QUERY 1 /* DNS query request */
#define REQ_UPDATE 0 /* DNS update request */
#define UPDATE_FORW 1 /* Update forward lookup zone */
#define UPDATE_REV 0 /* Update reverse lookup zone */
#define UPDATE_ADD 1 /* Update add request */
#define UPDATE_DEL 0 /* Update remove request */
#define MODE_GSS_API 3 /* Key negotiation mode */
/* Max buffer size for send and receive buffer */
#define MAX_BUF_SIZE 2000
#define MAX_RETRIES 3 /* Max number of send retries if no response */
#define TSIG_SIGNED 1 /* TSIG contains signed data */
#define TSIG_UNSIGNED 0 /* TSIG does not conain signed data */
#define DNS_CHECK 1 /* Check DNS for entry */
#define DNS_NOCHECK 0 /* Don't check DNS for entry */
#define MAX_TCP_SIZE 2000 /* max tcp DNS message size */
/* Delete 1 entry */
#define DEL_ONE 1
/* Delete all entries of the same resource name */
#define DEL_ALL 0
#define DNSF_RECUR_SUPP 0x80 /* Server can do recursive queries */
#define DNSF_RECUR_QRY 0x100 /* Query is recursive */
#define BUFLEN_TCP(x, y) (MAX_TCP_SIZE-(x-y))
#define BUFLEN_UDP(x, y) (NS_PACKETSZ-(x-y))
/*
* DDNS_TTL is the time to live in DNS caches. Note that this
* does not affect the entry in the authoritative DNS database.
*/
#define DDNS_TTL 1200
#ifdef __cplusplus
}
#endif
#endif /* _SMBSRV_DYNDNS_H */
|