confview.c revision 40f53fa8d9c6a4fc38c0014495e7a42b08f52481
6185db853e024a486ff8837e6784dd290d866112dougm * Copyright (C) 1999, 2000 Internet Software Consortium.
6185db853e024a486ff8837e6784dd290d866112dougm * Permission to use, copy, modify, and distribute this software for any
6185db853e024a486ff8837e6784dd290d866112dougm * purpose with or without fee is hereby granted, provided that the above
6185db853e024a486ff8837e6784dd290d866112dougm * copyright notice and this permission notice appear in all copies.
6185db853e024a486ff8837e6784dd290d866112dougm * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
6185db853e024a486ff8837e6784dd290d866112dougm * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
6185db853e024a486ff8837e6784dd290d866112dougm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
6185db853e024a486ff8837e6784dd290d866112dougm * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
6185db853e024a486ff8837e6784dd290d866112dougm * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
6185db853e024a486ff8837e6784dd290d866112dougm * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
6185db853e024a486ff8837e6784dd290d866112dougm * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
6185db853e024a486ff8837e6784dd290d866112dougm * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
6185db853e024a486ff8837e6784dd290d866112dougm/* $Id: confview.c,v 1.42 2000/08/01 01:23:30 tale Exp $ */
6185db853e024a486ff8837e6784dd290d866112dougm#include <isc/string.h> /* Required for HP/UX (and others?) */
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami** Due to the repetive nature of the fields in a view
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami** we have here a collection of macros to used in defining
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami** accessor/modifier functions for most of the fields in a view.
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami** Three functions are created: set, get and unset.
6185db853e024a486ff8837e6784dd290d866112dougm** In all the macros FUNC is a character sequence that is used in
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami** constructing the final function name. FIELD is the field in the view.
6185db853e024a486ff8837e6784dd290d866112dougm#define SETBOOL(FUNC, FIELD) SETBYTYPE(isc_boolean_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define GETBOOL(FUNC, FIELD) GETBYTYPE(isc_boolean_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define UNSETBOOL(FUNC, FIELD) UNSETBYTYPE(isc_boolean_t, FUNC, FIELD)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#define SETNOTIFYTYPE(FUNC, FIELD) SETBYTYPE(dns_notifytype_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define GETNOTIFYTYPE(FUNC, FIELD) GETBYTYPE(dns_notifytype_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define UNSETNOTIFYTYPE(FUNC, FIELD) UNSETBYTYPE(dns_notifytype_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define SETUINT32(FUNC, FIELD) SETBYTYPE(isc_uint32_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define GETUINT32(FUNC, FIELD) GETBYTYPE(isc_uint32_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define UNSETUINT32(FUNC, FIELD) UNSETBYTYPE(isc_uint32_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define SETSOCKADDR(FUNC, FIELD) SETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define GETSOCKADDR(FUNC, FIELD) GETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define UNSETSOCKADDR(FUNC, FIELD) UNSETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
6185db853e024a486ff8837e6784dd290d866112dougm#define PVT_CONCAT(x,y) x ## y
6185db853e024a486ff8837e6784dd290d866112dougm** The SET, GET and UNSETBYTYPE macros are all used whene the field in the
6185db853e024a486ff8837e6784dd290d866112dougm** view is a pointer to a fundamental type that requires no special copying,
6185db853e024a486ff8837e6784dd290d866112dougm** such as integers or booleans.
6185db853e024a486ff8837e6784dd290d866112dougmPVT_CONCAT(dns_c_view_set, FUNCNAME)(dns_c_view_t *view, TYPE newval) { \
6185db853e024a486ff8837e6784dd290d866112dougm view->FIELDNAME = isc_mem_get(view->mem, sizeof (TYPE)); \
6185db853e024a486ff8837e6784dd290d866112dougmPVT_CONCAT(dns_c_view_get, FUNCNAME)(dns_c_view_t *view, TYPE *retval) {\
6185db853e024a486ff8837e6784dd290d866112dougmPVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) { \
6185db853e024a486ff8837e6784dd290d866112dougm** Now SET, GET and UNSET for dns_c_ipmatchlist_t fields
6185db853e024a486ff8837e6784dd290d866112dougmPVT_CONCAT(dns_c_view_set, FUNCNAME)(dns_c_view_t *view, \
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwPVT_CONCAT(dns_c_view_unset, FUNCNAME)(dns_c_view_t *view) { \
return (ISC_R_SUCCESS); \
return (ISC_R_NOTFOUND); \
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
isc_result_t r;
if (r != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
const char *viewname,
const char *name)
return (res);
return (result);
return (ISC_R_NOMEMORY);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
if (port == 0) { \
ISC_TRUE));
return (ISC_R_SUCCESS);
return rval;
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (res);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
if (deepcopy) {
return (res);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
if (copy) {
return (res);
return (res);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
switch(transtype) {
case dns_trans_primary:
case dns_trans_secondary:
case dns_trans_response:
return (ISC_R_FAILURE);
if (!existed) {
switch (transtype) {
case dns_trans_primary:
case dns_trans_secondary:
case dns_trans_response:
return (ISC_R_FAILURE);
return (result);
switch(transtype) {
case dns_trans_primary:
case dns_trans_secondary:
case dns_trans_response:
return (ISC_R_FAILURE);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
if (copy) {
return (res);