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 
64 {
65 
71 
78 
86 
93 
99 
108 
115 
120  double avg_priority;
121 
126 
130  const struct GNUNET_PeerIdentity *peer;
131 
135  uint32_t respect;
136 
140  unsigned int pending_queries;
141 
145  unsigned int pending_replies;
146 
147 };
148 
149 
158 typedef void
160  const struct GNUNET_PeerIdentity *peer,
161  struct GSF_ConnectedPeer *cp,
162  const struct GSF_PeerPerformanceData *ppd);
163 
164 
173 typedef size_t
175  size_t buf_size,
176  void *buf);
177 
178 
186 typedef void
188  struct GSF_ConnectedPeer *cp,
189  int success);
190 
191 
196 
197 
207 void *
208 GSF_peer_connect_handler (void *cls,
209  const struct GNUNET_PeerIdentity *peer,
210  struct GNUNET_MQ_Handle *mq);
211 
212 
219 struct GSF_ConnectedPeer *
220 GSF_peer_get_ (const struct GNUNET_PeerIdentity *peer);
221 
222 
229 void
231  struct GNUNET_TIME_Relative latency);
232 
233 
244 void
246  int is_query,
247  uint32_t priority,
248  struct GNUNET_MQ_Envelope *env);
249 
250 
258 void
260  struct GNUNET_TIME_Absolute request_time,
261  uint32_t request_priority);
262 
263 
271 void
273  struct GSF_LocalClient *initiator_client);
274 
275 
283 void
285  const struct GSF_ConnectedPeer
286  *initiator_peer);
287 
288 
295 void
296 handle_p2p_migration_stop (void *cls,
297  const struct MigrationStopMessage *message);
298 
299 
306 void
307 handle_p2p_get (void *cls,
308  const struct GetMessage *gm);
309 
310 
319 
320 
328 void
330  struct GNUNET_TIME_Absolute block_time);
331 
332 
341 void
342 GSF_peer_disconnect_handler (void *cls,
343  const struct GNUNET_PeerIdentity *peer,
344  void *internal_cls);
345 
346 
353 void
355 
356 
366 void
368  uint64_t pref);
369 
370 
377 void
379  struct GNUNET_PeerIdentity *id);
380 
381 
388 const struct GNUNET_PeerIdentity *
390 
391 
392 
399 void
401 
402 
406 void
408 
409 
413 void
415 
416 
417 #endif
418 /* 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:143
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:85
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.