43 static isc_result_t update_lease_flags(
struct lease*
lease,
51 #if defined (FAILOVER_PROTOCOL) 78 sizeof (
struct lease),
80 if (status != ISC_R_SUCCESS)
81 log_fatal (
"Can't register lease object type: %s",
82 isc_result_totext (status));
94 sizeof (
struct class), 0,
96 if (status != ISC_R_SUCCESS)
97 log_fatal (
"Can't register class object type: %s",
98 isc_result_totext (status));
110 sizeof (
struct class), 0,
RC_MISC);
111 if (status != ISC_R_SUCCESS)
112 log_fatal (
"Can't register subclass object type: %s",
113 isc_result_totext (status));
127 if (status != ISC_R_SUCCESS)
128 log_fatal (
"Can't register pool object type: %s",
129 isc_result_totext (status));
144 if (status != ISC_R_SUCCESS)
145 log_fatal (
"Can't register host object type: %s",
146 isc_result_totext (status));
148 #if defined (FAILOVER_PROTOCOL) 160 sizeof (dhcp_failover_state_t),
163 if (status != ISC_R_SUCCESS)
164 log_fatal (
"Can't register failover state object type: %s",
165 isc_result_totext (status));
175 sizeof (dhcp_failover_link_t), 0,
178 if (status != ISC_R_SUCCESS)
179 log_fatal (
"Can't register failover link object type: %s",
180 isc_result_totext (status));
194 if (status != ISC_R_SUCCESS)
195 log_fatal (
"Can't register failover listener object type: %s",
196 isc_result_totext (status));
208 if (h -> type != dhcp_type_lease)
210 lease = (
struct lease *)h;
216 const char *ols, *nls;
218 if (status != ISC_R_SUCCESS)
228 ols =
"unknown state";
233 log_info (
"lease %s state changed from %s to %s",
235 return ISC_R_SUCCESS;
237 log_info (
"lease %s state change from %s to %s failed.",
239 return ISC_R_IOERROR;
259 unsigned long lease_end, old_lease_end;
261 if (status != ISC_R_SUCCESS)
263 old_lease_end = lease->
ends;
264 lease->
ends = lease_end;
266 log_info (
"lease %s end changed from %lu to %lu",
268 return ISC_R_SUCCESS;
270 log_info (
"lease %s end change from %lu to %lu failed",
272 return ISC_R_IOERROR;
274 return (update_lease_flags(lease, value));
281 }
else if (lease ->
scope) {
283 if (status == ISC_R_SUCCESS) {
285 return ISC_R_SUCCESS;
286 return ISC_R_IOERROR;
291 if (h -> inner && h -> inner -> type -> set_value) {
292 status = ((*(h -> inner -> type -> set_value))
293 (h -> inner, id, name, value));
298 if (!lease ->
scope) {
300 return ISC_R_NOMEMORY;
303 if (status != ISC_R_SUCCESS)
307 return ISC_R_SUCCESS;
308 return ISC_R_IOERROR;
330 static isc_result_t update_lease_flags(
struct lease*
lease,
335 struct lease* lupdate = NULL;
342 if (value->
u.
buffer.len == 1) {
343 newflags = value->
u.
buffer.value[0];
348 if (status != ISC_R_SUCCESS) {
352 newflags = (u_int8_t)tmp;
356 oldflags = lease->
flags;
363 if (oldflags == newflags) {
369 return (ISC_R_FAILURE);
373 lupdate->
flags = newflags;
377 log_error(
"Failed to update flags for lease %s.",
379 status = ISC_R_FAILURE;
381 log_debug (
"lease flags changed from %x to %x for lease %s.",
383 status = ISC_R_SUCCESS;
386 lease_dereference(&lupdate,
MDL);
398 if (h -> type != dhcp_type_lease)
400 lease = (
struct lease *)h;
417 return ISC_R_NOTFOUND;
437 return ISC_R_NOTFOUND;
444 return ISC_R_NOTFOUND;
450 return ISC_R_NOTFOUND;
451 }
else if (lease ->
scope) {
453 if (status != ISC_R_NOTFOUND)
458 if (h -> inner && h -> inner -> type -> get_value) {
459 status = ((*(h -> inner -> type -> get_value))
460 (h -> inner, id, name, value));
461 if (status == ISC_R_SUCCESS)
471 if (h->type != dhcp_type_lease)
473 lease = (
struct lease *)h;
506 host_dereference (&lease->
host, file, line);
508 subnet_dereference (&lease->
subnet, file, line);
510 pool_dereference (&lease->
pool, file, line);
532 lease_dereference (&lease->
n_hw, file, line);
534 lease_dereference (&lease->
n_uid, file, line);
538 return ISC_R_SUCCESS;
542 const char *name, va_list ap)
547 if (h -> type != dhcp_type_lease)
550 if (!strcmp (name,
"updated"))
551 return ISC_R_SUCCESS;
554 if (h -> inner && h -> inner -> type -> signal_handler) {
555 status = ((*(h -> inner -> type -> signal_handler))
556 (h -> inner, name, ap));
557 if (status == ISC_R_SUCCESS)
560 return ISC_R_NOTFOUND;
572 if (h -> type != dhcp_type_lease)
574 lease = (
struct lease *)h;
580 if (status != ISC_R_SUCCESS)
584 if (status != ISC_R_SUCCESS)
587 if (status != ISC_R_SUCCESS)
591 if (status != ISC_R_SUCCESS)
596 "dhcp-client-identifier");
597 if (status != ISC_R_SUCCESS)
600 if (status != ISC_R_SUCCESS)
605 if (status != ISC_R_SUCCESS)
612 if (status != ISC_R_SUCCESS)
617 if (status != ISC_R_SUCCESS)
623 if (status != ISC_R_SUCCESS)
628 if (status != ISC_R_SUCCESS)
633 if (status != ISC_R_SUCCESS)
637 if (status != ISC_R_SUCCESS)
641 if (status != ISC_R_SUCCESS)
645 if (status != ISC_R_SUCCESS)
650 if (status != ISC_R_SUCCESS)
654 if (status != ISC_R_SUCCESS)
660 if (status != ISC_R_SUCCESS)
665 if (status != ISC_R_SUCCESS)
671 if (status != ISC_R_SUCCESS)
676 if (status != ISC_R_SUCCESS)
690 bouncer = (u_int32_t)lease->
ends;
692 if (status != ISC_R_SUCCESS)
695 bouncer = (u_int32_t)lease->
starts;
697 if (status != ISC_R_SUCCESS)
700 bouncer = (u_int32_t)lease->
tstp;
702 if (status != ISC_R_SUCCESS)
705 bouncer = (u_int32_t)lease->
tsfp;
707 if (status != ISC_R_SUCCESS)
710 bouncer = (u_int32_t)lease->
atsfp;
712 if (status != ISC_R_SUCCESS)
715 bouncer = (u_int32_t)lease->
cltt;
717 if (status != ISC_R_SUCCESS)
721 if (status != ISC_R_SUCCESS)
724 if (status != ISC_R_SUCCESS)
728 if (status != ISC_R_SUCCESS)
731 if (lease ->
scope) {
733 if (status != ISC_R_SUCCESS)
738 if (h -> inner && h -> inner -> type -> stuff_values) {
739 status = ((*(h -> inner -> type -> stuff_values))
740 (c, id, h -> inner));
741 if (status == ISC_R_SUCCESS)
745 return ISC_R_SUCCESS;
760 if (status == ISC_R_SUCCESS) {
764 if (status != ISC_R_SUCCESS)
768 if ((*lp) -> type != dhcp_type_lease) {
776 if (status == ISC_R_SUCCESS) {
777 lease = (
struct lease *)0;
788 lease_dereference (&lease,
MDL);
793 return ISC_R_NOTFOUND;
799 lease_dereference (&lease,
MDL);
805 if (status == ISC_R_SUCCESS) {
806 lease = (
struct lease *)0;
814 lease_dereference (&lease,
MDL);
819 return ISC_R_NOTFOUND;
820 }
else if (lease ->
n_uid) {
829 lease_dereference (&lease,
MDL);
835 if (status == ISC_R_SUCCESS) {
836 unsigned char *haddr;
839 len = tv -> value -> u.
buffer.len + 1;
843 return ISC_R_NOMEMORY;
846 memcpy (haddr + 1, tv -> value -> u.
buffer.value, len - 1);
850 if (status == ISC_R_SUCCESS) {
852 if ((tv -> value -> u.
buffer.len != 4) ||
853 (tv -> value -> u.
buffer.value[0] != 0) ||
854 (tv -> value -> u.
buffer.value[1] != 0) ||
855 (tv -> value -> u.
buffer.value[2] != 0)) {
861 haddr[0] = tv -> value -> u.
buffer.value[3];
863 haddr[0] = (
unsigned char)
880 lease = (
struct lease *)0;
887 lease_dereference (&lease,
MDL);
892 return ISC_R_NOTFOUND;
893 }
else if (lease ->
n_hw) {
896 lease_dereference (&lease,
MDL);
903 lease_dereference (&lease,
MDL);
911 return ISC_R_SUCCESS;
917 return ISC_R_NOTIMPLEMENTED;
923 return ISC_R_NOTIMPLEMENTED;
934 if (h -> type != dhcp_type_host)
948 return ISC_R_NOMEMORY;
949 memcpy (host -> name,
952 host -> name [value -> u.
buffer.len] = 0;
955 return ISC_R_SUCCESS;
964 (
char *)value -> u.
buffer.value,
967 return ISC_R_NOTFOUND;
971 if (host -> named_group)
972 group_object_dereference (&host -> named_group,
974 group_object_reference (&host -> named_group,
976 group_object_dereference (&group,
MDL);
979 return ISC_R_SUCCESS;
983 if (host -> interface.hlen)
987 if (value -> u.
buffer.len >
988 (
sizeof host -> interface.hbuf) - 1)
990 memcpy (&host -> interface.hbuf [1],
993 host -> interface.hlen = value -> u.
buffer.len + 1;
996 return ISC_R_SUCCESS;
1001 if ((value != NULL) &&
1003 (value->
u.
buffer.len ==
sizeof(type)))) {
1004 if (value->
u.
buffer.len >
sizeof(type))
1006 memcpy(&type, value->
u.
buffer.value,
1009 }
else if ((value != NULL) &&
1015 return (ISC_R_SUCCESS);
1019 if (host -> client_identifier.data)
1020 return ISC_R_EXISTS;
1025 return ISC_R_NOMEMORY;
1026 host -> client_identifier.data =
1027 &host -> client_identifier.buffer -> data [0];
1028 memcpy (host -> client_identifier.buffer -> data,
1031 host -> client_identifier.len = value -> u.
buffer.len;
1034 return ISC_R_SUCCESS;
1038 if (host -> fixed_addr)
1041 return ISC_R_SUCCESS;
1045 memset (&ds, 0,
sizeof ds);
1048 return ISC_R_NOMEMORY;
1056 return ISC_R_NOMEMORY;
1061 return ISC_R_SUCCESS;
1065 if (!host ->
group) {
1067 return ISC_R_NOMEMORY;
1069 if (host ->
group -> statements &&
1070 (!host -> named_group ||
1071 host ->
group != host -> named_group ->
group) &&
1073 return ISC_R_EXISTS;
1075 return ISC_R_NOMEMORY;
1078 return ISC_R_NOMEMORY;
1083 parse = (
struct parse *)0;
1085 (
char *) value->
u.
buffer.value,
1087 "network client", 0);
1088 if (status != ISC_R_SUCCESS || parse == NULL)
1092 (&host ->
group -> statements, parse, &lose,
1100 return ISC_R_SUCCESS;
1106 return ISC_R_SUCCESS;
1110 if (h -> inner && h -> inner -> type -> set_value) {
1111 status = ((*(h -> inner -> type -> set_value))
1112 (h -> inner, id, name, value));
1126 isc_result_t status;
1129 if (h -> type != dhcp_type_host)
1134 memset (&ip_addrs, 0,
sizeof ip_addrs);
1149 return ISC_R_NOTFOUND;
1154 return ISC_R_NOTFOUND;
1167 return ISC_R_NOTFOUND;
1175 return ISC_R_NOTFOUND;
1181 if (h -> inner && h -> inner -> type -> get_value) {
1182 status = ((*(h -> inner -> type -> get_value))
1183 (h -> inner, id,
name, value));
1184 if (status == ISC_R_SUCCESS)
1193 if (h -> type != dhcp_type_host)
1198 host_dereference (&host ->
n_ipaddr, file, line);
1200 host_dereference (&host ->
n_dynamic, file, line);
1203 host ->
name = (
char *)0;
1215 return ISC_R_SUCCESS;
1219 const char *
name, va_list ap)
1222 isc_result_t status;
1225 if (h -> type != dhcp_type_host)
1229 if (!strcmp (name,
"updated")) {
1235 if (!host -> name) {
1237 sprintf (hnbuf,
"nh%08lx%08lx",
1238 (
unsigned long)
cur_time, (
unsigned long)host);
1239 host -> name =
dmalloc (strlen (hnbuf) + 1,
MDL);
1241 return ISC_R_NOMEMORY;
1242 strcpy (host -> name, hnbuf);
1246 log_debug (
"OMAPI added host %s", host -> name);
1249 if (status != ISC_R_SUCCESS)
1255 if (h -> inner && h -> inner -> type -> signal_handler) {
1256 status = ((*(h -> inner -> type -> signal_handler))
1257 (h -> inner,
name, ap));
1258 if (status == ISC_R_SUCCESS)
1262 return ISC_R_SUCCESS;
1263 return ISC_R_NOTFOUND;
1271 isc_result_t status;
1274 if (h -> type != dhcp_type_host)
1280 memset (&ip_addrs, 0,
sizeof ip_addrs);
1291 if (status != ISC_R_SUCCESS) {
1297 if (status != ISC_R_SUCCESS) {
1304 if (status != ISC_R_SUCCESS) {
1314 "dhcp-client-identifier");
1315 if (status != ISC_R_SUCCESS)
1319 if (status != ISC_R_SUCCESS)
1325 if (status != ISC_R_SUCCESS)
1331 if (status != ISC_R_SUCCESS)
1334 if (status != ISC_R_SUCCESS)
1340 if (status != ISC_R_SUCCESS)
1344 if (status != ISC_R_SUCCESS)
1349 if (status != ISC_R_SUCCESS)
1354 if (status != ISC_R_SUCCESS)
1359 if (h -> inner && h -> inner -> type -> stuff_values) {
1360 status = ((*(h -> inner -> type -> stuff_values))
1361 (c, id, h -> inner));
1362 if (status == ISC_R_SUCCESS)
1366 return ISC_R_SUCCESS;
1373 isc_result_t status;
1381 if (status == ISC_R_SUCCESS) {
1385 if (status != ISC_R_SUCCESS)
1389 if ((*lp) -> type != dhcp_type_host) {
1400 if (status == ISC_R_SUCCESS) {
1403 tv -> value -> u.
buffer.value,
1410 host_dereference (&host,
MDL);
1416 host_dereference (&host,
MDL);
1417 return ISC_R_NOTFOUND;
1423 host_dereference (&host,
MDL);
1429 if (status == ISC_R_SUCCESS) {
1430 unsigned char *haddr;
1433 len = tv -> value -> u.
buffer.len + 1;
1437 return ISC_R_NOMEMORY;
1440 memcpy (haddr + 1, tv -> value -> u.
buffer.value, len - 1);
1444 if (status == ISC_R_SUCCESS) {
1446 if ((tv -> value -> u.
buffer.len != 4) ||
1447 (tv -> value -> u.
buffer.value[0] != 0) ||
1448 (tv -> value -> u.
buffer.value[1] != 0) ||
1449 (tv -> value -> u.
buffer.value[2] != 0)) {
1455 haddr[0] = tv -> value -> u.
buffer.value[3];
1457 haddr[0] = (
unsigned char)
1481 host_dereference (&host,
MDL);
1487 host_dereference (&host,
MDL);
1488 return ISC_R_NOTFOUND;
1494 host_dereference (&host,
MDL);
1500 if (status == ISC_R_SUCCESS) {
1504 l = (
struct lease *)0;
1511 return ISC_R_NOTFOUND;
1517 l -> hardware_addr.hbuf,
1518 l -> hardware_addr.hlen,
MDL);
1523 host_dereference (&host,
MDL);
1525 }
else if (!host || (host ->
flags &
1528 host_dereference (&host,
MDL);
1530 return ISC_R_NOTFOUND;
1536 host_dereference (&host,
MDL);
1538 lease_dereference (&l,
MDL);
1544 if (status == ISC_R_SUCCESS) {
1547 tv -> value -> u.
buffer.value,
1554 host_dereference (&host,
MDL);
1558 host_dereference (&host,
MDL);
1559 return ISC_R_NOTFOUND;
1565 host_dereference (&host,
MDL);
1573 return ISC_R_SUCCESS;
1580 isc_result_t status;
1582 status = host_allocate (&hp,
MDL);
1583 if (status != ISC_R_SUCCESS)
1588 host_dereference (&hp,
MDL);
1596 if (lp -> type != dhcp_type_host)
1604 return ISC_R_SUCCESS;
1613 isc_result_t status;
1615 if (h -> type != dhcp_type_pool)
1621 if (h -> inner && h -> inner -> type -> set_value) {
1622 status = ((*(h -> inner -> type -> set_value))
1623 (h -> inner, id,
name, value));
1637 isc_result_t status;
1639 if (h -> type != dhcp_type_pool)
1645 if (h -> inner && h -> inner -> type -> get_value) {
1646 status = ((*(h -> inner -> type -> get_value))
1647 (h -> inner, id,
name, value));
1648 if (status == ISC_R_SUCCESS)
1658 if (h ->
type != dhcp_type_pool)
1661 struct pool *
pool = (
struct pool *)h;
1663 pool_dereference (&pool ->
next, file, line);
1667 shared_network_dereference (&pool ->
shared_network, file, line);
1676 #if defined (FAILOVER_PROTOCOL) 1688 for (pc = pool -> prohibit_list; pc; pc = pn) {
1692 pool -> prohibit_list = (
struct permit *)0;
1694 return ISC_R_SUCCESS;
1698 const char *name, va_list ap)
1701 isc_result_t status;
1703 if (h ->
type != dhcp_type_pool)
1709 if (h -> inner && h -> inner ->
type -> signal_handler) {
1710 status = ((*(h -> inner ->
type -> signal_handler))
1711 (h -> inner, name, ap));
1712 if (status == ISC_R_SUCCESS)
1716 return ISC_R_NOTFOUND;
1724 isc_result_t status;
1726 if (h->type != dhcp_type_pool)
1728 pool = (
struct pool *)h;
1738 if (status != ISC_R_SUCCESS)
1744 if (status != ISC_R_SUCCESS)
1750 if (status != ISC_R_SUCCESS)
1755 if (h->inner && h->inner->type->stuff_values) {
1756 status = ((*(h->inner->type->stuff_values))
1758 if (status == ISC_R_SUCCESS)
1762 return (ISC_R_SUCCESS);
1774 return ISC_R_SUCCESS;
1780 return ISC_R_NOTIMPLEMENTED;
1786 return ISC_R_NOTIMPLEMENTED;
1795 struct class *
class;
1797 isc_result_t status;
1800 class = (struct class *)h;
1804 return ISC_R_EXISTS;
1807 char tname[value->
u.
buffer.len + 1];
1809 tname[
sizeof(tname)-1] =
'\0';
1812 if (status == ISC_R_NOTFOUND)
1815 if (class->superclass != NULL)
1816 class_dereference(&class->superclass,
MDL);
1817 class_reference(&class->superclass, superclass,
MDL);
1819 if (class->group != NULL)
1824 if (class->lease_limit != 0) {
1825 class->billed_leases =
1827 sizeof(
struct lease *),
1829 if (class->billed_leases == NULL) {
1830 return ISC_R_NOMEMORY;
1838 return ISC_R_NOMEMORY;
1841 memcpy(class->name, value->
u.
buffer.value,
1846 return ISC_R_SUCCESS;
1851 if (class->hash_string.data)
1852 return ISC_R_EXISTS;
1858 return ISC_R_NOMEMORY;
1859 class->hash_string.data =
1860 class->hash_string.buffer->data;
1861 memcpy(class->hash_string.buffer->data,
1863 class->hash_string.len = value->
u.
buffer.len;
1867 return ISC_R_SUCCESS;
1876 (
char *)value->
u.
buffer.value,
1879 return ISC_R_NOTFOUND;
1883 group_object_dereference(&group,
MDL);
1887 return ISC_R_SUCCESS;
1898 unsigned minlen = (value->
u.
buffer.len > 8 ?
1901 if (!strncmp(
"hardware",
1902 (
char *)value->
u.
buffer.value, minlen))
1905 return ISC_R_NOMEMORY;
1913 return ISC_R_SUCCESS;
1936 if (h->inner && h->inner->type->set_value) {
1937 status = ((*(h->inner->type->set_value))
1938 (h->inner, id,
name, value));
1953 if (h -> type != dhcp_type_class)
1956 return class_set_value(h,
id, name, value);
1963 struct class *
class;
1964 isc_result_t status;
1966 if (h -> type != dhcp_type_class)
1968 class = (struct class *)h;
1975 if (h -> inner && h -> inner -> type -> get_value) {
1976 status = ((*(h -> inner -> type -> get_value))
1977 (h -> inner, id, name, value));
1978 if (status == ISC_R_SUCCESS)
1987 if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)
1989 struct class *
class = (struct class *)h;
1992 class_dereference (&
class -> nic, file, line);
1993 if (
class -> superclass)
1994 class_dereference (&
class -> superclass, file, line);
1995 if (
class -> name) {
1996 dfree (
class -> name, file, line);
1997 class -> name = (
char *)0;
1999 if (
class -> billed_leases) {
2001 for (i = 0; i <
class -> lease_limit; i++) {
2002 if (
class -> billed_leases [i]) {
2003 lease_dereference (&
class -> billed_leases [i],
2007 dfree (
class -> billed_leases, file, line);
2008 class -> billed_leases = (
struct lease **)0;
2010 if (
class -> hash) {
2011 class_free_hash_table (&
class -> hash, file, line);
2018 if (
class -> submatch)
2022 if (
class -> statements)
2025 if (
class -> superclass)
2026 class_dereference (&
class -> superclass, file, line);
2028 return ISC_R_SUCCESS;
2033 const char *name, va_list ap)
2035 struct class *
class = (struct class *)h;
2036 isc_result_t status;
2042 if (!strcmp (name,
"updated")) {
2045 if (class->name == 0 || strlen(class->name) == 0) {
2049 if (class->superclass == 0) {
2053 if (class->hash_string.data == NULL) {
2060 if (!class->superclass->hash)
2061 class_new_hash(&class->superclass->hash,
2064 class_hash_add(class->superclass->hash,
2065 (
const char *)class->hash_string.data,
2066 class->hash_string.len,
2067 (
void *)
class,
MDL);
2073 class->superclass->name);
2075 log_debug (
"OMAPI added class %s", class->name);
2080 if (status != ISC_R_SUCCESS)
2086 if (h->inner && h->inner->type->signal_handler) {
2087 status = ((*(h->inner->type->signal_handler))
2088 (h->inner, name, ap));
2089 if (status == ISC_R_SUCCESS)
2094 return ISC_R_SUCCESS;
2096 return ISC_R_NOTFOUND;
2101 const char *name, va_list ap)
2103 if (h -> type != dhcp_type_class)
2106 return class_signal_handler(h, name, ap);
2117 struct class *
class;
2118 isc_result_t status;
2120 class = (struct class *)h;
2124 class->lease_limit));
2125 if (status != ISC_R_SUCCESS)
2130 class->leases_consumed));
2131 if (status != ISC_R_SUCCESS)
2135 if (h->inner && h->inner->type->stuff_values) {
2136 status = ((*(h->inner->type->stuff_values))
2138 if (status == ISC_R_SUCCESS)
2142 return (ISC_R_SUCCESS);
2150 if (h->type != dhcp_type_class)
2164 isc_result_t status;
2165 struct class *
class = 0;
2166 struct class *subclass = 0;
2175 if (status == ISC_R_SUCCESS) {
2178 return (ISC_R_NOMEMORY);
2189 if (
class == NULL) {
2190 return (ISC_R_NOTFOUND);
2193 if (typewanted == dhcp_type_subclass) {
2196 if (status != ISC_R_SUCCESS) {
2197 class_dereference(&
class,
MDL);
2203 class_dereference(&
class,
MDL);
2208 class_hash_lookup(&subclass,
class->
hash,
2215 class_dereference(&
class,
MDL);
2217 if (subclass == NULL) {
2218 return (ISC_R_NOTFOUND);
2221 class_reference(&
class, subclass,
MDL);
2222 class_dereference(&subclass,
MDL);
2226 if (
class->type != typewanted) {
2227 class_dereference(&
class,
MDL);
2232 class_dereference(&
class,
MDL);
2233 return (ISC_R_NOTFOUND);
2237 class_dereference(&
class,
MDL);
2239 return (ISC_R_SUCCESS);
2249 return class_lookup(lp,
id, ref, dhcp_type_class);
2255 struct class *cp = 0;
2256 isc_result_t status;
2258 status = class_allocate(&cp,
MDL);
2259 if (status != ISC_R_SUCCESS)
2263 return (ISC_R_NOMEMORY);
2267 class_dereference(&cp,
MDL);
2275 if (lp -> type != dhcp_type_class)
2277 cp = (
struct class *)lp;
2280 log_debug (
"OMAPI delete class %s", cp -> name);
2284 return ISC_R_SUCCESS;
2292 if (h -> type != dhcp_type_subclass)
2295 return class_set_value(h,
id, name, value);
2303 struct class *subclass;
2304 isc_result_t status;
2306 if (h -> type != dhcp_type_class)
2308 subclass = (
struct class *)h;
2309 if (subclass -> name != 0)
2315 if (h -> inner && h -> inner -> type -> get_value) {
2316 status = ((*(h -> inner -> type -> get_value))
2317 (h -> inner, id,
name, value));
2318 if (status == ISC_R_SUCCESS)
2325 const char *name, va_list ap)
2327 if (h -> type != dhcp_type_subclass)
2330 return class_signal_handler(h, name, ap);
2338 struct class *subclass;
2340 if (h->type != dhcp_type_subclass)
2342 subclass = (
struct class *)h;
2343 if (subclass->
name != 0)
2354 return class_lookup(lp,
id, ref, dhcp_type_subclass);
2363 struct class *cp = 0;
2364 isc_result_t status;
2366 status = subclass_allocate(&cp,
MDL);
2367 if (status != ISC_R_SUCCESS)
2374 subclass_dereference (&cp,
MDL);
2382 if (lp -> type != dhcp_type_subclass)
2384 cp = (
struct class *)lp;
2387 log_debug (
"OMAPI delete subclass %s", cp -> name);
2392 return ISC_R_SUCCESS;
2404 return ISC_R_NOMEMORY;
2405 memcpy (nname, name -> value, name -> len);
2406 nname [name -> len] = 0;
2408 if (!bp && !createp) {
2417 return ISC_R_SUCCESS;
2423 return ISC_R_NOMEMORY;
2425 switch (value ->
type) {
2428 nv -> value.intval = value -> u.
integer;
2437 return ISC_R_NOMEMORY;
2439 memcpy (&nv -> value.data.
buffer -> data [1],
2441 nv -> value.data.
len = value -> u.
buffer.len;
2455 return ISC_R_NOMEMORY;
2457 memset (bp, 0,
sizeof *bp);
2459 bp -> next = scope -> bindings;
2460 scope -> bindings = bp;
2468 return ISC_R_SUCCESS;
2477 isc_result_t status;
2481 return ISC_R_NOMEMORY;
2482 memcpy (nname, name -> value, name -> len);
2483 nname [name -> len] = 0;
2491 switch (bp -> value -> type) {
2492 case binding_boolean:
2495 bp -> value -> value.boolean);
2498 case binding_numeric:
2502 bp -> value -> value.intval);
2508 bp -> value -> value.data.len);
2509 if (status != ISC_R_SUCCESS)
2511 memcpy (&td -> u.
buffer.value [0],
2512 bp -> value -> value.data.data,
2513 bp -> value -> value.data.len);
2518 case binding_function:
2523 return ISC_R_FAILURE;
2526 if (status != ISC_R_SUCCESS)
2529 if (status != ISC_R_SUCCESS) {
2538 return ISC_R_SUCCESS;
2546 isc_result_t status;
2548 for (bp = scope -> bindings; bp; bp = bp ->
next) {
2550 if (bp -> value -> type == binding_dns ||
2551 bp -> value -> type == binding_function)
2555 len = strlen (bp -> name);
2557 if (status != ISC_R_SUCCESS)
2560 (
unsigned char *)bp -> name,
2562 if (status != ISC_R_SUCCESS)
2565 switch (bp -> value -> type) {
2566 case binding_boolean:
2568 sizeof (u_int32_t));
2569 if (status != ISC_R_SUCCESS)
2573 ((u_int32_t)(bp -> value -> value.boolean))));
2574 if (status != ISC_R_SUCCESS)
2580 (c, bp -> value -> value.data.
len));
2581 if (status != ISC_R_SUCCESS)
2583 if (bp -> value -> value.data.
len) {
2585 (c, bp -> value -> value.data.data,
2586 bp -> value -> value.data.
len));
2587 if (status != ISC_R_SUCCESS)
2592 case binding_numeric:
2594 (c,
sizeof (u_int32_t)));
2595 if (status != ISC_R_SUCCESS)
2599 (bp -> value -> value.intval))));
2600 if (status != ISC_R_SUCCESS)
2607 case binding_function:
2612 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)
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
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 *)
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)
void * dmalloc(size_t, const char *, int)
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)
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)
int lease_copy(struct lease **, struct lease *, const char *, int)
struct option_chain_head * agent_options