3 OMAPI object interfaces for the DHCP server. */
6 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1999-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
35 /* Many, many thanks to Brian Murrell and BCtel for this code - BCtel
36 provided the funding that resulted in this code and the entire
37 OMAPI support library being written, and Brian helped brainstorm
38 and refine the requirements. To the extent that this code is
39 useful, you have Brian and BCtel to thank. Any limitations in the
40 code are a result of mistakes on my part. -- Ted Lemon */
43 static char copyright
[] =
44 "$Id$ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
48 #include <omapip/omapip_p.h>
50 OMAPI_OBJECT_ALLOC (subnet
, struct subnet
, dhcp_type_subnet
)
51 OMAPI_OBJECT_ALLOC (shared_network
, struct shared_network
,
52 dhcp_type_shared_network
)
53 OMAPI_OBJECT_ALLOC (group_object
, struct group_object
, dhcp_type_group
)
54 OMAPI_OBJECT_ALLOC (dhcp_control
, dhcp_control_object_t
, dhcp_type_control
)
56 omapi_object_type_t
*dhcp_type_interface
;
57 omapi_object_type_t
*dhcp_type_group
;
58 omapi_object_type_t
*dhcp_type_shared_network
;
59 omapi_object_type_t
*dhcp_type_subnet
;
60 omapi_object_type_t
*dhcp_type_control
;
61 dhcp_control_object_t
*dhcp_control_object
;
63 void dhcp_common_objects_setup ()
67 status
= omapi_object_type_register (&dhcp_type_control
,
69 dhcp_control_set_value
,
70 dhcp_control_get_value
,
72 dhcp_control_signal_handler
,
73 dhcp_control_stuff_values
,
76 dhcp_control_remove
, 0, 0, 0,
77 sizeof (dhcp_control_object_t
),
79 if (status
!= ISC_R_SUCCESS
)
80 log_fatal ("Can't register control object type: %s",
81 isc_result_totext (status
));
82 status
= dhcp_control_allocate (&dhcp_control_object
, MDL
);
83 if (status
!= ISC_R_SUCCESS
)
84 log_fatal ("Can't make initial control object: %s",
85 isc_result_totext (status
));
86 dhcp_control_object
-> state
= server_startup
;
88 status
= omapi_object_type_register (&dhcp_type_group
,
93 dhcp_group_signal_handler
,
94 dhcp_group_stuff_values
,
97 dhcp_group_remove
, 0, 0, 0,
98 sizeof (struct group_object
), 0,
100 if (status
!= ISC_R_SUCCESS
)
101 log_fatal ("Can't register group object type: %s",
102 isc_result_totext (status
));
104 status
= omapi_object_type_register (&dhcp_type_subnet
,
106 dhcp_subnet_set_value
,
107 dhcp_subnet_get_value
,
109 dhcp_subnet_signal_handler
,
110 dhcp_subnet_stuff_values
,
113 dhcp_subnet_remove
, 0, 0, 0,
114 sizeof (struct subnet
), 0,
116 if (status
!= ISC_R_SUCCESS
)
117 log_fatal ("Can't register subnet object type: %s",
118 isc_result_totext (status
));
120 status
= omapi_object_type_register
121 (&dhcp_type_shared_network
,
123 dhcp_shared_network_set_value
,
124 dhcp_shared_network_get_value
,
125 dhcp_shared_network_destroy
,
126 dhcp_shared_network_signal_handler
,
127 dhcp_shared_network_stuff_values
,
128 dhcp_shared_network_lookup
,
129 dhcp_shared_network_create
,
130 dhcp_shared_network_remove
, 0, 0, 0,
131 sizeof (struct shared_network
), 0, RC_MISC
);
132 if (status
!= ISC_R_SUCCESS
)
133 log_fatal ("Can't register shared network object type: %s",
134 isc_result_totext (status
));
139 isc_result_t
dhcp_group_set_value (omapi_object_t
*h
,
141 omapi_data_string_t
*name
,
142 omapi_typed_data_t
*value
)
144 struct group_object
*group
;
148 if (h
-> type
!= dhcp_type_group
)
149 return ISC_R_INVALIDARG
;
150 group
= (struct group_object
*)h
;
152 /* XXX For now, we can only set these values on new group objects.
153 XXX Soon, we need to be able to update group objects. */
154 if (!omapi_ds_strcmp (name
, "name")) {
157 if (value
-> type
== omapi_datatype_data
||
158 value
-> type
== omapi_datatype_string
) {
159 group
-> name
= dmalloc (value
-> u
.buffer
.len
+ 1,
162 return ISC_R_NOMEMORY
;
163 memcpy (group
-> name
,
164 value
-> u
.buffer
.value
,
165 value
-> u
.buffer
.len
);
166 group
-> name
[value
-> u
.buffer
.len
] = 0;
168 return ISC_R_INVALIDARG
;
169 return ISC_R_SUCCESS
;
172 if (!omapi_ds_strcmp (name
, "statements")) {
173 if (group
-> group
&& group
-> group
-> statements
)
175 if (!group
-> group
) {
176 if (!clone_group (&group
-> group
, root_group
, MDL
))
177 return ISC_R_NOMEMORY
;
179 if (value
-> type
== omapi_datatype_data
||
180 value
-> type
== omapi_datatype_string
) {
183 parse
= (struct parse
*)0;
184 status
= new_parse (&parse
, -1,
185 (char *)value
-> u
.buffer
.value
,
186 value
-> u
.buffer
.len
,
187 "network client", 0);
188 if (status
!= ISC_R_SUCCESS
)
190 if (!(parse_executable_statements
191 (&group
-> group
-> statements
, parse
, &lose
,
194 return ISC_R_BADPARSE
;
197 return ISC_R_SUCCESS
;
199 return ISC_R_INVALIDARG
;
202 /* Try to find some inner object that can take the value. */
203 if (h
-> inner
&& h
-> inner
-> type
-> set_value
) {
204 status
= ((*(h
-> inner
-> type
-> set_value
))
205 (h
-> inner
, id
, name
, value
));
206 if (status
== ISC_R_SUCCESS
|| status
== ISC_R_UNCHANGED
)
210 return ISC_R_NOTFOUND
;
214 isc_result_t
dhcp_group_get_value (omapi_object_t
*h
, omapi_object_t
*id
,
215 omapi_data_string_t
*name
,
216 omapi_value_t
**value
)
218 struct group_object
*group
;
220 // struct data_string ip_addrs;
222 if (h
-> type
!= dhcp_type_group
)
223 return ISC_R_INVALIDARG
;
224 group
= (struct group_object
*)h
;
226 if (!omapi_ds_strcmp (name
, "name"))
227 return omapi_make_string_value (value
,
228 name
, group
-> name
, MDL
);
230 /* Try to find some inner object that can take the value. */
231 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
232 status
= ((*(h
-> inner
-> type
-> get_value
))
233 (h
-> inner
, id
, name
, value
));
234 if (status
== ISC_R_SUCCESS
)
237 return ISC_R_NOTFOUND
;
240 isc_result_t
dhcp_group_destroy (omapi_object_t
*h
, const char *file
, int line
)
242 struct group_object
*group
, *t
;
243 // isc_result_t status;
245 if (h
-> type
!= dhcp_type_group
)
246 return ISC_R_INVALIDARG
;
247 group
= (struct group_object
*)h
;
250 if (group_name_hash
) {
251 t
= (struct group_object
*)0;
252 if (group_hash_lookup (&t
, group_name_hash
,
254 strlen (group
-> name
), MDL
)) {
255 group_hash_delete (group_name_hash
,
257 strlen (group
-> name
),
259 group_object_dereference (&t
, MDL
);
262 dfree (group
-> name
, file
, line
);
263 group
-> name
= (char *)0;
266 group_dereference (&group
-> group
, MDL
);
268 return ISC_R_SUCCESS
;
271 isc_result_t
dhcp_group_signal_handler (omapi_object_t
*h
,
272 const char *name
, va_list ap
)
274 struct group_object
*group
;
275 // struct group_object *t;
279 if (h
-> type
!= dhcp_type_group
)
280 return ISC_R_INVALIDARG
;
281 group
= (struct group_object
*)h
;
283 if (!strcmp (name
, "updated")) {
284 /* A group object isn't valid if a subgroup hasn't yet been
285 associated with it. */
287 return ISC_R_INVALIDARG
;
289 /* Group objects always have to have names. */
290 if (!group
-> name
) {
292 sprintf (hnbuf
, "ng%08lx%08lx",
293 (unsigned long)cur_time
,
294 (unsigned long)group
);
295 group
-> name
= dmalloc (strlen (hnbuf
) + 1, MDL
);
297 return ISC_R_NOMEMORY
;
298 strcpy (group
-> name
, hnbuf
);
301 supersede_group (group
, 1);
305 /* Try to find some inner object that can take the value. */
306 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
307 status
= ((*(h
-> inner
-> type
-> signal_handler
))
308 (h
-> inner
, name
, ap
));
309 if (status
== ISC_R_SUCCESS
)
313 return ISC_R_SUCCESS
;
314 return ISC_R_NOTFOUND
;
317 isc_result_t
dhcp_group_stuff_values (omapi_object_t
*c
,
321 struct group_object
*group
;
324 if (h
-> type
!= dhcp_type_group
)
325 return ISC_R_INVALIDARG
;
326 group
= (struct group_object
*)h
;
328 /* Write out all the values. */
330 status
= omapi_connection_put_name (c
, "name");
331 if (status
!= ISC_R_SUCCESS
)
333 status
= omapi_connection_put_string (c
, group
-> name
);
334 if (status
!= ISC_R_SUCCESS
)
338 /* Write out the inner object, if any. */
339 if (h
-> inner
&& h
-> inner
-> type
-> stuff_values
) {
340 status
= ((*(h
-> inner
-> type
-> stuff_values
))
341 (c
, id
, h
-> inner
));
342 if (status
== ISC_R_SUCCESS
)
346 return ISC_R_SUCCESS
;
349 isc_result_t
dhcp_group_lookup (omapi_object_t
**lp
,
350 omapi_object_t
*id
, omapi_object_t
*ref
)
352 omapi_value_t
*tv
= (omapi_value_t
*)0;
354 struct group_object
*group
;
359 /* First see if we were sent a handle. */
360 status
= omapi_get_value_str (ref
, id
, "handle", &tv
);
361 if (status
== ISC_R_SUCCESS
) {
362 status
= omapi_handle_td_lookup (lp
, tv
-> value
);
364 omapi_value_dereference (&tv
, MDL
);
365 if (status
!= ISC_R_SUCCESS
)
368 /* Don't return the object if the type is wrong. */
369 if ((*lp
) -> type
!= dhcp_type_group
) {
370 omapi_object_dereference (lp
, MDL
);
371 return ISC_R_INVALIDARG
;
375 /* Now look for a name. */
376 status
= omapi_get_value_str (ref
, id
, "name", &tv
);
377 if (status
== ISC_R_SUCCESS
) {
378 group
= (struct group_object
*)0;
379 if (group_name_hash
&&
380 group_hash_lookup (&group
, group_name_hash
,
382 tv
-> value
-> u
.buffer
.value
,
383 tv
-> value
-> u
.buffer
.len
, MDL
)) {
384 omapi_value_dereference (&tv
, MDL
);
386 if (*lp
&& *lp
!= (omapi_object_t
*)group
) {
387 group_object_dereference (&group
, MDL
);
388 omapi_object_dereference (lp
, MDL
);
389 return ISC_R_KEYCONFLICT
;
391 /* XXX fix so that hash lookup itself creates
392 XXX the reference. */
393 omapi_object_reference (lp
,
394 (omapi_object_t
*)group
,
396 group_object_dereference (&group
, MDL
);
399 return ISC_R_NOTFOUND
;
402 /* If we get to here without finding a group, no valid key was
407 if (((struct group_object
*)(*lp
)) -> flags
& GROUP_OBJECT_DELETED
) {
408 omapi_object_dereference (lp
, MDL
);
409 return ISC_R_NOTFOUND
;
411 return ISC_R_SUCCESS
;
414 isc_result_t
dhcp_group_create (omapi_object_t
**lp
,
417 struct group_object
*group
;
419 group
= (struct group_object
*)0;
421 status
= group_object_allocate (&group
, MDL
);
422 if (status
!= ISC_R_SUCCESS
)
424 group
-> flags
= GROUP_OBJECT_DYNAMIC
;
425 status
= omapi_object_reference (lp
, (omapi_object_t
*)group
, MDL
);
426 group_object_dereference (&group
, MDL
);
430 isc_result_t
dhcp_group_remove (omapi_object_t
*lp
,
433 struct group_object
*group
;
435 if (lp
-> type
!= dhcp_type_group
)
436 return ISC_R_INVALIDARG
;
437 group
= (struct group_object
*)lp
;
439 group
-> flags
|= GROUP_OBJECT_DELETED
;
440 if (group_write_hook
) {
441 if (!(*group_write_hook
) (group
))
442 return ISC_R_IOERROR
;
445 status
= dhcp_group_destroy ((omapi_object_t
*)group
, MDL
);
450 isc_result_t
dhcp_control_set_value (omapi_object_t
*h
,
452 omapi_data_string_t
*name
,
453 omapi_typed_data_t
*value
)
455 dhcp_control_object_t
*control
;
458 unsigned long newstate
;
460 if (h
-> type
!= dhcp_type_control
)
461 return ISC_R_INVALIDARG
;
462 control
= (dhcp_control_object_t
*)h
;
464 if (!omapi_ds_strcmp (name
, "state")) {
465 status
= omapi_get_int_value (&newstate
, value
);
466 if (status
!= ISC_R_SUCCESS
)
468 status
= dhcp_set_control_state (control
-> state
, newstate
);
469 if (status
== ISC_R_SUCCESS
)
470 control
-> state
= value
-> u
.integer
;
474 /* Try to find some inner object that can take the value. */
475 if (h
-> inner
&& h
-> inner
-> type
-> set_value
) {
476 status
= ((*(h
-> inner
-> type
-> set_value
))
477 (h
-> inner
, id
, name
, value
));
478 if (status
== ISC_R_SUCCESS
|| status
== ISC_R_UNCHANGED
)
482 return ISC_R_NOTFOUND
;
486 isc_result_t
dhcp_control_get_value (omapi_object_t
*h
, omapi_object_t
*id
,
487 omapi_data_string_t
*name
,
488 omapi_value_t
**value
)
490 dhcp_control_object_t
*control
;
492 // struct data_string ip_addrs;
494 if (h
-> type
!= dhcp_type_control
)
495 return ISC_R_INVALIDARG
;
496 control
= (dhcp_control_object_t
*)h
;
498 if (!omapi_ds_strcmp (name
, "state"))
499 return omapi_make_int_value (value
,
500 name
, (int)control
-> state
, MDL
);
502 /* Try to find some inner object that can take the value. */
503 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
504 status
= ((*(h
-> inner
-> type
-> get_value
))
505 (h
-> inner
, id
, name
, value
));
506 if (status
== ISC_R_SUCCESS
)
509 return ISC_R_NOTFOUND
;
512 isc_result_t
dhcp_control_destroy (omapi_object_t
*h
,
513 const char *file
, int line
)
515 // dhcp_control_object_t *control, *t;
516 // isc_result_t status;
518 if (h
-> type
!= dhcp_type_control
)
519 return ISC_R_INVALIDARG
;
521 /* Can't destroy the control object. */
525 isc_result_t
dhcp_control_signal_handler (omapi_object_t
*h
,
526 const char *name
, va_list ap
)
530 if (h
-> type
!= dhcp_type_control
)
531 return ISC_R_INVALIDARG
;
533 /* Try to find some inner object that can take the value. */
534 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
535 status
= ((*(h
-> inner
-> type
-> signal_handler
))
536 (h
-> inner
, name
, ap
));
537 if (status
== ISC_R_SUCCESS
)
540 return ISC_R_NOTFOUND
;
543 isc_result_t
dhcp_control_stuff_values (omapi_object_t
*c
,
547 dhcp_control_object_t
*control
;
550 if (h
-> type
!= dhcp_type_control
)
551 return ISC_R_INVALIDARG
;
552 control
= (dhcp_control_object_t
*)h
;
554 /* Write out all the values. */
555 status
= omapi_connection_put_name (c
, "state");
556 if (status
!= ISC_R_SUCCESS
)
558 status
= omapi_connection_put_uint32 (c
, sizeof (u_int32_t
));
559 if (status
!= ISC_R_SUCCESS
)
561 status
= omapi_connection_put_uint32 (c
, control
-> state
);
562 if (status
!= ISC_R_SUCCESS
)
565 /* Write out the inner object, if any. */
566 if (h
-> inner
&& h
-> inner
-> type
-> stuff_values
) {
567 status
= ((*(h
-> inner
-> type
-> stuff_values
))
568 (c
, id
, h
-> inner
));
569 if (status
== ISC_R_SUCCESS
)
573 return ISC_R_SUCCESS
;
576 isc_result_t
dhcp_control_lookup (omapi_object_t
**lp
,
577 omapi_object_t
*id
, omapi_object_t
*ref
)
579 omapi_value_t
*tv
= (omapi_value_t
*)0;
581 // dhcp_control_object_t *control;
583 /* First see if we were sent a handle. */
585 status
= omapi_get_value_str (ref
, id
, "handle", &tv
);
586 if (status
== ISC_R_SUCCESS
) {
587 status
= omapi_handle_td_lookup (lp
, tv
-> value
);
589 omapi_value_dereference (&tv
, MDL
);
590 if (status
!= ISC_R_SUCCESS
)
593 /* Don't return the object if the type is wrong. */
594 if ((*lp
) -> type
!= dhcp_type_control
) {
595 omapi_object_dereference (lp
, MDL
);
596 return ISC_R_INVALIDARG
;
601 /* Otherwise, stop playing coy - there's only one control object,
602 so we can just return it. */
603 dhcp_control_reference ((dhcp_control_object_t
**)lp
,
604 dhcp_control_object
, MDL
);
605 return ISC_R_SUCCESS
;
608 isc_result_t
dhcp_control_create (omapi_object_t
**lp
,
611 /* Can't create a control object - there can be only one. */
615 isc_result_t
dhcp_control_remove (omapi_object_t
*lp
,
618 /* Form is emptiness; emptiness form. The control object
619 cannot go out of existance. */
623 isc_result_t
dhcp_subnet_set_value (omapi_object_t
*h
,
625 omapi_data_string_t
*name
,
626 omapi_typed_data_t
*value
)
631 if (h
-> type
!= dhcp_type_subnet
)
632 return ISC_R_INVALIDARG
;
634 /* No values to set yet. */
636 /* Try to find some inner object that can take the value. */
637 if (h
-> inner
&& h
-> inner
-> type
-> set_value
) {
638 status
= ((*(h
-> inner
-> type
-> set_value
))
639 (h
-> inner
, id
, name
, value
));
640 if (status
== ISC_R_SUCCESS
|| status
== ISC_R_UNCHANGED
)
644 return ISC_R_NOTFOUND
;
648 isc_result_t
dhcp_subnet_get_value (omapi_object_t
*h
, omapi_object_t
*id
,
649 omapi_data_string_t
*name
,
650 omapi_value_t
**value
)
654 if (h
-> type
!= dhcp_type_subnet
)
655 return ISC_R_INVALIDARG
;
657 /* No values to get yet. */
659 /* Try to find some inner object that can provide the value. */
660 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
661 status
= ((*(h
-> inner
-> type
-> get_value
))
662 (h
-> inner
, id
, name
, value
));
663 if (status
== ISC_R_SUCCESS
)
666 return ISC_R_NOTFOUND
;
669 isc_result_t
dhcp_subnet_destroy (omapi_object_t
*h
, const char *file
, int line
)
671 #if defined (DEBUG_MEMORY_LEAKAGE) || \
672 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
673 struct subnet
*subnet
;
675 // isc_result_t status;
677 if (h
-> type
!= dhcp_type_subnet
)
678 return ISC_R_INVALIDARG
;
679 #if defined (DEBUG_MEMORY_LEAKAGE) || \
680 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
681 subnet
= (struct subnet
*)h
;
683 if (subnet
-> next_subnet
)
684 subnet_dereference (&subnet
-> next_subnet
, file
, line
);
685 if (subnet
-> next_sibling
)
686 subnet_dereference (&subnet
-> next_sibling
, file
, line
);
687 if (subnet
-> shared_network
)
688 shared_network_dereference (&subnet
-> shared_network
,
690 if (subnet
-> interface
)
691 interface_dereference (&subnet
-> interface
, file
, line
);
693 group_dereference (&subnet
-> group
, file
, line
);
696 return ISC_R_SUCCESS
;
699 isc_result_t
dhcp_subnet_signal_handler (omapi_object_t
*h
,
700 const char *name
, va_list ap
)
705 if (h
-> type
!= dhcp_type_subnet
)
706 return ISC_R_INVALIDARG
;
708 /* Can't write subnets yet. */
710 /* Try to find some inner object that can take the value. */
711 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
712 status
= ((*(h
-> inner
-> type
-> signal_handler
))
713 (h
-> inner
, name
, ap
));
714 if (status
== ISC_R_SUCCESS
)
718 return ISC_R_SUCCESS
;
719 return ISC_R_NOTFOUND
;
722 isc_result_t
dhcp_subnet_stuff_values (omapi_object_t
*c
,
728 if (h
-> type
!= dhcp_type_subnet
)
729 return ISC_R_INVALIDARG
;
731 /* Can't stuff subnet values yet. */
733 /* Write out the inner object, if any. */
734 if (h
-> inner
&& h
-> inner
-> type
-> stuff_values
) {
735 status
= ((*(h
-> inner
-> type
-> stuff_values
))
736 (c
, id
, h
-> inner
));
737 if (status
== ISC_R_SUCCESS
)
741 return ISC_R_SUCCESS
;
744 isc_result_t
dhcp_subnet_lookup (omapi_object_t
**lp
,
748 // omapi_value_t *tv = (omapi_value_t *)0;
749 // isc_result_t status;
750 // struct subnet *subnet;
752 /* Can't look up subnets yet. */
754 /* If we get to here without finding a subnet, no valid key was
758 return ISC_R_SUCCESS
;
761 isc_result_t
dhcp_subnet_create (omapi_object_t
**lp
,
764 return ISC_R_NOTIMPLEMENTED
;
767 isc_result_t
dhcp_subnet_remove (omapi_object_t
*lp
,
770 return ISC_R_NOTIMPLEMENTED
;
773 isc_result_t
dhcp_shared_network_set_value (omapi_object_t
*h
,
775 omapi_data_string_t
*name
,
776 omapi_typed_data_t
*value
)
781 if (h
-> type
!= dhcp_type_shared_network
)
782 return ISC_R_INVALIDARG
;
784 /* No values to set yet. */
786 /* Try to find some inner object that can take the value. */
787 if (h
-> inner
&& h
-> inner
-> type
-> set_value
) {
788 status
= ((*(h
-> inner
-> type
-> set_value
))
789 (h
-> inner
, id
, name
, value
));
790 if (status
== ISC_R_SUCCESS
|| status
== ISC_R_UNCHANGED
)
794 return ISC_R_NOTFOUND
;
798 isc_result_t
dhcp_shared_network_get_value (omapi_object_t
*h
,
800 omapi_data_string_t
*name
,
801 omapi_value_t
**value
)
805 if (h
-> type
!= dhcp_type_shared_network
)
806 return ISC_R_INVALIDARG
;
808 /* No values to get yet. */
810 /* Try to find some inner object that can provide the value. */
811 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
812 status
= ((*(h
-> inner
-> type
-> get_value
))
813 (h
-> inner
, id
, name
, value
));
814 if (status
== ISC_R_SUCCESS
)
817 return ISC_R_NOTFOUND
;
820 isc_result_t
dhcp_shared_network_destroy (omapi_object_t
*h
,
821 const char *file
, int line
)
823 #if defined (DEBUG_MEMORY_LEAKAGE) || \
824 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
825 struct shared_network
*shared_network
;
827 // isc_result_t status;
829 if (h
-> type
!= dhcp_type_shared_network
)
830 return ISC_R_INVALIDARG
;
831 #if defined (DEBUG_MEMORY_LEAKAGE) || \
832 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
833 shared_network
= (struct shared_network
*)h
;
835 if (shared_network
-> next
)
836 shared_network_dereference (&shared_network
-> next
,
838 if (shared_network
-> name
) {
839 dfree (shared_network
-> name
, file
, line
);
840 shared_network
-> name
= 0;
842 if (shared_network
-> subnets
)
843 subnet_dereference (&shared_network
-> subnets
, file
, line
);
844 if (shared_network
-> interface
)
845 interface_dereference (&shared_network
-> interface
,
847 if (shared_network
-> pools
)
848 omapi_object_dereference ((omapi_object_t
**)
849 &shared_network
-> pools
, file
, line
);
850 if (shared_network
-> group
)
851 group_dereference (&shared_network
-> group
, file
, line
);
852 #if defined (FAILOVER_PROTOCOL)
853 if (shared_network
-> failover_peer
)
854 omapi_object_dereference ((omapi_object_t
**)
855 &shared_network
-> failover_peer
,
858 #endif /* DEBUG_MEMORY_LEAKAGE */
860 return ISC_R_SUCCESS
;
863 isc_result_t
dhcp_shared_network_signal_handler (omapi_object_t
*h
,
870 if (h
-> type
!= dhcp_type_shared_network
)
871 return ISC_R_INVALIDARG
;
873 /* Can't write shared_networks yet. */
875 /* Try to find some inner object that can take the value. */
876 if (h
-> inner
&& h
-> inner
-> type
-> get_value
) {
877 status
= ((*(h
-> inner
-> type
-> signal_handler
))
878 (h
-> inner
, name
, ap
));
879 if (status
== ISC_R_SUCCESS
)
883 return ISC_R_SUCCESS
;
884 return ISC_R_NOTFOUND
;
887 isc_result_t
dhcp_shared_network_stuff_values (omapi_object_t
*c
,
893 if (h
-> type
!= dhcp_type_shared_network
)
894 return ISC_R_INVALIDARG
;
896 /* Can't stuff shared_network values yet. */
898 /* Write out the inner object, if any. */
899 if (h
-> inner
&& h
-> inner
-> type
-> stuff_values
) {
900 status
= ((*(h
-> inner
-> type
-> stuff_values
))
901 (c
, id
, h
-> inner
));
902 if (status
== ISC_R_SUCCESS
)
906 return ISC_R_SUCCESS
;
909 isc_result_t
dhcp_shared_network_lookup (omapi_object_t
**lp
,
913 // omapi_value_t *tv = (omapi_value_t *)0;
914 // isc_result_t status;
915 // struct shared_network *shared_network;
917 /* Can't look up shared_networks yet. */
919 /* If we get to here without finding a shared_network, no valid key was
923 return ISC_R_SUCCESS
;
926 isc_result_t
dhcp_shared_network_create (omapi_object_t
**lp
,
929 return ISC_R_NOTIMPLEMENTED
;
932 isc_result_t
dhcp_shared_network_remove (omapi_object_t
*lp
,
935 return ISC_R_NOTIMPLEMENTED
;