aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_dhtu_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_dhtu_plugin.h')
-rw-r--r--src/include/gnunet_dhtu_plugin.h90
1 files changed, 10 insertions, 80 deletions
diff --git a/src/include/gnunet_dhtu_plugin.h b/src/include/gnunet_dhtu_plugin.h
index e65318fb5..0503dda1c 100644
--- a/src/include/gnunet_dhtu_plugin.h
+++ b/src/include/gnunet_dhtu_plugin.h
@@ -27,6 +27,7 @@
27#ifndef PLUGIN_DHTU_H 27#ifndef PLUGIN_DHTU_H
28#define PLUGIN_DHTU_H 28#define PLUGIN_DHTU_H
29 29
30
30#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
31 32
32 33
@@ -57,38 +58,6 @@ struct GNUNET_DHTU_Target;
57 */ 58 */
58struct GNUNET_DHTU_PreferenceHandle; 59struct GNUNET_DHTU_PreferenceHandle;
59 60
60/**
61 * Opaque handle for a private key used by this underlay.
62 */
63struct GNUNET_DHTU_PrivateKey;
64
65/**
66 * Handle for a public key used by another peer. Note that
67 * the underlay used must be communicated separately.
68 */
69struct GNUNET_DHTU_PublicKey
70{
71 /**
72 * How long is the public key, in network byte order.
73 */
74 uint16_t size;
75
76 /* followed by size-2 bytes of the actual public key */
77};
78
79
80/**
81 * Hash used by the DHT for keys and peers.
82 */
83struct GNUNET_DHTU_Hash
84{
85
86 /**
87 * For now, use a 512 bit hash. (To be discussed).
88 */
89 struct GNUNET_HashCode hc;
90};
91
92 61
93/** 62/**
94 * The datastore service will pass a pointer to a struct 63 * The datastore service will pass a pointer to a struct
@@ -111,9 +80,6 @@ struct GNUNET_DHTU_PluginEnvironment
111 * Function to call with new addresses of this peer. 80 * Function to call with new addresses of this peer.
112 * 81 *
113 * @param cls the closure 82 * @param cls the closure
114 * @param my_id hash position of this address in the DHT
115 * @param pk private key of this peer used at @a address,
116 * pointer will remain valid until @e address_del_cb is called
117 * @param address address under which we are likely reachable, 83 * @param address address under which we are likely reachable,
118 * pointer will remain valid until @e address_del_cb is called; to be used for HELLOs. Example: "ip+udp://1.1.1.1:2086/" 84 * pointer will remain valid until @e address_del_cb is called; to be used for HELLOs. Example: "ip+udp://1.1.1.1:2086/"
119 * @param source handle for sending from this address, NULL if we can only receive 85 * @param source handle for sending from this address, NULL if we can only receive
@@ -121,8 +87,6 @@ struct GNUNET_DHTU_PluginEnvironment
121 */ 87 */
122 void 88 void
123 (*address_add_cb)(void *cls, 89 (*address_add_cb)(void *cls,
124 const struct GNUNET_DHTU_Hash *my_id,
125 const struct GNUNET_DHTU_PrivateKey *pk,
126 const char *address, 90 const char *address,
127 struct GNUNET_DHTU_Source *source, 91 struct GNUNET_DHTU_Source *source,
128 void **ctx); 92 void **ctx);
@@ -154,21 +118,19 @@ struct GNUNET_DHTU_PluginEnvironment
154 * that peer. 118 * that peer.
155 * 119 *
156 * @param cls the closure 120 * @param cls the closure
157 * @param pk public key of the target,
158 * pointer will remain valid until @e disconnect_cb is called
159 * @para peer_id hash position of the peer,
160 * pointer will remain valid until @e disconnect_cb is called
161 * @param target handle to the target, 121 * @param target handle to the target,
162 * pointer will remain valid until @e disconnect_cb is called 122 * pointer will remain valid until @e disconnect_cb is called
123 * @param pid peer identity,
124 * pointer will remain valid until @e disconnect_cb is called
163 * @param[out] ctx storage space for DHT to use in association with this target 125 * @param[out] ctx storage space for DHT to use in association with this target
164 */ 126 */
165 void 127 void
166 (*connect_cb)(void *cls, 128 (*connect_cb)(void *cls,
167 const struct GNUNET_DHTU_PublicKey *pk,
168 const struct GNUNET_DHTU_Hash *peer_id,
169 struct GNUNET_DHTU_Target *target, 129 struct GNUNET_DHTU_Target *target,
130 const struct GNUNET_PeerIdentity *pid,
170 void **ctx); 131 void **ctx);
171 132
133
172 /** 134 /**
173 * Function to call when we disconnected from a peer and can henceforth 135 * Function to call when we disconnected from a peer and can henceforth
174 * cannot transmit to that peer anymore. 136 * cannot transmit to that peer anymore.
@@ -209,50 +171,18 @@ struct GNUNET_DHTU_PluginFunctions
209 void *cls; 171 void *cls;
210 172
211 /** 173 /**
212 * Use our private key to sign a message.
213 *
214 * @param cls closure
215 * @param pk our private key to sign with
216 * @param purpose what to sign
217 * @param[out] signature, allocated on heap and returned
218 * @return -1 on error, otherwise number of bytes in @a sig
219 */
220 ssize_t
221 (*sign)(void *cls,
222 const struct GNUNET_DHTU_PrivateKey *pk,
223 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
224 void **sig);
225
226 /**
227 * Verify signature in @a sig over @a purpose.
228 *
229 * @param cls closure
230 * @param pk public key to verify signature of
231 * @param purpose what was being signed
232 * @param sig signature data
233 * @param sig_size number of bytes in @a sig
234 * @return #GNUNET_OK if signature is valid
235 * #GNUNET_NO if signatures are not supported
236 * #GNUNET_SYSERR if signature is invalid
237 */
238 enum GNUNET_GenericReturnValue
239 (*verify)(void *cls,
240 const struct GNUNET_DHTU_PublicKey *pk,
241 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
242 const void *sig,
243 size_t sig_size);
244
245
246 /**
247 * Request creation of a session with a peer at the given @a address. 174 * Request creation of a session with a peer at the given @a address.
248 * 175 *
249 * @param cls closure (internal context for the plugin) 176 * @param cls closure (internal context for the plugin)
250 * @param address target address to connect to 177 * @param pid target identity of the peer to connect to
178 * @param address target address URI to connect to
251 */ 179 */
252 void 180 void
253 (*try_connect) (void *cls, 181 (*try_connect) (void *cls,
182 const struct GNUNET_PeerIdentity *pid,
254 const char *address); 183 const char *address);
255 184
185
256 /** 186 /**
257 * Request underlay to keep the connection to @a target alive if possible. 187 * Request underlay to keep the connection to @a target alive if possible.
258 * Hold may be called multiple times to express a strong preference to 188 * Hold may be called multiple times to express a strong preference to
@@ -266,7 +196,7 @@ struct GNUNET_DHTU_PluginFunctions
266 struct GNUNET_DHTU_Target *target); 196 struct GNUNET_DHTU_Target *target);
267 197
268 /** 198 /**
269 * Do no long request underlay to keep the connection alive. 199 * Do no longer request underlay to keep the connection alive.
270 * 200 *
271 * @param cls closure 201 * @param cls closure
272 * @param target connection to keep alive 202 * @param target connection to keep alive