[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25406 - in gnunet/src: ats include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25406 - in gnunet/src: ats include |
Date: |
Wed, 12 Dec 2012 10:27:44 +0100 |
Author: wachs
Date: 2012-12-12 10:27:44 +0100 (Wed, 12 Dec 2012)
New Revision: 25406
Modified:
gnunet/src/ats/ats_api_scheduling.c
gnunet/src/include/gnunet_ats_service.h
Log:
adding function
Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2012-12-12 09:20:00 UTC (rev 25405)
+++ gnunet/src/ats/ats_api_scheduling.c 2012-12-12 09:27:44 UTC (rev 25406)
@@ -808,7 +808,22 @@
sh);
}
+/**
+ * Convert a GNUNET_ATS_NetworkType to a string
+ *
+ * @param net the network type
+ * @return a string or NULL if invalid
+ */
+const char *
+GNUNET_ATS_print_network_type (uint32_t net)
+{
+ char *networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString;
+ if (net < GNUNET_ATS_NetworkTypeCount)
+ return networks[net];
+ return NULL;
+}
+
/**
* Returns where the address is located: LAN or WAN or ...
*
@@ -822,7 +837,7 @@
{
GNUNET_assert (sh != NULL);
struct ATS_Network * cur = sh->net_head;
- char *networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString;
+
int type = GNUNET_ATS_NET_UNSPECIFIED;
struct GNUNET_ATS_Information ats;
@@ -895,8 +910,7 @@
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "ats-scheduling-api",
"`%s' is in network `%s'\n",
GNUNET_a2s ((const struct sockaddr *) addr, addrlen),
- networks[type]);
-
+ GNUNET_ATS_print_network_type(type));
return ats;
}
Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h 2012-12-12 09:20:00 UTC (rev
25405)
+++ gnunet/src/include/gnunet_ats_service.h 2012-12-12 09:27:44 UTC (rev
25406)
@@ -579,6 +579,15 @@
/**
+ * Convert a GNUNET_ATS_NetworkType to a string
+ *
+ * @param net the network type
+ * @return a string or NULL if invalid
+ */
+const char *
+GNUNET_ATS_print_network_type (uint32_t net);
+
+/**
* Returns where the address is located: LAN or WAN or ...
* @param sh the GNUNET_ATS_SchedulingHandle handle
* @param addr address
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25406 - in gnunet/src: ats include,
gnunet <=