diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-16 18:13:09 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-16 18:13:25 +0100 |
commit | d55c8698825605630770157c786e064af0c20467 (patch) | |
tree | 3378ff4d011a9553939a01cb6afdd9cd2f70a679 /src/cadet/gnunet-service-cadet-new_peer.h | |
parent | 73a48a626764013ab9f332810b5f7715c60105b4 (diff) | |
download | gnunet-d55c8698825605630770157c786e064af0c20467.tar.gz gnunet-d55c8698825605630770157c786e064af0c20467.zip |
more work on peers, paths and tunnels
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_peer.h')
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_peer.h | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_peer.h b/src/cadet/gnunet-service-cadet-new_peer.h index cc9a347fd..e1c8476d1 100644 --- a/src/cadet/gnunet-service-cadet-new_peer.h +++ b/src/cadet/gnunet-service-cadet-new_peer.h | |||
@@ -63,11 +63,10 @@ GCP_get (const struct GNUNET_PeerIdentity *peer_id, | |||
63 | * Obtain the peer identity for a `struct CadetPeer`. | 63 | * Obtain the peer identity for a `struct CadetPeer`. |
64 | * | 64 | * |
65 | * @param cp our peer handle | 65 | * @param cp our peer handle |
66 | * @param[out] peer_id where to write the peer identity | 66 | * @return the peer identity |
67 | */ | 67 | */ |
68 | void | 68 | const struct GNUNET_PeerIdentity * |
69 | GCP_id (struct CadetPeer *cp, | 69 | GCP_get_id (struct CadetPeer *cp); |
70 | struct GNUNET_PeerIdentity *peer_id); | ||
71 | 70 | ||
72 | 71 | ||
73 | /** | 72 | /** |
@@ -84,40 +83,38 @@ GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, | |||
84 | /** | 83 | /** |
85 | * Count the number of known paths toward the peer. | 84 | * Count the number of known paths toward the peer. |
86 | * | 85 | * |
87 | * @param peer Peer to get path info. | 86 | * @param cp Peer to get path info. |
88 | * @return Number of known paths. | 87 | * @return Number of known paths. |
89 | */ | 88 | */ |
90 | unsigned int | 89 | unsigned int |
91 | GCP_count_paths (const struct CadetPeer *peer); | 90 | GCP_count_paths (const struct CadetPeer *cp); |
92 | 91 | ||
93 | 92 | ||
94 | /** | 93 | /** |
95 | * Peer path iterator. | 94 | * Peer path iterator. |
96 | * | 95 | * |
97 | * @param cls Closure. | 96 | * @param cls Closure. |
98 | * @param peer Peer this path is towards. | ||
99 | * @param path Path itself | 97 | * @param path Path itself |
98 | * @param off offset of the target peer in @a path | ||
100 | * @return #GNUNET_YES if should keep iterating. | 99 | * @return #GNUNET_YES if should keep iterating. |
101 | * #GNUNET_NO otherwise. | 100 | * #GNUNET_NO otherwise. |
102 | * | ||
103 | * FIXME: peer argument should be redundant; remove! | ||
104 | */ | 101 | */ |
105 | typedef int | 102 | typedef int |
106 | (*GCP_PathIterator) (void *cls, | 103 | (*GCP_PathIterator) (void *cls, |
107 | struct CadetPeer *peer, | 104 | struct CadetPeerPath *path, |
108 | struct CadetPeerPath *path); | 105 | unsigned int off); |
109 | 106 | ||
110 | 107 | ||
111 | /** | 108 | /** |
112 | * Iterate over the paths to a peer. | 109 | * Iterate over the paths to a peer. |
113 | * | 110 | * |
114 | * @param peer Peer to get path info. | 111 | * @param cp Peer to get path info. |
115 | * @param callback Function to call for every path. | 112 | * @param callback Function to call for every path. |
116 | * @param callback_cls Closure for @a callback. | 113 | * @param callback_cls Closure for @a callback. |
117 | * @return Number of iterated paths. | 114 | * @return Number of iterated paths. |
118 | */ | 115 | */ |
119 | unsigned int | 116 | unsigned int |
120 | GCP_iterate_paths (struct CadetPeer *peer, | 117 | GCP_iterate_paths (struct CadetPeer *cp, |
121 | GCP_PathIterator callback, | 118 | GCP_PathIterator callback, |
122 | void *callback_cls); | 119 | void *callback_cls); |
123 | 120 | ||
@@ -151,12 +148,12 @@ GCP_path_entry_add (struct CadetPeer *cp, | |||
151 | /** | 148 | /** |
152 | * Get the tunnel towards a peer. | 149 | * Get the tunnel towards a peer. |
153 | * | 150 | * |
154 | * @param peer Peer to get from. | 151 | * @param cp Peer to get from. |
155 | * @param create #GNUNET_YES to create a tunnel if we do not have one | 152 | * @param create #GNUNET_YES to create a tunnel if we do not have one |
156 | * @return Tunnel towards peer. | 153 | * @return Tunnel towards peer. |
157 | */ | 154 | */ |
158 | struct CadetTunnel * | 155 | struct CadetTunnel * |
159 | GCP_get_tunnel (struct CadetPeer *peer, | 156 | GCP_get_tunnel (struct CadetPeer *cp, |
160 | int create); | 157 | int create); |
161 | 158 | ||
162 | 159 | ||
@@ -164,23 +161,37 @@ GCP_get_tunnel (struct CadetPeer *peer, | |||
164 | * The tunnel to the given peer no longer exists, remove it from our | 161 | * The tunnel to the given peer no longer exists, remove it from our |
165 | * data structures, and possibly clean up the peer itself. | 162 | * data structures, and possibly clean up the peer itself. |
166 | * | 163 | * |
167 | * @param peer the peer affected | 164 | * @param cp the peer affected |
168 | * @param t the dead tunnel | 165 | * @param t the dead tunnel |
169 | */ | 166 | */ |
170 | void | 167 | void |
171 | GCP_drop_tunnel (struct CadetPeer *peer, | 168 | GCP_drop_tunnel (struct CadetPeer *cp, |
172 | struct CadetTunnel *t); | 169 | struct CadetTunnel *t); |
173 | 170 | ||
174 | 171 | ||
175 | /** | 172 | /** |
176 | * We got a HELLO for a @a peer, remember it, and possibly | 173 | * Try adding a @a path to this @a cp. If the peer already |
174 | * has plenty of paths, return NULL. | ||
175 | * | ||
176 | * @param cp peer to which the @a path leads to | ||
177 | * @param path a path looking for an owner | ||
178 | * @return NULL if this peer does not care to become a new owner, | ||
179 | * otherwise the node in the peer's path heap for the @a path. | ||
180 | */ | ||
181 | struct GNUNET_CONTAINER_HeapNode * | ||
182 | GCP_attach_path (struct CadetPeer *cp, | ||
183 | struct CadetPeerPath *path); | ||
184 | |||
185 | |||
186 | /** | ||
187 | * We got a HELLO for a @a cp, remember it, and possibly | ||
177 | * trigger adequate actions (like trying to connect). | 188 | * trigger adequate actions (like trying to connect). |
178 | * | 189 | * |
179 | * @param peer the peer we got a HELLO for | 190 | * @param cp the peer we got a HELLO for |
180 | * @param hello the HELLO to remember | 191 | * @param hello the HELLO to remember |
181 | */ | 192 | */ |
182 | void | 193 | void |
183 | GCP_set_hello (struct CadetPeer *peer, | 194 | GCP_set_hello (struct CadetPeer *cp, |
184 | const struct GNUNET_HELLO_Message *hello); | 195 | const struct GNUNET_HELLO_Message *hello); |
185 | 196 | ||
186 | 197 | ||