LibDap
This library contains the basic modules that are used in the products of the family DAP
|
#include <unistd.h>
#include <pthread.h>
#include <syslog.h>
#include <time.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "dap_common.h"
Macros | |
#define | LAST_ERROR_MAX 255 |
#define | LOG_TAG "dap_common" |
#define | INT_DIGITS 19 /* enough for 64 bit integer */ |
Functions | |
void | set_log_level (enum log_level ll) |
set_log_level Sets the logging level More... | |
void | dap_set_log_tag_width (size_t width) |
dap_set_log_tag_width Sets the length of the label More... | |
int | dap_common_init (const char *a_log_file) |
dap_common_init initialise More... | |
void | dap_common_deinit () |
dap_common_deinit Deinitialise More... | |
void | _log_it (const char *log_tag, enum log_level ll, const char *format,...) |
_log_it Writes information to the log More... | |
void | _vlog_it (const char *log_tag, enum log_level ll, const char *format, va_list ap) |
const char * | log_error () |
log_error Error log More... | |
char * | itoa (int i) |
itoa The function converts an integer num to a string equivalent and places the result in a string More... | |
int | time_to_rfc822 (char *out, size_t out_size_max, time_t t) |
time_to_rfc822 Convert time_t to string with RFC822 formatted date and time More... | |
int | get_select_breaker () |
int | send_select_break () |
char * | exec_with_ret (const char *a_cmd) |
exec_with_ret Executes a command with result return More... | |
char * | exec_with_ret_multistring (const char *a_cmd) |
exec_with_ret_multistring performs a command with a result return in the form of a multistring More... | |
void | dap_random_string_fill (char *str, size_t length) |
random_string_fill Filling a string with random characters More... | |
char * | dap_random_string_create_alloc (size_t a_length) |
random_string_create Generates a random string More... | |
Variables | |
static char | last_error [LAST_ERROR_MAX] = {0} |
static enum log_level | log_level = L_DEBUG |
static FILE * | s_log_file = NULL |
static char | log_tag_fmt_str [10] |
static int | breaker_set [2] = { -1, -1 } |
static int | initialized = 0 |
static struct timespec | break_latency = {0, 1 * 1000 * 1000 } |
static const char | l_possible_chars [] ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" |
#define INT_DIGITS 19 /* enough for 64 bit integer */ |
#define LAST_ERROR_MAX 255 |
#define LOG_TAG "dap_common" |
void _log_it | ( | const char * | log_tag, |
enum log_level | ll, | ||
const char * | format, | ||
... | |||
) |
_log_it Writes information to the log
[in] | log_tag | Tag |
[in] | ll | Log level |
[in] | format |
void _vlog_it | ( | const char * | log_tag, |
enum log_level | ll, | ||
const char * | format, | ||
va_list | ap | ||
) |
void dap_common_deinit | ( | void | ) |
dap_common_deinit Deinitialise
int dap_common_init | ( | const char * | a_log_file | ) |
dap_common_init initialise
[in] | a_log_file |
char* dap_random_string_create_alloc | ( | size_t | a_length | ) |
random_string_create Generates a random string
[in] | a_length | lenght |
void dap_random_string_fill | ( | char * | str, |
size_t | length | ||
) |
random_string_fill Filling a string with random characters
[out] | str | A pointer to a char array |
[in] | length | The length of the array or string |
void dap_set_log_tag_width | ( | size_t | width | ) |
dap_set_log_tag_width Sets the length of the label
[in] | width | Length not more than 99 |
char* exec_with_ret | ( | const char * | a_cmd | ) |
exec_with_ret Executes a command with result return
[in] | a_cmd | Command |
char* exec_with_ret_multistring | ( | const char * | a_cmd | ) |
exec_with_ret_multistring performs a command with a result return in the form of a multistring
[in] | a_cmd | Coomand |
int get_select_breaker | ( | void | ) |
char* itoa | ( | int | i | ) |
itoa The function converts an integer num to a string equivalent and places the result in a string
[in] | i | number |
const char* log_error | ( | void | ) |
log_error Error log
int send_select_break | ( | void | ) |
void set_log_level | ( | enum log_level | ll | ) |
set_log_level Sets the logging level
[in] | ll | logging level |
int time_to_rfc822 | ( | char * | out, |
size_t | out_size_max, | ||
time_t | t | ||
) |
time_to_rfc822 Convert time_t to string with RFC822 formatted date and time
[out] | out | Output buffer |
[out] | out_size_mac | Maximum size of output buffer |
[in] | t | UNIX time |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |