struct yang_data *yang_data_new_binary(const char *xpath, const char *value,
				       size_t len)
{
	char *value_str;
	struct base64_encodestate s;
	int cnt;
	char *c;
	struct yang_data *data;

	value_str = (char *)malloc(len * 2);
	base64_init_encodestate(&s);
	cnt = base64_encode_block(value, len, value_str, &s);
	c = value_str + cnt;
	cnt = base64_encode_blockend(c, &s);
	c += cnt;
	*c = 0;
	data = yang_data_new(xpath, value_str);
	free(value_str);
	return data;
}
struct yang_data *yang_data_new_binary(const char *xpath, const char *value,
				       size_t len)
{
	char *value_str;
	struct base64_encodestate s;
	int cnt;
	char *c;
	struct yang_data *data;

	value_str = (char *)malloc(len * 2);
	base64_init_encodestate(&s);
	cnt = base64_encode_block(value, len, value_str, &s);
	c = value_str + cnt;
	cnt = base64_encode_blockend(c, &s);
	c += cnt;
	*c = 0;
	data = yang_data_new(xpath, value_str);
	free(value_str);
	return data;
}