aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet-new_peer.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-16 18:13:09 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-16 18:13:25 +0100
commitd55c8698825605630770157c786e064af0c20467 (patch)
tree3378ff4d011a9553939a01cb6afdd9cd2f70a679 /src/cadet/gnunet-service-cadet-new_peer.h
parent73a48a626764013ab9f332810b5f7715c60105b4 (diff)
downloadgnunet-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.h51
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 */
68void 68const struct GNUNET_PeerIdentity *
69GCP_id (struct CadetPeer *cp, 69GCP_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 */
90unsigned int 89unsigned int
91GCP_count_paths (const struct CadetPeer *peer); 90GCP_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 */
105typedef int 102typedef 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 */
119unsigned int 116unsigned int
120GCP_iterate_paths (struct CadetPeer *peer, 117GCP_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 */
158struct CadetTunnel * 155struct CadetTunnel *
159GCP_get_tunnel (struct CadetPeer *peer, 156GCP_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 */
170void 167void
171GCP_drop_tunnel (struct CadetPeer *peer, 168GCP_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 */
181struct GNUNET_CONTAINER_HeapNode *
182GCP_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 */
182void 193void
183GCP_set_hello (struct CadetPeer *peer, 194GCP_set_hello (struct CadetPeer *cp,
184 const struct GNUNET_HELLO_Message *hello); 195 const struct GNUNET_HELLO_Message *hello);
185 196
186 197