diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-06 22:10:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-06 22:10:48 +0000 |
commit | 766c8bc9f71de9549894beabbd61848f15c053d0 (patch) | |
tree | f3761e0ca0f8c83e523278441d8baae398de58a2 | |
parent | f7fafa634330f6d1755873fe4cb98d68af8f3427 (diff) | |
download | gnunet-gtk-766c8bc9f71de9549894beabbd61848f15c053d0.tar.gz gnunet-gtk-766c8bc9f71de9549894beabbd61848f15c053d0.zip |
removing GNUNET_TRANSPORT_monitor_validation-API
-rw-r--r-- | contrib/gnunet_peerinfo_gtk_main_window.glade | 12 | ||||
-rw-r--r-- | src/peerinfo/gnunet-peerinfo-gtk.c | 131 |
2 files changed, 10 insertions, 133 deletions
diff --git a/contrib/gnunet_peerinfo_gtk_main_window.glade b/contrib/gnunet_peerinfo_gtk_main_window.glade index cdc7415a..ae4440b2 100644 --- a/contrib/gnunet_peerinfo_gtk_main_window.glade +++ b/contrib/gnunet_peerinfo_gtk_main_window.glade | |||
@@ -1,7 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!-- Generated with glade 3.18.3 | 2 | <!-- Generated with glade 3.18.3 |
3 | 3 | ||
4 | Copyright (C) | 4 | Copyright (C) |
5 | 5 | ||
6 | This file is part of gnunet-peerinfo-gtk. | 6 | This file is part of gnunet-peerinfo-gtk. |
7 | 7 | ||
@@ -61,11 +61,11 @@ along with gnunet-peerinfo-gtk. If not, see <http://www.gnu.org/licenses/>. | |||
61 | <column type="gchararray"/> | 61 | <column type="gchararray"/> |
62 | <!-- column-name transport_neighbour_state_timeout_as_string --> | 62 | <!-- column-name transport_neighbour_state_timeout_as_string --> |
63 | <column type="gchararray"/> | 63 | <column type="gchararray"/> |
64 | <!-- column-name transport_validation_state_led --> | 64 | <!-- column-name transport_validation_state_led__DEAD --> |
65 | <column type="GdkPixbuf"/> | 65 | <column type="GdkPixbuf"/> |
66 | <!-- column-name transport_validation_is_valid --> | 66 | <!-- column-name transport_validation_is_valid__DEAD --> |
67 | <column type="gboolean"/> | 67 | <column type="gboolean"/> |
68 | <!-- column-name transport_validation_timeout_as_string --> | 68 | <!-- column-name transport_validation_timeout_as_string__DEAD --> |
69 | <column type="gchararray"/> | 69 | <column type="gchararray"/> |
70 | <!-- column-name plugin_connectivity_led --> | 70 | <!-- column-name plugin_connectivity_led --> |
71 | <column type="GdkPixbuf"/> | 71 | <column type="GdkPixbuf"/> |
@@ -252,10 +252,12 @@ along with gnunet-peerinfo-gtk. If not, see <http://www.gnu.org/licenses/>. | |||
252 | <property name="reorderable">True</property> | 252 | <property name="reorderable">True</property> |
253 | <property name="sort_indicator">True</property> | 253 | <property name="sort_indicator">True</property> |
254 | <property name="sort_column_id">19</property> | 254 | <property name="sort_column_id">19</property> |
255 | <property name="visible">false</property> | ||
255 | <child> | 256 | <child> |
256 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_valdiation_led_cellrendererpixbuf"/> | 257 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_valdiation_led_cellrendererpixbuf"/> |
257 | <attributes> | 258 | <attributes> |
258 | <attribute name="pixbuf">18</attribute> | 259 | <attribute name="pixbuf">18</attribute> |
260 | <property name="visible">false</property> | ||
259 | </attributes> | 261 | </attributes> |
260 | </child> | 262 | </child> |
261 | </object> | 263 | </object> |
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c index 97eb459b..0838fe15 100644 --- a/src/peerinfo/gnunet-peerinfo-gtk.c +++ b/src/peerinfo/gnunet-peerinfo-gtk.c | |||
@@ -141,17 +141,17 @@ enum PEERINFO_ModelColumns | |||
141 | /** | 141 | /** |
142 | * A GdkPixbuf | 142 | * A GdkPixbuf |
143 | */ | 143 | */ |
144 | PEERINFO_MC_VALIDATION_STATE_LED = 18, | 144 | PEERINFO_MC_VALIDATION_STATE_LED__DEAD = 18, |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * A gboolean | 147 | * A gboolean |
148 | */ | 148 | */ |
149 | PEERINFO_MC_VALIDATION_IS_VALID = 19, | 149 | PEERINFO_MC_VALIDATION_IS_VALID__DEAD = 19, |
150 | 150 | ||
151 | /** | 151 | /** |
152 | * A gchararray | 152 | * A gchararray |
153 | */ | 153 | */ |
154 | PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING = 20, | 154 | PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING__DEAD = 20, |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * A GdkPixbuf | 157 | * A GdkPixbuf |
@@ -329,11 +329,6 @@ static struct GNUNET_CONTAINER_MultiPeerMap *peer2info; | |||
329 | static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc; | 329 | static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc; |
330 | 330 | ||
331 | /** | 331 | /** |
332 | * Monitoring transport validation operations. | ||
333 | */ | ||
334 | static struct GNUNET_TRANSPORT_ValidationMonitoringContext *vmc; | ||
335 | |||
336 | /** | ||
337 | * Monitoring transport plugin sessions. | 332 | * Monitoring transport plugin sessions. |
338 | */ | 333 | */ |
339 | struct GNUNET_TRANSPORT_PluginMonitor *pm; | 334 | struct GNUNET_TRANSPORT_PluginMonitor *pm; |
@@ -404,11 +399,6 @@ static GtkTreeViewColumn *tvc_ats_connectivity; | |||
404 | static GtkTreeViewColumn *tvc_plugin_connectivity; | 399 | static GtkTreeViewColumn *tvc_plugin_connectivity; |
405 | 400 | ||
406 | /** | 401 | /** |
407 | * Tree view column for validation status | ||
408 | */ | ||
409 | static GtkTreeViewColumn *tvc_validation_status; | ||
410 | |||
411 | /** | ||
412 | * Tree view column for neighbour_state | 402 | * Tree view column for neighbour_state |
413 | */ | 403 | */ |
414 | static GtkTreeViewColumn *tvc_neighbour_state; | 404 | static GtkTreeViewColumn *tvc_neighbour_state; |
@@ -526,11 +516,6 @@ shutdown_task (void *cts) | |||
526 | GNUNET_TRANSPORT_monitor_plugins_cancel (pm); | 516 | GNUNET_TRANSPORT_monitor_plugins_cancel (pm); |
527 | pm = NULL; | 517 | pm = NULL; |
528 | } | 518 | } |
529 | if (NULL != vmc) | ||
530 | { | ||
531 | GNUNET_TRANSPORT_monitor_validation_entries_cancel (vmc); | ||
532 | vmc = NULL; | ||
533 | } | ||
534 | if (NULL != cm) | 519 | if (NULL != cm) |
535 | { | 520 | { |
536 | GNUNET_CORE_monitor_stop (cm); | 521 | GNUNET_CORE_monitor_stop (cm); |
@@ -1147,107 +1132,6 @@ transport_plugin_cb (void *cls, | |||
1147 | 1132 | ||
1148 | 1133 | ||
1149 | /** | 1134 | /** |
1150 | * Transport address validation monitor disconnected, reset | ||
1151 | * address validation status information for all peers. | ||
1152 | * | ||
1153 | * @param cls NULL | ||
1154 | * @param pid peer identity to reset | ||
1155 | * @param value the `struct PeerInfo` for the peer | ||
1156 | * @return #GNUNET_OK | ||
1157 | */ | ||
1158 | static int | ||
1159 | reset_address_validation_status (void *cls, | ||
1160 | const struct GNUNET_PeerIdentity *pid, | ||
1161 | void *value) | ||
1162 | { | ||
1163 | struct PeerInfo *info = value; | ||
1164 | GtkTreeIter iter; | ||
1165 | struct PeerAddress *pa; | ||
1166 | |||
1167 | for (pa = info->pa_head; NULL != pa; pa = pa->next) | ||
1168 | { | ||
1169 | get_iter_from_rr (pa->rr, &iter); | ||
1170 | gtk_tree_store_set (ts, &iter, | ||
1171 | PEERINFO_MC_VALIDATION_IS_VALID, FALSE, | ||
1172 | PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING, NULL, | ||
1173 | PEERINFO_MC_VALIDATION_STATE_LED, NULL, | ||
1174 | -1); | ||
1175 | } | ||
1176 | return GNUNET_OK; | ||
1177 | } | ||
1178 | |||
1179 | |||
1180 | /** | ||
1181 | * Function to call with validation information about a peer | ||
1182 | * | ||
1183 | * @param cts closure | ||
1184 | * @param address address, NULL for disconnect notification in monitor mode | ||
1185 | * @param last_validation when was this address last validated | ||
1186 | * @param valid_until when does this address expire | ||
1187 | * @param next_validation time of the next validation operation | ||
1188 | * @param state state in the validation state machine | ||
1189 | */ | ||
1190 | static void | ||
1191 | validation_monitor_cb (void *cts, | ||
1192 | const struct GNUNET_HELLO_Address *address, | ||
1193 | struct GNUNET_TIME_Absolute last_validation, | ||
1194 | struct GNUNET_TIME_Absolute valid_until, | ||
1195 | struct GNUNET_TIME_Absolute next_validation, | ||
1196 | enum GNUNET_TRANSPORT_ValidationState state) | ||
1197 | { | ||
1198 | struct PeerInfo *info; | ||
1199 | struct PeerAddress *pa; | ||
1200 | GtkTreeIter iter; | ||
1201 | const char *tos; | ||
1202 | gboolean valid; | ||
1203 | GdkPixbuf *led; | ||
1204 | |||
1205 | if (NULL == address) | ||
1206 | { | ||
1207 | /* disconnect notification, reset all validation state */ | ||
1208 | GNUNET_CONTAINER_multipeermap_iterate (peer2info, | ||
1209 | &reset_address_validation_status, | ||
1210 | NULL); | ||
1211 | return; | ||
1212 | } | ||
1213 | switch (state) | ||
1214 | { | ||
1215 | case GNUNET_TRANSPORT_VS_NONE: | ||
1216 | led = led_black; | ||
1217 | break; | ||
1218 | case GNUNET_TRANSPORT_VS_NEW: | ||
1219 | led = led_yellow; | ||
1220 | break; | ||
1221 | case GNUNET_TRANSPORT_VS_UPDATE: | ||
1222 | led = led_blue; | ||
1223 | break; | ||
1224 | case GNUNET_TRANSPORT_VS_TIMEOUT: | ||
1225 | led = led_red; | ||
1226 | break; | ||
1227 | case GNUNET_TRANSPORT_VS_REMOVE: | ||
1228 | led = NULL; | ||
1229 | break; | ||
1230 | default: | ||
1231 | GNUNET_break (0); | ||
1232 | led = NULL; | ||
1233 | break; | ||
1234 | } | ||
1235 | info = get_peer_info (&address->peer); | ||
1236 | valid = (GNUNET_TIME_absolute_get_remaining (valid_until).rel_value_us > 0); | ||
1237 | if (valid) | ||
1238 | led = led_green; /* UGH: should this not be indicated by 'state' somehow? */ | ||
1239 | pa = get_address (info, address); | ||
1240 | get_iter_from_rr (pa->rr, &iter); | ||
1241 | tos = GNUNET_STRINGS_absolute_time_to_string (valid_until); | ||
1242 | gtk_tree_store_set (ts, &iter, | ||
1243 | PEERINFO_MC_VALIDATION_IS_VALID, valid, | ||
1244 | PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING, tos, | ||
1245 | PEERINFO_MC_VALIDATION_STATE_LED, led, | ||
1246 | -1); | ||
1247 | } | ||
1248 | |||
1249 | |||
1250 | /** | ||
1251 | * Core disconnected, remove CORE KX status information for all peers. | 1135 | * Core disconnected, remove CORE KX status information for all peers. |
1252 | * | 1136 | * |
1253 | * @param cls NULL | 1137 | * @param cls NULL |
@@ -1538,8 +1422,6 @@ query_tooltip_cb (GtkWidget *widget, | |||
1538 | model_column = PEERINFO_MC_PEERINFO_ADDRESS_EXPIRATION; | 1422 | model_column = PEERINFO_MC_PEERINFO_ADDRESS_EXPIRATION; |
1539 | else if (tvc_transport_connectivity == column) | 1423 | else if (tvc_transport_connectivity == column) |
1540 | model_column = PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING; | 1424 | model_column = PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING; |
1541 | else if (tvc_validation_status == column) | ||
1542 | model_column = PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING; | ||
1543 | else if (tvc_neighbour_state == column) | 1425 | else if (tvc_neighbour_state == column) |
1544 | model_column = PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING; | 1426 | model_column = PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING; |
1545 | if (-1 == model_column) | 1427 | if (-1 == model_column) |
@@ -1631,19 +1513,12 @@ run (void *cts) | |||
1631 | pm = GNUNET_TRANSPORT_monitor_plugins (cfg, | 1513 | pm = GNUNET_TRANSPORT_monitor_plugins (cfg, |
1632 | &transport_plugin_cb, | 1514 | &transport_plugin_cb, |
1633 | NULL); | 1515 | NULL); |
1634 | vmc = GNUNET_TRANSPORT_monitor_validation_entries (cfg, | ||
1635 | NULL, | ||
1636 | GNUNET_NO, | ||
1637 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1638 | &validation_monitor_cb, | ||
1639 | NULL); | ||
1640 | ats = GNUNET_ATS_performance_init (cfg, | 1516 | ats = GNUNET_ATS_performance_init (cfg, |
1641 | &ats_status_cb, NULL); | 1517 | &ats_status_cb, NULL); |
1642 | tvc_core_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn")); | 1518 | tvc_core_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn")); |
1643 | tvc_ats_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn")); | 1519 | tvc_ats_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn")); |
1644 | tvc_plugin_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_plugin_connectivity_treeviewcolumn")); | 1520 | tvc_plugin_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_plugin_connectivity_treeviewcolumn")); |
1645 | tvc_transport_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_transport_connectivity_treeviewcolumn")); | 1521 | tvc_transport_connectivity = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_transport_connectivity_treeviewcolumn")); |
1646 | tvc_validation_status = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_validation_status_treeviewcolumn")); | ||
1647 | tvc_neighbour_state = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_neighbour_state_treeviewcolumn")); | 1522 | tvc_neighbour_state = GTK_TREE_VIEW_COLUMN (get_object ("GNUNET_PEERINFO_GTK_main_window_neighbour_state_treeviewcolumn")); |
1648 | /* setup main window */ | 1523 | /* setup main window */ |
1649 | main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window")); | 1524 | main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window")); |