Merge from vendor branch SENDMAIL:
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / dns / include / dns / fixedname.h
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: fixedname.h,v 1.12.2.1 2004/03/09 06:11:15 marka Exp $ */
19
20 #ifndef DNS_FIXEDNAME_H
21 #define DNS_FIXEDNAME_H 1
22
23 /*****
24  ***** Module Info
25  *****/
26
27 /*
28  * Fixed-size Names
29  *
30  * dns_fixedname_t is a convenience type containing a name, an offsets table,
31  * and a dedicated buffer big enough for the longest possible name.
32  *
33  * MP:
34  *      The caller must ensure any required synchronization.
35  *
36  * Reliability:
37  *      No anticipated impact.
38  *
39  * Resources:
40  *      Per dns_fixedname_t:
41  *              sizeof(dns_name_t) + sizeof(dns_offsets_t) +
42  *              sizeof(isc_buffer_t) + 255 bytes + structure padding
43  *
44  * Security:
45  *      No anticipated impact.
46  *
47  * Standards:
48  *      None.
49  */
50
51 /*****
52  ***** Imports
53  *****/
54
55 #include <isc/buffer.h>
56
57 #include <dns/name.h>
58
59 /*****
60  ***** Types
61  *****/
62
63 struct dns_fixedname {
64         dns_name_t                      name;
65         dns_offsets_t                   offsets;
66         isc_buffer_t                    buffer;
67         unsigned char                   data[DNS_NAME_MAXWIRE];
68 };
69
70 #define dns_fixedname_init(fn) \
71         do { \
72                 dns_name_init(&((fn)->name), (fn)->offsets); \
73                 isc_buffer_init(&((fn)->buffer), (fn)->data, \
74                                   DNS_NAME_MAXWIRE); \
75                 dns_name_setbuffer(&((fn)->name), &((fn)->buffer)); \
76         } while (0)
77
78 #define dns_fixedname_invalidate(fn) \
79         dns_name_invalidate(&((fn)->name))
80
81 #define dns_fixedname_name(fn)          (&((fn)->name))
82
83 #endif /* DNS_FIXEDNAME_H */