|
|
|
@ -14,6 +14,7 @@ using namespace std;
|
|
|
|
char dnsip[NET_HOSTLEN];
|
|
|
|
char dnsip[NET_HOSTLEN];
|
|
|
|
int UDPTCPNetwork_init = 0;
|
|
|
|
int UDPTCPNetwork_init = 0;
|
|
|
|
std::string debug_file = "";
|
|
|
|
std::string debug_file = "";
|
|
|
|
|
|
|
|
int debug_enabeld = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// convert host and port to sockaddr_in6
|
|
|
|
// convert host and port to sockaddr_in6
|
|
|
|
@ -96,7 +97,7 @@ std::string string_to_lower(std::string s) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void debug_set_logfile(std::string fname) {
|
|
|
|
void UDPTCPNetwork_debug_set_logfile(std::string fname) {
|
|
|
|
debug_file = fname;
|
|
|
|
debug_file = fname;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -104,7 +105,7 @@ void debug_set_logfile(std::string fname) {
|
|
|
|
#define LEN_TEXT 256
|
|
|
|
#define LEN_TEXT 256
|
|
|
|
#define DEBUG_TEXT1LEN 4096
|
|
|
|
#define DEBUG_TEXT1LEN 4096
|
|
|
|
#define DEBUG_TEXT2LEN (DEBUG_TEXT1LEN+LEN_TEXT)
|
|
|
|
#define DEBUG_TEXT2LEN (DEBUG_TEXT1LEN+LEN_TEXT)
|
|
|
|
void _debug (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
void UDPTCPNetwork_debug (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
va_list args;
|
|
|
|
va_list args;
|
|
|
|
char texttime[LEN_TEXT];
|
|
|
|
char texttime[LEN_TEXT];
|
|
|
|
char text1[DEBUG_TEXT1LEN];
|
|
|
|
char text1[DEBUG_TEXT1LEN];
|
|
|
|
@ -115,6 +116,8 @@ void _debug (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
struct tm tmp;
|
|
|
|
struct tm tmp;
|
|
|
|
struct tm *tmptr = NULL;
|
|
|
|
struct tm *tmptr = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (debug_enabeld == 0) return;
|
|
|
|
|
|
|
|
|
|
|
|
va_start (args, fmt);
|
|
|
|
va_start (args, fmt);
|
|
|
|
vsnprintf (text1, (DEBUG_TEXT1LEN-1), fmt, args);
|
|
|
|
vsnprintf (text1, (DEBUG_TEXT1LEN-1), fmt, args);
|
|
|
|
va_end (args);
|
|
|
|
va_end (args);
|
|
|
|
@ -143,11 +146,16 @@ void _debug (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _errorexit (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
void UDPTCPNetwork_enable_debug (int enable) {
|
|
|
|
|
|
|
|
debug_enabeld = enable;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UDPTCPNetwork_errorexit (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
va_list args;
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
|
|
|
|
va_start (args, fmt);
|
|
|
|
va_start (args, fmt);
|
|
|
|
_debug (srcfile, srcline, srcfunc, fmt, args);
|
|
|
|
UDPTCPNetwork_debug (srcfile, srcline, srcfunc, fmt, args);
|
|
|
|
va_end (args);
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
|
|
|
|
exit (1);
|
|
|
|
exit (1);
|
|
|
|
|