49 #if defined (FAILOVER_PROTOCOL)
76 sizeof (
struct lease),
78 if (status != ISC_R_SUCCESS)
79 log_fatal (
"Can't register lease object type: %s",
80 isc_result_totext (status));
92 sizeof (
struct class), 0,
94 if (status != ISC_R_SUCCESS)
95 log_fatal (
"Can't register class object type: %s",
96 isc_result_totext (status));
108 sizeof (
struct class), 0,
RC_MISC);
109 if (status != ISC_R_SUCCESS)
110 log_fatal (
"Can't register subclass object type: %s",
111 isc_result_totext (status));
125 if (status != ISC_R_SUCCESS)
126 log_fatal (
"Can't register pool object type: %s",
127 isc_result_totext (status));
142 if (status != ISC_R_SUCCESS)
143 log_fatal (
"Can't register host object type: %s",
144 isc_result_totext (status));
146 #if defined (FAILOVER_PROTOCOL)
158 sizeof (dhcp_failover_state_t),
161 if (status != ISC_R_SUCCESS)
162 log_fatal (
"Can't register failover state object type: %s",
163 isc_result_totext (status));
173 sizeof (dhcp_failover_link_t), 0,
176 if (status != ISC_R_SUCCESS)
177 log_fatal (
"Can't register failover link object type: %s",
178 isc_result_totext (status));
192 if (status != ISC_R_SUCCESS)
193 log_fatal (
"Can't register failover listener object type: %s",
194 isc_result_totext (status));
206 if (h -> type != dhcp_type_lease)
208 lease = (
struct lease *)h;
214 const char *ols, *nls;
216 if (status != ISC_R_SUCCESS)
226 ols =
"unknown state";
231 log_info (
"lease %s state changed from %s to %s",
233 return ISC_R_SUCCESS;
235 log_info (
"lease %s state change from %s to %s failed.",
237 return ISC_R_IOERROR;
257 unsigned long lease_end, old_lease_end;
259 if (status != ISC_R_SUCCESS)
261 old_lease_end = lease->
ends;
262 lease->
ends = lease_end;
264 log_info (
"lease %s end changed from %lu to %lu",
266 return ISC_R_SUCCESS;
268 log_info (
"lease %s end change from %lu to %lu failed",
270 return ISC_R_IOERROR;
277 oldflags = lease->
flags;
280 if(oldflags == lease->
flags)
281 return ISC_R_SUCCESS;
283 log_error(
"Failed to update flags for lease %s.",
285 return ISC_R_IOERROR;
287 return ISC_R_SUCCESS;
294 }
else if (lease ->
scope) {
296 if (status == ISC_R_SUCCESS) {
298 return ISC_R_SUCCESS;
299 return ISC_R_IOERROR;
304 if (h -> inner && h -> inner -> type -> set_value) {
305 status = ((*(h -> inner -> type -> set_value))
306 (h -> inner, id, name, value));
311 if (!lease ->
scope) {
313 return ISC_R_NOMEMORY;
316 if (status != ISC_R_SUCCESS)
320 return ISC_R_SUCCESS;
321 return ISC_R_IOERROR;
332 if (h -> type != dhcp_type_lease)
334 lease = (
struct lease *)h;
351 return ISC_R_NOTFOUND;
371 return ISC_R_NOTFOUND;
378 return ISC_R_NOTFOUND;
384 return ISC_R_NOTFOUND;
385 }
else if (lease ->
scope) {
387 if (status != ISC_R_NOTFOUND)
392 if (h -> inner && h -> inner -> type -> get_value) {
393 status = ((*(h -> inner -> type -> get_value))
394 (h -> inner, id, name, value));
395 if (status == ISC_R_SUCCESS)
405 if (h->type != dhcp_type_lease)
407 lease = (
struct lease *)h;
440 host_dereference (&lease->
host, file, line);
442 subnet_dereference (&lease->
subnet, file, line);
444 pool_dereference (&lease->
pool, file, line);
458 #if defined (DEBUG_MEMORY_LEAKAGE) || \
459 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
468 lease_dereference (&lease->
n_hw, file, line);
470 lease_dereference (&lease->
n_uid, file, line);
475 return ISC_R_SUCCESS;
479 const char *name, va_list ap)
484 if (h -> type != dhcp_type_lease)
487 if (!strcmp (name,
"updated"))
488 return ISC_R_SUCCESS;
491 if (h -> inner && h -> inner -> type -> signal_handler) {
492 status = ((*(h -> inner -> type -> signal_handler))
493 (h -> inner, name, ap));
494 if (status == ISC_R_SUCCESS)
497 return ISC_R_NOTFOUND;
509 if (h -> type != dhcp_type_lease)
511 lease = (
struct lease *)h;
517 if (status != ISC_R_SUCCESS)
521 if (status != ISC_R_SUCCESS)
524 if (status != ISC_R_SUCCESS)
528 if (status != ISC_R_SUCCESS)
533 "dhcp-client-identifier");
534 if (status != ISC_R_SUCCESS)
537 if (status != ISC_R_SUCCESS)
542 if (status != ISC_R_SUCCESS)
549 if (status != ISC_R_SUCCESS)
554 if (status != ISC_R_SUCCESS)
560 if (status != ISC_R_SUCCESS)
565 if (status != ISC_R_SUCCESS)
570 if (status != ISC_R_SUCCESS)
574 if (status != ISC_R_SUCCESS)
578 if (status != ISC_R_SUCCESS)
582 if (status != ISC_R_SUCCESS)
587 if (status != ISC_R_SUCCESS)
591 if (status != ISC_R_SUCCESS)
597 if (status != ISC_R_SUCCESS)
602 if (status != ISC_R_SUCCESS)
608 if (status != ISC_R_SUCCESS)
613 if (status != ISC_R_SUCCESS)
627 bouncer = (u_int32_t)lease->
ends;
629 if (status != ISC_R_SUCCESS)
632 bouncer = (u_int32_t)lease->
starts;
634 if (status != ISC_R_SUCCESS)
637 bouncer = (u_int32_t)lease->
tstp;
639 if (status != ISC_R_SUCCESS)
642 bouncer = (u_int32_t)lease->
tsfp;
644 if (status != ISC_R_SUCCESS)
647 bouncer = (u_int32_t)lease->
atsfp;
649 if (status != ISC_R_SUCCESS)
652 bouncer = (u_int32_t)lease->
cltt;
654 if (status != ISC_R_SUCCESS)
658 if (status != ISC_R_SUCCESS)
661 if (status != ISC_R_SUCCESS)
665 if (status != ISC_R_SUCCESS)
668 if (lease ->
scope) {
670 if (status != ISC_R_SUCCESS)
675 if (h -> inner && h -> inner -> type -> stuff_values) {
676 status = ((*(h -> inner -> type -> stuff_values))
677 (c, id, h -> inner));
678 if (status == ISC_R_SUCCESS)
682 return ISC_R_SUCCESS;
697 if (status == ISC_R_SUCCESS) {
701 if (status != ISC_R_SUCCESS)
705 if ((*lp) -> type != dhcp_type_lease) {
713 if (status == ISC_R_SUCCESS) {
714 lease = (
struct lease *)0;
725 lease_dereference (&lease,
MDL);
730 return ISC_R_NOTFOUND;
736 lease_dereference (&lease,
MDL);
742 if (status == ISC_R_SUCCESS) {
743 lease = (
struct lease *)0;
751 lease_dereference (&lease,
MDL);
756 return ISC_R_NOTFOUND;
757 }
else if (lease ->
n_uid) {
766 lease_dereference (&lease,
MDL);
772 if (status == ISC_R_SUCCESS) {
773 unsigned char *haddr;
776 len = tv -> value -> u.buffer.len + 1;
780 return ISC_R_NOMEMORY;
783 memcpy (haddr + 1, tv -> value -> u.buffer.
value, len - 1);
787 if (status == ISC_R_SUCCESS) {
789 if ((tv -> value -> u.buffer.len != 4) ||
790 (tv -> value -> u.buffer.
value[0] != 0) ||
791 (tv -> value -> u.buffer.
value[1] != 0) ||
792 (tv -> value -> u.buffer.
value[2] != 0)) {
798 haddr[0] = tv -> value -> u.buffer.
value[3];
800 haddr[0] = (
unsigned char)
801 tv -> value -> u.integer;
817 lease = (
struct lease *)0;
824 lease_dereference (&lease,
MDL);
829 return ISC_R_NOTFOUND;
830 }
else if (lease ->
n_hw) {
833 lease_dereference (&lease,
MDL);
840 lease_dereference (&lease,
MDL);
848 return ISC_R_SUCCESS;
854 return ISC_R_NOTIMPLEMENTED;
860 return ISC_R_NOTIMPLEMENTED;
871 if (h -> type != dhcp_type_host)
885 return ISC_R_NOMEMORY;
886 memcpy (host -> name,
889 host -> name [value -> u.
buffer.len] = 0;
892 return ISC_R_SUCCESS;
901 (
char *)value -> u.
buffer.value,
904 return ISC_R_NOTFOUND;
908 if (host -> named_group)
909 group_object_dereference (&host -> named_group,
911 group_object_reference (&host -> named_group,
913 group_object_dereference (&group,
MDL);
916 return ISC_R_SUCCESS;
920 if (host -> interface.hlen)
924 if (value -> u.
buffer.len >
925 (
sizeof host -> interface.hbuf) - 1)
927 memcpy (&host -> interface.hbuf [1],
930 host -> interface.hlen = value -> u.
buffer.len + 1;
933 return ISC_R_SUCCESS;
938 if ((value != NULL) &&
940 (value->
u.
buffer.len ==
sizeof(type)))) {
941 if (value->
u.
buffer.len >
sizeof(type))
943 memcpy(&type, value->
u.
buffer.value,
946 }
else if ((value != NULL) &&
952 return (ISC_R_SUCCESS);
956 if (host -> client_identifier.data)
962 return ISC_R_NOMEMORY;
963 host -> client_identifier.data =
964 &host -> client_identifier.buffer -> data [0];
965 memcpy (host -> client_identifier.buffer -> data,
968 host -> client_identifier.len = value -> u.
buffer.len;
971 return ISC_R_SUCCESS;
975 if (host -> fixed_addr)
978 return ISC_R_SUCCESS;
982 memset (&ds, 0,
sizeof ds);
985 return ISC_R_NOMEMORY;
993 return ISC_R_NOMEMORY;
998 return ISC_R_SUCCESS;
1002 if (!host ->
group) {
1004 return ISC_R_NOMEMORY;
1006 if (host ->
group -> statements &&
1007 (!host -> named_group ||
1008 host ->
group != host -> named_group ->
group) &&
1010 return ISC_R_EXISTS;
1012 return ISC_R_NOMEMORY;
1015 return ISC_R_NOMEMORY;
1020 parse = (
struct parse *)0;
1022 (
char *) value->
u.
buffer.value,
1024 "network client", 0);
1025 if (status != ISC_R_SUCCESS || parse == NULL)
1029 (&host ->
group -> statements, parse, &lose,
1037 return ISC_R_SUCCESS;
1043 return ISC_R_SUCCESS;
1047 if (h -> inner && h -> inner -> type -> set_value) {
1048 status = ((*(h -> inner -> type -> set_value))
1049 (h -> inner, id, name, value));
1063 isc_result_t status;
1066 if (h -> type != dhcp_type_host)
1071 memset (&ip_addrs, 0,
sizeof ip_addrs);
1086 return ISC_R_NOTFOUND;
1091 return ISC_R_NOTFOUND;
1104 return ISC_R_NOTFOUND;
1112 return ISC_R_NOTFOUND;
1118 if (h -> inner && h -> inner -> type -> get_value) {
1119 status = ((*(h -> inner -> type -> get_value))
1120 (h -> inner, id,
name, value));
1121 if (status == ISC_R_SUCCESS)
1130 if (h -> type != dhcp_type_host)
1135 host_dereference (&host ->
n_ipaddr, file, line);
1137 host_dereference (&host ->
n_dynamic, file, line);
1140 host ->
name = (
char *)0;
1152 return ISC_R_SUCCESS;
1156 const char *
name, va_list ap)
1159 isc_result_t status;
1162 if (h -> type != dhcp_type_host)
1166 if (!strcmp (name,
"updated")) {
1172 if (!host -> name) {
1174 sprintf (hnbuf,
"nh%08lx%08lx",
1175 (
unsigned long)
cur_time, (
unsigned long)host);
1176 host -> name =
dmalloc (strlen (hnbuf) + 1,
MDL);
1178 return ISC_R_NOMEMORY;
1179 strcpy (host -> name, hnbuf);
1183 log_debug (
"OMAPI added host %s", host -> name);
1186 if (status != ISC_R_SUCCESS)
1192 if (h -> inner && h -> inner -> type -> signal_handler) {
1193 status = ((*(h -> inner -> type -> signal_handler))
1194 (h -> inner,
name, ap));
1195 if (status == ISC_R_SUCCESS)
1199 return ISC_R_SUCCESS;
1200 return ISC_R_NOTFOUND;
1208 isc_result_t status;
1211 if (h -> type != dhcp_type_host)
1217 memset (&ip_addrs, 0,
sizeof ip_addrs);
1227 if (status != ISC_R_SUCCESS)
1230 if (status != ISC_R_SUCCESS)
1234 if (status != ISC_R_SUCCESS)
1241 "dhcp-client-identifier");
1242 if (status != ISC_R_SUCCESS)
1246 if (status != ISC_R_SUCCESS)
1252 if (status != ISC_R_SUCCESS)
1258 if (status != ISC_R_SUCCESS)
1261 if (status != ISC_R_SUCCESS)
1267 if (status != ISC_R_SUCCESS)
1271 if (status != ISC_R_SUCCESS)
1276 if (status != ISC_R_SUCCESS)
1281 if (status != ISC_R_SUCCESS)
1286 if (h -> inner && h -> inner -> type -> stuff_values) {
1287 status = ((*(h -> inner -> type -> stuff_values))
1288 (c, id, h -> inner));
1289 if (status == ISC_R_SUCCESS)
1293 return ISC_R_SUCCESS;
1300 isc_result_t status;
1308 if (status == ISC_R_SUCCESS) {
1312 if (status != ISC_R_SUCCESS)
1316 if ((*lp) -> type != dhcp_type_host) {
1327 if (status == ISC_R_SUCCESS) {
1330 tv -> value -> u.buffer.
value,
1331 tv -> value -> u.buffer.len,
MDL);
1337 host_dereference (&host,
MDL);
1343 host_dereference (&host,
MDL);
1344 return ISC_R_NOTFOUND;
1350 host_dereference (&host,
MDL);
1356 if (status == ISC_R_SUCCESS) {
1357 unsigned char *haddr;
1360 len = tv -> value -> u.buffer.len + 1;
1364 return ISC_R_NOMEMORY;
1367 memcpy (haddr + 1, tv -> value -> u.buffer.
value, len - 1);
1371 if (status == ISC_R_SUCCESS) {
1373 if ((tv -> value -> u.buffer.len != 4) ||
1374 (tv -> value -> u.buffer.
value[0] != 0) ||
1375 (tv -> value -> u.buffer.
value[1] != 0) ||
1376 (tv -> value -> u.buffer.
value[2] != 0)) {
1382 haddr[0] = tv -> value -> u.buffer.
value[3];
1384 haddr[0] = (
unsigned char)
1385 tv -> value -> u.integer;
1408 host_dereference (&host,
MDL);
1414 host_dereference (&host,
MDL);
1415 return ISC_R_NOTFOUND;
1421 host_dereference (&host,
MDL);
1427 if (status == ISC_R_SUCCESS) {
1431 l = (
struct lease *)0;
1438 return ISC_R_NOTFOUND;
1444 l -> hardware_addr.hbuf,
1445 l -> hardware_addr.hlen,
MDL);
1450 host_dereference (&host,
MDL);
1452 }
else if (!host || (host ->
flags &
1455 host_dereference (&host,
MDL);
1457 return ISC_R_NOTFOUND;
1463 host_dereference (&host,
MDL);
1465 lease_dereference (&l,
MDL);
1471 if (status == ISC_R_SUCCESS) {
1474 tv -> value -> u.buffer.
value,
1475 tv -> value -> u.buffer.len,
MDL);
1481 host_dereference (&host,
MDL);
1485 host_dereference (&host,
MDL);
1486 return ISC_R_NOTFOUND;
1492 host_dereference (&host,
MDL);
1500 return ISC_R_SUCCESS;
1507 isc_result_t status;
1509 status = host_allocate (&hp,
MDL);
1510 if (status != ISC_R_SUCCESS)
1515 host_dereference (&hp,
MDL);
1523 if (lp -> type != dhcp_type_host)
1531 return ISC_R_SUCCESS;
1540 isc_result_t status;
1542 if (h -> type != dhcp_type_pool)
1548 if (h -> inner && h -> inner -> type -> set_value) {
1549 status = ((*(h -> inner -> type -> set_value))
1550 (h -> inner, id,
name, value));
1564 isc_result_t status;
1566 if (h -> type != dhcp_type_pool)
1572 if (h -> inner && h -> inner -> type -> get_value) {
1573 status = ((*(h -> inner -> type -> get_value))
1574 (h -> inner, id,
name, value));
1575 if (status == ISC_R_SUCCESS)
1583 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1584 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1588 if (h ->
type != dhcp_type_pool)
1591 #if defined (DEBUG_MEMORY_LEAKAGE) || \
1592 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
1593 struct pool *
pool = (
struct pool *)h;
1595 pool_dereference (&pool ->
next, file, line);
1599 shared_network_dereference (&pool ->
shared_network, file, line);
1608 #if defined (FAILOVER_PROTOCOL)
1619 for (pc = pool -> prohibit_list; pc; pc = pn) {
1623 pool -> prohibit_list = (
struct permit *)0;
1626 return ISC_R_SUCCESS;
1630 const char *name, va_list ap)
1633 isc_result_t status;
1635 if (h ->
type != dhcp_type_pool)
1641 if (h -> inner && h -> inner ->
type -> signal_handler) {
1642 status = ((*(h -> inner ->
type -> signal_handler))
1643 (h -> inner, name, ap));
1644 if (status == ISC_R_SUCCESS)
1648 return ISC_R_NOTFOUND;
1656 isc_result_t status;
1658 if (h->type != dhcp_type_pool)
1660 pool = (
struct pool *)h;
1670 if (status != ISC_R_SUCCESS)
1676 if (status != ISC_R_SUCCESS)
1682 if (status != ISC_R_SUCCESS)
1687 if (h->inner && h->inner->type->stuff_values) {
1688 status = ((*(h->inner->type->stuff_values))
1690 if (status == ISC_R_SUCCESS)
1694 return (ISC_R_SUCCESS);
1706 return ISC_R_SUCCESS;
1712 return ISC_R_NOTIMPLEMENTED;
1718 return ISC_R_NOTIMPLEMENTED;
1727 struct class *
class;
1729 isc_result_t status;
1732 class = (struct
class *)h;
1736 return ISC_R_EXISTS;
1739 char tname[value->
u.
buffer.len + 1];
1741 tname[
sizeof(tname)-1] =
'\0';
1744 if (status == ISC_R_NOTFOUND)
1757 class->billed_leases =
1759 sizeof(
struct lease *),
1762 return ISC_R_NOMEMORY;
1770 return ISC_R_NOMEMORY;
1778 return ISC_R_SUCCESS;
1784 return ISC_R_EXISTS;
1790 return ISC_R_NOMEMORY;
1791 class->hash_string.data =
1792 class->hash_string.buffer->data;
1795 class->hash_string.len = value->
u.
buffer.len;
1799 return ISC_R_SUCCESS;
1808 (
char *)value->
u.
buffer.value,
1811 return ISC_R_NOTFOUND;
1815 group_object_dereference(&group,
MDL);
1819 return ISC_R_SUCCESS;
1830 unsigned minlen = (value->
u.
buffer.len > 8 ?
1833 if (!strncmp(
"hardware",
1834 (
char *)value->
u.
buffer.value, minlen))
1837 return ISC_R_NOMEMORY;
1845 return ISC_R_SUCCESS;
1868 if (h->inner && h->inner->type->set_value) {
1869 status = ((*(h->inner->type->set_value))
1870 (h->inner, id,
name, value));
1885 if (h -> type != dhcp_type_class)
1888 return class_set_value(h,
id, name, value);
1895 struct class *
class;
1896 isc_result_t status;
1898 if (h -> type != dhcp_type_class)
1900 class = (struct class *)h;
1907 if (h -> inner && h -> inner -> type -> get_value) {
1908 status = ((*(h -> inner -> type -> get_value))
1909 (h -> inner, id, name, value));
1910 if (status == ISC_R_SUCCESS)
1919 if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)
1921 struct class *
class = (struct class *)h;
1924 class_dereference (&
class -> nic, file, line);
1925 if (
class -> superclass)
1926 class_dereference (&
class -> superclass, file, line);
1927 if (
class -> name) {
1928 dfree (
class -> name, file, line);
1929 class -> name = (
char *)0;
1931 if (
class -> billed_leases) {
1933 for (i = 0; i <
class -> lease_limit; i++) {
1934 if (
class -> billed_leases [i]) {
1935 lease_dereference (&
class -> billed_leases [i],
1939 dfree (
class -> billed_leases, file, line);
1940 class -> billed_leases = (
struct lease **)0;
1942 if (
class -> hash) {
1943 class_free_hash_table (&
class -> hash, file, line);
1950 if (
class -> submatch)
1954 if (
class -> statements)
1957 if (
class -> superclass)
1958 class_dereference (&
class -> superclass, file, line);
1960 return ISC_R_SUCCESS;
1965 const char *name, va_list ap)
1968 isc_result_t status;
1974 if (!strcmp (name,
"updated")) {
1999 (
void *)
class,
MDL);
2012 if (status != ISC_R_SUCCESS)
2018 if (h->inner && h->inner->type->signal_handler) {
2019 status = ((*(h->inner->type->signal_handler))
2020 (h->inner, name, ap));
2021 if (status == ISC_R_SUCCESS)
2026 return ISC_R_SUCCESS;
2028 return ISC_R_NOTFOUND;
2033 const char *name, va_list ap)
2035 if (h -> type != dhcp_type_class)
2038 return class_signal_handler(h, name, ap);
2049 struct class *
class;
2050 isc_result_t status;
2052 class = (struct class *)h;
2056 class->lease_limit));
2057 if (status != ISC_R_SUCCESS)
2062 class->leases_consumed));
2063 if (status != ISC_R_SUCCESS)
2067 if (h->inner && h->inner->type->stuff_values) {
2068 status = ((*(h->inner->type->stuff_values))
2070 if (status == ISC_R_SUCCESS)
2074 return (ISC_R_SUCCESS);
2082 if (h->type != dhcp_type_class)
2096 isc_result_t status;
2097 struct class *
class = 0;
2098 struct class *subclass = 0;
2107 if (status == ISC_R_SUCCESS) {
2119 if (
class == NULL) {
2120 return (ISC_R_NOTFOUND);
2123 if (typewanted == dhcp_type_subclass) {
2126 if (status != ISC_R_SUCCESS) {
2127 class_dereference(&
class,
MDL);
2133 class_dereference(&
class,
MDL);
2138 class_hash_lookup(&subclass,
class->
hash,
2145 class_dereference(&
class,
MDL);
2147 if (subclass == NULL) {
2148 return (ISC_R_NOTFOUND);
2151 class_reference(&
class, subclass,
MDL);
2152 class_dereference(&subclass,
MDL);
2156 if (
class->type != typewanted) {
2157 class_dereference(&
class,
MDL);
2162 class_dereference(&
class,
MDL);
2163 return (ISC_R_NOTFOUND);
2167 class_dereference(&
class,
MDL);
2169 return (ISC_R_SUCCESS);
2179 return class_lookup(lp,
id, ref, dhcp_type_class);
2185 struct class *cp = 0;
2186 isc_result_t status;
2188 status = class_allocate(&cp,
MDL);
2189 if (status != ISC_R_SUCCESS)
2193 return (ISC_R_NOMEMORY);
2197 class_dereference(&cp,
MDL);
2205 if (lp -> type != dhcp_type_class)
2207 cp = (
struct class *)lp;
2210 log_debug (
"OMAPI delete class %s", cp -> name);
2214 return ISC_R_SUCCESS;
2222 if (h -> type != dhcp_type_subclass)
2225 return class_set_value(h,
id, name, value);
2233 struct class *subclass;
2234 isc_result_t status;
2236 if (h -> type != dhcp_type_class)
2238 subclass = (
struct class *)h;
2239 if (subclass -> name != 0)
2245 if (h -> inner && h -> inner -> type -> get_value) {
2246 status = ((*(h -> inner -> type -> get_value))
2247 (h -> inner, id,
name, value));
2248 if (status == ISC_R_SUCCESS)
2255 const char *name, va_list ap)
2257 if (h -> type != dhcp_type_subclass)
2260 return class_signal_handler(h, name, ap);
2268 struct class *subclass;
2270 if (h->type != dhcp_type_subclass)
2272 subclass = (
struct class *)h;
2273 if (subclass->
name != 0)
2284 return class_lookup(lp,
id, ref, dhcp_type_subclass);
2293 struct class *cp = 0;
2294 isc_result_t status;
2296 status = subclass_allocate(&cp,
MDL);
2297 if (status != ISC_R_SUCCESS)
2304 subclass_dereference (&cp,
MDL);
2312 if (lp -> type != dhcp_type_subclass)
2314 cp = (
struct class *)lp;
2317 log_debug (
"OMAPI delete subclass %s", cp -> name);
2322 return ISC_R_SUCCESS;
2334 return ISC_R_NOMEMORY;
2335 memcpy (nname, name -> value, name -> len);
2336 nname [name -> len] = 0;
2338 if (!bp && !createp) {
2347 return ISC_R_SUCCESS;
2353 return ISC_R_NOMEMORY;
2355 switch (value ->
type) {
2358 nv -> value.intval = value -> u.
integer;
2367 return ISC_R_NOMEMORY;
2369 memcpy (&nv -> value.data.
buffer -> data [1],
2371 nv -> value.data.
len = value -> u.
buffer.len;
2385 return ISC_R_NOMEMORY;
2387 memset (bp, 0,
sizeof *bp);
2389 bp -> next = scope -> bindings;
2390 scope -> bindings = bp;
2398 return ISC_R_SUCCESS;
2407 isc_result_t status;
2411 return ISC_R_NOMEMORY;
2412 memcpy (nname, name -> value, name -> len);
2413 nname [name -> len] = 0;
2421 switch (bp -> value -> type) {
2422 case binding_boolean:
2425 bp -> value -> value.boolean);
2428 case binding_numeric:
2432 bp -> value -> value.intval);
2438 bp -> value -> value.data.len);
2439 if (status != ISC_R_SUCCESS)
2441 memcpy (&td -> u.
buffer.value [0],
2442 bp -> value -> value.data.data,
2443 bp -> value -> value.data.len);
2448 case binding_function:
2453 return ISC_R_FAILURE;
2456 if (status != ISC_R_SUCCESS)
2459 if (status != ISC_R_SUCCESS) {
2468 return ISC_R_SUCCESS;
2476 isc_result_t status;
2478 for (bp = scope -> bindings; bp; bp = bp ->
next) {
2480 if (bp -> value -> type == binding_dns ||
2481 bp -> value -> type == binding_function)
2485 len = strlen (bp -> name);
2487 if (status != ISC_R_SUCCESS)
2490 (
unsigned char *)bp -> name,
2492 if (status != ISC_R_SUCCESS)
2495 switch (bp -> value -> type) {
2496 case binding_boolean:
2498 sizeof (u_int32_t));
2499 if (status != ISC_R_SUCCESS)
2503 ((u_int32_t)(bp -> value -> value.boolean))));
2504 if (status != ISC_R_SUCCESS)
2510 (c, bp -> value -> value.data.
len));
2511 if (status != ISC_R_SUCCESS)
2513 if (bp -> value -> value.data.
len) {
2515 (c, bp -> value -> value.data.data,
2516 bp -> value -> value.data.
len));
2517 if (status != ISC_R_SUCCESS)
2522 case binding_numeric:
2524 (c,
sizeof (u_int32_t)));
2525 if (status != ISC_R_SUCCESS)
2529 (bp -> value -> value.intval))));
2530 if (status != ISC_R_SUCCESS)
2537 case binding_function:
2542 return ISC_R_SUCCESS;
isc_result_t dhcp_failover_state_signal(omapi_object_t *, const char *, va_list)
int supersede_lease(struct lease *, struct lease *, int, int, int, int)
isc_result_t dhcp_subclass_create(omapi_object_t **lp, omapi_object_t *id)
isc_result_t omapi_typed_data_new(const char *, int, omapi_typed_data_t **, omapi_datatype_t,...)
isc_result_t dhcp_failover_state_stuff(omapi_object_t *, omapi_object_t *, omapi_object_t *)
lease_id_hash_t * lease_uid_hash
isc_result_t dhcp_failover_link_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
struct binding_scope * global_scope
isc_result_t dhcp_failover_listener_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
isc_result_t dhcp_lease_create(omapi_object_t **lp, omapi_object_t *id)
isc_result_t dhcp_class_remove(omapi_object_t *lp, omapi_object_t *id)
int binding_value_dereference(struct binding_value **v, const char *file, int line)
isc_result_t omapi_make_int_value(omapi_value_t **, omapi_data_string_t *, int, const char *, int)
isc_result_t dhcp_class_create(omapi_object_t **lp, omapi_object_t *id)
isc_result_t omapi_connection_put_handle(omapi_object_t *c, omapi_object_t *h)
int executable_statement_dereference(struct executable_statement **ptr, const char *file, int line)
isc_result_t omapi_object_reference(omapi_object_t **, omapi_object_t *, const char *, int)
isc_result_t dhcp_host_create(omapi_object_t **lp, omapi_object_t *id)
const char * piaddr(const struct iaddr addr)
omapi_object_type_t * dhcp_type_failover_link
isc_result_t dhcp_lease_signal_handler(omapi_object_t *h, const char *name, va_list ap)
isc_result_t end_parse(struct parse **cfile)
omapi_object_type_t * dhcp_type_subclass
isc_result_t dhcp_host_signal_handler(omapi_object_t *h, const char *name, va_list ap)
isc_result_t dhcp_pool_remove(omapi_object_t *lp, omapi_object_t *id)
void * dmalloc(unsigned, const char *, int)
struct lease_state * state
struct class * superclass
int option_cache_dereference(struct option_cache **ptr, const char *file, int line)
isc_result_t omapi_connection_copyin(omapi_object_t *, const unsigned char *, unsigned)
int expression_allocate(struct expression **cptr, const char *file, int line)
isc_result_t dhcp_subclass_remove(omapi_object_t *lp, omapi_object_t *id)
isc_result_t dhcp_class_destroy(omapi_object_t *h, const char *file, int line)
struct iaddr ip_addr(struct iaddr subnet, struct iaddr mask, u_int32_t host_address)
int binding_value_reference(struct binding_value **ptr, struct binding_value *src, const char *file, int line)
#define HOST_DECL_DYNAMIC
void cancel_timeout(void(*)(void *) where, void *what)
isc_result_t omapi_connection_put_named_uint32(omapi_object_t *, const char *, u_int32_t)
#define DHCP_R_INVALIDARG
omapi_typed_data_t * value
#define CLASS_DECL_DELETED
host_hash_t * host_uid_hash
isc_result_t dhcp_subclass_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
isc_result_t dhcp_host_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
isc_result_t dhcp_subclass_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
struct lease * next_pending
isc_result_t dhcp_failover_state_create(omapi_object_t **, omapi_object_t *)
struct executable_statement * on_release
void lease_ping_timeout(void *)
isc_result_t dhcp_failover_listener_stuff(omapi_object_t *, omapi_object_t *, omapi_object_t *)
isc_result_t dhcp_pool_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
int group_reference(struct group **ptr, struct group *bp, const char *file, int line)
void data_string_forget(struct data_string *data, const char *file, int line)
isc_result_t dhcp_pool_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
omapi_object_type_t * dhcp_type_failover_state
void hw_hash_delete(struct lease *)
isc_result_t dhcp_pool_signal_handler(omapi_object_t *h, const char *name, va_list ap)
struct option_cache * fixed_addr
struct class * billing_class
struct group * root_group
enum binding_value::@15 type
struct data_string hash_string
int log_error(const char *,...) __attribute__((__format__(__printf__
isc_result_t dhcp_lease_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
#define HOST_DECL_DELETED
omapi_object_type_t * dhcp_type_host
lease_id_hash_t * lease_hw_addr_hash
int binding_scope_dereference(struct binding_scope **ptr, const char *file, int line)
void free_permit(struct permit *, const char *, int)
isc_result_t dhcp_class_signal_handler(omapi_object_t *h, const char *name, va_list ap)
isc_result_t omapi_data_string_reference(omapi_data_string_t **, omapi_data_string_t *, const char *, int)
struct data_string auth_key_id
dhcp_failover_state_t * failover_peer
isc_result_t dhcp_subclass_signal_handler(omapi_object_t *h, const char *name, va_list ap)
isc_result_t omapi_value_new(omapi_value_t **, const char *, int)
struct data_string client_identifier
#define DHCP_R_KEYCONFLICT
isc_result_t enter_class(struct class *, int, int)
void expression_dereference(struct expression **eptr, const char *file, int line)
omapi_object_type_t * dhcp_type_pool
void log_fatal(const char *,...) __attribute__((__format__(__printf__
isc_result_t dhcp_failover_link_destroy(omapi_object_t *, const char *, int)
isc_result_t omapi_make_handle_value(omapi_value_t **, omapi_data_string_t *, omapi_object_t *, const char *, int)
int binding_value_allocate(struct binding_value **cptr, const char *file, int line)
isc_result_t dhcp_class_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
struct omapi_typed_data_t::@3::@4 buffer
isc_result_t dhcp_failover_state_destroy(omapi_object_t *, const char *, int)
#define CLASS_DECL_DYNAMIC
void free_lease_state(struct lease_state *, const char *, int)
struct hardware hardware_addr
isc_result_t omapi_connection_put_uint32(omapi_object_t *, u_int32_t)
omapi_object_type_t * dhcp_type_failover_listener
isc_result_t binding_scope_get_value(omapi_value_t **value, struct binding_scope *scope, omapi_data_string_t *name)
isc_result_t dhcp_failover_state_remove(omapi_object_t *, omapi_object_t *)
int evaluate_option_cache(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
isc_result_t omapi_get_value_str(omapi_object_t *, omapi_object_t *, const char *, omapi_value_t **)
isc_result_t dhcp_host_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
isc_result_t dhcp_subclass_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
int option_chain_head_dereference(struct option_chain_head **ptr, const char *file, int line)
host_hash_t * host_name_hash
isc_result_t dhcp_failover_state_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
isc_result_t delete_host(struct host_decl *, int)
binding_state_t binding_state
isc_result_t dhcp_failover_state_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
isc_result_t dhcp_class_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
int binding_scope_allocate(struct binding_scope **ptr, const char *file, int line)
int write_lease(struct lease *lease)
isc_result_t class_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
int group_dereference(struct group **ptr, const char *file, int line)
#define DHCP_R_UNKNOWNATTRIBUTE
isc_result_t omapi_object_dereference(omapi_object_t **, const char *, int)
host_hash_t * host_hw_addr_hash
isc_result_t dhcp_pool_create(omapi_object_t **lp, omapi_object_t *id)
isc_result_t dhcp_failover_link_signal(omapi_object_t *, const char *, va_list)
isc_result_t omapi_get_int_value(unsigned long *, omapi_typed_data_t *)
struct expression * submatch
void dfree(void *, const char *, int)
union omapi_typed_data_t::@3 u
struct host_decl * n_ipaddr
isc_result_t dhcp_failover_link_stuff_values(omapi_object_t *, omapi_object_t *, omapi_object_t *)
isc_result_t omapi_handle_td_lookup(omapi_object_t **, omapi_typed_data_t *)
void uid_hash_delete(struct lease *)
isc_result_t dhcp_lease_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
int int log_info(const char *,...) __attribute__((__format__(__printf__
omapi_object_type_t * dhcp_type_class
#define GROUP_OBJECT_DELETED
isc_result_t dhcp_lease_remove(omapi_object_t *lp, omapi_object_t *id)
isc_result_t dhcp_pool_destroy(omapi_object_t *h, const char *file, int line)
void dhcp_db_objects_setup()
omapi_object_type_t * dhcp_type_lease
isc_result_t omapi_connection_put_string(omapi_object_t *, const char *)
isc_result_t delete_class(struct class *, int)
isc_result_t omapi_typed_data_reference(omapi_typed_data_t **, omapi_typed_data_t *, const char *, int)
isc_result_t dhcp_lease_get(omapi_object_t **, const char *, int)
struct lease ** billed_leases
isc_result_t binding_scope_stuff_values(omapi_object_t *c, struct binding_scope *scope)
isc_result_t omapi_value_dereference(omapi_value_t **, const char *, int)
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)
struct group_object * named_group
isc_result_t dhcp_class_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
int omapi_ds_strcmp(omapi_data_string_t *, const char *)
isc_result_t find_class(struct class **c, const char *s, const char *file, int line)
isc_result_t dhcp_lease_destroy(omapi_object_t *h, const char *file, int line)
isc_result_t omapi_connection_put_uint16(omapi_object_t *, u_int32_t)
isc_result_t dhcp_failover_listener_destroy(omapi_object_t *, const char *, int)
isc_result_t dhcp_pool_set_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value)
isc_result_t enter_host(struct host_decl *, int, int)
isc_result_t dhcp_host_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
isc_result_t dhcp_lease_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
group_hash_t * group_name_hash
u_int8_t hbuf[HARDWARE_ADDR_LEN+1]
isc_result_t dhcp_lease_free(omapi_object_t *, const char *, int)
#define POOL_DESTROYP(LQ)
isc_result_t dhcp_subclass_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
isc_result_t omapi_make_const_value(omapi_value_t **, omapi_data_string_t *, const unsigned char *, unsigned, const char *, int)
isc_result_t dhcp_class_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
isc_result_t dhcp_failover_listener_signal(omapi_object_t *, const char *, va_list)
const char * binding_state_names[]
struct executable_statement * on_expiry
struct binding * find_binding(struct binding_scope *scope, const char *name)
isc_result_t dhcp_host_destroy(omapi_object_t *h, const char *file, int line)
struct permit * permit_list
isc_result_t omapi_connection_put_name(omapi_object_t *, const char *)
isc_result_t dhcp_host_stuff_values(omapi_object_t *c, omapi_object_t *id, omapi_object_t *h)
int parse_executable_statements(struct executable_statement **statements, struct parse *cfile, int *lose, enum expression_context case_context)
isc_result_t binding_scope_set_value(struct binding_scope *scope, int createp, omapi_data_string_t *name, omapi_typed_data_t *value)
struct executable_statement * on_commit
const unsigned char * data
struct binding_scope * scope
struct hardware interface
isc_result_t dhcp_failover_state_lookup(omapi_object_t **, omapi_object_t *, omapi_object_t *)
struct host_decl * n_dynamic
isc_result_t dhcp_failover_listener_get_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_value_t **)
int clone_group(struct group **gp, struct group *group, const char *file, int line)
isc_result_t omapi_typed_data_dereference(omapi_typed_data_t **, const char *, int)
binding_state_t next_binding_state
isc_result_t dhcp_failover_link_set_value(omapi_object_t *, omapi_object_t *, omapi_data_string_t *, omapi_typed_data_t *)
isc_result_t new_parse(struct parse **cfile, int file, char *inbuf, unsigned buflen, const char *name, int eolp)
lease_ip_hash_t * lease_ip_addr_hash
isc_result_t dhcp_lease_get_value(omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value)
isc_result_t omapi_make_string_value(omapi_value_t **, omapi_data_string_t *, const char *, const char *, int)
isc_result_t dhcp_pool_lookup(omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref)
isc_result_t dhcp_host_remove(omapi_object_t *lp, omapi_object_t *id)
struct option_chain_head * agent_options