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,
204 const char * const cert_file_path,
205 const char * const key_file_path,
206 const char * const ca_info,
207 const char * const ca_file_path,
210 const char * const username,
211 const char * const password,
212 const char * const username2,
213 const char * const password2,
216 /**************************************************************************//**
217 * Terminate the event handler.
219 * Shuts down the event handler thread in as clean a way as possible. Sets the
220 * global exit flag and then signals the thread to interrupt it since it's
221 * most likely waiting on the ring-buffer.
223 * Having achieved an orderly shutdown of the event handler thread, clean up
224 * the cURL library's resources cleanly.
226 * @return Status code.
227 * @retval ::EVEL_SUCCESS if everything OK.
228 * @retval One of ::EVEL_ERR_CODES if there was a problem.
229 *****************************************************************************/
230 EVEL_ERR_CODES event_handler_terminate();
232 /**************************************************************************//**
233 * Run the event handler.
235 * Spawns the thread responsible for handling events and sending them to the
238 * @return Status code.
239 * @retval ::EVEL_SUCCESS if everything OK.
240 * @retval One of ::EVEL_ERR_CODES if there was a problem.
241 *****************************************************************************/
242 EVEL_ERR_CODES event_handler_run();
244 /**************************************************************************//**
245 * Create a new internal event.
247 * @note The mandatory fields on the Fault must be supplied to this factory
248 * function and are immutable once set. Optional fields have explicit
249 * setter functions, but again values may only be set once so that the
250 * Fault has immutable properties.
251 * @param command The condition indicated by the event.
252 * @returns pointer to the newly manufactured ::EVENT_INTERNAL. If the event
253 * is not used (i.e. posted) it must be released using
255 * @retval NULL Failed to create the event.
256 *****************************************************************************/
257 EVENT_INTERNAL * evel_new_internal_event(EVT_HANDLER_COMMAND command,const char* ev_name, const char *ev_id);
259 /**************************************************************************//**
260 * Free an internal event.
262 * Free off the event supplied. Will free all the contained* allocated memory.
264 * @note It does not free the internal event itself, since that may be part of
265 * a larger structure.
266 *****************************************************************************/
267 void evel_free_internal_event(EVENT_INTERNAL * event);
269 /*****************************************************************************/
270 /* Structure to hold JSON buffer and associated tracking, as it is written. */
271 /*****************************************************************************/
272 typedef struct evel_json_buffer
278 /***************************************************************************/
279 /* The working throttle specification, which can be NULL. */
280 /***************************************************************************/
281 EVEL_THROTTLE_SPEC * throttle_spec;
283 /***************************************************************************/
284 /* Current object/list nesting depth. */
285 /***************************************************************************/
288 /***************************************************************************/
289 /* The checkpoint. */
290 /***************************************************************************/
295 /**************************************************************************//**
296 * Encode the event as a JSON event object according to AT&T's schema.
298 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
299 * @param event Pointer to the ::EVENT_HEADER to encode.
300 *****************************************************************************/
301 void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf,
302 EVENT_HEADER * event);
304 /**************************************************************************//**
305 * Encode the fault in JSON according to AT&T's schema for the fault type.
307 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
308 * @param event Pointer to the ::EVENT_HEADER to encode.
309 *****************************************************************************/
310 void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf,
311 EVENT_FAULT * event);
313 /**************************************************************************//**
314 * Encode the measurement as a JSON measurement.
316 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
317 * @param event Pointer to the ::EVENT_HEADER to encode.
318 *****************************************************************************/
319 void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
320 EVENT_MEASUREMENT * event);
322 /**************************************************************************//**
323 * Encode the Mobile Flow in JSON according to AT&T's schema for the event
326 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
327 * @param event Pointer to the ::EVENT_HEADER to encode.
328 *****************************************************************************/
329 void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf,
330 EVENT_MOBILE_FLOW * event);
332 /**************************************************************************//**
333 * Encode the report as a JSON report.
335 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
336 * @param event Pointer to the ::EVENT_HEADER to encode.
337 *****************************************************************************/
338 void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf,
339 EVENT_REPORT * event);
341 /**************************************************************************//**
342 * Encode the Heartbeat fields in JSON according to AT&T's schema for the
345 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
346 * @param event Pointer to the ::EVENT_HEADER to encode.
347 *****************************************************************************/
348 void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf,
349 EVENT_HEARTBEAT_FIELD * const event);
351 /**************************************************************************//**
352 * Encode the Signaling in JSON according to AT&T's schema for the event type.
354 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
355 * @param event Pointer to the ::EVENT_HEADER to encode.
356 *****************************************************************************/
357 void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf,
358 EVENT_SIGNALING * const event);
360 /**************************************************************************//**
361 * Encode the state change as a JSON state change.
363 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
364 * @param state_change Pointer to the ::EVENT_STATE_CHANGE to encode.
365 *****************************************************************************/
366 void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf,
367 EVENT_STATE_CHANGE * state_change);
369 /**************************************************************************//**
370 * Encode the Syslog in JSON according to AT&T's schema for the event type.
372 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
373 * @param event Pointer to the ::EVENT_HEADER to encode.
374 *****************************************************************************/
375 void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf,
376 EVENT_SYSLOG * event);
378 /**************************************************************************//**
379 * Encode the Other in JSON according to AT&T's schema for the event type.
381 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
382 * @param event Pointer to the ::EVENT_HEADER to encode.
383 *****************************************************************************/
384 void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf,
385 EVENT_OTHER * event);
387 /**************************************************************************//**
388 * Set the next event_sequence to use.
390 * @param sequence The next sequence number to use.
391 *****************************************************************************/
392 void evel_set_next_event_sequence(const int sequence);
394 /**************************************************************************//**
395 * Handle a JSON response from the listener, contained in a ::MEMORY_CHUNK.
397 * Tokenize the response, and decode any tokens found.
399 * @param chunk The memory chunk containing the response.
400 * @param post The memory chunk in which to place any resulting POST.
401 *****************************************************************************/
402 void evel_handle_event_response(const MEMORY_CHUNK * const chunk,
403 MEMORY_CHUNK * const post);
405 /**************************************************************************//**
406 * Initialize a ::EVEL_JSON_BUFFER.
408 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to initialise.
409 * @param json Pointer to the underlying working buffer to use.
410 * @param max_size Size of storage available in the JSON buffer.
411 * @param throttle_spec Pointer to throttle specification. Can be NULL.
412 *****************************************************************************/
413 void evel_json_buffer_init(EVEL_JSON_BUFFER * jbuf,
416 EVEL_THROTTLE_SPEC * throttle_spec);
418 /**************************************************************************//**
419 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
421 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
422 * @param key Pointer to the key to encode.
423 * @param option Pointer to holder of the corresponding value to encode.
424 * @return true if the key, value was added, false if it was suppressed.
425 *****************************************************************************/
426 bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER * jbuf,
427 const char * const key,
428 const EVEL_OPTION_STRING * const option);
430 /**************************************************************************//**
431 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
433 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
434 * @param key Pointer to the key to encode.
435 * @param value Pointer to the corresponding value to encode.
436 *****************************************************************************/
437 void evel_enc_kv_string(EVEL_JSON_BUFFER * jbuf,
438 const char * const key,
439 const char * const value);
441 /**************************************************************************//**
442 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
444 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
445 * @param key Pointer to the key to encode.
446 * @param option Pointer to holder of the corresponding value to encode.
447 * @return true if the key, value was added, false if it was suppressed.
448 *****************************************************************************/
449 bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER * jbuf,
450 const char * const key,
451 const EVEL_OPTION_INT * const option);
453 /**************************************************************************//**
454 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
456 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
457 * @param key Pointer to the key to encode.
458 * @param value The corresponding value to encode.
459 *****************************************************************************/
460 void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf,
461 const char * const key,
464 /**************************************************************************//**
465 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
467 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
468 * @param key Pointer to the key to encode.
469 * @param option Pointer to holder of the corresponding value to encode.
470 * @return true if the key, value was added, false if it was suppressed.
471 *****************************************************************************/
472 bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER * jbuf,
473 const char * const key,
474 const EVEL_OPTION_DOUBLE * const option);
476 /**************************************************************************//**
477 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
479 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
480 * @param key Pointer to the key to encode.
481 * @param value The corresponding value to encode.
482 *****************************************************************************/
483 void evel_enc_kv_double(EVEL_JSON_BUFFER * jbuf,
484 const char * const key,
487 /**************************************************************************//**
488 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
490 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
491 * @param key Pointer to the key to encode.
492 * @param option Pointer to holder of the corresponding value to encode.
493 * @return true if the key, value was added, false if it was suppressed.
494 *****************************************************************************/
495 bool evel_enc_kv_opt_ull(EVEL_JSON_BUFFER * jbuf,
496 const char * const key,
497 const EVEL_OPTION_ULL * const option);
499 /**************************************************************************//**
500 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
502 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
503 * @param key Pointer to the key to encode.
504 * @param value The corresponding value to encode.
505 *****************************************************************************/
506 void evel_enc_kv_ull(EVEL_JSON_BUFFER * jbuf,
507 const char * const key,
508 const unsigned long long value);
510 /**************************************************************************//**
511 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
513 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
514 * @param key Pointer to the key to encode.
515 * @param option Pointer to holder of the corresponding value to encode.
516 * @return true if the key, value was added, false if it was suppressed.
517 *****************************************************************************/
518 bool evel_enc_kv_opt_time(EVEL_JSON_BUFFER * jbuf,
519 const char * const key,
520 const EVEL_OPTION_TIME * const option);
522 /**************************************************************************//**
523 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
525 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
526 * @param key Pointer to the key to encode.
527 * @param time Pointer to the time to encode.
528 *****************************************************************************/
529 void evel_enc_kv_time(EVEL_JSON_BUFFER * jbuf,
530 const char * const key,
531 const time_t * time);
533 /**************************************************************************//**
534 * Encode a key and version.
536 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
537 * @param key Pointer to the key to encode.
538 * @param major_version The major version to encode.
539 * @param minor_version The minor version to encode.
540 *****************************************************************************/
541 void evel_enc_version(EVEL_JSON_BUFFER * jbuf,
542 const char * const key,
543 const int major_version,
544 const int minor_version);
546 /**************************************************************************//**
547 * Add the key and opening bracket of an optional named list to a JSON buffer.
549 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
550 * @param key Pointer to the key to encode.
551 * @return true if the list was opened, false if it was suppressed.
552 *****************************************************************************/
553 bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER * jbuf,
554 const char * const key);
556 /**************************************************************************//**
557 * Add the key and opening bracket of a named list to a JSON buffer.
559 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
560 * @param key Pointer to the key to encode.
561 *****************************************************************************/
562 void evel_json_open_named_list(EVEL_JSON_BUFFER * jbuf,
563 const char * const key);
565 /**************************************************************************//**
566 * Add the closing bracket of a list to a JSON buffer.
568 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
569 *****************************************************************************/
570 void evel_json_close_list(EVEL_JSON_BUFFER * jbuf);
572 /**************************************************************************//**
573 * Encode a list item with format and param list to a ::EVEL_JSON_BUFFER.
575 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
576 * @param format Format string in standard printf format.
577 * @param ... Variable parameters for format string.
578 *****************************************************************************/
579 void evel_enc_list_item(EVEL_JSON_BUFFER * jbuf,
580 const char * const format,
583 /**************************************************************************//**
584 * Add the opening bracket of an optional named object to a JSON buffer.
586 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
587 * @param key Pointer to the key to encode.
588 *****************************************************************************/
589 bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER * jbuf,
590 const char * const key);
592 /**************************************************************************//**
593 * Add the opening bracket of an object to a JSON buffer.
595 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
596 * @param key Pointer to the key to encode.
597 * @return true if the object was opened, false if it was suppressed.
598 *****************************************************************************/
599 void evel_json_open_named_object(EVEL_JSON_BUFFER * jbuf,
600 const char * const key);
602 /**************************************************************************//**
603 * Add the opening bracket of an object to a JSON buffer.
605 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
606 *****************************************************************************/
607 void evel_json_open_object(EVEL_JSON_BUFFER * jbuf);
609 /**************************************************************************//**
610 * Add the closing bracket of an object to a JSON buffer.
612 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
613 *****************************************************************************/
614 void evel_json_close_object(EVEL_JSON_BUFFER * jbuf);
616 /**************************************************************************//**
617 * Add a checkpoint - a stake in the ground to which we can rewind.
619 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
620 *****************************************************************************/
621 void evel_json_checkpoint(EVEL_JSON_BUFFER * jbuf);
623 /**************************************************************************//**
624 * Rewind to the latest checkoint.
626 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
627 *****************************************************************************/
628 void evel_json_rewind(EVEL_JSON_BUFFER * jbuf);
630 /**************************************************************************//**
631 * Free the underlying resources of an ::EVEL_OPTION_STRING.
633 * @param option Pointer to the ::EVEL_OPTION_STRING.
634 *****************************************************************************/
635 void evel_free_option_string(EVEL_OPTION_STRING * const option);
637 /**************************************************************************//**
638 * Initialize an ::EVEL_OPTION_STRING to a not-set state.
640 * @param option Pointer to the ::EVEL_OPTION_STRING.
641 *****************************************************************************/
642 void evel_init_option_string(EVEL_OPTION_STRING * const option);
644 /**************************************************************************//**
645 * Set the value of an ::EVEL_OPTION_STRING.
647 * @param option Pointer to the ::EVEL_OPTION_STRING.
648 * @param value The value to set.
649 * @param description Description to be used in logging.
650 *****************************************************************************/
651 void evel_set_option_string(EVEL_OPTION_STRING * const option,
652 const char * const value,
653 const char * const description);
655 /**************************************************************************//**
656 * Force the value of an ::EVEL_OPTION_STRING.
658 * @param option Pointer to the ::EVEL_OPTION_STRING.
659 * @param value The value to set.
660 *****************************************************************************/
661 void evel_force_option_string(EVEL_OPTION_STRING * const option,
662 const char * const value);
664 /**************************************************************************//**
665 * Initialize an ::EVEL_OPTION_INT to a not-set state.
667 * @param option Pointer to the ::EVEL_OPTION_INT.
668 *****************************************************************************/
669 void evel_init_option_int(EVEL_OPTION_INT * const option);
671 /**************************************************************************//**
672 * Force the value of an ::EVEL_OPTION_INT.
674 * @param option Pointer to the ::EVEL_OPTION_INT.
675 * @param value The value to set.
676 *****************************************************************************/
677 void evel_force_option_int(EVEL_OPTION_INT * const option,
680 /**************************************************************************//**
681 * Set the value of an ::EVEL_OPTION_INT.
683 * @param option Pointer to the ::EVEL_OPTION_INT.
684 * @param value The value to set.
685 * @param description Description to be used in logging.
686 *****************************************************************************/
687 void evel_set_option_int(EVEL_OPTION_INT * const option,
689 const char * const description);
691 /**************************************************************************//**
692 * Initialize an ::EVEL_OPTION_DOUBLE to a not-set state.
694 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
695 *****************************************************************************/
696 void evel_init_option_double(EVEL_OPTION_DOUBLE * const option);
698 /**************************************************************************//**
699 * Force the value of an ::EVEL_OPTION_DOUBLE.
701 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
702 * @param value The value to set.
703 *****************************************************************************/
704 void evel_force_option_double(EVEL_OPTION_DOUBLE * const option,
707 /**************************************************************************//**
708 * Set the value of an ::EVEL_OPTION_DOUBLE.
710 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
711 * @param value The value to set.
712 * @param description Description to be used in logging.
713 *****************************************************************************/
714 void evel_set_option_double(EVEL_OPTION_DOUBLE * const option,
716 const char * const description);
718 /**************************************************************************//**
719 * Initialize an ::EVEL_OPTION_ULL to a not-set state.
721 * @param option Pointer to the ::EVEL_OPTION_ULL.
722 *****************************************************************************/
723 void evel_init_option_ull(EVEL_OPTION_ULL * const option);
725 /**************************************************************************//**
726 * Force the value of an ::EVEL_OPTION_ULL.
728 * @param option Pointer to the ::EVEL_OPTION_ULL.
729 * @param value The value to set.
730 *****************************************************************************/
731 void evel_force_option_ull(EVEL_OPTION_ULL * const option,
732 const unsigned long long value);
734 /**************************************************************************//**
735 * Set the value of an ::EVEL_OPTION_ULL.
737 * @param option Pointer to the ::EVEL_OPTION_ULL.
738 * @param value The value to set.
739 * @param description Description to be used in logging.
740 *****************************************************************************/
741 void evel_set_option_ull(EVEL_OPTION_ULL * const option,
742 const unsigned long long value,
743 const char * const description);
745 /**************************************************************************//**
746 * Initialize an ::EVEL_OPTION_TIME to a not-set state.
748 * @param option Pointer to the ::EVEL_OPTION_TIME.
749 *****************************************************************************/
750 void evel_init_option_time(EVEL_OPTION_TIME * const option);
752 /**************************************************************************//**
753 * Force the value of an ::EVEL_OPTION_TIME.
755 * @param option Pointer to the ::EVEL_OPTION_TIME.
756 * @param value The value to set.
757 *****************************************************************************/
758 void evel_force_option_time(EVEL_OPTION_TIME * const option,
761 /**************************************************************************//**
762 * Set the value of an ::EVEL_OPTION_TIME.
764 * @param option Pointer to the ::EVEL_OPTION_TIME.
765 * @param value The value to set.
766 * @param description Description to be used in logging.
767 *****************************************************************************/
768 void evel_set_option_time(EVEL_OPTION_TIME * const option,
770 const char * const description);
772 /**************************************************************************//**
773 * Map an ::EVEL_COUNTER_CRITICALITIES enum value to the equivalent string.
775 * @param criticality The criticality to convert.
776 * @returns The equivalent string.
777 *****************************************************************************/
778 char * evel_criticality(const EVEL_COUNTER_CRITICALITIES criticality);
780 /**************************************************************************//**
781 * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
783 * @param severity The severity to convert.
784 * @returns The equivalent string.
785 *****************************************************************************/
786 char * evel_severity(const EVEL_SEVERITIES severity);
788 /**************************************************************************//**
789 * Map an ::EVEL_ALERT_ACTIONS enum value to the equivalent string.
791 * @param alert_action The alert_action to convert.
792 * @returns The equivalent string.
793 *****************************************************************************/
794 char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action);
796 /**************************************************************************//**
797 * Map an ::EVEL_ALERT_TYPES enum value to the equivalent string.
799 * @param alert_type The alert_type to convert.
800 * @returns The equivalent string.
801 *****************************************************************************/
802 char * evel_alert_type(const EVEL_ALERT_TYPES alert_type);
804 /**************************************************************************//**
805 * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
807 * @param domain The domain to convert.
808 * @returns The equivalent string.
809 *****************************************************************************/
810 char * evel_event_domain(const EVEL_EVENT_DOMAINS domain);
812 /**************************************************************************//**
813 * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
815 * @param priority The priority to convert.
816 * @returns The equivalent string.
817 *****************************************************************************/
818 char * evel_event_priority(const EVEL_EVENT_PRIORITIES priority);
820 /**************************************************************************//**
821 * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
823 * @param source_type The source type to convert.
824 * @returns The equivalent string.
825 *****************************************************************************/
826 char * evel_source_type(const EVEL_SOURCE_TYPES source_type);
828 /**************************************************************************//**
829 * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
831 * @param vf_status The vf_status to convert.
832 * @returns The equivalent string.
833 *****************************************************************************/
834 char * evel_vf_status(const EVEL_VF_STATUSES vf_status);
836 /**************************************************************************//**
837 * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
839 * @param state The entity state to encode.
841 * @returns the corresponding string
842 *****************************************************************************/
843 char * evel_entity_state(const EVEL_ENTITY_STATE state);
845 /**************************************************************************//**
846 * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
848 * @param endpoint_desc endpoint description to encode.
850 * @returns the corresponding string
851 *****************************************************************************/
852 char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc);
855 /**************************************************************************//**
856 * Initialize an ::EVEL_OPTION_INTHEADER_FIELDS to a not-set state.
858 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
859 *****************************************************************************/
860 void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
861 /**************************************************************************//**
862 * Force the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
864 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
865 * @param value The value to set.
866 *****************************************************************************/
867 void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
869 /**************************************************************************//**
870 * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
872 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
873 * @param value The value to set.
874 * @param description Description to be used in logging.
875 *****************************************************************************/
876 void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
878 const char * const description);
879 /**************************************************************************//**
880 * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS.
882 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
883 *****************************************************************************/
884 void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);