GNUnet  0.10.x
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 
69 
76 
84 
91 
97 
106 
113 
118  double avg_priority;
119 
124 
128  const struct GNUNET_PeerIdentity *peer;
129 
133  uint32_t respect;
134 
138  unsigned int pending_queries;
139 
143  unsigned int pending_replies;
144 };
145 
146 
155 typedef void
157  const struct GNUNET_PeerIdentity *peer,
158  struct GSF_ConnectedPeer *cp,
159  const struct GSF_PeerPerformanceData *ppd);
160 
161 
170 typedef size_t
172  size_t buf_size,
173  void *buf);
174 
175 
183 typedef void
185  struct GSF_ConnectedPeer *cp,
186  int success);
187 
188 
193 
194 
204 void *
205 GSF_peer_connect_handler(void *cls,
206  const struct GNUNET_PeerIdentity *peer,
207  struct GNUNET_MQ_Handle *mq);
208 
209 
216 struct GSF_ConnectedPeer *
217 GSF_peer_get_(const struct GNUNET_PeerIdentity *peer);
218 
219 
226 void
228  struct GNUNET_TIME_Relative latency);
229 
230 
241 void
243  int is_query,
244  uint32_t priority,
245  struct GNUNET_MQ_Envelope *env);
246 
247 
255 void
257  struct GNUNET_TIME_Absolute request_time,
258  uint32_t request_priority);
259 
260 
268 void
270  struct GSF_LocalClient *initiator_client);
271 
272 
280 void
282  const struct GSF_ConnectedPeer
283  *initiator_peer);
284 
285 
292 void
293 handle_p2p_migration_stop(void *cls,
294  const struct MigrationStopMessage *message);
295 
296 
303 void
304 handle_p2p_get(void *cls,
305  const struct GetMessage *gm);
306 
307 
316 
317 
325 void
327  struct GNUNET_TIME_Absolute block_time);
328 
329 
338 void
340  const struct GNUNET_PeerIdentity *peer,
341  void *internal_cls);
342 
343 
350 void
352 
353 
363 void
365  uint64_t pref);
366 
367 
374 void
376  struct GNUNET_PeerIdentity *id);
377 
378 
385 const struct GNUNET_PeerIdentity *
387 
388 
389 
396 void
398 
399 
403 void
405 
406 
410 void
412 
413 
414 #endif
415 /* end of gnunet-service-fs_cp.h */
unsigned int pending_queries
Number of pending queries (replies are not counted)
#define P2P_SUCCESS_LIST_SIZE
Length of the P2P success tracker.
struct GSF_ConnectedPeer * GSF_peer_get_(const struct GNUNET_PeerIdentity *peer)
Get a handle for a connected peer.
void GSF_iterate_connected_peers_(GSF_ConnectedPeerIterator it, void *it_cls)
Iterate over all connected peers.
#define CS2P_SUCCESS_LIST_SIZE
Length of the CS-2-P success tracker.
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_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_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_connected_peer_init_(void)
Initialize peer management subsystem.
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.
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...
const struct GNUNET_PeerIdentity * peer
The peer&#39;s identity (pointer).
definitions for the entire fs module
struct GSF_PeerPerformanceData * GSF_get_peer_performance_data_(struct GSF_ConnectedPeer *cp)
Return the performance data record for the given peer.
shared data structures of gnunet-service-fs.c
const struct GNUNET_PeerIdentity * GSF_connected_peer_get_identity2_(const struct GSF_ConnectedPeer *cp)
Obtain the identity of a connected peer.
A local client.
double avg_priority
Average priority of successful replies.
void GSF_peer_disconnect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, void *internal_cls)
A peer disconnected from us.
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 GNUNET_PEER_Id
A GNUNET_PEER_Id is simply a shorter version of a "struct GNUNET_PeerIdentifier" that can be used ins...
unsigned int pending_replies
Number of pending replies (queries are not counted)
uint32_t respect
Respect rating for this peer.
Message to the datastore service asking about specific content.
Definition: datastore.h:136
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...
void GSF_connected_peer_get_identity_(const struct GSF_ConnectedPeer *cp, struct GNUNET_PeerIdentity *id)
Obtain the identity of a connected peer.
static char buf[2048]
Values we track for load calculations.
Definition: load.c:35
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_TIME_Absolute last_request_times[24]
Transmission times for the last MAX_QUEUE_PER_PEER requests for this peer.
Message send by a peer that wants to be excluded from migration for a while.
GNUNET_PEER_Id pid
The peer&#39;s identity (interned version).
Handle to a message queue.
Definition: mq.c:84
The identity of the host (wraps the signing key of the peer).
struct GNUNET_TIME_Absolute migration_blocked_until
Point in time until which this peer does not want us to migrate content to it.
Performance data kept for a peer.
void handle_p2p_migration_stop(void *cls, const struct MigrationStopMessage *message)
Handle P2P GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP message.
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)...
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_PeerReserveCallback)(void *cls, struct GSF_ConnectedPeer *cp, int success)
Signature of function called on a reservation success or failure.
void GSF_connected_peer_done_(void)
Shutdown peer management subsystem.
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
A connected peer.
struct GSF_LocalClient * last_client_replies[8]
List of the last clients for which this peer successfully answered a query.
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 ...
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.
Time for absolute times used by GNUnet, in microseconds.
void GSF_handle_local_client_disconnect_(const struct GSF_LocalClient *lc)
Notification that a local client disconnected.
#define MAX_QUEUE_PER_PEER
Maximum number of outgoing messages we queue per peer.
size_t(* GSF_GetMessageCallback)(void *cls, size_t buf_size, void *buf)
Function called to get a message for transmission.
void handle_p2p_get(void *cls, const struct GetMessage *gm)
Handle P2P "QUERY" message.
void * GSF_peer_connect_handler(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
A peer connected to us.
Time for relative time used by GNUnet, in microseconds.
Handle to cancel a transmission request.
void GSF_update_peer_latency_(const struct GNUNET_PeerIdentity *id, struct GNUNET_TIME_Relative latency)
Update the latency information kept for the given peer.