Commit 7347faef authored by chenhaowen's avatar chenhaowen

add: exit_auth api

parent e2a0423b
...@@ -73,6 +73,10 @@ static void print_as_hex(uint8_t *buf, int len); ...@@ -73,6 +73,10 @@ static void print_as_hex(uint8_t *buf, int len);
int auth(void) int auth(void)
{ {
if (!drcom_config.log_file)
{
drcom_config.log_file = stdout;
}
#ifdef WIN32 #ifdef WIN32
WORD sockVersion = MAKEWORD(2,2); WORD sockVersion = MAKEWORD(2,2);
WSADATA wsaData; WSADATA wsaData;
...@@ -150,7 +154,7 @@ HEART_BEAT_START: ...@@ -150,7 +154,7 @@ HEART_BEAT_START:
kp1_cnt = 1; kp1_cnt = 1;
kp2_cnt = 0; kp2_cnt = 0;
srand((unsigned int)time(NULL)); srand((unsigned int)time(NULL));
while (1) while ( !drcom_config.exit )
{ {
retry_cnt = 1; retry_cnt = 1;
while (1) while (1)
...@@ -317,6 +321,12 @@ HEART_BEAT_START: ...@@ -317,6 +321,12 @@ HEART_BEAT_START:
return 0; return 0;
} }
int exit_auth(void)
{
drcom_config.exit = 1;
return 0;
}
static void print_as_hex(uint8_t *buf, int len) static void print_as_hex(uint8_t *buf, int len)
{ {
int i; int i;
......
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
#define __AUTH_H__ #define __AUTH_H__
int auth(void); int auth(void);
int exit_auth(void);
#endif //__AUTH_H__ #endif //__AUTH_H__
...@@ -13,6 +13,7 @@ struct option_s { ...@@ -13,6 +13,7 @@ struct option_s {
/* extern variables */ /* extern variables */
struct config_s drcom_config = { struct config_s drcom_config = {
.remote_port = 61440, .remote_port = 61440,
.exit = 0,
}; };
/* extern variables */ /* extern variables */
......
...@@ -15,6 +15,7 @@ struct config_s { ...@@ -15,6 +15,7 @@ struct config_s {
unsigned char keep_alive1_flag; unsigned char keep_alive1_flag;
int enable_crypt; int enable_crypt;
FILE * log_file; FILE * log_file;
int exit;
}; };
extern struct config_s drcom_config; extern struct config_s drcom_config;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment