~ubuntu-branches/ubuntu/maverick/bind9/maverick

« back to all changes in this revision

Viewing changes to bin/named/include/named/client.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, Internet Software Consortium, Inc, localization folks
  • Date: 2008-08-02 14:20:20 UTC
  • mfrom: (1.2.1 upstream) (6.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802142020-l1hon9jy8lbbjxmg
[LaMont Jones]

* default to using resolvconf if it is installed
* fix sonames and dependencies.  Closes: #149259, #492418
* Do not build-depend libcap2-dev on non-linux.  Closes: #493392
* drop unused query-loc manpage.  Closes: #492564
* lwresd: Deliver /etc/bind directory.  Closes: #490027
* fix query-source comment in default install

[Internet Software Consortium, Inc]

* 9.5.0-P2.  Closes: #492949

[localization folks]

* l10n: Spanish debconf translation.  Closes: #492425 (Ignacio Mondino)
* l10n: Swedish debconf templates.  Closes: #491369 (Martin Ågren)
* l10n: Japanese debconf translations.  Closes: #492048 (Hideki Yamane
  (Debian-JP))
* l10n: Finnish translation.  Closes: #490630 (Esko Arajärvi)
* l10n: Italian debconf translations.  Closes: #492587 (Alessandro Vietta)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
 
2
 * Copyright (C) 2004-2008  Internet Systems Consortium, Inc. ("ISC")
3
3
 * Copyright (C) 1999-2003  Internet Software Consortium.
4
4
 *
5
 
 * Permission to use, copy, modify, and distribute this software for any
 
5
 * Permission to use, copy, modify, and/or distribute this software for any
6
6
 * purpose with or without fee is hereby granted, provided that the above
7
7
 * copyright notice and this permission notice appear in all copies.
8
8
 *
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: client.h,v 1.60.2.2.10.10 2005/07/29 00:13:08 marka Exp $ */
 
18
/* $Id: client.h,v 1.82.128.2 2008/04/03 06:08:26 tbox Exp $ */
19
19
 
20
20
#ifndef NAMED_CLIENT_H
21
21
#define NAMED_CLIENT_H 1
24
24
 ***** Module Info
25
25
 *****/
26
26
 
27
 
/*
28
 
 * Client
29
 
 *
 
27
/*! \file
 
28
 * \brief
30
29
 * This module defines two objects, ns_client_t and ns_clientmgr_t.
31
30
 *
32
31
 * An ns_client_t object handles incoming DNS requests from clients
44
43
 * fully handled (which can be much later), the ns_client_t must be
45
44
 * notified of this by calling one of the following functions
46
45
 * exactly once in the context of its task:
47
 
 *
 
46
 * \code
48
47
 *   ns_client_send()   (sending a non-error response)
49
48
 *   ns_client_sendraw() (sending a raw response)
50
49
 *   ns_client_error()  (sending an error response)
51
50
 *   ns_client_next()   (sending no response)
52
 
 *
 
51
 *\endcode
53
52
 * This will release any resources used by the request and
54
53
 * and allow the ns_client_t to listen for the next request.
55
54
 *
84
83
 
85
84
typedef ISC_LIST(ns_client_t) client_list_t;
86
85
 
 
86
/*% nameserver client structure */
87
87
struct ns_client {
88
88
        unsigned int            magic;
89
89
        isc_mem_t *             mctx;
116
116
        dns_rdataset_t *        opt;
117
117
        isc_uint16_t            udpsize;
118
118
        isc_uint16_t            extflags;
 
119
        isc_int16_t             ednsversion;    /* -1 noedns */
119
120
        void                    (*next)(ns_client_t *);
120
121
        void                    (*shutdown)(void *arg, isc_result_t result);
121
122
        void                    *shutdown_arg;
122
123
        ns_query_t              query;
123
124
        isc_stdtime_t           requesttime;
124
125
        isc_stdtime_t           now;
125
 
        dns_name_t              signername;   /* [T]SIG key name */
126
 
        dns_name_t *            signer;       /* NULL if not valid sig */
127
 
        isc_boolean_t           mortal;       /* Die after handling request */
 
126
        dns_name_t              signername;   /*%< [T]SIG key name */
 
127
        dns_name_t *            signer;       /*%< NULL if not valid sig */
 
128
        isc_boolean_t           mortal;       /*%< Die after handling request */
128
129
        isc_quota_t             *tcpquota;
129
130
        isc_quota_t             *recursionquota;
130
131
        ns_interface_t          *interface;
132
133
        isc_boolean_t           peeraddr_valid;
133
134
        struct in6_pktinfo      pktinfo;
134
135
        isc_event_t             ctlevent;
135
 
        /*
 
136
        /*%
136
137
         * Information about recent FORMERR response(s), for
137
138
         * FORMERR loop avoidance.  This is separate for each
138
139
         * client object rather than global only to avoid
144
145
                dns_messageid_t         id;
145
146
        } formerrcache;
146
147
        ISC_LINK(ns_client_t)   link;
147
 
        /*
 
148
        /*%
148
149
         * The list 'link' is part of, or NULL if not on any list.
149
150
         */
150
151
        client_list_t           *list;
154
155
#define NS_CLIENT_VALID(c)              ISC_MAGIC_VALID(c, NS_CLIENT_MAGIC)
155
156
 
156
157
#define NS_CLIENTATTR_TCP               0x01
157
 
#define NS_CLIENTATTR_RA                0x02 /* Client gets recusive service */
158
 
#define NS_CLIENTATTR_PKTINFO           0x04 /* pktinfo is valid */
159
 
#define NS_CLIENTATTR_MULTICAST         0x08 /* recv'd from multicast */
160
 
#define NS_CLIENTATTR_WANTDNSSEC        0x10 /* include dnssec records */
 
158
#define NS_CLIENTATTR_RA                0x02 /*%< Client gets recusive service */
 
159
#define NS_CLIENTATTR_PKTINFO           0x04 /*%< pktinfo is valid */
 
160
#define NS_CLIENTATTR_MULTICAST         0x08 /*%< recv'd from multicast */
 
161
#define NS_CLIENTATTR_WANTDNSSEC        0x10 /*%< include dnssec records */
 
162
#define NS_CLIENTATTR_WANTNSID          0x20 /*%< include nameserver ID */
161
163
 
 
164
extern unsigned int ns_client_requests;
162
165
 
163
166
/***
164
167
 *** Functions
165
168
 ***/
166
169
 
167
 
/*
 
170
/*%
168
171
 * Note!  These ns_client_ routines MUST be called ONLY from the client's
169
172
 * task in order to ensure synchronization.
170
173
 */
171
174
 
172
175
void
173
176
ns_client_send(ns_client_t *client);
174
 
/*
 
177
/*%
175
178
 * Finish processing the current client request and
176
179
 * send client->message as a response.
 
180
 * \brief
 
181
 * Note!  These ns_client_ routines MUST be called ONLY from the client's
 
182
 * task in order to ensure synchronization.
177
183
 */
178
184
 
179
185
void
180
186
ns_client_sendraw(ns_client_t *client, dns_message_t *msg);
181
 
/*
 
187
/*%
182
188
 * Finish processing the current client request and
183
189
 * send msg as a response using client->message->id for the id.
184
190
 */
185
191
 
186
192
void
187
193
ns_client_error(ns_client_t *client, isc_result_t result);
188
 
/*
 
194
/*%
189
195
 * Finish processing the current client request and return
190
196
 * an error response to the client.  The error response
191
197
 * will have an RCODE determined by 'result'.
193
199
 
194
200
void
195
201
ns_client_next(ns_client_t *client, isc_result_t result);
196
 
/*
 
202
/*%
197
203
 * Finish processing the current client request,
198
204
 * return no response to the client.
199
205
 */
200
206
 
201
207
isc_boolean_t
202
208
ns_client_shuttingdown(ns_client_t *client);
203
 
/*
 
209
/*%
204
210
 * Return ISC_TRUE iff the client is currently shutting down.
205
211
 */
206
212
 
207
213
void
208
214
ns_client_attach(ns_client_t *source, ns_client_t **target);
209
 
/*
 
215
/*%
210
216
 * Attach '*targetp' to 'source'.
211
217
 */
212
218
 
213
219
void
214
220
ns_client_detach(ns_client_t **clientp);
215
 
/*
 
221
/*%
216
222
 * Detach '*clientp' from its client.
217
223
 */
218
224
 
219
225
isc_result_t
220
226
ns_client_replace(ns_client_t *client);
221
 
/*
 
227
/*%
222
228
 * Try to replace the current client with a new one, so that the
223
229
 * current one can go off and do some lengthy work without
224
230
 * leaving the dispatch/socket without service.
226
232
 
227
233
void
228
234
ns_client_settimeout(ns_client_t *client, unsigned int seconds);
229
 
/*
 
235
/*%
230
236
 * Set a timer in the client to go off in the specified amount of time.
231
237
 */
232
238
 
233
239
isc_result_t
234
240
ns_clientmgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
235
241
                    isc_timermgr_t *timermgr, ns_clientmgr_t **managerp);
236
 
/*
 
242
/*%
237
243
 * Create a client manager.
238
244
 */
239
245
 
240
246
void
241
247
ns_clientmgr_destroy(ns_clientmgr_t **managerp);
242
 
/*
 
248
/*%
243
249
 * Destroy a client manager and all ns_client_t objects
244
250
 * managed by it.
245
251
 */
247
253
isc_result_t
248
254
ns_clientmgr_createclients(ns_clientmgr_t *manager, unsigned int n,
249
255
                           ns_interface_t *ifp, isc_boolean_t tcp);
250
 
/*
 
256
/*%
251
257
 * Create up to 'n' clients listening on interface 'ifp'.
252
258
 * If 'tcp' is ISC_TRUE, the clients will listen for TCP connections,
253
259
 * otherwise for UDP requests.
255
261
 
256
262
isc_sockaddr_t *
257
263
ns_client_getsockaddr(ns_client_t *client);
258
 
/*
 
264
/*%
259
265
 * Get the socket address of the client whose request is
260
266
 * currently being processed.
261
267
 */
262
268
 
263
269
isc_result_t
264
 
ns_client_checkaclsilent(ns_client_t  *client,dns_acl_t *acl,
 
270
ns_client_checkaclsilent(ns_client_t *client,
 
271
                         isc_sockaddr_t *sockaddr,
 
272
                         dns_acl_t *acl,
265
273
                         isc_boolean_t default_allow);
266
274
 
267
 
/*
 
275
/*%
268
276
 * Convenience function for client request ACL checking.
269
277
 *
270
278
 * Check the current client request against 'acl'.  If 'acl'
271
279
 * is NULL, allow the request iff 'default_allow' is ISC_TRUE.
 
280
 * If netaddr is NULL, check the ACL against client->peeraddr;
 
281
 * otherwise check it against netaddr.
272
282
 *
273
283
 * Notes:
274
 
 *      This is appropriate for checking allow-update,
 
284
 *\li   This is appropriate for checking allow-update,
275
285
 *      allow-query, allow-transfer, etc.  It is not appropriate
276
286
 *      for checking the blackhole list because we treat positive
277
287
 *      matches as "allow" and negative matches as "deny"; in
278
288
 *      the case of the blackhole list this would be backwards.
279
289
 *
280
290
 * Requires:
281
 
 *      'client' points to a valid client.
282
 
 *      'acl' points to a valid ACL, or is NULL.
 
291
 *\li   'client' points to a valid client.
 
292
 *\li   'sockaddr' points to a valid address, or is NULL.
 
293
 *\li   'acl' points to a valid ACL, or is NULL.
283
294
 *
284
295
 * Returns:
285
 
 *      ISC_R_SUCCESS   if the request should be allowed
286
 
 *      ISC_R_REFUSED   if the request should be denied
287
 
 *      No other return values are possible.
 
296
 *\li   ISC_R_SUCCESS   if the request should be allowed
 
297
 * \li  ISC_R_REFUSED   if the request should be denied
 
298
 *\li   No other return values are possible.
288
299
 */
289
300
 
290
301
isc_result_t
291
302
ns_client_checkacl(ns_client_t  *client,
 
303
                   isc_sockaddr_t *sockaddr,
292
304
                   const char *opname, dns_acl_t *acl,
293
305
                   isc_boolean_t default_allow,
294
306
                   int log_level);
295
 
/*
296
 
 * Like ns_client_checkacl, but also logs the outcome of the
297
 
 * check at log level 'log_level' if denied, and at debug 3
298
 
 * if approved.  Log messages will refer to the request as
299
 
 * an 'opname' request.
 
307
/*%
 
308
 * Like ns_client_checkaclsilent, except the outcome of the check is
 
309
 * logged at log level 'log_level' if denied, and at debug 3 if approved.
 
310
 * Log messages will refer to the request as an 'opname' request.
300
311
 *
301
312
 * Requires:
302
 
 *      Those of ns_client_checkaclsilent(), and:
303
 
 *
304
 
 *      'opname' points to a null-terminated string.
 
313
 *\li   'client' points to a valid client.
 
314
 *\li   'sockaddr' points to a valid address, or is NULL.
 
315
 *\li   'acl' points to a valid ACL, or is NULL.
 
316
 *\li   'opname' points to a null-terminated string.
305
317
 */
306
318
 
307
319
void
324
336
void
325
337
ns_client_recursing(ns_client_t *client);
326
338
/*%
327
 
 * Add client to end of recursing list.  If 'killoldest' is true
328
 
 * kill the oldest recursive client (list head). 
 
339
 * Add client to end of th recursing list.
329
340
 */
330
341
 
331
342
void
336
347
 
337
348
void
338
349
ns_client_dumprecursing(FILE *f, ns_clientmgr_t *manager);
339
 
/*
 
350
/*%
340
351
 * Dump the outstanding recursive queries to 'f'.
341
352
 */
342
353
 
 
354
void
 
355
ns_client_qnamereplace(ns_client_t *client, dns_name_t *name);
 
356
/*%
 
357
 * Replace the qname.
 
358
 */
 
359
 
 
360
isc_boolean_t
 
361
ns_client_isself(dns_view_t *myview, dns_tsigkey_t *mykey,
 
362
                 isc_sockaddr_t *srcaddr, isc_sockaddr_t *destaddr,
 
363
                 dns_rdataclass_t rdclass, void *arg);
 
364
/*%
 
365
 * Isself callback.
 
366
 */
 
367
 
343
368
#endif /* NAMED_CLIENT_H */