|
|
@ -371,6 +371,8 @@ static int my_thr_id = 0; |
|
|
|
static int bye = 0; |
|
|
|
static int bye = 0; |
|
|
|
static bool ping = true; |
|
|
|
static bool ping = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static time_t when = 0; // when the request occurred
|
|
|
|
|
|
|
|
|
|
|
|
struct IP4ACCESS { |
|
|
|
struct IP4ACCESS { |
|
|
|
in_addr_t ip; |
|
|
|
in_addr_t ip; |
|
|
|
in_addr_t mask; |
|
|
|
in_addr_t mask; |
|
|
@ -411,9 +413,9 @@ static char *message(int messageid, int paramid, char *param2, bool isjson) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isjson) |
|
|
|
if (isjson) |
|
|
|
sprintf(msg_buffer, JSON_START JSON_STATUS "{\"" _STATUS "\":\"%c\",\"Code\":%d,\"Msg\":\"", severity, messageid); |
|
|
|
sprintf(msg_buffer, JSON_START JSON_STATUS "{\"" _STATUS "\":\"%c\",\"When\":%lu,\"Code\":%d,\"Msg\":\"", severity, (unsigned long)when, messageid); |
|
|
|
else |
|
|
|
else |
|
|
|
sprintf(msg_buffer, _STATUS "=%c,Code=%d,Msg=", severity, messageid); |
|
|
|
sprintf(msg_buffer, _STATUS "=%c,When=%lu,Code=%d,Msg=", severity, (unsigned long)when, messageid); |
|
|
|
|
|
|
|
|
|
|
|
ptr = msg_buffer + strlen(msg_buffer); |
|
|
|
ptr = msg_buffer + strlen(msg_buffer); |
|
|
|
|
|
|
|
|
|
|
@ -474,11 +476,11 @@ static char *message(int messageid, int paramid, char *param2, bool isjson) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isjson) |
|
|
|
if (isjson) |
|
|
|
sprintf(msg_buffer, JSON_START JSON_STATUS "{\"" _STATUS "\":\"F\",\"Code\":-1,\"Msg\":\"%d\",\"Description\":\"%s\"}" JSON_CLOSE, |
|
|
|
sprintf(msg_buffer, JSON_START JSON_STATUS "{\"" _STATUS "\":\"F\",\"When\":%lu,\"Code\":-1,\"Msg\":\"%d\",\"Description\":\"%s\"}" JSON_CLOSE, |
|
|
|
messageid, opt_api_description); |
|
|
|
(unsigned long)when, messageid, opt_api_description); |
|
|
|
else |
|
|
|
else |
|
|
|
sprintf(msg_buffer, _STATUS "=F,Code=-1,Msg=%d,Description=%s%c", |
|
|
|
sprintf(msg_buffer, _STATUS "=F,When=%lu,Code=-1,Msg=%d,Description=%s%c", |
|
|
|
messageid, opt_api_description, SEPARATOR); |
|
|
|
(unsigned long)when, messageid, opt_api_description, SEPARATOR); |
|
|
|
|
|
|
|
|
|
|
|
return msg_buffer; |
|
|
|
return msg_buffer; |
|
|
|
} |
|
|
|
} |
|
|
@ -1668,6 +1670,9 @@ void api(int api_thr_id) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!SOCKETFAIL(n)) { |
|
|
|
if (!SOCKETFAIL(n)) { |
|
|
|
|
|
|
|
// the time of the request in now
|
|
|
|
|
|
|
|
when = time(NULL); |
|
|
|
|
|
|
|
|
|
|
|
did = false; |
|
|
|
did = false; |
|
|
|
|
|
|
|
|
|
|
|
if (*buf != ISJSON) { |
|
|
|
if (*buf != ISJSON) { |
|
|
|