aboutsummaryrefslogtreecommitdiff
path: root/contrib/isc-dhcp/includes/omapip/omapip.h
blob: 3c8f15670f75a6859caae3b18c6a209475c63af0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
/* omapip.h

   Definitions for the object management API and protocol... */

/*
 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
 * Copyright (c) 1996-2003 by 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 ISC DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC 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.
 *
 *   Internet Systems Consortium, Inc.
 *   950 Charter Street
 *   Redwood City, CA 94063
 *   <info@isc.org>
 *   http://www.isc.org/
 *
 * This software has been written for Internet Systems Consortium
 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
 * To learn more about Internet Systems Consortium, see
 * ``http://www.isc.org/''.  To learn more about Vixie Enterprises,
 * see ``http://www.vix.com''.   To learn more about Nominum, Inc., see
 * ``http://www.nominum.com''.
 */

#ifndef _OMAPIP_H_
#define _OMAPIP_H_
#include <isc-dhcp/result.h>

typedef unsigned int omapi_handle_t;

struct __omapi_object;
typedef struct __omapi_object omapi_object_t;

typedef enum {
	omapi_datatype_int,
	omapi_datatype_string,
	omapi_datatype_data,
	omapi_datatype_object
} omapi_datatype_t;

typedef struct {
	int refcnt;
	omapi_datatype_t type;
	union {
		struct {
			unsigned len;
#define OMAPI_TYPED_DATA_NOBUFFER_LEN (sizeof (int) + \
				       sizeof (omapi_datatype_t) + \
				       sizeof (int))
			unsigned char value [1];
		} buffer;
#define OMAPI_TYPED_DATA_OBJECT_LEN (sizeof (int) + \
				     sizeof (omapi_datatype_t) + \
				     sizeof (omapi_object_t *))
		omapi_object_t *object;
#define OMAPI_TYPED_DATA_REF_LEN (sizeof (int) + \
				  sizeof (omapi_datatype_t) + \
				  3 * sizeof (void *))
		struct {
			void *ptr;
			isc_result_t (*reference) (void *,
						   void *, const char *, int);
			isc_result_t (*dereference) (void *,
						     const char *, int);
		} ref;
#define OMAPI_TYPED_DATA_INT_LEN (sizeof (int) + \
				  sizeof (omapi_datatype_t) + \
				  sizeof (int))
		int integer;
	} u;
} omapi_typed_data_t;

typedef struct {
	int refcnt;
	unsigned len;
#define OMAPI_DATA_STRING_EMPTY_SIZE (2 * sizeof (int))
	unsigned char value [1];
} omapi_data_string_t;

typedef struct {
	int refcnt;
	omapi_data_string_t *name;
	omapi_typed_data_t *value;
} omapi_value_t;

typedef struct __omapi_object_type_t {
	const char *name;
	struct __omapi_object_type_t *next;
	
	isc_result_t (*set_value) (omapi_object_t *, omapi_object_t *,
				   omapi_data_string_t *,
				   omapi_typed_data_t *);
	isc_result_t (*get_value) (omapi_object_t *,
				   omapi_object_t *,
				   omapi_data_string_t *, omapi_value_t **);
	isc_result_t (*destroy) (omapi_object_t *, const char *, int);
	isc_result_t (*signal_handler) (omapi_object_t *,
					const char *, va_list);
	isc_result_t (*stuff_values) (omapi_object_t *,
				      omapi_object_t *, omapi_object_t *);
	isc_result_t (*lookup) (omapi_object_t **, omapi_object_t *,
				omapi_object_t *);
	isc_result_t (*create) (omapi_object_t **, omapi_object_t *);
	isc_result_t (*remove) (omapi_object_t *, omapi_object_t *);
	isc_result_t (*freer) (omapi_object_t *, const char *, int);
	isc_result_t (*allocator) (omapi_object_t **, const char *, int);
	isc_result_t (*sizer) (size_t);
	size_t size;
	int rc_flag;
	isc_result_t (*initialize) (omapi_object_t *, const char *, int);
} omapi_object_type_t;

#define OMAPI_OBJECT_PREAMBLE \
	omapi_object_type_t *type; \
	int refcnt; \
	omapi_handle_t handle; \
	omapi_object_t *outer, *inner

/* The omapi handle structure. */
struct __omapi_object {
	OMAPI_OBJECT_PREAMBLE;
};

/* The port on which applications should listen for OMAPI connections. */
#define OMAPI_PROTOCOL_PORT	7911

typedef struct {
	unsigned addrtype;
	unsigned addrlen;
	unsigned char address [16];
	unsigned port;
} omapi_addr_t;

typedef struct {
	int refcnt;
	unsigned count;
	omapi_addr_t *addresses;
} omapi_addr_list_t;

typedef struct auth_key {
	OMAPI_OBJECT_PREAMBLE;
	char *name;
	char *algorithm;
	omapi_data_string_t *key;
} omapi_auth_key_t;

#define OMAPI_CREATE          1
#define OMAPI_UPDATE          2
#define OMAPI_EXCL            4
#define OMAPI_NOTIFY_PROTOCOL 8

#define OMAPI_OBJECT_ALLOC(name, stype, type) \
isc_result_t name##_allocate (stype **p, const char *file, int line)	      \
{									      \
	return omapi_object_allocate ((omapi_object_t **)p,		      \
				      type, 0, file, line);		      \
}									      \
									      \
isc_result_t name##_reference (stype **pptr, stype *ptr,		      \
			       const char *file, int line)		      \
{									      \
	return omapi_object_reference ((omapi_object_t **)pptr,		      \
				       (omapi_object_t *)ptr, file, line);    \
}									      \
									      \
isc_result_t name##_dereference (stype **ptr, const char *file, int line)     \
{									      \
	return omapi_object_dereference ((omapi_object_t **)ptr, file, line); \
}

#define OMAPI_OBJECT_ALLOC_DECL(name, stype, type) \
isc_result_t name##_allocate (stype **p, const char *file, int line); \
isc_result_t name##_reference (stype **pptr, stype *ptr, \
			       const char *file, int line); \
isc_result_t name##_dereference (stype **ptr, const char *file, int line);

typedef isc_result_t (*omapi_array_ref_t) (char **, char *, const char *, int);
typedef isc_result_t (*omapi_array_deref_t) (char **, const char *, int);

/* An extensible array type. */
typedef struct {
	char **data;
	omapi_array_ref_t ref;
	omapi_array_deref_t deref;
	int count;
	int max;
} omapi_array_t;

#define OMAPI_ARRAY_TYPE(name, stype)					      \
isc_result_t name##_array_allocate (omapi_array_t **p,			      \
				    const char *file, int line)		      \
{									      \
	return (omapi_array_allocate					      \
		(p,							      \
		 (omapi_array_ref_t)name##_reference,			      \
		 (omapi_array_deref_t)name##_dereference,		      \
		 file, line));						      \
}									      \
									      \
isc_result_t name##_array_free (omapi_array_t **p,			      \
				const char *file, int line)		      \
{									      \
	return omapi_array_free (p, file, line);			      \
}									      \
									      \
isc_result_t name##_array_extend (omapi_array_t *pptr, stype *ptr, int *index,\
				  const char *file, int line)		      \
{									      \
	return omapi_array_extend (pptr, (char *)ptr, index, file, line);     \
}									      \
									      \
isc_result_t name##_array_set (omapi_array_t *pptr, stype *ptr,	int index,    \
			       const char *file, int line)		      \
{									      \
	return omapi_array_set (pptr, (char *)ptr, index, file, line);	      \
}									      \
									      \
isc_result_t name##_array_lookup (stype **ptr, omapi_array_t *pptr,	      \
				  int index, const char *file, int line)      \
{									      \
	return omapi_array_lookup ((char **)ptr, pptr, index, file, line);    \
}

#define OMAPI_ARRAY_TYPE_DECL(name, stype) \
isc_result_t name##_array_allocate (omapi_array_t **, const char *, int);     \
isc_result_t name##_array_free (omapi_array_t **, const char *, int);	      \
isc_result_t name##_array_extend (omapi_array_t *, stype *, int *,	      \
				  const char *, int);			      \
isc_result_t name##_array_set (omapi_array_t *,				      \
			       stype *, int, const char *, int);	      \
isc_result_t name##_array_lookup (stype **,				      \
				  omapi_array_t *, int, const char *, int)

#define	omapi_array_foreach_begin(array, stype, var)			      \
	{								      \
		int omapi_array_foreach_index;				      \
		stype *var = (stype *)0;				      \
		for (omapi_array_foreach_index = 0;			      \
			     array &&					      \
			     omapi_array_foreach_index < (array) -> count;    \
		     omapi_array_foreach_index++) {			      \
			if ((array) -> data [omapi_array_foreach_index]) {    \
				((*(array) -> ref)			      \
				 ((char **)&var,			      \
				  (array) -> data [omapi_array_foreach_index],\
				  MDL));

#define	omapi_array_foreach_end(array, stype, var)			      \
				(*(array) -> deref) ((char **)&var, MDL);     \
			}						      \
		}							      \
	}

isc_result_t omapi_protocol_connect (omapi_object_t *,
				     const char *, unsigned, omapi_object_t *);
isc_result_t omapi_connect_list (omapi_object_t *, omapi_addr_list_t *,
				 omapi_addr_t *);
isc_result_t omapi_protocol_listen (omapi_object_t *, unsigned, int);
isc_boolean_t omapi_protocol_authenticated (omapi_object_t *);
isc_result_t omapi_protocol_configure_security (omapi_object_t *,
						isc_result_t (*)
						(omapi_object_t *,
						 omapi_addr_t *),
						isc_result_t (*)
						(omapi_object_t *,
						 omapi_auth_key_t *));
isc_result_t omapi_protocol_accept (omapi_object_t *);
isc_result_t omapi_protocol_send_intro (omapi_object_t *, unsigned, unsigned);
isc_result_t omapi_protocol_ready (omapi_object_t *);
isc_result_t omapi_protocol_add_auth (omapi_object_t *, omapi_object_t *,
				      omapi_handle_t);
isc_result_t omapi_protocol_lookup_auth (omapi_object_t **, omapi_object_t *,
					 omapi_handle_t);
isc_result_t omapi_protocol_set_value (omapi_object_t *, omapi_object_t *,
				       omapi_data_string_t *,
				       omapi_typed_data_t *);
isc_result_t omapi_protocol_get_value (omapi_object_t *, omapi_object_t *,
				       omapi_data_string_t *,
				       omapi_value_t **); 
isc_result_t omapi_protocol_stuff_values (omapi_object_t *,
					  omapi_object_t *,
					  omapi_object_t *);

isc_result_t omapi_protocol_destroy (omapi_object_t *, const char *, int);
isc_result_t omapi_protocol_send_message (omapi_object_t *,
					  omapi_object_t *,
					  omapi_object_t *,
					  omapi_object_t *);
isc_result_t omapi_protocol_signal_handler (omapi_object_t *,
					    const char *, va_list);
isc_result_t omapi_protocol_listener_set_value (omapi_object_t *,
						omapi_object_t *,
						omapi_data_string_t *,
						omapi_typed_data_t *);
isc_result_t omapi_protocol_listener_get_value (omapi_object_t *,
						omapi_object_t *,
						omapi_data_string_t *,
						omapi_value_t **); 
isc_result_t omapi_protocol_listener_destroy (omapi_object_t *,
					      const char *, int);
isc_result_t omapi_protocol_listener_signal (omapi_object_t *,
					     const char *, va_list);
isc_result_t omapi_protocol_listener_stuff (omapi_object_t *,
					    omapi_object_t *,
					    omapi_object_t *);
isc_result_t omapi_protocol_send_status (omapi_object_t *, omapi_object_t *,
					 isc_result_t, unsigned, const char *);
isc_result_t omapi_protocol_send_open (omapi_object_t *, omapi_object_t *,
				       const char *, omapi_object_t *,
				       unsigned);
isc_result_t omapi_protocol_send_update (omapi_object_t *, omapi_object_t *,
					 unsigned, omapi_object_t *);

isc_result_t omapi_connect (omapi_object_t *, const char *, unsigned);
isc_result_t omapi_disconnect (omapi_object_t *, int);
int omapi_connection_readfd (omapi_object_t *);
int omapi_connection_writefd (omapi_object_t *);
isc_result_t omapi_connection_connect (omapi_object_t *);
isc_result_t omapi_connection_reader (omapi_object_t *);
isc_result_t omapi_connection_writer (omapi_object_t *);
isc_result_t omapi_connection_reaper (omapi_object_t *);
isc_result_t omapi_connection_output_auth_length (omapi_object_t *,
                                                  unsigned *);
isc_result_t omapi_connection_set_value (omapi_object_t *, omapi_object_t *,
					 omapi_data_string_t *,
					 omapi_typed_data_t *);
isc_result_t omapi_connection_get_value (omapi_object_t *, omapi_object_t *,
					 omapi_data_string_t *,
					 omapi_value_t **); 
isc_result_t omapi_connection_destroy (omapi_object_t *, const char *, int);
isc_result_t omapi_connection_signal_handler (omapi_object_t *,
					      const char *, va_list);
isc_result_t omapi_connection_stuff_values (omapi_object_t *,
					    omapi_object_t *,
					    omapi_object_t *);
isc_result_t omapi_connection_write_typed_data (omapi_object_t *,
						omapi_typed_data_t *);
isc_result_t omapi_connection_put_name (omapi_object_t *, const char *);
isc_result_t omapi_connection_put_string (omapi_object_t *, const char *);
isc_result_t omapi_connection_put_handle (omapi_object_t *c,
					  omapi_object_t *h);

isc_result_t omapi_listen (omapi_object_t *, unsigned, int);
isc_result_t omapi_listen_addr (omapi_object_t *,
				omapi_addr_t *, int);
isc_result_t omapi_listener_accept (omapi_object_t *);
int omapi_listener_readfd (omapi_object_t *);
isc_result_t omapi_accept (omapi_object_t *);
isc_result_t omapi_listener_configure_security (omapi_object_t *,
						isc_result_t (*)
						(omapi_object_t *,
						 omapi_addr_t *));
isc_result_t omapi_listener_set_value (omapi_object_t *, omapi_object_t *,
				       omapi_data_string_t *,
				       omapi_typed_data_t *);
isc_result_t omapi_listener_get_value (omapi_object_t *, omapi_object_t *,
				       omapi_data_string_t *,
				       omapi_value_t **); 
isc_result_t omapi_listener_destroy (omapi_object_t *, const char *, int);
isc_result_t omapi_listener_signal_handler (omapi_object_t *,
					    const char *, va_list);
isc_result_t omapi_listener_stuff_values (omapi_object_t *,
					  omapi_object_t *,
					  omapi_object_t *);

isc_result_t omapi_register_io_object (omapi_object_t *,
				       int (*)(omapi_object_t *),
				       int (*)(omapi_object_t *),
				       isc_result_t (*)(omapi_object_t *),
				       isc_result_t (*)(omapi_object_t *),
				       isc_result_t (*)(omapi_object_t *));
isc_result_t omapi_unregister_io_object (omapi_object_t *);
isc_result_t omapi_dispatch (struct timeval *);
isc_result_t omapi_wait_for_completion (omapi_object_t *, struct timeval *);
isc_result_t omapi_one_dispatch (omapi_object_t *, struct timeval *);
isc_result_t omapi_io_set_value (omapi_object_t *, omapi_object_t *,
				 omapi_data_string_t *,
				 omapi_typed_data_t *);
isc_result_t omapi_io_get_value (omapi_object_t *, omapi_object_t *,
				 omapi_data_string_t *, omapi_value_t **); 
isc_result_t omapi_io_destroy (omapi_object_t *, const char *, int);
isc_result_t omapi_io_signal_handler (omapi_object_t *, const char *, va_list);
isc_result_t omapi_io_stuff_values (omapi_object_t *,
				    omapi_object_t *,
				    omapi_object_t *);
isc_result_t omapi_waiter_signal_handler (omapi_object_t *,
					  const char *, va_list);
isc_result_t omapi_io_state_foreach (isc_result_t (*func) (omapi_object_t *,
							   void *),
				     void *p);

isc_result_t omapi_generic_new (omapi_object_t **, const char *, int);
isc_result_t omapi_generic_set_value  (omapi_object_t *, omapi_object_t *,
				       omapi_data_string_t *,
				       omapi_typed_data_t *);
isc_result_t omapi_generic_get_value (omapi_object_t *, omapi_object_t *,
				      omapi_data_string_t *,
				      omapi_value_t **); 
isc_result_t omapi_generic_destroy (omapi_object_t *, const char *, int);
isc_result_t omapi_generic_signal_handler (omapi_object_t *,
					   const char *, va_list);
isc_result_t omapi_generic_stuff_values (omapi_object_t *,
					 omapi_object_t *,
					 omapi_object_t *);
isc_result_t omapi_generic_clear_flags (omapi_object_t *);

isc_result_t omapi_message_new (omapi_object_t **, const char *, int);
isc_result_t omapi_message_set_value  (omapi_object_t *, omapi_object_t *,
				       omapi_data_string_t *,
				       omapi_typed_data_t *);
isc_result_t omapi_message_get_value (omapi_object_t *, omapi_object_t *,
				      omapi_data_string_t *,
				      omapi_value_t **); 
isc_result_t omapi_message_destroy (omapi_object_t *, const char *, int);
isc_result_t omapi_message_signal_handler (omapi_object_t *,
					   const char *, va_list);
isc_result_t omapi_message_stuff_values (omapi_object_t *,
					 omapi_object_t *,
					 omapi_object_t *);
isc_result_t omapi_message_register (omapi_object_t *);
isc_result_t omapi_message_unregister (omapi_object_t *);
isc_result_t omapi_message_process (omapi_object_t *, omapi_object_t *);

OMAPI_OBJECT_ALLOC_DECL (omapi_auth_key,
			 omapi_auth_key_t, omapi_type_auth_key)
isc_result_t omapi_auth_key_new (omapi_auth_key_t **, const char *, int);
isc_result_t omapi_auth_key_destroy (omapi_object_t *, const char *, int);
isc_result_t omapi_auth_key_enter (omapi_auth_key_t *);
isc_result_t omapi_auth_key_lookup_name (omapi_auth_key_t **, const char *);
isc_result_t omapi_auth_key_lookup (omapi_object_t **,
				    omapi_object_t *,
				    omapi_object_t *);
isc_result_t omapi_auth_key_get_value (omapi_object_t *, omapi_object_t *,
				       omapi_data_string_t *,
				       omapi_value_t **); 
isc_result_t omapi_auth_key_stuff_values (omapi_object_t *,
					  omapi_object_t *,
					  omapi_object_t *);

extern omapi_object_type_t *omapi_type_connection;
extern omapi_object_type_t *omapi_type_listener;
extern omapi_object_type_t *omapi_type_io_object;
extern omapi_object_type_t *omapi_type_generic;
extern omapi_object_type_t *omapi_type_protocol;
extern omapi_object_type_t *omapi_type_protocol_listener;
extern omapi_object_type_t *omapi_type_waiter;
extern omapi_object_type_t *omapi_type_remote;
extern omapi_object_type_t *omapi_type_message;
extern omapi_object_type_t *omapi_type_auth_key;

extern omapi_object_type_t *omapi_object_types;

void omapi_type_relinquish (void);
isc_result_t omapi_init (void);
isc_result_t omapi_object_type_register (omapi_object_type_t **,
					 const char *,
					 isc_result_t (*)
						(omapi_object_t *,
						 omapi_object_t *,
						 omapi_data_string_t *,
						 omapi_typed_data_t *),
					 isc_result_t (*)
						(omapi_object_t *,
						 omapi_object_t *,
						 omapi_data_string_t *,
						 omapi_value_t **),
					 isc_result_t (*) (omapi_object_t *,
							   const char *, int),
					 isc_result_t (*) (omapi_object_t *,
							   const char *,
							   va_list),
					 isc_result_t (*) (omapi_object_t *,
							   omapi_object_t *,
							   omapi_object_t *),
					 isc_result_t (*) (omapi_object_t **,
							   omapi_object_t *,
							   omapi_object_t *),
					 isc_result_t (*) (omapi_object_t **,
							   omapi_object_t *),
					 isc_result_t (*) (omapi_object_t *,
							   omapi_object_t *),
					 isc_result_t (*) (omapi_object_t *,
							   const char *, int),
					 isc_result_t (*) (omapi_object_t **,
							   const char *, int),
					 isc_result_t (*) (size_t), size_t,
					 isc_result_t (*) (omapi_object_t *,
							   const char *, int),
					 int);
isc_result_t omapi_signal (omapi_object_t *, const char *, ...);
isc_result_t omapi_signal_in (omapi_object_t *, const char *, ...);
isc_result_t omapi_set_value (omapi_object_t *, omapi_object_t *,
			      omapi_data_string_t *,
			      omapi_typed_data_t *);
isc_result_t omapi_set_value_str (omapi_object_t *, omapi_object_t *,
				  const char *, omapi_typed_data_t *);
isc_result_t omapi_set_boolean_value (omapi_object_t *, omapi_object_t *,
				      const char *, int);
isc_result_t omapi_set_int_value (omapi_object_t *, omapi_object_t *,
				  const char *, int);
isc_result_t omapi_set_object_value (omapi_object_t *, omapi_object_t *,
				     const char *, omapi_object_t *);
isc_result_t omapi_set_string_value (omapi_object_t *, omapi_object_t *,
				     const char *, const char *);
isc_result_t omapi_get_value (omapi_object_t *, omapi_object_t *,
			      omapi_data_string_t *,
			      omapi_value_t **); 
isc_result_t omapi_get_value_str (omapi_object_t *, omapi_object_t *,
				  const char *, omapi_value_t **); 
isc_result_t omapi_stuff_values (omapi_object_t *,
				 omapi_object_t *,
				 omapi_object_t *);
isc_result_t omapi_object_create (omapi_object_t **, omapi_object_t *,
				  omapi_object_type_t *);
isc_result_t omapi_object_update (omapi_object_t *, omapi_object_t *,
				  omapi_object_t *, omapi_handle_t);
int omapi_data_string_cmp (omapi_data_string_t *, omapi_data_string_t *);
int omapi_ds_strcmp (omapi_data_string_t *, const char *);
int omapi_td_strcmp (omapi_typed_data_t *, const char *);
int omapi_td_strcasecmp (omapi_typed_data_t *, const char *);
isc_result_t omapi_make_value (omapi_value_t **, omapi_data_string_t *,
			       omapi_typed_data_t *, const char *, int);
isc_result_t omapi_make_const_value (omapi_value_t **, omapi_data_string_t *,
				     const unsigned char *,
				     unsigned, const char *, int);
isc_result_t omapi_make_int_value (omapi_value_t **, omapi_data_string_t *,
				   int, const char *, int);
isc_result_t omapi_make_uint_value (omapi_value_t **, omapi_data_string_t *,
				    unsigned int, const char *, int);
isc_result_t omapi_make_object_value (omapi_value_t **, omapi_data_string_t *,
				      omapi_object_t *, const char *, int);
isc_result_t omapi_make_handle_value (omapi_value_t **, omapi_data_string_t *,
				      omapi_object_t *, const char *, int);
isc_result_t omapi_make_string_value (omapi_value_t **, omapi_data_string_t *,
				      const char *, const char *, int);
isc_result_t omapi_get_int_value (unsigned long *, omapi_typed_data_t *);

isc_result_t omapi_object_handle (omapi_handle_t *, omapi_object_t *);
isc_result_t omapi_handle_lookup (omapi_object_t **, omapi_handle_t);
isc_result_t omapi_handle_td_lookup (omapi_object_t **, omapi_typed_data_t *);

void * dmalloc (unsigned, const char *, int);
void dfree (void *, const char *, int);
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
		defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
void dmalloc_reuse (void *, const char *, int, int);
void dmalloc_dump_outstanding (void);
#else
#define dmalloc_reuse(x,y,l,z)
#endif
#define MDL __FILE__, __LINE__
#if defined (DEBUG_RC_HISTORY)
void dump_rc_history (void *);
void rc_history_next (int);
#endif
void omapi_print_dmalloc_usage_by_caller (void);
isc_result_t omapi_object_allocate (omapi_object_t **,
				    omapi_object_type_t *,
				    size_t, const char *, int);
isc_result_t omapi_object_initialize (omapi_object_t *,
				      omapi_object_type_t *,
				      size_t, size_t, const char *, int);
isc_result_t omapi_object_reference (omapi_object_t **,
				     omapi_object_t *, const char *, int);
isc_result_t omapi_object_dereference (omapi_object_t **, const char *, int);
isc_result_t omapi_typed_data_new (const char *, int, omapi_typed_data_t **,
				   omapi_datatype_t, ...);
isc_result_t omapi_typed_data_reference (omapi_typed_data_t **,
					 omapi_typed_data_t *,
					 const char *, int);
isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **,
					   const char *, int);
isc_result_t omapi_data_string_new (omapi_data_string_t **,
				    unsigned, const char *, int);
isc_result_t omapi_data_string_reference (omapi_data_string_t **,
					  omapi_data_string_t *,
					  const char *, int);
isc_result_t omapi_data_string_dereference (omapi_data_string_t **,
					    const char *, int);
isc_result_t omapi_value_new (omapi_value_t **, const char *, int);
isc_result_t omapi_value_reference (omapi_value_t **,
				    omapi_value_t *, const char *, int);
isc_result_t omapi_value_dereference (omapi_value_t **, const char *, int);
isc_result_t omapi_addr_list_new (omapi_addr_list_t **, unsigned,
				  const char *, int);
isc_result_t omapi_addr_list_reference (omapi_addr_list_t **,
					omapi_addr_list_t *,
					const char *, int);
isc_result_t omapi_addr_list_dereference (omapi_addr_list_t **,
					  const char *, int);

isc_result_t omapi_array_allocate (omapi_array_t **, omapi_array_ref_t,
				   omapi_array_deref_t, const char *, int);
isc_result_t omapi_array_free (omapi_array_t **, const char *, int);
isc_result_t omapi_array_extend (omapi_array_t *, char *, int *,
				 const char *, int);
isc_result_t omapi_array_set (omapi_array_t *, void *, int, const char *, int);
isc_result_t omapi_array_lookup (char **,
				 omapi_array_t *, int, const char *, int);
OMAPI_ARRAY_TYPE_DECL(omapi_object, omapi_object_t);
#endif /* _OMAPIP_H_ */