Verify that GCD(m,n) != 1 when n is an RSA modulus
[oweals/gnunet.git] / src / core / gnunet-service-core_clients.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2010, 2011 GNUnet e.V.
4
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.
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      General Public License for more details.
14
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., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @file core/gnunet-service-core_clients.h
23  * @brief code for managing interactions with clients of core service
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_CORE_CLIENTS_H
27 #define GNUNET_SERVICE_CORE_CLIENTS_H
28
29 #include "gnunet_util_lib.h"
30 #include "gnunet-service-core.h"
31 #include "gnunet-service-core_typemap.h"
32
33
34 /**
35  * Send a message to one of our clients.
36  *
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?
41  */
42 void
43 GSC_CLIENTS_send_to_client (struct GNUNET_SERVER_Client *client,
44                             const struct GNUNET_MessageHeader *msg,
45                             int can_drop);
46
47
48 /**
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'.
52  *
53  * @param client client to notify
54  * @param neighbour identity of the neighbour that changed status
55  * @param tmap_old previous type map for the neighbour, NULL for disconnect
56  * @param tmap_new updated type map for the neighbour, NULL for disconnect
57  */
58 void
59 GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
60                                            const struct GNUNET_PeerIdentity *neighbour,
61                                            const struct GSC_TypeMap *tmap_old,
62                                            const struct GSC_TypeMap *tmap_new);
63
64
65 /**
66  * Notify all clients about a change to existing session.
67  * Called from SESSIONS whenever there is a change in sessions
68  * or types processed by the respective peer.
69  *
70  * @param neighbour identity of the neighbour that changed status
71  * @param tmap_old previous type map for the neighbour, NULL for disconnect
72  * @param tmap_new updated type map for the neighbour, NULL for disconnect
73  */
74 void
75 GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity *neighbour,
76                                             const struct GSC_TypeMap *tmap_old,
77                                             const struct GSC_TypeMap *tmap_new);
78
79
80 /**
81  * Deliver P2P message to interested clients. Caller must have checked
82  * that the sending peer actually lists the given message type as one
83  * of its types.
84  *
85  * @param sender peer who sent us the message
86  * @param msg the message
87  * @param msize number of bytes to transmit
88  * @param options options for checking which clients should
89  *        receive the message
90  */
91 void
92 GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
93                              const struct GNUNET_MessageHeader *msg,
94                              uint16_t msize,
95                              uint32_t options);
96
97
98 /**
99  * Tell a client that we are ready to receive the message.
100  *
101  * @param car request that is now ready; the responsibility
102  *        for the handle remains shared between CLIENTS
103  *        and SESSIONS after this call.
104  */
105 void
106 GSC_CLIENTS_solicit_request (struct GSC_ClientActiveRequest *car);
107
108
109 /**
110  * We will never be ready to transmit the given message in (disconnect
111  * or invalid request).  Frees resources associated with @a car.  We
112  * don't explicitly tell the client, he'll learn with the disconnect
113  * (or violated the protocol).
114  *
115  * @param car request that now permanently failed; the
116  *        responsibility for the handle is now returned
117  *        to CLIENTS (SESSIONS is done with it).
118  * @param drop_client #GNUNET_YES if the client violated the protocol
119  *        and we should thus drop the connection
120  */
121 void
122 GSC_CLIENTS_reject_request (struct GSC_ClientActiveRequest *car,
123                             int drop_client);
124
125
126 /**
127  * Initialize clients subsystem.
128  *
129  * @param server handle to server clients connect to
130  */
131 void
132 GSC_CLIENTS_init (struct GNUNET_SERVER_Handle *server);
133
134
135 /**
136  * Shutdown clients subsystem.
137  */
138 void
139 GSC_CLIENTS_done (void);
140
141 #endif
142 /* end of gnunet-service-core_clients.h */