ISC DHCP  4.3.6
A reference DHCPv4 and DHCPv6 implementation
comapi.c
Go to the documentation of this file.
1 /* omapi.c
2 
3  OMAPI object interfaces for the DHCP server. */
4 
5 /*
6  * Copyright (c) 2004-2016 Internet Systems Consortium, Inc. ("ISC")
7  * Copyright (c) 1999-2003 by Internet Software Consortium
8  *
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.
12  *
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.
20  *
21  * Internet Systems Consortium, Inc.
22  * 950 Charter Street
23  * Redwood City, CA 94063
24  * <info@isc.org>
25  * https://www.isc.org/
26  *
27  */
28 
29 /* Many, many thanks to Brian Murrell and BCtel for this code - BCtel
30  provided the funding that resulted in this code and the entire
31  OMAPI support library being written, and Brian helped brainstorm
32  and refine the requirements. To the extent that this code is
33  useful, you have Brian and BCtel to thank. Any limitations in the
34  code are a result of mistakes on my part. -- Ted Lemon */
35 
36 #include "dhcpd.h"
37 #include <omapip/omapip_p.h>
38 
44 
51 
53 {
54  isc_result_t status;
55 
57  "control",
65  dhcp_control_remove, 0, 0, 0,
66  sizeof (dhcp_control_object_t),
67  0, RC_MISC);
68  if (status != ISC_R_SUCCESS)
69  log_fatal ("Can't register control object type: %s",
70  isc_result_totext (status));
71  status = dhcp_control_allocate (&dhcp_control_object, MDL);
72  if (status != ISC_R_SUCCESS)
73  log_fatal ("Can't make initial control object: %s",
74  isc_result_totext (status));
76 
78  "group",
86  dhcp_group_remove, 0, 0, 0,
87  sizeof (struct group_object), 0,
88  RC_MISC);
89  if (status != ISC_R_SUCCESS)
90  log_fatal ("Can't register group object type: %s",
91  isc_result_totext (status));
92 
94  "subnet",
102  dhcp_subnet_remove, 0, 0, 0,
103  sizeof (struct subnet), 0,
104  RC_MISC);
105  if (status != ISC_R_SUCCESS)
106  log_fatal ("Can't register subnet object type: %s",
107  isc_result_totext (status));
108 
111  "shared-network",
120  sizeof (struct shared_network), 0, RC_MISC);
121  if (status != ISC_R_SUCCESS)
122  log_fatal ("Can't register shared network object type: %s",
123  isc_result_totext (status));
124 
125  interface_setup ();
126 }
127 
129  omapi_object_t *id,
130  omapi_data_string_t *name,
131  omapi_typed_data_t *value)
132 {
133  struct group_object *group;
134  isc_result_t status;
135 
136  if (h -> type != dhcp_type_group)
137  return DHCP_R_INVALIDARG;
138  group = (struct group_object *)h;
139 
140  /* XXX For now, we can only set these values on new group objects.
141  XXX Soon, we need to be able to update group objects. */
142  if (!omapi_ds_strcmp (name, "name")) {
143  if (group -> name)
144  return ISC_R_EXISTS;
145  if (value -> type == omapi_datatype_data ||
146  value -> type == omapi_datatype_string) {
147  group -> name = dmalloc (value -> u.buffer.len + 1,
148  MDL);
149  if (!group -> name)
150  return ISC_R_NOMEMORY;
151  memcpy (group -> name,
152  value -> u.buffer.value,
153  value -> u.buffer.len);
154  group -> name [value -> u.buffer.len] = 0;
155  } else
156  return DHCP_R_INVALIDARG;
157  return ISC_R_SUCCESS;
158  }
159 
160  if (!omapi_ds_strcmp (name, "statements")) {
161  if (group -> group && group -> group -> statements)
162  return ISC_R_EXISTS;
163  if (!group -> group) {
164  if (!clone_group (&group -> group, root_group, MDL))
165  return ISC_R_NOMEMORY;
166  }
167  if (value -> type == omapi_datatype_data ||
168  value -> type == omapi_datatype_string) {
169  struct parse *parse;
170  int lose = 0;
171  parse = NULL;
172  status = new_parse(&parse, -1,
173  (char *) value->u.buffer.value,
174  value->u.buffer.len,
175  "network client", 0);
176  if (status != ISC_R_SUCCESS || parse == NULL)
177  return status;
179  (&group -> group -> statements, parse, &lose,
180  context_any))) {
181  end_parse (&parse);
182  return DHCP_R_BADPARSE;
183  }
184  end_parse (&parse);
185  return ISC_R_SUCCESS;
186  } else
187  return DHCP_R_INVALIDARG;
188  }
189 
190  /* Try to find some inner object that can take the value. */
191  if (h -> inner && h -> inner -> type -> set_value) {
192  status = ((*(h -> inner -> type -> set_value))
193  (h -> inner, id, name, value));
194  if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
195  return status;
196  }
197 
198  return ISC_R_NOTFOUND;
199 }
200 
201 
203  omapi_data_string_t *name,
204  omapi_value_t **value)
205 {
206  struct group_object *group;
207  isc_result_t status;
208 
209  if (h -> type != dhcp_type_group)
210  return DHCP_R_INVALIDARG;
211  group = (struct group_object *)h;
212 
213  if (!omapi_ds_strcmp (name, "name"))
214  return omapi_make_string_value (value,
215  name, group -> name, MDL);
216 
217  /* Try to find some inner object that can take the value. */
218  if (h -> inner && h -> inner -> type -> get_value) {
219  status = ((*(h -> inner -> type -> get_value))
220  (h -> inner, id, name, value));
221  if (status == ISC_R_SUCCESS)
222  return status;
223  }
224  return ISC_R_NOTFOUND;
225 }
226 
227 isc_result_t dhcp_group_destroy (omapi_object_t *h, const char *file, int line)
228 {
229  struct group_object *group, *t;
230 
231  if (h -> type != dhcp_type_group)
232  return DHCP_R_INVALIDARG;
233  group = (struct group_object *)h;
234 
235  if (group -> name) {
236  if (group_name_hash) {
237  t = (struct group_object *)0;
238  if (group_hash_lookup (&t, group_name_hash,
239  group -> name,
240  strlen (group -> name), MDL)) {
241  group_hash_delete (group_name_hash,
242  group -> name,
243  strlen (group -> name),
244  MDL);
245  group_object_dereference (&t, MDL);
246  }
247  }
248  dfree (group -> name, file, line);
249  group -> name = (char *)0;
250  }
251  if (group -> group)
253 
254  return ISC_R_SUCCESS;
255 }
256 
258  const char *name, va_list ap)
259 {
260  struct group_object *group;
261  isc_result_t status;
262  int updatep = 0;
263 
264  if (h -> type != dhcp_type_group)
265  return DHCP_R_INVALIDARG;
266  group = (struct group_object *)h;
267 
268  if (!strcmp (name, "updated")) {
269  /* A group object isn't valid if a subgroup hasn't yet been
270  associated with it. */
271  if (!group -> group)
272  return DHCP_R_INVALIDARG;
273 
274  /* Group objects always have to have names. */
275  if (!group -> name) {
276  char hnbuf [64];
277  sprintf (hnbuf, "ng%08lx%08lx",
278  (unsigned long)cur_time,
279  (unsigned long)group);
280  group -> name = dmalloc (strlen (hnbuf) + 1, MDL);
281  if (!group -> name)
282  return ISC_R_NOMEMORY;
283  strcpy (group -> name, hnbuf);
284  }
285 
286  supersede_group (group, 1);
287  updatep = 1;
288  }
289 
290  /* Try to find some inner object that can take the value. */
291  if (h -> inner && h -> inner -> type -> get_value) {
292  status = ((*(h -> inner -> type -> signal_handler))
293  (h -> inner, name, ap));
294  if (status == ISC_R_SUCCESS)
295  return status;
296  }
297  if (updatep)
298  return ISC_R_SUCCESS;
299  return ISC_R_NOTFOUND;
300 }
301 
303  omapi_object_t *id,
304  omapi_object_t *h)
305 {
306  struct group_object *group;
307  isc_result_t status;
308 
309  if (h -> type != dhcp_type_group)
310  return DHCP_R_INVALIDARG;
311  group = (struct group_object *)h;
312 
313  /* Write out all the values. */
314  if (group -> name) {
315  status = omapi_connection_put_name (c, "name");
316  if (status != ISC_R_SUCCESS)
317  return status;
318  status = omapi_connection_put_string (c, group -> name);
319  if (status != ISC_R_SUCCESS)
320  return status;
321  }
322 
323  /* Write out the inner object, if any. */
324  if (h -> inner && h -> inner -> type -> stuff_values) {
325  status = ((*(h -> inner -> type -> stuff_values))
326  (c, id, h -> inner));
327  if (status == ISC_R_SUCCESS)
328  return status;
329  }
330 
331  return ISC_R_SUCCESS;
332 }
333 
335  omapi_object_t *id, omapi_object_t *ref)
336 {
337  omapi_value_t *tv = (omapi_value_t *)0;
338  isc_result_t status;
339  struct group_object *group;
340 
341  if (!ref)
342  return DHCP_R_NOKEYS;
343 
344  /* First see if we were sent a handle. */
345  status = omapi_get_value_str (ref, id, "handle", &tv);
346  if (status == ISC_R_SUCCESS) {
347  status = omapi_handle_td_lookup (lp, tv -> value);
348 
350  if (status != ISC_R_SUCCESS)
351  return status;
352 
353  /* Don't return the object if the type is wrong. */
354  if ((*lp) -> type != dhcp_type_group) {
356  return DHCP_R_INVALIDARG;
357  }
358  }
359 
360  /* Now look for a name. */
361  status = omapi_get_value_str (ref, id, "name", &tv);
362  if (status == ISC_R_SUCCESS) {
363  group = (struct group_object *)0;
364  if (group_name_hash &&
365  group_hash_lookup (&group, group_name_hash,
366  (const char *)
367  tv -> value -> u.buffer.value,
368  tv -> value -> u.buffer.len, MDL)) {
370 
371  if (*lp && *lp != (omapi_object_t *)group) {
372  group_object_dereference (&group, MDL);
374  return DHCP_R_KEYCONFLICT;
375  } else if (!*lp) {
376  /* XXX fix so that hash lookup itself creates
377  XXX the reference. */
380  MDL);
381  group_object_dereference (&group, MDL);
382  }
383  } else if (!*lp)
384  return ISC_R_NOTFOUND;
385  }
386 
387  /* If we get to here without finding a group, no valid key was
388  specified. */
389  if (!*lp)
390  return DHCP_R_NOKEYS;
391 
392  if (((struct group_object *)(*lp)) -> flags & GROUP_OBJECT_DELETED) {
394  return ISC_R_NOTFOUND;
395  }
396  return ISC_R_SUCCESS;
397 }
398 
400  omapi_object_t *id)
401 {
402  struct group_object *group;
403  isc_result_t status;
404  group = (struct group_object *)0;
405 
406  status = group_object_allocate (&group, MDL);
407  if (status != ISC_R_SUCCESS)
408  return status;
410  status = omapi_object_reference (lp, (omapi_object_t *)group, MDL);
411  group_object_dereference (&group, MDL);
412  return status;
413 }
414 
416  omapi_object_t *id)
417 {
418  struct group_object *group;
419  isc_result_t status;
420  if (lp -> type != dhcp_type_group)
421  return DHCP_R_INVALIDARG;
422  group = (struct group_object *)lp;
423 
425  if (group_write_hook) {
426  if (!(*group_write_hook) (group))
427  return ISC_R_IOERROR;
428  }
429 
431 
432  return status;
433 }
434 
436  omapi_object_t *id,
438  omapi_typed_data_t *value)
439 {
440  dhcp_control_object_t *control;
441  isc_result_t status;
442  unsigned long newstate;
443 
444  if (h -> type != dhcp_type_control)
445  return DHCP_R_INVALIDARG;
446  control = (dhcp_control_object_t *)h;
447 
448  if (!omapi_ds_strcmp (name, "state")) {
449  status = omapi_get_int_value (&newstate, value);
450  if (status != ISC_R_SUCCESS)
451  return status;
452  status = dhcp_set_control_state (control -> state, newstate);
453  if (status == ISC_R_SUCCESS)
454  control -> state = value -> u.integer;
455  return status;
456  }
457 
458  /* Try to find some inner object that can take the value. */
459  if (h -> inner && h -> inner -> type -> set_value) {
460  status = ((*(h -> inner -> type -> set_value))
461  (h -> inner, id, name, value));
462  if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
463  return status;
464  }
465 
466  return ISC_R_NOTFOUND;
467 }
468 
469 
472  omapi_value_t **value)
473 {
474  dhcp_control_object_t *control;
475  isc_result_t status;
476 
477  if (h -> type != dhcp_type_control)
478  return DHCP_R_INVALIDARG;
479  control = (dhcp_control_object_t *)h;
480 
481  if (!omapi_ds_strcmp (name, "state"))
482  return omapi_make_int_value (value,
483  name, (int)control -> state, MDL);
484 
485  /* Try to find some inner object that can take the value. */
486  if (h -> inner && h -> inner -> type -> get_value) {
487  status = ((*(h -> inner -> type -> get_value))
488  (h -> inner, id, name, value));
489  if (status == ISC_R_SUCCESS)
490  return status;
491  }
492  return ISC_R_NOTFOUND;
493 }
494 
496  const char *file, int line)
497 {
498  if (h -> type != dhcp_type_control)
499  return DHCP_R_INVALIDARG;
500 
501  /* Can't destroy the control object. */
502  return ISC_R_NOPERM;
503 }
504 
506  const char *name, va_list ap)
507 {
508  /* In this function h should be a (dhcp_control_object_t *) */
509 
510  isc_result_t status;
511 
512  if (h -> type != dhcp_type_control)
513  return DHCP_R_INVALIDARG;
514 
515  /* Try to find some inner object that can take the value. */
516  if (h -> inner && h -> inner -> type -> get_value) {
517  status = ((*(h -> inner -> type -> signal_handler))
518  (h -> inner, name, ap));
519  if (status == ISC_R_SUCCESS)
520  return status;
521  }
522  return ISC_R_NOTFOUND;
523 }
524 
526  omapi_object_t *id,
527  omapi_object_t *h)
528 {
529  dhcp_control_object_t *control;
530  isc_result_t status;
531 
532  if (h -> type != dhcp_type_control)
533  return DHCP_R_INVALIDARG;
534  control = (dhcp_control_object_t *)h;
535 
536  /* Write out all the values. */
537  status = omapi_connection_put_name (c, "state");
538  if (status != ISC_R_SUCCESS)
539  return status;
540  status = omapi_connection_put_uint32 (c, sizeof (u_int32_t));
541  if (status != ISC_R_SUCCESS)
542  return status;
543  status = omapi_connection_put_uint32 (c, control -> state);
544  if (status != ISC_R_SUCCESS)
545  return status;
546 
547  /* Write out the inner object, if any. */
548  if (h -> inner && h -> inner -> type -> stuff_values) {
549  status = ((*(h -> inner -> type -> stuff_values))
550  (c, id, h -> inner));
551  if (status == ISC_R_SUCCESS)
552  return status;
553  }
554 
555  return ISC_R_SUCCESS;
556 }
557 
559  omapi_object_t *id, omapi_object_t *ref)
560 {
561  omapi_value_t *tv = (omapi_value_t *)0;
562  isc_result_t status;
563 
564  /* First see if we were sent a handle. */
565  if (ref) {
566  status = omapi_get_value_str (ref, id, "handle", &tv);
567  if (status == ISC_R_SUCCESS) {
568  status = omapi_handle_td_lookup (lp, tv -> value);
569 
571  if (status != ISC_R_SUCCESS)
572  return status;
573 
574  /* Don't return the object if the type is wrong. */
575  if ((*lp) -> type != dhcp_type_control) {
577  return DHCP_R_INVALIDARG;
578  }
579  }
580  }
581 
582  /* Otherwise, stop playing coy - there's only one control object,
583  so we can just return it. */
584  dhcp_control_reference ((dhcp_control_object_t **)lp,
586  return ISC_R_SUCCESS;
587 }
588 
590  omapi_object_t *id)
591 {
592  /* Can't create a control object - there can be only one. */
593  return ISC_R_NOPERM;
594 }
595 
597  omapi_object_t *id)
598 {
599  /* Form is emptiness; emptiness form. The control object
600  cannot go out of existance. */
601  return ISC_R_NOPERM;
602 }
603 
605  omapi_object_t *id,
607  omapi_typed_data_t *value)
608 {
609  /* In this function h should be a (struct subnet *) */
610 
611  isc_result_t status;
612 
613  if (h -> type != dhcp_type_subnet)
614  return DHCP_R_INVALIDARG;
615 
616  /* No values to set yet. */
617 
618  /* Try to find some inner object that can take the value. */
619  if (h -> inner && h -> inner -> type -> set_value) {
620  status = ((*(h -> inner -> type -> set_value))
621  (h -> inner, id, name, value));
622  if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
623  return status;
624  }
625 
626  return ISC_R_NOTFOUND;
627 }
628 
629 
632  omapi_value_t **value)
633 {
634  /* In this function h should be a (struct subnet *) */
635 
636  isc_result_t status;
637 
638  if (h -> type != dhcp_type_subnet)
639  return DHCP_R_INVALIDARG;
640 
641  /* No values to get yet. */
642 
643  /* Try to find some inner object that can provide the value. */
644  if (h -> inner && h -> inner -> type -> get_value) {
645  status = ((*(h -> inner -> type -> get_value))
646  (h -> inner, id, name, value));
647  if (status == ISC_R_SUCCESS)
648  return status;
649  }
650  return ISC_R_NOTFOUND;
651 }
652 
653 isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line)
654 {
655  struct subnet *subnet;
656 
657  if (h -> type != dhcp_type_subnet)
658  return DHCP_R_INVALIDARG;
659 
660  subnet = (struct subnet *)h;
661  if (subnet -> next_subnet)
662  subnet_dereference (&subnet -> next_subnet, file, line);
663  if (subnet -> next_sibling)
664  subnet_dereference (&subnet -> next_sibling, file, line);
665  if (subnet -> shared_network)
666  shared_network_dereference (&subnet -> shared_network,
667  file, line);
668  if (subnet -> interface)
669  interface_dereference (&subnet -> interface, file, line);
670  if (subnet -> group)
672 
673  return ISC_R_SUCCESS;
674 }
675 
677  const char *name, va_list ap)
678 {
679  /* In this function h should be a (struct subnet *) */
680 
681  isc_result_t status;
682 
683  if (h -> type != dhcp_type_subnet)
684  return DHCP_R_INVALIDARG;
685 
686  /* Can't write subnets yet. */
687 
688  /* Try to find some inner object that can take the value. */
689  if (h -> inner && h -> inner -> type -> get_value) {
690  status = ((*(h -> inner -> type -> signal_handler))
691  (h -> inner, name, ap));
692  if (status == ISC_R_SUCCESS)
693  return status;
694  }
695 
696  return ISC_R_NOTFOUND;
697 }
698 
700  omapi_object_t *id,
701  omapi_object_t *h)
702 {
703  /* In this function h should be a (struct subnet *) */
704 
705  isc_result_t status;
706 
707  if (h -> type != dhcp_type_subnet)
708  return DHCP_R_INVALIDARG;
709 
710  /* Can't stuff subnet values yet. */
711 
712  /* Write out the inner object, if any. */
713  if (h -> inner && h -> inner -> type -> stuff_values) {
714  status = ((*(h -> inner -> type -> stuff_values))
715  (c, id, h -> inner));
716  if (status == ISC_R_SUCCESS)
717  return status;
718  }
719 
720  return ISC_R_SUCCESS;
721 }
722 
724  omapi_object_t *id,
725  omapi_object_t *ref)
726 {
727  /* Can't look up subnets yet. */
728 
729  /* If we get to here without finding a subnet, no valid key was
730  specified. */
731  if (!*lp)
732  return DHCP_R_NOKEYS;
733  return ISC_R_SUCCESS;
734 }
735 
737  omapi_object_t *id)
738 {
739  return ISC_R_NOTIMPLEMENTED;
740 }
741 
743  omapi_object_t *id)
744 {
745  return ISC_R_NOTIMPLEMENTED;
746 }
747 
749  omapi_object_t *id,
750  omapi_data_string_t *name,
751  omapi_typed_data_t *value)
752 {
753  /* In this function h should be a (struct shared_network *) */
754 
755  isc_result_t status;
756 
757  if (h -> type != dhcp_type_shared_network)
758  return DHCP_R_INVALIDARG;
759 
760  /* No values to set yet. */
761 
762  /* Try to find some inner object that can take the value. */
763  if (h -> inner && h -> inner -> type -> set_value) {
764  status = ((*(h -> inner -> type -> set_value))
765  (h -> inner, id, name, value));
766  if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
767  return status;
768  }
769 
770  return ISC_R_NOTFOUND;
771 }
772 
773 
775  omapi_object_t *id,
776  omapi_data_string_t *name,
777  omapi_value_t **value)
778 {
779  /* In this function h should be a (struct shared_network *) */
780 
781  isc_result_t status;
782 
783  if (h -> type != dhcp_type_shared_network)
784  return DHCP_R_INVALIDARG;
785 
786  /* No values to get yet. */
787 
788  /* Try to find some inner object that can provide the value. */
789  if (h -> inner && h -> inner -> type -> get_value) {
790  status = ((*(h -> inner -> type -> get_value))
791  (h -> inner, id, name, value));
792  if (status == ISC_R_SUCCESS)
793  return status;
794  }
795  return ISC_R_NOTFOUND;
796 }
797 
799  const char *file, int line)
800 {
801  /* In this function h should be a (struct shared_network *) */
802 
804 
805  if (h -> type != dhcp_type_shared_network)
806  return DHCP_R_INVALIDARG;
807 
808  shared_network = (struct shared_network *)h;
809  if (shared_network -> next)
810  shared_network_dereference (&shared_network -> next,
811  file, line);
812  if (shared_network -> name) {
814  shared_network -> name = 0;
815  }
816  if (shared_network -> subnets)
817  subnet_dereference (&shared_network -> subnets, file, line);
818  if (shared_network -> interface)
819  interface_dereference (&shared_network -> interface,
820  file, line);
821  if (shared_network -> pools)
823  &shared_network -> pools, file, line);
824  if (shared_network -> group)
826 #if defined (FAILOVER_PROTOCOL)
830  file, line);
831 #endif
832 
833  return ISC_R_SUCCESS;
834 }
835 
837  const char *name,
838  va_list ap)
839 {
840  /* In this function h should be a (struct shared_network *) */
841 
842  isc_result_t status;
843 
844  if (h -> type != dhcp_type_shared_network)
845  return DHCP_R_INVALIDARG;
846 
847  /* Can't write shared_networks yet. */
848 
849  /* Try to find some inner object that can take the value. */
850  if (h -> inner && h -> inner -> type -> get_value) {
851  status = ((*(h -> inner -> type -> signal_handler))
852  (h -> inner, name, ap));
853  if (status == ISC_R_SUCCESS)
854  return status;
855  }
856 
857  return ISC_R_NOTFOUND;
858 }
859 
861  omapi_object_t *id,
862  omapi_object_t *h)
863 {
864  /* In this function h should be a (struct shared_network *) */
865 
866  isc_result_t status;
867 
868  if (h -> type != dhcp_type_shared_network)
869  return DHCP_R_INVALIDARG;
870 
871  /* Can't stuff shared_network values yet. */
872 
873  /* Write out the inner object, if any. */
874  if (h -> inner && h -> inner -> type -> stuff_values) {
875  status = ((*(h -> inner -> type -> stuff_values))
876  (c, id, h -> inner));
877  if (status == ISC_R_SUCCESS)
878  return status;
879  }
880 
881  return ISC_R_SUCCESS;
882 }
883 
885  omapi_object_t *id,
886  omapi_object_t *ref)
887 {
888  /* Can't look up shared_networks yet. */
889 
890  /* If we get to here without finding a shared_network, no valid key was
891  specified. */
892  if (!*lp)
893  return DHCP_R_NOKEYS;
894  return ISC_R_SUCCESS;
895 }
896 
898  omapi_object_t *id)
899 {
900  return ISC_R_NOTIMPLEMENTED;
901 }
902 
904  omapi_object_t *id)
905 {
906  return ISC_R_NOTIMPLEMENTED;
907 }
908 
#define GROUP_OBJECT_DYNAMIC
Definition: dhcpd.h:927
const char int line
Definition: dhcpd.h:3728
omapi_object_type_t * dhcp_type_shared_network
isc_result_t dhcp_control_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:596
isc_result_t omapi_make_int_value(omapi_value_t **, omapi_data_string_t *, int, const char *, int)
Definition: support.c:710
isc_result_t omapi_object_reference(omapi_object_t **, omapi_object_t *, const char *, int)
Definition: alloc.c:571
isc_result_t end_parse(struct parse **cfile)
Definition: conflex.c:103
Definition: dhcpd.h:1045
isc_result_t dhcp_control_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
Definition: comapi.c:435
isc_result_t dhcp_control_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:558
#define MDL
Definition: omapip.h:568
#define DHCP_R_INVALIDARG
Definition: result.h:49
omapi_typed_data_t * value
Definition: omapip.h:91
struct group * root_group
Definition: memory.c:31
dhcp_failover_state_t * failover_peer
Definition: dhcpd.h:1041
struct subnet * subnets
Definition: mdb.c:32
isc_result_t dhcp_shared_network_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
Definition: comapi.c:748
#define DHCP_R_KEYCONFLICT
Definition: result.h:53
Definition: dhcpd.h:288
void log_fatal(const char *,...) __attribute__((__format__(__printf__
#define DHCP_R_BADPARSE
Definition: result.h:54
struct omapi_typed_data_t::@3::@4 buffer
isc_result_t dhcp_group_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:399
isc_result_t dhcp_group_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:334
isc_result_t dhcp_group_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:227
isc_result_t dhcp_group_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:415
isc_result_t omapi_connection_put_uint32(omapi_object_t *, u_int32_t)
Definition: buffer.c:596
isc_result_t dhcp_control_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:589
isc_result_t dhcp_group_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:257
isc_result_t omapi_get_value_str(omapi_object_t *, omapi_object_t *, const char *, omapi_value_t **)
Definition: support.c:483
isc_result_t dhcp_group_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
Definition: comapi.c:128
omapi_object_type_t * dhcp_type_control
int group_dereference(struct group **ptr, const char *file, int line)
Definition: alloc.c:205
isc_result_t dhcp_subnet_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:736
int(* group_write_hook)(struct group_object *)
Definition: memory.c:33
isc_result_t omapi_object_dereference(omapi_object_t **, const char *, int)
Definition: alloc.c:593
isc_result_t dhcp_subnet_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
Definition: comapi.c:604
#define cur_time
Definition: dhcpd.h:2079
isc_result_t dhcp_subnet_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:676
isc_result_t omapi_get_int_value(unsigned long *, omapi_typed_data_t *)
Definition: support.c:836
void dfree(void *, const char *, int)
Definition: alloc.c:145
union omapi_typed_data_t::@3 u
isc_result_t dhcp_control_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:495
isc_result_t dhcp_control_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:525
omapi_object_type_t * dhcp_type_interface
Definition: discover.c:71
isc_result_t omapi_handle_td_lookup(omapi_object_t **, omapi_typed_data_t *)
Definition: handle.c:283
isc_result_t dhcp_group_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:302
isc_result_t dhcp_shared_network_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:798
isc_result_t dhcp_control_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
Definition: comapi.c:470
#define GROUP_OBJECT_DELETED
Definition: dhcpd.h:926
void * dmalloc(size_t, const char *, int)
Definition: alloc.c:57
isc_result_t dhcp_shared_network_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
Definition: comapi.c:774
isc_result_t dhcp_subnet_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
Definition: comapi.c:630
isc_result_t omapi_connection_put_string(omapi_object_t *, const char *)
Definition: buffer.c:690
struct subnet * next_subnet
Definition: dhcpd.h:1047
char * name
Definition: dhcpd.h:924
omapi_object_type_t * dhcp_type_group
dhcp_control_object_t * dhcp_control_object
isc_result_t dhcp_subnet_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:653
isc_result_t omapi_value_dereference(omapi_value_t **, const char *, int)
Definition: alloc.c:1060
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)
Definition: support.c:194
isc_result_t dhcp_shared_network_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:903
isc_result_t dhcp_subnet_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:699
#define DHCP_R_NOKEYS
Definition: result.h:55
isc_result_t dhcp_subnet_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:742
Definition: dhcpd.h:932
#define DHCP_R_UNCHANGED
Definition: result.h:51
isc_result_t dhcp_subnet_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:723
int omapi_ds_strcmp(omapi_data_string_t *, const char *)
Definition: support.c:582
isc_result_t supersede_group(struct group_object *group, int writep)
Definition: memory.c:74
struct subnet * next_sibling
Definition: dhcpd.h:1048
isc_result_t dhcp_shared_network_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:836
struct interface_info * interface
Definition: dhcpd.h:1036
int flags
Definition: dhcpd.h:925
isc_result_t interface_setup()
Definition: discover.c:83
isc_result_t dhcp_group_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
Definition: comapi.c:202
group_hash_t * group_name_hash
Definition: memory.c:32
isc_result_t dhcp_shared_network_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:897
isc_result_t dhcp_shared_network_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:860
struct ipv6_pool ** pools
struct shared_network * next
Definition: dhcpd.h:1029
const char * file
Definition: dhcpd.h:3728
char * name
Definition: dhcpd.h:1030
isc_result_t omapi_connection_put_name(omapi_object_t *, const char *)
Definition: buffer.c:679
isc_result_t dhcp_set_control_state(control_object_state_t oldstate, control_object_state_t newstate)
Definition: dhclient.c:5220
int parse_executable_statements(struct executable_statement **statements, struct parse *cfile, int *lose, enum expression_context case_context)
Definition: parse.c:2114
void dhcp_common_objects_setup(void)
isc_result_t dhcp_shared_network_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:884
struct group * group
Definition: dhcpd.h:923
#define RC_MISC
Definition: alloc.h:56
int clone_group(struct group **gp, struct group *group, const char *file, int line)
Definition: memory.c:130
OMAPI_OBJECT_ALLOC(shared_network, struct shared_network, omapi_object_type_t *dhcp_type_shared_network)
Definition: comapi.c:40
struct interface_info * interface
Definition: dhcpd.h:1050
isc_result_t new_parse(struct parse **cfile, int file, char *inbuf, unsigned buflen, const char *name, int eolp)
Definition: conflex.c:41
omapi_object_type_t * dhcp_type_subnet
isc_result_t dhcp_control_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:505
isc_result_t omapi_make_string_value(omapi_value_t **, omapi_data_string_t *, const char *, const char *, int)
Definition: support.c:808