data.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: data.c,v 1.19 2001/01/09 21:59:56 bwelling Exp $ */
/* Principal Author: Ted Lemon */
/*
* Functions supporting memory allocation for the object management protocol.
*/
#include <config.h>
va_list l;
unsigned int len;
unsigned int val;
int intval;
char *s;
type == omapi_datatype_data ||
type == omapi_datatype_string ||
/*
* Quiet bogus "might be used uninitialized in this function" warnings.
*/
val = 0;
intval = 0;
s = NULL;
switch (type) {
case omapi_datatype_int:
break;
case omapi_datatype_string:
s = va_arg(l, char *);
break;
case omapi_datatype_data:
break;
case omapi_datatype_object:
break;
default:
"unknown type in omapi_data_create: %d",
type);
return (ISC_R_UNEXPECTED);
}
return (ISC_R_NOMEMORY);
switch (type) {
case omapi_datatype_int:
break;
case omapi_datatype_string:
break;
case omapi_datatype_data:
break;
case omapi_datatype_object:
break;
}
omapi_data_reference(t, new);
return (ISC_R_SUCCESS);
}
void
*r = h;
h->refcnt++;
}
void
unsigned int length = 0;
if (--((*h)->refcnt) == 0) {
switch ((*h)->type) {
case omapi_datatype_int:
break;
case omapi_datatype_string:
break;
case omapi_datatype_data:
break;
case omapi_datatype_object:
OBJECT_DEREF(&(*h)->u.object);
break;
default:
"unknown datatype in "
"omapi_data_dereference: %d\n",
(*h)->type);
/* NOTREACHED */
break;
}
}
*h = NULL;
}
int
int order;
else
if (order == 0) {
order = 1;
order = -1;
}
return (order);
}
int
((t->type == omapi_datatype_data ||
(t->type == omapi_datatype_string)) &&
if (t->type == omapi_datatype_int)
return (t->u.integer);
return (ntohl(stored_value));
}
char *
char *s;
t->type == omapi_datatype_data);
if (s != NULL) {
}
return (s);
}