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] throt_api_url
176 * The URL where the Throttling API is expected to be.
177 * @param[in] username The username for the Basic Authentication of requests.
178 * @param[in] password The password for the Basic Authentication of requests.
179 * @param verbosity 0 for normal operation, positive values for chattier
181 *****************************************************************************/
182 EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url,
183 const char * const throt_api_url,
184 const char * const username,
185 const char * const password,
188 /**************************************************************************//**
189 * Terminate the event handler.
191 * Shuts down the event handler thread in as clean a way as possible. Sets the
192 * global exit flag and then signals the thread to interrupt it since it's
193 * most likely waiting on the ring-buffer.
195 * Having achieved an orderly shutdown of the event handler thread, clean up
196 * the cURL library's resources cleanly.
198 * @return Status code.
199 * @retval ::EVEL_SUCCESS if everything OK.
200 * @retval One of ::EVEL_ERR_CODES if there was a problem.
201 *****************************************************************************/
202 EVEL_ERR_CODES event_handler_terminate();
204 /**************************************************************************//**
205 * Run the event handler.
207 * Spawns the thread responsible for handling events and sending them to the
210 * @return Status code.
211 * @retval ::EVEL_SUCCESS if everything OK.
212 * @retval One of ::EVEL_ERR_CODES if there was a problem.
213 *****************************************************************************/
214 EVEL_ERR_CODES event_handler_run();
216 /**************************************************************************//**
217 * Create a new internal event.
219 * @note The mandatory fields on the Fault must be supplied to this factory
220 * function and are immutable once set. Optional fields have explicit
221 * setter functions, but again values may only be set once so that the
222 * Fault has immutable properties.
223 * @param command The condition indicated by the event.
224 * @returns pointer to the newly manufactured ::EVENT_INTERNAL. If the event
225 * is not used (i.e. posted) it must be released using
227 * @retval NULL Failed to create the event.
228 *****************************************************************************/
229 EVENT_INTERNAL * evel_new_internal_event(EVT_HANDLER_COMMAND command);
231 /**************************************************************************//**
232 * Free an internal event.
234 * Free off the event supplied. Will free all the contained* allocated memory.
236 * @note It does not free the internal event itself, since that may be part of
237 * a larger structure.
238 *****************************************************************************/
239 void evel_free_internal_event(EVENT_INTERNAL * event);
241 /*****************************************************************************/
242 /* Structure to hold JSON buffer and associated tracking, as it is written. */
243 /*****************************************************************************/
244 typedef struct evel_json_buffer
250 /***************************************************************************/
251 /* The working throttle specification, which can be NULL. */
252 /***************************************************************************/
253 EVEL_THROTTLE_SPEC * throttle_spec;
255 /***************************************************************************/
256 /* Current object/list nesting depth. */
257 /***************************************************************************/
260 /***************************************************************************/
261 /* The checkpoint. */
262 /***************************************************************************/
267 /**************************************************************************//**
268 * Encode the event as a JSON event object according to AT&T's schema.
270 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
271 * @param event Pointer to the ::EVENT_HEADER to encode.
272 *****************************************************************************/
273 void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf,
274 EVENT_HEADER * event);
276 /**************************************************************************//**
277 * Encode the fault in JSON according to AT&T's schema for the fault type.
279 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
280 * @param event Pointer to the ::EVENT_HEADER to encode.
281 *****************************************************************************/
282 void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf,
283 EVENT_FAULT * event);
285 /**************************************************************************//**
286 * Encode the measurement as a JSON measurement.
288 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
289 * @param event Pointer to the ::EVENT_HEADER to encode.
290 *****************************************************************************/
291 void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
292 EVENT_MEASUREMENT * event);
294 /**************************************************************************//**
295 * Encode the Mobile Flow in JSON according to AT&T's schema for the event
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_mobile_flow(EVEL_JSON_BUFFER * jbuf,
302 EVENT_MOBILE_FLOW * event);
304 /**************************************************************************//**
305 * Encode the report as a JSON report.
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_report(EVEL_JSON_BUFFER * jbuf,
311 EVENT_REPORT * event);
313 /**************************************************************************//**
314 * Encode the Heartbeat fields in JSON according to AT&T's schema for the
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_hrtbt_field(EVEL_JSON_BUFFER * const jbuf,
321 EVENT_HEARTBEAT_FIELD * const event);
323 /**************************************************************************//**
324 * Encode the Signaling in JSON according to AT&T's schema for the event type.
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_signaling(EVEL_JSON_BUFFER * const jbuf,
330 EVENT_SIGNALING * const event);
332 /**************************************************************************//**
333 * Encode the state change as a JSON state change.
335 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
336 * @param state_change Pointer to the ::EVENT_STATE_CHANGE to encode.
337 *****************************************************************************/
338 void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf,
339 EVENT_STATE_CHANGE * state_change);
341 /**************************************************************************//**
342 * Encode the Syslog in JSON according to AT&T's schema for the event type.
344 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
345 * @param event Pointer to the ::EVENT_HEADER to encode.
346 *****************************************************************************/
347 void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf,
348 EVENT_SYSLOG * event);
350 /**************************************************************************//**
351 * Encode the Other in JSON according to AT&T's schema for the event type.
353 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
354 * @param event Pointer to the ::EVENT_HEADER to encode.
355 *****************************************************************************/
356 void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf,
357 EVENT_OTHER * event);
359 /**************************************************************************//**
360 * Set the next event_sequence to use.
362 * @param sequence The next sequence number to use.
363 *****************************************************************************/
364 void evel_set_next_event_sequence(const int sequence);
366 /**************************************************************************//**
367 * Handle a JSON response from the listener, contained in a ::MEMORY_CHUNK.
369 * Tokenize the response, and decode any tokens found.
371 * @param chunk The memory chunk containing the response.
372 * @param post The memory chunk in which to place any resulting POST.
373 *****************************************************************************/
374 void evel_handle_event_response(const MEMORY_CHUNK * const chunk,
375 MEMORY_CHUNK * const post);
377 /**************************************************************************//**
378 * Initialize a ::EVEL_JSON_BUFFER.
380 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to initialise.
381 * @param json Pointer to the underlying working buffer to use.
382 * @param max_size Size of storage available in the JSON buffer.
383 * @param throttle_spec Pointer to throttle specification. Can be NULL.
384 *****************************************************************************/
385 void evel_json_buffer_init(EVEL_JSON_BUFFER * jbuf,
388 EVEL_THROTTLE_SPEC * throttle_spec);
390 /**************************************************************************//**
391 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
393 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
394 * @param key Pointer to the key to encode.
395 * @param option Pointer to holder of the corresponding value to encode.
396 * @return true if the key, value was added, false if it was suppressed.
397 *****************************************************************************/
398 bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER * jbuf,
399 const char * const key,
400 const EVEL_OPTION_STRING * const option);
402 /**************************************************************************//**
403 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
405 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
406 * @param key Pointer to the key to encode.
407 * @param value Pointer to the corresponding value to encode.
408 *****************************************************************************/
409 void evel_enc_kv_string(EVEL_JSON_BUFFER * jbuf,
410 const char * const key,
411 const char * const value);
413 /**************************************************************************//**
414 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
416 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
417 * @param key Pointer to the key to encode.
418 * @param option Pointer to holder of the corresponding value to encode.
419 * @return true if the key, value was added, false if it was suppressed.
420 *****************************************************************************/
421 bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER * jbuf,
422 const char * const key,
423 const EVEL_OPTION_INT * const option);
425 /**************************************************************************//**
426 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
428 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
429 * @param key Pointer to the key to encode.
430 * @param value The corresponding value to encode.
431 *****************************************************************************/
432 void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf,
433 const char * const key,
436 /**************************************************************************//**
437 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
439 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
440 * @param key Pointer to the key to encode.
441 * @param option Pointer to holder of the corresponding value to encode.
442 * @return true if the key, value was added, false if it was suppressed.
443 *****************************************************************************/
444 bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER * jbuf,
445 const char * const key,
446 const EVEL_OPTION_DOUBLE * const option);
448 /**************************************************************************//**
449 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
451 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
452 * @param key Pointer to the key to encode.
453 * @param value The corresponding value to encode.
454 *****************************************************************************/
455 void evel_enc_kv_double(EVEL_JSON_BUFFER * jbuf,
456 const char * const key,
459 /**************************************************************************//**
460 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
462 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
463 * @param key Pointer to the key to encode.
464 * @param option Pointer to holder of the corresponding value to encode.
465 * @return true if the key, value was added, false if it was suppressed.
466 *****************************************************************************/
467 bool evel_enc_kv_opt_ull(EVEL_JSON_BUFFER * jbuf,
468 const char * const key,
469 const EVEL_OPTION_ULL * const option);
471 /**************************************************************************//**
472 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
474 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
475 * @param key Pointer to the key to encode.
476 * @param value The corresponding value to encode.
477 *****************************************************************************/
478 void evel_enc_kv_ull(EVEL_JSON_BUFFER * jbuf,
479 const char * const key,
480 const unsigned long long value);
482 /**************************************************************************//**
483 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
485 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
486 * @param key Pointer to the key to encode.
487 * @param option Pointer to holder of the corresponding value to encode.
488 * @return true if the key, value was added, false if it was suppressed.
489 *****************************************************************************/
490 bool evel_enc_kv_opt_time(EVEL_JSON_BUFFER * jbuf,
491 const char * const key,
492 const EVEL_OPTION_TIME * const option);
494 /**************************************************************************//**
495 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
497 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
498 * @param key Pointer to the key to encode.
499 * @param time Pointer to the time to encode.
500 *****************************************************************************/
501 void evel_enc_kv_time(EVEL_JSON_BUFFER * jbuf,
502 const char * const key,
503 const time_t * time);
505 /**************************************************************************//**
506 * Encode a key and version.
508 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
509 * @param key Pointer to the key to encode.
510 * @param major_version The major version to encode.
511 * @param minor_version The minor version to encode.
512 *****************************************************************************/
513 void evel_enc_version(EVEL_JSON_BUFFER * jbuf,
514 const char * const key,
515 const int major_version,
516 const int minor_version);
518 /**************************************************************************//**
519 * Add the key and opening bracket of an optional named list to a JSON buffer.
521 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
522 * @param key Pointer to the key to encode.
523 * @return true if the list was opened, false if it was suppressed.
524 *****************************************************************************/
525 bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER * jbuf,
526 const char * const key);
528 /**************************************************************************//**
529 * Add the key and opening bracket of a named list to a JSON buffer.
531 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
532 * @param key Pointer to the key to encode.
533 *****************************************************************************/
534 void evel_json_open_named_list(EVEL_JSON_BUFFER * jbuf,
535 const char * const key);
537 /**************************************************************************//**
538 * Add the closing bracket of a list to a JSON buffer.
540 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
541 *****************************************************************************/
542 void evel_json_close_list(EVEL_JSON_BUFFER * jbuf);
544 /**************************************************************************//**
545 * Encode a list item with format and param list to a ::EVEL_JSON_BUFFER.
547 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
548 * @param format Format string in standard printf format.
549 * @param ... Variable parameters for format string.
550 *****************************************************************************/
551 void evel_enc_list_item(EVEL_JSON_BUFFER * jbuf,
552 const char * const format,
555 /**************************************************************************//**
556 * Add the opening bracket of an optional named object to a JSON buffer.
558 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
559 * @param key Pointer to the key to encode.
560 *****************************************************************************/
561 bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER * jbuf,
562 const char * const key);
564 /**************************************************************************//**
565 * Add the opening bracket of an object to a JSON buffer.
567 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
568 * @param key Pointer to the key to encode.
569 * @return true if the object was opened, false if it was suppressed.
570 *****************************************************************************/
571 void evel_json_open_named_object(EVEL_JSON_BUFFER * jbuf,
572 const char * const key);
574 /**************************************************************************//**
575 * Add the opening bracket of an object to a JSON buffer.
577 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
578 *****************************************************************************/
579 void evel_json_open_object(EVEL_JSON_BUFFER * jbuf);
581 /**************************************************************************//**
582 * Add the closing bracket of an object to a JSON buffer.
584 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
585 *****************************************************************************/
586 void evel_json_close_object(EVEL_JSON_BUFFER * jbuf);
588 /**************************************************************************//**
589 * Add a checkpoint - a stake in the ground to which we can rewind.
591 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
592 *****************************************************************************/
593 void evel_json_checkpoint(EVEL_JSON_BUFFER * jbuf);
595 /**************************************************************************//**
596 * Rewind to the latest checkoint.
598 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
599 *****************************************************************************/
600 void evel_json_rewind(EVEL_JSON_BUFFER * jbuf);
602 /**************************************************************************//**
603 * Free the underlying resources of an ::EVEL_OPTION_STRING.
605 * @param option Pointer to the ::EVEL_OPTION_STRING.
606 *****************************************************************************/
607 void evel_free_option_string(EVEL_OPTION_STRING * const option);
609 /**************************************************************************//**
610 * Initialize an ::EVEL_OPTION_STRING to a not-set state.
612 * @param option Pointer to the ::EVEL_OPTION_STRING.
613 *****************************************************************************/
614 void evel_init_option_string(EVEL_OPTION_STRING * const option);
616 /**************************************************************************//**
617 * Set the value of an ::EVEL_OPTION_STRING.
619 * @param option Pointer to the ::EVEL_OPTION_STRING.
620 * @param value The value to set.
621 * @param description Description to be used in logging.
622 *****************************************************************************/
623 void evel_set_option_string(EVEL_OPTION_STRING * const option,
624 const char * const value,
625 const char * const description);
627 /**************************************************************************//**
628 * Force the value of an ::EVEL_OPTION_STRING.
630 * @param option Pointer to the ::EVEL_OPTION_STRING.
631 * @param value The value to set.
632 *****************************************************************************/
633 void evel_force_option_string(EVEL_OPTION_STRING * const option,
634 const char * const value);
636 /**************************************************************************//**
637 * Initialize an ::EVEL_OPTION_INT to a not-set state.
639 * @param option Pointer to the ::EVEL_OPTION_INT.
640 *****************************************************************************/
641 void evel_init_option_int(EVEL_OPTION_INT * const option);
643 /**************************************************************************//**
644 * Force the value of an ::EVEL_OPTION_INT.
646 * @param option Pointer to the ::EVEL_OPTION_INT.
647 * @param value The value to set.
648 *****************************************************************************/
649 void evel_force_option_int(EVEL_OPTION_INT * const option,
652 /**************************************************************************//**
653 * Set the value of an ::EVEL_OPTION_INT.
655 * @param option Pointer to the ::EVEL_OPTION_INT.
656 * @param value The value to set.
657 * @param description Description to be used in logging.
658 *****************************************************************************/
659 void evel_set_option_int(EVEL_OPTION_INT * const option,
661 const char * const description);
663 /**************************************************************************//**
664 * Initialize an ::EVEL_OPTION_DOUBLE to a not-set state.
666 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
667 *****************************************************************************/
668 void evel_init_option_double(EVEL_OPTION_DOUBLE * const option);
670 /**************************************************************************//**
671 * Force the value of an ::EVEL_OPTION_DOUBLE.
673 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
674 * @param value The value to set.
675 *****************************************************************************/
676 void evel_force_option_double(EVEL_OPTION_DOUBLE * const option,
679 /**************************************************************************//**
680 * Set the value of an ::EVEL_OPTION_DOUBLE.
682 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
683 * @param value The value to set.
684 * @param description Description to be used in logging.
685 *****************************************************************************/
686 void evel_set_option_double(EVEL_OPTION_DOUBLE * const option,
688 const char * const description);
690 /**************************************************************************//**
691 * Initialize an ::EVEL_OPTION_ULL to a not-set state.
693 * @param option Pointer to the ::EVEL_OPTION_ULL.
694 *****************************************************************************/
695 void evel_init_option_ull(EVEL_OPTION_ULL * const option);
697 /**************************************************************************//**
698 * Force the value of an ::EVEL_OPTION_ULL.
700 * @param option Pointer to the ::EVEL_OPTION_ULL.
701 * @param value The value to set.
702 *****************************************************************************/
703 void evel_force_option_ull(EVEL_OPTION_ULL * const option,
704 const unsigned long long value);
706 /**************************************************************************//**
707 * Set the value of an ::EVEL_OPTION_ULL.
709 * @param option Pointer to the ::EVEL_OPTION_ULL.
710 * @param value The value to set.
711 * @param description Description to be used in logging.
712 *****************************************************************************/
713 void evel_set_option_ull(EVEL_OPTION_ULL * const option,
714 const unsigned long long value,
715 const char * const description);
717 /**************************************************************************//**
718 * Initialize an ::EVEL_OPTION_TIME to a not-set state.
720 * @param option Pointer to the ::EVEL_OPTION_TIME.
721 *****************************************************************************/
722 void evel_init_option_time(EVEL_OPTION_TIME * const option);
724 /**************************************************************************//**
725 * Force the value of an ::EVEL_OPTION_TIME.
727 * @param option Pointer to the ::EVEL_OPTION_TIME.
728 * @param value The value to set.
729 *****************************************************************************/
730 void evel_force_option_time(EVEL_OPTION_TIME * const option,
733 /**************************************************************************//**
734 * Set the value of an ::EVEL_OPTION_TIME.
736 * @param option Pointer to the ::EVEL_OPTION_TIME.
737 * @param value The value to set.
738 * @param description Description to be used in logging.
739 *****************************************************************************/
740 void evel_set_option_time(EVEL_OPTION_TIME * const option,
742 const char * const description);
744 /**************************************************************************//**
745 * Map an ::EVEL_COUNTER_CRITICALITIES enum value to the equivalent string.
747 * @param criticality The criticality to convert.
748 * @returns The equivalent string.
749 *****************************************************************************/
750 char * evel_criticality(const EVEL_COUNTER_CRITICALITIES criticality);
752 /**************************************************************************//**
753 * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
755 * @param severity The severity to convert.
756 * @returns The equivalent string.
757 *****************************************************************************/
758 char * evel_severity(const EVEL_SEVERITIES severity);
760 /**************************************************************************//**
761 * Map an ::EVEL_ALERT_ACTIONS enum value to the equivalent string.
763 * @param alert_action The alert_action to convert.
764 * @returns The equivalent string.
765 *****************************************************************************/
766 char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action);
768 /**************************************************************************//**
769 * Map an ::EVEL_ALERT_TYPES enum value to the equivalent string.
771 * @param alert_type The alert_type to convert.
772 * @returns The equivalent string.
773 *****************************************************************************/
774 char * evel_alert_type(const EVEL_ALERT_TYPES alert_type);
776 /**************************************************************************//**
777 * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
779 * @param domain The domain to convert.
780 * @returns The equivalent string.
781 *****************************************************************************/
782 char * evel_event_domain(const EVEL_EVENT_DOMAINS domain);
784 /**************************************************************************//**
785 * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
787 * @param priority The priority to convert.
788 * @returns The equivalent string.
789 *****************************************************************************/
790 char * evel_event_priority(const EVEL_EVENT_PRIORITIES priority);
792 /**************************************************************************//**
793 * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
795 * @param source_type The source type to convert.
796 * @returns The equivalent string.
797 *****************************************************************************/
798 char * evel_source_type(const EVEL_SOURCE_TYPES source_type);
800 /**************************************************************************//**
801 * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
803 * @param vf_status The vf_status to convert.
804 * @returns The equivalent string.
805 *****************************************************************************/
806 char * evel_vf_status(const EVEL_VF_STATUSES vf_status);
808 /**************************************************************************//**
809 * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
811 * @param state The entity state to encode.
813 * @returns the corresponding string
814 *****************************************************************************/
815 char * evel_entity_state(const EVEL_ENTITY_STATE state);
817 /**************************************************************************//**
818 * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
820 * @param endpoint_desc endpoint description to encode.
822 * @returns the corresponding string
823 *****************************************************************************/
824 char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc);
827 /**************************************************************************//**
828 * Initialize an ::EVEL_OPTION_INTHEADER_FIELDS to a not-set state.
830 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
831 *****************************************************************************/
832 void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
833 /**************************************************************************//**
834 * Force the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
836 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
837 * @param value The value to set.
838 *****************************************************************************/
839 void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
841 /**************************************************************************//**
842 * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
844 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
845 * @param value The value to set.
846 * @param description Description to be used in logging.
847 *****************************************************************************/
848 void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
850 const char * const description);
851 /**************************************************************************//**
852 * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS.
854 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
855 *****************************************************************************/
856 void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);