1 #ifndef EVEL_INTERNAL_INCLUDED
2 #define EVEL_INTERNAL_INCLUDED
4 /**************************************************************************//**
6 * EVEL internal definitions.
8 * These are internal definitions which need to be shared between modules
9 * within the library but are not intended for external consumption.
14 * Copyright(c) <2016>, AT&T Intellectual Property. All other rights reserved.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions are met:
19 * 1. Redistributions of source code must retain the above copyright notice,
20 * this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright notice,
22 * this list of conditions and the following disclaimer in the documentation
23 * and/or other materials provided with the distribution.
24 * 3. All advertising materials mentioning features or use of this software
25 * must display the following acknowledgement: This product includes
26 * software developed by the AT&T.
27 * 4. Neither the name of AT&T nor the names of its contributors may be used to
28 * endorse or promote products derived from this software without specific
29 * prior written permission.
31 * THIS SOFTWARE IS PROVIDED BY AT&T INTELLECTUAL PROPERTY ''AS IS'' AND ANY
32 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 * DISCLAIMED. IN NO EVENT SHALL AT&T INTELLECTUAL PROPERTY BE LIABLE FOR ANY
35 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
40 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *****************************************************************************/
45 /*****************************************************************************/
46 /* Define some type-safe min/max macros. */
47 /*****************************************************************************/
49 ({ __typeof__ (a) _a = (a); \
50 __typeof__ (b) _b = (b); \
54 ({ __typeof__ (a) _a = (a); \
55 __typeof__ (b) _b = (b); \
59 /**************************************************************************//**
60 * Compile-time assertion.
61 *****************************************************************************/
62 #define EVEL_CT_ASSERT(X) switch (0) {case 0: case (X):;}
64 /**************************************************************************//**
65 * The Functional Role of the equipment represented by this VNF.
66 *****************************************************************************/
67 extern char * functional_role;
69 /**************************************************************************//**
70 * The type of equipment represented by this VNF.
71 *****************************************************************************/
72 extern EVEL_SOURCE_TYPES event_source_type;
74 /**************************************************************************//**
75 * A chunk of memory used in the cURL functions.
76 *****************************************************************************/
77 typedef struct memory_chunk {
82 /**************************************************************************//**
83 * Global commands that may be sent to the Event Handler thread.
84 *****************************************************************************/
88 } EVT_HANDLER_COMMAND;
90 /**************************************************************************//**
91 * State of the Event Handler thread.
92 *****************************************************************************/
94 EVT_HANDLER_UNINITIALIZED, /** The library cannot handle events. */
95 EVT_HANDLER_INACTIVE, /** The event handler thread not started. */
96 EVT_HANDLER_ACTIVE, /** The event handler thread is started. */
97 EVT_HANDLER_REQUEST_TERMINATE, /** Initial stages of shutdown. */
98 EVT_HANDLER_TERMINATING, /** The ring-buffer is being depleted. */
99 EVT_HANDLER_TERMINATED, /** The library is exited. */
100 EVT_HANDLER_MAX_STATES /** Maximum number of valid states. */
103 /**************************************************************************//**
105 * Pseudo-event used for routing internal commands.
106 *****************************************************************************/
107 typedef struct event_internal {
109 EVT_HANDLER_COMMAND command;
112 /**************************************************************************//**
113 * Suppressed NV pairs list entry.
114 * JSON equivalent field: suppressedNvPairs
115 *****************************************************************************/
116 typedef struct evel_suppressed_nv_pairs {
118 /***************************************************************************/
119 /* Mandatory fields */
120 /* JSON equivalent field: nvPairFieldName */
121 /***************************************************************************/
122 char * nv_pair_field_name;
124 /***************************************************************************/
125 /* Optional fields */
126 /* JSON equivalent field: suppressedNvPairNames */
127 /* Type of each list entry: char * */
128 /***************************************************************************/
129 DLIST suppressed_nv_pair_names;
131 /***************************************************************************/
132 /* Hash table containing suppressed_nv_pair_names as keys. */
133 /***************************************************************************/
134 struct hsearch_data * hash_nv_pair_names;
136 } EVEL_SUPPRESSED_NV_PAIRS;
138 /**************************************************************************//**
139 * Event Throttling Specification for a domain which is in a throttled state.
140 * JSON equivalent object: eventThrottlingState
141 *****************************************************************************/
142 typedef struct evel_throttle_spec {
144 /***************************************************************************/
145 /* List of field names to be suppressed. */
146 /* JSON equivalent field: suppressedFieldNames */
147 /* Type of each list entry: char * */
148 /***************************************************************************/
149 DLIST suppressed_field_names;
151 /***************************************************************************/
152 /* List of name-value pairs to be suppressed. */
153 /* JSON equivalent field: suppressedNvPairsList */
154 /* Type of each list entry: EVEL_SUPPRESSED_NV_PAIRS * */
155 /***************************************************************************/
156 DLIST suppressed_nv_pairs_list;
158 /***************************************************************************/
159 /* Hash table containing suppressed_nv_pair_names as keys. */
160 /***************************************************************************/
161 struct hsearch_data * hash_field_names;
163 /***************************************************************************/
164 /* Hash table containing nv_pair_field_name as keys, and */
165 /* suppressed_nv_pairs_list as values. */
166 /***************************************************************************/
167 struct hsearch_data * hash_nv_pairs_list;
169 } EVEL_THROTTLE_SPEC;
171 /*****************************************************************************/
172 /* RFC2822 format string for strftime. */
173 /*****************************************************************************/
174 #define EVEL_RFC2822_STRFTIME_FORMAT "%a, %d %b %Y %T %z"
176 /*****************************************************************************/
177 /* EVEL_JSON_BUFFER depth at which we throttle fields. */
178 /*****************************************************************************/
179 #define EVEL_THROTTLE_FIELD_DEPTH 3
181 /**************************************************************************//**
182 * Initialize the event handler.
184 * Primarily responsible for getting cURL ready for use.
186 * @param[in] event_api_url
187 * The URL where the Vendor Event Listener API is expected
189 * @param[in] throt_api_url
190 * The URL where the Throttling API is expected to be.
191 * @param[in] username The username for the Basic Authentication of requests.
192 * @param[in] password The password for the Basic Authentication of requests.
193 * @param verbosity 0 for normal operation, positive values for chattier
195 *****************************************************************************/
196 EVEL_ERR_CODES event_handler_initialize(const char * const event_api_url,
197 const char * const throt_api_url,
198 const char * const username,
199 const char * const password,
202 /**************************************************************************//**
203 * Terminate the event handler.
205 * Shuts down the event handler thread in as clean a way as possible. Sets the
206 * global exit flag and then signals the thread to interrupt it since it's
207 * most likely waiting on the ring-buffer.
209 * Having achieved an orderly shutdown of the event handler thread, clean up
210 * the cURL library's resources cleanly.
212 * @return Status code.
213 * @retval ::EVEL_SUCCESS if everything OK.
214 * @retval One of ::EVEL_ERR_CODES if there was a problem.
215 *****************************************************************************/
216 EVEL_ERR_CODES event_handler_terminate();
218 /**************************************************************************//**
219 * Run the event handler.
221 * Spawns the thread responsible for handling events and sending them to the
224 * @return Status code.
225 * @retval ::EVEL_SUCCESS if everything OK.
226 * @retval One of ::EVEL_ERR_CODES if there was a problem.
227 *****************************************************************************/
228 EVEL_ERR_CODES event_handler_run();
230 /**************************************************************************//**
231 * Create a new internal event.
233 * @note The mandatory fields on the Fault must be supplied to this factory
234 * function and are immutable once set. Optional fields have explicit
235 * setter functions, but again values may only be set once so that the
236 * Fault has immutable properties.
237 * @param command The condition indicated by the event.
238 * @returns pointer to the newly manufactured ::EVENT_INTERNAL. If the event
239 * is not used (i.e. posted) it must be released using
241 * @retval NULL Failed to create the event.
242 *****************************************************************************/
243 EVENT_INTERNAL * evel_new_internal_event(EVT_HANDLER_COMMAND command);
245 /**************************************************************************//**
246 * Free an internal event.
248 * Free off the event supplied. Will free all the contained* allocated memory.
250 * @note It does not free the internal event itself, since that may be part of
251 * a larger structure.
252 *****************************************************************************/
253 void evel_free_internal_event(EVENT_INTERNAL * event);
255 /*****************************************************************************/
256 /* Structure to hold JSON buffer and associated tracking, as it is written. */
257 /*****************************************************************************/
258 typedef struct evel_json_buffer
264 /***************************************************************************/
265 /* The working throttle specification, which can be NULL. */
266 /***************************************************************************/
267 EVEL_THROTTLE_SPEC * throttle_spec;
269 /***************************************************************************/
270 /* Current object/list nesting depth. */
271 /***************************************************************************/
274 /***************************************************************************/
275 /* The checkpoint. */
276 /***************************************************************************/
281 /**************************************************************************//**
282 * Encode the event as a JSON event object according to AT&T's schema.
284 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
285 * @param event Pointer to the ::EVENT_HEADER to encode.
286 *****************************************************************************/
287 void evel_json_encode_header(EVEL_JSON_BUFFER * jbuf,
288 EVENT_HEADER * event);
290 /**************************************************************************//**
291 * Encode the fault in JSON according to AT&T's schema for the fault type.
293 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
294 * @param event Pointer to the ::EVENT_HEADER to encode.
295 *****************************************************************************/
296 void evel_json_encode_fault(EVEL_JSON_BUFFER * jbuf,
297 EVENT_FAULT * event);
299 /**************************************************************************//**
300 * Encode the measurement as a JSON measurement.
302 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
303 * @param event Pointer to the ::EVENT_HEADER to encode.
304 *****************************************************************************/
305 void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
306 EVENT_MEASUREMENT * event);
308 /**************************************************************************//**
309 * Encode the Mobile Flow in JSON according to AT&T's schema for the event
312 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
313 * @param event Pointer to the ::EVENT_HEADER to encode.
314 *****************************************************************************/
315 void evel_json_encode_mobile_flow(EVEL_JSON_BUFFER * jbuf,
316 EVENT_MOBILE_FLOW * event);
318 /**************************************************************************//**
319 * Encode the report as a JSON report.
321 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
322 * @param event Pointer to the ::EVENT_HEADER to encode.
323 *****************************************************************************/
324 void evel_json_encode_report(EVEL_JSON_BUFFER * jbuf,
325 EVENT_REPORT * event);
327 /**************************************************************************//**
328 * Encode the Heartbeat fields in JSON according to AT&T's schema for the
331 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
332 * @param event Pointer to the ::EVENT_HEADER to encode.
333 *****************************************************************************/
334 void evel_json_encode_hrtbt_field(EVEL_JSON_BUFFER * const jbuf,
335 EVENT_HEARTBEAT_FIELD * const event);
337 /**************************************************************************//**
338 * Encode the Signaling in JSON according to AT&T's schema for the event type.
340 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
341 * @param event Pointer to the ::EVENT_HEADER to encode.
342 *****************************************************************************/
343 void evel_json_encode_signaling(EVEL_JSON_BUFFER * const jbuf,
344 EVENT_SIGNALING * const event);
346 /**************************************************************************//**
347 * Encode the state change as a JSON state change.
349 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
350 * @param state_change Pointer to the ::EVENT_STATE_CHANGE to encode.
351 *****************************************************************************/
352 void evel_json_encode_state_change(EVEL_JSON_BUFFER * jbuf,
353 EVENT_STATE_CHANGE * state_change);
355 /**************************************************************************//**
356 * Encode the Syslog in JSON according to AT&T's schema for the event type.
358 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
359 * @param event Pointer to the ::EVENT_HEADER to encode.
360 *****************************************************************************/
361 void evel_json_encode_syslog(EVEL_JSON_BUFFER * jbuf,
362 EVENT_SYSLOG * event);
364 /**************************************************************************//**
365 * Encode the Other in JSON according to AT&T's schema for the event type.
367 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to encode into.
368 * @param event Pointer to the ::EVENT_HEADER to encode.
369 *****************************************************************************/
370 void evel_json_encode_other(EVEL_JSON_BUFFER * jbuf,
371 EVENT_OTHER * event);
373 /**************************************************************************//**
374 * Set the next event_sequence to use.
376 * @param sequence The next sequence number to use.
377 *****************************************************************************/
378 void evel_set_next_event_sequence(const int sequence);
380 /**************************************************************************//**
381 * Handle a JSON response from the listener, contained in a ::MEMORY_CHUNK.
383 * Tokenize the response, and decode any tokens found.
385 * @param chunk The memory chunk containing the response.
386 * @param post The memory chunk in which to place any resulting POST.
387 *****************************************************************************/
388 void evel_handle_event_response(const MEMORY_CHUNK * const chunk,
389 MEMORY_CHUNK * const post);
391 /**************************************************************************//**
392 * Initialize a ::EVEL_JSON_BUFFER.
394 * @param jbuf Pointer to the ::EVEL_JSON_BUFFER to initialise.
395 * @param json Pointer to the underlying working buffer to use.
396 * @param max_size Size of storage available in the JSON buffer.
397 * @param throttle_spec Pointer to throttle specification. Can be NULL.
398 *****************************************************************************/
399 void evel_json_buffer_init(EVEL_JSON_BUFFER * jbuf,
402 EVEL_THROTTLE_SPEC * throttle_spec);
404 /**************************************************************************//**
405 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
407 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
408 * @param key Pointer to the key to encode.
409 * @param option Pointer to holder of the corresponding value to encode.
410 * @return true if the key, value was added, false if it was suppressed.
411 *****************************************************************************/
412 bool evel_enc_kv_opt_string(EVEL_JSON_BUFFER * jbuf,
413 const char * const key,
414 const EVEL_OPTION_STRING * const option);
416 /**************************************************************************//**
417 * Encode a string key and string value to a ::EVEL_JSON_BUFFER.
419 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
420 * @param key Pointer to the key to encode.
421 * @param value Pointer to the corresponding value to encode.
422 *****************************************************************************/
423 void evel_enc_kv_string(EVEL_JSON_BUFFER * jbuf,
424 const char * const key,
425 const char * const value);
427 /**************************************************************************//**
428 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
430 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
431 * @param key Pointer to the key to encode.
432 * @param option Pointer to holder of the corresponding value to encode.
433 * @return true if the key, value was added, false if it was suppressed.
434 *****************************************************************************/
435 bool evel_enc_kv_opt_int(EVEL_JSON_BUFFER * jbuf,
436 const char * const key,
437 const EVEL_OPTION_INT * const option);
439 /**************************************************************************//**
440 * Encode a string key and integer value to a ::EVEL_JSON_BUFFER.
442 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
443 * @param key Pointer to the key to encode.
444 * @param value The corresponding value to encode.
445 *****************************************************************************/
446 void evel_enc_kv_int(EVEL_JSON_BUFFER * jbuf,
447 const char * const key,
450 /**************************************************************************//**
451 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
453 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
454 * @param key Pointer to the key to encode.
455 * @param option Pointer to holder of the corresponding value to encode.
456 * @return true if the key, value was added, false if it was suppressed.
457 *****************************************************************************/
458 bool evel_enc_kv_opt_double(EVEL_JSON_BUFFER * jbuf,
459 const char * const key,
460 const EVEL_OPTION_DOUBLE * const option);
462 /**************************************************************************//**
463 * Encode a string key and double value to a ::EVEL_JSON_BUFFER.
465 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
466 * @param key Pointer to the key to encode.
467 * @param value The corresponding value to encode.
468 *****************************************************************************/
469 void evel_enc_kv_double(EVEL_JSON_BUFFER * jbuf,
470 const char * const key,
473 /**************************************************************************//**
474 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
476 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
477 * @param key Pointer to the key to encode.
478 * @param option Pointer to holder of the corresponding value to encode.
479 * @return true if the key, value was added, false if it was suppressed.
480 *****************************************************************************/
481 bool evel_enc_kv_opt_ull(EVEL_JSON_BUFFER * jbuf,
482 const char * const key,
483 const EVEL_OPTION_ULL * const option);
485 /**************************************************************************//**
486 * Encode a string key and unsigned long long value to a ::EVEL_JSON_BUFFER.
488 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
489 * @param key Pointer to the key to encode.
490 * @param value The corresponding value to encode.
491 *****************************************************************************/
492 void evel_enc_kv_ull(EVEL_JSON_BUFFER * jbuf,
493 const char * const key,
494 const unsigned long long value);
496 /**************************************************************************//**
497 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
499 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
500 * @param key Pointer to the key to encode.
501 * @param option Pointer to holder of the corresponding value to encode.
502 * @return true if the key, value was added, false if it was suppressed.
503 *****************************************************************************/
504 bool evel_enc_kv_opt_time(EVEL_JSON_BUFFER * jbuf,
505 const char * const key,
506 const EVEL_OPTION_TIME * const option);
508 /**************************************************************************//**
509 * Encode a string key and time value to a ::EVEL_JSON_BUFFER.
511 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
512 * @param key Pointer to the key to encode.
513 * @param time Pointer to the time to encode.
514 *****************************************************************************/
515 void evel_enc_kv_time(EVEL_JSON_BUFFER * jbuf,
516 const char * const key,
517 const time_t * time);
519 /**************************************************************************//**
520 * Encode a key and version.
522 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
523 * @param key Pointer to the key to encode.
524 * @param major_version The major version to encode.
525 * @param minor_version The minor version to encode.
526 *****************************************************************************/
527 void evel_enc_version(EVEL_JSON_BUFFER * jbuf,
528 const char * const key,
529 const int major_version,
530 const int minor_version);
532 /**************************************************************************//**
533 * Add the key and opening bracket of an optional named list to a JSON buffer.
535 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
536 * @param key Pointer to the key to encode.
537 * @return true if the list was opened, false if it was suppressed.
538 *****************************************************************************/
539 bool evel_json_open_opt_named_list(EVEL_JSON_BUFFER * jbuf,
540 const char * const key);
542 /**************************************************************************//**
543 * Add the key and opening bracket of a named list to a JSON buffer.
545 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
546 * @param key Pointer to the key to encode.
547 *****************************************************************************/
548 void evel_json_open_named_list(EVEL_JSON_BUFFER * jbuf,
549 const char * const key);
551 /**************************************************************************//**
552 * Add the closing bracket of a list to a JSON buffer.
554 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
555 *****************************************************************************/
556 void evel_json_close_list(EVEL_JSON_BUFFER * jbuf);
558 /**************************************************************************//**
559 * Encode a list item with format and param list to a ::EVEL_JSON_BUFFER.
561 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
562 * @param format Format string in standard printf format.
563 * @param ... Variable parameters for format string.
564 *****************************************************************************/
565 void evel_enc_list_item(EVEL_JSON_BUFFER * jbuf,
566 const char * const format,
569 /**************************************************************************//**
570 * Add the opening bracket of an optional named object to a JSON buffer.
572 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
573 * @param key Pointer to the key to encode.
574 *****************************************************************************/
575 bool evel_json_open_opt_named_object(EVEL_JSON_BUFFER * jbuf,
576 const char * const key);
578 /**************************************************************************//**
579 * Add the opening bracket of an object to a JSON buffer.
581 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
582 * @param key Pointer to the key to encode.
583 * @return true if the object was opened, false if it was suppressed.
584 *****************************************************************************/
585 void evel_json_open_named_object(EVEL_JSON_BUFFER * jbuf,
586 const char * const key);
588 /**************************************************************************//**
589 * Add the opening bracket of an object to a JSON buffer.
591 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
592 *****************************************************************************/
593 void evel_json_open_object(EVEL_JSON_BUFFER * jbuf);
595 /**************************************************************************//**
596 * Add the closing bracket of an object to a JSON buffer.
598 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
599 *****************************************************************************/
600 void evel_json_close_object(EVEL_JSON_BUFFER * jbuf);
602 /**************************************************************************//**
603 * Add a checkpoint - a stake in the ground to which we can rewind.
605 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
606 *****************************************************************************/
607 void evel_json_checkpoint(EVEL_JSON_BUFFER * jbuf);
609 /**************************************************************************//**
610 * Rewind to the latest checkoint.
612 * @param jbuf Pointer to working ::EVEL_JSON_BUFFER.
613 *****************************************************************************/
614 void evel_json_rewind(EVEL_JSON_BUFFER * jbuf);
616 /**************************************************************************//**
617 * Free the underlying resources of an ::EVEL_OPTION_STRING.
619 * @param option Pointer to the ::EVEL_OPTION_STRING.
620 *****************************************************************************/
621 void evel_free_option_string(EVEL_OPTION_STRING * const option);
623 /**************************************************************************//**
624 * Initialize an ::EVEL_OPTION_STRING to a not-set state.
626 * @param option Pointer to the ::EVEL_OPTION_STRING.
627 *****************************************************************************/
628 void evel_init_option_string(EVEL_OPTION_STRING * const option);
630 /**************************************************************************//**
631 * Set the value of an ::EVEL_OPTION_STRING.
633 * @param option Pointer to the ::EVEL_OPTION_STRING.
634 * @param value The value to set.
635 * @param description Description to be used in logging.
636 *****************************************************************************/
637 void evel_set_option_string(EVEL_OPTION_STRING * const option,
638 const char * const value,
639 const char * const description);
641 /**************************************************************************//**
642 * Force the value of an ::EVEL_OPTION_STRING.
644 * @param option Pointer to the ::EVEL_OPTION_STRING.
645 * @param value The value to set.
646 *****************************************************************************/
647 void evel_force_option_string(EVEL_OPTION_STRING * const option,
648 const char * const value);
650 /**************************************************************************//**
651 * Initialize an ::EVEL_OPTION_INT to a not-set state.
653 * @param option Pointer to the ::EVEL_OPTION_INT.
654 *****************************************************************************/
655 void evel_init_option_int(EVEL_OPTION_INT * const option);
657 /**************************************************************************//**
658 * Force the value of an ::EVEL_OPTION_INT.
660 * @param option Pointer to the ::EVEL_OPTION_INT.
661 * @param value The value to set.
662 *****************************************************************************/
663 void evel_force_option_int(EVEL_OPTION_INT * const option,
666 /**************************************************************************//**
667 * Set the value of an ::EVEL_OPTION_INT.
669 * @param option Pointer to the ::EVEL_OPTION_INT.
670 * @param value The value to set.
671 * @param description Description to be used in logging.
672 *****************************************************************************/
673 void evel_set_option_int(EVEL_OPTION_INT * const option,
675 const char * const description);
677 /**************************************************************************//**
678 * Initialize an ::EVEL_OPTION_DOUBLE to a not-set state.
680 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
681 *****************************************************************************/
682 void evel_init_option_double(EVEL_OPTION_DOUBLE * const option);
684 /**************************************************************************//**
685 * Force the value of an ::EVEL_OPTION_DOUBLE.
687 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
688 * @param value The value to set.
689 *****************************************************************************/
690 void evel_force_option_double(EVEL_OPTION_DOUBLE * const option,
693 /**************************************************************************//**
694 * Set the value of an ::EVEL_OPTION_DOUBLE.
696 * @param option Pointer to the ::EVEL_OPTION_DOUBLE.
697 * @param value The value to set.
698 * @param description Description to be used in logging.
699 *****************************************************************************/
700 void evel_set_option_double(EVEL_OPTION_DOUBLE * const option,
702 const char * const description);
704 /**************************************************************************//**
705 * Initialize an ::EVEL_OPTION_ULL to a not-set state.
707 * @param option Pointer to the ::EVEL_OPTION_ULL.
708 *****************************************************************************/
709 void evel_init_option_ull(EVEL_OPTION_ULL * const option);
711 /**************************************************************************//**
712 * Force the value of an ::EVEL_OPTION_ULL.
714 * @param option Pointer to the ::EVEL_OPTION_ULL.
715 * @param value The value to set.
716 *****************************************************************************/
717 void evel_force_option_ull(EVEL_OPTION_ULL * const option,
718 const unsigned long long value);
720 /**************************************************************************//**
721 * Set the value of an ::EVEL_OPTION_ULL.
723 * @param option Pointer to the ::EVEL_OPTION_ULL.
724 * @param value The value to set.
725 * @param description Description to be used in logging.
726 *****************************************************************************/
727 void evel_set_option_ull(EVEL_OPTION_ULL * const option,
728 const unsigned long long value,
729 const char * const description);
731 /**************************************************************************//**
732 * Initialize an ::EVEL_OPTION_TIME to a not-set state.
734 * @param option Pointer to the ::EVEL_OPTION_TIME.
735 *****************************************************************************/
736 void evel_init_option_time(EVEL_OPTION_TIME * const option);
738 /**************************************************************************//**
739 * Force the value of an ::EVEL_OPTION_TIME.
741 * @param option Pointer to the ::EVEL_OPTION_TIME.
742 * @param value The value to set.
743 *****************************************************************************/
744 void evel_force_option_time(EVEL_OPTION_TIME * const option,
747 /**************************************************************************//**
748 * Set the value of an ::EVEL_OPTION_TIME.
750 * @param option Pointer to the ::EVEL_OPTION_TIME.
751 * @param value The value to set.
752 * @param description Description to be used in logging.
753 *****************************************************************************/
754 void evel_set_option_time(EVEL_OPTION_TIME * const option,
756 const char * const description);
758 /**************************************************************************//**
759 * Map an ::EVEL_COUNTER_CRITICALITIES enum value to the equivalent string.
761 * @param criticality The criticality to convert.
762 * @returns The equivalent string.
763 *****************************************************************************/
764 char * evel_criticality(const EVEL_COUNTER_CRITICALITIES criticality);
766 /**************************************************************************//**
767 * Map an ::EVEL_SEVERITIES enum value to the equivalent string.
769 * @param severity The severity to convert.
770 * @returns The equivalent string.
771 *****************************************************************************/
772 char * evel_severity(const EVEL_SEVERITIES severity);
774 /**************************************************************************//**
775 * Map an ::EVEL_ALERT_ACTIONS enum value to the equivalent string.
777 * @param alert_action The alert_action to convert.
778 * @returns The equivalent string.
779 *****************************************************************************/
780 char * evel_alert_action(const EVEL_ALERT_ACTIONS alert_action);
782 /**************************************************************************//**
783 * Map an ::EVEL_ALERT_TYPES enum value to the equivalent string.
785 * @param alert_type The alert_type to convert.
786 * @returns The equivalent string.
787 *****************************************************************************/
788 char * evel_alert_type(const EVEL_ALERT_TYPES alert_type);
790 /**************************************************************************//**
791 * Map an ::EVEL_EVENT_DOMAINS enum value to the equivalent string.
793 * @param domain The domain to convert.
794 * @returns The equivalent string.
795 *****************************************************************************/
796 char * evel_event_domain(const EVEL_EVENT_DOMAINS domain);
798 /**************************************************************************//**
799 * Map an ::EVEL_EVENT_PRIORITIES enum value to the equivalent string.
801 * @param priority The priority to convert.
802 * @returns The equivalent string.
803 *****************************************************************************/
804 char * evel_event_priority(const EVEL_EVENT_PRIORITIES priority);
806 /**************************************************************************//**
807 * Map an ::EVEL_SOURCE_TYPES enum value to the equivalent string.
809 * @param source_type The source type to convert.
810 * @returns The equivalent string.
811 *****************************************************************************/
812 char * evel_source_type(const EVEL_SOURCE_TYPES source_type);
814 /**************************************************************************//**
815 * Map an ::EVEL_VF_STATUSES enum value to the equivalent string.
817 * @param vf_status The vf_status to convert.
818 * @returns The equivalent string.
819 *****************************************************************************/
820 char * evel_vf_status(const EVEL_VF_STATUSES vf_status);
822 /**************************************************************************//**
823 * Convert a ::EVEL_ENTITY_STATE to it's string form for JSON encoding.
825 * @param state The entity state to encode.
827 * @returns the corresponding string
828 *****************************************************************************/
829 char * evel_entity_state(const EVEL_ENTITY_STATE state);
831 /**************************************************************************//**
832 * Convert a ::EVEL_SERVICE_ENDPOINT_DESC to string form for JSON encoding.
834 * @param endpoint_desc endpoint description to encode.
836 * @returns the corresponding string
837 *****************************************************************************/
838 char * evel_service_endpoint_desc(const EVEL_ENTITY_STATE endpoint_desc);
841 /**************************************************************************//**
842 * Initialize an ::EVEL_OPTION_INTHEADER_FIELDS to a not-set state.
844 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
845 *****************************************************************************/
846 void evel_init_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);
847 /**************************************************************************//**
848 * Force the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
850 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
851 * @param value The value to set.
852 *****************************************************************************/
853 void evel_force_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
855 /**************************************************************************//**
856 * Set the value of an ::EVEL_OPTION_INTHEADER_FIELDS.
858 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
859 * @param value The value to set.
860 * @param description Description to be used in logging.
861 *****************************************************************************/
862 void evel_set_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option,
864 const char * const description);
865 /**************************************************************************//**
866 * Free the underlying resources of an ::EVEL_OPTION_INTHEADER_FIELDS.
868 * @param option Pointer to the ::EVEL_OPTION_INTHEADER_FIELDS.
869 *****************************************************************************/
870 void evel_free_option_intheader(EVEL_OPTION_INTHEADER_FIELDS * const option);