int c_zht_compare_and_swap_std(ZHTClient_c zhtClient, const char *key,
		const char *seen_value, const char *new_value, char **value_queried) {

	ZHTClient * zhtcppClient = (ZHTClient *) zhtClient;
	string sKey(key);
	string sSeenValue(seen_value);
	string sNewValue(new_value);

	Package package;
	package.set_virtualpath(sKey);
	package.set_isdir(true);
	package.set_replicano(5);
	package.set_operation(5);  // 5 for comapre and swap
	if (!sSeenValue.empty()) {
		package.set_realfullpath(sSeenValue);
	}
	if (!sNewValue.empty()) {
		package.set_newfullpath(sNewValue);
	}

	string return_str;
	int rc = zhtcppClient->compare_and_swap(package.SerializeAsString(),
			return_str);

	Package ret_pack;
	ret_pack.ParseFromString(return_str);

	strcpy(*value_queried, ret_pack.realfullpath().c_str());

	return rc;
}