object.c revision 499b34cea04a46823d003d4c0520c8b03e8513cb
/*
* Copyright (C) 1996-2001 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: object.c,v 1.23 2001/01/09 22:00:04 bwelling Exp $ */
/* Principal Author: Ted Lemon */
#include <config.h>
struct omapi_objecttype {
const char * name;
omapi_value_t **value);
const char *name,
};
{
size = sizeof(omapi_generic_t);
}
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
}
void
*r = h;
h->refcnt++;
}
void
int outer_reference = 0;
int inner_reference = 0;
int handle_reference = 0;
int extra_references;
omapi_object_t *p = NULL;
/*
* See if this object's inner object refers back to it, but don't
* count this as a reference if we're being asked to free the
* reference from the inner object.
*/
/*
* XXXDCL my wording
* Note whether the object being dereferenced has an inner object, but
* only if the inner object's own outer pointer is not what is
* being dereferenced.
* (XXXDCL when does it happen that way ?)
*/
inner_reference = 1;
/*
* Ditto for the outer object.
*/
outer_reference = 1;
/*
* Ditto for the handle object. The code below assumes that
* the only reason we'd get a dereference from the handle
* table is if this function does it - otherwise we'd have to
* traverse the handle table to find the address where the
* reference is stored and compare against that, and we don't
* want to do that if we can avoid it.
*/
if ((*h)->handle != 0)
handle_reference = 1;
/*
* If we are getting rid of the last reference other than
* references to inner and outer objects, or from the handle
* table, then we must examine all the objects in either
* direction to see if they hold any non-inner, non-outer,
* non-handle-table references. If not, we need to free the
* entire chain of objects.
*/
if ((*h)->refcnt ==
/*
* If refcnt is > 1, then inner_reference + outer_reference +
* handle_reference is > 0, so there are list references to
* chase.
*/
if ((*h)->refcnt > 1) {
/*
* XXXTL we could check for a reference from the
* handle table here.
*/
extra_references = 0;
if (inner_reference != 0)
for (p = (*h)->inner;
p != NULL && extra_references == 0;
p = p->inner) {
if (p->handle != 0)
}
if (outer_reference != 0)
for (p = (*h)->outer;
p != NULL && extra_references == 0;
p = p->outer) {
if (p->handle != 0)
}
} else
extra_references = 0;
if (extra_references == 0) {
void *arg = (*h)->destroy_arg;
if (inner_reference != 0)
OBJECT_DEREF(&(*h)->inner);
if (outer_reference != 0)
OBJECT_DEREF(&(*h)->outer);
(*h)->refcnt = 0;
sizeof(isc_event_t));
}
} else
(*h)->refcnt--;
} else
(*h)->refcnt--;
*h = NULL;
}
omapi_data_t *),
omapi_value_t **),
void (*destroy)(omapi_object_t *),
const char *, va_list),
omapi_object_t *),
omapi_object_t *),
{
t = isc_mem_get(omapi_mctx, sizeof(*t));
if (t == NULL)
return (ISC_R_NOMEMORY);
memset(t, 0, sizeof(*t));
t->signal_handler = signal_handler;
t->stuff_values = stuff_values;
t->next = omapi_object_types;
omapi_object_types = t;
*type = t;
return (ISC_R_SUCCESS);
}
break;
return (type);
}
void
object_destroytypes(void) {
}
}
/*
* Call the signal method for an object chain, starting at the outermost
* object.
*/
;
else
return (result);
}
/*
* Call the signal method for the named object. Used by message_process().
*/
else
return (ISC_R_NOTFOUND);
}
{
;
return (ISC_R_NOTFOUND);
}
{
if (result != ISC_R_SUCCESS)
return (result);
}
{
int boolean_value;
omapi_string_t *n = NULL;
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (result);
}
omapi_string_t *n = NULL;
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (result);
}
{
omapi_string_t *n = NULL;
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (result);
}
{
omapi_string_t *n = NULL;
if (result != ISC_R_SUCCESS)
return (result);
if (result != ISC_R_SUCCESS) {
return (result);
}
return (result);
}
{
if (result != ISC_R_SUCCESS)
return (result);
;
else
return (result);
}
;
return (ISC_R_NOTFOUND);
}
{
unsigned int i;
return (ISC_R_NOTIMPLEMENTED);
if (result != ISC_R_SUCCESS)
return (result);
}
if (handle != 0)
if (result != ISC_R_NOTFOUND)
return (result);
return (ISC_R_SUCCESS);
}
{
else
return (ISC_R_NOTFOUND);
}
{
else
return (ISC_R_NOTFOUND);
}
else
return (ISC_R_NOTFOUND);
}
{
else
return (ISC_R_SUCCESS);
}
{
else
return (ISC_R_NOTIMPLEMENTED);
}
else
return (ISC_R_NOTIMPLEMENTED);
}
else
return (ISC_R_NOTIMPLEMENTED);
}