00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "dhcpd.h"
00038 #include <omapip/omapip_p.h>
00039
00040 OMAPI_OBJECT_ALLOC (subnet, struct subnet, dhcp_type_subnet)
00041 OMAPI_OBJECT_ALLOC (shared_network, struct shared_network,
00042 dhcp_type_shared_network)
00043 OMAPI_OBJECT_ALLOC (group_object, struct group_object, dhcp_type_group)
00044 OMAPI_OBJECT_ALLOC (dhcp_control, dhcp_control_object_t, dhcp_type_control)
00045
00046 omapi_object_type_t *dhcp_type_interface;
00047 omapi_object_type_t *dhcp_type_group;
00048 omapi_object_type_t *dhcp_type_shared_network;
00049 omapi_object_type_t *dhcp_type_subnet;
00050 omapi_object_type_t *dhcp_type_control;
00051 dhcp_control_object_t *dhcp_control_object;
00052
00053 void dhcp_common_objects_setup ()
00054 {
00055 isc_result_t status;
00056
00057 status = omapi_object_type_register (&dhcp_type_control,
00058 "control",
00059 dhcp_control_set_value,
00060 dhcp_control_get_value,
00061 dhcp_control_destroy,
00062 dhcp_control_signal_handler,
00063 dhcp_control_stuff_values,
00064 dhcp_control_lookup,
00065 dhcp_control_create,
00066 dhcp_control_remove, 0, 0, 0,
00067 sizeof (dhcp_control_object_t),
00068 0, RC_MISC);
00069 if (status != ISC_R_SUCCESS)
00070 log_fatal ("Can't register control object type: %s",
00071 isc_result_totext (status));
00072 status = dhcp_control_allocate (&dhcp_control_object, MDL);
00073 if (status != ISC_R_SUCCESS)
00074 log_fatal ("Can't make initial control object: %s",
00075 isc_result_totext (status));
00076 dhcp_control_object -> state = server_startup;
00077
00078 status = omapi_object_type_register (&dhcp_type_group,
00079 "group",
00080 dhcp_group_set_value,
00081 dhcp_group_get_value,
00082 dhcp_group_destroy,
00083 dhcp_group_signal_handler,
00084 dhcp_group_stuff_values,
00085 dhcp_group_lookup,
00086 dhcp_group_create,
00087 dhcp_group_remove, 0, 0, 0,
00088 sizeof (struct group_object), 0,
00089 RC_MISC);
00090 if (status != ISC_R_SUCCESS)
00091 log_fatal ("Can't register group object type: %s",
00092 isc_result_totext (status));
00093
00094 status = omapi_object_type_register (&dhcp_type_subnet,
00095 "subnet",
00096 dhcp_subnet_set_value,
00097 dhcp_subnet_get_value,
00098 dhcp_subnet_destroy,
00099 dhcp_subnet_signal_handler,
00100 dhcp_subnet_stuff_values,
00101 dhcp_subnet_lookup,
00102 dhcp_subnet_create,
00103 dhcp_subnet_remove, 0, 0, 0,
00104 sizeof (struct subnet), 0,
00105 RC_MISC);
00106 if (status != ISC_R_SUCCESS)
00107 log_fatal ("Can't register subnet object type: %s",
00108 isc_result_totext (status));
00109
00110 status = omapi_object_type_register
00111 (&dhcp_type_shared_network,
00112 "shared-network",
00113 dhcp_shared_network_set_value,
00114 dhcp_shared_network_get_value,
00115 dhcp_shared_network_destroy,
00116 dhcp_shared_network_signal_handler,
00117 dhcp_shared_network_stuff_values,
00118 dhcp_shared_network_lookup,
00119 dhcp_shared_network_create,
00120 dhcp_shared_network_remove, 0, 0, 0,
00121 sizeof (struct shared_network), 0, RC_MISC);
00122 if (status != ISC_R_SUCCESS)
00123 log_fatal ("Can't register shared network object type: %s",
00124 isc_result_totext (status));
00125
00126 interface_setup ();
00127 }
00128
00129 isc_result_t dhcp_group_set_value (omapi_object_t *h,
00130 omapi_object_t *id,
00131 omapi_data_string_t *name,
00132 omapi_typed_data_t *value)
00133 {
00134 struct group_object *group;
00135 isc_result_t status;
00136
00137 if (h -> type != dhcp_type_group)
00138 return DHCP_R_INVALIDARG;
00139 group = (struct group_object *)h;
00140
00141
00142
00143 if (!omapi_ds_strcmp (name, "name")) {
00144 if (group -> name)
00145 return ISC_R_EXISTS;
00146 if (value -> type == omapi_datatype_data ||
00147 value -> type == omapi_datatype_string) {
00148 group -> name = dmalloc (value -> u.buffer.len + 1,
00149 MDL);
00150 if (!group -> name)
00151 return ISC_R_NOMEMORY;
00152 memcpy (group -> name,
00153 value -> u.buffer.value,
00154 value -> u.buffer.len);
00155 group -> name [value -> u.buffer.len] = 0;
00156 } else
00157 return DHCP_R_INVALIDARG;
00158 return ISC_R_SUCCESS;
00159 }
00160
00161 if (!omapi_ds_strcmp (name, "statements")) {
00162 if (group -> group && group -> group -> statements)
00163 return ISC_R_EXISTS;
00164 if (!group -> group) {
00165 if (!clone_group (&group -> group, root_group, MDL))
00166 return ISC_R_NOMEMORY;
00167 }
00168 if (value -> type == omapi_datatype_data ||
00169 value -> type == omapi_datatype_string) {
00170 struct parse *parse;
00171 int lose = 0;
00172 parse = NULL;
00173 status = new_parse(&parse, -1,
00174 (char *) value->u.buffer.value,
00175 value->u.buffer.len,
00176 "network client", 0);
00177 if (status != ISC_R_SUCCESS || parse == NULL)
00178 return status;
00179 if (!(parse_executable_statements
00180 (&group -> group -> statements, parse, &lose,
00181 context_any))) {
00182 end_parse (&parse);
00183 return DHCP_R_BADPARSE;
00184 }
00185 end_parse (&parse);
00186 return ISC_R_SUCCESS;
00187 } else
00188 return DHCP_R_INVALIDARG;
00189 }
00190
00191
00192 if (h -> inner && h -> inner -> type -> set_value) {
00193 status = ((*(h -> inner -> type -> set_value))
00194 (h -> inner, id, name, value));
00195 if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
00196 return status;
00197 }
00198
00199 return ISC_R_NOTFOUND;
00200 }
00201
00202
00203 isc_result_t dhcp_group_get_value (omapi_object_t *h, omapi_object_t *id,
00204 omapi_data_string_t *name,
00205 omapi_value_t **value)
00206 {
00207 struct group_object *group;
00208 isc_result_t status;
00209
00210 if (h -> type != dhcp_type_group)
00211 return DHCP_R_INVALIDARG;
00212 group = (struct group_object *)h;
00213
00214 if (!omapi_ds_strcmp (name, "name"))
00215 return omapi_make_string_value (value,
00216 name, group -> name, MDL);
00217
00218
00219 if (h -> inner && h -> inner -> type -> get_value) {
00220 status = ((*(h -> inner -> type -> get_value))
00221 (h -> inner, id, name, value));
00222 if (status == ISC_R_SUCCESS)
00223 return status;
00224 }
00225 return ISC_R_NOTFOUND;
00226 }
00227
00228 isc_result_t dhcp_group_destroy (omapi_object_t *h, const char *file, int line)
00229 {
00230 struct group_object *group, *t;
00231
00232 if (h -> type != dhcp_type_group)
00233 return DHCP_R_INVALIDARG;
00234 group = (struct group_object *)h;
00235
00236 if (group -> name) {
00237 if (group_name_hash) {
00238 t = (struct group_object *)0;
00239 if (group_hash_lookup (&t, group_name_hash,
00240 group -> name,
00241 strlen (group -> name), MDL)) {
00242 group_hash_delete (group_name_hash,
00243 group -> name,
00244 strlen (group -> name),
00245 MDL);
00246 group_object_dereference (&t, MDL);
00247 }
00248 }
00249 dfree (group -> name, file, line);
00250 group -> name = (char *)0;
00251 }
00252 if (group -> group)
00253 group_dereference (&group -> group, MDL);
00254
00255 return ISC_R_SUCCESS;
00256 }
00257
00258 isc_result_t dhcp_group_signal_handler (omapi_object_t *h,
00259 const char *name, va_list ap)
00260 {
00261 struct group_object *group;
00262 isc_result_t status;
00263 int updatep = 0;
00264
00265 if (h -> type != dhcp_type_group)
00266 return DHCP_R_INVALIDARG;
00267 group = (struct group_object *)h;
00268
00269 if (!strcmp (name, "updated")) {
00270
00271
00272 if (!group -> group)
00273 return DHCP_R_INVALIDARG;
00274
00275
00276 if (!group -> name) {
00277 char hnbuf [64];
00278 sprintf (hnbuf, "ng%08lx%08lx",
00279 (unsigned long)cur_time,
00280 (unsigned long)group);
00281 group -> name = dmalloc (strlen (hnbuf) + 1, MDL);
00282 if (!group -> name)
00283 return ISC_R_NOMEMORY;
00284 strcpy (group -> name, hnbuf);
00285 }
00286
00287 supersede_group (group, 1);
00288 updatep = 1;
00289 }
00290
00291
00292 if (h -> inner && h -> inner -> type -> get_value) {
00293 status = ((*(h -> inner -> type -> signal_handler))
00294 (h -> inner, name, ap));
00295 if (status == ISC_R_SUCCESS)
00296 return status;
00297 }
00298 if (updatep)
00299 return ISC_R_SUCCESS;
00300 return ISC_R_NOTFOUND;
00301 }
00302
00303 isc_result_t dhcp_group_stuff_values (omapi_object_t *c,
00304 omapi_object_t *id,
00305 omapi_object_t *h)
00306 {
00307 struct group_object *group;
00308 isc_result_t status;
00309
00310 if (h -> type != dhcp_type_group)
00311 return DHCP_R_INVALIDARG;
00312 group = (struct group_object *)h;
00313
00314
00315 if (group -> name) {
00316 status = omapi_connection_put_name (c, "name");
00317 if (status != ISC_R_SUCCESS)
00318 return status;
00319 status = omapi_connection_put_string (c, group -> name);
00320 if (status != ISC_R_SUCCESS)
00321 return status;
00322 }
00323
00324
00325 if (h -> inner && h -> inner -> type -> stuff_values) {
00326 status = ((*(h -> inner -> type -> stuff_values))
00327 (c, id, h -> inner));
00328 if (status == ISC_R_SUCCESS)
00329 return status;
00330 }
00331
00332 return ISC_R_SUCCESS;
00333 }
00334
00335 isc_result_t dhcp_group_lookup (omapi_object_t **lp,
00336 omapi_object_t *id, omapi_object_t *ref)
00337 {
00338 omapi_value_t *tv = (omapi_value_t *)0;
00339 isc_result_t status;
00340 struct group_object *group;
00341
00342 if (!ref)
00343 return DHCP_R_NOKEYS;
00344
00345
00346 status = omapi_get_value_str (ref, id, "handle", &tv);
00347 if (status == ISC_R_SUCCESS) {
00348 status = omapi_handle_td_lookup (lp, tv -> value);
00349
00350 omapi_value_dereference (&tv, MDL);
00351 if (status != ISC_R_SUCCESS)
00352 return status;
00353
00354
00355 if ((*lp) -> type != dhcp_type_group) {
00356 omapi_object_dereference (lp, MDL);
00357 return DHCP_R_INVALIDARG;
00358 }
00359 }
00360
00361
00362 status = omapi_get_value_str (ref, id, "name", &tv);
00363 if (status == ISC_R_SUCCESS) {
00364 group = (struct group_object *)0;
00365 if (group_name_hash &&
00366 group_hash_lookup (&group, group_name_hash,
00367 (const char *)
00368 tv -> value -> u.buffer.value,
00369 tv -> value -> u.buffer.len, MDL)) {
00370 omapi_value_dereference (&tv, MDL);
00371
00372 if (*lp && *lp != (omapi_object_t *)group) {
00373 group_object_dereference (&group, MDL);
00374 omapi_object_dereference (lp, MDL);
00375 return DHCP_R_KEYCONFLICT;
00376 } else if (!*lp) {
00377
00378
00379 omapi_object_reference (lp,
00380 (omapi_object_t *)group,
00381 MDL);
00382 group_object_dereference (&group, MDL);
00383 }
00384 } else if (!*lp)
00385 return ISC_R_NOTFOUND;
00386 }
00387
00388
00389
00390 if (!*lp)
00391 return DHCP_R_NOKEYS;
00392
00393 if (((struct group_object *)(*lp)) -> flags & GROUP_OBJECT_DELETED) {
00394 omapi_object_dereference (lp, MDL);
00395 return ISC_R_NOTFOUND;
00396 }
00397 return ISC_R_SUCCESS;
00398 }
00399
00400 isc_result_t dhcp_group_create (omapi_object_t **lp,
00401 omapi_object_t *id)
00402 {
00403 struct group_object *group;
00404 isc_result_t status;
00405 group = (struct group_object *)0;
00406
00407 status = group_object_allocate (&group, MDL);
00408 if (status != ISC_R_SUCCESS)
00409 return status;
00410 group -> flags = GROUP_OBJECT_DYNAMIC;
00411 status = omapi_object_reference (lp, (omapi_object_t *)group, MDL);
00412 group_object_dereference (&group, MDL);
00413 return status;
00414 }
00415
00416 isc_result_t dhcp_group_remove (omapi_object_t *lp,
00417 omapi_object_t *id)
00418 {
00419 struct group_object *group;
00420 isc_result_t status;
00421 if (lp -> type != dhcp_type_group)
00422 return DHCP_R_INVALIDARG;
00423 group = (struct group_object *)lp;
00424
00425 group -> flags |= GROUP_OBJECT_DELETED;
00426 if (group_write_hook) {
00427 if (!(*group_write_hook) (group))
00428 return ISC_R_IOERROR;
00429 }
00430
00431 status = dhcp_group_destroy ((omapi_object_t *)group, MDL);
00432
00433 return status;
00434 }
00435
00436 isc_result_t dhcp_control_set_value (omapi_object_t *h,
00437 omapi_object_t *id,
00438 omapi_data_string_t *name,
00439 omapi_typed_data_t *value)
00440 {
00441 dhcp_control_object_t *control;
00442 isc_result_t status;
00443 unsigned long newstate;
00444
00445 if (h -> type != dhcp_type_control)
00446 return DHCP_R_INVALIDARG;
00447 control = (dhcp_control_object_t *)h;
00448
00449 if (!omapi_ds_strcmp (name, "state")) {
00450 status = omapi_get_int_value (&newstate, value);
00451 if (status != ISC_R_SUCCESS)
00452 return status;
00453 status = dhcp_set_control_state (control -> state, newstate);
00454 if (status == ISC_R_SUCCESS)
00455 control -> state = value -> u.integer;
00456 return status;
00457 }
00458
00459
00460 if (h -> inner && h -> inner -> type -> set_value) {
00461 status = ((*(h -> inner -> type -> set_value))
00462 (h -> inner, id, name, value));
00463 if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
00464 return status;
00465 }
00466
00467 return ISC_R_NOTFOUND;
00468 }
00469
00470
00471 isc_result_t dhcp_control_get_value (omapi_object_t *h, omapi_object_t *id,
00472 omapi_data_string_t *name,
00473 omapi_value_t **value)
00474 {
00475 dhcp_control_object_t *control;
00476 isc_result_t status;
00477
00478 if (h -> type != dhcp_type_control)
00479 return DHCP_R_INVALIDARG;
00480 control = (dhcp_control_object_t *)h;
00481
00482 if (!omapi_ds_strcmp (name, "state"))
00483 return omapi_make_int_value (value,
00484 name, (int)control -> state, MDL);
00485
00486
00487 if (h -> inner && h -> inner -> type -> get_value) {
00488 status = ((*(h -> inner -> type -> get_value))
00489 (h -> inner, id, name, value));
00490 if (status == ISC_R_SUCCESS)
00491 return status;
00492 }
00493 return ISC_R_NOTFOUND;
00494 }
00495
00496 isc_result_t dhcp_control_destroy (omapi_object_t *h,
00497 const char *file, int line)
00498 {
00499 if (h -> type != dhcp_type_control)
00500 return DHCP_R_INVALIDARG;
00501
00502
00503 return ISC_R_NOPERM;
00504 }
00505
00506 isc_result_t dhcp_control_signal_handler (omapi_object_t *h,
00507 const char *name, va_list ap)
00508 {
00509
00510
00511 isc_result_t status;
00512
00513 if (h -> type != dhcp_type_control)
00514 return DHCP_R_INVALIDARG;
00515
00516
00517 if (h -> inner && h -> inner -> type -> get_value) {
00518 status = ((*(h -> inner -> type -> signal_handler))
00519 (h -> inner, name, ap));
00520 if (status == ISC_R_SUCCESS)
00521 return status;
00522 }
00523 return ISC_R_NOTFOUND;
00524 }
00525
00526 isc_result_t dhcp_control_stuff_values (omapi_object_t *c,
00527 omapi_object_t *id,
00528 omapi_object_t *h)
00529 {
00530 dhcp_control_object_t *control;
00531 isc_result_t status;
00532
00533 if (h -> type != dhcp_type_control)
00534 return DHCP_R_INVALIDARG;
00535 control = (dhcp_control_object_t *)h;
00536
00537
00538 status = omapi_connection_put_name (c, "state");
00539 if (status != ISC_R_SUCCESS)
00540 return status;
00541 status = omapi_connection_put_uint32 (c, sizeof (u_int32_t));
00542 if (status != ISC_R_SUCCESS)
00543 return status;
00544 status = omapi_connection_put_uint32 (c, control -> state);
00545 if (status != ISC_R_SUCCESS)
00546 return status;
00547
00548
00549 if (h -> inner && h -> inner -> type -> stuff_values) {
00550 status = ((*(h -> inner -> type -> stuff_values))
00551 (c, id, h -> inner));
00552 if (status == ISC_R_SUCCESS)
00553 return status;
00554 }
00555
00556 return ISC_R_SUCCESS;
00557 }
00558
00559 isc_result_t dhcp_control_lookup (omapi_object_t **lp,
00560 omapi_object_t *id, omapi_object_t *ref)
00561 {
00562 omapi_value_t *tv = (omapi_value_t *)0;
00563 isc_result_t status;
00564
00565
00566 if (ref) {
00567 status = omapi_get_value_str (ref, id, "handle", &tv);
00568 if (status == ISC_R_SUCCESS) {
00569 status = omapi_handle_td_lookup (lp, tv -> value);
00570
00571 omapi_value_dereference (&tv, MDL);
00572 if (status != ISC_R_SUCCESS)
00573 return status;
00574
00575
00576 if ((*lp) -> type != dhcp_type_control) {
00577 omapi_object_dereference (lp, MDL);
00578 return DHCP_R_INVALIDARG;
00579 }
00580 }
00581 }
00582
00583
00584
00585 dhcp_control_reference ((dhcp_control_object_t **)lp,
00586 dhcp_control_object, MDL);
00587 return ISC_R_SUCCESS;
00588 }
00589
00590 isc_result_t dhcp_control_create (omapi_object_t **lp,
00591 omapi_object_t *id)
00592 {
00593
00594 return ISC_R_NOPERM;
00595 }
00596
00597 isc_result_t dhcp_control_remove (omapi_object_t *lp,
00598 omapi_object_t *id)
00599 {
00600
00601
00602 return ISC_R_NOPERM;
00603 }
00604
00605 isc_result_t dhcp_subnet_set_value (omapi_object_t *h,
00606 omapi_object_t *id,
00607 omapi_data_string_t *name,
00608 omapi_typed_data_t *value)
00609 {
00610
00611
00612 isc_result_t status;
00613
00614 if (h -> type != dhcp_type_subnet)
00615 return DHCP_R_INVALIDARG;
00616
00617
00618
00619
00620 if (h -> inner && h -> inner -> type -> set_value) {
00621 status = ((*(h -> inner -> type -> set_value))
00622 (h -> inner, id, name, value));
00623 if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
00624 return status;
00625 }
00626
00627 return ISC_R_NOTFOUND;
00628 }
00629
00630
00631 isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id,
00632 omapi_data_string_t *name,
00633 omapi_value_t **value)
00634 {
00635
00636
00637 isc_result_t status;
00638
00639 if (h -> type != dhcp_type_subnet)
00640 return DHCP_R_INVALIDARG;
00641
00642
00643
00644
00645 if (h -> inner && h -> inner -> type -> get_value) {
00646 status = ((*(h -> inner -> type -> get_value))
00647 (h -> inner, id, name, value));
00648 if (status == ISC_R_SUCCESS)
00649 return status;
00650 }
00651 return ISC_R_NOTFOUND;
00652 }
00653
00654 isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line)
00655 {
00656 #if defined (DEBUG_MEMORY_LEAKAGE) || \
00657 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
00658 struct subnet *subnet;
00659 #endif
00660
00661 if (h -> type != dhcp_type_subnet)
00662 return DHCP_R_INVALIDARG;
00663
00664 #if defined (DEBUG_MEMORY_LEAKAGE) || \
00665 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
00666 subnet = (struct subnet *)h;
00667 if (subnet -> next_subnet)
00668 subnet_dereference (&subnet -> next_subnet, file, line);
00669 if (subnet -> next_sibling)
00670 subnet_dereference (&subnet -> next_sibling, file, line);
00671 if (subnet -> shared_network)
00672 shared_network_dereference (&subnet -> shared_network,
00673 file, line);
00674 if (subnet -> interface)
00675 interface_dereference (&subnet -> interface, file, line);
00676 if (subnet -> group)
00677 group_dereference (&subnet -> group, file, line);
00678 #endif
00679
00680 return ISC_R_SUCCESS;
00681 }
00682
00683 isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h,
00684 const char *name, va_list ap)
00685 {
00686
00687
00688 isc_result_t status;
00689
00690 if (h -> type != dhcp_type_subnet)
00691 return DHCP_R_INVALIDARG;
00692
00693
00694
00695
00696 if (h -> inner && h -> inner -> type -> get_value) {
00697 status = ((*(h -> inner -> type -> signal_handler))
00698 (h -> inner, name, ap));
00699 if (status == ISC_R_SUCCESS)
00700 return status;
00701 }
00702
00703 return ISC_R_NOTFOUND;
00704 }
00705
00706 isc_result_t dhcp_subnet_stuff_values (omapi_object_t *c,
00707 omapi_object_t *id,
00708 omapi_object_t *h)
00709 {
00710
00711
00712 isc_result_t status;
00713
00714 if (h -> type != dhcp_type_subnet)
00715 return DHCP_R_INVALIDARG;
00716
00717
00718
00719
00720 if (h -> inner && h -> inner -> type -> stuff_values) {
00721 status = ((*(h -> inner -> type -> stuff_values))
00722 (c, id, h -> inner));
00723 if (status == ISC_R_SUCCESS)
00724 return status;
00725 }
00726
00727 return ISC_R_SUCCESS;
00728 }
00729
00730 isc_result_t dhcp_subnet_lookup (omapi_object_t **lp,
00731 omapi_object_t *id,
00732 omapi_object_t *ref)
00733 {
00734
00735
00736
00737
00738 if (!*lp)
00739 return DHCP_R_NOKEYS;
00740 return ISC_R_SUCCESS;
00741 }
00742
00743 isc_result_t dhcp_subnet_create (omapi_object_t **lp,
00744 omapi_object_t *id)
00745 {
00746 return ISC_R_NOTIMPLEMENTED;
00747 }
00748
00749 isc_result_t dhcp_subnet_remove (omapi_object_t *lp,
00750 omapi_object_t *id)
00751 {
00752 return ISC_R_NOTIMPLEMENTED;
00753 }
00754
00755 isc_result_t dhcp_shared_network_set_value (omapi_object_t *h,
00756 omapi_object_t *id,
00757 omapi_data_string_t *name,
00758 omapi_typed_data_t *value)
00759 {
00760
00761
00762 isc_result_t status;
00763
00764 if (h -> type != dhcp_type_shared_network)
00765 return DHCP_R_INVALIDARG;
00766
00767
00768
00769
00770 if (h -> inner && h -> inner -> type -> set_value) {
00771 status = ((*(h -> inner -> type -> set_value))
00772 (h -> inner, id, name, value));
00773 if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
00774 return status;
00775 }
00776
00777 return ISC_R_NOTFOUND;
00778 }
00779
00780
00781 isc_result_t dhcp_shared_network_get_value (omapi_object_t *h,
00782 omapi_object_t *id,
00783 omapi_data_string_t *name,
00784 omapi_value_t **value)
00785 {
00786
00787
00788 isc_result_t status;
00789
00790 if (h -> type != dhcp_type_shared_network)
00791 return DHCP_R_INVALIDARG;
00792
00793
00794
00795
00796 if (h -> inner && h -> inner -> type -> get_value) {
00797 status = ((*(h -> inner -> type -> get_value))
00798 (h -> inner, id, name, value));
00799 if (status == ISC_R_SUCCESS)
00800 return status;
00801 }
00802 return ISC_R_NOTFOUND;
00803 }
00804
00805 isc_result_t dhcp_shared_network_destroy (omapi_object_t *h,
00806 const char *file, int line)
00807 {
00808
00809
00810 #if defined (DEBUG_MEMORY_LEAKAGE) || \
00811 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
00812 struct shared_network *shared_network;
00813 #endif
00814
00815 if (h -> type != dhcp_type_shared_network)
00816 return DHCP_R_INVALIDARG;
00817
00818 #if defined (DEBUG_MEMORY_LEAKAGE) || \
00819 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
00820 shared_network = (struct shared_network *)h;
00821 if (shared_network -> next)
00822 shared_network_dereference (&shared_network -> next,
00823 file, line);
00824 if (shared_network -> name) {
00825 dfree (shared_network -> name, file, line);
00826 shared_network -> name = 0;
00827 }
00828 if (shared_network -> subnets)
00829 subnet_dereference (&shared_network -> subnets, file, line);
00830 if (shared_network -> interface)
00831 interface_dereference (&shared_network -> interface,
00832 file, line);
00833 if (shared_network -> pools)
00834 omapi_object_dereference ((omapi_object_t **)
00835 &shared_network -> pools, file, line);
00836 if (shared_network -> group)
00837 group_dereference (&shared_network -> group, file, line);
00838 #if defined (FAILOVER_PROTOCOL)
00839 if (shared_network -> failover_peer)
00840 omapi_object_dereference ((omapi_object_t **)
00841 &shared_network -> failover_peer,
00842 file, line);
00843 #endif
00844 #endif
00845
00846 return ISC_R_SUCCESS;
00847 }
00848
00849 isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *h,
00850 const char *name,
00851 va_list ap)
00852 {
00853
00854
00855 isc_result_t status;
00856
00857 if (h -> type != dhcp_type_shared_network)
00858 return DHCP_R_INVALIDARG;
00859
00860
00861
00862
00863 if (h -> inner && h -> inner -> type -> get_value) {
00864 status = ((*(h -> inner -> type -> signal_handler))
00865 (h -> inner, name, ap));
00866 if (status == ISC_R_SUCCESS)
00867 return status;
00868 }
00869
00870 return ISC_R_NOTFOUND;
00871 }
00872
00873 isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *c,
00874 omapi_object_t *id,
00875 omapi_object_t *h)
00876 {
00877
00878
00879 isc_result_t status;
00880
00881 if (h -> type != dhcp_type_shared_network)
00882 return DHCP_R_INVALIDARG;
00883
00884
00885
00886
00887 if (h -> inner && h -> inner -> type -> stuff_values) {
00888 status = ((*(h -> inner -> type -> stuff_values))
00889 (c, id, h -> inner));
00890 if (status == ISC_R_SUCCESS)
00891 return status;
00892 }
00893
00894 return ISC_R_SUCCESS;
00895 }
00896
00897 isc_result_t dhcp_shared_network_lookup (omapi_object_t **lp,
00898 omapi_object_t *id,
00899 omapi_object_t *ref)
00900 {
00901
00902
00903
00904
00905 if (!*lp)
00906 return DHCP_R_NOKEYS;
00907 return ISC_R_SUCCESS;
00908 }
00909
00910 isc_result_t dhcp_shared_network_create (omapi_object_t **lp,
00911 omapi_object_t *id)
00912 {
00913 return ISC_R_NOTIMPLEMENTED;
00914 }
00915
00916 isc_result_t dhcp_shared_network_remove (omapi_object_t *lp,
00917 omapi_object_t *id)
00918 {
00919 return ISC_R_NOTIMPLEMENTED;
00920 }
00921