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) 463 lease_dereference (&lease->
next, file, line);
465 lease_dereference (&lease->
n_hw, file, line);
467 lease_dereference (&lease->
n_uid, file, line);
472 return ISC_R_SUCCESS;
476 const char *name, va_list ap)
481 if (h -> type != dhcp_type_lease)
484 if (!strcmp (name,
"updated"))
485 return ISC_R_SUCCESS;
488 if (h -> inner && h -> inner -> type -> signal_handler) {
489 status = ((*(h -> inner -> type -> signal_handler))
490 (h -> inner, name, ap));
491 if (status == ISC_R_SUCCESS)
494 return ISC_R_NOTFOUND;
506 if (h -> type != dhcp_type_lease)
508 lease = (
struct lease *)h;
514 if (status != ISC_R_SUCCESS)
518 if (status != ISC_R_SUCCESS)
521 if (status != ISC_R_SUCCESS)
525 if (status != ISC_R_SUCCESS)
530 "dhcp-client-identifier");
531 if (status != ISC_R_SUCCESS)
534 if (status != ISC_R_SUCCESS)
539 if (status != ISC_R_SUCCESS)
546 if (status != ISC_R_SUCCESS)
551 if (status != ISC_R_SUCCESS)
557 if (status != ISC_R_SUCCESS)
562 if (status != ISC_R_SUCCESS)
567 if (status != ISC_R_SUCCESS)
571 if (status != ISC_R_SUCCESS)
575 if (status != ISC_R_SUCCESS)
579 if (status != ISC_R_SUCCESS)
584 if (status != ISC_R_SUCCESS)
588 if (status != ISC_R_SUCCESS)
594 if (status != ISC_R_SUCCESS)
599 if (status != ISC_R_SUCCESS)
605 if (status != ISC_R_SUCCESS)
610 if (status != ISC_R_SUCCESS)
624 bouncer = (u_int32_t)lease->
ends;
626 if (status != ISC_R_SUCCESS)
629 bouncer = (u_int32_t)lease->
starts;
631 if (status != ISC_R_SUCCESS)
634 bouncer = (u_int32_t)lease->
tstp;
636 if (status != ISC_R_SUCCESS)
639 bouncer = (u_int32_t)lease->
tsfp;
641 if (status != ISC_R_SUCCESS)
644 bouncer = (u_int32_t)lease->
atsfp;
646 if (status != ISC_R_SUCCESS)
649 bouncer = (u_int32_t)lease->
cltt;
651 if (status != ISC_R_SUCCESS)
655 if (status != ISC_R_SUCCESS)
658 if (status != ISC_R_SUCCESS)
662 if (status != ISC_R_SUCCESS)
665 if (lease ->
scope) {
667 if (status != ISC_R_SUCCESS)
672 if (h -> inner && h -> inner -> type -> stuff_values) {
673 status = ((*(h -> inner -> type -> stuff_values))
674 (c, id, h -> inner));
675 if (status == ISC_R_SUCCESS)
679 return ISC_R_SUCCESS;
694 if (status == ISC_R_SUCCESS) {
698 if (status != ISC_R_SUCCESS)
702 if ((*lp) -> type != dhcp_type_lease) {
710 if (status == ISC_R_SUCCESS) {
711 lease = (
struct lease *)0;
722 lease_dereference (&lease,
MDL);
727 return ISC_R_NOTFOUND;
733 lease_dereference (&lease,
MDL);
739 if (status == ISC_R_SUCCESS) {
740 lease = (
struct lease *)0;
748 lease_dereference (&lease,
MDL);
753 return ISC_R_NOTFOUND;
754 }
else if (lease ->
n_uid) {
763 lease_dereference (&lease,
MDL);
769 if (status == ISC_R_SUCCESS) {
770 unsigned char *haddr;
773 len = tv -> value -> u.buffer.len + 1;
777 return ISC_R_NOMEMORY;
780 memcpy (haddr + 1, tv -> value -> u.buffer.
value, len - 1);
784 if (status == ISC_R_SUCCESS) {
786 if ((tv -> value -> u.buffer.len != 4) ||
787 (tv -> value -> u.buffer.
value[0] != 0) ||
788 (tv -> value -> u.buffer.
value[1] != 0) ||
789 (tv -> value -> u.buffer.
value[2] != 0)) {
795 haddr[0] = tv -> value -> u.buffer.
value[3];
797 haddr[0] = (
unsigned char)
798 tv -> value -> u.integer;
814 lease = (
struct lease *)0;
821 lease_dereference (&lease,
MDL);
826 return ISC_R_NOTFOUND;
827 }
else if (lease ->
n_hw) {
830 lease_dereference (&lease,
MDL);
837 lease_dereference (&lease,
MDL);
845 return ISC_R_SUCCESS;
851 return ISC_R_NOTIMPLEMENTED;
857 return ISC_R_NOTIMPLEMENTED;
868 if (h -> type != dhcp_type_host)
882 return ISC_R_NOMEMORY;
883 memcpy (host -> name,
886 host -> name [value -> u.
buffer.len] = 0;
889 return ISC_R_SUCCESS;
898 (
char *)value -> u.
buffer.value,
901 return ISC_R_NOTFOUND;
905 if (host -> named_group)
906 group_object_dereference (&host -> named_group,
908 group_object_reference (&host -> named_group,
910 group_object_dereference (&group,
MDL);
913 return ISC_R_SUCCESS;
917 if (host -> interface.hlen)
921 if (value -> u.
buffer.len >
922 (
sizeof host -> interface.hbuf) - 1)
924 memcpy (&host -> interface.hbuf [1],
927 host -> interface.hlen = value -> u.
buffer.len + 1;
930 return ISC_R_SUCCESS;
935 if ((value != NULL) &&
937 (value->
u.
buffer.len ==
sizeof(type)))) {
938 if (value->
u.
buffer.len >
sizeof(type))
940 memcpy(&type, value->
u.
buffer.value,
943 }
else if ((value != NULL) &&
949 return (ISC_R_SUCCESS);
953 if (host -> client_identifier.data)
959 return ISC_R_NOMEMORY;
960 host -> client_identifier.data =
961 &host -> client_identifier.buffer -> data [0];
962 memcpy (host -> client_identifier.buffer -> data,
965 host -> client_identifier.len = value -> u.
buffer.len;
968 return ISC_R_SUCCESS;
972 if (host -> fixed_addr)
975 return ISC_R_SUCCESS;
979 memset (&ds, 0,
sizeof ds);
982 return ISC_R_NOMEMORY;
990 return ISC_R_NOMEMORY;
995 return ISC_R_SUCCESS;
999 if (!host ->
group) {
1001 return ISC_R_NOMEMORY;
1003 if (host ->
group -> statements &&
1004 (!host -> named_group ||
1005 host ->
group != host -> named_group ->
group) &&
1007 return ISC_R_EXISTS;
1009 return ISC_R_NOMEMORY;
1012 return ISC_R_NOMEMORY;
1017 parse = (
struct parse *)0;
1019 (
char *) value->
u.
buffer.value,
1021 "network client", 0);
1022 if (status != ISC_R_SUCCESS || parse == NULL)
1026 (&host ->
group -> statements, parse, &lose,
1034 return ISC_R_SUCCESS;
1040 return ISC_R_SUCCESS;
1044 if (h -> inner && h -> inner -> type -> set_value) {
1045 status = ((*(h -> inner -> type -> set_value))
1046 (h -> inner, id, name, value));
1060 isc_result_t status;
1063 if (h -> type != dhcp_type_host)
1068 memset (&ip_addrs, 0,
sizeof ip_addrs);
1083 return ISC_R_NOTFOUND;
1088 return ISC_R_NOTFOUND;
1101 return ISC_R_NOTFOUND;
1109 return ISC_R_NOTFOUND;
1115 if (h -> inner && h -> inner -> type -> get_value) {
1116 status = ((*(h -> inner -> type -> get_value))
1117 (h -> inner, id,
name, value));
1118 if (status == ISC_R_SUCCESS)
1127 if (h -> type != dhcp_type_host)
1132 host_dereference (&host ->
n_ipaddr, file, line);
1134 host_dereference (&host ->
n_dynamic, file, line);
1137 host ->
name = (
char *)0;
1149 return ISC_R_SUCCESS;
1153 const char *
name, va_list ap)
1156 isc_result_t status;
1159 if (h -> type != dhcp_type_host)
1163 if (!strcmp (name,
"updated")) {
1169 if (!host -> name) {
1171 sprintf (hnbuf,
"nh%08lx%08lx",
1172 (
unsigned long)
cur_time, (
unsigned long)host);
1173 host -> name =
dmalloc (strlen (hnbuf) + 1,
MDL);
1175 return ISC_R_NOMEMORY;
1176 strcpy (host -> name, hnbuf);
1180 log_debug (
"OMAPI added host %s", host -> name);
1183 if (status != ISC_R_SUCCESS)
1189 if (h -> inner && h -> inner -> type -> signal_handler) {
1190 status = ((*(h -> inner -> type -> signal_handler))
1191 (h -> inner,
name, ap));
1192 if (status == ISC_R_SUCCESS)
1196 return ISC_R_SUCCESS;
1197 return ISC_R_NOTFOUND;
1205 isc_result_t status;
1208 if (h -> type != dhcp_type_host)
1214 memset (&ip_addrs, 0,
sizeof ip_addrs);
1224 if (status != ISC_R_SUCCESS)
1227 if (status != ISC_R_SUCCESS)
1231 if (status != ISC_R_SUCCESS)
1238 "dhcp-client-identifier");
1239 if (status != ISC_R_SUCCESS)
1243 if (status != ISC_R_SUCCESS)
1249 if (status != ISC_R_SUCCESS)
1255 if (status != ISC_R_SUCCESS)
1258 if (status != ISC_R_SUCCESS)
1264 if (status != ISC_R_SUCCESS)
1268 if (status != ISC_R_SUCCESS)
1273 if (status != ISC_R_SUCCESS)
1278 if (status != ISC_R_SUCCESS)
1283 if (h -> inner && h -> inner -> type -> stuff_values) {
1284 status = ((*(h -> inner -> type -> stuff_values))
1285 (c, id, h -> inner));
1286 if (status == ISC_R_SUCCESS)
1290 return ISC_R_SUCCESS;
1297 isc_result_t status;
1305 if (status == ISC_R_SUCCESS) {
1309 if (status != ISC_R_SUCCESS)
1313 if ((*lp) -> type != dhcp_type_host) {
1324 if (status == ISC_R_SUCCESS) {
1327 tv -> value -> u.buffer.
value,
1328 tv -> value -> u.buffer.len,
MDL);
1334 host_dereference (&host,
MDL);
1340 host_dereference (&host,
MDL);
1341 return ISC_R_NOTFOUND;
1347 host_dereference (&host,
MDL);
1353 if (status == ISC_R_SUCCESS) {
1354 unsigned char *haddr;
1357 len = tv -> value -> u.buffer.len + 1;
1361 return ISC_R_NOMEMORY;
1364 memcpy (haddr + 1, tv -> value -> u.buffer.
value, len - 1);
1368 if (status == ISC_R_SUCCESS) {
1370 if ((tv -> value -> u.buffer.len != 4) ||
1371 (tv -> value -> u.buffer.
value[0] != 0) ||
1372 (tv -> value -> u.buffer.
value[1] != 0) ||
1373 (tv -> value -> u.buffer.
value[2] != 0)) {
1379 haddr[0] = tv -> value -> u.buffer.
value[3];
1381 haddr[0] = (
unsigned char)
1382 tv -> value -> u.integer;
1405 host_dereference (&host,
MDL);
1411 host_dereference (&host,
MDL);
1412 return ISC_R_NOTFOUND;
1418 host_dereference (&host,
MDL);
1424 if (status == ISC_R_SUCCESS) {
1428 l = (
struct lease *)0;
1435 return ISC_R_NOTFOUND;
1441 l -> hardware_addr.hbuf,
1442 l -> hardware_addr.hlen,
MDL);
1447 host_dereference (&host,
MDL);
1449 }
else if (!host || (host ->
flags &
1452 host_dereference (&host,
MDL);
1454 return ISC_R_NOTFOUND;
1460 host_dereference (&host,
MDL);
1462 lease_dereference (&l,
MDL);
1468 if (status == ISC_R_SUCCESS) {
1471 tv -> value -> u.buffer.
value,
1472 tv -> value -> u.buffer.len,
MDL);
1478 host_dereference (&host,
MDL);
1482 host_dereference (&host,
MDL);
1483 return ISC_R_NOTFOUND;
1489 host_dereference (&host,
MDL);
1497 return ISC_R_SUCCESS;
1504 isc_result_t status;
1506 status = host_allocate (&hp,
MDL);
1507 if (status != ISC_R_SUCCESS)
1512 host_dereference (&hp,
MDL);
1520 if (lp -> type != dhcp_type_host)
1528 return ISC_R_SUCCESS;
1537 isc_result_t status;
1539 if (h -> type != dhcp_type_pool)
1545 if (h -> inner && h -> inner -> type -> set_value) {
1546 status = ((*(h -> inner -> type -> set_value))
1547 (h -> inner, id,
name, value));
1561 isc_result_t status;
1563 if (h -> type != dhcp_type_pool)
1569 if (h -> inner && h -> inner -> type -> get_value) {
1570 status = ((*(h -> inner -> type -> get_value))
1571 (h -> inner, id,
name, value));
1572 if (status == ISC_R_SUCCESS)
1580 #if defined (DEBUG_MEMORY_LEAKAGE) || \ 1581 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 1585 if (h ->
type != dhcp_type_pool)
1588 #if defined (DEBUG_MEMORY_LEAKAGE) || \ 1589 defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 1590 struct pool *
pool = (
struct pool *)h;
1592 pool_dereference (&pool ->
next, file, line);
1596 shared_network_dereference (&pool ->
shared_network, file, line);
1598 lease_dereference (&pool ->
active, file, line);
1600 lease_dereference (&pool ->
expired, file, line);
1602 lease_dereference (&pool ->
free, file, line);
1604 lease_dereference (&pool ->
backup, file, line);
1606 lease_dereference (&pool ->
abandoned, file, line);
1607 #if defined (FAILOVER_PROTOCOL) 1618 for (pc = pool -> prohibit_list; pc; pc = pn) {
1622 pool -> prohibit_list = (
struct permit *)0;
1625 return ISC_R_SUCCESS;
1629 const char *name, va_list ap)
1632 isc_result_t status;
1634 if (h ->
type != dhcp_type_pool)
1640 if (h -> inner && h -> inner ->
type -> signal_handler) {
1641 status = ((*(h -> inner ->
type -> signal_handler))
1642 (h -> inner, name, ap));
1643 if (status == ISC_R_SUCCESS)
1647 return ISC_R_NOTFOUND;
1655 isc_result_t status;
1657 if (h->type != dhcp_type_pool)
1659 pool = (
struct pool *)h;
1669 if (status != ISC_R_SUCCESS)
1675 if (status != ISC_R_SUCCESS)
1681 if (status != ISC_R_SUCCESS)
1686 if (h->inner && h->inner->type->stuff_values) {
1687 status = ((*(h->inner->type->stuff_values))
1689 if (status == ISC_R_SUCCESS)
1693 return (ISC_R_SUCCESS);
1705 return ISC_R_SUCCESS;
1711 return ISC_R_NOTIMPLEMENTED;
1717 return ISC_R_NOTIMPLEMENTED;
1726 struct class *
class;
1728 isc_result_t status;
1731 class = (struct class *)h;
1737 return ISC_R_EXISTS;
1740 return ISC_R_NOMEMORY;
1750 if (status == ISC_R_NOTFOUND)
1753 if (class->superclass != NULL)
1754 class_dereference(&class->superclass,
MDL);
1755 class_reference(&class->superclass, superclass,
MDL);
1757 if (class->group != NULL)
1762 if (class->lease_limit != 0) {
1763 class->billed_leases =
1765 sizeof(
struct lease *),
1767 if (class->billed_leases == NULL) {
1768 return ISC_R_NOMEMORY;
1776 return ISC_R_NOMEMORY;
1779 memcpy(class->name, value->
u.
buffer.value,
1784 return ISC_R_SUCCESS;
1789 if (class->hash_string.data)
1790 return ISC_R_EXISTS;
1796 return ISC_R_NOMEMORY;
1797 class->hash_string.data =
1798 class->hash_string.buffer->data;
1799 memcpy(class->hash_string.buffer->data,
1801 class->hash_string.len = value->
u.
buffer.len;
1805 return ISC_R_SUCCESS;
1814 (
char *)value->
u.
buffer.value,
1817 return ISC_R_NOTFOUND;
1821 group_object_dereference(&group,
MDL);
1825 return ISC_R_SUCCESS;
1836 unsigned minlen = (value->
u.
buffer.len > 8 ?
1839 if (!strncmp(
"hardware",
1840 (
char *)value->
u.
buffer.value, minlen))
1843 return ISC_R_NOMEMORY;
1851 return ISC_R_SUCCESS;
1874 if (h->inner && h->inner->type->set_value) {
1875 status = ((*(h->inner->type->set_value))
1876 (h->inner, id,
name, value));
1891 if (h -> type != dhcp_type_class)
1894 return class_set_value(h,
id, name, value);
1901 struct class *
class;
1902 isc_result_t status;
1904 if (h -> type != dhcp_type_class)
1906 class = (struct class *)h;
1913 if (h -> inner && h -> inner -> type -> get_value) {
1914 status = ((*(h -> inner -> type -> get_value))
1915 (h -> inner, id, name, value));
1916 if (status == ISC_R_SUCCESS)
1925 if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)
1927 struct class *
class = (struct class *)h;
1930 class_dereference (&
class -> nic, file, line);
1931 if (
class -> superclass)
1932 class_dereference (&
class -> superclass, file, line);
1933 if (
class -> name) {
1934 dfree (
class -> name, file, line);
1935 class -> name = (
char *)0;
1937 if (
class -> billed_leases) {
1939 for (i = 0; i <
class -> lease_limit; i++) {
1940 if (
class -> billed_leases [i]) {
1941 lease_dereference (&
class -> billed_leases [i],
1945 dfree (
class -> billed_leases, file, line);
1946 class -> billed_leases = (
struct lease **)0;
1948 if (
class -> hash) {
1949 class_free_hash_table (&
class -> hash, file, line);
1956 if (
class -> submatch)
1960 if (
class -> statements)
1963 if (
class -> superclass)
1964 class_dereference (&
class -> superclass, file, line);
1966 return ISC_R_SUCCESS;
1971 const char *name, va_list ap)
1973 struct class *
class = (struct class *)h;
1974 isc_result_t status;
1980 if (!strcmp (name,
"updated")) {
1983 if (class->name == 0 || strlen(class->name) == 0) {
1987 if (class->superclass == 0) {
1991 if (class->hash_string.data == NULL) {
1998 if (!class->superclass->hash)
1999 class_new_hash(&class->superclass->hash,
2002 class_hash_add(class->superclass->hash,
2003 (
const char *)class->hash_string.data,
2004 class->hash_string.len,
2005 (
void *)
class,
MDL);
2011 class->superclass->name);
2013 log_debug (
"OMAPI added class %s", class->name);
2018 if (status != ISC_R_SUCCESS)
2024 if (h->inner && h->inner->type->signal_handler) {
2025 status = ((*(h->inner->type->signal_handler))
2026 (h->inner, name, ap));
2027 if (status == ISC_R_SUCCESS)
2032 return ISC_R_SUCCESS;
2034 return ISC_R_NOTFOUND;
2039 const char *name, va_list ap)
2041 if (h -> type != dhcp_type_class)
2044 return class_signal_handler(h, name, ap);
2055 struct class *
class;
2056 isc_result_t status;
2058 class = (struct class *)h;
2062 class->lease_limit));
2063 if (status != ISC_R_SUCCESS)
2068 class->leases_consumed));
2069 if (status != ISC_R_SUCCESS)
2073 if (h->inner && h->inner->type->stuff_values) {
2074 status = ((*(h->inner->type->stuff_values))
2076 if (status == ISC_R_SUCCESS)
2080 return (ISC_R_SUCCESS);
2088 if (h->type != dhcp_type_class)
2102 isc_result_t status;
2103 struct class *
class = 0;
2104 struct class *subclass = 0;
2113 if (status == ISC_R_SUCCESS) {
2125 if (
class == NULL) {
2126 return (ISC_R_NOTFOUND);
2129 if (typewanted == dhcp_type_subclass) {
2132 if (status != ISC_R_SUCCESS) {
2133 class_dereference(&
class,
MDL);
2139 class_dereference(&
class,
MDL);
2144 class_hash_lookup(&subclass,
class->
hash,
2151 class_dereference(&
class,
MDL);
2153 if (subclass == NULL) {
2154 return (ISC_R_NOTFOUND);
2157 class_reference(&
class, subclass,
MDL);
2158 class_dereference(&subclass,
MDL);
2162 if (
class->type != typewanted) {
2163 class_dereference(&
class,
MDL);
2168 class_dereference(&
class,
MDL);
2169 return (ISC_R_NOTFOUND);
2173 class_dereference(&
class,
MDL);
2175 return (ISC_R_SUCCESS);
2185 return class_lookup(lp,
id, ref, dhcp_type_class);
2191 struct class *cp = 0;
2192 isc_result_t status;
2194 status = class_allocate(&cp,
MDL);
2195 if (status != ISC_R_SUCCESS)
2201 class_dereference(&cp,
MDL);
2209 if (lp -> type != dhcp_type_class)
2211 cp = (
struct class *)lp;
2214 log_debug (
"OMAPI delete class %s", cp -> name);
2218 return ISC_R_SUCCESS;
2226 if (h -> type != dhcp_type_subclass)
2229 return class_set_value(h,
id, name, value);
2237 struct class *subclass;
2238 isc_result_t status;
2240 if (h -> type != dhcp_type_class)
2242 subclass = (
struct class *)h;
2243 if (subclass -> name != 0)
2249 if (h -> inner && h -> inner -> type -> get_value) {
2250 status = ((*(h -> inner -> type -> get_value))
2251 (h -> inner, id,
name, value));
2252 if (status == ISC_R_SUCCESS)
2259 const char *name, va_list ap)
2261 if (h -> type != dhcp_type_subclass)
2264 return class_signal_handler(h, name, ap);
2272 struct class *subclass;
2274 if (h->type != dhcp_type_subclass)
2276 subclass = (
struct class *)h;
2277 if (subclass->
name != 0)
2288 return class_lookup(lp,
id, ref, dhcp_type_subclass);
2297 struct class *cp = 0;
2298 isc_result_t status;
2300 status = subclass_allocate(&cp,
MDL);
2301 if (status != ISC_R_SUCCESS)
2308 subclass_dereference (&cp,
MDL);
2316 if (lp -> type != dhcp_type_subclass)
2318 cp = (
struct class *)lp;
2321 log_debug (
"OMAPI delete subclass %s", cp -> name);
2326 return ISC_R_SUCCESS;
2338 return ISC_R_NOMEMORY;
2339 memcpy (nname, name -> value, name -> len);
2340 nname [name -> len] = 0;
2342 if (!bp && !createp) {
2351 return ISC_R_SUCCESS;
2357 return ISC_R_NOMEMORY;
2359 switch (value ->
type) {
2362 nv -> value.intval = value -> u.
integer;
2371 return ISC_R_NOMEMORY;
2373 memcpy (&nv -> value.data.
buffer -> data [1],
2375 nv -> value.data.
len = value -> u.
buffer.len;
2389 return ISC_R_NOMEMORY;
2391 memset (bp, 0,
sizeof *bp);
2393 bp -> next = scope -> bindings;
2394 scope -> bindings = bp;
2402 return ISC_R_SUCCESS;
2411 isc_result_t status;
2415 return ISC_R_NOMEMORY;
2416 memcpy (nname, name -> value, name -> len);
2417 nname [name -> len] = 0;
2425 switch (bp -> value -> type) {
2426 case binding_boolean:
2429 bp -> value -> value.boolean);
2432 case binding_numeric:
2436 bp -> value -> value.intval);
2442 bp -> value -> value.data.len);
2443 if (status != ISC_R_SUCCESS)
2445 memcpy (&td -> u.
buffer.value [0],
2446 bp -> value -> value.data.data,
2447 bp -> value -> value.data.len);
2452 case binding_function:
2457 return ISC_R_FAILURE;
2460 if (status != ISC_R_SUCCESS)
2463 if (status != ISC_R_SUCCESS) {
2472 return ISC_R_SUCCESS;
2480 isc_result_t status;
2482 for (bp = scope -> bindings; bp; bp = bp ->
next) {
2484 if (bp -> value -> type == binding_dns ||
2485 bp -> value -> type == binding_function)
2489 len = strlen (bp -> name);
2491 if (status != ISC_R_SUCCESS)
2494 (
unsigned char *)bp -> name,
2496 if (status != ISC_R_SUCCESS)
2499 switch (bp -> value -> type) {
2500 case binding_boolean:
2502 sizeof (u_int32_t));
2503 if (status != ISC_R_SUCCESS)
2507 ((u_int32_t)(bp -> value -> value.boolean))));
2508 if (status != ISC_R_SUCCESS)
2514 (c, bp -> value -> value.data.
len));
2515 if (status != ISC_R_SUCCESS)
2517 if (bp -> value -> value.data.
len) {
2519 (c, bp -> value -> value.data.data,
2520 bp -> value -> value.data.
len));
2521 if (status != ISC_R_SUCCESS)
2526 case binding_numeric:
2528 (c,
sizeof (u_int32_t)));
2529 if (status != ISC_R_SUCCESS)
2533 (bp -> value -> value.intval))));
2534 if (status != ISC_R_SUCCESS)
2541 case binding_function:
2546 return ISC_R_SUCCESS;
isc_result_t dhcp_failover_state_signal(omapi_object_t *, const char *, va_list)
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
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 supersede_lease(struct lease *, struct lease *, int, int, int)
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)
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)
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