issuer
[oweals/gnunet.git] / src / experimentation / gnunet-daemon-experimentation.h
1 /*
2      This file is part of GNUnet.
3      (C) 2009 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 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., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file experimentation/gnunet-daemon-experimentation.h
23  * @brief experimentation daemon
24  * @author Christian Grothoff
25  * @author Matthias Wachs
26  */
27 #include "platform.h"
28 #include "gnunet_getopt_lib.h"
29 #include "gnunet_util_lib.h"
30 #include "gnunet_core_service.h"
31 #include "gnunet_statistics_service.h"
32
33
34 /**
35  * Timeout between request and expected response
36  */
37 #define EXP_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
38
39 extern struct GNUNET_STATISTICS_Handle *GSE_stats;
40
41 extern struct GNUNET_CONFIGURATION_Handle *GSE_cfg;
42
43 extern uint32_t GSE_node_capabilities;
44
45 /**
46  * Capabilities a node has or an experiment requires
47  */
48 enum GNUNET_EXPERIMENTATION_capabilities
49 {
50         NONE = 0,
51         PLUGIN_TCP = 1,
52         PLUGIN_UDP = 2,
53         PLUGIN_UNIX = 4,
54         PLUGIN_HTTP_CLIENT = 8,
55         PLUGIN_HTTP_SERVER = 16,
56         PLUGIN_HTTPS_CLIENT = 32,
57         PLUGIN_HTTPS_SERVER = 64,
58         PLUGIN_WLAN = 128,
59         HAVE_IPV6 = 256,
60         BEHIND_NAT = 512
61 };
62
63
64 /**
65  * A experimentation node
66  */
67 struct Node
68 {
69         /**
70          * Peer id
71          */
72         struct GNUNET_PeerIdentity id;
73
74         /**
75          * Task for response timeout
76          */
77         GNUNET_SCHEDULER_TaskIdentifier timeout_task;
78
79         /**
80          * Core transmission handle
81          */
82         struct GNUNET_CORE_TransmitHandle *cth;
83
84         uint32_t capabilities;
85 };
86
87 /**
88  * Experimentation request message
89  * Used to detect experimentation capability
90  */
91 struct Experimentation_Request
92 {
93         struct GNUNET_MessageHeader msg;
94
95         uint32_t capabilities;
96 };
97
98 /**
99  * Experimentation response message
100  * Sent if peer is running the daemon
101  */
102 struct Experimentation_Response
103 {
104         struct GNUNET_MessageHeader msg;
105
106         uint32_t capabilities;
107 };
108
109
110 /**
111  * Start the nodes management
112  */
113 void
114 GNUNET_EXPERIMENTATION_nodes_start ();
115
116
117 /**
118  * Stop the nodes management
119  */
120 void
121 GNUNET_EXPERIMENTATION_nodes_stop ();
122
123 /**
124  * Are the capabilities provided?
125  *
126  * @param have bitstring containing the provided capabilities
127  * @param have bitstring containing the desired capabilities
128  */
129 int
130 GNUNET_EXPERIMENTATION_capabilities_have (uint32_t have, uint32_t desired);
131
132 /**
133  * Start the detecting capabilities
134  */
135 void
136 GNUNET_EXPERIMENTATION_capabilities_start ();
137
138 /**
139  * Stop the detecting capabilities
140  */
141 void
142 GNUNET_EXPERIMENTATION_capabilities_stop ();
143
144
145 /**
146  * Start experiments management
147  *
148  * @return GNUNET_YES or GNUNET_NO
149  */
150 int
151 GNUNET_EXPERIMENTATION_experiments_issuer_accepted (struct GNUNET_PeerIdentity *issuer_ID);
152
153
154 /**
155  * Start experiments management
156  *
157  * @return GNUNET_OK on success, GNUNET_SYSERR on error
158  */
159 int
160 GNUNET_EXPERIMENTATION_experiments_start ();
161
162 /**
163  * Stop experiments management
164  */
165 void
166 GNUNET_EXPERIMENTATION_experiments_stop ();
167
168
169 /* end of gnunet-daemon-experimentation.h */