confctx.c revision bedfa169b4cc5511b34c0c4a54c5b8aae364babe
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * Copyright (C) 1999, 2000 Internet Software Consortium.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * Permission to use, copy, modify, and distribute this software for any
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * purpose with or without fee is hereby granted, provided that the above
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * copyright notice and this permission notice appear in all copies.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews/* $Id: confctx.c,v 1.68 2000/06/09 22:13:20 brister Exp $ */
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#include <isc/string.h> /* Required for HP/UX (and others?) */
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define SETBOOL(FUNC, FIELD) SETBYTYPE(isc_boolean_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define GETBOOL(FUNC, FIELD) GETBYTYPE(isc_boolean_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define UNSETBOOL(FUNC, FIELD) UNSETBYTYPE(isc_boolean_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define SETINT32(FUNC, FIELD) SETBYTYPE(isc_int32_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define GETINT32(FUNC, FIELD) GETBYTYPE(isc_int32_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define UNSETINT32(FUNC, FIELD) UNSETBYTYPE(isc_int32_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define SETUINT32(FUNC, FIELD) SETBYTYPE(isc_uint32_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define GETUINT32(FUNC, FIELD) GETBYTYPE(isc_uint32_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define UNSETUINT32(FUNC, FIELD) UNSETBYTYPE(isc_uint32_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define SETSOCKADDR(FUNC, FIELD) SETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define GETSOCKADDR(FUNC, FIELD) GETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define UNSETSOCKADDR(FUNC, FIELD) UNSETBYTYPE(isc_sockaddr_t, FUNC, FIELD)
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define PVT_CONCAT(x,y) x ## y
4a53e3c2b83c476a93148eaee0272649beb221caMark AndrewsPVT_CONCAT(dns_c_ctx_set, FUNCNAME)(dns_c_ctx_t *cfg, TYPE newval) \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews result = dns_c_ctx_optionsnew(cfg->mem, &cfg->options); \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews options->FIELDNAME = isc_mem_get(options->mem, \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews sizeof (TYPE)); \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews return (existed ? ISC_R_EXISTS : ISC_R_SUCCESS); \
4a53e3c2b83c476a93148eaee0272649beb221caMark AndrewsPVT_CONCAT(dns_c_ctx_get, FUNCNAME)(dns_c_ctx_t *cfg, TYPE *retval) \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#define UNSETBYTYPE(TYPE, FUNCNAME, FIELDNAME) \
4a53e3c2b83c476a93148eaee0272649beb221caMark AndrewsPVT_CONCAT(dns_c_ctx_unset, FUNCNAME)(dns_c_ctx_t *cfg) \
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews isc_mem_put(options->mem, options->FIELDNAME, \
4a53e3c2b83c476a93148eaee0272649beb221caMark AndrewsPVT_CONCAT(dns_c_ctx_set, FUNC)(dns_c_ctx_t *cfg, const char *newval) \
return (res); \
return (ISC_R_NOTFOUND); \
return (ISC_R_NOTFOUND); \
return (ISC_R_NOTFOUND); \
return (ISC_R_SUCCESS); \
char **field,
const char *newval);
char *cpval;
return (result);
isc_result_t r;
return (ISC_R_NOMEMORY);
if (r != ISC_R_SUCCESS) {
if (r != ISC_R_SUCCESS) {
if (r != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
dns_c_ctx_t *c;
c = *cfg;
c->magic = 0;
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
if (port == 0) { \
ISC_TRUE));
ISC_TRUE));
defport);
defport);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
if (deepcopy) {
return (res);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
} else if (deepcopy) {
return (res);
&newc);
return (res);
return (res);
return (res);
return (res);
&newc);
return (res);
return (res);
return (res);
return (res);
return (res);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
if (r != ISC_R_SUCCESS)
result = r;
if (r != ISC_R_SUCCESS)
result = r;
if (r != ISC_R_SUCCESS)
result = r;
if (r != ISC_R_SUCCESS)
result = r;
return (result);
return (res);
newval));
return (res);
charval));
return (res);
switch(transtype) {
case dns_trans_primary:
case dns_trans_secondary:
case dns_trans_response:
return (ISC_R_FAILURE);
if (!existed) {
sizeof (**ptr));
return (ISC_R_NOTFOUND);
switch (transtype) {
case dns_trans_primary:
case dns_trans_secondary:
case dns_trans_response:
return (ISC_R_FAILURE);
return (result);
return (res);
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 (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); \
return (res);
if (copy) {
return (res);
return (res);
return (res);
if (copy) {
return (res);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (res);
return (res);
return (res);
return (ISC_R_FAILURE);
return (res);
return (res);
return (ISC_R_NOTFOUND);
return (res);
return (res);
return (ISC_R_FAILURE);
return (res);
return (res);
return (ISC_R_NOTFOUND);
return (res);
return (res);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return rval;
static isc_result_t
p = *field;
if (p != NULL) {
if (p != NULL) {
p = NULL;
} else if (p == NULL) {
if (p == NULL) {
return (ISC_R_NOMEMORY);
if (p == NULL) {
return (ISC_R_NOMEMORY);
*field = p;
static isc_result_t
} else if (copy) {
newval);
return (res);
return (res);
static isc_result_t
return (res);
static isc_result_t
isc_result_t r;
if (r != ISC_R_SUCCESS) return (r);
return (ISC_R_SUCCESS);
static isc_result_t
return (res);
return (ISC_R_SUCCESS);
static isc_result_t
return (res);
return (res);