Download
jcs
/subtext
/db.h
(View History)
jcs db: Add ftn_max_tossed_message_size and max_sysop_idle_minutes | Latest amendment: 469 on 2023-04-08 |
1 | /* |
2 | * Copyright (c) 2021 joshua stein <jcs@jcs.org> |
3 | * |
4 | * Permission to use, copy, modify, and distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above |
6 | * copyright notice and this permission notice appear in all copies. |
7 | * |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ |
16 | |
17 | #ifndef __DB_H__ |
18 | #define __DB_H__ |
19 | |
20 | #include <time.h> |
21 | |
22 | #define DB_CUR_VERS 18 |
23 | |
24 | #define SUBTEXT_CREATOR 'SUBT' |
25 | #define DB_TYPE 'STDB' |
26 | |
27 | #define DB_TRUE 0x100 |
28 | #define DB_FALSE 0x000 |
29 | |
30 | #define DB_CONFIG_RTYPE 'CONF' |
31 | #define DB_USER_RTYPE 'USER' |
32 | #define DB_BOARD_RTYPE 'BORD' |
33 | #define DB_FOLDER_RTYPE 'FOLD' |
34 | #define DB_VERS_RTYPE 'VERS' |
35 | #define DB_MOTD_RTYPE 'MOTD' |
36 | |
37 | #define DB_TEXT_TYPE 'TEXT' |
38 | #define DB_TEXT_MENU_ID 1 |
39 | #define DB_TEXT_SHORTMENU_ID 2 |
40 | #define DB_TEXT_ISSUE_ID 3 |
41 | #define DB_TEXT_SIGNUP_ID 4 |
42 | #define DB_TEXT_PAGE_SYSOP_ID 5 |
43 | #define DB_TEXT_NO_FREE_NODES_ID 6 |
44 | #define DB_TEXT_SIGNOFF_ID 7 |
45 | #define DB_TEXT_MENU_OPTIONS_ID 8 |
46 | |
47 | #define DB_USERNAME_LENGTH 16 |
48 | |
49 | #define SL_TYPE 'STSL' |
50 | #define SL_LOG_RTYPE 'SLOG' |
51 | #define SL_TALLY_RTYPE 'STLY' |
52 | |
53 | #define BOARD_FILENAME_EXT "brd" |
54 | #define BOARD_THREAD_RTYPE 'BDTH' |
55 | #define BOARD_POST_RTYPE 'BDPS' |
56 | #define BOARD_FTN_POST_RTYPE 'BDFP' |
57 | #define BOARD_FTN_MSGID_CACHE_RTYPE 'BDMC' |
58 | #define BOARD_SORTED_ID_MAP_RTYPE 'BDDX' |
59 | |
60 | #define FOLDER_FILENAME_EXT "fld" |
61 | #define FOLDER_FILE_RTYPE 'FILE' |
62 | |
63 | #define MAIL_SPOOL_TYPE 'STMS' |
64 | #define MAIL_SPOOL_MESSAGE_RTYPE 'PMSG' |
65 | |
66 | #define FTN_SPOOL_PACKET_TYPE 'FNSP' |
67 | |
68 | #include "subtext.h" |
69 | #include "bile.h" |
70 | #include "board.h" |
71 | #include "folder.h" |
72 | #include "settings.h" |
73 | |
74 | struct config { |
75 | char name[32]; |
76 | char phone_number[32]; |
77 | char location[64]; |
78 | char hostname[32]; |
79 | short telnet_port; |
80 | short modem_port; |
81 | char modem_init[96]; |
82 | short max_idle_minutes; |
83 | char timezone[8]; |
84 | short open_signup; |
85 | short max_login_seconds; |
86 | short blanker_idle_seconds; |
87 | short blanker_runtime_seconds; |
88 | unsigned long trusted_proxy_ip; |
89 | unsigned long modem_speed; |
90 | unsigned short trusted_proxy_udp_port; |
91 | short session_log_prune_days; |
92 | char modem_parity[4]; |
93 | char ftn_node_addr[32]; |
94 | char ftn_hub_addr[32]; |
95 | char ftn_hub_pkt_password[9]; |
96 | char binkp_hostname[64]; |
97 | unsigned short binkp_port; |
98 | char binkp_password[32]; |
99 | unsigned long binkp_interval_seconds; |
100 | short binkp_delete_done; |
101 | short timezone_utcoff; |
102 | char ftn_network[16]; |
103 | short mail_prune_days; |
104 | unsigned long ftn_max_tossed_message_size; |
105 | short max_sysop_idle_minutes; |
106 | }; |
107 | |
108 | extern struct struct_field config_fields[]; |
109 | extern size_t nconfig_fields; |
110 | |
111 | struct db { |
112 | struct bile *bile; |
113 | short fh; |
114 | struct config config; |
115 | struct username_cache *username_cache; |
116 | short nusers; |
117 | struct bile *sessions_bile; |
118 | struct board *boards; |
119 | short nboards; |
120 | struct folder *folders; |
121 | short nfolders; |
122 | struct bile *mail_bile; |
123 | }; |
124 | |
125 | struct db * db_open(Str255 file, short vrefnum); |
126 | struct db * db_create(void); |
127 | void db_close(struct db *tdb); |
128 | void db_config_save(struct db *tdb); |
129 | |
130 | void db_cache_boards(struct db *tdb); |
131 | struct bile * db_board_create(struct db *tdb, struct board *board, |
132 | bool delete_first); |
133 | void db_board_delete(struct db *tdb, struct board *board); |
134 | |
135 | void db_cache_folders(struct db *tdb); |
136 | struct bile * db_folder_create(struct db *tdb, struct folder *folder, |
137 | bool delete_first); |
138 | void db_folder_delete(struct db *tdb, struct folder *folder); |
139 | |
140 | #endif |