| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
common.h - description |
/* |
| 3 |
------------------- |
* common |
| 4 |
begin : Mon Oct 18 2004 |
* - common definitions |
| 5 |
copyright : (C) 2004 by Leaflet |
* |
| 6 |
email : leaflet@leafok.com |
* Copyright (C) 2004-2025 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 2 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_ |
| 11 |
|
|
| 12 |
#include <stddef.h> |
#include <stddef.h> |
| 13 |
|
#include <libssh/libssh.h> |
| 14 |
|
#include <libssh/server.h> |
| 15 |
|
|
| 16 |
#define LINE_BUFFER_LEN 256 |
#define LINE_BUFFER_LEN 1024 |
| 17 |
#define FILE_PATH_LEN 1024 |
#define FILE_PATH_LEN 4096 |
| 18 |
|
|
| 19 |
// Version |
// Version |
| 20 |
extern char app_version[256]; |
#define APP_INFO (PACKAGE_STRING " build on " __DATE__ " " __TIME__) |
| 21 |
|
|
| 22 |
// Enviroment |
// Enviroment |
| 23 |
extern char app_home_dir[256]; |
#define CONF_BBSD "conf/bbsd.conf" |
| 24 |
extern char app_temp_dir[256]; |
#define CONF_MENU "var/menu_merged.conf" |
| 25 |
|
#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" |
| 28 |
|
|
| 29 |
|
#define LOG_FILE_INFO "log/bbsd.log" |
| 30 |
|
#define LOG_FILE_ERROR "log/error.log" |
| 31 |
|
|
| 32 |
|
#define DATA_WELCOME "data/welcome.txt" |
| 33 |
|
#define DATA_REGISTER "data/register.txt" |
| 34 |
|
#define DATA_GOODBYE "data/goodbye.txt" |
| 35 |
|
#define DATA_LICENSE "data/license.txt" |
| 36 |
|
#define DATA_COPYRIGHT "data/copyright.txt" |
| 37 |
|
#define DATA_VERSION "data/version.txt" |
| 38 |
|
#define DATA_LOGIN_ERROR "data/login_error.txt" |
| 39 |
|
#define DATA_ACTIVE_BOARD "data/active_board.txt" |
| 40 |
|
#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" |
| 44 |
|
|
| 45 |
|
#define VAR_ARTICLE_BLOCK_SHM "var/article_block_shm.~" |
| 46 |
|
#define VAR_SECTION_LIST_SHM "var/section_list_shm.~" |
| 47 |
|
#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/" |
| 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 |
| 55 |
|
extern const char *data_files_load_startup[]; |
| 56 |
|
extern const int data_files_load_startup_count; |
| 57 |
|
|
| 58 |
|
// Screen |
| 59 |
|
#define SCREEN_ROWS 24 |
| 60 |
|
#define SCREEN_COLS 80 |
| 61 |
|
|
| 62 |
// Network |
// Network |
| 63 |
extern int socket_server; |
#define MAX_CLIENT_LIMIT 2000 |
| 64 |
|
#define MAX_CLIENT_PER_IP_LIMIT 100 |
| 65 |
|
#define IP_ADDR_LEN 50 |
| 66 |
|
#define MAX_EVENTS 10 |
| 67 |
|
|
| 68 |
|
extern int socket_server[2]; |
| 69 |
extern int socket_client; |
extern int socket_client; |
| 70 |
extern char hostaddr_server[50]; |
extern char hostaddr_client[IP_ADDR_LEN]; |
|
extern char hostaddr_client[50]; |
|
|
extern int port_server; |
|
| 71 |
extern int port_client; |
extern int port_client; |
| 72 |
|
|
| 73 |
// Signal |
// SSHv2 |
| 74 |
#define SIG_RELOAD_MENU 0x22 |
extern int SSH_v2; |
| 75 |
|
extern ssh_bind sshbind; |
| 76 |
extern const char *str_space(char *string, int length); |
extern ssh_session SSH_session; |
| 77 |
extern const char *get_time_str(char *string, size_t length); |
extern ssh_channel SSH_channel; |
| 78 |
|
|
| 79 |
// Signal handler |
// Signal handler |
| 80 |
extern void reload_bbs_menu(int); |
extern void sig_hup_handler(int); |
| 81 |
extern void system_exit(int); |
extern void sig_term_handler(int); |
| 82 |
extern void child_exit(int); |
extern void sig_chld_handler(int); |
| 83 |
|
|
| 84 |
// System |
// System |
| 85 |
extern int SYS_exit; |
extern volatile int SYS_server_exit; |
| 86 |
extern int SYS_child_process_count; |
extern volatile int SYS_child_process_count; |
| 87 |
|
extern volatile int SYS_child_exit; |
| 88 |
|
extern volatile int SYS_conf_reload; |
| 89 |
|
|
| 90 |
#endif //_COMMON_H_ |
#endif //_COMMON_H_ |