2 This file is part of GNUnet.
3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file core/gnunet-service-core_clients.h
23 * @brief code for managing interactions with clients of core service
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_CORE_CLIENTS_H
27 #define GNUNET_SERVICE_CORE_CLIENTS_H
29 #include "gnunet_util_lib.h"
30 #include "gnunet-service-core.h"
31 #include "gnunet-service-core_typemap.h"
35 * Send a message to one of our clients.
37 * @param client target for the message
38 * @param msg message to transmit
39 * @param can_drop could this message be dropped if the
40 * client's queue is getting too large?
43 GSC_CLIENTS_send_to_client (struct GNUNET_SERVER_Client *client,
44 const struct GNUNET_MessageHeader *msg,
49 * Notify a particular client about a change to existing connection to
50 * one of our neighbours (check if the client is interested). Called
51 * from 'GSC_SESSIONS_notify_client_about_sessions'.
53 * @param client client to notify
54 * @param neighbour identity of the neighbour that changed status
55 * @param atsi performance information about neighbour
56 * @param atsi_count number of entries in 'ats' array
57 * @param tmap_old previous type map for the neighbour, NULL for disconnect
58 * @param tmap_new updated type map for the neighbour, NULL for disconnect
59 * @param is_new GNUNET_YES if this is a completely new neighbour
62 GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
63 const struct GNUNET_PeerIdentity *neighbour,
64 const struct GNUNET_ATS_Information *atsi,
65 unsigned int atsi_count,
66 const struct GSC_TypeMap *tmap_old,
67 const struct GSC_TypeMap *tmap_new,
72 * Notify all clients about a change to existing session.
73 * Called from SESSIONS whenever there is a change in sessions
74 * or types processed by the respective peer.
76 * @param neighbour identity of the neighbour that changed status
77 * @param atsi performance information about neighbour
78 * @param atsi_count number of entries in 'ats' array
79 * @param tmap_old previous type map for the neighbour, NULL for disconnect
80 * @param tmap_new updated type map for the neighbour, NULL for disconnect
83 GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity *neighbour,
84 const struct GNUNET_ATS_Information *atsi,
85 unsigned int atsi_count,
86 const struct GSC_TypeMap *tmap_old,
87 const struct GSC_TypeMap *tmap_new);
91 * Deliver P2P message to interested clients. Caller must have checked
92 * that the sending peer actually lists the given message type as one
95 * @param sender peer who sent us the message
96 * @param atsi performance information about neighbour
97 * @param atsi_count number of entries in 'ats' array
98 * @param msg the message
99 * @param msize number of bytes to transmit
100 * @param options options for checking which clients should
101 * receive the message
104 GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
105 const struct GNUNET_ATS_Information *atsi,
106 unsigned int atsi_count,
107 const struct GNUNET_MessageHeader *msg,
113 * Tell a client that we are ready to receive the message.
115 * @param car request that is now ready; the responsibility
116 * for the handle remains shared between CLIENTS
117 * and SESSIONS after this call.
120 GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car);
124 * Tell a client that we will never be ready to receive the
125 * given message in time (disconnect or timeout).
127 * @param car request that now permanently failed; the
128 * responsibility for the handle is now returned
129 * to CLIENTS (SESSIONS is done with it).
132 GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car);
136 * Initialize clients subsystem.
138 * @param server handle to server clients connect to
141 GSC_CLIENTS_init (struct GNUNET_SERVER_Handle *server);
145 * Shutdown clients subsystem.
148 GSC_CLIENTS_done (void);
151 /* end of gnunet-service-core_clients.h */