GNUnet  0.20.0
gnunet-service-fs_cp.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2011 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
26 #ifndef GNUNET_SERVICE_FS_CP_H
27 #define GNUNET_SERVICE_FS_CP_H
28 
29 #include "fs.h"
30 #include "gnunet-service-fs.h"
31 
32 
45 #define MAX_QUEUE_PER_PEER 24
46 
51 #define P2P_SUCCESS_LIST_SIZE 8
52 
57 #define CS2P_SUCCESS_LIST_SIZE 8
58 
59 
64 {
70 
77 
85 
92 
98 
107 
114 
119  double avg_priority;
120 
125 
129  const struct GNUNET_PeerIdentity *peer;
130 
134  uint32_t respect;
135 
139  unsigned int pending_queries;
140 
144  unsigned int pending_replies;
145 };
146 
147 
156 typedef void
157 (*GSF_ConnectedPeerIterator) (void *cls,
158  const struct GNUNET_PeerIdentity *peer,
159  struct GSF_ConnectedPeer *cp,
160  const struct GSF_PeerPerformanceData *ppd);
161 
162 
171 typedef size_t
172 (*GSF_GetMessageCallback) (void *cls,
173  size_t buf_size,
174  void *buf);
175 
176 
184 typedef void
185 (*GSF_PeerReserveCallback) (void *cls,
186  struct GSF_ConnectedPeer *cp,
187  int success);
188 
189 
194 
195 
205 void *
206 GSF_peer_connect_handler (void *cls,
207  const struct GNUNET_PeerIdentity *peer,
208  struct GNUNET_MQ_Handle *mq);
209 
210 
217 struct GSF_ConnectedPeer *
218 GSF_peer_get_ (const struct GNUNET_PeerIdentity *peer);
219 
220 
227 void
229  struct GNUNET_TIME_Relative latency);
230 
231 
242 void
244  int is_query,
245  uint32_t priority,
246  struct GNUNET_MQ_Envelope *env);
247 
248 
256 void
258  struct GNUNET_TIME_Absolute request_time,
259  uint32_t request_priority);
260 
261 
269 void
271  struct GSF_LocalClient *initiator_client);
272 
273 
281 void
283  const struct GSF_ConnectedPeer
284  *initiator_peer);
285 
286 
293 void
294 handle_p2p_migration_stop (void *cls,
295  const struct MigrationStopMessage *message);
296 
297 
304 void
305 handle_p2p_get (void *cls,
306  const struct GetMessage *gm);
307 
308 
317 
318 
326 void
328  struct GNUNET_TIME_Absolute block_time);
329 
330 
339 void
340 GSF_peer_disconnect_handler (void *cls,
341  const struct GNUNET_PeerIdentity *peer,
342  void *internal_cls);
343 
344 
351 void
353 
354 
364 void
366  uint64_t pref);
367 
368 
375 void
377  struct GNUNET_PeerIdentity *id);
378 
379 
386 const struct GNUNET_PeerIdentity *
388 
389 
396 void
398 
399 
403 void
405 
406 
410 void
412 
413 
414 #endif
415 /* end of gnunet-service-fs_cp.h */
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
definitions for the entire fs module
shared data structures of gnunet-service-fs.c
void GSF_connected_peer_done_(void)
Shutdown peer management subsystem.
void GSF_peer_disconnect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
A peer disconnected from us.
void handle_p2p_get(void *cls, const struct GetMessage *gm)
Handle P2P "QUERY" message.
const struct GNUNET_PeerIdentity * GSF_connected_peer_get_identity2_(const struct GSF_ConnectedPeer *cp)
Obtain the identity of a connected peer.
void GSF_update_peer_latency_(const struct GNUNET_PeerIdentity *id, struct GNUNET_TIME_Relative latency)
Update the latency information kept for the given peer.
struct GSF_ConnectedPeer * GSF_peer_get_(const struct GNUNET_PeerIdentity *peer)
Get a handle for a connected peer.
size_t(* GSF_GetMessageCallback)(void *cls, size_t buf_size, void *buf)
Function called to get a message for transmission.
void GSF_connected_peer_init_(void)
Initialize peer management subsystem.
void handle_p2p_migration_stop(void *cls, const struct MigrationStopMessage *message)
Handle P2P GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP message.
void GSF_iterate_connected_peers_(GSF_ConnectedPeerIterator it, void *it_cls)
Iterate over all connected peers.
void(* GSF_ConnectedPeerIterator)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GSF_ConnectedPeer *cp, const struct GSF_PeerPerformanceData *ppd)
Signature of function called on a connected peer.
#define P2P_SUCCESS_LIST_SIZE
Length of the P2P success tracker.
void GSF_connected_peer_get_identity_(const struct GSF_ConnectedPeer *cp, struct GNUNET_PeerIdentity *id)
Obtain the identity of a connected peer.
void GSF_handle_local_client_disconnect_(const struct GSF_LocalClient *lc)
Notification that a local client disconnected.
void * GSF_peer_connect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
A peer connected to us.
void(* GSF_PeerReserveCallback)(void *cls, struct GSF_ConnectedPeer *cp, int success)
Signature of function called on a reservation success or failure.
#define CS2P_SUCCESS_LIST_SIZE
Length of the CS-2-P success tracker.
void GSF_peer_update_responder_peer_(struct GSF_ConnectedPeer *cp, const struct GSF_ConnectedPeer *initiator_peer)
Report on receiving a reply in response to an initiating peer.
void GSF_peer_update_responder_client_(struct GSF_ConnectedPeer *cp, struct GSF_LocalClient *initiator_client)
Report on receiving a reply in response to an initiating client.
void GSF_peer_transmit_(struct GSF_ConnectedPeer *cp, int is_query, uint32_t priority, struct GNUNET_MQ_Envelope *env)
Transmit a message to the given peer as soon as possible.
void GSF_block_peer_migration_(struct GSF_ConnectedPeer *cp, struct GNUNET_TIME_Absolute block_time)
Ask a peer to stop migrating data to us until the given point in time.
void GSF_peer_update_performance_(struct GSF_ConnectedPeer *cp, struct GNUNET_TIME_Absolute request_time, uint32_t request_priority)
Report on receiving a reply; update the performance record of the given peer.
void GSF_connected_peer_change_preference_(struct GSF_ConnectedPeer *cp, uint64_t pref)
Notify core about a preference we have for the given peer (to allocate more resources towards it).
#define MAX_QUEUE_PER_PEER
Maximum number of outgoing messages we queue per peer.
struct GSF_PeerPerformanceData * GSF_get_peer_performance_data_(struct GSF_ConnectedPeer *cp)
Return the performance data record for the given peer.
static char buf[2048]
unsigned int GNUNET_PEER_Id
A GNUNET_PEER_Id is simply a shorter version of a "struct GNUNET_PeerIdentifier" that can be used ins...
Values we track for load calculations.
Definition: load.c:37
Handle to a message queue.
Definition: mq.c:87
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
A connected peer.
A local client.
Performance data kept for a peer.
double avg_priority
Average priority of successful replies.
struct GNUNET_TIME_Relative avg_reply_delay
Average delay between sending the peer a request and getting a reply (only calculated over the reques...
unsigned int pending_replies
Number of pending replies (queries are not counted)
struct GSF_LocalClient * last_client_replies[8]
List of the last clients for which this peer successfully answered a query.
struct GNUNET_LOAD_Value * transmission_delay
How long does it typically take for us to transmit a message to this peer? (delay between the request...
struct GNUNET_TIME_Absolute migration_blocked_until
Point in time until which this peer does not want us to migrate content to it.
const struct GNUNET_PeerIdentity * peer
The peer's identity (pointer).
unsigned int pending_queries
Number of pending queries (replies are not counted)
GNUNET_PEER_Id pid
The peer's identity (interned version).
uint32_t respect
Respect rating for this peer.
struct GNUNET_TIME_Relative migration_delay
If we get content we already have from this peer, for how long do we block it? Adjusted based on the ...
struct GNUNET_TIME_Absolute last_request_times[24]
Transmission times for the last MAX_QUEUE_PER_PEER requests for this peer.
GNUNET_PEER_Id last_p2p_replies[8]
List of the last PIDs for which this peer successfully answered a query; We use 0 to indicate no succ...
Handle to cancel a transmission request.
Message to the datastore service asking about specific content.
Definition: datastore.h:141
Message send by a peer that wants to be excluded from migration for a while.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.