3 #define TRACE fprintf(stderr, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
5 #define SLEEPING 180 /* TCP connection timeout */
6 #define WEBCIT_TIMEOUT 900 /* WebCit session timeout */
7 #define PORT_NUM 2000 /* port number to listen on */
8 #define SERVER "WebCit v3.00" /* who's in da house */
11 #define CLIENT_VERSION 300
12 #define DEFAULT_HOST "localhost" /* Default Citadel server */
13 #define DEFAULT_PORT "504"
14 #define LB (1) /* Internal escape chars */
17 #define TARGET "webcit01" /* Target for inline URL's */
18 #define HOUSEKEEPING 15 /* Housekeeping frequency */
19 #define INITIAL_WORKER_THREADS 5
20 #define LISTEN_QUEUE_LENGTH 20 /* listen() backlog queue */
23 /* Room flags (from Citadel) */
24 #define QR_PERMANENT 1 /* Room does not purge */
25 #define QR_INUSE 2 /* Set if in use, clear if avail */
26 #define QR_PRIVATE 4 /* Set for any type of private room */
27 #define QR_PASSWORDED 8 /* Set if there's a password too */
28 #define QR_GUESSNAME 16 /* Set if it's a guessname room */
29 #define QR_DIRECTORY 32 /* Directory room */
30 #define QR_UPLOAD 64 /* Allowed to upload */
31 #define QR_DOWNLOAD 128 /* Allowed to download */
32 #define QR_VISDIR 256 /* Visible directory */
33 #define QR_ANONONLY 512 /* Anonymous-Only room */
34 #define QR_ANONOPT 1024 /* Anonymous-Option room */
35 #define QR_NETWORK 2048 /* Shared network room */
36 #define QR_PREFONLY 4096 /* Preferred status needed to enter */
37 #define QR_READONLY 8192 /* Aide status required to post */
38 #define QR_MAILBOX 16384 /* Set if this is a private mailbox */
42 struct httprequest *next;
47 struct urlcontent *next;
54 char serv_nodename[32];
55 char serv_humannode[64];
57 char serv_software[64];
59 char serv_bbs_city[64];
61 char serv_moreprompt[256];
68 * This struct holds a list of rooms for <G>oto operations.
78 * This struct holds a list of rooms for client display.
82 struct roomlisting *lnext;
83 struct roomlisting *rnext;
93 * Dynamic content for variable substitution in templates
100 void (*wcs_function)(void);
104 * Values for wcs_type
114 * One of these is kept for each active Citadel session.
115 * HTTP transactions are bound to one at a time.
118 struct wcsession *next; /* Linked list */
119 int wc_session; /* WebCit session ID */
120 char wc_username[256];
121 char wc_password[256];
122 char wc_roomname[256];
136 int remember_new_mail;
138 pthread_mutex_t SessionMutex; /* mutex for exclusive access */
139 time_t lastreq; /* Timestamp of most recent HTTP */
140 int killthis; /* Nonzero == purge this session */
141 struct march *march; /* march mode room list */
142 char reply_to[512]; /* reply-to address */
143 long msgarr[1024]; /* for read operations */
145 struct urlcontent *urlstrings;
146 int HaveExpressMessages; /* Nonzero if incoming msgs exist */
147 struct wcsubst *vars;
152 #define WC ((struct wcsession *)pthread_getspecific(MyConKey))
153 extern pthread_key_t MyConKey;
155 struct serv_info serv_info;
156 extern char floorlist[128][256];
157 extern char *axdefs[];
158 extern char *defaulthost, *defaultport;
160 extern struct wcsubst *global_subst;
163 void stuff_to_cookie(char *cookie, int session,
164 char *user, char *pass, char *room);
165 void cookie_to_stuff(char *cookie, int *session,
166 char *user, char *pass, char *room);
167 void locate_host(char *, int);
168 void become_logged_in(char *, char *, char *);
170 void display_login(char *mesg);
171 void do_welcome(void);
172 void do_logout(void);
173 void display_main_menu(void);
174 void display_advanced_menu(void);
175 void list_all_rooms_by_floor(void);
176 void slrp_highest(void);
179 void get_serv_info(char *, char *);
180 int uds_connectsock(char *);
181 int tcp_connectsock(char *, char *);
182 void serv_gets(char *strbuf);
183 void serv_puts(char *string);
185 void fmout(FILE * fp);
186 void wDumpContent(int);
187 void serv_printf(const char *format,...);
188 char *bstr(char *key);
189 char *urlesc(char *);
190 void urlescputs(char *);
191 void output_headers(int);
192 void wprintf(const char *format,...);
193 void extract(char *dest, char *source, int parmnum);
194 int extract_int(char *source, int parmnum);
195 void output_static(char *what);
196 void stresc(char *target, char *strbuf, int nbsp);
197 void escputs(char *strbuf);
199 void escputs1(char *strbuf, int nbsp);
200 long extract_long(char *source, long int parmnum);
201 void dump_vars(void);
202 void embed_main_menu(void);
203 void serv_read(char *buf, int bytes);
204 int haschar(char *, char);
205 void readloop(char *oper);
206 void text_to_server(char *ptr);
207 void display_enter(void);
208 void post_message(void);
209 void confirm_delete_msg(void);
210 void delete_msg(void);
211 void confirm_move_msg(void);
215 void display_page(void);
216 void page_user(void);
218 void display_private(char *rname, int req_pass);
219 void goto_private(void);
220 void zapped_list(void);
221 void display_zap(void);
223 void display_error(char *);
224 void display_success(char *);
225 void display_entroom(void);
227 void display_editroom(void);
229 void display_whok(void);
230 void server_to_text(void);
231 void save_edit(char *description, char *enter_cmd, int regoto);
232 void display_edit(char *description, char *check_cmd,
233 char *read_cmd, char *save_cmd);
234 void gotoroom(char *gname, int display_name);
235 void confirm_delete_room(void);
236 void delete_room(void);
238 void display_graphics_upload(char *, char *, char *);
239 void do_graphics_upload(char *upl_cmd);
240 void serv_read(char *buf, int bytes);
241 void serv_gets(char *strbuf);
242 void serv_write(char *buf, int nbytes);
243 void serv_puts(char *string);
244 void serv_printf(const char *format,...);
245 void load_floorlist(void);
246 void select_floor_to_edit_pic(void);
247 void display_reg(int);
248 void register_user(void);
249 void display_changepw(void);
251 void display_edit_node(void);
252 void display_netconf(void);
253 void display_confirm_unshare(void);
254 void display_confirm_delete_node(void);
255 void delete_node(void);
257 void display_add_node(void);
259 void display_share(void);
261 void terminate_session(void);
263 void display_siteconfig(void);
264 void siteconfig(void);
265 void display_generic(void);
266 void do_generic(void);
267 void display_menubar(int);
268 void embed_room_banner(char *);
269 void smart_goto(char *);
270 void worker_entry(void);
271 void session_loop(struct httprequest *);
272 void mime_parser(char *content,
279 void *cbcontent, char *cbtype, size_t cblength)
281 void fmt_date(char *buf, time_t thetime);
282 void httpdate(char *buf, time_t thetime);
283 void end_webcit_session(void);
284 void page_popup(void);
285 void http_redirect(char *);
286 void clear_local_substs(void);
287 void svprintf(char *keyname, int keytype, const char *format,...);
288 void svcallback(char *keyname, void (*fcn_ptr)() );
289 void do_template(void *templatename);
290 int lingering_close(int fd);