added dns_c_ndcctx_getserver, minor style lint

This commit is contained in:
David Lawrence 2000-04-24 22:53:41 +00:00
parent 026edfb64c
commit 6d4b6f9d4b
2 changed files with 34 additions and 18 deletions

View file

@ -15,11 +15,11 @@
* SOFTWARE.
*/
/* $Id: confndc.c,v 1.10 2000/04/18 00:18:37 gson Exp $ */
/* $Id: confndc.c,v 1.11 2000/04/24 22:53:40 tale Exp $ */
/*
** options {
** [ default-server server_name; ]
** [ default-server server_name; ]
** [ default-key key_name; ]
** };
**
@ -393,6 +393,30 @@ dns_c_ndcctx_addserver(dns_c_ndcctx_t *ctx, dns_c_ndcserver_t **server) {
return (ISC_R_SUCCESS);
}
isc_result_t
dns_c_ndcctx_getserver(dns_c_ndcctx_t *ctx, const char *name,
dns_c_ndcserver_t **server)
{
dns_c_ndcserver_t *s;
REQUIRE(DNS_C_NDCCTX_VALID(ctx));
REQUIRE(name != NULL);
REQUIRE(server != NULL && *server == NULL);
if (ctx->servers != NULL) {
for (s = ISC_LIST_HEAD(ctx->servers->list); s != NULL;
s = ISC_LIST_NEXT(s, next)) {
INSIST(s->name != NULL);
if (strcasecmp(s->name, name) == 0) {
*server = s;
return (ISC_R_SUCCESS);
}
}
}
return (ISC_R_NOTFOUND);
}
isc_result_t
dns_c_ndcctx_getkeys(dns_c_ndcctx_t *ctx, dns_c_kdeflist_t **keys) {
REQUIRE(DNS_C_NDCCTX_VALID(ctx));
@ -843,8 +867,7 @@ parse_file(ndcpcontext *pctx, dns_c_ndcctx_t **context) {
}
static isc_result_t
parse_statement(ndcpcontext *pctx)
{
parse_statement(ndcpcontext *pctx) {
isc_result_t result;
dns_c_ndcctx_t *ctx = pctx->thecontext;
dns_c_ndcopts_t *opts = NULL;
@ -1351,10 +1374,8 @@ eat_eos(ndcpcontext *pctx) {
/* ************* PRIVATE STUFF ************ */
/* ************************************************** */
static isc_result_t
parser_setup(ndcpcontext *pctx, isc_mem_t *mem, const char *filename)
{
parser_setup(ndcpcontext *pctx, isc_mem_t *mem, const char *filename) {
isc_result_t result;
isc_lexspecials_t specials;
struct keywordtoken *tok;

View file

@ -42,8 +42,7 @@ typedef struct dns_c_ndcserver dns_c_ndcserver_t;
typedef struct dns_c_ndcserverlist dns_c_ndcserverlist_t;
typedef struct dns_c_ndckey dnc_c_ndckey_t;
struct dns_c_ndcctx
{
struct dns_c_ndcctx {
isc_mem_t *mem;
isc_uint32_t magic;
@ -52,8 +51,7 @@ struct dns_c_ndcctx
dns_c_kdeflist_t *keys;
};
struct dns_c_ndcopts
{
struct dns_c_ndcopts {
isc_mem_t *mem;
isc_uint32_t magic;
@ -61,18 +59,14 @@ struct dns_c_ndcopts
char *defkey;
};
struct dns_c_ndcserverlist
{
struct dns_c_ndcserverlist {
isc_mem_t *mem;
isc_uint32_t magic;
ISC_LIST(dns_c_ndcserver_t) list;
};
struct dns_c_ndcserver
{
struct dns_c_ndcserver {
isc_mem_t *mem;
isc_uint32_t magic;
@ -82,7 +76,6 @@ struct dns_c_ndcserver
ISC_LINK(dns_c_ndcserver_t) next;
};
/* All the 'set' functions do not delete the replaced value if one exists,
* so if setting a value for a second time, be sure to 'get' the original
* value first and do something with it
@ -100,6 +93,8 @@ isc_result_t dns_c_ndcctx_getservers(dns_c_ndcctx_t *ctx,
dns_c_ndcserverlist_t **servers);
isc_result_t dns_c_ndcctx_addserver(dns_c_ndcctx_t *ctx,
dns_c_ndcserver_t **server);
isc_result_t dns_c_ndcctx_getserver(dns_c_ndcctx_t *ctx, const char *name,
dns_c_ndcserver_t **server);
isc_result_t dns_c_ndcctx_getkeys(dns_c_ndcctx_t *ctx,
dns_c_kdeflist_t **list);
isc_result_t dns_c_ndcctx_setkeys(dns_c_ndcctx_t *ctx,