mirror of https://github.com/OpenVPN/openvpn-gui
fix log() confusion
By some reasons Release build ignores _INC_MATH and includes math.h, which conflicts with our own log definition. Rename it to log_. While on it, also rename other enum names for consistency. Signed-off-by: Lev Stipakov <lev@openvpn.net>pull/423/head
parent
a68341f021
commit
af72adf2ee
22
main.c
22
main.c
|
@ -175,17 +175,17 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance,
|
||||||
|
|
||||||
/* Initialize handlers for manangement interface notifications */
|
/* Initialize handlers for manangement interface notifications */
|
||||||
mgmt_rtmsg_handler handler[] = {
|
mgmt_rtmsg_handler handler[] = {
|
||||||
{ ready, OnReady },
|
{ ready_, OnReady },
|
||||||
{ hold, OnHold },
|
{ hold_, OnHold },
|
||||||
{ log, OnLogLine },
|
{ log_, OnLogLine },
|
||||||
{ state, OnStateChange },
|
{ state_, OnStateChange },
|
||||||
{ password, OnPassword },
|
{ password_, OnPassword },
|
||||||
{ proxy, OnProxy },
|
{ proxy_, OnProxy },
|
||||||
{ stop, OnStop },
|
{ stop_, OnStop },
|
||||||
{ needok, OnNeedOk },
|
{ needok_, OnNeedOk },
|
||||||
{ needstr, OnNeedStr },
|
{ needstr_, OnNeedStr },
|
||||||
{ echo, OnEcho },
|
{ echo_, OnEcho },
|
||||||
{ bytecount,OnByteCount },
|
{ bytecount_,OnByteCount },
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
InitManagement(handler);
|
InitManagement(handler);
|
||||||
|
|
48
manage.c
48
manage.c
|
@ -212,7 +212,7 @@ OnManagement(SOCKET sk, LPARAM lParam)
|
||||||
if (c->state != disconnected)
|
if (c->state != disconnected)
|
||||||
c->state = timedout;
|
c->state = timedout;
|
||||||
CloseManagement (c);
|
CloseManagement (c);
|
||||||
rtmsg_handler[stop](c, "");
|
rtmsg_handler[stop_](c, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -282,55 +282,55 @@ OnManagement(SOCKET sk, LPARAM lParam)
|
||||||
pos = line + 1;
|
pos = line + 1;
|
||||||
if (strncmp(pos, "LOG:", 4) == 0)
|
if (strncmp(pos, "LOG:", 4) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[log])
|
if (rtmsg_handler[log_])
|
||||||
rtmsg_handler[log](c, pos + 4);
|
rtmsg_handler[log_](c, pos + 4);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "STATE:", 6) == 0)
|
else if (strncmp(pos, "STATE:", 6) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[state])
|
if (rtmsg_handler[state_])
|
||||||
rtmsg_handler[state](c, pos + 6);
|
rtmsg_handler[state_](c, pos + 6);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "HOLD:", 5) == 0)
|
else if (strncmp(pos, "HOLD:", 5) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[hold])
|
if (rtmsg_handler[hold_])
|
||||||
rtmsg_handler[hold](c, pos + 5);
|
rtmsg_handler[hold_](c, pos + 5);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "PASSWORD:", 9) == 0)
|
else if (strncmp(pos, "PASSWORD:", 9) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[password])
|
if (rtmsg_handler[password_])
|
||||||
rtmsg_handler[password](c, pos + 9);
|
rtmsg_handler[password_](c, pos + 9);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "PROXY:", 6) == 0)
|
else if (strncmp(pos, "PROXY:", 6) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[proxy])
|
if (rtmsg_handler[proxy_])
|
||||||
rtmsg_handler[proxy](c, pos + 6);
|
rtmsg_handler[proxy_](c, pos + 6);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "INFO:", 5) == 0)
|
else if (strncmp(pos, "INFO:", 5) == 0)
|
||||||
{
|
{
|
||||||
/* delay until management interface accepts input */
|
/* delay until management interface accepts input */
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
if (rtmsg_handler[ready])
|
if (rtmsg_handler[ready_])
|
||||||
rtmsg_handler[ready](c, pos + 5);
|
rtmsg_handler[ready_](c, pos + 5);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "NEED-OK:", 8) == 0)
|
else if (strncmp(pos, "NEED-OK:", 8) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[needok])
|
if (rtmsg_handler[needok_])
|
||||||
rtmsg_handler[needok](c, pos + 8);
|
rtmsg_handler[needok_](c, pos + 8);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "NEED-STR:", 9) == 0)
|
else if (strncmp(pos, "NEED-STR:", 9) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[needstr])
|
if (rtmsg_handler[needstr_])
|
||||||
rtmsg_handler[needstr](c, pos + 9);
|
rtmsg_handler[needstr_](c, pos + 9);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "ECHO:", 5) == 0)
|
else if (strncmp(pos, "ECHO:", 5) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[echo])
|
if (rtmsg_handler[echo_])
|
||||||
rtmsg_handler[echo](c, pos + 5);
|
rtmsg_handler[echo_](c, pos + 5);
|
||||||
}
|
}
|
||||||
else if (strncmp(pos, "BYTECOUNT:", 10) == 0)
|
else if (strncmp(pos, "BYTECOUNT:", 10) == 0)
|
||||||
{
|
{
|
||||||
if (rtmsg_handler[bytecount])
|
if (rtmsg_handler[bytecount_])
|
||||||
rtmsg_handler[bytecount](c, pos + 10);
|
rtmsg_handler[bytecount_](c, pos + 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c->manage.cmd_queue)
|
else if (c->manage.cmd_queue)
|
||||||
|
@ -349,7 +349,7 @@ OnManagement(SOCKET sk, LPARAM lParam)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
_snprintf_0(buf, "%lld,N,Previous command sent to management failed: %s",
|
_snprintf_0(buf, "%lld,N,Previous command sent to management failed: %s",
|
||||||
(long long)time(NULL), line)
|
(long long)time(NULL), line)
|
||||||
rtmsg_handler[log](c, buf);
|
rtmsg_handler[log_](c, buf);
|
||||||
|
|
||||||
if (cmd->handler)
|
if (cmd->handler)
|
||||||
cmd->handler(c, NULL);
|
cmd->handler(c, NULL);
|
||||||
|
@ -374,8 +374,8 @@ OnManagement(SOCKET sk, LPARAM lParam)
|
||||||
|
|
||||||
case FD_CLOSE:
|
case FD_CLOSE:
|
||||||
CloseManagement (c);
|
CloseManagement (c);
|
||||||
if (rtmsg_handler[stop])
|
if (rtmsg_handler[stop_])
|
||||||
rtmsg_handler[stop](c, "");
|
rtmsg_handler[stop_](c, "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
24
manage.h
24
manage.h
|
@ -25,18 +25,18 @@
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ready,
|
ready_,
|
||||||
stop,
|
stop_,
|
||||||
bytecount,
|
bytecount_,
|
||||||
echo,
|
echo_,
|
||||||
hold,
|
hold_,
|
||||||
log,
|
log_,
|
||||||
password,
|
password_,
|
||||||
proxy,
|
proxy_,
|
||||||
state,
|
state_,
|
||||||
needok,
|
needok_,
|
||||||
needstr,
|
needstr_,
|
||||||
pkcs11_id_count,
|
pkcs11_id_count_,
|
||||||
mgmt_rtmsg_type_max
|
mgmt_rtmsg_type_max
|
||||||
} mgmt_rtmsg_type;
|
} mgmt_rtmsg_type;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue