| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
bbs.h - description |
/* |
| 3 |
------------------- |
* bbs |
| 4 |
begin : Mon Oct 18 2004 |
* - BBS related 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 _BBS_H_ |
#ifndef _BBS_H_ |
| 10 |
#define _BBS_H_ |
#define _BBS_H_ |
| 11 |
|
|
| 12 |
#include <time.h> |
#include <time.h> |
| 13 |
|
#include <netinet/in.h> |
| 14 |
|
|
| 15 |
// BBS |
enum bbs_const_t |
| 16 |
#define BBS_max_section 1024 |
{ |
| 17 |
#define BBS_max_username_length 20 |
BBS_max_section = 200, |
| 18 |
|
BBS_section_name_max_len = 20, |
| 19 |
|
BBS_section_title_max_len = 40, |
| 20 |
|
BBS_username_max_len = 12, |
| 21 |
|
BBS_password_max_len = 12, |
| 22 |
|
BBS_nickname_max_len = 40, |
| 23 |
|
BBS_user_tz_max_len = 50, |
| 24 |
|
|
| 25 |
|
BBS_msg_max_len = 1024, |
| 26 |
|
|
| 27 |
|
BBS_id_max_len = 20, |
| 28 |
|
BBS_name_max_len = 50, |
| 29 |
|
BBS_server_max_len = 255, |
| 30 |
|
BBS_address_max_len = 50, |
| 31 |
|
BBS_start_dt_max_len = 50, |
| 32 |
|
|
| 33 |
extern char BBS_id[20]; |
BBS_max_user_count = 100000, |
| 34 |
extern char BBS_name[50]; |
BBS_max_user_online_count = 10000, |
|
extern char BBS_server[256]; |
|
|
extern char BBS_address[50]; |
|
|
extern unsigned int BBS_port; |
|
|
extern long BBS_max_client; |
|
|
extern long BBS_max_user; |
|
|
extern char BBS_start_dt[50]; |
|
|
|
|
|
// User privilege |
|
|
#define S_NONE 0x0 |
|
|
#define S_LIST 0x1 |
|
|
#define S_GETEXP 0x2 |
|
|
#define S_POST 0x4 |
|
|
#define S_MSG 0x8 |
|
|
#define S_MAIL 0x10 |
|
|
#define S_MAN_S 0x20 |
|
|
#define S_MAN_M 0x60 //(0x40 | 0x20) |
|
|
#define S_ADMIN 0xe0 //(0x80 | 0x40 | 0x20) |
|
|
#define S_ALL 0xff |
|
|
#define S_DEFAULT 0x3 // 0x1 | 0x2 |
|
|
|
|
|
#define P_GUEST 0x0 // �ο� |
|
|
#define P_USER 0x1 // ��ͨ�û� |
|
|
#define P_AUTH_USER 0x2 // ��֤�û� |
|
|
#define P_MAN_S 0x4 // ������ |
|
|
#define P_MAN_M 0x8 // ����� |
|
|
#define P_MAN_C 0x10 // 8Ŀ��� |
|
|
#define P_ADMIN_S 0x20 // ��ϵͳ����Ա |
|
|
#define P_ADMIN_M 0x40 // ��ϵͳ����Ա |
|
| 35 |
|
|
| 36 |
struct user_priv |
BBS_max_user_idle_time = 600, // 10 minutes |
| 37 |
{ |
|
| 38 |
long int uid; |
BBS_current_action_max_len = 20, |
|
long int auid; |
|
|
int level; |
|
|
int g_priv; |
|
|
struct |
|
|
{ |
|
|
int sid; |
|
|
int s_priv; |
|
|
} s_priv_list[BBS_max_section]; |
|
|
int s_count; |
|
| 39 |
}; |
}; |
| 40 |
|
|
| 41 |
typedef struct user_priv BBS_user_priv; |
// BBS |
| 42 |
|
extern const int BBS_section_list_load_interval; |
| 43 |
|
|
| 44 |
|
extern char BBS_id[BBS_id_max_len + 1]; |
| 45 |
|
extern char BBS_name[BBS_name_max_len + 1]; |
| 46 |
|
extern char BBS_server[BBS_server_max_len + 1]; |
| 47 |
|
extern char BBS_address[BBS_address_max_len + 1]; |
| 48 |
|
extern in_port_t BBS_port[2]; |
| 49 |
|
extern int BBS_max_client; |
| 50 |
|
extern int BBS_max_client_per_ip; |
| 51 |
|
extern char BBS_start_dt[BBS_start_dt_max_len + 1]; |
| 52 |
|
extern int BBS_sys_id; |
| 53 |
|
|
| 54 |
|
// User |
| 55 |
|
extern const int BBS_user_list_load_interval; |
| 56 |
|
extern const int BBS_user_online_list_load_interval; |
| 57 |
|
|
| 58 |
// Session |
// Session |
| 59 |
#define MAX_DELAY_TIME 600 |
extern const int BBS_user_off_line; |
| 60 |
|
|
| 61 |
extern char BBS_username[BBS_max_username_length]; |
extern char BBS_username[BBS_username_max_len + 1]; |
| 62 |
extern BBS_user_priv BBS_priv; |
extern char BBS_nickname[BBS_nickname_max_len + 1]; |
| 63 |
extern int BBS_passwd_complex; |
extern char BBS_user_tz[BBS_user_tz_max_len + 1]; |
| 64 |
extern int BBS_user_money; |
extern int BBS_user_exp; |
| 65 |
|
|
| 66 |
extern time_t BBS_login_tm; |
extern time_t BBS_login_tm; |
| 67 |
extern time_t BBS_last_access_tm; |
extern time_t BBS_last_access_tm; |
|
extern time_t BBS_last_sub_tm; |
|
| 68 |
|
|
| 69 |
extern char BBS_current_section_name[20]; |
extern char BBS_current_action[BBS_current_action_max_len + 1]; |
| 70 |
|
extern time_t BBS_current_action_tm; |
| 71 |
|
extern const int BBS_current_action_refresh_interval; |
| 72 |
|
|
| 73 |
|
extern const char *get_astro_name(time_t birthday); |
| 74 |
|
extern int get_user_level(int point); |
| 75 |
|
extern const char *get_user_level_name(int level); |
| 76 |
|
|
| 77 |
|
extern char *setuserfile(char *buf, size_t len, const char *filename); |
| 78 |
|
|
| 79 |
#endif //_BBS_H_ |
#endif //_BBS_H_ |