1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * SPDX-License-Identifier: MPL-2.0
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
9  *
10  * See the COPYRIGHT file distributed with this work for additional
11  * information regarding copyright ownership.
12  */
13 
14 #ifndef DNS_FIXEDNAME_H
15 #define DNS_FIXEDNAME_H 1
16 
17 /*****
18 ***** Module Info
19 *****/
20 
21 /*! \file dns/fixedname.h
22  * \brief
23  * Fixed-size Names
24  *
25  * dns_fixedname_t is a convenience type containing a name, an offsets
26  * table, and a dedicated buffer big enough for the longest possible
27  * name. This is typically used for stack-allocated names.
28  *
29  * MP:
30  *\li	The caller must ensure any required synchronization.
31  *
32  * Reliability:
33  *\li	No anticipated impact.
34  *
35  * Resources:
36  *\li	Per dns_fixedname_t:
37  *\code
38  *		sizeof(dns_name_t) + sizeof(dns_offsets_t) +
39  *		sizeof(isc_buffer_t) + 255 bytes + structure padding
40  *\endcode
41  *
42  * Security:
43  *\li	No anticipated impact.
44  *
45  * Standards:
46  *\li	None.
47  */
48 
49 /*****
50 ***** Imports
51 *****/
52 
53 #include <isc/buffer.h>
54 #include <isc/lang.h>
55 
56 #include <dns/name.h>
57 
58 /*****
59 ***** Types
60 *****/
61 
62 struct dns_fixedname {
63 	dns_name_t    name;
64 	dns_offsets_t offsets;
65 	isc_buffer_t  buffer;
66 	unsigned char data[DNS_NAME_MAXWIRE];
67 };
68 
69 ISC_LANG_BEGINDECLS
70 
71 void
72 dns_fixedname_init(dns_fixedname_t *fixed);
73 
74 void
75 dns_fixedname_invalidate(dns_fixedname_t *fixed);
76 
77 dns_name_t *
78 dns_fixedname_name(dns_fixedname_t *fixed);
79 
80 dns_name_t *
81 dns_fixedname_initname(dns_fixedname_t *fixed);
82 
83 ISC_LANG_ENDDECLS
84 
85 #endif /* DNS_FIXEDNAME_H */
86