| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
common.h - description |
/* |
| 3 |
------------------- |
* common |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - common definitions |
| 5 |
Email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
|
/*************************************************************************** |
|
|
* * |
|
|
* 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 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 8 |
|
|
| 9 |
#ifndef _COMMON_H_ |
#ifndef _COMMON_H_ |
| 10 |
#define _COMMON_H_ |
#define _COMMON_H_ |
| 17 |
#define FILE_PATH_LEN 4096 |
#define FILE_PATH_LEN 4096 |
| 18 |
|
|
| 19 |
// Version |
// Version |
| 20 |
#define APP_NAME_VER "LBBS-devel version 1.0" |
#define APP_INFO (PACKAGE_STRING " build on " __DATE__ " " __TIME__) |
| 21 |
|
|
| 22 |
// Enviroment |
// Enviroment |
| 23 |
#define CONF_BBSD "conf/bbsd.conf" |
#define CONF_BBSD "conf/bbsd.conf" |
| 24 |
#define CONF_MENU "var/menu_merged.conf" |
#define CONF_MENU "var/menu_merged.conf" |
| 25 |
#define CONF_BBSNET "conf/bbsnet.conf" |
#define CONF_BBSNET "conf/bbsnet.conf" |
| 26 |
|
#define CONF_TOP10_MENU "var/bbs_top_menu.conf" |
| 27 |
#define SSH_HOST_KEYFILE "conf/ssh_host_rsa_key" |
#define SSH_HOST_KEYFILE "conf/ssh_host_rsa_key" |
| 28 |
|
|
| 29 |
#define LOG_FILE_INFO "log/bbsd.log" |
#define LOG_FILE_INFO "log/bbsd.log" |
| 34 |
#define DATA_GOODBYE "data/goodbye.txt" |
#define DATA_GOODBYE "data/goodbye.txt" |
| 35 |
#define DATA_LICENSE "data/license.txt" |
#define DATA_LICENSE "data/license.txt" |
| 36 |
#define DATA_COPYRIGHT "data/copyright.txt" |
#define DATA_COPYRIGHT "data/copyright.txt" |
| 37 |
|
#define DATA_VERSION "data/version.txt" |
| 38 |
#define DATA_LOGIN_ERROR "data/login_error.txt" |
#define DATA_LOGIN_ERROR "data/login_error.txt" |
| 39 |
#define DATA_ACTIVE_BOARD "data/active_board.txt" |
#define DATA_ACTIVE_BOARD "data/active_board.txt" |
| 40 |
#define DATA_READ_HELP "data/read_help.txt" |
#define DATA_READ_HELP "data/read_help.txt" |
| 41 |
|
#define DATA_EDITOR_HELP "data/editor_help.txt" |
| 42 |
|
|
| 43 |
#define VAR_BBS_TOP "var/bbs_top.txt" |
#define VAR_BBS_TOP "var/bbs_top.txt" |
| 44 |
|
|
| 45 |
#define VAR_ARTICLE_BLOCK_SHM "var/article_block_shm.~" |
#define VAR_ARTICLE_BLOCK_SHM "var/article_block_shm.~" |
| 46 |
#define VAR_SECTION_LIST_SHM "var/section_list_shm.~" |
#define VAR_SECTION_LIST_SHM "var/section_list_shm.~" |
| 47 |
#define VAR_TRIE_DICT_SHM "var/trie_dict_shm.~" |
#define VAR_TRIE_DICT_SHM "var/trie_dict_shm.~" |
| 48 |
|
#define VAR_USER_LIST_SHM "var/user_list_shm.~" |
| 49 |
|
|
| 50 |
#define VAR_ARTICLE_CACHE_DIR "var/articles/" |
#define VAR_ARTICLE_CACHE_DIR "var/articles/" |
| 51 |
|
#define VAR_GEN_EX_MENU_DIR "var/gen_ex/" |
| 52 |
|
#define VAR_SECTION_AID_LOC_DIR "var/section_aid_loc/" |
| 53 |
|
|
| 54 |
// File loader |
// File loader |
| 55 |
extern const char *data_files_load_startup[]; |
extern const char *data_files_load_startup[]; |
| 56 |
extern int data_files_load_startup_count; |
extern const int data_files_load_startup_count; |
| 57 |
|
|
| 58 |
// Screen |
// Screen |
| 59 |
#define SCREEN_ROWS 24 |
#define SCREEN_ROWS 24 |
| 65 |
#define IP_ADDR_LEN 50 |
#define IP_ADDR_LEN 50 |
| 66 |
#define MAX_EVENTS 10 |
#define MAX_EVENTS 10 |
| 67 |
|
|
|
// User |
|
|
#define BBS_MAX_USER_LIMIT 100000 |
|
|
|
|
| 68 |
extern int socket_server[2]; |
extern int socket_server[2]; |
| 69 |
extern int socket_client; |
extern int socket_client; |
| 70 |
extern char hostaddr_client[IP_ADDR_LEN]; |
extern char hostaddr_client[IP_ADDR_LEN]; |
| 76 |
extern ssh_session SSH_session; |
extern ssh_session SSH_session; |
| 77 |
extern ssh_channel SSH_channel; |
extern ssh_channel SSH_channel; |
| 78 |
|
|
|
extern const char *get_time_str(char *string, size_t length); |
|
|
|
|
| 79 |
// Signal handler |
// Signal handler |
| 80 |
extern void sig_hup_handler(int); |
extern void sig_hup_handler(int); |
| 81 |
extern void sig_term_handler(int); |
extern void sig_term_handler(int); |
| 86 |
extern volatile int SYS_child_process_count; |
extern volatile int SYS_child_process_count; |
| 87 |
extern volatile int SYS_child_exit; |
extern volatile int SYS_child_exit; |
| 88 |
extern volatile int SYS_conf_reload; |
extern volatile int SYS_conf_reload; |
|
extern volatile int SYS_data_file_reload; |
|
|
extern volatile int SYS_section_list_reload; |
|
|
|
|
|
// Network |
|
|
extern const char *ip_mask(char *s, int level, char mask); |
|
| 89 |
|
|
| 90 |
#endif //_COMMON_H_ |
#endif //_COMMON_H_ |