aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-07-26 18:22:54 +0000
committerNathan S. Evans <evans@in.tum.de>2011-07-26 18:22:54 +0000
commit81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd (patch)
tree35b65462b9209af4bd610552bb485ad22487400e /src/include
parentbf4a9d8364675b34ac18d505e508006e2b773670 (diff)
downloadgnunet-81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd.tar.gz
gnunet-81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd.zip
start service
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_peerinfo_service.h71
-rw-r--r--src/include/gnunet_testing_lib.h38
2 files changed, 106 insertions, 3 deletions
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h
index 1411168c0..ff4d99d95 100644
--- a/src/include/gnunet_peerinfo_service.h
+++ b/src/include/gnunet_peerinfo_service.h
@@ -89,6 +89,45 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
89 89
90 90
91/** 91/**
92 * Connect to the peerinfo service.
93 *
94 * @param cfg configuration to use
95 * @return NULL on error (configuration related, actual connection
96 * etablishment may happen asynchronously).
97 */
98struct GNUNET_PEERINFO_Handle *
99GNUNET_PEERINFO_standalone_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
100
101
102/**
103 * Disconnect from the peerinfo service. Note that all iterators must
104 * have completed or have been cancelled by the time this function is
105 * called (otherwise, calling this function is a serious error).
106 * Furthermore, if 'GNUNET_PEERINFO_add_peer' operations are still
107 * pending, they will be cancelled silently on disconnect.
108 *
109 * @param h handle to disconnect
110 */
111void
112GNUNET_PEERINFO_standalone_disconnect (struct GNUNET_PEERINFO_Handle *h);
113
114
115/**
116 * Add a host to the persistent list. This method operates in
117 * semi-reliable mode: if the transmission is not completed by
118 * the time 'GNUNET_PEERINFO_disconnect' is called, it will be
119 * aborted. Furthermore, if a second HELLO is added for the
120 * same peer before the first one was transmitted, PEERINFO may
121 * merge the two HELLOs prior to transmission to the service.
122 *
123 * @param h handle to the peerinfo service
124 * @param hello the verified (!) HELLO message
125 */
126void
127GNUNET_PEERINFO_standalone_add_peer (struct GNUNET_PEERINFO_Handle *h,
128 const struct GNUNET_HELLO_Message *hello);
129
130/**
92 * Type of an iterator over the hosts. Note that each 131 * Type of an iterator over the hosts. Note that each
93 * host will be called with each available protocol. 132 * host will be called with each available protocol.
94 * 133 *
@@ -144,9 +183,41 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
144void 183void
145GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic); 184GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic);
146 185
186/**
187 * Call a method for each known matching host and change its trust
188 * value. The callback method will be invoked once for each matching
189 * host and then finally once with a NULL pointer. After that final
190 * invocation, the iterator context must no longer be used.
191 *
192 * Instead of calling this function with 'peer == NULL'
193 * it is often better to use 'GNUNET_PEERINFO_notify'.
194 *
195 * @param h handle to the peerinfo service
196 * @param peer restrict iteration to this peer only (can be NULL)
197 * @param timeout how long to wait until timing out
198 * @param callback the method to call for each peer
199 * @param callback_cls closure for callback
200 * @return NULL on error (in this case, 'callback' is never called!),
201 * otherwise an iterator context
202 */
203struct GNUNET_PEERINFO_IteratorContext *
204GNUNET_PEERINFO_standalone_iterate (struct GNUNET_PEERINFO_Handle *h,
205 const struct GNUNET_PeerIdentity *peer,
206 struct GNUNET_TIME_Relative timeout,
207 GNUNET_PEERINFO_Processor callback,
208 void *callback_cls);
209
147 210
148 211
149/** 212/**
213 * Cancel an iteration over peer information.
214 *
215 * @param ic context of the iterator to cancel
216 */
217void
218GNUNET_PEERINFO_standalone_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic);
219
220/**
150 * Handle for notifications about changes to the set of known peers. 221 * Handle for notifications about changes to the set of known peers.
151 */ 222 */
152struct GNUNET_PEERINFO_NotifyContext; 223struct GNUNET_PEERINFO_NotifyContext;
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index 0b998cf95..9d85f3af9 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -514,12 +514,27 @@ GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon,
514 void *cb_cls); 514 void *cb_cls);
515 515
516/** 516/**
517 * Stops a GNUnet daemon. 517 * Starts a GNUnet daemon's service.
518 * 518 *
519 * @param d the daemon for which the service should be started 519 * @param d the daemon for which the service should be started
520 * @param service the name of the service to start 520 * @param service the name of the service to start
521 * @param timeout how long to wait for process for shutdown to complete 521 * @param timeout how long to wait for process for startup
522 * @param cb function called once the daemon was stopped 522 * @param cb function called once gnunet-arm returns
523 * @param cb_cls closure for cb
524 */
525void
526GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d,
527 char *service,
528 struct GNUNET_TIME_Relative timeout,
529 GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls);
530
531/**
532 * Starts a GNUnet daemon's service which has been previously turned off.
533 *
534 * @param d the daemon for which the service should be started
535 * @param service the name of the service to start
536 * @param timeout how long to wait for process for startup
537 * @param cb function called once gnunet-arm returns
523 * @param cb_cls closure for cb 538 * @param cb_cls closure for cb
524 */ 539 */
525void 540void
@@ -759,6 +774,23 @@ GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg,
759 struct GNUNET_TIME_Relative timeout, 774 struct GNUNET_TIME_Relative timeout,
760 GNUNET_TESTING_NotifyCompletion cb, 775 GNUNET_TESTING_NotifyCompletion cb,
761 void *cb_cls); 776 void *cb_cls);
777/*
778 * Start a given service for each of the peers in the peer group.
779 *
780 * @param pg handle for the peer group
781 * @param service the service to start
782 * @param timeout how long to wait for operations to finish before
783 * giving up
784 * @param cb function to call once finished
785 * @param cb_cls closure for cb
786 *
787 */
788void
789GNUNET_TESTING_daemons_start_service (struct GNUNET_TESTING_PeerGroup *pg,
790 char *service,
791 struct GNUNET_TIME_Relative timeout,
792 GNUNET_TESTING_NotifyCompletion cb,
793 void *cb_cls);
762 794
763/** 795/**
764 * Callback function to process statistic values. 796 * Callback function to process statistic values.