📄 comapi.c
字号:
(h -> inner, id, name, value)); if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED) return status; } return ISC_R_NOTFOUND;}isc_result_t dhcp_control_get_value (omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value){ dhcp_control_object_t *control; isc_result_t status; struct data_string ip_addrs; if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; control = (dhcp_control_object_t *)h; if (!omapi_ds_strcmp (name, "state")) return omapi_make_int_value (value, name, (int)control -> state, MDL); /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> get_value) { status = ((*(h -> inner -> type -> get_value)) (h -> inner, id, name, value)); if (status == ISC_R_SUCCESS) return status; } return ISC_R_NOTFOUND;}isc_result_t dhcp_control_destroy (omapi_object_t *h, const char *file, int line){ dhcp_control_object_t *control, *t; isc_result_t status; if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; /* Can't destroy the control object. */ return ISC_R_NOPERM;}isc_result_t dhcp_control_signal_handler (omapi_object_t *h, const char *name, va_list ap){ dhcp_control_object_t *control, *t; isc_result_t status; int updatep = 0; if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; control = (dhcp_control_object_t *)h; /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> get_value) { status = ((*(h -> inner -> type -> signal_handler)) (h -> inner, name, ap)); if (status == ISC_R_SUCCESS) return status; } return ISC_R_NOTFOUND;}isc_result_t dhcp_control_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h){ dhcp_control_object_t *control; isc_result_t status; if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; control = (dhcp_control_object_t *)h; /* Write out all the values. */ status = omapi_connection_put_name (c, "state"); if (status != ISC_R_SUCCESS) return status; status = omapi_connection_put_uint32 (c, sizeof (u_int32_t)); if (status != ISC_R_SUCCESS) return status; status = omapi_connection_put_uint32 (c, control -> state); if (status != ISC_R_SUCCESS) return status; /* Write out the inner object, if any. */ if (h -> inner && h -> inner -> type -> stuff_values) { status = ((*(h -> inner -> type -> stuff_values)) (c, id, h -> inner)); if (status == ISC_R_SUCCESS) return status; } return ISC_R_SUCCESS;}isc_result_t dhcp_control_lookup (omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref){ omapi_value_t *tv = (omapi_value_t *)0; isc_result_t status; dhcp_control_object_t *control; /* First see if we were sent a handle. */ if (ref) { status = omapi_get_value_str (ref, id, "handle", &tv); if (status == ISC_R_SUCCESS) { status = omapi_handle_td_lookup (lp, tv -> value); omapi_value_dereference (&tv, MDL); if (status != ISC_R_SUCCESS) return status; /* Don't return the object if the type is wrong. */ if ((*lp) -> type != dhcp_type_control) { omapi_object_dereference (lp, MDL); return ISC_R_INVALIDARG; } } } /* Otherwise, stop playing coy - there's only one control object, so we can just return it. */ dhcp_control_reference ((dhcp_control_object_t **)lp, dhcp_control_object, MDL); return ISC_R_SUCCESS;}isc_result_t dhcp_control_create (omapi_object_t **lp, omapi_object_t *id){ /* Can't create a control object - there can be only one. */ return ISC_R_NOPERM;}isc_result_t dhcp_control_remove (omapi_object_t *lp, omapi_object_t *id){ /* Form is emptiness; emptiness form. The control object cannot go out of existance. */ return ISC_R_NOPERM;}isc_result_t dhcp_subnet_set_value (omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value){ struct subnet *subnet; isc_result_t status; int foo; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; subnet = (struct subnet *)h; /* No values to set yet. */ /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> set_value) { status = ((*(h -> inner -> type -> set_value)) (h -> inner, id, name, value)); if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED) return status; } return ISC_R_NOTFOUND;}isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value){ struct subnet *subnet; isc_result_t status; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; subnet = (struct subnet *)h; /* No values to get yet. */ /* Try to find some inner object that can provide the value. */ if (h -> inner && h -> inner -> type -> get_value) { status = ((*(h -> inner -> type -> get_value)) (h -> inner, id, name, value)); if (status == ISC_R_SUCCESS) return status; } return ISC_R_NOTFOUND;}isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line){ struct subnet *subnet; isc_result_t status; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; subnet = (struct subnet *)h;#if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) if (subnet -> next_subnet) subnet_dereference (&subnet -> next_subnet, file, line); if (subnet -> next_sibling) subnet_dereference (&subnet -> next_sibling, file, line); if (subnet -> shared_network) shared_network_dereference (&subnet -> shared_network, file, line); if (subnet -> interface) interface_dereference (&subnet -> interface, file, line); if (subnet -> group) group_dereference (&subnet -> group, file, line);#endif return ISC_R_SUCCESS;}isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h, const char *name, va_list ap){ struct subnet *subnet; isc_result_t status; int updatep = 0; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; subnet = (struct subnet *)h; /* Can't write subnets yet. */ /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> get_value) { status = ((*(h -> inner -> type -> signal_handler)) (h -> inner, name, ap)); if (status == ISC_R_SUCCESS) return status; } if (updatep) return ISC_R_SUCCESS; return ISC_R_NOTFOUND;}isc_result_t dhcp_subnet_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h){ struct subnet *subnet; isc_result_t status; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; subnet = (struct subnet *)h; /* Can't stuff subnet values yet. */ /* Write out the inner object, if any. */ if (h -> inner && h -> inner -> type -> stuff_values) { status = ((*(h -> inner -> type -> stuff_values)) (c, id, h -> inner)); if (status == ISC_R_SUCCESS) return status; } return ISC_R_SUCCESS;}isc_result_t dhcp_subnet_lookup (omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref){ omapi_value_t *tv = (omapi_value_t *)0; isc_result_t status; struct subnet *subnet; /* Can't look up subnets yet. */ /* If we get to here without finding a subnet, no valid key was specified. */ if (!*lp) return ISC_R_NOKEYS; return ISC_R_SUCCESS;}isc_result_t dhcp_subnet_create (omapi_object_t **lp, omapi_object_t *id){ return ISC_R_NOTIMPLEMENTED;}isc_result_t dhcp_subnet_remove (omapi_object_t *lp, omapi_object_t *id){ return ISC_R_NOTIMPLEMENTED;}isc_result_t dhcp_shared_network_set_value (omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_typed_data_t *value){ struct shared_network *shared_network; isc_result_t status; int foo; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; shared_network = (struct shared_network *)h; /* No values to set yet. */ /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> set_value) { status = ((*(h -> inner -> type -> set_value)) (h -> inner, id, name, value)); if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED) return status; } return ISC_R_NOTFOUND;}isc_result_t dhcp_shared_network_get_value (omapi_object_t *h, omapi_object_t *id, omapi_data_string_t *name, omapi_value_t **value){ struct shared_network *shared_network; isc_result_t status; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; shared_network = (struct shared_network *)h; /* No values to get yet. */ /* Try to find some inner object that can provide the value. */ if (h -> inner && h -> inner -> type -> get_value) { status = ((*(h -> inner -> type -> get_value)) (h -> inner, id, name, value)); if (status == ISC_R_SUCCESS) return status; } return ISC_R_NOTFOUND;}isc_result_t dhcp_shared_network_destroy (omapi_object_t *h, const char *file, int line){ struct shared_network *shared_network; isc_result_t status; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; shared_network = (struct shared_network *)h;#if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) if (shared_network -> next) shared_network_dereference (&shared_network -> next, file, line); if (shared_network -> name) { dfree (shared_network -> name, file, line); shared_network -> name = 0; } if (shared_network -> subnets) subnet_dereference (&shared_network -> subnets, file, line); if (shared_network -> interface) interface_dereference (&shared_network -> interface, file, line); if (shared_network -> pools) omapi_object_dereference ((omapi_object_t **) &shared_network -> pools, file, line); if (shared_network -> group) group_dereference (&shared_network -> group, file, line);#if defined (FAILOVER_PROTOCOL) if (shared_network -> failover_peer) omapi_object_dereference ((omapi_object_t **) &shared_network -> failover_peer, file, line);#endif#endif /* DEBUG_MEMORY_LEAKAGE */ return ISC_R_SUCCESS;}isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *h, const char *name, va_list ap){ struct shared_network *shared_network; isc_result_t status; int updatep = 0; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; shared_network = (struct shared_network *)h; /* Can't write shared_networks yet. */ /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> get_value) { status = ((*(h -> inner -> type -> signal_handler)) (h -> inner, name, ap)); if (status == ISC_R_SUCCESS) return status; } if (updatep) return ISC_R_SUCCESS; return ISC_R_NOTFOUND;}isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *c, omapi_object_t *id, omapi_object_t *h){ struct shared_network *shared_network; isc_result_t status; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; shared_network = (struct shared_network *)h; /* Can't stuff shared_network values yet. */ /* Write out the inner object, if any. */ if (h -> inner && h -> inner -> type -> stuff_values) { status = ((*(h -> inner -> type -> stuff_values)) (c, id, h -> inner)); if (status == ISC_R_SUCCESS) return status; } return ISC_R_SUCCESS;}isc_result_t dhcp_shared_network_lookup (omapi_object_t **lp, omapi_object_t *id, omapi_object_t *ref){ omapi_value_t *tv = (omapi_value_t *)0; isc_result_t status; struct shared_network *shared_network; /* Can't look up shared_networks yet. */ /* If we get to here without finding a shared_network, no valid key was specified. */ if (!*lp) return ISC_R_NOKEYS; return ISC_R_SUCCESS;}isc_result_t dhcp_shared_network_create (omapi_object_t **lp, omapi_object_t *id){ return ISC_R_NOTIMPLEMENTED;}isc_result_t dhcp_shared_network_remove (omapi_object_t *lp, omapi_object_t *id){ return ISC_R_NOTIMPLEMENTED;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -