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