UCX  1.14
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 
101 #define UCS_CONFIG_ARRAY_FIELD(_type, _array_name) \
102  struct { \
103  _type *_array_name; \
104  unsigned count; \
105  unsigned pad; \
106  }
107 
108 
109 /* Specific structure for an array of strings */
110 #define UCS_CONFIG_STRING_ARRAY_FIELD(_array_name) \
111  UCS_CONFIG_ARRAY_FIELD(char*, _array_name)
112 
113 
114 typedef UCS_CONFIG_STRING_ARRAY_FIELD(names) ucs_config_names_array_t;
115 
116 
120 typedef enum {
121  UCS_CONFIG_ALLOW_LIST_ALLOW_ALL, /* Allow all possible options */
122  UCS_CONFIG_ALLOW_LIST_ALLOW, /* Allow only the specified options */
123  UCS_CONFIG_ALLOW_LIST_NEGATE /* Negate (forbid) the specified options */
124 } ucs_config_allow_list_mode_t;
125 
126 
127 typedef struct {
128  ucs_config_names_array_t array;
129  ucs_config_allow_list_mode_t mode;
131 
132 
137 typedef struct ucs_sock_addr {
138  const struct sockaddr *addr;
139  socklen_t addrlen;
141 
142 
146 typedef struct ucs_log_component_config {
147  ucs_log_level_t log_level;
148  char name[16];
149  const char *file_filter; /* glob pattern of source files */
151 
152 #endif /* TYPES_H_ */
ucs_config_allow_list_mode_t mode
Definition: types.h:129
struct ucs_sock_addr ucs_sock_addr_t
const struct sockaddr * addr
Definition: types.h:138
ucs_config_names_array_t array
Definition: types.h:128
socklen_t addrlen
Definition: types.h:139
ucs_log_level_t log_level
Definition: types.h:147
Definition: types.h:146
Definition: types.h:137
Definition: types.h:127
const char * file_filter
Definition: types.h:149