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 <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  uint16_t is_default : 1; /**< 1 if value is a default value, 0
95  * otherwise, only for get response */
96  uint16_t reserved : 15; /**< Reserved for future use. */
97  uint16_t num_values; /**< Number of valus in list. */
99 
100 /** Get value message. */
101 typedef struct {
102  config_descriptor_t cp; /**< value descriptor */
104 
105 /** Invalid value request message. */
106 typedef struct {
107  config_descriptor_t cp; /**< value descriptor */
109 
110 /** Erase value request. */
111 typedef struct {
112  config_descriptor_t cp; /**< value descriptor */
114 
115 /** Value erased message. */
116 typedef struct {
117  config_descriptor_t cp; /**< value descriptor */
119 
120 /** String value header indicating the string length. */
121 typedef struct {
122  uint16_t s_length; /**< Length of following string */
123  uint16_t reserved; /**< Reserved for future use */
125 
126 
127 /** Comment message */
128 typedef struct {
129  config_descriptor_t cp; /**< value descriptor */
130  uint16_t s_length; /**< Length of following string */
131  char s[2]; /**< comment, 0-terminated */
133 
134 /** Tag message. */
135 typedef struct {
136  config_descriptor_t cp; /**< value descriptor */
137  char tag[CONFIG_MSG_MAX_TAG_LENGTH]; /**< tag */
139 
140 
141 /** Config list message. */
142 typedef struct {
143  dynamic_list_t config_list; /**< DynamicBuffer for list */
145 
146 /** Config list entity header. */
147 typedef struct {
148  config_descriptor_t cp; /**< Config descriptor. */
149  uint32_t type : 8; /**< type of entity, uses MSG_CONFIG_*_VALUE message IDs */
150  uint32_t reserved : 24; /**< reserved for future use */
152 
153 } // end namespace fawkes
154 
155 #pragma pack(pop)
156 
157 #endif
config_descriptor_t cp
value descriptor
Definition: net_messages.h:129
uint16_t reserved
Reserved for future use.
Definition: net_messages.h:96
Fawkes library namespace.
config_descriptor_t cp
value descriptor
Definition: net_messages.h:112
Get value message.
Definition: net_messages.h:101
config_descriptor_t cp
value descriptor
Definition: net_messages.h:107
config_descriptor_t cp
value descriptor
Definition: net_messages.h:136
dynamic_list_t config_list
DynamicBuffer for list.
Definition: net_messages.h:143
Dynamic list type.
uint32_t type
type of entity, uses MSG_CONFIG_*_VALUE message IDs
Definition: net_messages.h:149
uint16_t s_length
Length of following string.
Definition: net_messages.h:130
uint16_t is_default
1 if value is a default value, 0 otherwise, only for get response
Definition: net_messages.h:94
String value header indicating the string length.
Definition: net_messages.h:121
config_descriptor_t cp
value descriptor
Definition: net_messages.h:117
Basic config descriptor.
Definition: net_messages.h:92
uint16_t reserved
Reserved for future use.
Definition: net_messages.h:123
uint16_t num_values
Number of valus in list.
Definition: net_messages.h:97
Config list message.
Definition: net_messages.h:142
config_descriptor_t cp
Config descriptor.
Definition: net_messages.h:148
uint32_t reserved
reserved for future use
Definition: net_messages.h:150
Invalid value request message.
Definition: net_messages.h:106
Value erased message.
Definition: net_messages.h:116
Config list entity header.
Definition: net_messages.h:147
uint16_t s_length
Length of following string.
Definition: net_messages.h:122
config_descriptor_t cp
value descriptor
Definition: net_messages.h:102