aboutsummaryrefslogtreecommitdiff
path: root/src/set/set.h
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-04-17 00:44:29 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-04-17 00:44:29 +0000
commit0555e4e107db9c0c1f0caa6c947881c32bf426f4 (patch)
treed9bbd740ad0f73c07cf56aad0650e6ded7d05229 /src/set/set.h
parente77e2db24ef3681f207521e539a2c1ca3584efda (diff)
downloadgnunet-0555e4e107db9c0c1f0caa6c947881c32bf426f4.tar.gz
gnunet-0555e4e107db9c0c1f0caa6c947881c32bf426f4.zip
started implementing set api, draft for mq
Diffstat (limited to 'src/set/set.h')
-rw-r--r--src/set/set.h189
1 files changed, 189 insertions, 0 deletions
diff --git a/src/set/set.h b/src/set/set.h
new file mode 100644
index 000000000..f10b25e4e
--- /dev/null
+++ b/src/set/set.h
@@ -0,0 +1,189 @@
1/*
2 This file is part of GNUnet.
3 (C) 2012 Christian Grothoff (and other contributing authors)
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 2, 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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @author Florian Dold
23 * @file consensus/consensus.h
24 * @brief
25 */
26#ifndef SET_H
27#define SET_H
28
29#include "gnunet_common.h"
30
31
32/**
33 * The service sends up to GNUNET_SET_ACK_WINDOW messages per client handle,
34 * the client should send an ack every GNUNET_SET_ACK_WINDOW/2 messages.
35 */
36#define GNUNET_SET_ACK_WINDOW 8
37
38
39GNUNET_NETWORK_STRUCT_BEGIN
40
41struct SetCreateMessage
42{
43 /**
44 * Type: GNUNET_MESSAGE_TYPE_SET_CREATE
45 */
46 struct GNUNET_MessageHeader header;
47
48 /**
49 * Operation type, values of enum GNUNET_SET_OperationType
50 */
51 uint16_t operation GNUNET_PACKED;
52};
53
54
55struct ListenMessage
56{
57 /**
58 * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
59 */
60 struct GNUNET_MessageHeader header;
61
62 /**
63 * application id
64 */
65 struct GNUNET_HashCode app_id;
66
67 /**
68 * Operation type, values of enum GNUNET_SET_OperationType
69 */
70 uint16_t operation GNUNET_PACKED;
71
72 /**
73 * Operation type, values of enum GNUNET_SET_OperationType
74 */
75 uint16_t op GNUNET_PACKED;
76
77};
78
79
80struct AcceptMessage
81{
82 /**
83 * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT
84 */
85 struct GNUNET_MessageHeader header;
86
87 /**
88 * request id of the request we want to accept
89 */
90 uint32_t request_id GNUNET_PACKED;
91
92
93 struct GNUNET_TIME_RelativeNBO timeout;
94};
95
96
97struct RequestMessage
98{
99 /**
100 * Type: GNUNET_MESSAGE_TYPE_SET_Request
101 */
102 struct GNUNET_MessageHeader header;
103
104 /**
105 * requesting peer
106 */
107 struct GNUNET_PeerIdentity peer_id;
108
109 /**
110 * request id of the request we want to accept
111 */
112 uint32_t request_id GNUNET_PACKED;
113
114 /* rest: inner message */
115};
116
117
118struct EvaluateMessage
119{
120 /**
121 * Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
122 */
123 struct GNUNET_MessageHeader header;
124
125 struct GNUNET_PeerIdentity other_peer;
126
127 struct GNUNET_HashCode app_id;
128
129 struct GNUNET_TIME_RelativeNBO timeout;
130
131 /**
132 * id of our evaluate
133 */
134 uint32_t request_id GNUNET_PACKED;
135
136 /* rest: inner message */
137};
138
139
140struct ResultMessage
141{
142 /**
143 * Type: GNUNET_MESSAGE_TYPE_SET_RESULT
144 */
145 struct GNUNET_MessageHeader header;
146
147 /**
148 * id the result belongs to
149 */
150 uint32_t request_id GNUNET_PACKED;
151
152 uint16_t result_status GNUNET_PACKED;
153
154 uint16_t element_type GNUNET_PACKED;
155
156 /* rest: the actual element */
157};
158
159
160struct ElementMessage
161{
162 /**
163 * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
164 * GNUNET_MESSAGE_TYPE_SET_REMOVE
165 */
166 struct GNUNET_MessageHeader header;
167
168 uint16_t element_type GNUNET_PACKED;
169
170 /* rest: the actual element */
171};
172
173
174struct CancelMessage
175{
176 /**
177 * Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
178 */
179 struct GNUNET_MessageHeader header;
180
181 /**
182 * id we want to cancel result belongs to
183 */
184 uint32_t request_id GNUNET_PACKED;
185};
186
187GNUNET_NETWORK_STRUCT_END
188
189#endif