2019-07-28 10:31:56 +08:00
|
|
|
|
#ifndef __APP_MAIN_INCLUDE_H__
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#define __APP_MAIN_INCLUDE_H__
|
|
|
|
|
|
|
|
|
|
#include "lib_acl.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* <20>ͻ<EFBFBD><CDBB>˶<EFBFBD>д<EFBFBD><D0B4>ʱʱ<CAB1><CAB1>ֵ */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
extern int app_var_client_idle_limit;
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ != 0 ʱ, <20><><EFBFBD>ܻ<EFBFBD><DCBB>Զ<EFBFBD><D4B6>رտͻ<D5BF><CDBB><EFBFBD><EFBFBD><EFBFBD> */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
typedef int (*APP_RUN_FN)(ACL_VSTREAM *stream, void *run_ctx);
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
/* <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
typedef void (*APP_INIT_FN)(void*);
|
|
|
|
|
typedef void (*APP_EXIT_FN)(void*);
|
|
|
|
|
|
|
|
|
|
typedef ACL_MASTER_SERVER_THREAD_INIT_FN APP_THREAD_INIT_FN /* void (*)(void*) */;
|
|
|
|
|
typedef ACL_MASTER_SERVER_THREAD_EXIT_FN APP_THREAD_EXIT_FN; /* void (*)(void*) */
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
#define APP_CTL_END 0 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD>־ */
|
|
|
|
|
#define APP_CTL_INIT_FN 1 /* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define APP_CTL_INIT_CTX 2 /* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õIJ<C3B5><C4B2><EFBFBD> */
|
|
|
|
|
#define APP_CTL_CFG_BOOL 3 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define APP_CTL_CFG_INT 4 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define APP_CTL_CFG_STR 5 /* <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define APP_CTL_EXIT_FN 6 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>ʱ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define APP_CTL_EXIT_CTX 7 /* <20><><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>ʱ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD> */
|
|
|
|
|
#define APP_CTL_THREAD_INIT 8 /* ÿ<><C3BF><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define APP_CTL_THREAD_INIT_CTX 9 /* <20>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD> */
|
|
|
|
|
#define APP_CTL_THREAD_EXIT 10 /* <20>߳<EFBFBD><DFB3>˳<EFBFBD>ʱ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define APP_CTL_THREAD_EXIT_CTX 11 /* <20>߳<EFBFBD><DFB3>˳<EFBFBD>ʱ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD> */
|
|
|
|
|
#define APP_CTL_DENY_INFO 12 /* <20><><EFBFBD>Ƿ<EFBFBD><C7B7>ͻ<EFBFBD><CDBB>˷<EFBFBD><CBB7><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* in app_main.c */
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>뼰<EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(APP_INIT_FN <EFBFBD><EFBFBD><EFBFBD><EFBFBD>), <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵĿͻ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>(APP_RUN_FN <EFBFBD><EFBFBD><EFBFBD><EFBFBD>).
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
* @param argc "int main(int argc, char *argv[])" <EFBFBD>е<EFBFBD> argc
|
|
|
|
|
* @param argv "int main(int argc, char *argv[])" <EFBFBD>е<EFBFBD> argv
|
|
|
|
|
* @param run_fn <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param run_ctx run_fn() <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>֮һ
|
|
|
|
|
* @param name <EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>: APP_CTL_XXX
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD>ʽ: APP_CTL_XXX, xxx; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> APP_CTL_END Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @example:
|
|
|
|
|
* app_main(argc, argv, {run_fn}, {run_ctx},
|
|
|
|
|
* APP_CTL_INIT_FN, {run_init_fn},
|
|
|
|
|
* APP_CTL_INIT_CTX, {run_init_ctx},
|
|
|
|
|
* APP_CTL_END);
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* ע: app_main() <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, argc, argv, run_fn, run_ctx(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪNULL), APP_CTL_END
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
extern void app_main(int argc, char *argv[], APP_RUN_FN run_fn, void *run_ctx, int name, ...);
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|