-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.h
38 lines (30 loc) · 978 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef LKLFTPD_UTILS_H__
#define LKLFTPD_UTILS_H__
#include <apr.h>
#define STR_ERROR_MAX_LEN 300
enum err_levels
{
LFD_ERROR,
LFD_WARN,
LFD_DBG,
};
enum err_source_t
{
ERR_SOURCE_APR,
ERR_SOURCE_LINUX,
};
void lfd_log(enum err_levels lvl, char * fmt, ...);
void lfd_log_err_impl(enum err_source_t errsrc, const char * file, int line, const char * func, int rc, char * fmt, ...);
#define lfd_log_err lfd_log_apr_err
#define lfd_log_apr_err(rc, fmt...) lfd_log_err_impl(ERR_SOURCE_APR, __FILE__, __LINE__, __FUNCTION__, rc, fmt)
#define lfd_log_linux_err(rc, fmt...) lfd_log_err_impl(ERR_SOURCE_LINUX, __FILE__, __LINE__, __FUNCTION__, rc, fmt)
void bug(const char* p_text);
struct ascii_to_bin_ret
{
apr_size_t stored;
int last_was_cr;
char* p_buf;
};
struct ascii_to_bin_ret lfd_ascii_ascii_to_bin(char* p_in, apr_size_t in_len, int prev_cr);
apr_size_t lfd_ascii_bin_to_ascii(const char* p_in, char* p_out, apr_size_t in_len);
#endif//LKLFTPD_UTILS_H__