| 1 |
#include <stdio.h> |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
#include <stdlib.h> |
/* |
| 3 |
#include <ctype.h> |
* common |
| 4 |
#include <string.h> |
* - common definitions |
| 5 |
|
* |
| 6 |
|
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
| 8 |
|
|
| 9 |
|
#ifndef _COMMON_H_ |
| 10 |
|
#define _COMMON_H_ |
| 11 |
|
|
| 12 |
|
#include <stddef.h> |
| 13 |
|
#include <libssh/libssh.h> |
| 14 |
|
#include <libssh/server.h> |
| 15 |
|
|
| 16 |
|
enum common_constant_t |
| 17 |
|
{ |
| 18 |
|
LINE_BUFFER_LEN = 1024, |
| 19 |
|
FILE_PATH_LEN = 4096, |
| 20 |
|
FILE_NAME_LEN = 256, |
| 21 |
|
|
| 22 |
|
// Screen |
| 23 |
|
SCREEN_ROWS = 24, |
| 24 |
|
SCREEN_COLS = 80, |
| 25 |
|
|
| 26 |
|
TAB_SIZE = 4, |
| 27 |
|
|
| 28 |
|
// Network |
| 29 |
|
MAX_CLIENT_LIMIT = 2000, |
| 30 |
|
MAX_CLIENT_PER_IP_LIMIT = 100, |
| 31 |
|
IP_ADDR_LEN = 50, |
| 32 |
|
MAX_EVENTS = 10, |
| 33 |
|
}; |
| 34 |
|
|
| 35 |
|
// Version |
| 36 |
|
extern const char APP_INFO[]; |
| 37 |
|
extern const char COPYRIGHT_INFO[]; |
| 38 |
|
|
| 39 |
|
// Enviroment |
| 40 |
|
extern const char CONF_BBSD[]; |
| 41 |
|
extern const char CONF_MENU[]; |
| 42 |
|
extern const char CONF_BBSNET[]; |
| 43 |
|
extern const char CONF_BWF[]; |
| 44 |
|
extern const char CONF_TOP10_MENU[]; |
| 45 |
|
extern const char SSH_HOST_KEYFILE[]; |
| 46 |
|
|
| 47 |
|
extern const char LOG_FILE_INFO[]; |
| 48 |
|
extern const char LOG_FILE_ERROR[]; |
| 49 |
|
|
| 50 |
|
extern const char DATA_WELCOME[]; |
| 51 |
|
extern const char DATA_REGISTER[]; |
| 52 |
|
extern const char DATA_GOODBYE[]; |
| 53 |
|
extern const char DATA_LICENSE[]; |
| 54 |
|
extern const char DATA_COPYRIGHT[]; |
| 55 |
|
extern const char DATA_VERSION[]; |
| 56 |
|
extern const char DATA_LOGIN_ERROR[]; |
| 57 |
|
extern const char DATA_ACTIVE_BOARD[]; |
| 58 |
|
extern const char DATA_READ_HELP[]; |
| 59 |
|
extern const char DATA_EDITOR_HELP[]; |
| 60 |
|
|
| 61 |
|
extern const char VAR_BBS_TOP[]; |
| 62 |
|
|
| 63 |
|
extern const char VAR_ARTICLE_BLOCK_SHM[]; |
| 64 |
|
extern const char VAR_SECTION_LIST_SHM[]; |
| 65 |
|
extern const char VAR_TRIE_DICT_SHM[]; |
| 66 |
|
extern const char VAR_USER_LIST_SHM[]; |
| 67 |
|
|
| 68 |
|
extern const char VAR_ARTICLE_CACHE_DIR[]; |
| 69 |
|
extern const char VAR_GEN_EX_MENU_DIR[]; |
| 70 |
|
extern const char VAR_SECTION_AID_LOC_DIR[]; |
| 71 |
|
|
| 72 |
|
// File loader |
| 73 |
|
extern const char *data_files_load_startup[]; |
| 74 |
|
extern const int data_files_load_startup_count; |
| 75 |
|
|
| 76 |
|
// Network |
| 77 |
|
extern char hostaddr_client[IP_ADDR_LEN]; |
| 78 |
|
extern int port_client; |
| 79 |
|
|
| 80 |
|
// SSHv2 |
| 81 |
|
extern int SSH_v2; |
| 82 |
|
extern ssh_session SSH_session; |
| 83 |
|
extern ssh_channel SSH_channel; |
| 84 |
|
|
| 85 |
|
// Signal handler |
| 86 |
|
extern void sig_hup_handler(int); |
| 87 |
|
extern void sig_term_handler(int); |
| 88 |
|
extern void sig_chld_handler(int); |
| 89 |
|
|
| 90 |
|
// System |
| 91 |
|
extern volatile int SYS_server_exit; |
| 92 |
|
extern volatile int SYS_child_process_count; |
| 93 |
|
extern volatile int SYS_child_exit; |
| 94 |
|
extern volatile int SYS_conf_reload; |
| 95 |
|
|
| 96 |
|
#endif //_COMMON_H_ |