⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhcpctl.c

📁 DHCP服务器源码
💻 C
📖 第 1 页 / 共 2 页
字号:
	omapi_data_string_t *name = (omapi_data_string_t *)0;	int len;	status = omapi_data_string_new (&name, strlen (value_name), MDL);	if (status != ISC_R_SUCCESS)		return status;	memcpy (name -> value, value_name, strlen (value_name));	status = omapi_typed_data_new (MDL, &tv, omapi_datatype_string, value);	if (status != ISC_R_SUCCESS) {		omapi_data_string_dereference (&name, MDL);		return status;	}	status = omapi_set_value (h, (omapi_object_t *)0, name, tv);	omapi_data_string_dereference (&name, MDL);	omapi_typed_data_dereference (&tv, MDL);	return status;}/* dhcpctl_set_buffer_value   Sets a value on an object referred to by a dhcpctl_handle.  like   dhcpctl_set_value, but saves the trouble of creating a data_string   for string for which we have a buffer and length.  Does not update   the server - just sets the value on the handle. */dhcpctl_status dhcpctl_set_data_value (dhcpctl_handle h,				       const char *value, unsigned len,				       const char *value_name){	isc_result_t status;	omapi_typed_data_t *tv = (omapi_typed_data_t *)0;	omapi_data_string_t *name = (omapi_data_string_t *)0;	unsigned ll;	ll = strlen (value_name);	status = omapi_data_string_new (&name, ll, MDL);	if (status != ISC_R_SUCCESS)		return status;	memcpy (name -> value, value_name, ll);	status = omapi_typed_data_new (MDL, &tv,				       omapi_datatype_data, len, value);	if (status != ISC_R_SUCCESS) {		omapi_data_string_dereference (&name, MDL);		return status;	}	memcpy (tv -> u.buffer.value, value, len);	status = omapi_set_value (h, (omapi_object_t *)0, name, tv);	omapi_data_string_dereference (&name, MDL);	omapi_typed_data_dereference (&tv, MDL);	return status;}/* dhcpctl_set_null_value   Sets a null value on an object referred to by a dhcpctl_handle. */dhcpctl_status dhcpctl_set_null_value (dhcpctl_handle h,				       const char *value_name){	isc_result_t status;	omapi_data_string_t *name = (omapi_data_string_t *)0;	unsigned ll;	ll = strlen (value_name);	status = omapi_data_string_new (&name, ll, MDL);	if (status != ISC_R_SUCCESS)		return status;	memcpy (name -> value, value_name, ll);	status = omapi_set_value (h, (omapi_object_t *)0, name,				  (omapi_typed_data_t *)0);	omapi_data_string_dereference (&name, MDL);	return status;}/* dhcpctl_set_boolean_value   Sets a boolean value on an object - like dhcpctl_set_value,   only more convenient for booleans. */dhcpctl_status dhcpctl_set_boolean_value (dhcpctl_handle h, int value,					  const char *value_name){	isc_result_t status;	omapi_typed_data_t *tv = (omapi_typed_data_t *)0;	omapi_data_string_t *name = (omapi_data_string_t *)0;	int len;	status = omapi_data_string_new (&name, strlen (value_name), MDL);	if (status != ISC_R_SUCCESS)		return status;	memcpy (name -> value, value_name, strlen (value_name));	status = omapi_typed_data_new (MDL, &tv, omapi_datatype_int, value);	if (status != ISC_R_SUCCESS) {		omapi_data_string_dereference (&name, MDL);		return status;	}	status = omapi_set_value (h, (omapi_object_t *)0, name, tv);	omapi_data_string_dereference (&name, MDL);	omapi_typed_data_dereference (&tv, MDL);	return status;}/* dhcpctl_set_int_value   Sets a boolean value on an object - like dhcpctl_set_value,   only more convenient for booleans. */dhcpctl_status dhcpctl_set_int_value (dhcpctl_handle h, int value,				      const char *value_name){	isc_result_t status;	omapi_typed_data_t *tv = (omapi_typed_data_t *)0;	omapi_data_string_t *name = (omapi_data_string_t *)0;	int len;	status = omapi_data_string_new (&name, strlen (value_name), MDL);	if (status != ISC_R_SUCCESS)		return status;	memcpy (name -> value, value_name, strlen (value_name));	status = omapi_typed_data_new (MDL, &tv, omapi_datatype_int, value);	if (status != ISC_R_SUCCESS) {		omapi_data_string_dereference (&name, MDL);		return status;	}	status = omapi_set_value (h, (omapi_object_t *)0, name, tv);	omapi_data_string_dereference (&name, MDL);	omapi_typed_data_dereference (&tv, MDL);	return status;}/* dhcpctl_object_update   Queues an update on the object referenced by the handle (there   can't be any other work in progress on the handle).   An   update means local parameters will be sent to the server. */dhcpctl_status dhcpctl_object_update (dhcpctl_handle connection,				      dhcpctl_handle h){	isc_result_t status;	omapi_object_t *message = (omapi_object_t *)0;	dhcpctl_remote_object_t *ro;	if (h -> type != dhcpctl_remote_type)		return ISC_R_INVALIDARG;	ro = (dhcpctl_remote_object_t *)h;	status = omapi_message_new (&message, MDL);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_int_value (message, (omapi_object_t *)0,				      "op", OMAPI_OP_UPDATE);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_object_value (message, (omapi_object_t *)0,					 "object", h);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_int_value (message, (omapi_object_t *)0, "handle",				      (int)(ro -> remote_handle));	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	omapi_message_register (message);	status = omapi_protocol_send_message (connection -> outer,					      (omapi_object_t *)0,					      message, (omapi_object_t *)0);	omapi_object_dereference (&message, MDL);	return status;}/* Requests a refresh on the object referenced by the handle (there   can't be any other work in progress on the handle).   A   refresh means local parameters are updated from the server. */dhcpctl_status dhcpctl_object_refresh (dhcpctl_handle connection,				       dhcpctl_handle h){	isc_result_t status;	omapi_object_t *message = (omapi_object_t *)0;	dhcpctl_remote_object_t *ro;	if (h -> type != dhcpctl_remote_type)		return ISC_R_INVALIDARG;	ro = (dhcpctl_remote_object_t *)h;	status = omapi_message_new (&message, MDL);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_int_value (message, (omapi_object_t *)0,				      "op", OMAPI_OP_REFRESH);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_int_value (message, (omapi_object_t *)0,				      "handle", (int)(ro -> remote_handle));	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	omapi_message_register (message);	status = omapi_protocol_send_message (connection -> outer,					      (omapi_object_t *)0,					      message, (omapi_object_t *)0);	/* We don't want to send the contents of the object down the	   wire, but we do need to reference it so that we know what	   to do with the update. */	status = omapi_set_object_value (message, (omapi_object_t *)0,					 "object", h);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	omapi_object_dereference (&message, MDL);	return status;}/* Requests the removal of the object referenced by the handle (there   can't be any other work in progress on the handle).   A   removal means that all searchable references to the object on the   server are deleted. */dhcpctl_status dhcpctl_object_remove (dhcpctl_handle connection,				      dhcpctl_handle h){	isc_result_t status;	omapi_object_t *message = (omapi_object_t *)0;	dhcpctl_remote_object_t *ro;	if (h -> type != dhcpctl_remote_type)		return ISC_R_INVALIDARG;	ro = (dhcpctl_remote_object_t *)h;	status = omapi_message_new (&message, MDL);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_int_value (message, (omapi_object_t *)0,				      "op", OMAPI_OP_DELETE);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_int_value (message, (omapi_object_t *)0, "handle",				      (int)(ro -> remote_handle));	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	status = omapi_set_object_value (message, (omapi_object_t *)0,					 "notify-object", h);	if (status != ISC_R_SUCCESS) {		omapi_object_dereference (&message, MDL);		return status;	}	omapi_message_register (message);	status = omapi_protocol_send_message (connection -> outer,					      (omapi_object_t *)0,					      message, (omapi_object_t *)0);	omapi_object_dereference (&message, MDL);	return status;}isc_result_t dhcpctl_data_string_dereference (dhcpctl_data_string *vp,					      const char *file, int line){	return omapi_data_string_dereference (vp, file, line);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -