Example #1
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;
}
Example #2
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;
}