GCC Code Coverage Report


Directory: ../replacer/
File: storage.h
Date: 2025-10-28 11:47:20
Coverage Exec Excl Total
Lines: 100.0% 6 0 6
Functions: 100.0% 1 0 1
Branches: -% 0 0 0

Line Branch Exec Source
1 /*
2 * storage.h
3 *
4 * Created on: Dec 25, 2017
5 * Author: alexey
6 */
7
8 #ifndef STORAGE_H_
9 #define STORAGE_H_
10
11 #include <sys/types.h>
12
13 #ifdef HAVE_CONFIG_H
14 #include "config.h"
15 #endif
16
17 #include "sendmessage.pb-c.h"
18 #include "statsmessage.pb-c.h"
19 #define MAX_SAVED_PARAMS 50
20 typedef struct max_val_arr_ {
21 char *max_values_array_st[MAX_SAVED_PARAMS];
22 int elem_numb;
23 } max_val_arr;
24
25 typedef struct __attribute__((__packed__)) send_params_buffer_ {
26 uint16_t size;
27 char buffer;
28 } send_params_buffer;
29
30 #define MAX_FAILURE_SEND_SIZE 8192
31 #define MAX_FAILURE_AUX_BUF_SIZE 6
32 #define MAX_FAILURE_BUF_SIZE 16
33 #define MAX_FAILURE_BUF_LEN 128
34 #define MAX_FAILURE_FILENAME_LEN 256
35
36 typedef struct _i360_log_data {
37 const char *ip;
38 chain_result *chains;
39 int version;
40 const char *script_schema;
41 const char *script_name;
42 const char *queue;
43 const char *include_stack;
44 const char *application_id;
45 const char *application_instance_id;
46 void *server;
47 const char *last_funcname;
48 const char *hash;
49 int qhash_version;
50 const char *qhash;
51 const char *qhashfn;
52 const char *qhashlast;
53 int qhashlen;
54 unsigned long long running_delta;
55 } i360_log_data_t;
56
57 typedef struct _i360_monitoring_data {
58 uint64_t module_duration;
59 uint64_t total_connections;
60 uint64_t total_packets_sent;
61 uint64_t total_requests;
62 } i360_monitoring_data_t;
63
64 typedef struct _i360_yaml_config {
65 int blamer;
66 int override;
67 int jit;
68 int log_whitelisted;
69 } i360_yaml_config_t;
70
71 static inline
72 11 void i360_yaml_config_init(i360_yaml_config_t *config) {
73 11 config->blamer = -1;
74 11 config->override = -1;
75 11 config->jit = -1;
76 11 config->log_whitelisted = -1;
77 11 }
78
79 #define SELECT_VALUE(c1, c2) ((c1) < 0 ? (c2) : (c1))
80
81 static inline
82 void i360_yaml_config_merge(i360_yaml_config_t *config, i360_yaml_config_t *merged) {
83 config->blamer = SELECT_VALUE(config->blamer, merged->blamer);
84 config->override = SELECT_VALUE(config->override, merged->override);
85 config->jit = SELECT_VALUE(config->jit, merged->jit);
86 config->log_whitelisted = SELECT_VALUE(config->log_whitelisted, merged->log_whitelisted);
87 }
88
89 ssize_t i360_write_connect(int *fd, const void *buf, size_t count, char *s_name, int buf_sz, void *mx, int timeout);
90 int i360_connect_to_server(char *s_name, int buf_sz, int timeout);
91 time_t i360_get_tmstmp();
92 int i360_isclosed(int sock);
93 int i360_init_proto_data_failure(const i360_log_data_t *data, char *aux_env[], size_t aux_env_len, char *buf);
94 char *i360_init_proto_data(const i360_log_data_t *data, int *length);
95 char *i360_init_proto_data_stats(int *length, const char *script_name, const char *uri, const char *method, const char *app_id, const char *application_instance_id);
96 char *i360_init_proto_data_mon(const i360_monitoring_data_t *mon_data, int *length);
97 uint16_t i360_get_little_e_size(int size);
98 uint16_t i360_get_big_e_size(int size);
99 int i360_parse_yaml_conf(const char *filename, int location, i360_yaml_config_t *config);
100 void i360_set_old_socket_name(char *old_sock);
101 void i360_set_sign(long id);
102 void i360_set_hdb_version(uint64_t ver);
103
104 #endif /* STORAGE_H_ */
105