Fawkes API  Fawkes Development Version
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 <netcomm/utils/dynamic_buffer.h>
28 
29 #include <stdint.h>
30 
31 #pragma pack(push, 4)
32 
33 namespace fawkes {
34 
35 #define MSG_CONFIG_GET_FLOAT 1
36 #define MSG_CONFIG_GET_UINT 2
37 #define MSG_CONFIG_GET_INT 3
38 #define MSG_CONFIG_GET_BOOL 4
39 #define MSG_CONFIG_GET_STRING 5
40 #define MSG_CONFIG_GET_VALUE 6
41 #define MSG_CONFIG_GET_COMMENT 7
42 #define MSG_CONFIG_GET_DEFAULT_COMMENT 8
43 #define MSG_CONFIG_GET_BEGIN MSG_CONFIG_GET_FLOAT
44 #define MSG_CONFIG_GET_END MSG_CONFIG_GET_DEFAULT_COMMENT
45 #define MSG_CONFIG_GET_ALL 9
46 
47 #define MSG_CONFIG_SET_FLOAT 10
48 #define MSG_CONFIG_SET_UINT 11
49 #define MSG_CONFIG_SET_INT 12
50 #define MSG_CONFIG_SET_BOOL 13
51 #define MSG_CONFIG_SET_STRING 14
52 #define MSG_CONFIG_SET_COMMENT 15
53 #define MSG_CONFIG_SET_DEFAULT_FLOAT 16
54 #define MSG_CONFIG_SET_DEFAULT_UINT 17
55 #define MSG_CONFIG_SET_DEFAULT_INT 18
56 #define MSG_CONFIG_SET_DEFAULT_BOOL 19
57 #define MSG_CONFIG_SET_DEFAULT_STRING 20
58 #define MSG_CONFIG_SET_DEFAULT_COMMENT 21
59 #define MSG_CONFIG_SET_BEGIN MSG_CONFIG_SET_FLOAT
60 #define MSG_CONFIG_SET_END MSG_CONFIG_SET_DEFAULT_COMMENT
61 #define MSG_CONFIG_ERASE_VALUE 22
62 
63 #define MSG_CONFIG_GET_TAGS 25
64 #define MSG_CONFIG_LOAD_TAG 26
65 #define MSG_CONFIG_SAVE_TAG 27
66 #define MSG_CONFIG_INV_TAG 28
67 #define MSG_CONFIG_DEL_TAG 29
68 
69 #define MSG_CONFIG_FLOAT_VALUE 30
70 #define MSG_CONFIG_UINT_VALUE 31
71 #define MSG_CONFIG_INT_VALUE 32
72 #define MSG_CONFIG_BOOL_VALUE 33
73 #define MSG_CONFIG_STRING_VALUE 34
74 #define MSG_CONFIG_COMMENT_VALUE 35
75 #define MSG_CONFIG_VALUE_BEGIN MSG_CONFIG_FLOAT_VALUE
76 #define MSG_CONFIG_VALUE_END MSG_CONFIG_COMMENT_VALUE
77 #define MSG_CONFIG_INV_VALUE 36
78 #define MSG_CONFIG_VALUE_ERASED 37
79 #define MSG_CONFIG_LIST 38
80 
81 #define MSG_CONFIG_SUBSCRIBE 50
82 #define MSG_CONFIG_UNSUBSCRIBE 51
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 {
94  char path[CONFIG_MSG_PATH_LENGTH]; /**< path to config value. */
95  uint16_t is_default : 1; /**< 1 if value is a default value, 0
96  * otherwise, only for get response */
97  uint16_t reserved : 15; /**< Reserved for future use. */
98  uint16_t num_values; /**< Number of valus in list. */
100 
101 /** Get value message. */
102 typedef struct
103 {
104  config_descriptor_t cp; /**< value descriptor */
106 
107 /** Invalid value request message. */
108 typedef struct
109 {
110  config_descriptor_t cp; /**< value descriptor */
112 
113 /** Erase value request. */
114 typedef struct
115 {
116  config_descriptor_t cp; /**< value descriptor */
118 
119 /** Value erased message. */
120 typedef struct
121 {
122  config_descriptor_t cp; /**< value descriptor */
124 
125 /** String value header indicating the string length. */
126 typedef struct
127 {
128  uint16_t s_length; /**< Length of following string */
129  uint16_t reserved; /**< Reserved for future use */
131 
132 /** Comment message */
133 typedef struct
134 {
135  config_descriptor_t cp; /**< value descriptor */
136  uint16_t s_length; /**< Length of following string */
137  char s[2]; /**< comment, 0-terminated */
139 
140 /** Tag message. */
141 typedef struct
142 {
143  config_descriptor_t cp; /**< value descriptor */
144  char tag[CONFIG_MSG_MAX_TAG_LENGTH]; /**< tag */
146 
147 /** Config list message. */
148 typedef struct
149 {
150  dynamic_list_t config_list; /**< DynamicBuffer for list */
152 
153 /** Config list entity header. */
154 typedef struct
155 {
156  config_descriptor_t cp; /**< Config descriptor. */
157  uint32_t type : 8; /**< type of entity, uses MSG_CONFIG_*_VALUE message IDs */
158  uint32_t reserved : 24; /**< reserved for future use */
160 
161 } // end namespace fawkes
162 
163 #pragma pack(pop)
164 
165 #endif
fawkes::config_value_erased_msg_t
Value erased message.
Definition: net_messages.h:126
fawkes::config_descriptor_t
Basic config descriptor.
Definition: net_messages.h:98
fawkes::config_list_msg_t
Config list message.
Definition: net_messages.h:154
fawkes::config_erase_value_msg_t::cp
config_descriptor_t cp
value descriptor
Definition: net_messages.h:122
fawkes::config_getval_msg_t
Get value message.
Definition: net_messages.h:108
fawkes::config_comment_msg_t
Comment message.
Definition: net_messages.h:139
fawkes::config_tag_msg_t
Tag message.
Definition: net_messages.h:147
fawkes::config_list_entity_header_t
Config list entity header.
Definition: net_messages.h:160
fawkes::config_erase_value_msg_t
Erase value request.
Definition: net_messages.h:120
fawkes
fawkes::dynamic_list_t
Dynamic list type.
Definition: dynamic_buffer.h:47
fawkes::config_invval_msg_t::cp
config_descriptor_t cp
value descriptor
Definition: net_messages.h:116
fawkes::config_invval_msg_t
Invalid value request message.
Definition: net_messages.h:114
fawkes::config_string_value_t
String value header indicating the string length.
Definition: net_messages.h:132
fawkes::config_getval_msg_t::cp
config_descriptor_t cp
value descriptor
Definition: net_messages.h:110