Choco OS  V.0.16.9.0
Join to the chocolate world
oc_dynamic_config.h
Go to the documentation of this file.
1 
27 #ifndef Dynamic_LIBRARIES_INC_OC_Dynamic_CFG_H_
28 #define Dynamic_LIBRARIES_INC_OC_Dynamic_CFG_H_
29 
30 #include <oc_stdtypes.h>
31 #include <oc_1word.h>
32 #include <oc_errors.h>
33 #include <oc_time.h>
34 #include <oc_memory.h>
35 #include <oc_cfg.h>
36 
42 #define _________________________________________DEFINITIONS_SECTION________________________________________________________________________
43 
44 //==========================================================================================================================================
49 //==========================================================================================================================================
50 #define oC_CONFIGURATIONS_MODULES_LIST(ADD,DONT_ADD) \
51  ADD( Tcp , "Tcp" )\
52  ADD( ExcHan , "Exception Handler" )\
53  ADD( Telnet , "Telnet" )\
54 
55 //==========================================================================================================================================
62 //==========================================================================================================================================
63 #define oC_CONFIGURATIONS_LIST(ADD,DONT_ADD) \
64  ADD( Tcp , oC_MemorySize_t , StackSize , B(8096) , "Stack Size" , "Default size of the stack for TCP server threads " )\
65  ADD( Tcp , uint16_t , WindowSize , B(1500) , "Window Size" , "Default size of the window for new TCP connections" )\
66  ADD( Tcp , uint8_t , WindowScale , 0 , "Window Scale" , "Default scale of the window for new TCP connections" )\
67  ADD( Tcp , oC_Time_t , ConfirmationTimeout , ms(500) , "Confirmation Timeout" , "Maximum time for the confirmation before retransmission of a packet" )\
68  ADD( Tcp , oC_Time_t , WaitForConnectionTimeout , day(1) , "WfC Timeout" , "Maximum time to wait for new connection" )\
69  ADD( Tcp , oC_Time_t , DeleteConnectionTimeout , day(1) , "Delete Connection Timeout" , "Maximum time for deleting connections" )\
70  ADD( Tcp , oC_Time_t , DecisionTimeout , s(1) , "Decision Timeout" , "Maximum time for making decision about accepting connection" )\
71  ADD( Tcp , oC_Time_t , AcceptConnectionTimeout , s(1) , "Accept Connection Timeout" , "Maximum time for accepting connections" )\
72  ADD( Tcp , oC_Time_t , RejectConnectionTimeout , ms(500) , "Reject Connection Timeout" , "Maximum time for rejecting connections" )\
73  ADD( Tcp , oC_Time_t , ExpirationTimeout , min(10) , "Expiration Timeout" , "Maximum time without receiving packets" )\
74  ADD( Tcp , oC_Time_t , SendingAcknowledgeTimeout , ms(0) , "Sending ACK Timeout" , "Maximum time to wait for sending ACK message" )\
75  ADD( Tcp , oC_Time_t , ReadSegmentTimeout , ms(500) , "Read Segment Timeout" , "Maximum time to wait for an app to read a received segment" )\
76  ADD( Tcp , oC_Time_t , ReceiveTimeout , ms(500) , "Receive Timeout" , "Maximum time to wait for a packet before checking expiration timeout" )\
77  ADD( Tcp , uint32_t , InitialSequenceNumber , 0 , "ISN" , "Initial Sequence Number for new connections" )\
78  ADD( Tcp , oC_MemorySize_t , PacketSize , B(1024) , "Packet Size" , "Size of a packet used for sending data" )\
79  ADD( ExcHan, oC_Time_t , MemoryEventsLoggingPeriod , min(1) , "Memory events logging period", "Minimum time to elapse before logging again an event" )\
80  ADD( Telnet, uint32_t , MaxConnections , 5 , "Max Connections" , "Maximum number of connections over Telnet" )\
81  ADD( Telnet, oC_Time_t , StartServerTimeout , s(3) , "Start Server Timeout" , "Maximum time for starting the Telnet server" )\
82  ADD( Telnet, oC_Time_t , StopServerTimeout , s(3) , "Stop Server Timeout" , "Maximum time for stopping the Telnet server" )\
83  ADD( Telnet, oC_Time_t , DisconnectTimeout , ms(500) , "Disconnect Timeout" , "Maximum time for disconnecting telnet connection" )\
84  ADD( Telnet, oC_Time_t , NaglePeriod , ms(50) , "Nagle Period" , "Period of buffering according to the Nagle's Algorithm" )\
85  ADD( Telnet, oC_Time_t , NagleMaximumInactiveTime , ms(500) , "Max Nagle Inactive Time" , "Maximum time to wait when Nagle's thread is inactive" )\
86  ADD( Telnet, oC_Time_t , NagleSendingTimeout , ms(200) , "Nagle Sending Timeout" , "Maximum time for TCP transmission" )\
87  ADD( Telnet, oC_MemorySize_t , NagleBufferSize , B(1024) , "Nagle Buffer Size" , "Size of the buffer allocated for the Nagle's Algorithm" )\
88  ADD( Telnet, oC_MemorySize_t , NagleThreadStackSize , B(2048) , "Nagle Thread Stack Size" , "Size of the stack of the Nagle's Algorithm thread" )\
89 
90 #undef _________________________________________DEFINITIONS_SECTION________________________________________________________________________
91 
97 #define _________________________________________TYPES_SECTION______________________________________________________________________________
98 
99 //==========================================================================================================================================
103 //==========================================================================================================================================
104 #define oC_DynamicConfig_Module_( MODULE_NAME ) oC_1WORD_FROM_2( oC_DynamicConfig_Module_, MODULE_NAME )
105 
106 //==========================================================================================================================================
110 //==========================================================================================================================================
111 typedef enum
112 {
113 #define ADD( MODULE_NAME, FRIENDLY_STRING ) oC_DynamicConfig_Module_( MODULE_NAME ) ,
114 #define DONT_ADD(...)
115 
116  oC_CONFIGURATIONS_MODULES_LIST(ADD,DONT_ADD)
117 
118 #undef ADD
119 #undef DONT_ADD
121 
122 //==========================================================================================================================================
126 //==========================================================================================================================================
127 typedef enum
128 {
129 
130 #define ADD( MODULE_NAME, TYPE , VARIABLE_NAME, DEFAULT_VALUE, FRIENDLY_NAME, BRIEF ) \
131  oC_1WORD_FROM_4( oC_DynamicConfig_VariableId_, MODULE_NAME , _ , VARIABLE_NAME ) ,
132 #define DONT_ADD(...)
133 
134  oC_CONFIGURATIONS_LIST(ADD,DONT_ADD)
135 
136  oC_DynamicConfig_VariableId_NumberOfElements
137 #undef ADD
138 #undef DONT_ADD
139 
141 
142 //==========================================================================================================================================
148 //==========================================================================================================================================
149 typedef struct
150 {
152  const char * TypeName;
153  oC_MemorySize_t TypeSize;
154  void * ValueReference;
155  const char * VariableName;
156  const char * FriendlyName;
157  const char * Brief;
159 
160 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
161 
167 #define _________________________________________VARIABLES_SECTION__________________________________________________________________________
168 
169 #define DYNAMIC_CONFIG_MAKE_VARIABLE_NAME(MODULE_NAME,VARIABLE_NAME) oC_1WORD_FROM_4(oC_DynamicConfig_, MODULE_NAME, _ , VARIABLE_NAME)
170 
171 //==========================================================================================================================================
172 /* Creating variables to store values of configurations */
173 //==========================================================================================================================================
174 #define ADD( MODULE_NAME, TYPE , VARIABLE_NAME, DEFAULT_VALUE, FRIENDLY_NAME, BRIEF ) \
175  extern TYPE DYNAMIC_CONFIG_MAKE_VARIABLE_NAME(MODULE_NAME, VARIABLE_NAME);
176 #define DONT_ADD(...)
177 
178 oC_CONFIGURATIONS_LIST(ADD,DONT_ADD);
179 
180 #undef ADD
181 #undef DONT_ADD
182 
183 
184 //==========================================================================================================================================
185 /* Array with details of configuration variables */
186 //==========================================================================================================================================
187 extern oC_DynamicConfig_VariableDetails_t oC_DynamicConfig_VariablesDetails[oC_DynamicConfig_VariableId_NumberOfElements];
188 
189 #undef _________________________________________VARIABLES_SECTION__________________________________________________________________________
190 
196 #define _________________________________________INTERFACE_SECTION__________________________________________________________________________
197 
198 #define oC_DynamicConfig_SetValue( MODULE_NAME, VARIABLE_NAME, VALUE ) DYNAMIC_CONFIG_MAKE_VARIABLE_NAME( MODULE_NAME, VARIABLE_NAME ) = VALUE
199 #define oC_DynamicConfig_GetValue( MODULE_NAME, VARIABLE_NAME ) DYNAMIC_CONFIG_MAKE_VARIABLE_NAME( MODULE_NAME, VARIABLE_NAME )
200 
201 #undef _________________________________________INTERFACE_SECTION__________________________________________________________________________
202 
203 
204 #endif /* Dynamic_LIBRARIES_INC_OC_Dynamic_CFG_H_ */
Contains macros for creating one word from more words in macros.
const char * TypeName
Name of the type.
The file with interface for the GPIO driver.
stores configuration data
#define oC_CONFIGURATIONS_LIST(ADD, DONT_ADD)
The library with time definitions.
#define oC_CONFIGURATIONS_MODULES_LIST(ADD, DONT_ADD)
Helper macros for configurations files.
oC_DynamicConfig_Module_t Module
Module associated with the variable.
const char * FriendlyName
Friendly name of the variable.
oC_MemorySize_t TypeSize
Size of the type.
const char * Brief
Quick description of the variable.
oC_DynamicConfig_VariableId_t
stores ID of the configuration variable
const char * VariableName
Name of the variable that stores the configuration.
oC_DynamicConfig_VariableDetails_t oC_DynamicConfig_VariablesDetails[oC_DynamicConfig_VariableId_NumberOfElements]
array with definitions of variables details
void * ValueReference
Pointer to the variable that stores the configuration.
oC_DynamicConfig_Module_t
stores configuration module ID
FILE__DESCRIPTION