2 This file is part of GNUnet
3 (C) 2013 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 2, 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 * @brief common stuff for the set service
25 #ifndef GNUNET_SERVICE_SET_H_PRIVATE
26 #define GNUNET_SERVICE_SET_H_PRIVATE
29 #include "gnunet_common.h"
30 #include "gnunet_protocols.h"
31 #include "gnunet_applications.h"
32 #include "gnunet_util_lib.h"
33 #include "gnunet_core_service.h"
34 #include "gnunet_stream_lib.h"
35 #include "gnunet_set_service.h"
41 struct IntersectionState;
45 * Extra state required for set union.
51 * A set that supports a specific operation
57 * Client that owns the set.
58 * Only one client may own a set.
60 struct GNUNET_SERVER_Client *client;
63 * Message queue for the client
65 struct GNUNET_MQ_MessageQueue *client_mq;
68 * Type of operation supported for this set
70 uint32_t operation; // use enum from API
73 * Sets are held in a doubly linked list.
78 * Sets are held in a doubly linked list.
83 * Appropriate state for each type of
87 struct IntersectionState *i;
96 * Listeners are held in a doubly linked list.
98 struct Listener *next;
101 * Listeners are held in a doubly linked list.
103 struct Listener *prev;
106 * Client that owns the set.
107 * Only one client may own a set.
109 struct GNUNET_SERVER_Client *client;
112 * Message queue for the client
114 struct GNUNET_MQ_MessageQueue *client_mq;
117 * Type of operation supported for this set
119 enum GNUNET_SET_OperationType operation;
122 * Application id of intereset for this listener.
124 struct GNUNET_HashCode app_id;
129 * Peer that has connected to us, but is not yet evaluating a set operation.
130 * Once the peer has sent a request, and the client has
131 * accepted or rejected it, this information will be deleted.
136 * Incoming peers are held in a linked list
138 struct Incoming *next;
141 * Incoming peers are held in a linked list
143 struct Incoming *prev;
146 * Identity of the peer that connected to us
148 struct GNUNET_PeerIdentity peer;
151 * Socket connected to the peer
153 struct GNUNET_STREAM_Socket *socket;
156 * Message queue for the peer
158 struct GNUNET_MQ_MessageQueue *mq;
161 * App code, set once the peer has
162 * requested an operation
164 struct GNUNET_HashCode app_id;
167 * Context message, set once the peer
168 * has requested an operation.
170 struct GNUNET_MessageHeader *context_msg;
173 * Salt the peer has requested to use for the
179 * Operation the other peer wants to do
181 enum GNUNET_SET_OperationType operation;
184 * Request id associated with the
185 * request coming from this client
192 * Configuration of the local peer
194 extern const struct GNUNET_CONFIGURATION_Handle *configuration;
198 * Disconnect a client and free all resources
199 * that the client allocated (e.g. Sets or Listeners)
201 * @param client the client to disconnect
204 _GSS_client_disconnect (struct GNUNET_SERVER_Client *client);
208 _GSS_union_set_create (void);
212 _GSS_union_evaluate (struct EvaluateMessage *m, struct Set *set);
216 _GSS_union_add (struct ElementMessage *m, struct Set *set);
220 _GSS_union_accept (struct AcceptMessage *m, struct Set *set,
221 struct Incoming *incoming);