1 /*************************************************************************//**
3 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 ****************************************************************************/
17 /**************************************************************************//**
19 * EVEL internal definitions.
21 * These are internal definitions which need to be shared between modules
22 * within the library but are not intended for external consumption.
24 ****************************************************************************/
26 #ifndef EVEL_INTERNAL_INCLUDED
27 #define EVEL_INTERNAL_INCLUDED
31 /*****************************************************************************/
32 /* Define some type-safe min/max macros. */
33 /*****************************************************************************/
35 ({ __typeof__ (a) _a = (a); \
36 __typeof__ (b) _b = (b); \
40 ({ __typeof__ (a) _a = (a); \
41 __typeof__ (b) _b = (b); \
45 /**************************************************************************//**
46 * Compile-time assertion.
47 *****************************************************************************/
48 #define EVEL_CT_ASSERT(X) switch (0) {case 0: case (X):;}
50 /**************************************************************************//**
51 * The Functional Role of the equipment represented by this VNF.
52 *****************************************************************************/
53 extern char * functional_role;
55 /**************************************************************************//**
56 * The type of equipment represented by this VNF.
57 *****************************************************************************/
58 extern EVEL_SOURCE_TYPES event_source_type;
60 /**************************************************************************//**
61 * A chunk of memory used in the cURL functions.
62 *****************************************************************************/
63 typedef struct memory_chunk {
68 /**************************************************************************//**
69 * Global commands that may be sent to the Event Handler thread.
70 *****************************************************************************/
74 } EVT_HANDLER_COMMAND;
76 /**************************************************************************//**
77 * State of the Event Handler thread.
78 *****************************************************************************/
80 EVT_HANDLER_UNINITIALIZED, /** The library cannot handle events. */
81 EVT_HANDLER_INACTIVE, /** The event handler thread not started. */
82 EVT_HANDLER_ACTIVE, /** The event handler thread is started. */
83 EVT_HANDLER_REQUEST_TERMINATE, /** Initial stages of shutdown. */
84 EVT_HANDLER_TERMINATING, /** The ring-buffer is being depleted. */
85 EVT_HANDLER_TERMINATED, /** The library is exited. */
86 EVT_HANDLER_MAX_STATES /** Maximum number of valid states. */
89 /**************************************************************************//**
91 * Pseudo-event used for routing internal commands.
92 *****************************************************************************/
93 typedef struct event_internal {
95 EVT_HANDLER_COMMAND command;
98 /**************************************************************************//**
99 * Suppressed NV pairs list entry.
100 * JSON equivalent field: suppressedNvPairs
101 *****************************************************************************/
102 typedef struct evel_suppressed_nv_pairs {
104 /***************************************************************************/
105 /* Mandatory fields */
106 /* JSON equivalent field: nvPairFieldName */
107 /***************************************************************************/
108 char * nv_pair_field_name;
110 /***************************************************************************/
111 /* Optional fields */
112 /* JSON equivalent field: suppressedNvPairNames */
113 /* Type of each list entry: char * */
114 /***************************************************************************/
115 DLIST suppressed_nv_pair_names;
117 /***************************************************************************/
118 /* Hash table containing suppressed_nv_pair_names as keys. */
119 /***************************************************************************/
120 struct hsearch_data * hash_nv_pair_names;
122 } EVEL_SUPPRESSED_NV_PAIRS;
124 /**************************************************************************//**
125 * Event Throttling Specification for a domain which is in a throttled state.
126 * JSON equivalent object: eventThrottlingState
127 *****************************************************************************/
128 typedef struct evel_throttle_spec {
130 /***************************************************************************/
131 /* List of field names to be suppressed. */
132 /* JSON equivalent field: suppressedFieldNames */
133 /* Type of each list entry: char * */
134 /***************************************************************************/
135 DLIST suppressed_field_names;
137 /***************************************************************************/
138 /* List of name-value pairs to be suppressed. */
139 /* JSON equivalent field: suppressedNvPairsList */
140 /* Type of each list entry: EVEL_SUPPRESSED_NV_PAIRS * */
141 /***************************************************************************/
142 DLIST suppressed_nv_pairs_list;
144 /***************************************************************************/
145 /* Hash table containing suppressed_nv_pair_names as keys. */
146 /***************************************************************************/
147 struct hsearch_data * hash_field_names;
149 /***************************************************************************/
150 /* Hash table containing nv_pair_field_name as keys, and */
151 /* suppressed_nv_pairs_list as values. */
152 /***************************************************************************/
153 struct hsearch_data * hash_nv_pairs_list;
155 } EVEL_THROTTLE_SPEC;
157 /*****************************************************************************/
158 /* RFC2822 format string for strftime. */
159 /*****************************************************************************/
160 #define EVEL_RFC2822_STRFTIME_FORMAT "%a, %d %b %Y %T %z"
162 /*****************************************************************************/
163 /* EVEL_JSON_BUFFER depth at which we throttle fields. */
164 /*****************************************************************************/
165 #define EVEL_THROTTLE_FIELD_DEPTH 3
167 /**************************************************************************//**
168 * Initialize the event handler.
170 * Primarily responsible for getting cURL ready for use.
172 * @param[in] event_api_url
173 * The URL where the Vendor Event Listener API is expected
175 * @param[in] bakup_api_url
176 * The BakupURL where the Vendor Backup Listener is expected
178 * @param[in] throt_api_url
179 * The URL where the Throttling API is expected to be.
180 * @param[in] source_ip Source IP of VES Agent
181 * @param[in] bakup_source_ip Backup Source IP of VES Agent
182 * @param[in] ring_buf_size Initialization size of Ring Buffer
183 * @param[in] secure Whether Using http or https
184 * @param[in] cert_file_path Path to Client Certificate file
185 * @param[in] key_file_path Path to Client key file
186 * @param[in] ca_info Path to CA info file
187 * @param[in] ca_file_path Path to CA file
188 * @param[in] verify_peer Using peer verification or not
189 * @param[in] verify_host Using host verification or not
190 * @param[in] username The username for the Basic Authentication of requests.
191 * @param[in] password The password for the Basic Authentication of requests.
192 * @param[in] username2 The username for the Bakup requests.
193 * @param[in] password2 The password for the Bakup requests.
194 * @param verbosity 0 for normal operation, positive values for chattier
196 *****************************************************************************/
197 EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url,
198 const char * const bakup_api_url,
199 const char * const throt_api_url,
200 const char * const source_ip,
201 const char * const bakup_source_ip,
205 const char * const cert_file_path,
206 const char * const key_file_path,
207 const char * const ca_info,
208 const char * const ca_file_path,
211 const char * const username,
212 const char * const password,
213 const char * const username2,
214 const char * const password2,
217 /**************************************************************************//**
218 * Terminate the event handler.
220 * Shuts down the event handler thread in as clean a way as possible. Sets the
221 * global exit flag and then signals the thread to interrupt it since it's
222 * most likely waiting on the ring-buffer.
224 * Having achieved an orderly shutdown of the event handler thread, clean up
225 * the cURL library's resources cleanly.
227 * @return Status code.
228 * @retval ::EVEL_SUCCESS if everything OK.
229 * @retval One of ::EVEL_ERR_CODES if there was a problem.
230 *****************************************************************************/
231 EVEL_ERR_CODES event_handler_terminate();
233 /**************************************************************************//**
234 * Run the event handler.
236 * Spawns the thread responsible for handling events and sending them to the
239 * @return Status code.
240 * @retval ::EVEL_SUCCESS if everything OK.
241 * @retval One of ::EVEL_ERR_CODES if there was a problem.
242 *****************************************************************************/
243 EVEL_ERR_CODES event_handler_run();
245 /**************************************************************************//**
246 * Create a new internal event.
248 * @note The mandatory fields on the Fault must be supplied to this factory
249 * function and are immutable once set. Optional fields have explicit
250 * setter functions, but again values may only be set once so that the
251 * Fault has immutable properties.
252 * @param command The condition indicated by the event.
253 * @returns pointer to the newly manufactured ::EVENT_INTERNAL. If the event
254 * is not used (i.e. posted) it must be released using
256 * @retval NULL Failed to create the event.
257 *****************************************************************************/
258 EVENT_INTERNAL * evel_new_internal_event(EVT_HANDLER_COMMAND command,const char* ev_name, const char *ev_id);
260 /**************************************************************************//**
261 * Free an internal event.
263 * Free off the event supplied. Will free all the contained* allocated memory.
265 * @note It does not free the internal event itself, since that may be part of
266 * a larger structure.
267 *****************************************************************************/
268 void evel_free_internal_event(EVENT_INTERNAL * event);
270 /*****************************************************************************/
271 /* Structure to hold JSON buffer and associated tracking, as it is written. */
272 /*****************************************************************************/
273 typedef struct evel_json_buffer
279 /***************************************************************************/
280 /* The working throttle specification, which can be NULL. */
281 /***************************************************************************/
282 EVEL_THROTTLE_SPEC * throttle_spec;
284 /***************************************************************************/
285 /* Current object/list nesting depth. */
286 /***************************************************************************/
289 /***************************************************************************/
290 /* The checkpoint. */
291 /***************************************************************************/
296 /**************************************************************************//**
297 * Encode the event as a JSON event object according to AT&T's schema.
299 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
300 * @param event Pointer to the ::EVENT_HEADER to encode.
301 *****************************************************************************/
302 void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf,
303 EVENT_HEADER * event);
305 /**************************************************************************//**
306 * Encode the fault in JSON according to AT&T's schema for the fault type.
308 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
309 * @param event Pointer to the ::EVENT_HEADER to encode.
310 *****************************************************************************/
311 void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf,
312 EVENT_FAULT * event);
314 /**************************************************************************//**
315 * Encode the measurement as a JSON measurement.
317 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
318 * @param event Pointer to the ::EVENT_HEADER to encode.
319 *****************************************************************************/
320 void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
321 EVENT_MEASUREMENT * event);
323 /**************************************************************************//**
324 * Encode the Mobile Flow in JSON according to AT&T's schema for the event
327 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
328 * @param event Pointer to the ::EVENT_HEADER to encode.
329 *****************************************************************************/
330 void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf,
331 EVENT_MOBILE_FLOW * event);
333 /**************************************************************************//**
334 * Encode the report as a JSON report.
336 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
337 * @param event Pointer to the ::EVENT_HEADER to encode.
338 *****************************************************************************/
339 void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf,
340 EVENT_REPORT * event);
342 /**************************************************************************//**
343 * Encode the Heartbeat fields in JSON according to AT&T's schema for the
346 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
347 * @param event Pointer to the ::EVENT_HEADER to encode.
348 *****************************************************************************/
349 void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf,
350 EVENT_HEARTBEAT_FIELD * const event);
352 /**************************************************************************//**
353 * Encode the Signaling in JSON according to AT&T's schema for the event type.
355 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
356 * @param event Pointer to the ::EVENT_HEADER to encode.
357 *****************************************************************************/
358 void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf,
359 EVENT_SIGNALING * const event);
361 /**************************************************************************//**
362 * Encode the state change as a JSON state change.
364 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
365 * @param state_change Pointer to the ::EVENT_STATE_CHANGE to encode.
366 *****************************************************************************/
367 void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf,
368 EVENT_STATE_CHANGE * state_change);
370 /**************************************************************************//**
371 * Encode the Syslog in JSON according to AT&T's schema for the event type.
373 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
374 * @param event Pointer to the ::EVENT_HEADER to encode.
375 *****************************************************************************/
376 void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf,
377 EVENT_SYSLOG * event);
379 /**************************************************************************//**
380 * Encode the Other in JSON according to AT&T's schema for the event type.
382 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
383 * @param event Pointer to the ::EVENT_HEADER to encode.
384 *****************************************************************************/
385 void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf,
386 EVENT_OTHER * event);
388 /**************************************************************************//**
389 * Set the next event_sequence to use.
391 * @param sequence The next sequence number to use.
392 *****************************************************************************/
393 void evel_set_next_event_sequence(const int sequence);
395 /**************************************************************************//**
396 * Handle a JSON response from the listener, contained in a ::MEMORY_CHUNK.
398 * Tokenize the response, and decode any tokens found.
400 * @param chunk The memory chunk containing the response.
401 * @param post The memory chunk in which to place any resulting POST.
402 *****************************************************************************/
403 void evel_handle_event_response(const MEMORY_CHUNK * const chunk,
404 MEMORY_CHUNK * const post);
406 /**************************************************************************//**
407 * Initialize a ::EVEL_JSON_BUFFER.
409 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to initialise.
410 * @param json Pointer to the underlying working buffer to use.
411 * @param max_size Size of storage available in the JSON buffer.
412 * @param throttle_spec Pointer to throttle specification. Can be NULL.
413 *****************************************************************************/
414 void evel_json_buffer_init(EVEL_JSON_BUFFER * jbuf,
417 EVEL_THROTTLE_SPEC * throttle_spec);
419 /**************************************************************************//**
420 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
422 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
423 * @param key Pointer to the key to encode.
424 * @param option Pointer to holder of the corresponding value to encode.
425 * @return true if the key, value was added, false if it was suppressed.
426 *****************************************************************************/
427 bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER * jbuf,
428 const char * const key,
429 const EVEL_OPTION_STRING * const option);
431 /**************************************************************************//**
432 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
434 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
435 * @param key Pointer to the key to encode.
436 * @param value Pointer to the corresponding value to encode.
437 *****************************************************************************/
438 void evel_enc_kv_string(EVEL_JSON_BUFFER * jbuf,
439 const char * const key,
440 const char * const value);
442 /**************************************************************************//**
443 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
445 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
446 * @param key Pointer to the key to encode.
447 * @param option Pointer to holder of the corresponding value to encode.
448 * @return true if the key, value was added, false if it was suppressed.
449 *****************************************************************************/
450 bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER * jbuf,
451 const char * const key,
452 const EVEL_OPTION_INT * const option);
454 /**************************************************************************//**
455 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
457 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
458 * @param key Pointer to the key to encode.
459 * @param value The corresponding value to encode.
460 *****************************************************************************/
461 void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf,
462 const char * const key,
465 /**************************************************************************//**
466 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
468 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
469 * @param key Pointer to the key to encode.
470 * @param option Pointer to holder of the corresponding value to encode.
471 * @return true if the key, value was added, false if it was suppressed.
472 *****************************************************************************/
473 bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER * jbuf,
474 const char * const key,
475 const EVEL_OPTION_DOUBLE * const option);
477 /**************************************************************************//**
478 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
480 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
481 * @param key Pointer to the key to encode.
482 * @param value The corresponding value to encode.
483 *****************************************************************************/
484 void evel_enc_kv_double(EVEL_JSON_BUFFER * jbuf,
485 const char * const key,
488 /**************************************************************************//**
489 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
491 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
492 * @param key Pointer to the key to encode.
493 * @param option Pointer to holder of the corresponding value to encode.
494 * @return true if the key, value was added, false if it was suppressed.
495 *****************************************************************************/
496 bool evel_enc_kv_opt_ull(EVEL_JSON_BUFFER * jbuf,
497 const char * const key,
498 const EVEL_OPTION_ULL * const option);
500 /**************************************************************************//**
501 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
503 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
504 * @param key Pointer to the key to encode.
505 * @param value The corresponding value to encode.
506 *****************************************************************************/
507 void evel_enc_kv_ull(EVEL_JSON_BUFFER * jbuf,
508 const char * const key,
509 const unsigned long long value);
511 /**************************************************************************//**
512 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
514 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
515 * @param key Pointer to the key to encode.
516 * @param option Pointer to holder of the corresponding value to encode.
517 * @return true if the key, value was added, false if it was suppressed.
518 *****************************************************************************/
519 bool evel_enc_kv_opt_time(EVEL_JSON_BUFFER * jbuf,
520 const char * const key,
521 const EVEL_OPTION_TIME * const option);
523 /**************************************************************************//**
524 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
526 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
527 * @param key Pointer to the key to encode.
528 * @param time Pointer to the time to encode.
529 *****************************************************************************/
530 void evel_enc_kv_time(EVEL_JSON_BUFFER * jbuf,
531 const char * const key,
532 const time_t * time);
534 /**************************************************************************//**
535 * Encode a key and version.
537 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
538 * @param key Pointer to the key to encode.
539 * @param major_version The major version to encode.
540 * @param minor_version The minor version to encode.
541 *****************************************************************************/
542 void evel_enc_version(EVEL_JSON_BUFFER * jbuf,
543 const char * const key,
544 const int major_version,
545 const int minor_version);
547 /**************************************************************************//**
548 * Add the key and opening bracket of an optional named list to a JSON buffer.
550 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
551 * @param key Pointer to the key to encode.
552 * @return true if the list was opened, false if it was suppressed.
553 *****************************************************************************/
554 bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER * jbuf,
555 const char * const key);
557 /**************************************************************************//**
558 * Add the key and opening bracket of a named list to a JSON buffer.
560 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
561 * @param key Pointer to the key to encode.
562 *****************************************************************************/
563 void evel_json_open_named_list(EVEL_JSON_BUFFER * jbuf,
564 const char * const key);
566 /**************************************************************************//**
567 * Add the closing bracket of a list to a JSON buffer.
569 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
570 *****************************************************************************/
571 void evel_json_close_list(EVEL_JSON_BUFFER * jbuf);
573 /**************************************************************************//**
574 * Encode a list item with format and param list to a ::EVEL_JSON_BUFFER.
576 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
577 * @param format Format string in standard printf format.
578 * @param ... Variable parameters for format string.
579 *****************************************************************************/
580 void evel_enc_list_item(EVEL_JSON_BUFFER * jbuf,
581 const char * const format,
584 /**************************************************************************//**
585 * Add the opening bracket of an optional named object to a JSON buffer.
587 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
588 * @param key Pointer to the key to encode.
589 *****************************************************************************/
590 bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER * jbuf,
591 const char * const key);
593 /**************************************************************************//**
594 * Add the opening bracket of an object to a JSON buffer.
596 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
597 * @param key Pointer to the key to encode.
598 * @return true if the object was opened, false if it was suppressed.
599 *****************************************************************************/
600 void evel_json_open_named_object(EVEL_JSON_BUFFER * jbuf,
601 const char * const key);
603 /**************************************************************************//**
604 * Add the opening bracket of an object to a JSON buffer.
606 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
607 *****************************************************************************/
608 void evel_json_open_object(EVEL_JSON_BUFFER * jbuf);
610 /**************************************************************************//**
611 * Add the closing bracket of an object to a JSON buffer.
613 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
614 *****************************************************************************/
615 void evel_json_close_object(EVEL_JSON_BUFFER * jbuf);
617 /**************************************************************************//**
618 * Add a checkpoint - a stake in the ground to which we can rewind.
620 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
621 *****************************************************************************/
622 void evel_json_checkpoint(EVEL_JSON_BUFFER * jbuf);
624 /**************************************************************************//**
625 * Rewind to the latest checkoint.
627 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
628 *****************************************************************************/
629 void evel_json_rewind(EVEL_JSON_BUFFER * jbuf);
631 /**************************************************************************//**
632 * Free the underlying resources of an ::EVEL_OPTION_STRING.
634 * @param option Pointer to the ::EVEL_OPTION_STRING.
635 *****************************************************************************/
636 void evel_free_option_string(EVEL_OPTION_STRING * const option);
638 /**************************************************************************//**
639 * Initialize an ::EVEL_OPTION_STRING to a not-set state.
641 * @param option Pointer to the ::EVEL_OPTION_STRING.
642 *****************************************************************************/
643 void evel_init_option_string(EVEL_OPTION_STRING * const option);
645 /**************************************************************************//**
646 * Set the value of an ::EVEL_OPTION_STRING.
648 * @param option Pointer to the ::EVEL_OPTION_STRING.
649 * @param value The value to set.
650 * @param description Description to be used in logging.
651 *****************************************************************************/
652 void evel_set_option_string(EVEL_OPTION_STRING * const option,
653 const char * const value,
654 const char * const description);
656 /**************************************************************************//**
657 * Force the value of an ::EVEL_OPTION_STRING.
659 * @param option Pointer to the ::EVEL_OPTION_STRING.
660 * @param value The value to set.
661 *****************************************************************************/
662 void evel_force_option_string(EVEL_OPTION_STRING * const option,
663 const char * const value);
665 /**************************************************************************//**
666 * Initialize an ::EVEL_OPTION_INT to a not-set state.
668 * @param option Pointer to the ::EVEL_OPTION_INT.
669 *****************************************************************************/
670 void evel_init_option_int(EVEL_OPTION_INT * const option);
672 /**************************************************************************//**
673 * Force the value of an ::EVEL_OPTION_INT.
675 * @param option Pointer to the ::EVEL_OPTION_INT.
676 * @param value The value to set.
677 *****************************************************************************/
678 void evel_force_option_int(EVEL_OPTION_INT * const option,
681 /**************************************************************************//**
682 * Set the value of an ::EVEL_OPTION_INT.
684 * @param option Pointer to the ::EVEL_OPTION_INT.
685 * @param value The value to set.
686 * @param description Description to be used in logging.
687 *****************************************************************************/
688 void evel_set_option_int(EVEL_OPTION_INT * const option,
690 const char * const description);
692 /**************************************************************************//**
693 * Initialize an ::EVEL_OPTION_DOUBLE to a not-set state.
695 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
696 *****************************************************************************/
697 void evel_init_option_double(EVEL_OPTION_DOUBLE * const option);
699 /**************************************************************************//**
700 * Force the value of an ::EVEL_OPTION_DOUBLE.
702 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
703 * @param value The value to set.
704 *****************************************************************************/
705 void evel_force_option_double(EVEL_OPTION_DOUBLE * const option,
708 /**************************************************************************//**
709 * Set the value of an ::EVEL_OPTION_DOUBLE.
711 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
712 * @param value The value to set.
713 * @param description Description to be used in logging.
714 *****************************************************************************/
715 void evel_set_option_double(EVEL_OPTION_DOUBLE * const option,
717 const char * const description);
719 /**************************************************************************//**
720 * Initialize an ::EVEL_OPTION_ULL to a not-set state.
722 * @param option Pointer to the ::EVEL_OPTION_ULL.
723 *****************************************************************************/
724 void evel_init_option_ull(EVEL_OPTION_ULL * const option);
726 /**************************************************************************//**
727 * Force the value of an ::EVEL_OPTION_ULL.
729 * @param option Pointer to the ::EVEL_OPTION_ULL.
730 * @param value The value to set.
731 *****************************************************************************/
732 void evel_force_option_ull(EVEL_OPTION_ULL * const option,
733 const unsigned long long value);
735 /**************************************************************************//**
736 * Set the value of an ::EVEL_OPTION_ULL.
738 * @param option Pointer to the ::EVEL_OPTION_ULL.
739 * @param value The value to set.
740 * @param description Description to be used in logging.
741 *****************************************************************************/
742 void evel_set_option_ull(EVEL_OPTION_ULL * const option,
743 const unsigned long long value,
744 const char * const description);
746 /**************************************************************************//**
747 * Initialize an ::EVEL_OPTION_TIME to a not-set state.
749 * @param option Pointer to the ::EVEL_OPTION_TIME.
750 *****************************************************************************/
751 void evel_init_option_time(EVEL_OPTION_TIME * const option);
753 /**************************************************************************//**
754 * Force the value of an ::EVEL_OPTION_TIME.
756 * @param option Pointer to the ::EVEL_OPTION_TIME.
757 * @param value The value to set.
758 *****************************************************************************/
759 void evel_force_option_time(EVEL_OPTION_TIME * const option,
762 /**************************************************************************//**
763 * Set the value of an ::EVEL_OPTION_TIME.
765 * @param option Pointer to the ::EVEL_OPTION_TIME.
766 * @param value The value to set.
767 * @param description Description to be used in logging.
768 *****************************************************************************/
769 void evel_set_option_time(EVEL_OPTION_TIME * const option,
771 const char * const description);
773 /**************************************************************************//**
774 * Map an ::EVEL_COUNTER_CRITICALITIES enum value to the equivalent string.
776 * @param criticality The criticality to convert.
777 * @returns The equivalent string.
778 *****************************************************************************/
779 char * evel_criticality(const EVEL_COUNTER_CRITICALITIES criticality);
781 /**************************************************************************//**
782 * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
784 * @param severity The severity to convert.
785 * @returns The equivalent string.
786 *****************************************************************************/
787 char * evel_severity(const EVEL_SEVERITIES severity);
789 /**************************************************************************//**
790 * Map an ::EVEL_ALERT_ACTIONS enum value to the equivalent string.
792 * @param alert_action The alert_action to convert.
793 * @returns The equivalent string.
794 *****************************************************************************/
795 char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action);
797 /**************************************************************************//**
798 * Map an ::EVEL_ALERT_TYPES enum value to the equivalent string.
800 * @param alert_type The alert_type to convert.
801 * @returns The equivalent string.
802 *****************************************************************************/
803 char * evel_alert_type(const EVEL_ALERT_TYPES alert_type);
805 /**************************************************************************//**
806 * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
808 * @param domain The domain to convert.
809 * @returns The equivalent string.
810 *****************************************************************************/
811 char * evel_event_domain(const EVEL_EVENT_DOMAINS domain);
813 /**************************************************************************//**
814 * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
816 * @param priority The priority to convert.
817 * @returns The equivalent string.
818 *****************************************************************************/
819 char * evel_event_priority(const EVEL_EVENT_PRIORITIES priority);
821 /**************************************************************************//**
822 * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
824 * @param source_type The source type to convert.
825 * @returns The equivalent string.
826 *****************************************************************************/
827 char * evel_source_type(const EVEL_SOURCE_TYPES source_type);
829 /**************************************************************************//**
830 * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
832 * @param vf_status The vf_status to convert.
833 * @returns The equivalent string.
834 *****************************************************************************/
835 char * evel_vf_status(const EVEL_VF_STATUSES vf_status);
837 /**************************************************************************//**
838 * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
840 * @param state The entity state to encode.
842 * @returns the corresponding string
843 *****************************************************************************/
844 char * evel_entity_state(const EVEL_ENTITY_STATE state);
846 /**************************************************************************//**
847 * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
849 * @param endpoint_desc endpoint description to encode.
851 * @returns the corresponding string
852 *****************************************************************************/
853 char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc);
856 /**************************************************************************//**
857 * Initialize an ::EVEL_OPTION_INTHEADER_FIELDS to a not-set state.
859 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
860 *****************************************************************************/
861 void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
862 /**************************************************************************//**
863 * Force the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
865 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
866 * @param value The value to set.
867 *****************************************************************************/
868 void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
870 /**************************************************************************//**
871 * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
873 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
874 * @param value The value to set.
875 * @param description Description to be used in logging.
876 *****************************************************************************/
877 void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
879 const char * const description);
880 /**************************************************************************//**
881 * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS.
883 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
884 *****************************************************************************/
885 void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);