mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-04 16:25:21 +00:00
Fix compilation errors introduced in the last set of checkins.
This commit is contained in:
@@ -19,9 +19,9 @@
|
||||
|
||||
CATMANPAGES = omapi.cat3
|
||||
SEDMANPAGES = omapi.man3
|
||||
SRC = protocol.c buffer.c alloc.c result.c connection.c \
|
||||
SRC = protocol.c buffer.c alloc.c result.c connection.c errwarn.c \
|
||||
listener.c dispatch.c generic.c support.c handle.c message.c
|
||||
OBJ = protocol.o buffer.o alloc.o result.o connection.o \
|
||||
OBJ = protocol.o buffer.o alloc.o result.o connection.o errwarn.o \
|
||||
listener.o dispatch.o generic.o support.o handle.o message.o
|
||||
MAN = omapi.3
|
||||
|
||||
|
309
omapip/alloc.c
309
omapip/alloc.c
@@ -4,7 +4,7 @@
|
||||
protocol... */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Use is subject to license terms which appear in the file named
|
||||
* ISC-LICENSE that should have accompanied this file when you
|
||||
* received it. If a file named ISC-LICENSE did not accompany this
|
||||
@@ -23,6 +23,270 @@
|
||||
|
||||
#include <omapip/omapip_p.h>
|
||||
|
||||
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
|
||||
struct dmalloc_preamble *dmalloc_list;
|
||||
unsigned long dmalloc_outstanding;
|
||||
unsigned long dmalloc_longterm;
|
||||
unsigned long dmalloc_generation;
|
||||
unsigned long dmalloc_cutoff_generation;
|
||||
#endif
|
||||
|
||||
#if defined (DEBUG_RC_HISTORY)
|
||||
struct rc_history_entry rc_history [RC_HISTORY_MAX];
|
||||
int rc_history_index;
|
||||
#endif
|
||||
|
||||
VOIDPTR dmalloc (size, file, line)
|
||||
unsigned size;
|
||||
const char *file;
|
||||
int line;
|
||||
{
|
||||
unsigned char *foo = dmalloc (size + DMDSIZE, file, line);
|
||||
int i;
|
||||
VOIDPTR *bar;
|
||||
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
|
||||
struct dmalloc_preamble *dp;
|
||||
#endif
|
||||
if (!foo)
|
||||
return (VOIDPTR)0;
|
||||
bar = (VOIDPTR)(foo + DMDOFFSET);
|
||||
memset (bar, 0, size);
|
||||
|
||||
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
|
||||
dp = (struct dmalloc_preamble *)foo;
|
||||
dp -> prev = dmalloc_list;
|
||||
if (dmalloc_list)
|
||||
dmalloc_list -> next = dp;
|
||||
dmalloc_list = dp;
|
||||
dp -> next = (struct dmalloc_preamble *)0;
|
||||
dp -> size = size;
|
||||
dp -> file = file;
|
||||
dp -> line = line;
|
||||
dp -> generation = dmalloc_generation++;
|
||||
dmalloc_outstanding += size;
|
||||
for (i = 0; i < DMLFSIZE; i++)
|
||||
dp -> low_fence [i] =
|
||||
(((unsigned long)
|
||||
(&dp -> low_fence [i])) % 143) + 113;
|
||||
for (i = DMDOFFSET; i < DMDSIZE; i++)
|
||||
foo [i + size] =
|
||||
(((unsigned long)
|
||||
(&foo [i + size])) % 143) + 113;
|
||||
#if defined (DEBUG_MALLOC_POOL_EXHAUSTIVELY)
|
||||
/* Check _every_ entry in the pool! Very expensive. */
|
||||
for (dp = dmalloc_list; dp; dp = dp -> prev) {
|
||||
for (i = 0; i < DMLFSIZE; i++) {
|
||||
if (dp -> low_fence [i] !=
|
||||
(((unsigned long)
|
||||
(&dp -> low_fence [i])) % 143) + 113)
|
||||
{
|
||||
log_error ("malloc fence modified: %s(%d)",
|
||||
dp -> file, dp -> line);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
foo = (unsigned char *)dp;
|
||||
for (i = DMDOFFSET; i < DMDSIZE; i++) {
|
||||
if (foo [i + dp -> size] !=
|
||||
(((unsigned long)
|
||||
(&foo [i + dp -> size])) % 143) + 113) {
|
||||
log_error ("malloc fence modified: %s(%d)",
|
||||
dp -> file, dp -> line);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return bar;
|
||||
}
|
||||
|
||||
void dfree (ptr, file, line)
|
||||
VOIDPTR ptr;
|
||||
const char *file;
|
||||
int line;
|
||||
{
|
||||
if (!ptr) {
|
||||
log_error ("dfree %s(%d): free on null pointer.", file, line);
|
||||
return;
|
||||
}
|
||||
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
|
||||
{
|
||||
unsigned char *bar = ptr;
|
||||
struct dmalloc_preamble *dp, *cur;
|
||||
int i;
|
||||
bar -= DMDOFFSET;
|
||||
cur = (struct dmalloc_preamble *)bar;
|
||||
for (dp = dmalloc_list; dp; dp = dp -> prev)
|
||||
if (dp == cur)
|
||||
break;
|
||||
if (!dp) {
|
||||
log_error ("%s(%d): freeing unknown memory: %lx",
|
||||
dp -> file, dp -> line, (unsigned long)cur);
|
||||
abort ();
|
||||
}
|
||||
if (dp -> prev)
|
||||
dp -> prev -> next = dp -> next;
|
||||
if (dp -> next)
|
||||
dp -> next -> prev = dp -> prev;
|
||||
if (dp == dmalloc_list)
|
||||
dmalloc_list = dp -> prev;
|
||||
if (dp -> generation >= dmalloc_cutoff_generation)
|
||||
dmalloc_outstanding -= dp -> size;
|
||||
else
|
||||
dmalloc_longterm -= dp -> size;
|
||||
|
||||
for (i = 0; i < DMLFSIZE; i++) {
|
||||
if (dp -> low_fence [i] !=
|
||||
(((unsigned long)
|
||||
(&dp -> low_fence [i])) % 143) + 113)
|
||||
{
|
||||
log_error ("malloc fence modified: %s(%d)",
|
||||
dp -> file, dp -> line);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
for (i = DMDOFFSET; i < DMDSIZE; i++) {
|
||||
if (bar [i + dp -> size] !=
|
||||
(((unsigned long)
|
||||
(&bar [i + dp -> size])) % 143) + 113) {
|
||||
log_error ("malloc fence modified: %s(%d)",
|
||||
dp -> file, dp -> line);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
ptr = bar;
|
||||
}
|
||||
#endif
|
||||
free (ptr);
|
||||
}
|
||||
|
||||
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
|
||||
/* For allocation functions that keep their own free lists, we want to
|
||||
account for the reuse of the memory. */
|
||||
|
||||
void dmalloc_reuse (foo, file, line, justref)
|
||||
VOIDPTR foo;
|
||||
const char *file;
|
||||
int line;
|
||||
int justref;
|
||||
{
|
||||
struct dmalloc_preamble *dp;
|
||||
|
||||
/* Get the pointer to the dmalloc header. */
|
||||
dp = foo;
|
||||
dp--;
|
||||
|
||||
/* If we just allocated this and are now referencing it, this
|
||||
function would almost be a no-op, except that it would
|
||||
increment the generation count needlessly. So just return
|
||||
in this case. */
|
||||
if (dp -> generation == dmalloc_generation)
|
||||
return;
|
||||
|
||||
/* If this is longterm data, and we just made reference to it,
|
||||
don't put it on the short-term list or change its name -
|
||||
we don't need to know about this. */
|
||||
if (dp -> generation < dmalloc_cutoff_generation && justref)
|
||||
return;
|
||||
|
||||
/* Take it out of the place in the allocated list where it was. */
|
||||
if (dp -> prev)
|
||||
dp -> prev -> next = dp -> next;
|
||||
if (dp -> next)
|
||||
dp -> next -> prev = dp -> prev;
|
||||
if (dp == dmalloc_list)
|
||||
dmalloc_list = dp -> prev;
|
||||
|
||||
/* Account for its removal. */
|
||||
if (dp -> generation >= dmalloc_cutoff_generation)
|
||||
dmalloc_outstanding -= dp -> size;
|
||||
else
|
||||
dmalloc_longterm -= dp -> size;
|
||||
|
||||
/* Now put it at the head of the list. */
|
||||
dp -> prev = dmalloc_list;
|
||||
if (dmalloc_list)
|
||||
dmalloc_list -> next = dp;
|
||||
dmalloc_list = dp;
|
||||
dp -> next = (struct dmalloc_preamble *)0;
|
||||
|
||||
/* Change the reference location information. */
|
||||
dp -> file = file;
|
||||
dp -> line = line;
|
||||
|
||||
/* Increment the generation. */
|
||||
dp -> generation = dmalloc_generation++;
|
||||
|
||||
/* Account for it. */
|
||||
dmalloc_outstanding += dp -> size;
|
||||
}
|
||||
|
||||
void dmalloc_dump_outstanding ()
|
||||
{
|
||||
static unsigned long dmalloc_cutoff_point;
|
||||
struct dmalloc_preamble *dp;
|
||||
unsigned char *foo;
|
||||
int i;
|
||||
|
||||
if (!dmalloc_cutoff_point)
|
||||
dmalloc_cutoff_point = dmalloc_cutoff_generation;
|
||||
for (dp = dmalloc_list; dp; dp = dp -> prev) {
|
||||
if (dp -> generation <= dmalloc_cutoff_point)
|
||||
break;
|
||||
#if defined (DEBUG_MALLOC_POOL)
|
||||
for (i = 0; i < DMLFSIZE; i++) {
|
||||
if (dp -> low_fence [i] !=
|
||||
(((unsigned long)
|
||||
(&dp -> low_fence [i])) % 143) + 113)
|
||||
{
|
||||
log_error ("malloc fence modified: %s(%d)",
|
||||
dp -> file, dp -> line);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
foo = (unsigned char *)dp;
|
||||
for (i = DMDOFFSET; i < DMDSIZE; i++) {
|
||||
if (foo [i + dp -> size] !=
|
||||
(((unsigned long)
|
||||
(&foo [i + dp -> size])) % 143) + 113) {
|
||||
log_error ("malloc fence modified: %s(%d)",
|
||||
dp -> file, dp -> line);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined (DEBUG_MEMORY_LEAKAGE)
|
||||
/* Don't count data that's actually on a free list
|
||||
somewhere. */
|
||||
if (dp -> file)
|
||||
log_info (" %s(%d): %d",
|
||||
dp -> file, dp -> line, dp -> size);
|
||||
#endif
|
||||
}
|
||||
if (dmalloc_list)
|
||||
dmalloc_cutoff_point = dmalloc_list -> generation;
|
||||
}
|
||||
#endif /* DEBUG_MEMORY_LEAKAGE || DEBUG_MALLOC_POOL */
|
||||
|
||||
#if defined (DEBUG_RC_HISTORY)
|
||||
void dump_rc_history ()
|
||||
{
|
||||
int i;
|
||||
|
||||
i = rc_history_index;
|
||||
do {
|
||||
log_info (" referenced by %s(%d): addr = %lx refcnt = %x\n",
|
||||
rc_history [i].file, rc_history [i].line,
|
||||
(unsigned long)rc_history [i].addr,
|
||||
rc_history [i].refcnt);
|
||||
++i;
|
||||
if (i == RC_HISTORY_MAX)
|
||||
i = 0;
|
||||
} while (i != rc_history_index && rc_history [i].file);
|
||||
}
|
||||
#endif
|
||||
|
||||
isc_result_t omapi_object_reference (omapi_object_t **r,
|
||||
omapi_object_t *h,
|
||||
const char *file, int line)
|
||||
@@ -46,7 +310,7 @@ isc_result_t omapi_object_reference (omapi_object_t **r,
|
||||
}
|
||||
|
||||
isc_result_t omapi_object_dereference (omapi_object_t **h,
|
||||
const char *name)
|
||||
const char *file, int line)
|
||||
{
|
||||
int outer_reference = 0;
|
||||
int inner_reference = 0;
|
||||
@@ -59,7 +323,7 @@ isc_result_t omapi_object_dereference (omapi_object_t **h,
|
||||
|
||||
if (!*h) {
|
||||
#if defined (ALLOCATION_DEBUGGING)
|
||||
abort ("%s: dereference of null pointer!", name);
|
||||
abort ("%s(%d): dereference of null pointer!", file, line);
|
||||
#else
|
||||
return ISC_R_INVALIDARG;
|
||||
#endif
|
||||
@@ -67,7 +331,8 @@ isc_result_t omapi_object_dereference (omapi_object_t **h,
|
||||
|
||||
if ((*h) -> refcnt <= 0) {
|
||||
#if defined (ALLOCATION_DEBUGGING)
|
||||
abort ("dereference of pointer with refcnt of zero!");
|
||||
abort ("%s(%d): dereference of pointer with refcnt of zero!",
|
||||
file, line);
|
||||
#else
|
||||
return ISC_R_INVALIDARG;
|
||||
#endif
|
||||
@@ -184,7 +449,7 @@ isc_result_t omapi_buffer_reference (omapi_buffer_t **r,
|
||||
}
|
||||
|
||||
isc_result_t omapi_buffer_dereference (omapi_buffer_t **h,
|
||||
const char *name)
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!h)
|
||||
return ISC_R_INVALIDARG;
|
||||
@@ -213,7 +478,8 @@ isc_result_t omapi_buffer_dereference (omapi_buffer_t **h,
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
|
||||
isc_result_t omapi_typed_data_new (const char *file, int line,
|
||||
omapi_typed_data_t **t,
|
||||
omapi_datatype_t type, ...)
|
||||
{
|
||||
va_list l;
|
||||
@@ -223,8 +489,6 @@ isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
|
||||
int intval;
|
||||
char *s;
|
||||
isc_result_t status;
|
||||
const char *file;
|
||||
int line;
|
||||
omapi_object_t *obj;
|
||||
|
||||
va_start (l, type);
|
||||
@@ -251,10 +515,6 @@ isc_result_t omapi_typed_data_new (omapi_typed_data_t **t,
|
||||
return ISC_R_INVALIDARG;
|
||||
}
|
||||
|
||||
/* XXX not necessary if not doing malloc debugging. */
|
||||
file = va_arg (l, const char *);
|
||||
line = va_arg (l, int);
|
||||
|
||||
new = dmalloc (len, file, line);
|
||||
if (!new)
|
||||
return ISC_R_NOMEMORY;
|
||||
@@ -307,14 +567,14 @@ isc_result_t omapi_typed_data_reference (omapi_typed_data_t **r,
|
||||
}
|
||||
|
||||
isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **h,
|
||||
const char *file, line)
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!h)
|
||||
return ISC_R_INVALIDARG;
|
||||
|
||||
if (!*h) {
|
||||
#if defined (ALLOCATION_DEBUGGING)
|
||||
abort ("%s: dereference of null pointer!", name);
|
||||
abort ("%s(%d): dereference of null pointer!", file, line);
|
||||
#else
|
||||
return ISC_R_INVALIDARG;
|
||||
#endif
|
||||
@@ -322,7 +582,8 @@ isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **h,
|
||||
|
||||
if ((*h) -> refcnt <= 0) {
|
||||
#if defined (ALLOCATION_DEBUGGING)
|
||||
abort ("dereference of pointer with refcnt of zero!");
|
||||
abort ("%s(%d): dereference of pointer with refcnt of zero!",
|
||||
file, line);
|
||||
#else
|
||||
return ISC_R_INVALIDARG;
|
||||
#endif
|
||||
@@ -363,7 +624,7 @@ isc_result_t omapi_data_string_new (omapi_data_string_t **d, unsigned len,
|
||||
|
||||
isc_result_t omapi_data_string_reference (omapi_data_string_t **r,
|
||||
omapi_data_string_t *h,
|
||||
const char *file, line)
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!h || !r)
|
||||
return ISC_R_INVALIDARG;
|
||||
@@ -383,7 +644,7 @@ isc_result_t omapi_data_string_reference (omapi_data_string_t **r,
|
||||
}
|
||||
|
||||
isc_result_t omapi_data_string_dereference (omapi_data_string_t **h,
|
||||
const char *file, line)
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!h)
|
||||
return ISC_R_INVALIDARG;
|
||||
@@ -406,7 +667,7 @@ isc_result_t omapi_data_string_dereference (omapi_data_string_t **h,
|
||||
}
|
||||
|
||||
--((*h) -> refcnt);
|
||||
rc_register (file, line, h, h -> refcnt);
|
||||
rc_register (file, line, h, (*h) -> refcnt);
|
||||
if ((*h) -> refcnt <= 0 ) {
|
||||
dfree (*h, file, line);
|
||||
}
|
||||
@@ -428,7 +689,7 @@ isc_result_t omapi_value_new (omapi_value_t **d,
|
||||
|
||||
isc_result_t omapi_value_reference (omapi_value_t **r,
|
||||
omapi_value_t *h,
|
||||
const char *file, line)
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!h || !r)
|
||||
return ISC_R_INVALIDARG;
|
||||
@@ -449,7 +710,7 @@ isc_result_t omapi_value_reference (omapi_value_t **r,
|
||||
}
|
||||
|
||||
isc_result_t omapi_value_dereference (omapi_value_t **h,
|
||||
const char *name)
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!h)
|
||||
return ISC_R_INVALIDARG;
|
||||
@@ -472,12 +733,14 @@ isc_result_t omapi_value_dereference (omapi_value_t **h,
|
||||
}
|
||||
|
||||
--((*h) -> refcnt);
|
||||
rc_register (file, line, h, h -> refcnt);
|
||||
rc_register (file, line, h, (*h) -> refcnt);
|
||||
if ((*h) -> refcnt <= 0 ) {
|
||||
if ((*h) -> name)
|
||||
omapi_data_string_dereference (&(*h) -> name, name);
|
||||
omapi_data_string_dereference (&(*h) -> name,
|
||||
file, line);
|
||||
if ((*h) -> value)
|
||||
omapi_typed_data_dereference (&(*h) -> value, name);
|
||||
omapi_typed_data_dereference (&(*h) -> value,
|
||||
file, line);
|
||||
dfree (*h, file, line);
|
||||
}
|
||||
*h = 0;
|
||||
|
@@ -52,15 +52,13 @@ isc_result_t omapi_connection_reader (omapi_object_t *h)
|
||||
buffer = buffer -> next)
|
||||
;
|
||||
if (!BUFFER_BYTES_FREE (buffer)) {
|
||||
status = omapi_buffer_new (&buffer -> next,
|
||||
"omapi_private_read");
|
||||
status = omapi_buffer_new (&buffer -> next, MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
buffer = buffer -> next;
|
||||
}
|
||||
} else {
|
||||
status = omapi_buffer_new (&c -> inbufs,
|
||||
"omapi_private_read");
|
||||
status = omapi_buffer_new (&c -> inbufs, MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
buffer = c -> inbufs;
|
||||
@@ -134,8 +132,7 @@ isc_result_t omapi_connection_copyin (omapi_object_t *h,
|
||||
buffer -> next; buffer = buffer -> next)
|
||||
;
|
||||
} else {
|
||||
status = omapi_buffer_new (&c -> outbufs,
|
||||
"omapi_private_buffer_copyin");
|
||||
status = omapi_buffer_new (&c -> outbufs, MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
buffer = c -> outbufs;
|
||||
@@ -145,9 +142,7 @@ isc_result_t omapi_connection_copyin (omapi_object_t *h,
|
||||
/* If there is no space available in this buffer,
|
||||
allocate a new one. */
|
||||
if (!BUFFER_BYTES_FREE (buffer)) {
|
||||
status = (omapi_buffer_new
|
||||
(&buffer -> next,
|
||||
"omapi_private_buffer_copyin"));
|
||||
status = (omapi_buffer_new (&buffer -> next, MDL));
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
buffer = buffer -> next;
|
||||
@@ -233,22 +228,15 @@ isc_result_t omapi_connection_copyout (unsigned char *buf,
|
||||
while (c -> inbufs &&
|
||||
!BYTES_IN_BUFFER (c -> inbufs)) {
|
||||
if (c -> inbufs -> next) {
|
||||
omapi_buffer_reference
|
||||
(&buffer,
|
||||
c -> inbufs -> next,
|
||||
"omapi_private_buffer_copyout");
|
||||
omapi_buffer_dereference
|
||||
(&c -> inbufs -> next,
|
||||
"omapi_private_buffer_copyout");
|
||||
omapi_buffer_reference (&buffer,
|
||||
c -> inbufs -> next, MDL);
|
||||
omapi_buffer_dereference (&c -> inbufs -> next, MDL);
|
||||
}
|
||||
omapi_buffer_dereference (&c -> inbufs,
|
||||
"omapi_private_buffer_copyout");
|
||||
omapi_buffer_dereference (&c -> inbufs, MDL);
|
||||
if (buffer) {
|
||||
omapi_buffer_reference
|
||||
(&c -> inbufs, buffer,
|
||||
"omapi_private_buffer_copyout");
|
||||
omapi_buffer_dereference
|
||||
(&buffer, "omapi_private_buffer_copyout");
|
||||
(&c -> inbufs, buffer, MDL);
|
||||
omapi_buffer_dereference (&buffer, MDL);
|
||||
}
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
@@ -336,19 +324,14 @@ isc_result_t omapi_connection_writer (omapi_object_t *h)
|
||||
while (c -> outbufs &&
|
||||
!BYTES_IN_BUFFER (c -> outbufs)) {
|
||||
if (c -> outbufs -> next) {
|
||||
omapi_buffer_reference
|
||||
(&buffer, c -> outbufs -> next,
|
||||
"omapi_private_flush");
|
||||
omapi_buffer_dereference
|
||||
(&c -> outbufs -> next, "omapi_private_flush");
|
||||
omapi_buffer_reference (&buffer,
|
||||
c -> outbufs -> next, MDL);
|
||||
omapi_buffer_dereference (&c -> outbufs -> next, MDL);
|
||||
}
|
||||
omapi_buffer_dereference (&c -> outbufs,
|
||||
"omapi_private_flush");
|
||||
omapi_buffer_dereference (&c -> outbufs, MDL);
|
||||
if (buffer) {
|
||||
omapi_buffer_reference (&c -> outbufs, buffer,
|
||||
"omapi_private_flush");
|
||||
omapi_buffer_dereference (&buffer,
|
||||
"omapi_private_flush");
|
||||
omapi_buffer_reference (&c -> outbufs, buffer, MDL);
|
||||
omapi_buffer_dereference (&buffer, MDL);
|
||||
}
|
||||
}
|
||||
return ISC_R_SUCCESS;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
Subroutines for dealing with connections. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Use is subject to license terms which appear in the file named
|
||||
* ISC-LICENSE that should have accompanied this file when you
|
||||
* received it. If a file named ISC-LICENSE did not accompany this
|
||||
@@ -33,25 +33,23 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
omapi_connection_object_t *obj;
|
||||
int flag;
|
||||
|
||||
obj = (omapi_connection_object_t *)malloc (sizeof *obj);
|
||||
obj = (omapi_connection_object_t *)dmalloc (sizeof *obj, MDL);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
obj -> refcnt = 1;
|
||||
rc_register_mdl (obj, obj -> refcnt);
|
||||
obj -> type = omapi_type_connection;
|
||||
|
||||
status = omapi_object_reference (&c -> outer, (omapi_object_t *)obj,
|
||||
"omapi_protocol_connect");
|
||||
MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
status = omapi_object_reference (&obj -> inner, c,
|
||||
"omapi_protocol_connect");
|
||||
status = omapi_object_reference (&obj -> inner, c, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -65,7 +63,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
he = gethostbyname (server_name);
|
||||
if (!he) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
MDL);
|
||||
return ISC_R_HOSTUNKNOWN;
|
||||
}
|
||||
hix = 1;
|
||||
@@ -87,8 +85,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
obj -> socket =
|
||||
socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (obj -> socket < 0) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
if (errno == EMFILE || errno == ENFILE || errno == ENOBUFS)
|
||||
return ISC_R_NORESOURCES;
|
||||
return ISC_R_UNEXPECTED;
|
||||
@@ -97,8 +94,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
#if defined (HAVE_SETFD)
|
||||
if (fcntl (obj -> socket, F_SETFD, 1) < 0) {
|
||||
close (obj -> socket);
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return ISC_R_UNEXPECTED;
|
||||
}
|
||||
#endif
|
||||
@@ -107,8 +103,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
flag = 1;
|
||||
if (setsockopt (obj -> socket, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&flag, sizeof flag) < 0) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return ISC_R_UNEXPECTED;
|
||||
}
|
||||
|
||||
@@ -120,7 +115,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
sizeof obj -> remote_addr)) {
|
||||
if (!he || !he -> h_addr_list [hix]) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
MDL);
|
||||
if (errno == ECONNREFUSED)
|
||||
return ISC_R_CONNREFUSED;
|
||||
if (errno == ENETUNREACH)
|
||||
@@ -143,8 +138,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
}
|
||||
|
||||
if (fcntl (obj -> socket, F_SETFL, O_NONBLOCK) < 0) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return ISC_R_UNEXPECTED;
|
||||
}
|
||||
|
||||
@@ -155,8 +149,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
|
||||
omapi_connection_writer,
|
||||
omapi_connection_reaper);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -198,7 +191,7 @@ isc_result_t omapi_disconnect (omapi_object_t *h,
|
||||
|
||||
/* Disconnect from I/O object, if any. */
|
||||
if (h -> outer)
|
||||
omapi_object_dereference (&h -> outer, "omapi_disconnect");
|
||||
omapi_object_dereference (&h -> outer, MDL);
|
||||
|
||||
/* If whatever created us registered a signal handler, send it
|
||||
a disconnect signal. */
|
||||
@@ -302,7 +295,8 @@ isc_result_t omapi_connection_get_value (omapi_object_t *h,
|
||||
return ISC_R_NOTFOUND;
|
||||
}
|
||||
|
||||
isc_result_t omapi_connection_destroy (omapi_object_t *h, const char *name)
|
||||
isc_result_t omapi_connection_destroy (omapi_object_t *h,
|
||||
const char *file, int line)
|
||||
{
|
||||
omapi_connection_object_t *c;
|
||||
|
||||
@@ -312,7 +306,7 @@ isc_result_t omapi_connection_destroy (omapi_object_t *h, const char *name)
|
||||
if (c -> state == omapi_connection_connected)
|
||||
omapi_disconnect (h, 1);
|
||||
if (c -> listener)
|
||||
omapi_object_dereference (&c -> listener, name);
|
||||
omapi_object_dereference (&c -> listener, file, line);
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
I/O dispatcher. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Use is subject to license terms which appear in the file named
|
||||
* ISC-LICENSE that should have accompanied this file when you
|
||||
* received it. If a file named ISC-LICENSE did not accompany this
|
||||
@@ -50,27 +50,24 @@ isc_result_t omapi_register_io_object (omapi_object_t *h,
|
||||
omapi_io_states.type = omapi_type_io_object;
|
||||
}
|
||||
|
||||
obj = malloc (sizeof *obj);
|
||||
obj = dmalloc (sizeof *obj, MDL);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
|
||||
obj -> refcnt = 1;
|
||||
rc_register_mdl (obj, obj -> refcnt);
|
||||
obj -> type = omapi_type_io_object;
|
||||
|
||||
status = omapi_object_reference (&obj -> inner, h,
|
||||
"omapi_register_io_object");
|
||||
status = omapi_object_reference (&obj -> inner, h, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_register_io_object");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_object_reference (&h -> outer, (omapi_object_t *)obj,
|
||||
"omapi_register_io_object");
|
||||
status = omapi_object_reference (&h -> outer,
|
||||
(omapi_object_t *)obj, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_register_io_object");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -105,11 +102,12 @@ isc_result_t omapi_wait_for_completion (omapi_object_t *object,
|
||||
omapi_object_t *inner;
|
||||
|
||||
if (object) {
|
||||
waiter = malloc (sizeof *waiter);
|
||||
waiter = dmalloc (sizeof *waiter, MDL);
|
||||
if (!waiter)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (waiter, 0, sizeof *waiter);
|
||||
waiter -> refcnt = 1;
|
||||
rc_register_mdl (waiter, waiter -> refcnt);
|
||||
waiter -> type = omapi_type_waiter;
|
||||
|
||||
/* Paste the waiter object onto the inner object we're
|
||||
@@ -117,20 +115,19 @@ isc_result_t omapi_wait_for_completion (omapi_object_t *object,
|
||||
for (inner = object; inner -> inner; inner = inner -> inner)
|
||||
;
|
||||
|
||||
status = omapi_object_reference (&waiter -> outer, inner,
|
||||
"omapi_wait_for_completion");
|
||||
status = omapi_object_reference (&waiter -> outer, inner, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&waiter,
|
||||
"omapi_wait_for_completion");
|
||||
MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_object_reference (&inner -> inner,
|
||||
(omapi_object_t *)waiter,
|
||||
"omapi_wait_for_completion");
|
||||
MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&waiter,
|
||||
"omapi_wait_for_completion");
|
||||
MDL);
|
||||
return status;
|
||||
}
|
||||
} else
|
||||
@@ -145,22 +142,18 @@ isc_result_t omapi_wait_for_completion (omapi_object_t *object,
|
||||
if (waiter -> outer) {
|
||||
if (waiter -> outer -> inner) {
|
||||
omapi_object_dereference (&waiter -> outer -> inner,
|
||||
"omapi_wait_for_completion");
|
||||
MDL);
|
||||
if (waiter -> inner)
|
||||
omapi_object_reference
|
||||
(&waiter -> outer -> inner,
|
||||
waiter -> inner,
|
||||
"omapi_wait_for_completion");
|
||||
waiter -> inner, MDL);
|
||||
}
|
||||
omapi_object_dereference (&waiter -> outer,
|
||||
"omapi_wait_for_completion");
|
||||
omapi_object_dereference (&waiter -> outer, MDL);
|
||||
}
|
||||
if (waiter -> inner)
|
||||
omapi_object_dereference (&waiter -> inner,
|
||||
"omapi_wait_for_completion");
|
||||
omapi_object_dereference (&waiter -> inner, MDL);
|
||||
|
||||
omapi_object_dereference ((omapi_object_t **)&waiter,
|
||||
"omapi_wait_for_completion");
|
||||
omapi_object_dereference ((omapi_object_t **)&waiter, MDL);
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -280,28 +273,28 @@ isc_result_t omapi_one_dispatch (omapi_object_t *wo,
|
||||
omapi_object_reference
|
||||
((omapi_object_t **)&tmp,
|
||||
(omapi_object_t *)io -> next,
|
||||
"omapi_wfc");
|
||||
MDL);
|
||||
if (prev) {
|
||||
omapi_object_dereference
|
||||
(((omapi_object_t **)
|
||||
&prev -> next), "omapi_wfc");
|
||||
&prev -> next), MDL);
|
||||
if (tmp)
|
||||
omapi_object_reference
|
||||
(((omapi_object_t **)
|
||||
&prev -> next),
|
||||
(omapi_object_t *)tmp,
|
||||
"omapi_wfc");
|
||||
MDL);
|
||||
} else {
|
||||
omapi_object_dereference
|
||||
(((omapi_object_t **)
|
||||
&omapi_io_states.next),
|
||||
"omapi_wfc");
|
||||
MDL);
|
||||
if (tmp)
|
||||
omapi_object_reference
|
||||
(((omapi_object_t **)
|
||||
&omapi_io_states.next),
|
||||
(omapi_object_t *)tmp,
|
||||
"omapi_wfc");
|
||||
MDL);
|
||||
else
|
||||
omapi_signal_in
|
||||
((omapi_object_t *)
|
||||
@@ -310,8 +303,7 @@ isc_result_t omapi_one_dispatch (omapi_object_t *wo,
|
||||
}
|
||||
if (tmp)
|
||||
omapi_object_dereference
|
||||
((omapi_object_t **)&tmp,
|
||||
"omapi_wfc");
|
||||
((omapi_object_t **)&tmp, MDL);
|
||||
}
|
||||
}
|
||||
prev = io;
|
||||
@@ -348,7 +340,7 @@ isc_result_t omapi_io_get_value (omapi_object_t *h,
|
||||
return ISC_R_NOTFOUND;
|
||||
}
|
||||
|
||||
isc_result_t omapi_io_destroy (omapi_object_t *h, const char *name)
|
||||
isc_result_t omapi_io_destroy (omapi_object_t *h, const char *file, int line)
|
||||
{
|
||||
if (h -> type != omapi_type_io_object)
|
||||
return ISC_R_INVALIDARG;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 RadioMail Corporation.
|
||||
* Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
*
|
||||
* Use is subject to license terms which appear in the file named
|
||||
* ISC-LICENSE that should have accompanied this file when you
|
||||
@@ -29,13 +29,19 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: errwarn.c,v 1.1 2000/01/25 20:41:45 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: errwarn.c,v 1.2 2000/01/26 14:56:05 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
#include <omapip/omapip_p.h>
|
||||
#include <errno.h>
|
||||
|
||||
static void do_percentm PROTO ((char *obuf, const char *ibuf));
|
||||
#ifdef DEBUG
|
||||
int log_perror = -1;
|
||||
#else
|
||||
int log_perror = 1;
|
||||
#endif
|
||||
int log_priority;
|
||||
void (*log_cleanup) (void);
|
||||
|
||||
static char mbuf [1024];
|
||||
static char fbuf [1024];
|
||||
@@ -69,7 +75,8 @@ void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT)
|
||||
fprintf (stderr, "exiting.\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
cleanup ();
|
||||
if (log_cleanup)
|
||||
(*log_cleanup) ();
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -153,7 +160,7 @@ int log_debug (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
|
||||
|
||||
/* Find %m in the input string and substitute an error message string. */
|
||||
|
||||
static void do_percentm (obuf, ibuf)
|
||||
void do_percentm (obuf, ibuf)
|
||||
char *obuf;
|
||||
const char *ibuf;
|
||||
{
|
||||
@@ -193,66 +200,6 @@ static void do_percentm (obuf, ibuf)
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
|
||||
int parse_warn (ANSI_DECL (struct parse *)cfile,
|
||||
ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
|
||||
KandR (struct parse *cfile;)
|
||||
KandR (char *fmt;)
|
||||
va_dcl
|
||||
{
|
||||
va_list list;
|
||||
static char spaces [] = " ";
|
||||
char lexbuf [256];
|
||||
unsigned i, lix;
|
||||
|
||||
do_percentm (mbuf, fmt);
|
||||
#ifndef NO_SNPRINTF
|
||||
snprintf (fbuf, sizeof fbuf, "%s line %d: %s",
|
||||
cfile -> tlname, cfile -> lexline, mbuf);
|
||||
#else
|
||||
sprintf (fbuf, "%s line %d: %s",
|
||||
cfile -> tlname, cfile -> lexline, mbuf);
|
||||
#endif
|
||||
|
||||
VA_start (list, fmt);
|
||||
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
|
||||
va_end (list);
|
||||
|
||||
lix = 0;
|
||||
for (i = 0;
|
||||
cfile -> token_line [i] && i < (cfile -> lexchar - 1); i++) {
|
||||
if (lix < (sizeof lexbuf) - 1)
|
||||
lexbuf [lix++] = ' ';
|
||||
if (cfile -> token_line [i] == '\t') {
|
||||
for (lix;
|
||||
lix < (sizeof lexbuf) - 1 && (lix & 7); lix++)
|
||||
lexbuf [lix] = ' ';
|
||||
}
|
||||
}
|
||||
lexbuf [lix] = 0;
|
||||
|
||||
#ifndef DEBUG
|
||||
syslog (log_priority | LOG_ERR, mbuf);
|
||||
syslog (log_priority | LOG_ERR, cfile -> token_line);
|
||||
if (cfile -> lexchar < 81)
|
||||
syslog (log_priority | LOG_ERR, "%s^", lexbuf);
|
||||
#endif
|
||||
|
||||
if (log_perror) {
|
||||
write (2, mbuf, strlen (mbuf));
|
||||
write (2, "\n", 1);
|
||||
write (2, cfile -> token_line, strlen (cfile -> token_line));
|
||||
write (2, "\n", 1);
|
||||
if (cfile -> lexchar < 81)
|
||||
write (2, lexbuf, lix);
|
||||
write (2, "^\n", 2);
|
||||
}
|
||||
|
||||
cfile -> warnings_occurred = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NO_STRERROR
|
||||
char *strerror (err)
|
||||
int err;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
Subroutines that support the generic object. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1999 Internet Software Consortium.
|
||||
* Copyright (c) 1996-2000 Internet Software Consortium.
|
||||
* Use is subject to license terms which appear in the file named
|
||||
* ISC-LICENSE that should have accompanied this file when you
|
||||
* received it. If a file named ISC-LICENSE did not accompany this
|
||||
@@ -22,18 +22,19 @@
|
||||
|
||||
#include <omapip/omapip_p.h>
|
||||
|
||||
isc_result_t omapi_generic_new (omapi_object_t **gen, const char *name)
|
||||
isc_result_t omapi_generic_new (omapi_object_t **gen,
|
||||
const char *file, int line)
|
||||
{
|
||||
omapi_generic_object_t *obj;
|
||||
|
||||
obj = malloc (sizeof *obj);
|
||||
obj = dmalloc (sizeof *obj, file, line);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
obj -> refcnt = 0;
|
||||
obj -> type = omapi_type_generic;
|
||||
|
||||
return omapi_object_reference (gen, (omapi_object_t *)obj, name);
|
||||
return omapi_object_reference (gen, (omapi_object_t *)obj, file, line);
|
||||
}
|
||||
|
||||
isc_result_t omapi_generic_set_value (omapi_object_t *h,
|
||||
@@ -71,25 +72,18 @@ isc_result_t omapi_generic_set_value (omapi_object_t *h,
|
||||
maps to a name/null pair, ISC_R_NOTFOUND is
|
||||
returned. */
|
||||
new = (omapi_value_t *)0;
|
||||
status = (omapi_value_new (&new,
|
||||
"omapi_message_get_value"));
|
||||
status = (omapi_value_new (&new, MDL));
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
omapi_data_string_reference
|
||||
(&new -> name, name,
|
||||
"omapi_message_get_value");
|
||||
omapi_data_string_reference (&new -> name, name, MDL);
|
||||
if (value)
|
||||
omapi_typed_data_reference
|
||||
(&new -> value, value,
|
||||
"omapi_generic_set_value");
|
||||
omapi_typed_data_reference (&new -> value,
|
||||
value, MDL);
|
||||
|
||||
omapi_value_dereference (&(g -> values [i]),
|
||||
"omapi_message_set_value");
|
||||
omapi_value_dereference (&(g -> values [i]), MDL);
|
||||
status = (omapi_value_reference
|
||||
(&(g -> values [i]), new,
|
||||
"omapi_message_set_value"));
|
||||
omapi_value_dereference (&new,
|
||||
"omapi_message_set_value");
|
||||
(&(g -> values [i]), new, MDL));
|
||||
omapi_value_dereference (&new, MDL);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -116,27 +110,25 @@ isc_result_t omapi_generic_set_value (omapi_object_t *h,
|
||||
vm_new = 2 * g -> va_max;
|
||||
else
|
||||
vm_new = 10;
|
||||
va = malloc (vm_new * sizeof *va);
|
||||
va = dmalloc (vm_new * sizeof *va, MDL);
|
||||
if (!va)
|
||||
return ISC_R_NOMEMORY;
|
||||
if (g -> va_max)
|
||||
memcpy (va, g -> values, g -> va_max * sizeof *va);
|
||||
memset (va + g -> va_max, 0,
|
||||
(vm_new - g -> va_max) * sizeof *va);
|
||||
free (g -> values);
|
||||
dfree (g -> values, MDL);
|
||||
g -> values = va;
|
||||
g -> va_max = vm_new;
|
||||
}
|
||||
status = omapi_value_new (&g -> values [g -> nvalues],
|
||||
"omapi_generic_set_value");
|
||||
status = omapi_value_new (&g -> values [g -> nvalues], MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
omapi_data_string_reference (&g -> values [g -> nvalues] -> name, name,
|
||||
"omapi_generic_set_value");
|
||||
omapi_data_string_reference (&g -> values [g -> nvalues] -> name,
|
||||
name, MDL);
|
||||
if (value)
|
||||
omapi_typed_data_reference
|
||||
(&g -> values [g -> nvalues] -> value, value,
|
||||
"omapi_generic_set_value");
|
||||
(&g -> values [g -> nvalues] -> value, value, MDL);
|
||||
g -> nvalues++;
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
@@ -162,9 +154,8 @@ isc_result_t omapi_generic_get_value (omapi_object_t *h,
|
||||
if (!g -> values [i] -> value)
|
||||
return ISC_R_NOTFOUND;
|
||||
/* Otherwise, return the name/value pair. */
|
||||
return omapi_value_reference
|
||||
(value, g -> values [i],
|
||||
"omapi_message_get_value");
|
||||
return omapi_value_reference (value,
|
||||
g -> values [i], MDL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +165,8 @@ isc_result_t omapi_generic_get_value (omapi_object_t *h,
|
||||
return ISC_R_NOTFOUND;
|
||||
}
|
||||
|
||||
isc_result_t omapi_generic_destroy (omapi_object_t *h, const char *name)
|
||||
isc_result_t omapi_generic_destroy (omapi_object_t *h,
|
||||
const char *file, int line)
|
||||
{
|
||||
omapi_generic_object_t *g;
|
||||
int i;
|
||||
@@ -187,9 +179,9 @@ isc_result_t omapi_generic_destroy (omapi_object_t *h, const char *name)
|
||||
for (i = 0; i < g -> nvalues; i++) {
|
||||
if (g -> values [i])
|
||||
omapi_value_dereference (&g -> values [i],
|
||||
name);
|
||||
file, line);
|
||||
}
|
||||
free (g -> values);
|
||||
dfree (g -> values, file, line);
|
||||
g -> values = (omapi_value_t **)0;
|
||||
g -> va_max = 0;
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ isc_result_t omapi_object_handle (omapi_handle_t *h, omapi_object_t *o)
|
||||
}
|
||||
|
||||
if (!omapi_handle_table) {
|
||||
omapi_handle_table = malloc (sizeof *omapi_handle_table);
|
||||
omapi_handle_table = dmalloc (sizeof *omapi_handle_table, MDL);
|
||||
if (!omapi_handle_table)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (omapi_handle_table, 0, sizeof *omapi_handle_table);
|
||||
@@ -86,7 +86,7 @@ isc_result_t omapi_object_handle (omapi_handle_t *h, omapi_object_t *o)
|
||||
while (omapi_next_handle >= omapi_handle_table -> limit) {
|
||||
omapi_handle_table_t *new;
|
||||
|
||||
new = malloc (sizeof *new);
|
||||
new = dmalloc (sizeof *new, MDL);
|
||||
if (!new)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (new, 0, sizeof *new);
|
||||
@@ -140,7 +140,7 @@ static isc_result_t omapi_object_handle_in_table (omapi_handle_t h,
|
||||
if (table -> leafp) {
|
||||
status = (omapi_object_reference
|
||||
(&table -> children [h - table -> first].object,
|
||||
o, "omapi_object_handle_in_table"));
|
||||
o, MDL));
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
o -> handle = h;
|
||||
@@ -161,7 +161,7 @@ static isc_result_t omapi_object_handle_in_table (omapi_handle_t h,
|
||||
/* If there is no more direct table than this one in the slot
|
||||
we came up with, make one. */
|
||||
if (!inner) {
|
||||
inner = malloc (sizeof *inner);
|
||||
inner = dmalloc (sizeof *inner, MDL);
|
||||
if (!inner)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (inner, 0, sizeof *inner);
|
||||
@@ -211,7 +211,7 @@ static isc_result_t omapi_handle_table_enclose (omapi_handle_table_t **table)
|
||||
we are allocating sequentially. */
|
||||
index = (base - inner -> first) / OMAPI_HANDLE_TABLE_SIZE;
|
||||
|
||||
new = malloc (sizeof *new);
|
||||
new = dmalloc (sizeof *new, MDL);
|
||||
if (!new)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (new, 0, sizeof *new);
|
||||
@@ -247,7 +247,7 @@ static isc_result_t omapi_handle_lookup_in (omapi_object_t **o,
|
||||
return ISC_R_NOTFOUND;
|
||||
return omapi_object_reference
|
||||
(o, table -> children [h - table -> first].object,
|
||||
"omapi_handle_lookup_in");
|
||||
MDL);
|
||||
}
|
||||
|
||||
/* Scale is the number of handles represented by each child of this
|
||||
|
@@ -32,26 +32,24 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
||||
omapi_listener_object_t *obj;
|
||||
|
||||
/* Get the handle. */
|
||||
obj = (omapi_listener_object_t *)malloc (sizeof *obj);
|
||||
obj = (omapi_listener_object_t *)dmalloc (sizeof *obj, MDL);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
obj -> refcnt = 1;
|
||||
rc_register_mdl (obj, obj -> refcnt);
|
||||
obj -> type = omapi_type_listener;
|
||||
|
||||
/* Connect this object to the inner object. */
|
||||
status = omapi_object_reference (&h -> outer, (omapi_object_t *)obj,
|
||||
"omapi_protocol_listen");
|
||||
status = omapi_object_reference (&h -> outer,
|
||||
(omapi_object_t *)obj, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
status = omapi_object_reference (&obj -> inner, h,
|
||||
"omapi_protocol_listen");
|
||||
status = omapi_object_reference (&obj -> inner, h, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -62,8 +60,7 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
||||
/* Create a socket on which to listen. */
|
||||
obj -> socket = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (!obj -> socket) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
if (errno == EMFILE || errno == ENFILE || errno == ENOBUFS)
|
||||
return ISC_R_NORESOURCES;
|
||||
return ISC_R_UNEXPECTED;
|
||||
@@ -72,8 +69,7 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
||||
#if defined (HAVE_SETFD)
|
||||
if (fcntl (obj -> socket, F_SETFD, 1) < 0) {
|
||||
close (obj -> socket);
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return ISC_R_UNEXPECTED;
|
||||
}
|
||||
#endif
|
||||
@@ -82,8 +78,7 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
||||
we were given. */
|
||||
if (bind (obj -> socket,
|
||||
(struct sockaddr *)&obj -> address, sizeof obj -> address)) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
if (errno == EADDRINUSE)
|
||||
return ISC_R_ADDRNOTAVAIL;
|
||||
if (errno == EPERM)
|
||||
@@ -93,14 +88,12 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
||||
|
||||
/* Now tell the kernel to listen for connections. */
|
||||
if (listen (obj -> socket, max)) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return ISC_R_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (fcntl (obj -> socket, F_SETFL, O_NONBLOCK) < 0) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return ISC_R_UNEXPECTED;
|
||||
}
|
||||
|
||||
@@ -108,8 +101,7 @@ isc_result_t omapi_listen (omapi_object_t *h,
|
||||
omapi_listener_readfd, 0,
|
||||
omapi_accept, 0, 0);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -142,11 +134,12 @@ isc_result_t omapi_accept (omapi_object_t *h)
|
||||
listener = (omapi_listener_object_t *)h;
|
||||
|
||||
/* Get the handle. */
|
||||
obj = (omapi_connection_object_t *)malloc (sizeof *obj);
|
||||
obj = (omapi_connection_object_t *)dmalloc (sizeof *obj, MDL);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
obj -> refcnt = 1;
|
||||
rc_register_mdl (obj, obj -> refcnt);
|
||||
obj -> type = omapi_type_connection;
|
||||
|
||||
/* Accept the connection. */
|
||||
@@ -156,8 +149,7 @@ isc_result_t omapi_accept (omapi_object_t *h)
|
||||
((struct sockaddr *)
|
||||
&(obj -> remote_addr)), &len);
|
||||
if (obj -> socket < 0) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_accept");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
if (errno == EMFILE || errno == ENFILE || errno == ENOBUFS)
|
||||
return ISC_R_NORESOURCES;
|
||||
return ISC_R_UNEXPECTED;
|
||||
@@ -172,19 +164,18 @@ isc_result_t omapi_accept (omapi_object_t *h)
|
||||
omapi_connection_writer,
|
||||
omapi_connection_reaper);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_accept");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
omapi_object_reference (&obj -> listener, (omapi_object_t *)listener,
|
||||
"omapi_accept");
|
||||
omapi_object_reference (&obj -> listener,
|
||||
(omapi_object_t *)listener, MDL);
|
||||
|
||||
status = omapi_signal (h, "connect", obj);
|
||||
|
||||
/* Lose our reference to the connection, so it'll be gc'd when it's
|
||||
reaped. */
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, "omapi_accept");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -216,7 +207,8 @@ isc_result_t omapi_listener_get_value (omapi_object_t *h,
|
||||
return ISC_R_NOTFOUND;
|
||||
}
|
||||
|
||||
isc_result_t omapi_listener_destroy (omapi_object_t *h, const char *name)
|
||||
isc_result_t omapi_listener_destroy (omapi_object_t *h,
|
||||
const char *file, int line)
|
||||
{
|
||||
omapi_listener_object_t *l;
|
||||
|
||||
|
@@ -30,23 +30,24 @@ isc_result_t omapi_message_new (omapi_object_t **o, const char *file, int line)
|
||||
omapi_object_t *g;
|
||||
isc_result_t status;
|
||||
|
||||
m = malloc (sizeof *m);
|
||||
m = dmalloc (sizeof *m, file, line);
|
||||
if (!m)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (m, 0, sizeof *m);
|
||||
m -> type = omapi_type_message;
|
||||
rc_register (file, line, m, m -> refcnt);
|
||||
m -> refcnt = 1;
|
||||
|
||||
g = (omapi_object_t *)0;
|
||||
status = omapi_generic_new (&g, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
free (m);
|
||||
dfree (m, file, line);
|
||||
return status;
|
||||
}
|
||||
status = omapi_object_reference (&m -> inner, g, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&m, file, line);
|
||||
omapi_object_dereference (&g, name);
|
||||
omapi_object_dereference (&g, file, line);
|
||||
return status;
|
||||
}
|
||||
status = omapi_object_reference (&g -> outer,
|
||||
@@ -54,7 +55,7 @@ isc_result_t omapi_message_new (omapi_object_t **o, const char *file, int line)
|
||||
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&m, file, line);
|
||||
omapi_object_dereference (&g, name);
|
||||
omapi_object_dereference (&g, file, line);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -84,28 +85,24 @@ isc_result_t omapi_message_set_value (omapi_object_t *h,
|
||||
/* Can set authenticator, but the value must be typed data. */
|
||||
if (!omapi_ds_strcmp (name, "authenticator")) {
|
||||
if (m -> authenticator)
|
||||
omapi_typed_data_dereference
|
||||
(&m -> authenticator, MDL);
|
||||
omapi_typed_data_reference (&m -> authenticator,
|
||||
value, MDL);
|
||||
omapi_typed_data_dereference (&m -> authenticator,
|
||||
MDL);
|
||||
omapi_typed_data_reference (&m -> authenticator, value, MDL);
|
||||
return ISC_R_SUCCESS;
|
||||
|
||||
} else if (!omapi_ds_strcmp (name, "object")) {
|
||||
if (value -> type != omapi_datatype_object)
|
||||
return ISC_R_INVALIDARG;
|
||||
if (m -> object)
|
||||
omapi_object_dereference
|
||||
(&m -> object, MDL);
|
||||
omapi_object_reference (&m -> object,
|
||||
value -> u.object, MDL);
|
||||
omapi_object_dereference (&m -> object, MDL);
|
||||
omapi_object_reference (&m -> object, value -> u.object, MDL);
|
||||
return ISC_R_SUCCESS;
|
||||
|
||||
} else if (!omapi_ds_strcmp (name, "notify-object")) {
|
||||
if (value -> type != omapi_datatype_object)
|
||||
return ISC_R_INVALIDARG;
|
||||
if (m -> notify_object)
|
||||
omapi_object_dereference
|
||||
(&m -> notify_object, MDL);
|
||||
omapi_object_dereference (&m -> notify_object, MDL);
|
||||
omapi_object_reference (&m -> notify_object,
|
||||
value -> u.object, MDL);
|
||||
return ISC_R_SUCCESS;
|
||||
@@ -205,7 +202,7 @@ isc_result_t omapi_message_destroy (omapi_object_t *h,
|
||||
omapi_message_object_t *m;
|
||||
if (h -> type != omapi_type_message)
|
||||
return ISC_R_INVALIDARG;
|
||||
m = (omapi_message_object *)h;
|
||||
m = (omapi_message_object_t *)h;
|
||||
if (m -> authenticator) {
|
||||
omapi_typed_data_dereference (&m -> authenticator, file, line);
|
||||
}
|
||||
@@ -276,18 +273,16 @@ isc_result_t omapi_message_register (omapi_object_t *mo)
|
||||
if (omapi_registered_messages) {
|
||||
omapi_object_reference
|
||||
((omapi_object_t **)&m -> next,
|
||||
(omapi_object_t *)omapi_registered_messages,
|
||||
file, line);
|
||||
(omapi_object_t *)omapi_registered_messages, MDL);
|
||||
omapi_object_reference
|
||||
((omapi_object_t **)&omapi_registered_messages -> prev,
|
||||
(omapi_object_t *)m, file, line);
|
||||
(omapi_object_t *)m, MDL);
|
||||
omapi_object_dereference
|
||||
((omapi_object_t **)&omapi_registered_messages,
|
||||
file, line);
|
||||
((omapi_object_t **)&omapi_registered_messages, MDL);
|
||||
}
|
||||
omapi_object_reference
|
||||
((omapi_object_t **)&omapi_registered_messages,
|
||||
(omapi_object_t *)m, file, line);
|
||||
(omapi_object_t *)m, MDL);
|
||||
return ISC_R_SUCCESS;;
|
||||
}
|
||||
|
||||
|
@@ -30,31 +30,28 @@ isc_result_t omapi_protocol_connect (omapi_object_t *h,
|
||||
isc_result_t status;
|
||||
omapi_protocol_object_t *obj;
|
||||
|
||||
obj = (omapi_protocol_object_t *)malloc (sizeof *obj);
|
||||
obj = (omapi_protocol_object_t *)dmalloc (sizeof *obj, MDL);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
obj -> refcnt = 1;
|
||||
rc_register_mdl (obj, obj -> refcnt);
|
||||
obj -> type = omapi_type_protocol;
|
||||
|
||||
status = omapi_connect ((omapi_object_t *)obj, server_name, port);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
status = omapi_object_reference (&h -> outer, (omapi_object_t *)obj,
|
||||
"omapi_protocol_connect");
|
||||
status = omapi_object_reference (&h -> outer,
|
||||
(omapi_object_t *)obj, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
status = omapi_object_reference (&obj -> inner, h,
|
||||
"omapi_protocol_connect");
|
||||
status = omapi_object_reference (&obj -> inner, h, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -63,16 +60,13 @@ isc_result_t omapi_protocol_connect (omapi_object_t *h,
|
||||
OMAPI_PROTOCOL_VERSION,
|
||||
sizeof (omapi_protocol_header_t));
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (authinfo)
|
||||
omapi_object_reference (&obj -> authinfo, authinfo,
|
||||
"omapi_protocol_connect");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_accept");
|
||||
omapi_object_reference (&obj -> authinfo, authinfo, MDL);
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -288,7 +282,7 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
|
||||
|
||||
case omapi_protocol_header_wait:
|
||||
status = omapi_message_new ((omapi_object_t **)&p -> message,
|
||||
"omapi_protocol_signal_handler");
|
||||
MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_disconnect (c, 1);
|
||||
return status;
|
||||
@@ -366,8 +360,7 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
|
||||
}
|
||||
|
||||
/* Allocate a buffer for the name. */
|
||||
status = (omapi_data_string_new
|
||||
(&p -> name, nlen, "omapi_protocol_signal_handler"));
|
||||
status = (omapi_data_string_new (&p -> name, nlen, MDL));
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_disconnect (c, 1);
|
||||
return ISC_R_NOMEMORY;
|
||||
@@ -395,9 +388,9 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
|
||||
if (!vlen)
|
||||
goto insert_new_value;
|
||||
|
||||
status = (omapi_typed_data_new
|
||||
(&p -> value, omapi_datatype_data, vlen,
|
||||
"omapi_protocol_signal_handler"));
|
||||
status = omapi_typed_data_new (MDL, &p -> value,
|
||||
omapi_datatype_data,
|
||||
vlen);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_disconnect (c, 1);
|
||||
return ISC_R_NOMEMORY;
|
||||
@@ -423,8 +416,7 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
|
||||
/* We need a generic object to hang off of the
|
||||
incoming message. */
|
||||
status = (omapi_generic_new
|
||||
(&p -> message -> object,
|
||||
"omapi_protocol_signal_handler"));
|
||||
(&p -> message -> object, MDL));
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_disconnect (c, 1);
|
||||
return status;
|
||||
@@ -439,15 +431,14 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
|
||||
omapi_disconnect (c, 1);
|
||||
return status;
|
||||
}
|
||||
omapi_data_string_dereference
|
||||
(&p -> name, "omapi_protocol_signal_handler");
|
||||
omapi_typed_data_dereference (&p -> value,
|
||||
"omapi_protocol_signal_handler");
|
||||
omapi_data_string_dereference (&p -> name, MDL);
|
||||
omapi_typed_data_dereference (&p -> value, MDL);
|
||||
goto need_name_length;
|
||||
|
||||
signature_wait:
|
||||
case omapi_protocol_signature_wait:
|
||||
status = omapi_typed_data_new (&p -> message -> authenticator,
|
||||
status = omapi_typed_data_new (MDL,
|
||||
&p -> message -> authenticator,
|
||||
omapi_datatype_data,
|
||||
p -> message -> authlen);
|
||||
|
||||
@@ -472,7 +463,7 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
|
||||
/* XXX unbind the authenticator. */
|
||||
auth_unbind:
|
||||
omapi_object_dereference ((omapi_object_t **)&p -> message,
|
||||
"omapi_protocol_signal_handler");
|
||||
MDL);
|
||||
|
||||
/* Now wait for the next message. */
|
||||
goto to_header_wait;
|
||||
@@ -512,7 +503,8 @@ isc_result_t omapi_protocol_get_value (omapi_object_t *h,
|
||||
return ISC_R_NOTFOUND;
|
||||
}
|
||||
|
||||
isc_result_t omapi_protocol_destroy (omapi_object_t *h, const char *name)
|
||||
isc_result_t omapi_protocol_destroy (omapi_object_t *h,
|
||||
const char *file, int line)
|
||||
{
|
||||
omapi_protocol_object_t *p;
|
||||
if (h -> type != omapi_type_protocol)
|
||||
@@ -520,9 +512,9 @@ isc_result_t omapi_protocol_destroy (omapi_object_t *h, const char *name)
|
||||
p = (omapi_protocol_object_t *)h;
|
||||
if (p -> message)
|
||||
omapi_object_dereference ((omapi_object_t **)&p -> message,
|
||||
name);
|
||||
file, line);
|
||||
if (p -> authinfo)
|
||||
return omapi_object_dereference (&p -> authinfo, name);
|
||||
return omapi_object_dereference (&p -> authinfo, file, line);
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -554,31 +546,27 @@ isc_result_t omapi_protocol_listen (omapi_object_t *h,
|
||||
isc_result_t status;
|
||||
omapi_protocol_listener_object_t *obj;
|
||||
|
||||
obj = (omapi_protocol_listener_object_t *)malloc (sizeof *obj);
|
||||
obj = (omapi_protocol_listener_object_t *)dmalloc (sizeof *obj, MDL);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
obj -> refcnt = 1;
|
||||
obj -> type = omapi_type_protocol_listener;
|
||||
|
||||
status = omapi_object_reference (&h -> outer, (omapi_object_t *)obj,
|
||||
"omapi_protocol_listen");
|
||||
status = omapi_object_reference (&h -> outer,
|
||||
(omapi_object_t *)obj, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
status = omapi_object_reference (&obj -> inner, h,
|
||||
"omapi_protocol_listen");
|
||||
status = omapi_object_reference (&obj -> inner, h, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_listen ((omapi_object_t *)obj, port, max);
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_listen");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -609,25 +597,23 @@ isc_result_t omapi_protocol_listener_signal (omapi_object_t *o,
|
||||
if (!c || c -> type != omapi_type_connection)
|
||||
return ISC_R_INVALIDARG;
|
||||
|
||||
obj = (omapi_protocol_object_t *)malloc (sizeof *obj);
|
||||
obj = (omapi_protocol_object_t *)dmalloc (sizeof *obj, MDL);
|
||||
if (!obj)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (obj, 0, sizeof *obj);
|
||||
obj -> refcnt = 1;
|
||||
obj -> type = omapi_type_protocol;
|
||||
|
||||
status = omapi_object_reference (&obj -> outer, c,
|
||||
"omapi_protocol_accept");
|
||||
status = omapi_object_reference (&obj -> outer, c, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
lose:
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_accept");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
omapi_disconnect (c, 1);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_object_reference (&c -> inner, (omapi_object_t *)obj,
|
||||
"omapi_protocol_accept");
|
||||
status = omapi_object_reference (&c -> inner,
|
||||
(omapi_object_t *)obj, MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
goto lose;
|
||||
|
||||
@@ -638,8 +624,7 @@ isc_result_t omapi_protocol_listener_signal (omapi_object_t *o,
|
||||
if (status != ISC_R_SUCCESS)
|
||||
goto lose;
|
||||
|
||||
omapi_object_dereference ((omapi_object_t **)&obj,
|
||||
"omapi_protocol_accept");
|
||||
omapi_object_dereference ((omapi_object_t **)&obj, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -672,7 +657,7 @@ isc_result_t omapi_protocol_listener_get_value (omapi_object_t *h,
|
||||
}
|
||||
|
||||
isc_result_t omapi_protocol_listener_destroy (omapi_object_t *h,
|
||||
const char *name)
|
||||
const char *file, int line)
|
||||
{
|
||||
if (h -> type != omapi_type_protocol_listener)
|
||||
return ISC_R_INVALIDARG;
|
||||
@@ -708,31 +693,28 @@ isc_result_t omapi_protocol_send_status (omapi_object_t *po,
|
||||
if (po -> type != omapi_type_protocol)
|
||||
return ISC_R_INVALIDARG;
|
||||
|
||||
status = omapi_message_new (&message, "omapi_protocol_send_status");
|
||||
status = omapi_message_new (&message, MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = omapi_set_int_value (message, (omapi_object_t *)0,
|
||||
"op", OMAPI_OP_STATUS);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference (&message,
|
||||
"omapi_protocol_send_status");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_set_int_value (message, (omapi_object_t *)0,
|
||||
"rid", (int)rid);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference (&message,
|
||||
"omapi_protocol_send_status");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_set_int_value (message, (omapi_object_t *)0,
|
||||
"result", (int)waitstatus);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference (&message,
|
||||
"omapi_protocol_send_status");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -741,8 +723,7 @@ isc_result_t omapi_protocol_send_status (omapi_object_t *po,
|
||||
status = omapi_set_string_value (message, (omapi_object_t *)0,
|
||||
"message", msg);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference
|
||||
(&message, "omapi_protocol_send_status");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -762,15 +743,14 @@ isc_result_t omapi_protocol_send_update (omapi_object_t *po,
|
||||
if (po -> type != omapi_type_protocol)
|
||||
return ISC_R_INVALIDARG;
|
||||
|
||||
status = omapi_message_new (&message, "omapi_protocol_send_update");
|
||||
status = omapi_message_new (&message, MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = omapi_set_int_value (message, (omapi_object_t *)0,
|
||||
"op", OMAPI_OP_UPDATE);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference (&message,
|
||||
"omapi_protocol_send_update");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -779,22 +759,19 @@ isc_result_t omapi_protocol_send_update (omapi_object_t *po,
|
||||
status = omapi_set_int_value (message, (omapi_object_t *)0,
|
||||
"rid", (int)rid);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference
|
||||
(&message, "omapi_protocol_send_update");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_object_handle (&handle, object);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference
|
||||
(&message, "omapi_protocol_send_update");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
status = omapi_set_int_value (message, (omapi_object_t *)0,
|
||||
"handle", (int)handle);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference
|
||||
(&message, "omapi_protocol_send_update");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -802,7 +779,7 @@ isc_result_t omapi_protocol_send_update (omapi_object_t *po,
|
||||
status = omapi_set_object_value (message, (omapi_object_t *)0,
|
||||
"object", object);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_object_dereference (&message, "dhcpctl_open_object");
|
||||
omapi_object_dereference (&message, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
131
omapip/support.c
131
omapip/support.c
@@ -147,7 +147,7 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **type,
|
||||
omapi_value_t **),
|
||||
isc_result_t (*destroy)
|
||||
(omapi_object_t *,
|
||||
const char *),
|
||||
const char *, int),
|
||||
isc_result_t (*signal_handler)
|
||||
(omapi_object_t *,
|
||||
const char *, va_list),
|
||||
@@ -168,7 +168,7 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **type,
|
||||
{
|
||||
omapi_object_type_t *t;
|
||||
|
||||
t = malloc (sizeof *t);
|
||||
t = dmalloc (sizeof *t, MDL);
|
||||
if (!t)
|
||||
return ISC_R_NOMEMORY;
|
||||
memset (t, 0, sizeof *t);
|
||||
@@ -251,8 +251,7 @@ isc_result_t omapi_set_value_str (omapi_object_t *h,
|
||||
isc_result_t status;
|
||||
|
||||
nds = (omapi_data_string_t *)0;
|
||||
status = omapi_data_string_new (&nds, strlen (name),
|
||||
"omapi_set_value_str");
|
||||
status = omapi_data_string_new (&nds, strlen (name), MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
memcpy (nds -> value, name, strlen (name));
|
||||
@@ -269,22 +268,20 @@ isc_result_t omapi_set_boolean_value (omapi_object_t *h, omapi_object_t *id,
|
||||
int len;
|
||||
int ip;
|
||||
|
||||
status = omapi_data_string_new (&n, strlen (name),
|
||||
"omapi_set_boolean_value");
|
||||
status = omapi_data_string_new (&n, strlen (name), MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
memcpy (n -> value, name, strlen (name));
|
||||
|
||||
status = omapi_typed_data_new (&tv, omapi_datatype_int, value);
|
||||
status = omapi_typed_data_new (MDL, &tv, omapi_datatype_int, value);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_data_string_dereference (&n,
|
||||
"omapi_set_boolean_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_set_value (h, id, n, tv);
|
||||
omapi_data_string_dereference (&n, "omapi_set_boolean_value");
|
||||
omapi_typed_data_dereference (&tv, "omapi_set_boolean_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
omapi_typed_data_dereference (&tv, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -297,22 +294,20 @@ isc_result_t omapi_set_int_value (omapi_object_t *h, omapi_object_t *id,
|
||||
int len;
|
||||
int ip;
|
||||
|
||||
status = omapi_data_string_new (&n, strlen (name),
|
||||
"omapi_set_int_value");
|
||||
status = omapi_data_string_new (&n, strlen (name), MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
memcpy (n -> value, name, strlen (name));
|
||||
|
||||
status = omapi_typed_data_new (&tv, omapi_datatype_int, value);
|
||||
status = omapi_typed_data_new (MDL, &tv, omapi_datatype_int, value);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_data_string_dereference (&n,
|
||||
"omapi_set_int_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_set_value (h, id, n, tv);
|
||||
omapi_data_string_dereference (&n, "omapi_set_int_value");
|
||||
omapi_typed_data_dereference (&tv, "omapi_set_int_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
omapi_typed_data_dereference (&tv, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -325,22 +320,20 @@ isc_result_t omapi_set_object_value (omapi_object_t *h, omapi_object_t *id,
|
||||
int len;
|
||||
int ip;
|
||||
|
||||
status = omapi_data_string_new (&n, strlen (name),
|
||||
"omapi_set_object_value");
|
||||
status = omapi_data_string_new (&n, strlen (name), MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
memcpy (n -> value, name, strlen (name));
|
||||
|
||||
status = omapi_typed_data_new (&tv, omapi_datatype_object, value);
|
||||
status = omapi_typed_data_new (MDL, &tv, omapi_datatype_object, value);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_data_string_dereference (&n,
|
||||
"omapi_set_object_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_set_value (h, id, n, tv);
|
||||
omapi_data_string_dereference (&n, "omapi_set_object_value");
|
||||
omapi_typed_data_dereference (&tv, "omapi_set_object_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
omapi_typed_data_dereference (&tv, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -353,22 +346,20 @@ isc_result_t omapi_set_string_value (omapi_object_t *h, omapi_object_t *id,
|
||||
int len;
|
||||
int ip;
|
||||
|
||||
status = omapi_data_string_new (&n, strlen (name),
|
||||
"omapi_set_string_value");
|
||||
status = omapi_data_string_new (&n, strlen (name), MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
memcpy (n -> value, name, strlen (name));
|
||||
|
||||
status = omapi_typed_data_new (&tv, omapi_datatype_string, value);
|
||||
status = omapi_typed_data_new (MDL, &tv, omapi_datatype_string, value);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_data_string_dereference (&n,
|
||||
"omapi_set_string_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = omapi_set_value (h, id, n, tv);
|
||||
omapi_data_string_dereference (&n, "omapi_set_string_value");
|
||||
omapi_typed_data_dereference (&tv, "omapi_set_string_value");
|
||||
omapi_data_string_dereference (&n, MDL);
|
||||
omapi_typed_data_dereference (&tv, MDL);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -397,8 +388,7 @@ isc_result_t omapi_get_value_str (omapi_object_t *h,
|
||||
isc_result_t status;
|
||||
|
||||
nds = (omapi_data_string_t *)0;
|
||||
status = omapi_data_string_new (&nds, strlen (name),
|
||||
"omapi_get_value_str");
|
||||
status = omapi_data_string_new (&nds, strlen (name), MDL);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
memcpy (nds -> value, name, strlen (name));
|
||||
@@ -523,25 +513,28 @@ int omapi_td_strcmp (omapi_typed_data_t *s1, const char *s2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
isc_result_t omapi_make_value (omapi_value_t **vp, omapi_data_string_t *name,
|
||||
omapi_typed_data_t *value, const char *caller)
|
||||
isc_result_t omapi_make_value (omapi_value_t **vp,
|
||||
omapi_data_string_t *name,
|
||||
omapi_typed_data_t *value,
|
||||
const char *file, int line)
|
||||
{
|
||||
isc_result_t status;
|
||||
|
||||
status = omapi_value_new (vp, caller);
|
||||
status = omapi_value_new (vp, file, line);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = omapi_data_string_reference (&(*vp) -> name, name, caller);
|
||||
status = omapi_data_string_reference (&(*vp) -> name,
|
||||
name, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
if (value) {
|
||||
status = omapi_typed_data_reference (&(*vp) -> value,
|
||||
value, caller);
|
||||
value, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -551,24 +544,26 @@ isc_result_t omapi_make_value (omapi_value_t **vp, omapi_data_string_t *name,
|
||||
isc_result_t omapi_make_const_value (omapi_value_t **vp,
|
||||
omapi_data_string_t *name,
|
||||
const unsigned char *value,
|
||||
unsigned len, const char *caller)
|
||||
unsigned len,
|
||||
const char *file, int line)
|
||||
{
|
||||
isc_result_t status;
|
||||
|
||||
status = omapi_value_new (vp, caller);
|
||||
status = omapi_value_new (vp, file, line);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = omapi_data_string_reference (&(*vp) -> name, name, caller);
|
||||
status = omapi_data_string_reference (&(*vp) -> name,
|
||||
name, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
if (value) {
|
||||
status = omapi_typed_data_new (&(*vp) -> value,
|
||||
status = omapi_typed_data_new (file, line, &(*vp) -> value,
|
||||
omapi_datatype_data, len);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
memcpy ((*vp) -> value -> u.buffer.value, value, len);
|
||||
@@ -578,24 +573,25 @@ isc_result_t omapi_make_const_value (omapi_value_t **vp,
|
||||
|
||||
isc_result_t omapi_make_int_value (omapi_value_t **vp,
|
||||
omapi_data_string_t *name,
|
||||
int value, const char *caller)
|
||||
int value, const char *file, int line)
|
||||
{
|
||||
isc_result_t status;
|
||||
|
||||
status = omapi_value_new (vp, caller);
|
||||
status = omapi_value_new (vp, file, line);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = omapi_data_string_reference (&(*vp) -> name, name, caller);
|
||||
status = omapi_data_string_reference (&(*vp) -> name,
|
||||
name, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
if (value) {
|
||||
status = omapi_typed_data_new (&(*vp) -> value,
|
||||
status = omapi_typed_data_new (file, line, &(*vp) -> value,
|
||||
omapi_datatype_int);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
(*vp) -> value -> u.integer = value;
|
||||
@@ -606,31 +602,32 @@ isc_result_t omapi_make_int_value (omapi_value_t **vp,
|
||||
isc_result_t omapi_make_handle_value (omapi_value_t **vp,
|
||||
omapi_data_string_t *name,
|
||||
omapi_object_t *value,
|
||||
const char *caller)
|
||||
const char *file, int line)
|
||||
{
|
||||
isc_result_t status;
|
||||
|
||||
status = omapi_value_new (vp, caller);
|
||||
status = omapi_value_new (vp, file, line);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = omapi_data_string_reference (&(*vp) -> name, name, caller);
|
||||
status = omapi_data_string_reference (&(*vp) -> name,
|
||||
name, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
if (value) {
|
||||
status = omapi_typed_data_new (&(*vp) -> value,
|
||||
status = omapi_typed_data_new (file, line, &(*vp) -> value,
|
||||
omapi_datatype_int);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
status = (omapi_object_handle
|
||||
((omapi_handle_t *)&(*vp) -> value -> u.integer,
|
||||
value));
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -639,24 +636,26 @@ isc_result_t omapi_make_handle_value (omapi_value_t **vp,
|
||||
|
||||
isc_result_t omapi_make_string_value (omapi_value_t **vp,
|
||||
omapi_data_string_t *name,
|
||||
const char *value, const char *caller)
|
||||
const char *value,
|
||||
const char *file, int line)
|
||||
{
|
||||
isc_result_t status;
|
||||
|
||||
status = omapi_value_new (vp, caller);
|
||||
status = omapi_value_new (vp, file, line);
|
||||
if (status != ISC_R_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = omapi_data_string_reference (&(*vp) -> name, name, caller);
|
||||
status = omapi_data_string_reference (&(*vp) -> name,
|
||||
name, file, line);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
if (value) {
|
||||
status = omapi_typed_data_new (&(*vp) -> value,
|
||||
status = omapi_typed_data_new (file, line, &(*vp) -> value,
|
||||
omapi_datatype_string, value);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
omapi_value_dereference (vp, caller);
|
||||
omapi_value_dereference (vp, file, line);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr, "Usage: test listen port\n");
|
||||
exit (1);
|
||||
}
|
||||
status = omapi_generic_new (&listener, "main");
|
||||
status = omapi_generic_new (&listener, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
fprintf (stderr, "omapi_generic_new: %s\n",
|
||||
isc_result_totext (status));
|
||||
@@ -59,7 +59,7 @@ int main (int argc, char **argv)
|
||||
fprintf (stderr, "Usage: test listen address port\n");
|
||||
exit (1);
|
||||
}
|
||||
status = omapi_generic_new (&connection, "main");
|
||||
status = omapi_generic_new (&connection, MDL);
|
||||
if (status != ISC_R_SUCCESS) {
|
||||
fprintf (stderr, "omapi_generic_new: %s\n",
|
||||
isc_result_totext (status));
|
||||
|
Reference in New Issue
Block a user