diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-11 22:13:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-11 22:13:37 +0000 |
commit | bb4e48f94a3daba7b0294ce8760a231b0601fa11 (patch) | |
tree | c32408c3060ba0a51bf8ca031d944d478a65f866 /src/include | |
parent | c85579b554836cd5a67e87abb3e11a2d53d6a3e8 (diff) | |
download | gnunet-bb4e48f94a3daba7b0294ce8760a231b0601fa11.tar.gz gnunet-bb4e48f94a3daba7b0294ce8760a231b0601fa11.zip |
adding notification API to peerinfo
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_peerinfo_service.h | 35 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 6 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index 54fc68033..463131e6a 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h | |||
@@ -99,6 +99,41 @@ GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
99 | void *callback_cls); | 99 | void *callback_cls); |
100 | 100 | ||
101 | 101 | ||
102 | /** | ||
103 | * Handle for notifications about changes to the set of known peers. | ||
104 | */ | ||
105 | struct GNUNET_PEERINFO_NotifyContext; | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Call a method whenever our known information about peers | ||
110 | * changes. Initially calls the given function for all known | ||
111 | * peers and then only signals changes. Note that it is | ||
112 | * possible (i.e. on disconnects) that the callback is called | ||
113 | * twice with the same peer information. | ||
114 | * | ||
115 | * @param cfg configuration to use | ||
116 | * @param sched scheduler to use | ||
117 | * @param callback the method to call for each peer | ||
118 | * @param callback_cls closure for callback | ||
119 | * @return NULL on error | ||
120 | */ | ||
121 | struct GNUNET_PEERINFO_NotifyContext * | ||
122 | GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
123 | struct GNUNET_SCHEDULER_Handle *sched, | ||
124 | GNUNET_PEERINFO_Processor callback, | ||
125 | void *callback_cls); | ||
126 | |||
127 | |||
128 | /** | ||
129 | * Stop notifying about changes. | ||
130 | * | ||
131 | * @param nc context to stop notifying | ||
132 | */ | ||
133 | void | ||
134 | GNUNET_PEERINFO_notify_cancel (struct GNUNET_PEERINFO_NotifyContext *nc); | ||
135 | |||
136 | |||
102 | #if 0 /* keep Emacsens' auto-indent happy */ | 137 | #if 0 /* keep Emacsens' auto-indent happy */ |
103 | { | 138 | { |
104 | #endif | 139 | #endif |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 2fd1c26eb..fc73a57c3 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -211,6 +211,12 @@ extern "C" | |||
211 | */ | 211 | */ |
212 | #define GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END 36 | 212 | #define GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END 36 |
213 | 213 | ||
214 | /** | ||
215 | * Start notifying this client about all changes to | ||
216 | * the known peers until it disconnects. | ||
217 | */ | ||
218 | #define GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY 37 | ||
219 | |||
214 | 220 | ||
215 | /** | 221 | /** |
216 | * Message by which a TCP transport notifies | 222 | * Message by which a TCP transport notifies |