keytable.c revision 40f53fa8d9c6a4fc38c0014495e7a42b08f52481
/*
* Copyright (C) 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: keytable.c,v 1.21 2000/08/01 01:22:26 tale Exp $ */
#include <config.h>
#include <dns/keytable.h>
#include <dns/fixedname.h>
struct dns_keytable {
/* Unlocked. */
unsigned int magic;
/* Locked by lock. */
/* Locked by rwlock. */
};
struct dns_keynode {
unsigned int magic;
struct dns_keynode * next;
};
static void
}
/*
* Create a keytable.
*/
return (ISC_R_NOMEMORY);
if (result != ISC_R_SUCCESS)
goto cleanup_keytable;
if (result != ISC_R_SUCCESS) {
"isc_mutex_init() failed: %s",
goto cleanup_rbt;
}
if (result != ISC_R_SUCCESS) {
"isc_rwlock_init() failed: %s",
goto cleanup_lock;
}
keytable->active_nodes = 0;
return (ISC_R_SUCCESS);
return (result);
}
void
/*
* Attach *targetp to source.
*/
source->references++;
}
void
/*
* Detach *keytablep from its keytable.
*/
keytable->references--;
if (destroy) {
}
}
/*
* Add '*keyp' to 'keytable'.
*/
return (ISC_R_NOMEMORY);
}
return (result);
}
{
void *data;
/*
* Search for a key named 'name', matching 'algorithm' and 'tag' in
* 'keytable'.
*/
if (result == ISC_R_SUCCESS) {
break;
}
keytable->active_nodes++;
} else
} else if (result == DNS_R_PARTIALMATCH)
return (result);
}
{
/*
* Search for the next key with the same properties as 'keynode' in
* 'keytable'.
*/
break;
}
keytable->active_nodes++;
} else
return (result);
}
{
void *data;
/*
* Search for the deepest match in 'keytable'.
*/
return (result);
}
void
{
/*
* Give back a keynode found via dns_keytable_findkeynode().
*/
keytable->active_nodes--;
}
{
void *data;
/*
* Is 'name' at or beneath a trusted key?
*/
*wantdnssecp = ISC_TRUE;
} else if (result == ISC_R_NOTFOUND) {
*wantdnssecp = ISC_FALSE;
}
return (result);
}
/*
* Get the DST key associated with keynode.
*/
}