Mixe for Privacy and Anonymity in the Internet
monitoringDefs.h
Go to the documentation of this file.
1 /*
2 Copyright (c) The JAP-Team, JonDos GmbH
3 
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright notice,
10  this list of conditions and the following disclaimer in the documentation and/or
11  other materials provided with the distribution.
12  * Neither the name of the University of Technology Dresden, Germany, nor the name of
13  the JonDos GmbH, nor the names of their contributors may be used to endorse or
14  promote products derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 #ifndef MONITORING_DEFS_H_
29 #define MONITORING_DEFS_H_
30 
49 /* How many different status types exist*/
50 
51 #define STATUS_FLAG(status_type) (1<<(unsigned int)status_type)
52 
53 #define FIRST_STATUS 0
54 #define FIRST_EVENT 0
55 #define ENTRY_STATE 0
56 
57 #define DOM_ELEMENT_STATUS_MESSAGE_NAME "StatusMessage"
58 #define DOM_ELEMENT_STATE_NAME "State"
59 #define DOM_ELEMENT_STATE_LEVEL_NAME "StateLevel"
60 #define DOM_ELEMENT_STATE_DESCRIPTION_NAME "StateDescription"
61 
62 #define MAX_DESCRIPTION_LENGTH 50
63 #define MONITORING_SERVER_PORT 8080
64 #define XML_STATUS_MESSAGE_MAX_SIZE 3000
65 
66 #define XML_STATUS_MESSAGE_START "<StatusMessage>"
67 #define HTTP_ANSWER_PREFIX_FORMAT "HTTP/1.1 200 OK\nContent-Length: %u\nConnection: close\nContent-Type: text/xml; charset=UTF-8\n\n"
68 
69 #define HTTP_ANSWER_PREFIX_MAX_LENGTH 100
70 
71 #define EVER 1
72 
73 //all status types
75 {
76  stat_undef = -1,
78 #ifdef PAYMENT
79  stat_payment,
80 #endif
82  stat_all
83 };
84 
85 #define NR_STATUS_TYPES stat_all
86 
87 //enum type for the id of a state
89 {
90  st_ignore = -1,
91  /* networking states */
97  st_net_overall, /* only represents the number all network states */
98 #ifdef PAYMENT
99  /* payment states */
100  st_pay_entry = 0,
101  st_pay_aiInit, st_pay_aiShutdown,
102  st_pay_biAvailable, st_pay_biUnreachable, st_pay_biPermanentlyUnreachable,
103  st_pay_dbError, st_pay_dbErrorBiUnreachable, st_pay_dbErrorBiPermanentlyUnreachable,
104  st_pay_overall, /* only represents the number all payment states */
105 #endif
106  /* system states */
110  st_sys_overall /* only represents the number all system states */
111 };
112 
113 //enum type for the id of an event
115 {
116  /* networking events */
122  ev_net_overall, /* only represents the number all network events */
123 #ifdef PAYMENT
124  /* payment events */
125  ev_pay_aiInited = 0, ev_pay_aiShutdown,
126  ev_pay_biConnectionSuccess, ev_pay_biConnectionFailure, ev_pay_biConnectionCriticalSubseqFailures,
127  ev_pay_dbConnectionSuccess, ev_pay_dbConnectionFailure,
128  ev_pay_overall, /* only represents the number all payment events */
129 #endif
130  /* system events */
134  ev_sys_overall /* only represents the number all system events */
135 };
136 
137 #ifdef PAYMENT
138  #define PAYMENT_STATUS_NAME "PaymentStatus"
139  #define NR_PAYMENT_STATES st_pay_overall
140  #define NR_PAYMENT_EVENTS ev_pay_overall
141 #endif
142 
143 #define NETWORKING_STATUS_NAME "NetworkingStatus"
144 #define NR_NETWORKING_STATES st_net_overall
145 #define NR_NETWORKING_EVENTS ev_net_overall
146 
147 #define SYSTEM_STATUS_NAME "SystemStatus"
148 #define NR_SYSTEM_STATES st_sys_overall
149 #define NR_SYSTEM_EVENTS ev_sys_overall
150 
151 static const char *STATUS_NAMES[NR_STATUS_TYPES] =
152 {
154 #ifdef PAYMENT
155  PAYMENT_STATUS_NAME,
156 #endif
158 };
159 
160 static const int EVENT_COUNT[NR_STATUS_TYPES] =
161 {
163 #ifdef PAYMENT
164  NR_PAYMENT_EVENTS,
165 #endif
167 };
168 
169 static const int STATE_COUNT[NR_STATUS_TYPES] =
170 {
172 #ifdef PAYMENT
173  NR_PAYMENT_STATES,
174 #endif
176 };
177 
178 
179 /* indices must correspond to strings in STATUS_LEVEL_NAMES */
181 {
183 };
184 
185 #define NR_STATE_LEVELS stl_all
186 
187 static const char *STATUS_LEVEL_NAMES[NR_STATE_LEVELS] =
188 {
189  "OK", "WARNING", "CRITICAL", "UNKNOWN"
190 };
191 
192 typedef enum state_type state_type_t;
193 typedef enum status_type status_type_t;
194 typedef enum state_type transition_t;
195 typedef enum event_type event_type_t;
196 typedef enum state_level state_level_t;
197 
198 //struct representing an event
199 struct event
200 {
201  event_type_t ev_type; //id of the event
202  status_type_t ev_statusType; //status to which the event belongs
203  char *ev_description; //text description of this event.
204 };
205 
206 struct state
207 {
208  state_type_t st_type; //id of the state
209  status_type_t st_statusType; //status to which the state belongs
210  state_level_t st_stateLevel; //level of the state (e.g "ok", "critical")
211  char *st_description; //text description of this state.
212  struct event *st_cause;
213  struct state *st_prev;
214  transition_t *st_transitions; //pointer to the transitions which leads from this state to other states
215 };
216 
217 typedef struct state state_t;
218 typedef struct event event_t;
219 
221 #define FINISH_STATE_DEFINITIONS(state_array) \
222  FINISH_NETWORKING_STATE_DEFINITIONS(state_array) \
223  FINISH_PAYMENT_STATE_DEFINITIONS(state_array) \
224  FINISH_SYSTEM_STATE_DEFINITIONS(state_array)
225 
226 #define FINISH_EVENT_DEFINITIONS(event_array) \
227  FINISH_NETWORKING_EVENT_DEFINITIONS(event_array) \
228  FINISH_PAYMENT_EVENT_DEFINITIONS(event_array) \
229  FINISH_SYSTEM_EVENT_DEFINITIONS(event_array)
230 
231 /* networking states description and transition assignment
232  * new networking state definitions can be appended here
233  * (after being declared as networking enum state_type)
234  */
235 #define FINISH_NETWORKING_STATE_DEFINITIONS(state_array) \
236  NET_STATE_DEF(state_array, st_net_entry, \
237  "networking entry state", \
238  TRANS_NET_ENTRY, stl_unknown) \
239  NET_STATE_DEF(state_array, st_net_firstMixInit,\
240  "first mix initialized", \
241  TRANS_NET_FIRST_MIX_INIT, stl_warning) \
242  NET_STATE_DEF(state_array, st_net_firstMixConnectedToNext, \
243  "first mix connected to next mix", \
244  TRANS_NET_FIRST_MIX_CONNECTED_TO_NEXT, stl_warning) \
245  NET_STATE_DEF(state_array, st_net_firstMixOnline, \
246  "first mix online", \
247  TRANS_NET_FIRST_MIX_ONLINE, stl_ok) \
248  NET_STATE_DEF(state_array, st_net_middleMixInit, \
249  "middle mix initialized", \
250  TRANS_NET_MIDDLE_MIX_INIT, stl_warning) \
251  NET_STATE_DEF(state_array, st_net_middleMixConnectedToPrev, \
252  "middle mix connected to previous mix", \
253  TRANS_NET_MIDDLE_MIX_CONNECTED_TO_PREV, stl_warning) \
254  NET_STATE_DEF(state_array, st_net_middleMixConnectedToNext, \
255  "middle mix connected to next mix", \
256  TRANS_NET_MIDDLE_MIX_CONNECTED_TO_NEXT, stl_warning) \
257  NET_STATE_DEF(state_array, st_net_middleMixOnline, \
258  "middle mix online", \
259  TRANS_NET_MIDDLE_MIX_ONLINE, stl_ok) \
260  NET_STATE_DEF(state_array, st_net_lastMixInit, \
261  "last mix initialized", \
262  TRANS_NET_LAST_MIX_INIT, stl_warning) \
263  NET_STATE_DEF(state_array, st_net_lastMixConnectedToPrev, \
264  "last mix connected to previous mix", \
265  TRANS_NET_LAST_MIX_CONNECTED_TO_PREV, stl_warning) \
266  NET_STATE_DEF(state_array, st_net_lastMixOnline, \
267  "last mix online", \
268  TRANS_NET_LAST_MIX_ONLINE, stl_ok)
269 
270 /* networking events descriptions */
271 #define FINISH_NETWORKING_EVENT_DEFINITIONS(event_array) \
272  NET_EVENT_DEF(event_array, ev_net_firstMixInited, \
273  "first mix initialization finished") \
274  NET_EVENT_DEF(event_array, ev_net_middleMixInited, \
275  "middle mix initialization finished") \
276  NET_EVENT_DEF(event_array, ev_net_lastMixInited, \
277  "last mix initialization finished") \
278  NET_EVENT_DEF(event_array, ev_net_prevConnected, \
279  "connection to previous mix established") \
280  NET_EVENT_DEF(event_array, ev_net_nextConnected, \
281  "connection to next mix established") \
282  NET_EVENT_DEF(event_array, ev_net_keyExchangePrevSuccessful, \
283  "key exchange with previous mix successful") \
284  NET_EVENT_DEF(event_array, ev_net_keyExchangeNextSuccessful, \
285  "key exchange with next mix successful") \
286  NET_EVENT_DEF(event_array, ev_net_keyExchangePrevFailed, \
287  "key exchange with previous mix failed") \
288  NET_EVENT_DEF(event_array, ev_net_keyExchangeNextFailed, \
289  "key exchange with next mix failed") \
290  NET_EVENT_DEF(event_array, ev_net_prevConnectionClosed, \
291  "connection to previous mix closed") \
292  NET_EVENT_DEF(event_array, ev_net_nextConnectionClosed, \
293  "connection to next mix closed")
294 
295 #ifdef PAYMENT
296  /* payment states description and transition assignment
297  * new payment state definitions can be appended here
298  * (after being declared as payment enum state_type)
299  */
300  #define FINISH_PAYMENT_STATE_DEFINITIONS(state_array) \
301  PAY_STATE_DEF(state_array, st_pay_entry, \
302  "payment entry state", \
303  TRANS_PAY_ENTRY, stl_unknown) \
304  PAY_STATE_DEF(state_array, st_pay_aiInit, \
305  "accounting instance initialized", \
306  TRANS_PAY_AI_INIT, stl_ok) \
307  PAY_STATE_DEF(state_array, st_pay_aiShutdown, \
308  "accounting instance shutdown", \
309  TRANS_PAY_AI_SHUTDOWN, stl_critical) \
310  PAY_STATE_DEF(state_array, st_pay_biAvailable, \
311  "payment instance available", \
312  TRANS_PAY_BI_AVAILABLE, stl_ok) \
313  PAY_STATE_DEF(state_array, st_pay_biUnreachable, \
314  "payment instance temporarily unreachable", \
315  TRANS_PAY_BI_UNREACHABLE, stl_warning) \
316  PAY_STATE_DEF(state_array, st_pay_biPermanentlyUnreachable, \
317  "payment instance permanently unreachable", \
318  TRANS_PAY_BI_PERMANENTLY_UNREACHABLE, stl_critical) \
319  PAY_STATE_DEF(state_array, st_pay_dbError, \
320  "pay DB cannot be accessed ", \
321  TRANS_PAY_DB_ERROR, stl_critical) \
322  PAY_STATE_DEF(state_array, st_pay_dbErrorBiUnreachable, \
323  "pay DB cannot be accessed and Payment Instance temporarily unreachable", \
324  TRANS_PAY_DB_ERROR_BI_UNREACHABLE, stl_critical) \
325  PAY_STATE_DEF(state_array, st_pay_dbErrorBiPermanentlyUnreachable, \
326  "pay DB cannot be accessed and Payment Instance permanently unreachable", \
327  TRANS_PAY_DB_ERROR_BI_PERMANENTLY_UNREACHABLE, stl_critical)
328 
329  /* payment events descriptions */
330  #define FINISH_PAYMENT_EVENT_DEFINITIONS(event_array) \
331  PAY_EVENT_DEF(event_array, ev_pay_aiInited, \
332  "accounting instance initialization finished") \
333  PAY_EVENT_DEF(event_array, ev_pay_aiShutdown, \
334  "accounting instance shutdown finished") \
335  PAY_EVENT_DEF(event_array, ev_pay_biConnectionSuccess, \
336  "successfully connected to payment instance") \
337  PAY_EVENT_DEF(event_array, ev_pay_biConnectionFailure, \
338  "connection to payment instance failed") \
339  PAY_EVENT_DEF(event_array, ev_pay_biConnectionCriticalSubseqFailures, \
340  "connection to payment instance failed permanently") \
341  PAY_EVENT_DEF(event_array, ev_pay_dbConnectionSuccess, \
342  "pay DB access successful") \
343  PAY_EVENT_DEF(event_array, ev_pay_dbConnectionFailure, \
344  "pay DB access failed")
345 #else
346  #define FINISH_PAYMENT_STATE_DEFINITIONS(state_array)
347  #define FINISH_PAYMENT_EVENT_DEFINITIONS(event_array)
348 #endif /* PAYMENT */
349 
350 /* system states description and transition assignment
351  * new system state definitions can be appended here
352  * (after being declared as system enum state_type)
353  */
354 #define FINISH_SYSTEM_STATE_DEFINITIONS(state_array) \
355  SYS_STATE_DEF(state_array, st_sys_entry, \
356  "system entry state", \
357  TRANS_SYS_ENTRY, stl_unknown) \
358  SYS_STATE_DEF(state_array, st_sys_initializing, \
359  "mix is initializing", \
360  TRANS_SYS_INITIALIZING, stl_warning) \
361  SYS_STATE_DEF(state_array, st_sys_operating, \
362  "mix is operating", \
363  TRANS_SYS_OPERATING, stl_ok) \
364  SYS_STATE_DEF(state_array, st_sys_restarting, \
365  "mix is restarting", \
366  TRANS_SYS_RESTARTING, stl_warning) \
367  SYS_STATE_DEF(state_array, st_sys_shuttingDown, \
368  "mix is shutting down", \
369  TRANS_SYS_SHUTTING_DOWN, stl_critical) \
370  SYS_STATE_DEF(state_array, st_sys_ShuttingDownAfterSegFault, \
371  "mix is shutting down due to a segmentation fault!", \
372  TRANS_SYS_SHUTTING_DOWN_AFTER_SEG_FAULT, stl_critical)
373 
374 /* payment events descriptions */
375 #define FINISH_SYSTEM_EVENT_DEFINITIONS(event_array) \
376  SYS_EVENT_DEF(event_array, ev_sys_start, \
377  "mix startup") \
378  SYS_EVENT_DEF(event_array, ev_sys_enterMainLoop, \
379  "mix entering main loop") \
380  SYS_EVENT_DEF(event_array, ev_sys_leavingMainLoop, \
381  "mix leaving main loop") \
382  SYS_EVENT_DEF(event_array, ev_sys_sigTerm, \
383  "mix caught SIG_TERM") \
384  SYS_EVENT_DEF(event_array, ev_sys_sigInt, \
385  "mix caught SIG_INT") \
386  SYS_EVENT_DEF(event_array, ev_sys_sigSegV, \
387  "mix caught SIG_SEGV")
388 
389 /* convenience macros for special status state and event definitions */
390 #define NET_STATE_DEF(state_array, state_type, description, transitions, stateLevel) \
391  STATE_DEF(state_array, stat_networking, state_type, description, transitions, stateLevel)
392 
393 #define NET_EVENT_DEF(event_array, event_type, description) \
394  EVENT_DEF(event_array, stat_networking, event_type, description)
395 
396 #ifdef PAYMENT
397  #define PAY_STATE_DEF(state_array, state_type, description, transitions, stateLevel) \
398  STATE_DEF(state_array, stat_payment, state_type, description, transitions, stateLevel)
399 
400  #define PAY_EVENT_DEF(event_array, event_type, description) \
401  EVENT_DEF(event_array, stat_payment, event_type, description)
402 #else
403  #define PAY_STATE_DEF(state_array, state_type, description, transitions, stateLevel)
404  #define PAY_EVENT_DEF(event_array, event_type, description)
405 #endif
406 
407 #define SYS_STATE_DEF(state_array, state_type, description, transitions, stateLevel) \
408  STATE_DEF(state_array, stat_system, state_type, description, transitions, stateLevel)
409 
410 #define SYS_EVENT_DEF(event_array, event_type, description) \
411  EVENT_DEF(event_array, stat_system, event_type, description)
412 
413 /* This macro is used for assigning state description and state transitions
414  * to the initialized states in the function "initStates()"
415  */
416 #define STATE_DEF(state_array, status_type, state_type, description, transitions, stateLevel) \
417  state_array[status_type][state_type]->st_description = (char *) description; \
418  state_array[status_type][state_type]->st_transitions = transitions; \
419  state_array[status_type][state_type]->st_stateLevel = stateLevel;
420 /* Same for events description assignment */
421 #define EVENT_DEF(event_array, status_type, event_type, description) \
422  event_array[status_type][event_type]->ev_description = (char *) description;
423 
435 transition_t *defineTransitions(status_type_t s_type, int transitionCount, ...);
436 
439 /* transitions for the networking entry state: */
440 #define TRANS_NET_ENTRY \
441  (defineTransitions(stat_networking, 3, \
442  ev_net_firstMixInited, st_net_firstMixInit, \
443  ev_net_middleMixInited, st_net_middleMixInit, \
444  ev_net_lastMixInited, st_net_lastMixInit))
445 
446 /* transitions for st_net_firstMixInit: */
447 #define TRANS_NET_FIRST_MIX_INIT \
448  (defineTransitions(stat_networking, 1, \
449  ev_net_nextConnected, st_net_firstMixConnectedToNext))
450 
451 /* transitions for st_net_firstMixConnectedToNext: */
452 #define TRANS_NET_FIRST_MIX_CONNECTED_TO_NEXT \
453  (defineTransitions(stat_networking, 2, \
454  ev_net_keyExchangeNextSuccessful, st_net_firstMixOnline, \
455  ev_net_nextConnectionClosed, st_net_firstMixInit))
456 
457 /* transitions for st_net_firstMixOnline: */
458 #define TRANS_NET_FIRST_MIX_ONLINE \
459  (defineTransitions(stat_networking, 1, \
460  ev_net_nextConnectionClosed, st_net_firstMixInit))
461 
462 /* transitions for st_net_middleMixInit: */
463 #define TRANS_NET_MIDDLE_MIX_INIT \
464  (defineTransitions(stat_networking, 1, \
465  ev_net_prevConnected, st_net_middleMixConnectedToPrev))
466 
467 /* transitions for st_net_middleMixConnectedToPrev: */
468 #define TRANS_NET_MIDDLE_MIX_CONNECTED_TO_PREV \
469  (defineTransitions(stat_networking, 2, \
470  ev_net_nextConnected, st_net_middleMixConnectedToNext, \
471  ev_net_prevConnectionClosed, st_net_middleMixInit))
472 
473 /* transitions for st_net_middleMixConnectedToNext: */
474 #define TRANS_NET_MIDDLE_MIX_CONNECTED_TO_NEXT \
475  (defineTransitions(stat_networking, 4, \
476  ev_net_keyExchangeNextFailed, st_net_middleMixInit, \
477  ev_net_keyExchangePrevFailed, st_net_middleMixInit, \
478  ev_net_keyExchangeNextSuccessful, st_net_middleMixConnectedToNext, \
479  ev_net_keyExchangePrevSuccessful, st_net_middleMixOnline))
480 
481 /* transitions for st_net_middleMixOnline: */
482 #define TRANS_NET_MIDDLE_MIX_ONLINE \
483  (defineTransitions(stat_networking, 2, \
484  ev_net_prevConnectionClosed, st_net_middleMixInit, \
485  ev_net_nextConnectionClosed, st_net_middleMixInit))
486 
487 /* transitions for st_net_lastMixInit: */
488 #define TRANS_NET_LAST_MIX_INIT \
489  (defineTransitions(stat_networking, 1, \
490  ev_net_prevConnected, st_net_lastMixConnectedToPrev))
491 
492 /* transitions for st_net_lastMixConnectedToPrev: */
493 #define TRANS_NET_LAST_MIX_CONNECTED_TO_PREV \
494  (defineTransitions(stat_networking, 2, \
495  ev_net_keyExchangePrevFailed, st_net_lastMixInit, \
496  ev_net_keyExchangePrevSuccessful, st_net_lastMixOnline))
497 
498 
499 /* transitions for st_net_lastMixOnline: */
500 #define TRANS_NET_LAST_MIX_ONLINE \
501  (defineTransitions(stat_networking, 1, \
502  ev_net_prevConnectionClosed, st_net_lastMixInit))
503 
504 #ifdef PAYMENT
505 
508 /* transitions for st_pay_entry */
509 #define TRANS_PAY_ENTRY \
510  (defineTransitions(stat_payment, 1, \
511  ev_pay_aiInited, st_pay_aiInit))
512 
513 /* transitions for st_pay_aiInit */
514 #define TRANS_PAY_AI_INIT \
515  (defineTransitions(stat_payment, 4, \
516  ev_pay_aiShutdown, st_pay_aiShutdown, \
517  ev_pay_biConnectionSuccess, st_pay_biAvailable, \
518  ev_pay_biConnectionFailure, st_pay_biUnreachable, \
519  ev_pay_dbConnectionFailure, st_pay_dbError))
520 
521 /* transitions for st_pay_aiShutdown */
522 #define TRANS_PAY_AI_SHUTDOWN \
523  (defineTransitions(stat_payment, 1, \
524  ev_pay_aiInited, st_pay_aiInit))
525 
526 /* transitions for st_pay_biAvailable */
527 #define TRANS_PAY_BI_AVAILABLE \
528  (defineTransitions(stat_payment, 3, \
529  ev_pay_aiShutdown, st_pay_aiShutdown, \
530  ev_pay_biConnectionFailure, st_pay_biUnreachable, \
531  ev_pay_dbConnectionFailure, st_pay_dbError))
532 
533 /* transitions for st_pay_biUnreachable */
534 #define TRANS_PAY_BI_UNREACHABLE \
535  (defineTransitions(stat_payment, 4, \
536  ev_pay_aiShutdown, st_pay_aiShutdown, \
537  ev_pay_biConnectionSuccess, st_pay_biAvailable, \
538  ev_pay_biConnectionCriticalSubseqFailures, st_pay_biPermanentlyUnreachable, \
539  ev_pay_dbConnectionFailure, st_pay_dbErrorBiUnreachable))
540 
541 /* transitions for st_pay_biPermanentlyUnreachable */
542 #define TRANS_PAY_BI_PERMANENTLY_UNREACHABLE \
543  (defineTransitions(stat_payment, 3, \
544  ev_pay_aiShutdown, st_pay_aiShutdown, \
545  ev_pay_biConnectionSuccess, st_pay_biAvailable, \
546  ev_pay_dbConnectionFailure, st_pay_dbErrorBiPermanentlyUnreachable))
547 
548 /* transitions for st_pay_dbError */
549 #define TRANS_PAY_DB_ERROR \
550  (defineTransitions(stat_payment, 2, \
551  ev_pay_aiShutdown, st_pay_aiShutdown, \
552  ev_pay_dbConnectionSuccess, st_pay_aiInit))
553 
554 /* transitions for st_pay_dbErrorBiUnreachable */
555 #define TRANS_PAY_DB_ERROR_BI_UNREACHABLE \
556  (defineTransitions(stat_payment, 2, \
557  ev_pay_aiShutdown, st_pay_aiShutdown, \
558  ev_pay_dbConnectionSuccess, st_pay_biUnreachable))
559 
560 /* transitions for st_pay_dbErrorBiPermanentlyUnreachable */
561 #define TRANS_PAY_DB_ERROR_BI_PERMANENTLY_UNREACHABLE \
562  (defineTransitions(stat_payment, 2, \
563  ev_pay_aiShutdown, st_pay_aiShutdown, \
564  ev_pay_dbConnectionSuccess, st_pay_biPermanentlyUnreachable))
565 
566 #endif /* PAYMENT */
567 
570 /* transitions for st_sys_entry */
571 #define TRANS_SYS_ENTRY \
572  (defineTransitions(stat_system, 1, \
573  ev_sys_start, st_sys_initializing))
574 
575 /* transitions for st_sys_initializing */
576 #define TRANS_SYS_INITIALIZING \
577  (defineTransitions(stat_system, 4, \
578  ev_sys_enterMainLoop, st_sys_operating, \
579  ev_sys_sigTerm, st_sys_shuttingDown, \
580  ev_sys_sigInt, st_sys_shuttingDown, \
581  ev_sys_sigSegV, st_sys_ShuttingDownAfterSegFault))
582 
583 /* transitions for st_sys_operating */
584 #define TRANS_SYS_OPERATING \
585  (defineTransitions(stat_system, 4, \
586  ev_sys_leavingMainLoop, st_sys_restarting, \
587  ev_sys_sigTerm, st_sys_shuttingDown, \
588  ev_sys_sigInt, st_sys_shuttingDown, \
589  ev_sys_sigSegV, st_sys_ShuttingDownAfterSegFault))
590 
591 /* transitions for st_sys_restarting */
592 #define TRANS_SYS_RESTARTING \
593  (defineTransitions(stat_system, 4, \
594  ev_sys_enterMainLoop, st_sys_operating, \
595  ev_sys_sigTerm, st_sys_shuttingDown, \
596  ev_sys_sigInt, st_sys_shuttingDown, \
597  ev_sys_sigSegV, st_sys_ShuttingDownAfterSegFault))
598 
599 /* transitions for st_sys_shuttingDown */
600 #define TRANS_SYS_SHUTTING_DOWN \
601  (defineTransitions(stat_system, 1, \
602  ev_sys_sigSegV, st_sys_ShuttingDownAfterSegFault))
603 
604 /* transitions for st_sys_ShuttingDownAfterSegFault */
605 #define TRANS_SYS_SHUTTING_DOWN_AFTER_SEG_FAULT \
606  (defineTransitions(stat_system, 0))
607 
608 #endif /* MONITORING_DEFS_H_ */
transition_t * defineTransitions(status_type_t s_type, int transitionCount,...)
a convenience function for easily defining state transitions
state_level
@ stl_unknown
@ stl_ok
@ stl_all
@ stl_warning
@ stl_critical
#define NR_SYSTEM_STATES
#define NR_NETWORKING_EVENTS
#define SYSTEM_STATUS_NAME
#define NR_STATE_LEVELS
enum state_type transition_t
event_type
@ ev_sys_overall
@ ev_net_nextConnectionClosed
@ ev_net_keyExchangePrevSuccessful
@ ev_net_prevConnectionClosed
@ ev_sys_sigSegV
@ ev_net_overall
@ ev_sys_sigTerm
@ ev_net_middleMixInited
@ ev_net_keyExchangeNextSuccessful
@ ev_sys_enterMainLoop
@ ev_sys_leavingMainLoop
@ ev_net_keyExchangePrevFailed
@ ev_sys_start
@ ev_sys_sigInt
@ ev_net_keyExchangeNextFailed
@ ev_net_nextConnected
@ ev_net_lastMixInited
@ ev_net_prevConnected
@ ev_net_firstMixInited
state_type
@ st_sys_shuttingDown
@ st_net_firstMixOnline
@ st_net_lastMixConnectedToPrev
@ st_net_middleMixConnectedToPrev
@ st_sys_ShuttingDownAfterSegFault
@ st_net_entry
@ st_net_middleMixOnline
@ st_net_firstMixConnectedToNext
@ st_net_overall
@ st_net_middleMixConnectedToNext
@ st_net_lastMixInit
@ st_sys_overall
@ st_net_middleMixInit
@ st_sys_entry
@ st_sys_restarting
@ st_net_lastMixOnline
@ st_sys_operating
@ st_net_firstMixInit
@ st_ignore
@ st_sys_initializing
enum state_level state_level_t
enum state_type state_type_t
#define NR_NETWORKING_STATES
enum event_type event_type_t
#define NR_STATUS_TYPES
#define NR_SYSTEM_EVENTS
enum status_type status_type_t
#define NETWORKING_STATUS_NAME
status_type
@ stat_all
@ stat_system
@ stat_undef
@ stat_networking
char * ev_description
event_type_t ev_type
status_type_t ev_statusType
struct state * st_prev
transition_t * st_transitions
state_type_t st_type
struct event * st_cause
status_type_t st_statusType
state_level_t st_stateLevel
char * st_description