UCX  1.18
Unified Communication X
types.h
1 
7 #ifndef UCS_CONFIG_TYPES_H
8 #define UCS_CONFIG_TYPES_H
9 
10 #include <ucs/sys/compiler_def.h>
11 #include <sys/socket.h>
12 
16 typedef enum {
17  UCS_LOG_LEVEL_FATAL, /* Immediate termination */
18  UCS_LOG_LEVEL_ERROR, /* Error is returned to the user */
19  UCS_LOG_LEVEL_WARN, /* Something's wrong, but we continue */
20  UCS_LOG_LEVEL_DIAG, /* Diagnostics, silent adjustments or internal error handling */
21  UCS_LOG_LEVEL_INFO, /* Information */
22  UCS_LOG_LEVEL_DEBUG, /* Low-volume debugging */
23  UCS_LOG_LEVEL_TRACE, /* High-volume debugging */
24  UCS_LOG_LEVEL_TRACE_REQ, /* Every send/receive request */
25  UCS_LOG_LEVEL_TRACE_DATA, /* Data sent/received on the transport */
26  UCS_LOG_LEVEL_TRACE_ASYNC, /* Asynchronous progress engine */
27  UCS_LOG_LEVEL_TRACE_FUNC, /* Function calls */
28  UCS_LOG_LEVEL_TRACE_POLL, /* Polling functions */
29  UCS_LOG_LEVEL_LAST,
30  UCS_LOG_LEVEL_PRINT /* Temporary output */
31 } ucs_log_level_t;
32 
33 
37 typedef enum {
38  UCS_ASYNC_MODE_SIGNAL,
39  UCS_ASYNC_MODE_THREAD, /* Deprecated, keep for backward compatibility */
40  UCS_ASYNC_MODE_THREAD_SPINLOCK = UCS_ASYNC_MODE_THREAD,
41  UCS_ASYNC_MODE_THREAD_MUTEX,
42  UCS_ASYNC_MODE_POLL, /* TODO keep only in debug version */
43  UCS_ASYNC_MODE_LAST
44 } ucs_async_mode_t;
45 
46 
47 extern const char *ucs_async_mode_names[];
48 
49 
53 typedef enum ucs_ternary_auto_value {
54  UCS_NO = 0,
55  UCS_YES = 1,
56  UCS_TRY = 2,
57  UCS_AUTO = 3,
58  UCS_TERNARY_LAST
59 } ucs_ternary_auto_value_t;
60 
61 
65 typedef enum ucs_on_off_auto_value {
66  UCS_CONFIG_OFF = 0,
67  UCS_CONFIG_ON = 1,
68  UCS_CONFIG_AUTO = 2,
69  UCS_CONFIG_ON_OFF_LAST
70 } ucs_on_off_auto_value_t;
71 
72 
76 typedef enum {
77  UCS_HANDLE_ERROR_BACKTRACE, /* Print backtrace */
78  UCS_HANDLE_ERROR_FREEZE, /* Freeze and wait for a debugger */
79  UCS_HANDLE_ERROR_DEBUG, /* Attach debugger */
80  UCS_HANDLE_ERROR_NONE, /* Do not take any action */
81  UCS_HANDLE_ERROR_LAST
82 } ucs_handle_error_t;
83 
84 
88 typedef enum {
89  UCS_CONFIG_PRINT_CONFIG = UCS_BIT(0),
90  UCS_CONFIG_PRINT_HEADER = UCS_BIT(1),
91  UCS_CONFIG_PRINT_DOC = UCS_BIT(2),
92  UCS_CONFIG_PRINT_HIDDEN = UCS_BIT(3),
93  UCS_CONFIG_PRINT_COMMENT_DEFAULT = UCS_BIT(4)
94 } ucs_config_print_flags_t;
95 
96 
97 static inline int
98 ucs_ternary_auto_value_is_yes_or_try(ucs_ternary_auto_value_t value)
99 {
100  return (value == UCS_YES) || (value == UCS_TRY);
101 }
102 
103 
104 static inline int
105 ucs_ternary_auto_value_is_yes_or_no(ucs_ternary_auto_value_t value)
106 {
107  return (value == UCS_YES) || (value == UCS_NO);
108 }
109 
110 
115 #define UCS_CONFIG_ARRAY_FIELD(_type, _array_name) \
116  struct { \
117  _type *_array_name; \
118  unsigned count; \
119  unsigned pad; \
120  }
121 
122 
123 /* Specific structure for an array of strings */
124 #define UCS_CONFIG_STRING_ARRAY_FIELD(_array_name) \
125  UCS_CONFIG_ARRAY_FIELD(char*, _array_name)
126 
127 
128 typedef UCS_CONFIG_STRING_ARRAY_FIELD(names) ucs_config_names_array_t;
129 
130 
134 typedef enum {
135  UCS_CONFIG_ALLOW_LIST_ALLOW_ALL, /* Allow all possible options */
136  UCS_CONFIG_ALLOW_LIST_ALLOW, /* Allow only the specified options */
137  UCS_CONFIG_ALLOW_LIST_NEGATE /* Negate (forbid) the specified options */
138 } ucs_config_allow_list_mode_t;
139 
140 
141 typedef struct {
142  ucs_config_names_array_t array;
143  ucs_config_allow_list_mode_t mode;
145 
146 
151 typedef struct ucs_sock_addr {
152  const struct sockaddr *addr;
153  socklen_t addrlen;
155 
156 
160 typedef struct ucs_log_component_config {
161  ucs_log_level_t log_level;
162  char name[16];
163  const char *file_filter; /* glob pattern of source files */
165 
166 #endif /* TYPES_H_ */
ucs_config_allow_list_mode_t mode
Definition: types.h:143
struct ucs_sock_addr ucs_sock_addr_t
const struct sockaddr * addr
Definition: types.h:152
ucs_config_names_array_t array
Definition: types.h:142
socklen_t addrlen
Definition: types.h:153
ucs_log_level_t log_level
Definition: types.h:161
char name[16]
Definition: types.h:162
Definition: types.h:160
Definition: types.h:151
Definition: types.h:141
const char * file_filter
Definition: types.h:163