fixedname.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2001  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: fixedname.h,v 1.19 2007/06/19 23:47:16 tbox Exp $ */
00019 
00020 #ifndef DNS_FIXEDNAME_H
00021 #define DNS_FIXEDNAME_H 1
00022 
00023 /*****
00024  ***** Module Info
00025  *****/
00026 
00027 /*! \file dns/fixedname.h
00028  * \brief
00029  * Fixed-size Names
00030  *
00031  * dns_fixedname_t is a convenience type containing a name, an offsets table,
00032  * and a dedicated buffer big enough for the longest possible name.
00033  *
00034  * MP:
00035  *\li   The caller must ensure any required synchronization.
00036  *
00037  * Reliability:
00038  *\li   No anticipated impact.
00039  *
00040  * Resources:
00041  *\li   Per dns_fixedname_t:
00042  *\code
00043  *              sizeof(dns_name_t) + sizeof(dns_offsets_t) +
00044  *              sizeof(isc_buffer_t) + 255 bytes + structure padding
00045  *\endcode
00046  *
00047  * Security:
00048  *\li   No anticipated impact.
00049  *
00050  * Standards:
00051  *\li   None.
00052  */
00053 
00054 /*****
00055  ***** Imports
00056  *****/
00057 
00058 #include <isc/buffer.h>
00059 
00060 #include <dns/name.h>
00061 
00062 /*****
00063  ***** Types
00064  *****/
00065 
00066 struct dns_fixedname {
00067         dns_name_t                      name;
00068         dns_offsets_t                   offsets;
00069         isc_buffer_t                    buffer;
00070         unsigned char                   data[DNS_NAME_MAXWIRE];
00071 };
00072 
00073 #define dns_fixedname_init(fn) \
00074         do { \
00075                 dns_name_init(&((fn)->name), (fn)->offsets); \
00076                 isc_buffer_init(&((fn)->buffer), (fn)->data, \
00077                                   DNS_NAME_MAXWIRE); \
00078                 dns_name_setbuffer(&((fn)->name), &((fn)->buffer)); \
00079         } while (0)
00080 
00081 #define dns_fixedname_invalidate(fn) \
00082         dns_name_invalidate(&((fn)->name))
00083 
00084 #define dns_fixedname_name(fn)          (&((fn)->name))
00085 
00086 #endif /* DNS_FIXEDNAME_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha