syslog-ng source
loggen_helper.h File Reference
#include "compat/compat.h"
#include "compat/glib.h"
#include <stddef.h>
#include <stdio.h>
#include <sys/un.h>
#include <netdb.h>
#include <openssl/ssl.h>
#include <libgen.h>
Include dependency graph for loggen_helper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX_MESSAGE_LENGTH   8192
 
#define USEC_PER_SEC   1000000
 
#define CONNECTION_TIMEOUT_SEC   5
 
#define ERROR(format, ...)
 
#define DEBUG(format, ...)
 

Functions

int get_debug_level (void)
 
void set_debug_level (int new_debug)
 
unsigned long time_val_diff_in_usec (struct timeval *t1, struct timeval *t2)
 
double time_val_diff_in_sec (struct timeval *t1, struct timeval *t2)
 
void time_val_diff_in_timeval (struct timeval *res, const struct timeval *t1, const struct timeval *t2)
 
size_t get_now_timestamp (char *stamp, gsize stamp_size)
 
size_t get_now_timestamp_bsd (char *stamp, gsize stamp_size)
 
void format_timezone_offset_with_colon (char *timestamp, int timestamp_size, struct tm *tm)
 
int connect_ip_socket (int sock_type, const char *target, const char *port, int use_ipv6)
 
int connect_unix_domain_socket (int sock_type, const char *path)
 
SSL * open_ssl_connection (int sock_fd)
 
void close_ssl_connection (SSL *ssl)
 
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)
 

Macro Definition Documentation

◆ CONNECTION_TIMEOUT_SEC

#define CONNECTION_TIMEOUT_SEC   5

◆ DEBUG

#define DEBUG (   format,
  ... 
)
Value:
do {\
if (!get_debug_level()) \
break; \
gchar *base = g_path_get_basename(__FILE__);\
fprintf(stdout, "debug [%s:%s:%d] ", base, __func__, __LINE__); \
fprintf(stdout, format, ##__VA_ARGS__);\
g_free(base);\
} while(0)
int get_debug_level(void)
Definition: loggen_helper.c:47

◆ ERROR

#define ERROR (   format,
  ... 
)
Value:
do {\
gchar *base = g_path_get_basename(__FILE__);\
fprintf(stderr, "error [%s:%s:%d] ", base, __func__, __LINE__);\
fprintf(stderr, format, ##__VA_ARGS__);\
g_free(base);\
} while (0)

◆ MAX_MESSAGE_LENGTH

#define MAX_MESSAGE_LENGTH   8192

◆ USEC_PER_SEC

#define USEC_PER_SEC   1000000

Function Documentation

◆ close_ssl_connection()

void close_ssl_connection ( SSL *  ssl)

◆ connect_ip_socket()

int connect_ip_socket ( int  sock_type,
const char *  target,
const char *  port,
int  use_ipv6 
)

◆ connect_unix_domain_socket()

int connect_unix_domain_socket ( int  sock_type,
const char *  path 
)

◆ format_timezone_offset_with_colon()

void format_timezone_offset_with_colon ( char *  timestamp,
int  timestamp_size,
struct tm *  tm 
)

◆ generate_proxy_header()

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 
)

◆ get_debug_level()

int get_debug_level ( void  )

◆ get_now_timestamp()

size_t get_now_timestamp ( char *  stamp,
gsize  stamp_size 
)

◆ get_now_timestamp_bsd()

size_t get_now_timestamp_bsd ( char *  stamp,
gsize  stamp_size 
)

◆ open_ssl_connection()

SSL* open_ssl_connection ( int  sock_fd)

◆ set_debug_level()

void set_debug_level ( int  new_debug)

◆ time_val_diff_in_sec()

double time_val_diff_in_sec ( struct timeval *  t1,
struct timeval *  t2 
)

◆ time_val_diff_in_timeval()

void time_val_diff_in_timeval ( struct timeval *  res,
const struct timeval *  t1,
const struct timeval *  t2 
)

◆ time_val_diff_in_usec()

unsigned long time_val_diff_in_usec ( struct timeval *  t1,
struct timeval *  t2 
)