Merge branch 'master' of gnunet.org:gnunet
[oweals/gnunet.git] / src / arm / arm.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your 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      Affero General Public License for more details.
14     
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20  * @author Christian Grothoff
21  * @file arm/arm.h
22  */
23 #ifndef ARM_H
24 #define ARM_H
25
26 #include "gnunet_common.h"
27
28 /**
29  * This option will turn on the DEBUG loglevel for
30  * all processes controlled by this ARM!
31  */
32 #define DEBUG_ARM GNUNET_EXTRA_LOGGING
33
34 GNUNET_NETWORK_STRUCT_BEGIN
35
36 /**
37  * Status update from ARM to client.
38  */
39 struct GNUNET_ARM_StatusMessage
40 {
41
42   /**
43    * Reply to client, of type is #GNUNET_MESSAGE_TYPE_ARM_STATUS.
44    */
45   struct GNUNET_MessageHeader header;
46
47   /**
48    * Status from the 'enum GNUNET_ARM_ServiceStatus'
49    */
50   uint32_t status;
51
52   /* followed by a 0-terminated service name */
53 };
54
55 struct GNUNET_ARM_Message
56 {
57   /**
58    * Reply to client, type is #GNUNET_MESSAGE_TYPE_ARM_RESULT or
59    * #GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT.
60    * OR
61    * Request from client, type is #GNUNET_MESSAGE_TYPE_ARM_START or
62    * #GNUNET_MESSAGE_TYPE_ARM_STOP.
63    */
64   struct GNUNET_MessageHeader header;
65
66   /**
67    * For alignment.
68    */
69   uint32_t reserved;
70
71   /**
72    * ID of a request that is being replied to.
73    * OR
74    * ID of a request that is being sent.
75    */
76   uint64_t request_id;
77
78   /* For requests - followed by a 0-terminated service name */
79 };
80
81
82 /**
83  * Reply from ARM to client.
84  */
85 struct GNUNET_ARM_ResultMessage
86 {
87
88   /**
89    * Reply to client, of type is #GNUNET_MESSAGE_TYPE_ARM_RESULT, with an ID.
90    */
91   struct GNUNET_ARM_Message arm_msg;
92
93   /**
94    * Result from the `enum GNUNET_ARM_Result`
95    */
96   uint32_t result;
97 };
98
99 /**
100  * Reply from ARM to client for the
101  * #GNUNET_MESSAGE_TYPE_ARM_LIST request followed by count
102  * '\0' terminated strings. header->size contains the
103  * total size (including all strings).
104  */
105 struct GNUNET_ARM_ListResultMessage
106 {
107   /**
108    * Reply to client, of type is #GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT,
109    * with an ID.
110    */
111   struct GNUNET_ARM_Message arm_msg;
112
113   /**
114    * Number of '\0' terminated strings that follow
115    * this message.
116    */
117   uint16_t count;
118 };
119
120 GNUNET_NETWORK_STRUCT_END
121
122 #endif