+static unsigned int
+disassemble_ats_information (const struct GNUNET_ATS_Information *src,
+ uint32_t ats_count,
+ struct ATS_Address *dest)
+{
+ int i;
+ int res = 0;
+ for (i = 0; i < ats_count; i++)
+ switch (ntohl (src[i].type))
+ {
+ case GNUNET_ATS_UTILIZATION_UP:
+ dest->atsp_utilization_out.value__ = src[i].value;
+ res ++;
+ break;
+ case GNUNET_ATS_UTILIZATION_DOWN:
+ dest->atsp_utilization_in.value__ = src[i].value;
+ res ++;
+ break;
+ case GNUNET_ATS_QUALITY_NET_DELAY:
+ dest->atsp_latency.rel_value = ntohl (src[i].value);
+ res ++;
+ break;
+ case GNUNET_ATS_QUALITY_NET_DISTANCE:
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Old ATS type %u %u\n", dest->atsp_distance, ntohl (src[i].type));
+ dest->atsp_distance = ntohl (src[i].value);
+ res ++;
+ break;
+ case GNUNET_ATS_COST_WAN:
+ dest->atsp_cost_wan = ntohl (src[i].value);
+ res ++;
+ break;
+ case GNUNET_ATS_COST_LAN:
+ dest->atsp_cost_lan = ntohl (src[i].value);
+ res ++;
+ break;
+ case GNUNET_ATS_COST_WLAN:
+ dest->atsp_cost_wlan = ntohl (src[i].value);
+ res ++;
+ break;
+ case GNUNET_ATS_NETWORK_TYPE:
+ dest->atsp_network_type = ntohl (src[i].value);
+ res ++;
+ break;
+ case GNUNET_ATS_ARRAY_TERMINATOR:
+ break;
+ default:
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Received unsupported ATS type %u\n", ntohl (src[i].type));
+ GNUNET_break (0);
+ break;
+ }
+ return res;
+}
+