FreeBSD/sys/dev/hyperv/utilities/hv_kvp.c
/*
 * Convert ip related info in umsg from utf8 to utf16 and store in hmsg
 */
Convert ip related info in umsg from utf8 to utf16 and store in hmsg
Convert ip related info in umsg from utf8 to utf16 and store in hmsg
static int
hv_kvp_convert_utf8_ipinfo_to_utf16(struct hv_kvp_msg *umsg,
				    struct hv_kvp_ip_msg *host_ip_msg)
{
	int err_ip, err_subnet, err_gway, err_dns, err_adap;
	int UNUSED_FLAG = 1;
	utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.ip_addr,
	    MAX_IP_ADDR_SIZE,
	    (char *)umsg->body.kvp_ip_val.ip_addr,
	    strlen((char *)umsg->body.kvp_ip_val.ip_addr),
	    UNUSED_FLAG,
	    &err_ip);
	utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.sub_net,
	    MAX_IP_ADDR_SIZE,
	    (char *)umsg->body.kvp_ip_val.sub_net,
	    strlen((char *)umsg->body.kvp_ip_val.sub_net),
	    UNUSED_FLAG,
	    &err_subnet);
	utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.gate_way,
	    MAX_GATEWAY_SIZE,
	    (char *)umsg->body.kvp_ip_val.gate_way,
	    strlen((char *)umsg->body.kvp_ip_val.gate_way),
	    UNUSED_FLAG,
	    &err_gway);
	utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.dns_addr,
	    MAX_IP_ADDR_SIZE,
	    (char *)umsg->body.kvp_ip_val.dns_addr,
	    strlen((char *)umsg->body.kvp_ip_val.dns_addr),
	    UNUSED_FLAG,
	    &err_dns);
	utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.adapter_id,
	    MAX_IP_ADDR_SIZE,
	    (char *)umsg->body.kvp_ip_val.adapter_id,
	    strlen((char *)umsg->body.kvp_ip_val.adapter_id),
	    UNUSED_FLAG,
	    &err_adap);
	host_ip_msg->kvp_ip_val.dhcp_enabled = umsg->body.kvp_ip_val.dhcp_enabled;
	host_ip_msg->kvp_ip_val.addr_family = umsg->body.kvp_ip_val.addr_family;
	return (err_ip | err_subnet | err_gway | err_dns | err_adap);
}
static int hv_kvp_convert_utf8_ipinfo_to_utf16 ( struct hv_kvp_msg * umsg , struct hv_kvp_ip_msg * host_ip_msg ) { int err_ip , err_subnet , err_gway , err_dns , err_adap ; int UNUSED_FLAG = 1 ; utf8_to_utf16 ( ( uint16_t * ) host_ip_msg -> kvp_ip_val . ip_addr , MAX_IP_ADDR_SIZE , ( char * ) umsg -> body . kvp_ip_val . ip_addr , strlen ( ( char * ) umsg -> body . kvp_ip_val . ip_addr ) , UNUSED_FLAG , & err_ip ) ; utf8_to_utf16 ( ( uint16_t * ) host_ip_msg -> kvp_ip_val . sub_net , MAX_IP_ADDR_SIZE , ( char * ) umsg -> body . kvp_ip_val . sub_net , strlen ( ( char * ) umsg -> body . kvp_ip_val . sub_net ) , UNUSED_FLAG , & err_subnet ) ; utf8_to_utf16 ( ( uint16_t * ) host_ip_msg -> kvp_ip_val . gate_way , MAX_GATEWAY_SIZE , ( char * ) umsg -> body . kvp_ip_val . gate_way , strlen ( ( char * ) umsg -> body . kvp_ip_val . gate_way ) , UNUSED_FLAG , & err_gway ) ; utf8_to_utf16 ( ( uint16_t * ) host_ip_msg -> kvp_ip_val . dns_addr , MAX_IP_ADDR_SIZE , ( char * ) umsg -> body . kvp_ip_val . dns_addr , strlen ( ( char * ) umsg -> body . kvp_ip_val . dns_addr ) , UNUSED_FLAG , & err_dns ) ; utf8_to_utf16 ( ( uint16_t * ) host_ip_msg -> kvp_ip_val . adapter_id , MAX_IP_ADDR_SIZE , ( char * ) umsg -> body . kvp_ip_val . adapter_id , strlen ( ( char * ) umsg -> body . kvp_ip_val . adapter_id ) , UNUSED_FLAG , & err_adap ) ; host_ip_msg -> kvp_ip_val . dhcp_enabled = umsg -> body . kvp_ip_val . dhcp_enabled ; host_ip_msg -> kvp_ip_val . addr_family = umsg -> body . kvp_ip_val . addr_family ; return ( err_ip | err_subnet | err_gway | err_dns | err_adap ) ; }
Convert ip related info in umsg from utf8 to utf16 and store in hmsg
Convert ip related info in umsg from utf8 to utf16 and store in hmsg