fixedname.h 1.62 KB
Newer Older
Bob Halley's avatar
add  
Bob Halley committed
1
/*
2
 * Copyright (C) 1999-2001, 2004-2007, 2016  Internet Systems Consortium, Inc. ("ISC")
3
 *
4 5 6
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
Bob Halley's avatar
add  
Bob Halley committed
7 8
 */

Automatic Updater's avatar
Automatic Updater committed
9
/* $Id: fixedname.h,v 1.19 2007/06/19 23:47:16 tbox Exp $ */
David Lawrence's avatar
David Lawrence committed
10

Bob Halley's avatar
add  
Bob Halley committed
11 12 13 14 15 16 17
#ifndef DNS_FIXEDNAME_H
#define DNS_FIXEDNAME_H 1

/*****
 ***** Module Info
 *****/

18
/*! \file dns/fixedname.h
19
 * \brief
Bob Halley's avatar
add  
Bob Halley committed
20 21 22 23 24 25
 * Fixed-size Names
 *
 * dns_fixedname_t is a convenience type containing a name, an offsets table,
 * and a dedicated buffer big enough for the longest possible name.
 *
 * MP:
26
 *\li	The caller must ensure any required synchronization.
Bob Halley's avatar
add  
Bob Halley committed
27 28
 *
 * Reliability:
29
 *\li	No anticipated impact.
Bob Halley's avatar
add  
Bob Halley committed
30 31
 *
 * Resources:
32 33
 *\li	Per dns_fixedname_t:
 *\code
Bob Halley's avatar
add  
Bob Halley committed
34 35
 *		sizeof(dns_name_t) + sizeof(dns_offsets_t) +
 *		sizeof(isc_buffer_t) + 255 bytes + structure padding
36
 *\endcode
Bob Halley's avatar
add  
Bob Halley committed
37 38
 *
 * Security:
39
 *\li	No anticipated impact.
Bob Halley's avatar
add  
Bob Halley committed
40 41
 *
 * Standards:
42
 *\li	None.
Bob Halley's avatar
add  
Bob Halley committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56
 */

/*****
 ***** Imports
 *****/

#include <isc/buffer.h>

#include <dns/name.h>

/*****
 ***** Types
 *****/

57 58 59 60
struct dns_fixedname {
	dns_name_t			name;
	dns_offsets_t			offsets;
	isc_buffer_t			buffer;
61
	unsigned char			data[DNS_NAME_MAXWIRE];
62
};
Bob Halley's avatar
add  
Bob Halley committed
63 64 65 66

#define dns_fixedname_init(fn) \
	do { \
		dns_name_init(&((fn)->name), (fn)->offsets); \
67
		isc_buffer_init(&((fn)->buffer), (fn)->data, \
68
				  DNS_NAME_MAXWIRE); \
Bob Halley's avatar
add  
Bob Halley committed
69 70 71 72 73 74
		dns_name_setbuffer(&((fn)->name), &((fn)->buffer)); \
	} while (0)

#define dns_fixedname_invalidate(fn) \
	dns_name_invalidate(&((fn)->name))

75 76
#define dns_fixedname_name(fn)		(&((fn)->name))

Bob Halley's avatar
add  
Bob Halley committed
77
#endif /* DNS_FIXEDNAME_H */