Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
net_messages.h
1 
2 /***************************************************************************
3  * config_messages.h - Fawkes Configuration Messages
4  *
5  * Created: Sat Jan 06 23:14:59 2007
6  * Copyright 2006-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FAWKES_CONFIG_MESSAGES_H_
25 #define __FAWKES_CONFIG_MESSAGES_H_
26 
27 #include <stdint.h>
28 #include <netcomm/utils/dynamic_buffer.h>
29 
30 #pragma pack(push,4)
31 
32 namespace fawkes {
33 
34 #define MSG_CONFIG_GET_FLOAT 1
35 #define MSG_CONFIG_GET_UINT 2
36 #define MSG_CONFIG_GET_INT 3
37 #define MSG_CONFIG_GET_BOOL 4
38 #define MSG_CONFIG_GET_STRING 5
39 #define MSG_CONFIG_GET_VALUE 6
40 #define MSG_CONFIG_GET_COMMENT 7
41 #define MSG_CONFIG_GET_DEFAULT_COMMENT 8
42 #define MSG_CONFIG_GET_BEGIN MSG_CONFIG_GET_FLOAT
43 #define MSG_CONFIG_GET_END MSG_CONFIG_GET_DEFAULT_COMMENT
44 #define MSG_CONFIG_GET_ALL 9
45 
46 #define MSG_CONFIG_SET_FLOAT 10
47 #define MSG_CONFIG_SET_UINT 11
48 #define MSG_CONFIG_SET_INT 12
49 #define MSG_CONFIG_SET_BOOL 13
50 #define MSG_CONFIG_SET_STRING 14
51 #define MSG_CONFIG_SET_COMMENT 15
52 #define MSG_CONFIG_SET_DEFAULT_FLOAT 16
53 #define MSG_CONFIG_SET_DEFAULT_UINT 17
54 #define MSG_CONFIG_SET_DEFAULT_INT 18
55 #define MSG_CONFIG_SET_DEFAULT_BOOL 19
56 #define MSG_CONFIG_SET_DEFAULT_STRING 20
57 #define MSG_CONFIG_SET_DEFAULT_COMMENT 21
58 #define MSG_CONFIG_SET_BEGIN MSG_CONFIG_SET_FLOAT
59 #define MSG_CONFIG_SET_END MSG_CONFIG_SET_DEFAULT_COMMENT
60 #define MSG_CONFIG_ERASE_VALUE 22
61 
62 #define MSG_CONFIG_GET_TAGS 25
63 #define MSG_CONFIG_LOAD_TAG 26
64 #define MSG_CONFIG_SAVE_TAG 27
65 #define MSG_CONFIG_INV_TAG 28
66 #define MSG_CONFIG_DEL_TAG 29
67 
68 #define MSG_CONFIG_FLOAT_VALUE 30
69 #define MSG_CONFIG_UINT_VALUE 31
70 #define MSG_CONFIG_INT_VALUE 32
71 #define MSG_CONFIG_BOOL_VALUE 33
72 #define MSG_CONFIG_STRING_VALUE 34
73 #define MSG_CONFIG_COMMENT_VALUE 35
74 #define MSG_CONFIG_VALUE_BEGIN MSG_CONFIG_FLOAT_VALUE
75 #define MSG_CONFIG_VALUE_END MSG_CONFIG_COMMENT_VALUE
76 #define MSG_CONFIG_INV_VALUE 36
77 #define MSG_CONFIG_VALUE_ERASED 37
78 #define MSG_CONFIG_LIST 38
79 
80 #define MSG_CONFIG_SUBSCRIBE 50
81 #define MSG_CONFIG_UNSUBSCRIBE 51
82 
83 
84 /* Length definitions */
85 #define CONFIG_MSG_PATH_LENGTH 128
86 #define CONFIG_MSG_MAX_TAG_LENGTH 64
87 
88 /** Basic config descriptor.
89  * Path that defines a unique element in the configuration.
90  * It is part of most messages.
91  */
92 typedef struct {
93  char path[CONFIG_MSG_PATH_LENGTH]; /**< path to config value. */
94  uint32_t is_default : 1; /**< 1 if value is a default value, 0
95  * otherwise, only for get response */
96  uint32_t reserved : 31; /**< Reserved for future use. */
98 
99 /** Get value message. */
100 typedef struct {
101  config_descriptor_t cp; /**< value descriptor */
103 
104 /** Invalid value request message. */
105 typedef struct {
106  config_descriptor_t cp; /**< value descriptor */
108 
109 /** Erase value request. */
110 typedef struct {
111  config_descriptor_t cp; /**< value descriptor */
113 
114 /** Value erased message. */
115 typedef struct {
116  config_descriptor_t cp; /**< value descriptor */
118 
119 /** Float value message */
120 typedef struct {
121  config_descriptor_t cp; /**< value descriptor */
122  float f; /**< value */
124 
125 /** Unsigned int value message */
126 typedef struct {
127  config_descriptor_t cp; /**< value descriptor */
128  uint32_t u; /**< value */
130 
131 /** Integer value message */
132 typedef struct {
133  config_descriptor_t cp; /**< value descriptor */
134  int32_t i; /**< value */
136 
137 /** Boolean value message */
138 typedef struct {
139  config_descriptor_t cp; /**< value descriptor */
140  uint32_t b; /**< value */
142 
143 /** String value message */
144 typedef struct {
145  config_descriptor_t cp; /**< value descriptor */
146  uint16_t s_length; /**< Length of following string */
147  char s[2]; /**< string value, 0-terminated */
149 
150 
151 /** Comment message */
152 typedef struct {
153  config_descriptor_t cp; /**< value descriptor */
154  uint16_t s_length; /**< Length of following string */
155  char s[2]; /**< comment, 0-terminated */
157 
158 /** Tag message. */
159 typedef struct {
160  config_descriptor_t cp; /**< value descriptor */
161  char tag[CONFIG_MSG_MAX_TAG_LENGTH]; /**< tag */
163 
164 
165 /** Config list message. */
166 typedef struct {
167  dynamic_list_t config_list; /**< DynamicBuffer for list */
169 
170 /** Config list entity header. */
171 typedef struct {
172  config_descriptor_t cp; /**< Config descriptor. */
173  uint32_t type : 8; /**< type of entity, uses MSG_CONFIG_*_VALUE message IDs */
174  uint32_t reserved : 24; /**< reserved for future use */
176 
177 /** Config list float entity. */
178 typedef struct {
179  config_list_entity_header_t header; /**< config entity header */
180  float f; /**< float value */
182 
183 /** Config list unsigned int entity. */
184 typedef struct {
185  config_list_entity_header_t header; /**< config entity header */
186  uint32_t u; /**< uint value */
188 
189 /** Config list int entity. */
190 typedef struct {
191  config_list_entity_header_t header; /**< config entity header */
192  int32_t i; /**< float value */
194 
195 /** Config list bool entity. */
196 typedef struct {
197  config_list_entity_header_t header; /**< config entity header */
198  int32_t b; /**< 0 is false, everything else is true */
200 
201 /** Config list string entity. */
202 typedef struct {
203  config_list_entity_header_t header; /**< config entity header */
204  uint16_t s_length; /**< length of following string value */
205  char s[2]; /**< string value, 0-terminated */
207 
208 /** Config list comment entity. */
209 typedef struct {
210  config_list_entity_header_t header; /**< config entity header */
211  uint16_t s_length; /**< Length of following comment string */
212  char s[2]; /**< Comment value, 0-terminated */
214 
215 } // end namespace fawkes
216 
217 #pragma pack(pop)
218 
219 #endif