ISC DHCP  4.3.5
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 
group_object::name
char * name
Definition: dhcpd.h:923
dhcp_shared_network_set_value
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
subnet::next_sibling
struct subnet * next_sibling
Definition: dhcpd.h:1047
dhcp_shared_network_signal_handler
isc_result_t dhcp_shared_network_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:836
dhcp_group_create
isc_result_t dhcp_group_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:399
omapi_object_reference
isc_result_t omapi_object_reference(omapi_object_t **, omapi_object_t *, const char *, int)
Definition: alloc.c:557
omapip_p.h
dhcp_group_set_value
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
dhcp_set_control_state
isc_result_t dhcp_set_control_state(control_object_state_t oldstate, control_object_state_t newstate)
Definition: dhclient.c:5145
log_fatal
void log_fatal(const char *,...) __attribute__((__format__(__printf__
dhcp_type_interface
omapi_object_type_t * dhcp_type_interface
Definition: discover.c:71
cur_time
#define cur_time
Definition: dhcpd.h:2076
line
const char int line
Definition: dhcpd.h:3723
__omapi_object_type_t
Definition: omapip.h:94
dhcp_group_destroy
isc_result_t dhcp_group_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:227
dhcp_group_remove
isc_result_t dhcp_group_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:415
dhcpd.h
omapi_data_string_t
Definition: omapip.h:81
dhcp_group_lookup
isc_result_t dhcp_group_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:334
dhcp_group_signal_handler
isc_result_t dhcp_group_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:257
omapi_connection_put_name
isc_result_t omapi_connection_put_name(omapi_object_t *, const char *)
Definition: buffer.c:670
context_any
@ context_any
Definition: tree.h:85
end_parse
isc_result_t end_parse(struct parse **cfile)
Definition: conflex.c:103
dhcp_type_subnet
omapi_object_type_t * dhcp_type_subnet
dhcp_shared_network_lookup
isc_result_t dhcp_shared_network_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:884
dhcp_shared_network_create
isc_result_t dhcp_shared_network_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:897
omapi_typed_data_t::integer
int integer
Definition: omapip.h:77
dhcp_shared_network_stuff_values
isc_result_t dhcp_shared_network_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:860
omapi_make_int_value
isc_result_t omapi_make_int_value(omapi_value_t **, omapi_data_string_t *, int, const char *, int)
Definition: support.c:710
OMAPI_OBJECT_ALLOC
OMAPI_OBJECT_ALLOC(shared_network, struct shared_network, omapi_object_type_t *dhcp_type_shared_network)
Definition: comapi.c:40
dhcp_control_get_value
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
dhcp_control_object_t
Definition: dhcpd.h:527
dhcp_shared_network_get_value
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
dhcp_subnet_set_value
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
dhcp_subnet_signal_handler
isc_result_t dhcp_subnet_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:676
RC_MISC
#define RC_MISC
Definition: alloc.h:56
dhcp_control_object
dhcp_control_object_t * dhcp_control_object
shared_network
Definition: dhcpd.h:1026
omapi_typed_data_t::buffer
struct omapi_typed_data_t::@3::@4 buffer
DHCP_R_NOKEYS
#define DHCP_R_NOKEYS
Definition: result.h:54
dhcp_subnet_stuff_values
isc_result_t dhcp_subnet_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:699
dhcp_control_remove
isc_result_t dhcp_control_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:596
group_name_hash
group_hash_t * group_name_hash
Definition: memory.c:32
omapi_make_string_value
isc_result_t omapi_make_string_value(omapi_value_t **, omapi_data_string_t *, const char *, const char *, int)
Definition: support.c:808
dhcp_type_shared_network
omapi_object_type_t * dhcp_type_shared_network
root_group
struct group * root_group
Definition: memory.c:31
parse
Definition: dhcpd.h:288
dhcp_subnet_destroy
isc_result_t dhcp_subnet_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:653
subnet::next_subnet
struct subnet * next_subnet
Definition: dhcpd.h:1046
DHCP_R_BADPARSE
#define DHCP_R_BADPARSE
Definition: result.h:53
shared_network::failover_peer
dhcp_failover_state_t * failover_peer
Definition: dhcpd.h:1040
group
Definition: dhcpd.h:931
dhcp_group_get_value
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_write_hook
int(* group_write_hook)(struct group_object *)
Definition: memory.c:33
omapi_object_dereference
isc_result_t omapi_object_dereference(omapi_object_t **, const char *, int)
Definition: alloc.c:579
dhcp_subnet_lookup
isc_result_t dhcp_subnet_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:723
GROUP_OBJECT_DYNAMIC
#define GROUP_OBJECT_DYNAMIC
Definition: dhcpd.h:926
dfree
void dfree(void *, const char *, int)
Definition: alloc.c:131
MDL
#define MDL
Definition: omapip.h:568
pools
struct ipv6_pool ** pools
group_object::group
struct group * group
Definition: dhcpd.h:922
group_dereference
int group_dereference(struct group **ptr, const char *file, int line)
Definition: alloc.c:205
GROUP_OBJECT_DELETED
#define GROUP_OBJECT_DELETED
Definition: dhcpd.h:925
parse_executable_statements
int parse_executable_statements(struct executable_statement **statements, struct parse *cfile, int *lose, enum expression_context case_context)
Definition: parse.c:2113
omapi_ds_strcmp
int omapi_ds_strcmp(omapi_data_string_t *, const char *)
Definition: support.c:582
omapi_value_dereference
isc_result_t omapi_value_dereference(omapi_value_t **, const char *, int)
Definition: alloc.c:1046
omapi_object_type_register
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
group_object::flags
int flags
Definition: dhcpd.h:924
file
const char * file
Definition: dhcpd.h:3723
omapi_datatype_string
@ omapi_datatype_string
Definition: omapip.h:44
shared_network::interface
struct interface_info * interface
Definition: dhcpd.h:1035
dhcp_control_signal_handler
isc_result_t dhcp_control_signal_handler(omapi_object_t *h, const char *name, va_list ap)
Definition: comapi.c:505
omapi_datatype_data
@ omapi_datatype_data
Definition: omapip.h:45
DHCP_R_UNCHANGED
#define DHCP_R_UNCHANGED
Definition: result.h:50
dhcp_control_create
isc_result_t dhcp_control_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:589
omapi_connection_put_string
isc_result_t omapi_connection_put_string(omapi_object_t *, const char *)
Definition: buffer.c:681
omapi_typed_data_t
Definition: omapip.h:49
omapi_get_int_value
isc_result_t omapi_get_int_value(unsigned long *, omapi_typed_data_t *)
Definition: support.c:836
shared_network::next
struct shared_network * next
Definition: dhcpd.h:1028
omapi_connection_put_uint32
isc_result_t omapi_connection_put_uint32(omapi_object_t *, u_int32_t)
Definition: buffer.c:587
subnets
struct subnet * subnets
Definition: mdb.c:32
__omapi_object
Definition: omapip.h:128
dmalloc
void * dmalloc(size_t, const char *, int)
Definition: alloc.c:56
subnet
Definition: dhcpd.h:1044
supersede_group
isc_result_t supersede_group(struct group_object *group, int writep)
Definition: memory.c:74
clone_group
int clone_group(struct group **gp, struct group *group, const char *file, int line)
Definition: memory.c:130
dhcp_control_set_value
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
new_parse
isc_result_t new_parse(struct parse **cfile, int file, char *inbuf, unsigned buflen, const char *name, int eolp)
Definition: conflex.c:41
dhcp_type_control
omapi_object_type_t * dhcp_type_control
dhcp_subnet_create
isc_result_t dhcp_subnet_create(omapi_object_t **lp, omapi_object_t *id)
Definition: comapi.c:736
omapi_get_value_str
isc_result_t omapi_get_value_str(omapi_object_t *, omapi_object_t *, const char *, omapi_value_t **)
Definition: support.c:483
omapi_typed_data_t::u
union omapi_typed_data_t::@3 u
dhcp_control_lookup
isc_result_t dhcp_control_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
Definition: comapi.c:558
dhcp_control_destroy
isc_result_t dhcp_control_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:495
omapi_handle_td_lookup
isc_result_t omapi_handle_td_lookup(omapi_object_t **, omapi_typed_data_t *)
Definition: handle.c:283
DHCP_R_INVALIDARG
#define DHCP_R_INVALIDARG
Definition: result.h:48
dhcp_control_stuff_values
isc_result_t dhcp_control_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:525
dhcp_group_stuff_values
isc_result_t dhcp_group_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
Definition: comapi.c:302
dhcp_shared_network_remove
isc_result_t dhcp_shared_network_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:903
dhcp_shared_network_destroy
isc_result_t dhcp_shared_network_destroy(omapi_object_t *h, const char *file, int line)
Definition: comapi.c:798
server_startup
@ server_startup
Definition: dhcpd.h:520
dhcp_common_objects_setup
void dhcp_common_objects_setup(void)
shared_network::name
char * name
Definition: dhcpd.h:1029
omapi_value_t
Definition: omapip.h:88
subnet::interface
struct interface_info * interface
Definition: dhcpd.h:1049
dhcp_subnet_remove
isc_result_t dhcp_subnet_remove(omapi_object_t *lp, omapi_object_t *id)
Definition: comapi.c:742
interface_setup
isc_result_t interface_setup()
Definition: discover.c:83
DHCP_R_KEYCONFLICT
#define DHCP_R_KEYCONFLICT
Definition: result.h:52
group_object
Definition: dhcpd.h:918
dhcp_subnet_get_value
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
dhcp_type_group
omapi_object_type_t * dhcp_type_group
omapi_value_t::value
omapi_typed_data_t * value
Definition: omapip.h:91