diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-21 11:51:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-21 11:51:50 +0000 |
commit | 66d6dc062c1ab92c4855dc061bf45b3e9531b539 (patch) | |
tree | a2998ca713a4699e59554cb9ebf45b049b4ee949 /src/peerinfo/peerinfo_api.c | |
parent | 6c32edc3932553c01d329d026150046ebf95b38f (diff) | |
download | gnunet-66d6dc062c1ab92c4855dc061bf45b3e9531b539.tar.gz gnunet-66d6dc062c1ab92c4855dc061bf45b3e9531b539.zip |
skel
Diffstat (limited to 'src/peerinfo/peerinfo_api.c')
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 126 |
1 files changed, 124 insertions, 2 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 841f14074..89422bcb6 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -30,6 +30,130 @@ | |||
30 | #include "gnunet_time_lib.h" | 30 | #include "gnunet_time_lib.h" |
31 | #include "peerinfo.h" | 31 | #include "peerinfo.h" |
32 | 32 | ||
33 | |||
34 | |||
35 | /** | ||
36 | * Handle to the peerinfo service. | ||
37 | */ | ||
38 | struct GNUNET_PEERINFO_Handle | ||
39 | { | ||
40 | }; | ||
41 | |||
42 | |||
43 | /** | ||
44 | * Connect to the peerinfo service. | ||
45 | * | ||
46 | * @param cfg configuration to use | ||
47 | * @param sched scheduler to use | ||
48 | * @return NULL on error (configuration related, actual connection | ||
49 | * etablishment may happen asynchronously). | ||
50 | */ | ||
51 | struct GNUNET_PEERINFO_Handle * | ||
52 | GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
53 | struct GNUNET_SCHEDULER_Handle *sched) | ||
54 | { | ||
55 | return NULL; | ||
56 | } | ||
57 | |||
58 | |||
59 | /** | ||
60 | * Disconnect from the peerinfo service. Note that all iterators must | ||
61 | * have completed or have been cancelled by the time this function is | ||
62 | * called (otherwise, calling this function is a serious error). | ||
63 | * Furthermore, if 'GNUNET_PEERINFO_add_peer' operations are still | ||
64 | * pending, they will be cancelled silently on disconnect. | ||
65 | * | ||
66 | * @param h handle to disconnect | ||
67 | */ | ||
68 | void | ||
69 | GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h) | ||
70 | { | ||
71 | } | ||
72 | |||
73 | |||
74 | |||
75 | |||
76 | |||
77 | |||
78 | /** | ||
79 | * Add a host to the persistent list. This method operates in | ||
80 | * semi-reliable mode: if the transmission is not completed by | ||
81 | * the time 'GNUNET_PEERINFO_disconnect' is called, it will be | ||
82 | * aborted. Furthermore, if a second HELLO is added for the | ||
83 | * same peer before the first one was transmitted, PEERINFO may | ||
84 | * merge the two HELLOs prior to transmission to the service. | ||
85 | * | ||
86 | * @param h handle to the peerinfo service | ||
87 | * @param peer identity of the peer | ||
88 | * @param hello the verified (!) HELLO message | ||
89 | */ | ||
90 | void | ||
91 | GNUNET_PEERINFO_add_peer_new (struct GNUNET_PEERINFO_Handle *h, | ||
92 | const struct GNUNET_PeerIdentity *peer, | ||
93 | const struct GNUNET_HELLO_Message *hello) | ||
94 | { | ||
95 | } | ||
96 | |||
97 | |||
98 | struct GNUNET_PEERINFO_NewIteratorContext | ||
99 | { | ||
100 | }; | ||
101 | |||
102 | |||
103 | /** | ||
104 | * Call a method for each known matching host and change its trust | ||
105 | * value. The callback method will be invoked once for each matching | ||
106 | * host and then finally once with a NULL pointer. After that final | ||
107 | * invocation, the iterator context must no longer be used. | ||
108 | * | ||
109 | * Note that the last call can be triggered by timeout or by simply | ||
110 | * being done; however, the trust argument will be set to zero if we | ||
111 | * are done, 1 if we timed out and 2 for fatal error. | ||
112 | * | ||
113 | * Instead of calling this function with 'peer == NULL' and 'trust == | ||
114 | * 0', it is often better to use 'GNUNET_PEERINFO_notify'. | ||
115 | * | ||
116 | * @param h handle to the peerinfo service | ||
117 | * @param peer restrict iteration to this peer only (can be NULL) | ||
118 | * @param trust_delta how much to change the trust in all matching peers | ||
119 | * @param timeout how long to wait until timing out | ||
120 | * @param callback the method to call for each peer | ||
121 | * @param callback_cls closure for callback | ||
122 | * @return NULL on error (in this case, 'callback' is never called!), | ||
123 | * otherwise an iterator context | ||
124 | */ | ||
125 | struct GNUNET_PEERINFO_NewIteratorContext * | ||
126 | GNUNET_PEERINFO_iterate_new (struct GNUNET_PEERINFO_Handle *h, | ||
127 | const struct GNUNET_PeerIdentity *peer, | ||
128 | int trust_delta, | ||
129 | struct GNUNET_TIME_Relative timeout, | ||
130 | GNUNET_PEERINFO_Processor callback, | ||
131 | void *callback_cls) | ||
132 | { | ||
133 | return NULL; | ||
134 | } | ||
135 | |||
136 | |||
137 | |||
138 | /** | ||
139 | * Cancel an iteration over peer information. | ||
140 | * | ||
141 | * @param ic context of the iterator to cancel | ||
142 | */ | ||
143 | void | ||
144 | GNUNET_PEERINFO_iterate_cancel_new (struct GNUNET_PEERINFO_NewIteratorContext *ic) | ||
145 | { | ||
146 | } | ||
147 | |||
148 | |||
149 | |||
150 | |||
151 | |||
152 | /* ***************************** OLD API ****************************** */ | ||
153 | |||
154 | |||
155 | |||
156 | |||
33 | #define ADD_PEER_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 157 | #define ADD_PEER_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
34 | 158 | ||
35 | 159 | ||
@@ -324,6 +448,4 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic) | |||
324 | } | 448 | } |
325 | 449 | ||
326 | 450 | ||
327 | |||
328 | |||
329 | /* end of peerinfo_api.c */ | 451 | /* end of peerinfo_api.c */ |