summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-07-07 06:27:10 +0000
committerChristian Grothoff <christian@grothoff.org>2010-07-07 06:27:10 +0000
commitac2de52a5de68f6f4f13b7aa01a481869fffc6aa (patch)
tree856c9f0b2f55f8cae99f3c7b3bf22beaecbf58da /src/include
parentc1a3c11f8665432d9db6d549c28c0329668e66af (diff)
downloadgnunet-ac2de52a5de68f6f4f13b7aa01a481869fffc6aa.tar.gz
gnunet-ac2de52a5de68f6f4f13b7aa01a481869fffc6aa.zip
hacks from trip
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_core_service.h22
-rw-r--r--src/include/gnunet_peerinfo_service.h13
-rw-r--r--src/include/gnunet_protocols.h70
-rw-r--r--src/include/gnunet_statistics_service.h22
4 files changed, 91 insertions, 36 deletions
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index 069bf5202..2434e3770 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -64,6 +64,26 @@ typedef void (*GNUNET_CORE_ConnectEventHandler) (void *cls,
64 struct GNUNET_TIME_Relative latency, 64 struct GNUNET_TIME_Relative latency,
65 uint32_t distance); 65 uint32_t distance);
66 66
67/**
68 * Method called whenever a given peer has a status change.
69 *
70 * @param cls closure
71 * @param peer peer identity this notification is about
72 * @param latency reported latency of the connection with 'other'
73 * @param distance reported distance (DV) to 'other'
74 * @param bandwidth_in available amount of inbound bandwidth
75 * @param bandwidth_out available amount of outbound bandwidth
76 * @param timeout absolute time when this peer will time out
77 * unless we see some further activity from it
78 */
79typedef void (*GNUNET_CORE_PeerStatusEventHandler) (void *cls,
80 const struct
81 GNUNET_PeerIdentity * peer,
82 struct GNUNET_TIME_Relative latency,
83 uint32_t distance,
84 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
85 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
86 struct GNUNET_TIME_Absolute timeout);
67 87
68 88
69/** 89/**
@@ -166,6 +186,7 @@ typedef void
166 * connected to the core service; note that timeout is only meaningful if init is not NULL 186 * connected to the core service; note that timeout is only meaningful if init is not NULL
167 * @param connects function to call on peer connect, can be NULL 187 * @param connects function to call on peer connect, can be NULL
168 * @param disconnects function to call on peer disconnect / timeout, can be NULL 188 * @param disconnects function to call on peer disconnect / timeout, can be NULL
189 * @param status_events function to call on peer status changes, can be NULL
169 * @param inbound_notify function to call for all inbound messages, can be NULL 190 * @param inbound_notify function to call for all inbound messages, can be NULL
170 * note that the core is allowed to drop notifications about inbound 191 * note that the core is allowed to drop notifications about inbound
171 * messages if the client does not process them fast enough (for this 192 * messages if the client does not process them fast enough (for this
@@ -201,6 +222,7 @@ GNUNET_CORE_connect (struct GNUNET_SCHEDULER_Handle *sched,
201 GNUNET_CORE_StartupCallback init, 222 GNUNET_CORE_StartupCallback init,
202 GNUNET_CORE_ConnectEventHandler connects, 223 GNUNET_CORE_ConnectEventHandler connects,
203 GNUNET_CORE_DisconnectEventHandler disconnects, 224 GNUNET_CORE_DisconnectEventHandler disconnects,
225 GNUNET_CORE_PeerStatusEventHandler status_events,
204 GNUNET_CORE_MessageCallback inbound_notify, 226 GNUNET_CORE_MessageCallback inbound_notify,
205 int inbound_hdr_only, 227 int inbound_hdr_only,
206 GNUNET_CORE_MessageCallback outbound_notify, 228 GNUNET_CORE_MessageCallback outbound_notify,
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h
index db5cc37ba..d88c6fb41 100644
--- a/src/include/gnunet_peerinfo_service.h
+++ b/src/include/gnunet_peerinfo_service.h
@@ -20,8 +20,7 @@
20/** 20/**
21 * @file include/gnunet_peerinfo_service.h 21 * @file include/gnunet_peerinfo_service.h
22 * @brief Code to maintain the list of currently known hosts 22 * @brief Code to maintain the list of currently known hosts
23 * (in memory structure of data/hosts) and their trust ratings 23 * (in memory structure of data/hosts).
24 * (in memory structure of data/trust)
25 * @author Christian Grothoff 24 * @author Christian Grothoff
26 */ 25 */
27 26
@@ -98,13 +97,11 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
98 * @param cls closure 97 * @param cls closure
99 * @param peer id of the peer, NULL for last call 98 * @param peer id of the peer, NULL for last call
100 * @param hello hello message for the peer (can be NULL) 99 * @param hello hello message for the peer (can be NULL)
101 * @param trust amount of trust we have in the peer
102 */ 100 */
103typedef void 101typedef void
104 (*GNUNET_PEERINFO_Processor) (void *cls, 102 (*GNUNET_PEERINFO_Processor) (void *cls,
105 const struct GNUNET_PeerIdentity * peer, 103 const struct GNUNET_PeerIdentity * peer,
106 const struct GNUNET_HELLO_Message * hello, 104 const struct GNUNET_HELLO_Message * hello);
107 uint32_t trust);
108 105
109 106
110/** 107/**
@@ -123,12 +120,11 @@ struct GNUNET_PEERINFO_IteratorContext;
123 * being done; however, the trust argument will be set to zero if we 120 * being done; however, the trust argument will be set to zero if we
124 * are done, 1 if we timed out and 2 for fatal error. 121 * are done, 1 if we timed out and 2 for fatal error.
125 * 122 *
126 * Instead of calling this function with 'peer == NULL' and 'trust == 123 * Instead of calling this function with 'peer == NULL'
127 * 0', it is often better to use 'GNUNET_PEERINFO_notify'. 124 * it is often better to use 'GNUNET_PEERINFO_notify'.
128 * 125 *
129 * @param h handle to the peerinfo service 126 * @param h handle to the peerinfo service
130 * @param peer restrict iteration to this peer only (can be NULL) 127 * @param peer restrict iteration to this peer only (can be NULL)
131 * @param trust_delta how much to change the trust in all matching peers
132 * @param timeout how long to wait until timing out 128 * @param timeout how long to wait until timing out
133 * @param callback the method to call for each peer 129 * @param callback the method to call for each peer
134 * @param callback_cls closure for callback 130 * @param callback_cls closure for callback
@@ -138,7 +134,6 @@ struct GNUNET_PEERINFO_IteratorContext;
138struct GNUNET_PEERINFO_IteratorContext * 134struct GNUNET_PEERINFO_IteratorContext *
139GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, 135GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
140 const struct GNUNET_PeerIdentity *peer, 136 const struct GNUNET_PeerIdentity *peer,
141 int trust_delta,
142 struct GNUNET_TIME_Relative timeout, 137 struct GNUNET_TIME_Relative timeout,
143 GNUNET_PEERINFO_Processor callback, 138 GNUNET_PEERINFO_Processor callback,
144 void *callback_cls); 139 void *callback_cls);
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index bfa1314c9..8a1df7ff9 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -52,26 +52,6 @@ extern "C"
52#define GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE 3 52#define GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE 3
53 53
54 54
55/**
56 * Set a statistical value.
57 */
58#define GNUNET_MESSAGE_TYPE_STATISTICS_SET 4
59
60/**
61 * Get a statistical value(s).
62 */
63#define GNUNET_MESSAGE_TYPE_STATISTICS_GET 5
64
65/**
66 * Response to a STATISTICS_GET message (with value).
67 */
68#define GNUNET_MESSAGE_TYPE_STATISTICS_VALUE 6
69
70/**
71 * Response to a STATISTICS_GET message (end of value stream).
72 */
73#define GNUNET_MESSAGE_TYPE_STATISTICS_END 7
74
75 55
76/** 56/**
77 * Request to ARM to start a service. 57 * Request to ARM to start a service.
@@ -345,35 +325,40 @@ extern "C"
345#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT 68 325#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT 68
346 326
347/** 327/**
328 * Notify clients about peer status change.
329 */
330#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_STATUS_CHANGE 69
331
332/**
348 * Notify clients about incoming P2P messages. 333 * Notify clients about incoming P2P messages.
349 */ 334 */
350#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND 69 335#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND 70
351 336
352/** 337/**
353 * Notify clients about outgoing P2P transmissions. 338 * Notify clients about outgoing P2P transmissions.
354 */ 339 */
355#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND 70 340#define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND 71
356 341
357/** 342/**
358 * Request from client to "configure" P2P connection. 343 * Request from client to "configure" P2P connection.
359 */ 344 */
360#define GNUNET_MESSAGE_TYPE_CORE_REQUEST_INFO 71 345#define GNUNET_MESSAGE_TYPE_CORE_REQUEST_INFO 72
361 346
362/** 347/**
363 * Response from server about (possibly updated) P2P 348 * Response from server about (possibly updated) P2P
364 * connection configuration. 349 * connection configuration.
365 */ 350 */
366#define GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO 72 351#define GNUNET_MESSAGE_TYPE_CORE_CONFIGURATION_INFO 73
367 352
368/** 353/**
369 * Request from client with message to transmit. 354 * Request from client with message to transmit.
370 */ 355 */
371#define GNUNET_MESSAGE_TYPE_CORE_SEND 73 356#define GNUNET_MESSAGE_TYPE_CORE_SEND 74
372 357
373/** 358/**
374 * Request from client asking to connect to a peer. 359 * Request from client asking to connect to a peer.
375 */ 360 */
376#define GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT 74 361#define GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT 75
377 362
378 363
379/** 364/**
@@ -584,6 +569,39 @@ extern "C"
584 */ 569 */
585#define GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT 160 570#define GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT 160
586 571
572
573/**
574 * Set a statistical value.
575 */
576#define GNUNET_MESSAGE_TYPE_STATISTICS_SET 168
577
578/**
579 * Get a statistical value(s).
580 */
581#define GNUNET_MESSAGE_TYPE_STATISTICS_GET 169
582
583/**
584 * Response to a STATISTICS_GET message (with value).
585 */
586#define GNUNET_MESSAGE_TYPE_STATISTICS_VALUE 170
587
588/**
589 * Response to a STATISTICS_GET message (end of value stream).
590 */
591#define GNUNET_MESSAGE_TYPE_STATISTICS_END 171
592
593/**
594 * Watch changes to a statistical value. Message format is the same
595 * as for GET, except that the subsystem and entry name must be given.
596 */
597#define GNUNET_MESSAGE_TYPE_STATISTICS_WATCH 172
598
599/**
600 * Changes to a watched value.
601 */
602#define GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE 173
603
604
587/** 605/**
588 * Type used to match 'all' message types. 606 * Type used to match 'all' message types.
589 */ 607 */
diff --git a/src/include/gnunet_statistics_service.h b/src/include/gnunet_statistics_service.h
index 5c166d43d..71c834f2a 100644
--- a/src/include/gnunet_statistics_service.h
+++ b/src/include/gnunet_statistics_service.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2009 Christian Grothoff (and other contributing authors) 3 (C) 2009, 2010 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
@@ -94,6 +94,26 @@ void GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h,
94 94
95 95
96/** 96/**
97 * Watch statistics from the peer (be notified whenever they change).
98 * Note that the only way to cancel a "watch" request is to destroy
99 * the statistics handle given as the first argument to this call.
100 *
101 * @param handle identification of the statistics service
102 * @param subsystem limit to the specified subsystem, never NULL
103 * @param name name of the statistic value, never NULL
104 * @param proc function to call on each value
105 * @param proc_cls closure for proc
106 * @return GNUNET_OK on success, GNUNET_SYSERR on error
107 */
108int
109GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle,
110 const char *subsystem,
111 const char *name,
112 GNUNET_STATISTICS_Iterator proc,
113 void *proc_cls);
114
115
116/**
97 * Continuation called by the "get_all" and "get" functions. 117 * Continuation called by the "get_all" and "get" functions.
98 * 118 *
99 * @param cls closure 119 * @param cls closure