--- lbbs/include/common.h 2025/05/04 14:54:55 1.19 +++ lbbs/include/common.h 2025/07/01 08:31:11 1.48 @@ -1,16 +1,15 @@ /*************************************************************************** common.h - description ------------------- - begin : Mon Oct 18 2004 - copyright : (C) 2004 by Leaflet - email : leaflet@leafok.com + Copyright : (C) 2004-2025 by Leaflet + Email : leaflet@leafok.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * + * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ @@ -19,16 +18,22 @@ #define _COMMON_H_ #include +#include +#include #define LINE_BUFFER_LEN 1024 #define FILE_PATH_LEN 4096 -#define MAX_FILE_LINES 65536 // Version -extern char app_version[256]; +#define APP_NAME "LBBS" +#define APP_VER "1.2.2" +#define APP_INFO (APP_NAME " version " APP_VER " build on " __DATE__ " " __TIME__) // Enviroment +#define CONF_BBSD "conf/bbsd.conf" +#define CONF_MENU "var/menu_merged.conf" #define CONF_BBSNET "conf/bbsnet.conf" +#define SSH_HOST_KEYFILE "conf/ssh_host_rsa_key" #define LOG_FILE_INFO "log/bbsd.log" #define LOG_FILE_ERROR "log/error.log" @@ -42,29 +47,57 @@ extern char app_version[256]; #define DATA_ACTIVE_BOARD "data/active_board.txt" #define DATA_READ_HELP "data/read_help.txt" -#define VAR_MAX_USER_ONLINE "var/max_user_online.dat" +#define VAR_BBS_TOP "var/bbs_top.txt" + +#define VAR_ARTICLE_BLOCK_SHM "var/article_block_shm.~" +#define VAR_SECTION_LIST_SHM "var/section_list_shm.~" +#define VAR_TRIE_DICT_SHM "var/trie_dict_shm.~" + +#define VAR_ARTICLE_CACHE_DIR "var/articles/" +#define VAR_GEN_EX_MENU_DIR "var/gen_ex/" + +// File loader +extern const char *data_files_load_startup[]; +extern int data_files_load_startup_count; + +// Screen +#define SCREEN_ROWS 24 +#define SCREEN_COLS 80 // Network -extern int socket_server; +#define MAX_CLIENT_LIMIT 2000 +#define MAX_CLIENT_PER_IP_LIMIT 100 +#define IP_ADDR_LEN 50 +#define MAX_EVENTS 10 + +// User +#define BBS_MAX_USER_LIMIT 100000 + +extern int socket_server[2]; extern int socket_client; -extern char hostaddr_server[50]; -extern char hostaddr_client[50]; -extern int port_server; +extern char hostaddr_client[IP_ADDR_LEN]; extern int port_client; -// Signal -#define SIG_RELOAD_MENU 0x22 +// SSHv2 +extern int SSH_v2; +extern ssh_bind sshbind; +extern ssh_session SSH_session; +extern ssh_channel SSH_channel; -extern const char *str_space(char *string, int length); extern const char *get_time_str(char *string, size_t length); // Signal handler -extern void reload_bbs_menu(int); -extern void system_exit(int); -extern void child_exit(int); +extern void sig_hup_handler(int); +extern void sig_term_handler(int); +extern void sig_chld_handler(int); // System -extern int SYS_exit; -extern int SYS_child_process_count; +extern volatile int SYS_server_exit; +extern volatile int SYS_child_process_count; +extern volatile int SYS_child_exit; +extern volatile int SYS_conf_reload; + +// Network +extern const char *ip_mask(char *s, int level, char mask); #endif //_COMMON_H_