示例#1
0
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;
}
示例#2
0
isc_result_t omapi_make_uint_value (omapi_value_t **vp,
				    omapi_data_string_t *name,
				    unsigned int value,
				    const char *file, int line)
{
	return omapi_make_int_value (vp, name, (int)value, file, line);
}
示例#3
0
isc_result_t omapi_message_get_value (omapi_object_t *h,
				      omapi_object_t *id,
				      omapi_data_string_t *name,
				      omapi_value_t **value)
{
	omapi_message_object_t *m;
	if (h -> type != omapi_type_message)
		return DHCP_R_INVALIDARG;
	m = (omapi_message_object_t *)h;

	/* Look for values that are in the message data structure. */
	if (!omapi_ds_strcmp (name, "authlen"))
		return omapi_make_int_value (value, name, (int)m -> authlen,
					     MDL);
	else if (!omapi_ds_strcmp (name, "authenticator")) {
		if (m -> authenticator)
			return omapi_make_value (value, name,
						 m -> authenticator, MDL);
		else
			return ISC_R_NOTFOUND;
	} else if (!omapi_ds_strcmp (name, "authid")) {
		return omapi_make_int_value (value,
					     name, (int)m -> authid, MDL);
	} else if (!omapi_ds_strcmp (name, "op")) {
		return omapi_make_int_value (value, name, (int)m -> op, MDL);
	} else if (!omapi_ds_strcmp (name, "handle")) {
		return omapi_make_int_value (value, name, (int)m -> h, MDL);
	} else if (!omapi_ds_strcmp (name, "id")) {
		return omapi_make_int_value (value, name, (int)m -> id, MDL);
	} else if (!omapi_ds_strcmp (name, "rid")) {
		return omapi_make_int_value (value, name, (int)m -> rid, MDL);
	}

	/* See if there's an inner object that has the value. */
	if (h -> inner && h -> inner -> type -> get_value)
		return (*(h -> inner -> type -> get_value))
			(h -> inner, id, name, value);
	return ISC_R_NOTFOUND;
}
示例#4
0
isc_result_t omapi_connection_get_value (omapi_object_t *h,
					 omapi_object_t *id,
					 omapi_data_string_t *name,
					 omapi_value_t **value)
{
	omapi_connection_object_t *c;
	omapi_typed_data_t *td = (omapi_typed_data_t *)0;
	isc_result_t status;
	unsigned int sigsize;

	if (h -> type != omapi_type_connection)
		return DHCP_R_INVALIDARG;
	c = (omapi_connection_object_t *)h;

	if (omapi_ds_strcmp (name, "input-signature") == 0) {
//ScenSim-Port//		if (!c -> in_key || !c -> in_context)
//ScenSim-Port//			return ISC_R_NOTFOUND;

//ScenSim-Port//		status = omapi_connection_sign_data (SIG_MODE_FINAL,
//ScenSim-Port//						     c -> in_key,
//ScenSim-Port//						     &c -> in_context,
//ScenSim-Port//						     0, 0, &td);
//ScenSim-Port//		if (status != ISC_R_SUCCESS)
//ScenSim-Port//			return status;

		status = omapi_make_value (value, name, td, MDL);
		omapi_typed_data_dereference (&td, MDL);
		return status;

	} else if (omapi_ds_strcmp (name, "input-signature-size") == 0) {
//ScenSim-Port//		if (c->in_key == NULL)
//ScenSim-Port//			return ISC_R_NOTFOUND;

//ScenSim-Port//		status = dst_key_sigsize(c->in_key, &sigsize);
//ScenSim-Port//		if (status != ISC_R_SUCCESS) {
//ScenSim-Port//			return(status);
//ScenSim-Port//		}		

		return omapi_make_int_value(value, name, sigsize, MDL);

	} else if (omapi_ds_strcmp (name, "output-signature") == 0) {
//ScenSim-Port//		if (!c -> out_key || !c -> out_context)
//ScenSim-Port//			return ISC_R_NOTFOUND;

//ScenSim-Port//		status = omapi_connection_sign_data (SIG_MODE_FINAL,
//ScenSim-Port//						     c -> out_key,
//ScenSim-Port//						     &c -> out_context,
//ScenSim-Port//						     0, 0, &td);
//ScenSim-Port//		if (status != ISC_R_SUCCESS)
//ScenSim-Port//			return status;

		status = omapi_make_value (value, name, td, MDL);
		omapi_typed_data_dereference (&td, MDL);
		return status;

	} else if (omapi_ds_strcmp (name, "output-signature-size") == 0) {
//ScenSim-Port//		if (c->out_key == NULL)
//ScenSim-Port//			return ISC_R_NOTFOUND;


//ScenSim-Port//		status = dst_key_sigsize(c->out_key, &sigsize);
//ScenSim-Port//		if (status != ISC_R_SUCCESS) {
//ScenSim-Port//			return(status);
//ScenSim-Port//		}		

		return omapi_make_int_value(value, name, sigsize, MDL);
	}
	
	if (h -> inner && h -> inner -> type -> get_value)
		return (*(h -> inner -> type -> get_value))
			(h -> inner, id, name, value);
	return ISC_R_NOTFOUND;
}