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] source_ip Source IP of VES Agent
178 * @param[in] secure Whether Using http or https
179 * @param[in] cert_file_path Path to Client Certificate file
180 * @param[in] key_file_path Path to Client key file
181 * @param[in] ca_info Path to CA info file
182 * @param[in] ca_file_path Path to CA file
183 * @param[in] verify_peer Using peer verification or not
184 * @param[in] verify_host Using host verification or not
185 * @param[in] username The username for the Basic Authentication of requests.
186 * @param[in] password The password for the Basic Authentication of requests.
187 * @param verbosity 0 for normal operation, positive values for chattier
189 *****************************************************************************/
190 EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url,
191 const char * const throt_api_url,
192 const char * const source_ip,
194 const char * const cert_file_path,
195 const char * const key_file_path,
196 const char * const ca_info,
197 const char * const ca_file_path,
200 const char * const username,
201 const char * const password,
204 /**************************************************************************//**
205 * Terminate the event handler.
207 * Shuts down the event handler thread in as clean a way as possible. Sets the
208 * global exit flag and then signals the thread to interrupt it since it's
209 * most likely waiting on the ring-buffer.
211 * Having achieved an orderly shutdown of the event handler thread, clean up
212 * the cURL library's resources cleanly.
214 * @return Status code.
215 * @retval ::EVEL_SUCCESS if everything OK.
216 * @retval One of ::EVEL_ERR_CODES if there was a problem.
217 *****************************************************************************/
218 EVEL_ERR_CODES event_handler_terminate();
220 /**************************************************************************//**
221 * Run the event handler.
223 * Spawns the thread responsible for handling events and sending them to the
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_run();
232 /**************************************************************************//**
233 * Create a new internal event.
235 * @note The mandatory fields on the Fault must be supplied to this factory
236 * function and are immutable once set. Optional fields have explicit
237 * setter functions, but again values may only be set once so that the
238 * Fault has immutable properties.
239 * @param command The condition indicated by the event.
240 * @returns pointer to the newly manufactured ::EVENT_INTERNAL. If the event
241 * is not used (i.e. posted) it must be released using
243 * @retval NULL Failed to create the event.
244 *****************************************************************************/
245 EVENT_INTERNAL * evel_new_internal_event(EVT_HANDLER_COMMAND command,const char* ev_name, const char *ev_id);
247 /**************************************************************************//**
248 * Free an internal event.
250 * Free off the event supplied. Will free all the contained* allocated memory.
252 * @note It does not free the internal event itself, since that may be part of
253 * a larger structure.
254 *****************************************************************************/
255 void evel_free_internal_event(EVENT_INTERNAL * event);
257 /*****************************************************************************/
258 /* Structure to hold JSON buffer and associated tracking, as it is written. */
259 /*****************************************************************************/
260 typedef struct evel_json_buffer
266 /***************************************************************************/
267 /* The working throttle specification, which can be NULL. */
268 /***************************************************************************/
269 EVEL_THROTTLE_SPEC * throttle_spec;
271 /***************************************************************************/
272 /* Current object/list nesting depth. */
273 /***************************************************************************/
276 /***************************************************************************/
277 /* The checkpoint. */
278 /***************************************************************************/
283 /**************************************************************************//**
284 * Encode the event as a JSON event object according to AT&T's schema.
286 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
287 * @param event Pointer to the ::EVENT_HEADER to encode.
288 *****************************************************************************/
289 void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf,
290 EVENT_HEADER * event);
292 /**************************************************************************//**
293 * Encode the fault in JSON according to AT&T's schema for the fault type.
295 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
296 * @param event Pointer to the ::EVENT_HEADER to encode.
297 *****************************************************************************/
298 void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf,
299 EVENT_FAULT * event);
301 /**************************************************************************//**
302 * Encode the measurement as a JSON measurement.
304 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
305 * @param event Pointer to the ::EVENT_HEADER to encode.
306 *****************************************************************************/
307 void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
308 EVENT_MEASUREMENT * event);
310 /**************************************************************************//**
311 * Encode the Mobile Flow in JSON according to AT&T's schema for the event
314 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
315 * @param event Pointer to the ::EVENT_HEADER to encode.
316 *****************************************************************************/
317 void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf,
318 EVENT_MOBILE_FLOW * event);
320 /**************************************************************************//**
321 * Encode the report as a JSON report.
323 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
324 * @param event Pointer to the ::EVENT_HEADER to encode.
325 *****************************************************************************/
326 void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf,
327 EVENT_REPORT * event);
329 /**************************************************************************//**
330 * Encode the Heartbeat fields in JSON according to AT&T's schema for the
333 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
334 * @param event Pointer to the ::EVENT_HEADER to encode.
335 *****************************************************************************/
336 void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf,
337 EVENT_HEARTBEAT_FIELD * const event);
339 /**************************************************************************//**
340 * Encode the Signaling in JSON according to AT&T's schema for the event type.
342 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
343 * @param event Pointer to the ::EVENT_HEADER to encode.
344 *****************************************************************************/
345 void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf,
346 EVENT_SIGNALING * const event);
348 /**************************************************************************//**
349 * Encode the state change as a JSON state change.
351 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
352 * @param state_change Pointer to the ::EVENT_STATE_CHANGE to encode.
353 *****************************************************************************/
354 void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf,
355 EVENT_STATE_CHANGE * state_change);
357 /**************************************************************************//**
358 * Encode the Syslog in JSON according to AT&T's schema for the event type.
360 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
361 * @param event Pointer to the ::EVENT_HEADER to encode.
362 *****************************************************************************/
363 void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf,
364 EVENT_SYSLOG * event);
366 /**************************************************************************//**
367 * Encode the Other in JSON according to AT&T's schema for the event type.
369 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
370 * @param event Pointer to the ::EVENT_HEADER to encode.
371 *****************************************************************************/
372 void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf,
373 EVENT_OTHER * event);
375 /**************************************************************************//**
376 * Set the next event_sequence to use.
378 * @param sequence The next sequence number to use.
379 *****************************************************************************/
380 void evel_set_next_event_sequence(const int sequence);
382 /**************************************************************************//**
383 * Handle a JSON response from the listener, contained in a ::MEMORY_CHUNK.
385 * Tokenize the response, and decode any tokens found.
387 * @param chunk The memory chunk containing the response.
388 * @param post The memory chunk in which to place any resulting POST.
389 *****************************************************************************/
390 void evel_handle_event_response(const MEMORY_CHUNK * const chunk,
391 MEMORY_CHUNK * const post);
393 /**************************************************************************//**
394 * Initialize a ::EVEL_JSON_BUFFER.
396 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to initialise.
397 * @param json Pointer to the underlying working buffer to use.
398 * @param max_size Size of storage available in the JSON buffer.
399 * @param throttle_spec Pointer to throttle specification. Can be NULL.
400 *****************************************************************************/
401 void evel_json_buffer_init(EVEL_JSON_BUFFER * jbuf,
404 EVEL_THROTTLE_SPEC * throttle_spec);
406 /**************************************************************************//**
407 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
409 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
410 * @param key Pointer to the key to encode.
411 * @param option Pointer to holder of the corresponding value to encode.
412 * @return true if the key, value was added, false if it was suppressed.
413 *****************************************************************************/
414 bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER * jbuf,
415 const char * const key,
416 const EVEL_OPTION_STRING * const option);
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 value Pointer to the corresponding value to encode.
424 *****************************************************************************/
425 void evel_enc_kv_string(EVEL_JSON_BUFFER * jbuf,
426 const char * const key,
427 const char * const value);
429 /**************************************************************************//**
430 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
432 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
433 * @param key Pointer to the key to encode.
434 * @param option Pointer to holder of the corresponding value to encode.
435 * @return true if the key, value was added, false if it was suppressed.
436 *****************************************************************************/
437 bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER * jbuf,
438 const char * const key,
439 const EVEL_OPTION_INT * const option);
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 value The corresponding value to encode.
447 *****************************************************************************/
448 void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf,
449 const char * const key,
452 /**************************************************************************//**
453 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
455 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
456 * @param key Pointer to the key to encode.
457 * @param option Pointer to holder of the corresponding value to encode.
458 * @return true if the key, value was added, false if it was suppressed.
459 *****************************************************************************/
460 bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER * jbuf,
461 const char * const key,
462 const EVEL_OPTION_DOUBLE * const option);
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 value The corresponding value to encode.
470 *****************************************************************************/
471 void evel_enc_kv_double(EVEL_JSON_BUFFER * jbuf,
472 const char * const key,
475 /**************************************************************************//**
476 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
478 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
479 * @param key Pointer to the key to encode.
480 * @param option Pointer to holder of the corresponding value to encode.
481 * @return true if the key, value was added, false if it was suppressed.
482 *****************************************************************************/
483 bool evel_enc_kv_opt_ull(EVEL_JSON_BUFFER * jbuf,
484 const char * const key,
485 const EVEL_OPTION_ULL * const option);
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 value The corresponding value to encode.
493 *****************************************************************************/
494 void evel_enc_kv_ull(EVEL_JSON_BUFFER * jbuf,
495 const char * const key,
496 const unsigned long long value);
498 /**************************************************************************//**
499 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
501 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
502 * @param key Pointer to the key to encode.
503 * @param option Pointer to holder of the corresponding value to encode.
504 * @return true if the key, value was added, false if it was suppressed.
505 *****************************************************************************/
506 bool evel_enc_kv_opt_time(EVEL_JSON_BUFFER * jbuf,
507 const char * const key,
508 const EVEL_OPTION_TIME * const option);
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 time Pointer to the time to encode.
516 *****************************************************************************/
517 void evel_enc_kv_time(EVEL_JSON_BUFFER * jbuf,
518 const char * const key,
519 const time_t * time);
521 /**************************************************************************//**
522 * Encode a key and version.
524 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
525 * @param key Pointer to the key to encode.
526 * @param major_version The major version to encode.
527 * @param minor_version The minor version to encode.
528 *****************************************************************************/
529 void evel_enc_version(EVEL_JSON_BUFFER * jbuf,
530 const char * const key,
531 const int major_version,
532 const int minor_version);
534 /**************************************************************************//**
535 * Add the key and opening bracket of an optional named list to a JSON buffer.
537 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
538 * @param key Pointer to the key to encode.
539 * @return true if the list was opened, false if it was suppressed.
540 *****************************************************************************/
541 bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER * jbuf,
542 const char * const key);
544 /**************************************************************************//**
545 * Add the key and opening bracket of a named list to a JSON buffer.
547 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
548 * @param key Pointer to the key to encode.
549 *****************************************************************************/
550 void evel_json_open_named_list(EVEL_JSON_BUFFER * jbuf,
551 const char * const key);
553 /**************************************************************************//**
554 * Add the closing bracket of a list to a JSON buffer.
556 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
557 *****************************************************************************/
558 void evel_json_close_list(EVEL_JSON_BUFFER * jbuf);
560 /**************************************************************************//**
561 * Encode a list item with format and param list to a ::EVEL_JSON_BUFFER.
563 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
564 * @param format Format string in standard printf format.
565 * @param ... Variable parameters for format string.
566 *****************************************************************************/
567 void evel_enc_list_item(EVEL_JSON_BUFFER * jbuf,
568 const char * const format,
571 /**************************************************************************//**
572 * Add the opening bracket of an optional named object to a JSON buffer.
574 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
575 * @param key Pointer to the key to encode.
576 *****************************************************************************/
577 bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER * jbuf,
578 const char * const key);
580 /**************************************************************************//**
581 * Add the opening bracket of an object to a JSON buffer.
583 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
584 * @param key Pointer to the key to encode.
585 * @return true if the object was opened, false if it was suppressed.
586 *****************************************************************************/
587 void evel_json_open_named_object(EVEL_JSON_BUFFER * jbuf,
588 const char * const key);
590 /**************************************************************************//**
591 * Add the opening bracket of an object to a JSON buffer.
593 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
594 *****************************************************************************/
595 void evel_json_open_object(EVEL_JSON_BUFFER * jbuf);
597 /**************************************************************************//**
598 * Add the closing bracket of an object to a JSON buffer.
600 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
601 *****************************************************************************/
602 void evel_json_close_object(EVEL_JSON_BUFFER * jbuf);
604 /**************************************************************************//**
605 * Add a checkpoint - a stake in the ground to which we can rewind.
607 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
608 *****************************************************************************/
609 void evel_json_checkpoint(EVEL_JSON_BUFFER * jbuf);
611 /**************************************************************************//**
612 * Rewind to the latest checkoint.
614 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
615 *****************************************************************************/
616 void evel_json_rewind(EVEL_JSON_BUFFER * jbuf);
618 /**************************************************************************//**
619 * Free the underlying resources of an ::EVEL_OPTION_STRING.
621 * @param option Pointer to the ::EVEL_OPTION_STRING.
622 *****************************************************************************/
623 void evel_free_option_string(EVEL_OPTION_STRING * const option);
625 /**************************************************************************//**
626 * Initialize an ::EVEL_OPTION_STRING to a not-set state.
628 * @param option Pointer to the ::EVEL_OPTION_STRING.
629 *****************************************************************************/
630 void evel_init_option_string(EVEL_OPTION_STRING * const option);
632 /**************************************************************************//**
633 * Set the value of an ::EVEL_OPTION_STRING.
635 * @param option Pointer to the ::EVEL_OPTION_STRING.
636 * @param value The value to set.
637 * @param description Description to be used in logging.
638 *****************************************************************************/
639 void evel_set_option_string(EVEL_OPTION_STRING * const option,
640 const char * const value,
641 const char * const description);
643 /**************************************************************************//**
644 * Force the value of an ::EVEL_OPTION_STRING.
646 * @param option Pointer to the ::EVEL_OPTION_STRING.
647 * @param value The value to set.
648 *****************************************************************************/
649 void evel_force_option_string(EVEL_OPTION_STRING * const option,
650 const char * const value);
652 /**************************************************************************//**
653 * Initialize an ::EVEL_OPTION_INT to a not-set state.
655 * @param option Pointer to the ::EVEL_OPTION_INT.
656 *****************************************************************************/
657 void evel_init_option_int(EVEL_OPTION_INT * const option);
659 /**************************************************************************//**
660 * Force the value of an ::EVEL_OPTION_INT.
662 * @param option Pointer to the ::EVEL_OPTION_INT.
663 * @param value The value to set.
664 *****************************************************************************/
665 void evel_force_option_int(EVEL_OPTION_INT * const option,
668 /**************************************************************************//**
669 * Set the value of an ::EVEL_OPTION_INT.
671 * @param option Pointer to the ::EVEL_OPTION_INT.
672 * @param value The value to set.
673 * @param description Description to be used in logging.
674 *****************************************************************************/
675 void evel_set_option_int(EVEL_OPTION_INT * const option,
677 const char * const description);
679 /**************************************************************************//**
680 * Initialize an ::EVEL_OPTION_DOUBLE to a not-set state.
682 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
683 *****************************************************************************/
684 void evel_init_option_double(EVEL_OPTION_DOUBLE * const option);
686 /**************************************************************************//**
687 * Force the value of an ::EVEL_OPTION_DOUBLE.
689 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
690 * @param value The value to set.
691 *****************************************************************************/
692 void evel_force_option_double(EVEL_OPTION_DOUBLE * const option,
695 /**************************************************************************//**
696 * Set the value of an ::EVEL_OPTION_DOUBLE.
698 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
699 * @param value The value to set.
700 * @param description Description to be used in logging.
701 *****************************************************************************/
702 void evel_set_option_double(EVEL_OPTION_DOUBLE * const option,
704 const char * const description);
706 /**************************************************************************//**
707 * Initialize an ::EVEL_OPTION_ULL to a not-set state.
709 * @param option Pointer to the ::EVEL_OPTION_ULL.
710 *****************************************************************************/
711 void evel_init_option_ull(EVEL_OPTION_ULL * const option);
713 /**************************************************************************//**
714 * Force the value of an ::EVEL_OPTION_ULL.
716 * @param option Pointer to the ::EVEL_OPTION_ULL.
717 * @param value The value to set.
718 *****************************************************************************/
719 void evel_force_option_ull(EVEL_OPTION_ULL * const option,
720 const unsigned long long value);
722 /**************************************************************************//**
723 * Set the value of an ::EVEL_OPTION_ULL.
725 * @param option Pointer to the ::EVEL_OPTION_ULL.
726 * @param value The value to set.
727 * @param description Description to be used in logging.
728 *****************************************************************************/
729 void evel_set_option_ull(EVEL_OPTION_ULL * const option,
730 const unsigned long long value,
731 const char * const description);
733 /**************************************************************************//**
734 * Initialize an ::EVEL_OPTION_TIME to a not-set state.
736 * @param option Pointer to the ::EVEL_OPTION_TIME.
737 *****************************************************************************/
738 void evel_init_option_time(EVEL_OPTION_TIME * const option);
740 /**************************************************************************//**
741 * Force the value of an ::EVEL_OPTION_TIME.
743 * @param option Pointer to the ::EVEL_OPTION_TIME.
744 * @param value The value to set.
745 *****************************************************************************/
746 void evel_force_option_time(EVEL_OPTION_TIME * const option,
749 /**************************************************************************//**
750 * Set the value of an ::EVEL_OPTION_TIME.
752 * @param option Pointer to the ::EVEL_OPTION_TIME.
753 * @param value The value to set.
754 * @param description Description to be used in logging.
755 *****************************************************************************/
756 void evel_set_option_time(EVEL_OPTION_TIME * const option,
758 const char * const description);
760 /**************************************************************************//**
761 * Map an ::EVEL_COUNTER_CRITICALITIES enum value to the equivalent string.
763 * @param criticality The criticality to convert.
764 * @returns The equivalent string.
765 *****************************************************************************/
766 char * evel_criticality(const EVEL_COUNTER_CRITICALITIES criticality);
768 /**************************************************************************//**
769 * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
771 * @param severity The severity to convert.
772 * @returns The equivalent string.
773 *****************************************************************************/
774 char * evel_severity(const EVEL_SEVERITIES severity);
776 /**************************************************************************//**
777 * Map an ::EVEL_ALERT_ACTIONS enum value to the equivalent string.
779 * @param alert_action The alert_action to convert.
780 * @returns The equivalent string.
781 *****************************************************************************/
782 char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action);
784 /**************************************************************************//**
785 * Map an ::EVEL_ALERT_TYPES enum value to the equivalent string.
787 * @param alert_type The alert_type to convert.
788 * @returns The equivalent string.
789 *****************************************************************************/
790 char * evel_alert_type(const EVEL_ALERT_TYPES alert_type);
792 /**************************************************************************//**
793 * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
795 * @param domain The domain to convert.
796 * @returns The equivalent string.
797 *****************************************************************************/
798 char * evel_event_domain(const EVEL_EVENT_DOMAINS domain);
800 /**************************************************************************//**
801 * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
803 * @param priority The priority to convert.
804 * @returns The equivalent string.
805 *****************************************************************************/
806 char * evel_event_priority(const EVEL_EVENT_PRIORITIES priority);
808 /**************************************************************************//**
809 * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
811 * @param source_type The source type to convert.
812 * @returns The equivalent string.
813 *****************************************************************************/
814 char * evel_source_type(const EVEL_SOURCE_TYPES source_type);
816 /**************************************************************************//**
817 * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
819 * @param vf_status The vf_status to convert.
820 * @returns The equivalent string.
821 *****************************************************************************/
822 char * evel_vf_status(const EVEL_VF_STATUSES vf_status);
824 /**************************************************************************//**
825 * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
827 * @param state The entity state to encode.
829 * @returns the corresponding string
830 *****************************************************************************/
831 char * evel_entity_state(const EVEL_ENTITY_STATE state);
833 /**************************************************************************//**
834 * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
836 * @param endpoint_desc endpoint description to encode.
838 * @returns the corresponding string
839 *****************************************************************************/
840 char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc);
843 /**************************************************************************//**
844 * Initialize an ::EVEL_OPTION_INTHEADER_FIELDS to a not-set state.
846 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
847 *****************************************************************************/
848 void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
849 /**************************************************************************//**
850 * Force the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
852 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
853 * @param value The value to set.
854 *****************************************************************************/
855 void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
857 /**************************************************************************//**
858 * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
860 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
861 * @param value The value to set.
862 * @param description Description to be used in logging.
863 *****************************************************************************/
864 void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
866 const char * const description);
867 /**************************************************************************//**
868 * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS.
870 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
871 *****************************************************************************/
872 void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);