1 1.2 christos /* $NetBSD: omapip.h,v 1.3 2022/04/03 01:10:59 christos Exp $ */ 2 1.1 christos 3 1.1 christos /* omapip.h 4 1.1 christos 5 1.1 christos Definitions for the object management API and protocol... */ 6 1.1 christos 7 1.1 christos /* 8 1.3 christos * Copyright (C) 2004-2022 Internet Systems Consortium, Inc. ("ISC") 9 1.1 christos * Copyright (c) 1996-2003 by Internet Software Consortium 10 1.1 christos * 11 1.1 christos * This Source Code Form is subject to the terms of the Mozilla Public 12 1.1 christos * License, v. 2.0. If a copy of the MPL was not distributed with this 13 1.1 christos * file, You can obtain one at http://mozilla.org/MPL/2.0/. 14 1.1 christos * 15 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 16 1.1 christos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 17 1.1 christos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 18 1.1 christos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19 1.1 christos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 20 1.1 christos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 21 1.1 christos * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 22 1.1 christos * 23 1.1 christos * Internet Systems Consortium, Inc. 24 1.3 christos * PO Box 360 25 1.3 christos * Newmarket, NH 03857 USA 26 1.1 christos * <info (at) isc.org> 27 1.1 christos * https://www.isc.org/ 28 1.1 christos * 29 1.1 christos */ 30 1.1 christos 31 1.1 christos #ifndef _OMAPIP_H_ 32 1.1 christos #define _OMAPIP_H_ 33 1.1 christos #include "result.h" 34 1.1 christos #include <stdarg.h> 35 1.1 christos 36 1.1 christos #include <dns/tsec.h> 37 1.1 christos 38 1.1 christos typedef unsigned int omapi_handle_t; 39 1.1 christos 40 1.1 christos struct __omapi_object; 41 1.1 christos typedef struct __omapi_object omapi_object_t; 42 1.1 christos 43 1.1 christos typedef enum { 44 1.1 christos omapi_datatype_int, 45 1.1 christos omapi_datatype_string, 46 1.1 christos omapi_datatype_data, 47 1.1 christos omapi_datatype_object 48 1.1 christos } omapi_datatype_t; 49 1.1 christos 50 1.1 christos typedef struct { 51 1.1 christos int refcnt; 52 1.1 christos omapi_datatype_t type; 53 1.1 christos union { 54 1.1 christos struct { 55 1.1 christos unsigned len; 56 1.1 christos #define OMAPI_TYPED_DATA_NOBUFFER_LEN (sizeof (int) + \ 57 1.1 christos sizeof (omapi_datatype_t) + \ 58 1.1 christos sizeof (int)) 59 1.1 christos unsigned char value [1]; 60 1.1 christos } buffer; 61 1.1 christos #define OMAPI_TYPED_DATA_OBJECT_LEN (sizeof (int) + \ 62 1.1 christos sizeof (omapi_datatype_t) + \ 63 1.1 christos sizeof (omapi_object_t *)) 64 1.1 christos omapi_object_t *object; 65 1.1 christos #define OMAPI_TYPED_DATA_REF_LEN (sizeof (int) + \ 66 1.1 christos sizeof (omapi_datatype_t) + \ 67 1.1 christos 3 * sizeof (void *)) 68 1.1 christos struct { 69 1.1 christos void *ptr; 70 1.1 christos isc_result_t (*reference) (void *, 71 1.1 christos void *, const char *, int); 72 1.1 christos isc_result_t (*dereference) (void *, 73 1.1 christos const char *, int); 74 1.1 christos } ref; 75 1.1 christos #define OMAPI_TYPED_DATA_INT_LEN (sizeof (int) + \ 76 1.1 christos sizeof (omapi_datatype_t) + \ 77 1.1 christos sizeof (int)) 78 1.1 christos int integer; 79 1.1 christos } u; 80 1.1 christos } omapi_typed_data_t; 81 1.1 christos 82 1.1 christos typedef struct { 83 1.1 christos int refcnt; 84 1.1 christos unsigned len; 85 1.1 christos #define OMAPI_DATA_STRING_EMPTY_SIZE (2 * sizeof (int)) 86 1.1 christos unsigned char value [1]; 87 1.1 christos } omapi_data_string_t; 88 1.1 christos 89 1.1 christos typedef struct { 90 1.1 christos int refcnt; 91 1.1 christos omapi_data_string_t *name; 92 1.1 christos omapi_typed_data_t *value; 93 1.1 christos } omapi_value_t; 94 1.1 christos 95 1.1 christos typedef struct __omapi_object_type_t { 96 1.1 christos const char *name; 97 1.1 christos struct __omapi_object_type_t *next; 98 1.3 christos 99 1.1 christos isc_result_t (*set_value) (omapi_object_t *, omapi_object_t *, 100 1.1 christos omapi_data_string_t *, 101 1.1 christos omapi_typed_data_t *); 102 1.1 christos isc_result_t (*get_value) (omapi_object_t *, 103 1.1 christos omapi_object_t *, 104 1.1 christos omapi_data_string_t *, omapi_value_t **); 105 1.1 christos isc_result_t (*destroy) (omapi_object_t *, const char *, int); 106 1.1 christos isc_result_t (*signal_handler) (omapi_object_t *, 107 1.1 christos const char *, va_list); 108 1.1 christos isc_result_t (*stuff_values) (omapi_object_t *, 109 1.1 christos omapi_object_t *, omapi_object_t *); 110 1.1 christos isc_result_t (*lookup) (omapi_object_t **, omapi_object_t *, 111 1.1 christos omapi_object_t *); 112 1.1 christos isc_result_t (*create) (omapi_object_t **, omapi_object_t *); 113 1.1 christos isc_result_t (*remove) (omapi_object_t *, omapi_object_t *); 114 1.1 christos isc_result_t (*freer) (omapi_object_t *, const char *, int); 115 1.1 christos isc_result_t (*allocator) (omapi_object_t **, const char *, int); 116 1.1 christos isc_result_t (*sizer) (size_t); 117 1.1 christos size_t size; 118 1.1 christos int rc_flag; 119 1.1 christos isc_result_t (*initialize) (omapi_object_t *, const char *, int); 120 1.1 christos } omapi_object_type_t; 121 1.1 christos 122 1.1 christos #define OMAPI_OBJECT_PREAMBLE \ 123 1.1 christos omapi_object_type_t *type; \ 124 1.1 christos int refcnt; \ 125 1.1 christos omapi_handle_t handle; \ 126 1.1 christos omapi_object_t *outer, *inner 127 1.1 christos 128 1.1 christos /* The omapi handle structure. */ 129 1.1 christos struct __omapi_object { 130 1.1 christos OMAPI_OBJECT_PREAMBLE; 131 1.1 christos }; 132 1.1 christos 133 1.1 christos /* The port on which applications should listen for OMAPI connections. */ 134 1.1 christos #define OMAPI_PROTOCOL_PORT 7911 135 1.1 christos 136 1.1 christos typedef struct { 137 1.1 christos unsigned addrtype; 138 1.1 christos unsigned addrlen; 139 1.1 christos unsigned char address [16]; 140 1.1 christos unsigned port; 141 1.1 christos } omapi_addr_t; 142 1.1 christos 143 1.1 christos typedef struct { 144 1.1 christos int refcnt; 145 1.1 christos unsigned count; 146 1.1 christos omapi_addr_t *addresses; 147 1.1 christos } omapi_addr_list_t; 148 1.1 christos 149 1.1 christos typedef struct auth_key { 150 1.1 christos OMAPI_OBJECT_PREAMBLE; 151 1.1 christos char *name; 152 1.1 christos char *algorithm; 153 1.1 christos omapi_data_string_t *key; 154 1.1 christos dns_tsec_t *tsec_key; 155 1.1 christos } omapi_auth_key_t; 156 1.1 christos 157 1.1 christos #define OMAPI_CREATE 1 158 1.1 christos #define OMAPI_UPDATE 2 159 1.1 christos #define OMAPI_EXCL 4 160 1.1 christos #define OMAPI_NOTIFY_PROTOCOL 8 161 1.1 christos 162 1.1 christos #define OMAPI_OBJECT_ALLOC(name, stype, type) \ 163 1.1 christos isc_result_t name##_allocate (stype **p, const char *file, int line) \ 164 1.1 christos { \ 165 1.1 christos return omapi_object_allocate ((omapi_object_t **)p, \ 166 1.1 christos type, 0, file, line); \ 167 1.1 christos } \ 168 1.1 christos \ 169 1.1 christos isc_result_t name##_reference (stype **pptr, stype *ptr, \ 170 1.1 christos const char *file, int line) \ 171 1.1 christos { \ 172 1.1 christos return omapi_object_reference ((omapi_object_t **)pptr, \ 173 1.1 christos (omapi_object_t *)ptr, file, line); \ 174 1.1 christos } \ 175 1.1 christos \ 176 1.1 christos isc_result_t name##_dereference (stype **ptr, const char *file, int line) \ 177 1.1 christos { \ 178 1.1 christos return omapi_object_dereference ((omapi_object_t **)ptr, file, line); \ 179 1.1 christos } 180 1.1 christos 181 1.1 christos #define OMAPI_OBJECT_ALLOC_DECL(name, stype, type) \ 182 1.1 christos isc_result_t name##_allocate (stype **p, const char *file, int line); \ 183 1.1 christos isc_result_t name##_reference (stype **pptr, stype *ptr, \ 184 1.1 christos const char *file, int line); \ 185 1.1 christos isc_result_t name##_dereference (stype **ptr, const char *file, int line); 186 1.1 christos 187 1.1 christos typedef isc_result_t (*omapi_array_ref_t) (char **, char *, const char *, int); 188 1.1 christos typedef isc_result_t (*omapi_array_deref_t) (char **, const char *, int); 189 1.1 christos 190 1.1 christos /* An extensible array type. */ 191 1.1 christos typedef struct { 192 1.1 christos char **data; 193 1.1 christos omapi_array_ref_t ref; 194 1.1 christos omapi_array_deref_t deref; 195 1.1 christos int count; 196 1.1 christos int max; 197 1.1 christos } omapi_array_t; 198 1.1 christos 199 1.1 christos #define OMAPI_ARRAY_TYPE(name, stype) \ 200 1.1 christos isc_result_t name##_array_allocate (omapi_array_t **p, \ 201 1.1 christos const char *file, int line) \ 202 1.1 christos { \ 203 1.1 christos return (omapi_array_allocate \ 204 1.1 christos (p, \ 205 1.1 christos (omapi_array_ref_t)name##_reference, \ 206 1.1 christos (omapi_array_deref_t)name##_dereference, \ 207 1.1 christos file, line)); \ 208 1.1 christos } \ 209 1.1 christos \ 210 1.1 christos isc_result_t name##_array_free (omapi_array_t **p, \ 211 1.1 christos const char *file, int line) \ 212 1.1 christos { \ 213 1.1 christos return omapi_array_free (p, file, line); \ 214 1.1 christos } \ 215 1.1 christos \ 216 1.1 christos isc_result_t name##_array_extend (omapi_array_t *pptr, stype *ptr, int *index,\ 217 1.1 christos const char *file, int line) \ 218 1.1 christos { \ 219 1.1 christos return omapi_array_extend (pptr, (char *)ptr, index, file, line); \ 220 1.1 christos } \ 221 1.1 christos \ 222 1.1 christos isc_result_t name##_array_set (omapi_array_t *pptr, stype *ptr, int index, \ 223 1.1 christos const char *file, int line) \ 224 1.1 christos { \ 225 1.1 christos return omapi_array_set (pptr, (char *)ptr, index, file, line); \ 226 1.1 christos } \ 227 1.1 christos \ 228 1.1 christos isc_result_t name##_array_lookup (stype **ptr, omapi_array_t *pptr, \ 229 1.1 christos int index, const char *file, int line) \ 230 1.1 christos { \ 231 1.1 christos return omapi_array_lookup ((char **)ptr, pptr, index, file, line); \ 232 1.1 christos } 233 1.1 christos 234 1.1 christos #define OMAPI_ARRAY_TYPE_DECL(name, stype) \ 235 1.1 christos isc_result_t name##_array_allocate (omapi_array_t **, const char *, int); \ 236 1.1 christos isc_result_t name##_array_free (omapi_array_t **, const char *, int); \ 237 1.1 christos isc_result_t name##_array_extend (omapi_array_t *, stype *, int *, \ 238 1.1 christos const char *, int); \ 239 1.1 christos isc_result_t name##_array_set (omapi_array_t *, \ 240 1.1 christos stype *, int, const char *, int); \ 241 1.1 christos isc_result_t name##_array_lookup (stype **, \ 242 1.1 christos omapi_array_t *, int, const char *, int) 243 1.1 christos 244 1.1 christos #define omapi_array_foreach_begin(array, stype, var) \ 245 1.1 christos { \ 246 1.1 christos int omapi_array_foreach_index; \ 247 1.1 christos stype *var = (stype *)0; \ 248 1.1 christos for (omapi_array_foreach_index = 0; \ 249 1.1 christos array && \ 250 1.1 christos omapi_array_foreach_index < (array) -> count; \ 251 1.1 christos omapi_array_foreach_index++) { \ 252 1.1 christos if ((array) -> data [omapi_array_foreach_index]) { \ 253 1.1 christos ((*(array) -> ref) \ 254 1.1 christos ((char **)&var, \ 255 1.1 christos (array) -> data [omapi_array_foreach_index],\ 256 1.1 christos MDL)); 257 1.1 christos 258 1.1 christos #define omapi_array_foreach_end(array, stype, var) \ 259 1.1 christos (*(array) -> deref) ((char **)&var, MDL); \ 260 1.1 christos } \ 261 1.1 christos } \ 262 1.1 christos } 263 1.1 christos 264 1.1 christos isc_result_t omapi_protocol_connect (omapi_object_t *, 265 1.1 christos const char *, unsigned, omapi_object_t *); 266 1.1 christos isc_result_t omapi_connect_list (omapi_object_t *, omapi_addr_list_t *, 267 1.1 christos omapi_addr_t *); 268 1.1 christos isc_result_t omapi_protocol_listen (omapi_object_t *, unsigned, int); 269 1.1 christos isc_boolean_t omapi_protocol_authenticated (omapi_object_t *); 270 1.1 christos isc_result_t omapi_protocol_configure_security (omapi_object_t *, 271 1.1 christos isc_result_t (*) 272 1.1 christos (omapi_object_t *, 273 1.1 christos omapi_addr_t *), 274 1.1 christos isc_result_t (*) 275 1.1 christos (omapi_object_t *, 276 1.1 christos omapi_auth_key_t *)); 277 1.1 christos isc_result_t omapi_protocol_accept (omapi_object_t *); 278 1.1 christos isc_result_t omapi_protocol_send_intro (omapi_object_t *, unsigned, unsigned); 279 1.1 christos isc_result_t omapi_protocol_ready (omapi_object_t *); 280 1.1 christos isc_result_t omapi_protocol_add_auth (omapi_object_t *, omapi_object_t *, 281 1.1 christos omapi_handle_t); 282 1.1 christos isc_result_t omapi_protocol_lookup_auth (omapi_object_t **, omapi_object_t *, 283 1.1 christos omapi_handle_t); 284 1.1 christos isc_result_t omapi_protocol_set_value (omapi_object_t *, omapi_object_t *, 285 1.1 christos omapi_data_string_t *, 286 1.1 christos omapi_typed_data_t *); 287 1.1 christos isc_result_t omapi_protocol_get_value (omapi_object_t *, omapi_object_t *, 288 1.1 christos omapi_data_string_t *, 289 1.3 christos omapi_value_t **); 290 1.1 christos isc_result_t omapi_protocol_stuff_values (omapi_object_t *, 291 1.1 christos omapi_object_t *, 292 1.1 christos omapi_object_t *); 293 1.1 christos 294 1.1 christos isc_result_t omapi_protocol_destroy (omapi_object_t *, const char *, int); 295 1.1 christos isc_result_t omapi_protocol_send_message (omapi_object_t *, 296 1.1 christos omapi_object_t *, 297 1.1 christos omapi_object_t *, 298 1.1 christos omapi_object_t *); 299 1.1 christos isc_result_t omapi_protocol_signal_handler (omapi_object_t *, 300 1.1 christos const char *, va_list); 301 1.1 christos isc_result_t omapi_protocol_listener_set_value (omapi_object_t *, 302 1.1 christos omapi_object_t *, 303 1.1 christos omapi_data_string_t *, 304 1.1 christos omapi_typed_data_t *); 305 1.1 christos isc_result_t omapi_protocol_listener_get_value (omapi_object_t *, 306 1.1 christos omapi_object_t *, 307 1.1 christos omapi_data_string_t *, 308 1.3 christos omapi_value_t **); 309 1.1 christos isc_result_t omapi_protocol_listener_destroy (omapi_object_t *, 310 1.1 christos const char *, int); 311 1.1 christos isc_result_t omapi_protocol_listener_signal (omapi_object_t *, 312 1.1 christos const char *, va_list); 313 1.1 christos isc_result_t omapi_protocol_listener_stuff (omapi_object_t *, 314 1.1 christos omapi_object_t *, 315 1.1 christos omapi_object_t *); 316 1.1 christos isc_result_t omapi_protocol_send_status (omapi_object_t *, omapi_object_t *, 317 1.1 christos isc_result_t, unsigned, const char *); 318 1.1 christos isc_result_t omapi_protocol_send_open (omapi_object_t *, omapi_object_t *, 319 1.1 christos const char *, omapi_object_t *, 320 1.1 christos unsigned); 321 1.1 christos isc_result_t omapi_protocol_send_update (omapi_object_t *, omapi_object_t *, 322 1.1 christos unsigned, omapi_object_t *); 323 1.1 christos 324 1.1 christos isc_result_t omapi_connect (omapi_object_t *, const char *, unsigned); 325 1.1 christos isc_result_t omapi_disconnect (omapi_object_t *, int); 326 1.1 christos int omapi_connection_readfd (omapi_object_t *); 327 1.1 christos int omapi_connection_writefd (omapi_object_t *); 328 1.1 christos isc_result_t omapi_connection_connect (omapi_object_t *); 329 1.1 christos isc_result_t omapi_connection_reader (omapi_object_t *); 330 1.1 christos isc_result_t omapi_connection_writer (omapi_object_t *); 331 1.1 christos isc_result_t omapi_connection_reaper (omapi_object_t *); 332 1.1 christos isc_result_t omapi_connection_output_auth_length (omapi_object_t *, 333 1.1 christos unsigned *); 334 1.1 christos isc_result_t omapi_connection_set_value (omapi_object_t *, omapi_object_t *, 335 1.1 christos omapi_data_string_t *, 336 1.1 christos omapi_typed_data_t *); 337 1.1 christos isc_result_t omapi_connection_get_value (omapi_object_t *, omapi_object_t *, 338 1.1 christos omapi_data_string_t *, 339 1.3 christos omapi_value_t **); 340 1.1 christos isc_result_t omapi_connection_destroy (omapi_object_t *, const char *, int); 341 1.1 christos isc_result_t omapi_connection_signal_handler (omapi_object_t *, 342 1.1 christos const char *, va_list); 343 1.1 christos isc_result_t omapi_connection_stuff_values (omapi_object_t *, 344 1.1 christos omapi_object_t *, 345 1.1 christos omapi_object_t *); 346 1.1 christos isc_result_t omapi_connection_write_typed_data (omapi_object_t *, 347 1.1 christos omapi_typed_data_t *); 348 1.1 christos isc_result_t omapi_connection_put_name (omapi_object_t *, const char *); 349 1.1 christos isc_result_t omapi_connection_put_string (omapi_object_t *, const char *); 350 1.1 christos isc_result_t omapi_connection_put_handle (omapi_object_t *c, 351 1.1 christos omapi_object_t *h); 352 1.1 christos isc_result_t omapi_connection_put_named_uint32 (omapi_object_t *, 353 1.1 christos const char *, 354 1.1 christos u_int32_t); 355 1.1 christos isc_result_t omapi_listen (omapi_object_t *, unsigned, int); 356 1.1 christos isc_result_t omapi_listen_addr (omapi_object_t *, 357 1.1 christos omapi_addr_t *, int); 358 1.1 christos isc_result_t omapi_listener_accept (omapi_object_t *); 359 1.1 christos int omapi_listener_readfd (omapi_object_t *); 360 1.1 christos isc_result_t omapi_accept (omapi_object_t *); 361 1.1 christos isc_result_t omapi_listener_configure_security (omapi_object_t *, 362 1.1 christos isc_result_t (*) 363 1.1 christos (omapi_object_t *, 364 1.1 christos omapi_addr_t *)); 365 1.1 christos isc_result_t omapi_listener_set_value (omapi_object_t *, omapi_object_t *, 366 1.1 christos omapi_data_string_t *, 367 1.1 christos omapi_typed_data_t *); 368 1.1 christos isc_result_t omapi_listener_get_value (omapi_object_t *, omapi_object_t *, 369 1.1 christos omapi_data_string_t *, 370 1.3 christos omapi_value_t **); 371 1.1 christos isc_result_t omapi_listener_destroy (omapi_object_t *, const char *, int); 372 1.1 christos isc_result_t omapi_listener_signal_handler (omapi_object_t *, 373 1.1 christos const char *, va_list); 374 1.1 christos isc_result_t omapi_listener_stuff_values (omapi_object_t *, 375 1.1 christos omapi_object_t *, 376 1.1 christos omapi_object_t *); 377 1.1 christos 378 1.1 christos isc_result_t omapi_register_io_object (omapi_object_t *, 379 1.1 christos int (*)(omapi_object_t *), 380 1.1 christos int (*)(omapi_object_t *), 381 1.1 christos isc_result_t (*)(omapi_object_t *), 382 1.1 christos isc_result_t (*)(omapi_object_t *), 383 1.1 christos isc_result_t (*)(omapi_object_t *)); 384 1.1 christos isc_result_t omapi_reregister_io_object (omapi_object_t *, 385 1.1 christos int (*)(omapi_object_t *), 386 1.1 christos int (*)(omapi_object_t *), 387 1.1 christos isc_result_t (*)(omapi_object_t *), 388 1.1 christos isc_result_t (*)(omapi_object_t *), 389 1.1 christos isc_result_t (*)(omapi_object_t *)); 390 1.1 christos isc_result_t omapi_unregister_io_object (omapi_object_t *); 391 1.1 christos isc_result_t omapi_dispatch (struct timeval *); 392 1.1 christos isc_result_t omapi_wait_for_completion (omapi_object_t *, struct timeval *); 393 1.1 christos isc_result_t omapi_one_dispatch (omapi_object_t *, struct timeval *); 394 1.1 christos isc_result_t omapi_io_set_value (omapi_object_t *, omapi_object_t *, 395 1.1 christos omapi_data_string_t *, 396 1.1 christos omapi_typed_data_t *); 397 1.1 christos isc_result_t omapi_io_get_value (omapi_object_t *, omapi_object_t *, 398 1.3 christos omapi_data_string_t *, omapi_value_t **); 399 1.1 christos isc_result_t omapi_io_destroy (omapi_object_t *, const char *, int); 400 1.1 christos isc_result_t omapi_io_signal_handler (omapi_object_t *, const char *, va_list); 401 1.1 christos isc_result_t omapi_io_stuff_values (omapi_object_t *, 402 1.1 christos omapi_object_t *, 403 1.1 christos omapi_object_t *); 404 1.1 christos isc_result_t omapi_waiter_signal_handler (omapi_object_t *, 405 1.1 christos const char *, va_list); 406 1.1 christos isc_result_t omapi_io_state_foreach (isc_result_t (*func) (omapi_object_t *, 407 1.1 christos void *), 408 1.1 christos void *p); 409 1.1 christos 410 1.1 christos isc_result_t omapi_generic_new (omapi_object_t **, const char *, int); 411 1.1 christos isc_result_t omapi_generic_set_value (omapi_object_t *, omapi_object_t *, 412 1.1 christos omapi_data_string_t *, 413 1.1 christos omapi_typed_data_t *); 414 1.1 christos isc_result_t omapi_generic_get_value (omapi_object_t *, omapi_object_t *, 415 1.1 christos omapi_data_string_t *, 416 1.3 christos omapi_value_t **); 417 1.1 christos isc_result_t omapi_generic_destroy (omapi_object_t *, const char *, int); 418 1.1 christos isc_result_t omapi_generic_signal_handler (omapi_object_t *, 419 1.1 christos const char *, va_list); 420 1.1 christos isc_result_t omapi_generic_stuff_values (omapi_object_t *, 421 1.1 christos omapi_object_t *, 422 1.1 christos omapi_object_t *); 423 1.1 christos isc_result_t omapi_generic_clear_flags (omapi_object_t *); 424 1.1 christos 425 1.1 christos isc_result_t omapi_message_new (omapi_object_t **, const char *, int); 426 1.1 christos isc_result_t omapi_message_set_value (omapi_object_t *, omapi_object_t *, 427 1.1 christos omapi_data_string_t *, 428 1.1 christos omapi_typed_data_t *); 429 1.1 christos isc_result_t omapi_message_get_value (omapi_object_t *, omapi_object_t *, 430 1.1 christos omapi_data_string_t *, 431 1.3 christos omapi_value_t **); 432 1.1 christos isc_result_t omapi_message_destroy (omapi_object_t *, const char *, int); 433 1.1 christos isc_result_t omapi_message_signal_handler (omapi_object_t *, 434 1.1 christos const char *, va_list); 435 1.1 christos isc_result_t omapi_message_stuff_values (omapi_object_t *, 436 1.1 christos omapi_object_t *, 437 1.1 christos omapi_object_t *); 438 1.1 christos isc_result_t omapi_message_register (omapi_object_t *); 439 1.1 christos isc_result_t omapi_message_unregister (omapi_object_t *); 440 1.1 christos isc_result_t omapi_message_process (omapi_object_t *, omapi_object_t *); 441 1.1 christos 442 1.1 christos OMAPI_OBJECT_ALLOC_DECL (omapi_auth_key, 443 1.1 christos omapi_auth_key_t, omapi_type_auth_key) 444 1.1 christos isc_result_t omapi_auth_key_new (omapi_auth_key_t **, const char *, int); 445 1.1 christos isc_result_t omapi_auth_key_destroy (omapi_object_t *, const char *, int); 446 1.1 christos isc_result_t omapi_auth_key_enter (omapi_auth_key_t *); 447 1.1 christos isc_result_t omapi_auth_key_lookup_name (omapi_auth_key_t **, const char *); 448 1.1 christos isc_result_t omapi_auth_key_lookup (omapi_object_t **, 449 1.1 christos omapi_object_t *, 450 1.1 christos omapi_object_t *); 451 1.1 christos isc_result_t omapi_auth_key_get_value (omapi_object_t *, omapi_object_t *, 452 1.1 christos omapi_data_string_t *, 453 1.3 christos omapi_value_t **); 454 1.1 christos isc_result_t omapi_auth_key_stuff_values (omapi_object_t *, 455 1.1 christos omapi_object_t *, 456 1.1 christos omapi_object_t *); 457 1.1 christos 458 1.1 christos extern omapi_object_type_t *omapi_type_connection; 459 1.1 christos extern omapi_object_type_t *omapi_type_listener; 460 1.1 christos extern omapi_object_type_t *omapi_type_io_object; 461 1.1 christos extern omapi_object_type_t *omapi_type_generic; 462 1.1 christos extern omapi_object_type_t *omapi_type_protocol; 463 1.1 christos extern omapi_object_type_t *omapi_type_protocol_listener; 464 1.1 christos extern omapi_object_type_t *omapi_type_waiter; 465 1.1 christos extern omapi_object_type_t *omapi_type_remote; 466 1.1 christos extern omapi_object_type_t *omapi_type_message; 467 1.1 christos extern omapi_object_type_t *omapi_type_auth_key; 468 1.1 christos 469 1.1 christos extern omapi_object_type_t *omapi_object_types; 470 1.1 christos 471 1.1 christos void omapi_type_relinquish (void); 472 1.1 christos isc_result_t omapi_init (void); 473 1.1 christos isc_result_t omapi_object_type_register (omapi_object_type_t **, 474 1.1 christos const char *, 475 1.1 christos isc_result_t (*) 476 1.1 christos (omapi_object_t *, 477 1.1 christos omapi_object_t *, 478 1.1 christos omapi_data_string_t *, 479 1.1 christos omapi_typed_data_t *), 480 1.1 christos isc_result_t (*) 481 1.1 christos (omapi_object_t *, 482 1.1 christos omapi_object_t *, 483 1.1 christos omapi_data_string_t *, 484 1.1 christos omapi_value_t **), 485 1.1 christos isc_result_t (*) (omapi_object_t *, 486 1.1 christos const char *, int), 487 1.1 christos isc_result_t (*) (omapi_object_t *, 488 1.1 christos const char *, 489 1.1 christos va_list), 490 1.1 christos isc_result_t (*) (omapi_object_t *, 491 1.1 christos omapi_object_t *, 492 1.1 christos omapi_object_t *), 493 1.1 christos isc_result_t (*) (omapi_object_t **, 494 1.1 christos omapi_object_t *, 495 1.1 christos omapi_object_t *), 496 1.1 christos isc_result_t (*) (omapi_object_t **, 497 1.1 christos omapi_object_t *), 498 1.1 christos isc_result_t (*) (omapi_object_t *, 499 1.1 christos omapi_object_t *), 500 1.1 christos isc_result_t (*) (omapi_object_t *, 501 1.1 christos const char *, int), 502 1.1 christos isc_result_t (*) (omapi_object_t **, 503 1.1 christos const char *, int), 504 1.1 christos isc_result_t (*) (size_t), size_t, 505 1.1 christos isc_result_t (*) (omapi_object_t *, 506 1.1 christos const char *, int), 507 1.1 christos int); 508 1.1 christos isc_result_t omapi_signal (omapi_object_t *, const char *, ...); 509 1.1 christos isc_result_t omapi_signal_in (omapi_object_t *, const char *, ...); 510 1.1 christos isc_result_t omapi_set_value (omapi_object_t *, omapi_object_t *, 511 1.1 christos omapi_data_string_t *, 512 1.1 christos omapi_typed_data_t *); 513 1.1 christos isc_result_t omapi_set_value_str (omapi_object_t *, omapi_object_t *, 514 1.1 christos const char *, omapi_typed_data_t *); 515 1.1 christos isc_result_t omapi_set_boolean_value (omapi_object_t *, omapi_object_t *, 516 1.1 christos const char *, int); 517 1.1 christos isc_result_t omapi_set_int_value (omapi_object_t *, omapi_object_t *, 518 1.1 christos const char *, int); 519 1.1 christos isc_result_t omapi_set_object_value (omapi_object_t *, omapi_object_t *, 520 1.1 christos const char *, omapi_object_t *); 521 1.1 christos isc_result_t omapi_set_string_value (omapi_object_t *, omapi_object_t *, 522 1.1 christos const char *, const char *); 523 1.1 christos isc_result_t omapi_get_value (omapi_object_t *, omapi_object_t *, 524 1.1 christos omapi_data_string_t *, 525 1.3 christos omapi_value_t **); 526 1.1 christos isc_result_t omapi_get_value_str (omapi_object_t *, omapi_object_t *, 527 1.3 christos const char *, omapi_value_t **); 528 1.1 christos isc_result_t omapi_stuff_values (omapi_object_t *, 529 1.1 christos omapi_object_t *, 530 1.1 christos omapi_object_t *); 531 1.1 christos isc_result_t omapi_object_create (omapi_object_t **, omapi_object_t *, 532 1.1 christos omapi_object_type_t *); 533 1.1 christos isc_result_t omapi_object_update (omapi_object_t *, omapi_object_t *, 534 1.1 christos omapi_object_t *, omapi_handle_t); 535 1.1 christos int omapi_data_string_cmp (omapi_data_string_t *, omapi_data_string_t *); 536 1.1 christos int omapi_ds_strcmp (omapi_data_string_t *, const char *); 537 1.1 christos int omapi_td_strcmp (omapi_typed_data_t *, const char *); 538 1.1 christos int omapi_td_strcasecmp (omapi_typed_data_t *, const char *); 539 1.1 christos isc_result_t omapi_make_value (omapi_value_t **, omapi_data_string_t *, 540 1.1 christos omapi_typed_data_t *, const char *, int); 541 1.1 christos isc_result_t omapi_make_const_value (omapi_value_t **, omapi_data_string_t *, 542 1.1 christos const unsigned char *, 543 1.1 christos unsigned, const char *, int); 544 1.1 christos isc_result_t omapi_make_int_value (omapi_value_t **, omapi_data_string_t *, 545 1.1 christos int, const char *, int); 546 1.1 christos isc_result_t omapi_make_uint_value (omapi_value_t **, omapi_data_string_t *, 547 1.1 christos unsigned int, const char *, int); 548 1.1 christos isc_result_t omapi_make_object_value (omapi_value_t **, omapi_data_string_t *, 549 1.1 christos omapi_object_t *, const char *, int); 550 1.1 christos isc_result_t omapi_make_handle_value (omapi_value_t **, omapi_data_string_t *, 551 1.1 christos omapi_object_t *, const char *, int); 552 1.1 christos isc_result_t omapi_make_string_value (omapi_value_t **, omapi_data_string_t *, 553 1.1 christos const char *, const char *, int); 554 1.1 christos isc_result_t omapi_get_int_value (unsigned long *, omapi_typed_data_t *); 555 1.1 christos 556 1.1 christos isc_result_t omapi_object_handle (omapi_handle_t *, omapi_object_t *); 557 1.1 christos isc_result_t omapi_handle_lookup (omapi_object_t **, omapi_handle_t); 558 1.1 christos isc_result_t omapi_handle_td_lookup (omapi_object_t **, omapi_typed_data_t *); 559 1.1 christos 560 1.1 christos void * dmalloc (size_t, const char *, int); 561 1.1 christos void dfree (void *, const char *, int); 562 1.1 christos #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \ 563 1.1 christos defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 564 1.1 christos void dmalloc_reuse (void *, const char *, int, int); 565 1.1 christos void dmalloc_dump_outstanding (void); 566 1.1 christos #else 567 1.1 christos #define dmalloc_reuse(x,y,l,z) 568 1.1 christos #endif 569 1.1 christos #define MDL __FILE__, __LINE__ 570 1.1 christos #if defined (DEBUG_RC_HISTORY) 571 1.1 christos void dump_rc_history (void *); 572 1.1 christos void rc_history_next (int); 573 1.1 christos #endif 574 1.1 christos void omapi_print_dmalloc_usage_by_caller (void); 575 1.1 christos isc_result_t omapi_object_allocate (omapi_object_t **, 576 1.1 christos omapi_object_type_t *, 577 1.1 christos size_t, const char *, int); 578 1.1 christos isc_result_t omapi_object_initialize (omapi_object_t *, 579 1.1 christos omapi_object_type_t *, 580 1.1 christos size_t, size_t, const char *, int); 581 1.1 christos isc_result_t omapi_object_reference (omapi_object_t **, 582 1.1 christos omapi_object_t *, const char *, int); 583 1.1 christos isc_result_t omapi_object_dereference (omapi_object_t **, const char *, int); 584 1.1 christos isc_result_t omapi_typed_data_new (const char *, int, omapi_typed_data_t **, 585 1.1 christos omapi_datatype_t, ...); 586 1.1 christos isc_result_t omapi_typed_data_reference (omapi_typed_data_t **, 587 1.1 christos omapi_typed_data_t *, 588 1.1 christos const char *, int); 589 1.1 christos isc_result_t omapi_typed_data_dereference (omapi_typed_data_t **, 590 1.1 christos const char *, int); 591 1.1 christos isc_result_t omapi_data_string_new (omapi_data_string_t **, 592 1.1 christos unsigned, const char *, int); 593 1.1 christos isc_result_t omapi_data_string_reference (omapi_data_string_t **, 594 1.1 christos omapi_data_string_t *, 595 1.1 christos const char *, int); 596 1.1 christos isc_result_t omapi_data_string_dereference (omapi_data_string_t **, 597 1.1 christos const char *, int); 598 1.1 christos isc_result_t omapi_value_new (omapi_value_t **, const char *, int); 599 1.1 christos isc_result_t omapi_value_reference (omapi_value_t **, 600 1.1 christos omapi_value_t *, const char *, int); 601 1.1 christos isc_result_t omapi_value_dereference (omapi_value_t **, const char *, int); 602 1.1 christos isc_result_t omapi_addr_list_new (omapi_addr_list_t **, unsigned, 603 1.1 christos const char *, int); 604 1.1 christos isc_result_t omapi_addr_list_reference (omapi_addr_list_t **, 605 1.1 christos omapi_addr_list_t *, 606 1.1 christos const char *, int); 607 1.1 christos isc_result_t omapi_addr_list_dereference (omapi_addr_list_t **, 608 1.1 christos const char *, int); 609 1.1 christos 610 1.1 christos isc_result_t omapi_array_allocate (omapi_array_t **, omapi_array_ref_t, 611 1.1 christos omapi_array_deref_t, const char *, int); 612 1.1 christos isc_result_t omapi_array_free (omapi_array_t **, const char *, int); 613 1.1 christos isc_result_t omapi_array_extend (omapi_array_t *, char *, int *, 614 1.1 christos const char *, int); 615 1.1 christos isc_result_t omapi_array_set (omapi_array_t *, void *, int, const char *, int); 616 1.1 christos isc_result_t omapi_array_lookup (char **, 617 1.1 christos omapi_array_t *, int, const char *, int); 618 1.1 christos OMAPI_ARRAY_TYPE_DECL(omapi_object, omapi_object_t); 619 1.1 christos #endif /* _OMAPIP_H_ */ 620