24 #ifndef LOGGEN_HELPER_H_INCLUDED
25 #define LOGGEN_HELPER_H_INCLUDED
35 #include <openssl/ssl.h>
39 #define MAX_MESSAGE_LENGTH 8192
40 #define USEC_PER_SEC 1000000
41 #define CONNECTION_TIMEOUT_SEC 5
51 int connect_ip_socket(
int sock_type,
const char *target,
const char *port,
int use_ipv6);
56 const char *proxy_dst_ip,
const char *proxy_src_port,
const char *proxy_dst_port);
58 #define ERROR(format,...) do {\
59 gchar *base = g_path_get_basename(__FILE__);\
60 fprintf(stderr, "error [%s:%s:%d] ", base, __func__, __LINE__);\
61 fprintf(stderr, format, ##__VA_ARGS__);\
66 #define DEBUG(format,...) do {\
67 if (!get_debug_level()) \
69 gchar *base = g_path_get_basename(__FILE__);\
70 fprintf(stdout, "debug [%s:%s:%d] ", base, __func__, __LINE__); \
71 fprintf(stdout, format, ##__VA_ARGS__);\
unsigned long time_val_diff_in_usec(struct timeval *t1, struct timeval *t2)
Definition: loggen_helper.c:201
size_t get_now_timestamp_bsd(char *stamp, gsize stamp_size)
Definition: loggen_helper.c:238
int generate_proxy_header(char *buffer, int buffer_size, int thread_id, int proxy_version, const char *proxy_src_ip, const char *proxy_dst_ip, const char *proxy_src_port, const char *proxy_dst_port)
Definition: loggen_helper.c:435
void format_timezone_offset_with_colon(char *timestamp, int timestamp_size, struct tm *tm)
Definition: loggen_helper.c:249
void set_debug_level(int new_debug)
Definition: loggen_helper.c:53
size_t get_now_timestamp(char *stamp, gsize stamp_size)
Definition: loggen_helper.c:227
int get_debug_level(void)
Definition: loggen_helper.c:47
SSL * open_ssl_connection(int sock_fd)
Definition: loggen_helper.c:261
void close_ssl_connection(SSL *ssl)
Definition: loggen_helper.c:292
double time_val_diff_in_sec(struct timeval *t1, struct timeval *t2)
Definition: loggen_helper.c:219
int connect_unix_domain_socket(int sock_type, const char *path)
Definition: loggen_helper.c:170
void time_val_diff_in_timeval(struct timeval *res, const struct timeval *t1, const struct timeval *t2)
Definition: loggen_helper.c:207
int connect_ip_socket(int sock_type, const char *target, const char *port, int use_ipv6)
Definition: loggen_helper.c:117
GString * buffer
Definition: test_smart_multi_line.c:69