diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-01-09 09:02:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-01-09 09:02:36 +0000 |
commit | 31de566d2541ac69f15688b1527d19e122d5f555 (patch) | |
tree | 504d17e847a39e2467ad7274bc0d3ebd2c7bfdc3 | |
parent | 3a5e793dcc8c059831614bfd41cae9f0c115f790 (diff) | |
download | gnunet-gtk-31de566d2541ac69f15688b1527d19e122d5f555.tar.gz gnunet-gtk-31de566d2541ac69f15688b1527d19e122d5f555.zip |
-towards improved peerinfo data visualization with ats/transport/core state machines
-rw-r--r-- | contrib/gnunet_peerinfo_gtk_main_window.glade | 222 | ||||
-rw-r--r-- | src/peerinfo/Makefile.am | 2 | ||||
-rw-r--r-- | src/peerinfo/gnunet-peerinfo-gtk.c | 380 |
3 files changed, 474 insertions, 130 deletions
diff --git a/contrib/gnunet_peerinfo_gtk_main_window.glade b/contrib/gnunet_peerinfo_gtk_main_window.glade index 42cbe37e..96e087a5 100644 --- a/contrib/gnunet_peerinfo_gtk_main_window.glade +++ b/contrib/gnunet_peerinfo_gtk_main_window.glade | |||
@@ -2,12 +2,34 @@ | |||
2 | <interface> | 2 | <interface> |
3 | <requires lib="gtk+" version="2.20"/> | 3 | <requires lib="gtk+" version="2.20"/> |
4 | <!-- interface-naming-policy project-wide --> | 4 | <!-- interface-naming-policy project-wide --> |
5 | <object class="GtkListStore" id="GNUNET_PEERINFO_GTK_list_store"> | 5 | <object class="GtkAdjustment" id="adjustment4"> |
6 | <property name="upper">100</property> | ||
7 | <property name="step_increment">1</property> | ||
8 | <property name="page_increment">10</property> | ||
9 | <property name="page_size">10</property> | ||
10 | </object> | ||
11 | <object class="GtkImage" id="connected_image_core"> | ||
12 | <property name="visible">True</property> | ||
13 | <property name="can_focus">False</property> | ||
14 | <property name="tooltip_text" translatable="yes">CORE</property> | ||
15 | <property name="stock">gtk-connect</property> | ||
16 | </object> | ||
17 | <object class="GtkImage" id="connected_image_neighbours"> | ||
18 | <property name="visible">True</property> | ||
19 | <property name="can_focus">False</property> | ||
20 | <property name="tooltip_text" translatable="yes">TRANSPORT</property> | ||
21 | <property name="stock">gtk-connect</property> | ||
22 | </object> | ||
23 | <object class="GtkImage" id="connected_image_plugin"> | ||
24 | <property name="visible">True</property> | ||
25 | <property name="can_focus">False</property> | ||
26 | <property name="tooltip_text" translatable="yes">PLUGIN</property> | ||
27 | <property name="stock">gtk-connect</property> | ||
28 | </object> | ||
29 | <object class="GtkTreeStore" id="GNUNET_PEERINFO_GTK_tree_store"> | ||
6 | <columns> | 30 | <columns> |
7 | <!-- column-name peer_identity --> | 31 | <!-- column-name peer_identity --> |
8 | <column type="gchararray"/> | 32 | <column type="gchararray"/> |
9 | <!-- column-name number_of_known_addresses --> | ||
10 | <column type="guint"/> | ||
11 | <!-- column-name country_name --> | 33 | <!-- column-name country_name --> |
12 | <column type="gchararray"/> | 34 | <column type="gchararray"/> |
13 | <!-- column-name country_flag --> | 35 | <!-- column-name country_flag --> |
@@ -16,18 +38,66 @@ | |||
16 | <column type="guint"/> | 38 | <column type="guint"/> |
17 | <!-- column-name bandwidth_out --> | 39 | <!-- column-name bandwidth_out --> |
18 | <column type="guint"/> | 40 | <column type="guint"/> |
19 | <!-- column-name addresses --> | 41 | <!-- column-name ats_connectivity_led --> |
20 | <column type="gchararray"/> | ||
21 | <!-- column-name connectivity_led --> | ||
22 | <column type="GdkPixbuf"/> | 42 | <column type="GdkPixbuf"/> |
23 | <!-- column-name connected_status --> | 43 | <!-- column-name ats_selected_status --> |
44 | <column type="gboolean"/> | ||
45 | <!-- column-name core_connectivity_led --> | ||
46 | <column type="GdkPixbuf"/> | ||
47 | <!-- column-name core_connected_status --> | ||
24 | <column type="gboolean"/> | 48 | <column type="gboolean"/> |
25 | <!-- column-name is_friend --> | 49 | <!-- column-name is_friend --> |
26 | <column type="gboolean"/> | 50 | <column type="gboolean"/> |
27 | <!-- column-name peerinfo --> | 51 | <!-- column-name peerinfo --> |
28 | <column type="gpointer"/> | 52 | <column type="gpointer"/> |
53 | <!-- column-name plugin_name --> | ||
54 | <column type="gchararray"/> | ||
55 | <!-- column-name address_as_string --> | ||
56 | <column type="gchararray"/> | ||
57 | <!-- column-name neighbour_connectivity_led --> | ||
58 | <column type="GdkPixbuf"/> | ||
59 | <!-- column-name neighbour_connected_status --> | ||
60 | <column type="gboolean"/> | ||
61 | <!-- column-name neighbour_connectivity_timeout_as_string --> | ||
62 | <column type="gchararray"/> | ||
63 | <!-- column-name transport_neighbour_state_as_string --> | ||
64 | <column type="gchararray"/> | ||
65 | <!-- column-name transport_neighbour_state_timeout_as_string --> | ||
66 | <column type="gchararray"/> | ||
67 | <!-- column-name transport_validation_state_led --> | ||
68 | <column type="GdkPixbuf"/> | ||
69 | <!-- column-name transport_validation_is_valid --> | ||
70 | <column type="gboolean"/> | ||
71 | <!-- column-name transport_validation_timeout_as_string --> | ||
72 | <column type="gchararray"/> | ||
73 | <!-- column-name plugin_connectivity_led --> | ||
74 | <column type="GdkPixbuf"/> | ||
75 | <!-- column-name plugin_connectivity_status --> | ||
76 | <column type="gboolean"/> | ||
77 | <!-- column-name plugin_connectivity_timeout_as_string --> | ||
78 | <column type="gchararray"/> | ||
79 | <!-- column-name show_friend --> | ||
80 | <column type="gboolean"/> | ||
29 | </columns> | 81 | </columns> |
30 | </object> | 82 | </object> |
83 | <object class="GtkAdjustment" id="adjustment3"> | ||
84 | <property name="upper">100</property> | ||
85 | <property name="step_increment">1</property> | ||
86 | <property name="page_increment">10</property> | ||
87 | <property name="page_size">10</property> | ||
88 | </object> | ||
89 | <object class="GtkImage" id="connected_image_ats"> | ||
90 | <property name="visible">True</property> | ||
91 | <property name="can_focus">False</property> | ||
92 | <property name="tooltip_text" translatable="yes">ATS</property> | ||
93 | <property name="stock">gtk-connect</property> | ||
94 | </object> | ||
95 | <object class="GtkImage" id="validated_image"> | ||
96 | <property name="visible">True</property> | ||
97 | <property name="can_focus">False</property> | ||
98 | <property name="tooltip_text" translatable="yes">Address valid?</property> | ||
99 | <property name="stock">gtk-dialog-authentication</property> | ||
100 | </object> | ||
31 | <object class="GtkWindow" id="GNUNET_PEERINFO_GTK_main_window"> | 101 | <object class="GtkWindow" id="GNUNET_PEERINFO_GTK_main_window"> |
32 | <property name="can_focus">False</property> | 102 | <property name="can_focus">False</property> |
33 | <property name="title" translatable="yes">gnunet-peerinfo-gtk</property> | 103 | <property name="title" translatable="yes">gnunet-peerinfo-gtk</property> |
@@ -46,7 +116,6 @@ | |||
46 | <property name="can_focus">False</property> | 116 | <property name="can_focus">False</property> |
47 | <child> | 117 | <child> |
48 | <object class="GtkMenuItem" id="GNUNET_PEERINFO_GTK_main_menu_help"> | 118 | <object class="GtkMenuItem" id="GNUNET_PEERINFO_GTK_main_menu_help"> |
49 | <property name="use_action_appearance">False</property> | ||
50 | <property name="visible">True</property> | 119 | <property name="visible">True</property> |
51 | <property name="can_focus">False</property> | 120 | <property name="can_focus">False</property> |
52 | <property name="label" translatable="yes">_Help</property> | 121 | <property name="label" translatable="yes">_Help</property> |
@@ -58,7 +127,6 @@ | |||
58 | <child> | 127 | <child> |
59 | <object class="GtkImageMenuItem" id="GNUNET_PEERINFO_GTK_main_menu_help_about"> | 128 | <object class="GtkImageMenuItem" id="GNUNET_PEERINFO_GTK_main_menu_help_about"> |
60 | <property name="label">gtk-about</property> | 129 | <property name="label">gtk-about</property> |
61 | <property name="use_action_appearance">False</property> | ||
62 | <property name="visible">True</property> | 130 | <property name="visible">True</property> |
63 | <property name="can_focus">False</property> | 131 | <property name="can_focus">False</property> |
64 | <property name="tooltip_text" translatable="yes">Display information about this version of gnunet-peerinfo-gtk</property> | 132 | <property name="tooltip_text" translatable="yes">Display information about this version of gnunet-peerinfo-gtk</property> |
@@ -91,7 +159,7 @@ | |||
91 | <object class="GtkTreeView" id="GNUNET_PEERINFO_GTK_main_window_treeview"> | 159 | <object class="GtkTreeView" id="GNUNET_PEERINFO_GTK_main_window_treeview"> |
92 | <property name="visible">True</property> | 160 | <property name="visible">True</property> |
93 | <property name="can_focus">True</property> | 161 | <property name="can_focus">True</property> |
94 | <property name="model">GNUNET_PEERINFO_GTK_list_store</property> | 162 | <property name="model">GNUNET_PEERINFO_GTK_tree_store</property> |
95 | <property name="hadjustment">adjustment3</property> | 163 | <property name="hadjustment">adjustment3</property> |
96 | <property name="vadjustment">adjustment4</property> | 164 | <property name="vadjustment">adjustment4</property> |
97 | <property name="reorderable">True</property> | 165 | <property name="reorderable">True</property> |
@@ -127,6 +195,7 @@ | |||
127 | <signal name="toggled" handler="GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb" swapped="no"/> | 195 | <signal name="toggled" handler="GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb" swapped="no"/> |
128 | </object> | 196 | </object> |
129 | <attributes> | 197 | <attributes> |
198 | <attribute name="visible">24</attribute> | ||
130 | <attribute name="active">9</attribute> | 199 | <attribute name="active">9</attribute> |
131 | </attributes> | 200 | </attributes> |
132 | </child> | 201 | </child> |
@@ -136,12 +205,12 @@ | |||
136 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_connectivity_treeviewcolumn"> | 205 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_connectivity_treeviewcolumn"> |
137 | <property name="spacing">2</property> | 206 | <property name="spacing">2</property> |
138 | <property name="sizing">autosize</property> | 207 | <property name="sizing">autosize</property> |
139 | <property name="widget">connected_image</property> | 208 | <property name="widget">connected_image_core</property> |
140 | <property name="reorderable">True</property> | 209 | <property name="reorderable">True</property> |
141 | <property name="sort_indicator">True</property> | 210 | <property name="sort_indicator">True</property> |
142 | <property name="sort_column_id">8</property> | 211 | <property name="sort_column_id">8</property> |
143 | <child> | 212 | <child> |
144 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_led_cellrendererpixbuf"/> | 213 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_core_led_cellrendererpixbuf"/> |
145 | <attributes> | 214 | <attributes> |
146 | <attribute name="pixbuf">7</attribute> | 215 | <attribute name="pixbuf">7</attribute> |
147 | </attributes> | 216 | </attributes> |
@@ -149,6 +218,91 @@ | |||
149 | </object> | 218 | </object> |
150 | </child> | 219 | </child> |
151 | <child> | 220 | <child> |
221 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_plugin_treeviewcolumn"> | ||
222 | <property name="widget">connected_image_plugin</property> | ||
223 | <property name="reorderable">True</property> | ||
224 | <property name="sort_indicator">True</property> | ||
225 | <property name="sort_column_id">22</property> | ||
226 | <child> | ||
227 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_plugin_led_cellrendererpixbuf"/> | ||
228 | <attributes> | ||
229 | <attribute name="pixbuf">21</attribute> | ||
230 | </attributes> | ||
231 | </child> | ||
232 | </object> | ||
233 | </child> | ||
234 | <child> | ||
235 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_core_timeout_treeviewcolumn"> | ||
236 | <property name="widget">connected_image_ats</property> | ||
237 | <child> | ||
238 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_ats_led_cellrendererpixbuf"/> | ||
239 | <attributes> | ||
240 | <attribute name="visible">6</attribute> | ||
241 | <attribute name="pixbuf">5</attribute> | ||
242 | </attributes> | ||
243 | </child> | ||
244 | </object> | ||
245 | </child> | ||
246 | <child> | ||
247 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_transport_led_treeviewcolumn"> | ||
248 | <property name="widget">connected_image_neighbours</property> | ||
249 | <property name="reorderable">True</property> | ||
250 | <property name="sort_indicator">True</property> | ||
251 | <property name="sort_column_id">14</property> | ||
252 | <child> | ||
253 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_transport_led_cellrendererpixbuf"/> | ||
254 | <attributes> | ||
255 | <attribute name="pixbuf">13</attribute> | ||
256 | </attributes> | ||
257 | </child> | ||
258 | </object> | ||
259 | </child> | ||
260 | <child> | ||
261 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_validation_led_treeviewcolumn"> | ||
262 | <property name="widget">validated_image</property> | ||
263 | <property name="reorderable">True</property> | ||
264 | <property name="sort_indicator">True</property> | ||
265 | <property name="sort_column_id">19</property> | ||
266 | <child> | ||
267 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_valdiation_led_cellrendererpixbuf"/> | ||
268 | <attributes> | ||
269 | <attribute name="pixbuf">18</attribute> | ||
270 | </attributes> | ||
271 | </child> | ||
272 | </object> | ||
273 | </child> | ||
274 | <child> | ||
275 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_country_column"> | ||
276 | <property name="sizing">autosize</property> | ||
277 | <property name="title">Country</property> | ||
278 | <property name="clickable">True</property> | ||
279 | <property name="reorderable">True</property> | ||
280 | <property name="sort_indicator">True</property> | ||
281 | <property name="sort_column_id">2</property> | ||
282 | <child> | ||
283 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_country_renderer"/> | ||
284 | <attributes> | ||
285 | <attribute name="pixbuf">3</attribute> | ||
286 | </attributes> | ||
287 | </child> | ||
288 | </object> | ||
289 | </child> | ||
290 | <child> | ||
291 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_address_treeviewcolumn"> | ||
292 | <property name="sizing">autosize</property> | ||
293 | <property name="title">Address</property> | ||
294 | <property name="expand">True</property> | ||
295 | <property name="clickable">True</property> | ||
296 | <property name="sort_column_id">12</property> | ||
297 | <child> | ||
298 | <object class="GtkCellRendererText" id="GNUNET_PEERINFO_GTK_main_window_address_cellrenderertext"/> | ||
299 | <attributes> | ||
300 | <attribute name="text">12</attribute> | ||
301 | </attributes> | ||
302 | </child> | ||
303 | </object> | ||
304 | </child> | ||
305 | <child> | ||
152 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_bandwidth_column"> | 306 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_bandwidth_column"> |
153 | <property name="title">In</property> | 307 | <property name="title">In</property> |
154 | <property name="clickable">True</property> | 308 | <property name="clickable">True</property> |
@@ -179,32 +333,27 @@ | |||
179 | </object> | 333 | </object> |
180 | </child> | 334 | </child> |
181 | <child> | 335 | <child> |
182 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_country_column"> | 336 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_plugin_name_treeviewcolumn"> |
183 | <property name="sizing">autosize</property> | 337 | <property name="title" translatable="yes">Plugin</property> |
184 | <property name="title">Country</property> | ||
185 | <property name="clickable">True</property> | ||
186 | <property name="reorderable">True</property> | ||
187 | <property name="sort_indicator">True</property> | ||
188 | <property name="sort_column_id">2</property> | ||
189 | <child> | 338 | <child> |
190 | <object class="GtkCellRendererPixbuf" id="GNUNET_PEERINFO_GTK_main_window_country_renderer"/> | 339 | <object class="GtkCellRendererText" id="cellrenderertext1"/> |
191 | <attributes> | 340 | <attributes> |
192 | <attribute name="pixbuf">3</attribute> | 341 | <attribute name="text">11</attribute> |
193 | </attributes> | 342 | </attributes> |
194 | </child> | 343 | </child> |
195 | </object> | 344 | </object> |
196 | </child> | 345 | </child> |
197 | <child> | 346 | <child> |
198 | <object class="GtkTreeViewColumn" id="GNUNET_PEERINFO_GTK_main_window_address_treeviewcolumn"> | 347 | <object class="GtkTreeViewColumn" id="treeviewcolumn1"> |
199 | <property name="sizing">autosize</property> | 348 | <property name="sizing">autosize</property> |
200 | <property name="title">Addresses</property> | 349 | <property name="title" translatable="yes">State</property> |
201 | <property name="expand">True</property> | 350 | <property name="reorderable">True</property> |
202 | <property name="clickable">True</property> | 351 | <property name="sort_indicator">True</property> |
203 | <property name="sort_column_id">6</property> | 352 | <property name="sort_column_id">16</property> |
204 | <child> | 353 | <child> |
205 | <object class="GtkCellRendererText" id="GNUNET_PEERINFO_GTK_main_window_addresses_cellrenderertext"/> | 354 | <object class="GtkCellRendererText" id="cellrenderertext2"/> |
206 | <attributes> | 355 | <attributes> |
207 | <attribute name="text">6</attribute> | 356 | <attribute name="text">16</attribute> |
208 | </attributes> | 357 | </attributes> |
209 | </child> | 358 | </child> |
210 | </object> | 359 | </object> |
@@ -221,21 +370,4 @@ | |||
221 | </object> | 370 | </object> |
222 | </child> | 371 | </child> |
223 | </object> | 372 | </object> |
224 | <object class="GtkAdjustment" id="adjustment3"> | ||
225 | <property name="upper">100</property> | ||
226 | <property name="step_increment">1</property> | ||
227 | <property name="page_increment">10</property> | ||
228 | <property name="page_size">10</property> | ||
229 | </object> | ||
230 | <object class="GtkAdjustment" id="adjustment4"> | ||
231 | <property name="upper">100</property> | ||
232 | <property name="step_increment">1</property> | ||
233 | <property name="page_increment">10</property> | ||
234 | <property name="page_size">10</property> | ||
235 | </object> | ||
236 | <object class="GtkImage" id="connected_image"> | ||
237 | <property name="visible">True</property> | ||
238 | <property name="can_focus">False</property> | ||
239 | <property name="stock">gtk-connect</property> | ||
240 | </object> | ||
241 | </interface> | 373 | </interface> |
diff --git a/src/peerinfo/Makefile.am b/src/peerinfo/Makefile.am index 7643d316..5b2992ff 100644 --- a/src/peerinfo/Makefile.am +++ b/src/peerinfo/Makefile.am | |||
@@ -18,7 +18,7 @@ gnunet_peerinfo_gtk_LDADD = \ | |||
18 | $(top_builddir)/src/lib/libgnunetgtk.la \ | 18 | $(top_builddir)/src/lib/libgnunetgtk.la \ |
19 | @GTK_LIBS@ \ | 19 | @GTK_LIBS@ \ |
20 | @GLADE_LIBS@ @GNUNET_LIBS@ @unique_LIBS@ \ | 20 | @GLADE_LIBS@ @GNUNET_LIBS@ @unique_LIBS@ \ |
21 | -lgnunetutil -lgnunetpeerinfo -lgnunettransport -lgnunetats -lgnunetfriends \ | 21 | -lgnunetutil -lgnunetpeerinfo -lgnunettransport -lgnunetats -lgnunetcore -lgnunetfriends \ |
22 | $(INTLLIBS) | 22 | $(INTLLIBS) |
23 | gnunet_peerinfo_gtk_LDFLAGS = \ | 23 | gnunet_peerinfo_gtk_LDFLAGS = \ |
24 | -export-dynamic | 24 | -export-dynamic |
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c index 29d0c5ca..f07e2784 100644 --- a/src/peerinfo/gnunet-peerinfo-gtk.c +++ b/src/peerinfo/gnunet-peerinfo-gtk.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010, 2012, 2013 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2014 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -27,6 +27,7 @@ | |||
27 | #include <gnunet/gnunet_peerinfo_service.h> | 27 | #include <gnunet/gnunet_peerinfo_service.h> |
28 | #include <gnunet/gnunet_transport_service.h> | 28 | #include <gnunet/gnunet_transport_service.h> |
29 | #include <gnunet/gnunet_ats_service.h> | 29 | #include <gnunet/gnunet_ats_service.h> |
30 | #include <gnunet/gnunet_core_service.h> | ||
30 | #include <gnunet/gnunet_friends_lib.h> | 31 | #include <gnunet/gnunet_friends_lib.h> |
31 | #include "gnunet-peerinfo-gtk-flags.h" | 32 | #include "gnunet-peerinfo-gtk-flags.h" |
32 | 33 | ||
@@ -46,54 +47,164 @@ enum PEERINFO_ModelColumns | |||
46 | PEERINFO_MC_PEER_IDENTITY_STRING = 0, | 47 | PEERINFO_MC_PEER_IDENTITY_STRING = 0, |
47 | 48 | ||
48 | /** | 49 | /** |
50 | * A gchararray | ||
51 | */ | ||
52 | PEERINFO_MC_COUNTRY_NAME = 1, | ||
53 | |||
54 | /** | ||
55 | * A GdkPixbuf | ||
56 | */ | ||
57 | PEERINFO_MC_COUNTRY_FLAG = 2, | ||
58 | |||
59 | /** | ||
49 | * A guint | 60 | * A guint |
50 | */ | 61 | */ |
51 | PEERINFO_MC_NUMBER_OF_ADDRESSES = 1, | 62 | PEERINFO_MC_BANDWIDTH_IN = 3, |
63 | |||
64 | /** | ||
65 | * A guint | ||
66 | */ | ||
67 | PEERINFO_MC_BANDWIDTH_OUT = 4, | ||
68 | |||
69 | /** | ||
70 | * A GdkPixbuf | ||
71 | */ | ||
72 | PEERINFO_MC_ATS_CONNECTIVITY_LED = 5, | ||
73 | |||
74 | /** | ||
75 | * A gboolean | ||
76 | */ | ||
77 | PEERINFO_MC_ATS_SELECTED_STATUS = 6, | ||
78 | |||
79 | /** | ||
80 | * A GdkPixbuf | ||
81 | */ | ||
82 | PEERINFO_MC_CORE_CONNECTIVITY_LED = 7, | ||
83 | |||
84 | /** | ||
85 | * A gboolean | ||
86 | */ | ||
87 | PEERINFO_MC_CORE_CONNECTED_STATUS = 8, | ||
88 | |||
89 | /** | ||
90 | * A gboolean | ||
91 | */ | ||
92 | PEERINFO_MC_IS_FRIEND = 9, | ||
93 | |||
94 | /** | ||
95 | * A `struct PeerInfo *` | ||
96 | */ | ||
97 | PEERINFO_MC_PEERINFO = 10, | ||
52 | 98 | ||
53 | /** | 99 | /** |
54 | * A gchararray | 100 | * A gchararray |
55 | */ | 101 | */ |
56 | PEERINFO_MC_COUNTRY_NAME = 2, | 102 | PEERINFO_MC_PLUGIN_NAME = 11, |
103 | |||
104 | /** | ||
105 | * A gchararray | ||
106 | */ | ||
107 | PEERINFO_MC_ADDRESS_AS_STRING = 12, | ||
57 | 108 | ||
58 | /** | 109 | /** |
59 | * A GdkPixbuf | 110 | * A GdkPixbuf |
60 | */ | 111 | */ |
61 | PEERINFO_MC_COUNTRY_FLAG = 3, | 112 | PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED = 13, |
113 | |||
114 | /** | ||
115 | * A gboolean | ||
116 | */ | ||
117 | PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS = 14, | ||
62 | 118 | ||
63 | /** | 119 | /** |
64 | * A guint64 | 120 | * A gchararray |
65 | */ | 121 | */ |
66 | PEERINFO_MC_BANDWIDTH_IN = 4, | 122 | PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING = 15, |
67 | 123 | ||
68 | /** | 124 | /** |
69 | * A guint64 | 125 | * A gchararray |
70 | */ | 126 | */ |
71 | PEERINFO_MC_BANDWIDTH_OUT = 5, | 127 | PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING = 16, |
72 | 128 | ||
73 | /** | 129 | /** |
74 | * A gchararray | 130 | * A gchararray |
75 | */ | 131 | */ |
76 | PEERINFO_MC_ADDRESS_AS_STRING = 6, | 132 | PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING = 17, |
77 | 133 | ||
78 | /** | 134 | /** |
79 | * A GdkPixbuf | 135 | * A GdkPixbuf |
80 | */ | 136 | */ |
81 | PEERINFO_MC_CONNECTIVITY_LED = 7, | 137 | PEERINFO_MC_VALIDATION_STATE_LED = 18, |
82 | 138 | ||
83 | /** | 139 | /** |
84 | * A gboolean | 140 | * A gboolean |
85 | */ | 141 | */ |
86 | PEERINFO_MC_CONNECTED_STATUS = 8, | 142 | PEERINFO_MC_VALIDATION_IS_VALID = 19, |
143 | |||
144 | /** | ||
145 | * A gchararray | ||
146 | */ | ||
147 | PEERINFO_MC_VALIDATION_TIMEOUT_AS_STRING = 20, | ||
87 | 148 | ||
88 | /** | 149 | /** |
89 | * A gboolean | 150 | * A gboolean |
90 | */ | 151 | */ |
91 | PEERINFO_MC_IS_FRIEND = 9, | 152 | PEERINFO_MC_PLUGIN_CONNECTIVITY_LED = 21, |
92 | 153 | ||
93 | /** | 154 | /** |
94 | * A `struct PeerInfo *` | 155 | * A gboolean |
156 | */ | ||
157 | PEERINFO_MC_PLUGIN_CONNECTIVITY_STATUS = 22, | ||
158 | |||
159 | /** | ||
160 | * A gchararray | ||
161 | */ | ||
162 | PEERINFO_MC_PLUGIN_CONNECTIVITY_TIMEOUT_AS_STRING = 23, | ||
163 | |||
164 | /** | ||
165 | * A gboolean | ||
166 | */ | ||
167 | PEERINFO_MC_SHOW_FRIEND = 24 | ||
168 | |||
169 | }; | ||
170 | |||
171 | |||
172 | /** | ||
173 | * Information about an address of the peer. | ||
174 | */ | ||
175 | struct PeerAddress | ||
176 | { | ||
177 | |||
178 | /** | ||
179 | * DLL. | ||
180 | */ | ||
181 | struct PeerAddress *next; | ||
182 | |||
183 | /** | ||
184 | * DLL. | ||
185 | */ | ||
186 | struct PeerAddress *prev; | ||
187 | |||
188 | /** | ||
189 | * Reference to the peer in the view. | ||
190 | */ | ||
191 | GtkTreeRowReference *rr; | ||
192 | |||
193 | /** | ||
194 | * Handle for address to string conversion. | ||
195 | */ | ||
196 | struct GNUNET_TRANSPORT_AddressToStringContext *tos; | ||
197 | |||
198 | /** | ||
199 | * Binary address, allocated at the end of the struct. | ||
200 | */ | ||
201 | const void *addr; | ||
202 | |||
203 | /** | ||
204 | * Number of bytes in @e addr. | ||
95 | */ | 205 | */ |
96 | PEERINFO_MC_PEERINFO = 10 | 206 | size_t addr_len; |
207 | |||
97 | }; | 208 | }; |
98 | 209 | ||
99 | 210 | ||
@@ -113,19 +224,20 @@ struct PeerInfo | |||
113 | struct GNUNET_TRANSPORT_PeerIterateContext *palc; | 224 | struct GNUNET_TRANSPORT_PeerIterateContext *palc; |
114 | 225 | ||
115 | /** | 226 | /** |
116 | * Handle for address to string conversion. | ||
117 | */ | ||
118 | struct GNUNET_TRANSPORT_AddressToStringContext *tos; | ||
119 | |||
120 | /** | ||
121 | * Identity of the peer for this entry. | 227 | * Identity of the peer for this entry. |
122 | */ | 228 | */ |
123 | struct GNUNET_PeerIdentity pid; | 229 | struct GNUNET_PeerIdentity pid; |
124 | 230 | ||
125 | /** | 231 | /** |
126 | * Did we get any address? | 232 | * Head of DLL with addresses of this peer. |
127 | */ | 233 | */ |
128 | int got_address; | 234 | struct PeerAddress *pa_head; |
235 | |||
236 | /** | ||
237 | * Tail of DLL with addresses of this peer. | ||
238 | */ | ||
239 | struct PeerAddress *pa_tail; | ||
240 | |||
129 | }; | 241 | }; |
130 | 242 | ||
131 | 243 | ||
@@ -150,6 +262,21 @@ static struct GNUNET_ATS_PerformanceHandle *ats; | |||
150 | static struct GNUNET_CONTAINER_MultiPeerMap *peer2info; | 262 | static struct GNUNET_CONTAINER_MultiPeerMap *peer2info; |
151 | 263 | ||
152 | /** | 264 | /** |
265 | * Monitoring transport neighbours | ||
266 | */ | ||
267 | static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc; | ||
268 | |||
269 | /** | ||
270 | * Monitoring transport validation operations. | ||
271 | */ | ||
272 | static struct GNUNET_TRANSPORT_ValidationMonitoringContext *vmc; | ||
273 | |||
274 | /** | ||
275 | * Monitoring core connectivity. | ||
276 | */ | ||
277 | static struct GNUNET_CORE_Handle *core; | ||
278 | |||
279 | /** | ||
153 | * Should gnunet-peerinfo-gtk start in tray mode? | 280 | * Should gnunet-peerinfo-gtk start in tray mode? |
154 | */ | 281 | */ |
155 | static int tray_only; | 282 | static int tray_only; |
@@ -204,12 +331,12 @@ get_object (const char *name) | |||
204 | 331 | ||
205 | 332 | ||
206 | /** | 333 | /** |
207 | * Function called on each entry in the 'peer2info' map | 334 | * Function called on each entry in the #peer2info map |
208 | * to free the associated path. | 335 | * to free the associated path. |
209 | * | 336 | * |
210 | * @param cls unused | 337 | * @param cls unused |
211 | * @param key peer identity | 338 | * @param key peer identity |
212 | * @param value the 'struct PeerInfo' | 339 | * @param value the `struct PeerInfo` |
213 | * @return #GNUNET_OK (continue to iterate) | 340 | * @return #GNUNET_OK (continue to iterate) |
214 | */ | 341 | */ |
215 | static int | 342 | static int |
@@ -218,16 +345,25 @@ free_paths (void *cls, | |||
218 | void *value) | 345 | void *value) |
219 | { | 346 | { |
220 | struct PeerInfo *info = value; | 347 | struct PeerInfo *info = value; |
348 | struct PeerAddress *pa; | ||
221 | 349 | ||
222 | if (NULL != info->palc) | 350 | if (NULL != info->palc) |
223 | { | 351 | { |
224 | GNUNET_TRANSPORT_peer_get_active_addresses_cancel (info->palc); | 352 | GNUNET_TRANSPORT_peer_get_active_addresses_cancel (info->palc); |
225 | info->palc = NULL; | 353 | info->palc = NULL; |
226 | } | 354 | } |
227 | if (NULL != info->tos) | 355 | while (NULL != (pa = info->pa_head)) |
228 | { | 356 | { |
229 | GNUNET_TRANSPORT_address_to_string_cancel (info->tos); | 357 | GNUNET_CONTAINER_DLL_remove (info->pa_head, |
230 | info->tos = NULL; | 358 | info->pa_tail, |
359 | pa); | ||
360 | if (NULL != pa->tos) | ||
361 | { | ||
362 | GNUNET_TRANSPORT_address_to_string_cancel (pa->tos); | ||
363 | pa->tos = NULL; | ||
364 | } | ||
365 | gtk_tree_row_reference_free (pa->rr); | ||
366 | GNUNET_free (pa); | ||
231 | } | 367 | } |
232 | gtk_tree_row_reference_free (info->rr); | 368 | gtk_tree_row_reference_free (info->rr); |
233 | GNUNET_free (info); | 369 | GNUNET_free (info); |
@@ -242,7 +378,8 @@ free_paths (void *cls, | |||
242 | * @param tc scheduler context, unused | 378 | * @param tc scheduler context, unused |
243 | */ | 379 | */ |
244 | static void | 380 | static void |
245 | shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 381 | shutdown_task (void *cls, |
382 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
246 | { | 383 | { |
247 | GNUNET_GTK_tray_icon_destroy (); | 384 | GNUNET_GTK_tray_icon_destroy (); |
248 | GNUNET_GTK_main_loop_quit (ml); | 385 | GNUNET_GTK_main_loop_quit (ml); |
@@ -257,6 +394,21 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
257 | GNUNET_ATS_performance_done (ats); | 394 | GNUNET_ATS_performance_done (ats); |
258 | ats = NULL; | 395 | ats = NULL; |
259 | } | 396 | } |
397 | if (NULL != pmc) | ||
398 | { | ||
399 | GNUNET_TRANSPORT_monitor_peers_cancel (pmc); | ||
400 | pmc = NULL; | ||
401 | } | ||
402 | if (NULL != vmc) | ||
403 | { | ||
404 | GNUNET_TRANSPORT_monitor_validation_entries_cancel (vmc); | ||
405 | vmc = NULL; | ||
406 | } | ||
407 | if (NULL != core) | ||
408 | { | ||
409 | GNUNET_CORE_disconnect (core); | ||
410 | core = NULL; | ||
411 | } | ||
260 | GNUNET_CONTAINER_multipeermap_iterate (peer2info, &free_paths, NULL); | 412 | GNUNET_CONTAINER_multipeermap_iterate (peer2info, &free_paths, NULL); |
261 | GNUNET_CONTAINER_multipeermap_destroy (peer2info); | 413 | GNUNET_CONTAINER_multipeermap_destroy (peer2info); |
262 | peer2info = NULL; | 414 | peer2info = NULL; |
@@ -264,43 +416,32 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
264 | } | 416 | } |
265 | 417 | ||
266 | 418 | ||
267 | |||
268 | /** | 419 | /** |
269 | * Function to call with the text format of an address | 420 | * Function to call with the text format of an address |
270 | * | 421 | * |
271 | * @param cls the 'struct PeerInfo' for which this is a valid address | 422 | * @param cls the `struct PeerAddress` for the address |
272 | * @param address address as a string, NULL on error | 423 | * @param address address as a string, NULL on error |
273 | */ | 424 | */ |
274 | static void | 425 | static void |
275 | peer_address_string_cb (void *cls, const char *address) | 426 | peer_address_string_cb (void *cls, |
427 | const char *address) | ||
276 | { | 428 | { |
277 | struct PeerInfo *info = cls; | 429 | struct PeerAddress *pa = cls; |
278 | GtkTreeIter iter; | 430 | GtkTreeIter iter; |
279 | GtkTreePath *path; | 431 | GtkTreePath *path; |
280 | char *country; | 432 | char *country; |
281 | const char *colon; | 433 | const char *colon; |
282 | const char *dot; | 434 | const char *dot; |
283 | 435 | ||
284 | path = gtk_tree_row_reference_get_path (info->rr); | ||
285 | GNUNET_assert (NULL != path); | ||
286 | GNUNET_assert (TRUE == gtk_tree_model_get_iter (GTK_TREE_MODEL (ls), &iter, path)); | ||
287 | gtk_tree_path_free (path); | ||
288 | if (NULL == address) | 436 | if (NULL == address) |
289 | { | 437 | { |
290 | /* error */ | ||
291 | if (GNUNET_NO == info->got_address) | ||
292 | gtk_list_store_set (ls, &iter, | ||
293 | PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 1, | ||
294 | PEERINFO_MC_COUNTRY_NAME, NULL, | ||
295 | PEERINFO_MC_COUNTRY_FLAG, NULL, | ||
296 | PEERINFO_MC_ADDRESS_AS_STRING, "<no address>", | ||
297 | PEERINFO_MC_CONNECTIVITY_LED, led_green, | ||
298 | PEERINFO_MC_CONNECTED_STATUS, TRUE, | ||
299 | -1); | ||
300 | info->tos = NULL; | 438 | info->tos = NULL; |
301 | return; | 439 | return; |
302 | } | 440 | } |
303 | /* last address, store information in model */ | 441 | path = gtk_tree_row_reference_get_path (info->rr); |
442 | GNUNET_assert (NULL != path); | ||
443 | GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ls), &iter, path)); | ||
444 | gtk_tree_path_free (path); | ||
304 | country = NULL; | 445 | country = NULL; |
305 | colon = strstr (address, ":"); | 446 | colon = strstr (address, ":"); |
306 | if (NULL != colon) | 447 | if (NULL != colon) |
@@ -312,15 +453,11 @@ peer_address_string_cb (void *cls, const char *address) | |||
312 | country = GNUNET_strndup (&dot[1], (colon - dot) - 1); | 453 | country = GNUNET_strndup (&dot[1], (colon - dot) - 1); |
313 | } | 454 | } |
314 | gtk_list_store_set (ls, &iter, | 455 | gtk_list_store_set (ls, &iter, |
315 | PEERINFO_MC_NUMBER_OF_ADDRESSES, 1, | ||
316 | PEERINFO_MC_COUNTRY_NAME, country, | 456 | PEERINFO_MC_COUNTRY_NAME, country, |
317 | PEERINFO_MC_COUNTRY_FLAG, GNUNET_PEERINFO_GTK_get_flag (country), | 457 | PEERINFO_MC_COUNTRY_FLAG, GNUNET_PEERINFO_GTK_get_flag (country), |
318 | PEERINFO_MC_ADDRESS_AS_STRING, address, | 458 | PEERINFO_MC_ADDRESS_AS_STRING, address, |
319 | PEERINFO_MC_CONNECTIVITY_LED, led_green, | ||
320 | PEERINFO_MC_CONNECTED_STATUS, TRUE, | ||
321 | -1); | 459 | -1); |
322 | GNUNET_free_non_null (country); | 460 | GNUNET_free_non_null (country); |
323 | info->got_address = GNUNET_YES; | ||
324 | } | 461 | } |
325 | 462 | ||
326 | 463 | ||
@@ -337,36 +474,36 @@ peer_address_cb (void *cls, | |||
337 | const struct GNUNET_HELLO_Address *address) | 474 | const struct GNUNET_HELLO_Address *address) |
338 | { | 475 | { |
339 | struct PeerInfo *info = cls; | 476 | struct PeerInfo *info = cls; |
477 | struct PeerAddress *pa; | ||
340 | GtkTreeIter iter; | 478 | GtkTreeIter iter; |
341 | GtkTreePath *path; | 479 | GtkTreePath *path; |
342 | 480 | ||
343 | path = gtk_tree_row_reference_get_path (info->rr); | 481 | path = gtk_tree_row_reference_get_path (info->rr); |
344 | GNUNET_assert (NULL != path); | 482 | GNUNET_assert (NULL != path); |
345 | GNUNET_assert (TRUE == gtk_tree_model_get_iter (GTK_TREE_MODEL (ls), &iter, path)); | 483 | GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ls), &iter, path)); |
346 | gtk_tree_path_free (path); | 484 | gtk_tree_path_free (path); |
347 | if (NULL == address) | 485 | if (NULL == address) |
348 | { | 486 | { |
349 | /* disconnect */ | 487 | /* disconnect */ |
350 | gtk_list_store_set (ls, &iter, | 488 | gtk_list_store_set (ls, &iter, |
351 | PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 0, | 489 | // PEERINFO_MC_CONNECTIVITY_LED, led_red, |
352 | PEERINFO_MC_CONNECTIVITY_LED, led_red, | 490 | // PEERINFO_MC_CONNECTED_STATUS, FALSE, |
353 | PEERINFO_MC_CONNECTED_STATUS, FALSE, | ||
354 | -1); | 491 | -1); |
355 | return; | 492 | return; |
356 | } | 493 | } |
357 | gtk_list_store_set (ls, &iter, | 494 | gtk_list_store_set (ls, &iter, |
358 | PEERINFO_MC_NUMBER_OF_ADDRESSES, 1, | 495 | // PEERINFO_MC_CONNECTIVITY_LED, led_green, |
359 | PEERINFO_MC_CONNECTIVITY_LED, led_green, | 496 | // PEERINFO_MC_CONNECTED_STATUS, TRUE, |
360 | PEERINFO_MC_CONNECTED_STATUS, TRUE, | ||
361 | -1); | 497 | -1); |
498 | #if 0 | ||
362 | if (NULL != info->tos) | 499 | if (NULL != info->tos) |
363 | GNUNET_TRANSPORT_address_to_string_cancel (info->tos); | 500 | GNUNET_TRANSPORT_address_to_string_cancel (info->tos); |
364 | info->got_address = GNUNET_NO; | 501 | pa->tos = |
365 | info->tos = | 502 | GNUNET_TRANSPORT_address_to_string (get_configuration (), address, |
366 | GNUNET_TRANSPORT_address_to_string (get_configuration (), address, | 503 | GNUNET_NO, |
367 | GNUNET_NO, | 504 | GNUNET_TIME_UNIT_FOREVER_REL, |
368 | GNUNET_TIME_UNIT_FOREVER_REL, | 505 | &peer_address_string_cb, pa); |
369 | &peer_address_string_cb, info); | 506 | #endif |
370 | } | 507 | } |
371 | 508 | ||
372 | 509 | ||
@@ -396,14 +533,10 @@ peerinfo_processor (void *cls, | |||
396 | gtk_list_store_append (ls, &iter); | 533 | gtk_list_store_append (ls, &iter); |
397 | gtk_list_store_set (ls, &iter, | 534 | gtk_list_store_set (ls, &iter, |
398 | PEERINFO_MC_PEER_IDENTITY_STRING, GNUNET_i2s (peer), | 535 | PEERINFO_MC_PEER_IDENTITY_STRING, GNUNET_i2s (peer), |
399 | PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 0, | ||
400 | PEERINFO_MC_COUNTRY_NAME, "", | 536 | PEERINFO_MC_COUNTRY_NAME, "", |
401 | PEERINFO_MC_COUNTRY_FLAG, NULL, | 537 | PEERINFO_MC_COUNTRY_FLAG, NULL, |
402 | PEERINFO_MC_BANDWIDTH_IN, (guint64) 0, | 538 | PEERINFO_MC_BANDWIDTH_IN, (guint) 0, |
403 | PEERINFO_MC_BANDWIDTH_OUT, (guint64) 0, | 539 | PEERINFO_MC_BANDWIDTH_OUT, (guint) 0, |
404 | PEERINFO_MC_ADDRESS_AS_STRING, "", | ||
405 | PEERINFO_MC_CONNECTIVITY_LED, led_red, | ||
406 | PEERINFO_MC_CONNECTED_STATUS, FALSE, | ||
407 | PEERINFO_MC_IS_FRIEND, GNUNET_CONTAINER_multipeermap_contains (friends, | 540 | PEERINFO_MC_IS_FRIEND, GNUNET_CONTAINER_multipeermap_contains (friends, |
408 | peer), | 541 | peer), |
409 | PEERINFO_MC_PEERINFO, info, | 542 | PEERINFO_MC_PEERINFO, info, |
@@ -542,8 +675,7 @@ GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb (GtkCellRe | |||
542 | GNUNET_break (0); | 675 | GNUNET_break (0); |
543 | return; | 676 | return; |
544 | } | 677 | } |
545 | if (TRUE != | 678 | if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ls), &old, path)) |
546 | gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ls), &old, path)) | ||
547 | { | 679 | { |
548 | GNUNET_break (0); | 680 | GNUNET_break (0); |
549 | return; | 681 | return; |
@@ -629,6 +761,73 @@ add_friend (void *cls, | |||
629 | 761 | ||
630 | 762 | ||
631 | /** | 763 | /** |
764 | * Function to call with information about a peer | ||
765 | * | ||
766 | * @param cls closure | ||
767 | * @param peer peer this update is about, | ||
768 | * NULL if this is the final last callback for a iteration operation | ||
769 | * @param address address, NULL for disconnect notification in monitor mode | ||
770 | * @param state current state this peer is in | ||
771 | * @param state_timeout timeout for the current state of the peer | ||
772 | */ | ||
773 | static void | ||
774 | transport_peer_cb (void *cls, | ||
775 | const struct GNUNET_PeerIdentity *peer, | ||
776 | const struct GNUNET_HELLO_Address *address, | ||
777 | enum GNUNET_TRANSPORT_PeerState state, | ||
778 | struct GNUNET_TIME_Absolute state_timeout) | ||
779 | { | ||
780 | } | ||
781 | |||
782 | |||
783 | /** | ||
784 | * Function to call with validation information about a peer | ||
785 | * | ||
786 | * @param cls closure | ||
787 | * @param peer peer this update is about, | ||
788 | * NULL if this is the final last callback for a iteration operation | ||
789 | * @param address address, NULL for disconnect notification in monitor mode | ||
790 | * @param valid_until when does this address expire | ||
791 | * @param next_validation time of the next validation operation | ||
792 | * | ||
793 | */ | ||
794 | static void | ||
795 | validation_monitor_cb (void *cls, | ||
796 | const struct GNUNET_PeerIdentity *peer, | ||
797 | const struct GNUNET_HELLO_Address *address, | ||
798 | struct GNUNET_TIME_Absolute valid_until, | ||
799 | struct GNUNET_TIME_Absolute next_validation) | ||
800 | { | ||
801 | } | ||
802 | |||
803 | |||
804 | /** | ||
805 | * Method called whenever a given peer connects. | ||
806 | * | ||
807 | * @param cls closure | ||
808 | * @param peer peer identity this notification is about | ||
809 | */ | ||
810 | static void | ||
811 | handle_core_connect (void *cls, | ||
812 | const struct GNUNET_PeerIdentity *peer) | ||
813 | { | ||
814 | } | ||
815 | |||
816 | |||
817 | /** | ||
818 | * Method called whenever a peer disconnects. | ||
819 | * | ||
820 | * @param cls closure | ||
821 | * @param peer peer identity this notification is about | ||
822 | */ | ||
823 | static void | ||
824 | handle_core_disconnect (void *cls, | ||
825 | const struct GNUNET_PeerIdentity *peer) | ||
826 | { | ||
827 | } | ||
828 | |||
829 | |||
830 | /** | ||
632 | * Actual main function run right after GNUnet's scheduler | 831 | * Actual main function run right after GNUnet's scheduler |
633 | * is initialized. Initializes up GTK and Glade. | 832 | * is initialized. Initializes up GTK and Glade. |
634 | * | 833 | * |
@@ -636,7 +835,8 @@ add_friend (void *cls, | |||
636 | * @param tc schedule context | 835 | * @param tc schedule context |
637 | */ | 836 | */ |
638 | static void | 837 | static void |
639 | run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 838 | run (void *cls, |
839 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
640 | { | 840 | { |
641 | GtkWidget *main_window; | 841 | GtkWidget *main_window; |
642 | 842 | ||
@@ -656,17 +856,29 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
656 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 856 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
657 | _("Failed to parse list of friends\n")); | 857 | _("Failed to parse list of friends\n")); |
658 | peer2info = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); | 858 | peer2info = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); |
659 | pnc = | 859 | core = GNUNET_CORE_connect (get_configuration (), |
660 | GNUNET_PEERINFO_notify (get_configuration (), | 860 | NULL, |
661 | GNUNET_NO, | 861 | NULL, |
662 | &peerinfo_processor, NULL); | 862 | &handle_core_connect, |
663 | if (NULL == pnc) | 863 | &handle_core_disconnect, |
664 | { | 864 | NULL, GNUNET_NO, |
665 | fprintf (stderr, | 865 | NULL, GNUNET_NO, |
666 | _("Failed to initialize communication with peerinfo service!\n")); | 866 | NULL); |
667 | GNUNET_SCHEDULER_shutdown (); | 867 | pnc = GNUNET_PEERINFO_notify (get_configuration (), |
668 | return; | 868 | GNUNET_NO, |
669 | } | 869 | &peerinfo_processor, NULL); |
870 | pmc = GNUNET_TRANSPORT_monitor_peers (get_configuration (), | ||
871 | NULL, | ||
872 | GNUNET_NO, | ||
873 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
874 | &transport_peer_cb, | ||
875 | NULL); | ||
876 | vmc = GNUNET_TRANSPORT_monitor_validation_entries (get_configuration (), | ||
877 | NULL, | ||
878 | GNUNET_NO, | ||
879 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
880 | &validation_monitor_cb, | ||
881 | NULL); | ||
670 | ats = GNUNET_ATS_performance_init (get_configuration (), &status_cb, NULL); | 882 | ats = GNUNET_ATS_performance_init (get_configuration (), &status_cb, NULL); |
671 | /* setup main window */ | 883 | /* setup main window */ |
672 | main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window")); | 884 | main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window")); |