selfcare init

This commit is contained in:
zhangsz
2025-03-03 11:40:37 +08:00
parent 19f09dd7ea
commit aca2bace68
692 changed files with 273972 additions and 0 deletions

66
proxy_c/selfcare_res.h Normal file
View File

@@ -0,0 +1,66 @@
#ifndef __SELFCARE_RES_H__
#define __SELFCARE_RES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "selfcare_httpsrv.h"
#include "selfcare_config.h"
typedef enum _selfcare_state_e
{
SELFCARE_IDLE = 0,
SELFCARE_WAIT_SELFCARE_REQ,
SELFCARE_WAIT_SEND2OCS_REQ,
SELFCARE_WAIT_OCS_RESP,
SELFCARE_WAIT_SEND2SELFCARE_RESP,
SELFCARE_LOCAL_INIT_REQ,
SELFCARE_LOCAL_INIT_RESP,
SELFCARE_RELEASE,
SELFCARE_STATE_MAX,
}selfcare_state_e;
#define SELFCARE_RES_NUM (1024)
typedef struct _selfcare_res_s
{
int id;
unsigned int timer;
selfcare_state_e state; /* ״̬ */
struct evhttp_request *req; /* selfcare <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> */
char *arg; /* libevent <20>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> */
SELFCARE_URL_E req_type; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
_rest_msg_s resp; /* OCS <20>ظ<EFBFBD><D8B8><EFBFBD>udp<64><70>Ϣ */
int local_init_flag;
int local_init_oc;
int local_init_db_key;
}selfcare_res_s;
extern selfcare_res_s g_res_arr[SELFCARE_RES_NUM];
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դid */
int selfcare_res_get(int *res_id);
/* <20>ͷ<EFBFBD>id */
int selfcare_res_release(const int res_id);
const char *selfcare_res_stateprint(selfcare_state_e state);
/* <20><>ʼ<EFBFBD><CABC> */
int selfcare_res_init(int argc, char **argv);
/* <20><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC> */
void selfcare_res_uninit(void);
#ifdef __cplusplus
}
#endif
#endif /* __SELFCARE_RES_H__ */