* Brought over the SSL/TLS stuff from Citadel. I think it's complete but
[citadel.git] / webcit / webcit.h
index ee5018bdc0351da4bd68f795bfd569a771de1de7..afb3c9d7b406bfe2c203642de0b2556166e869ca 100644 (file)
 #include <ical.h>
 #endif
 
+#ifdef HAVE_OPENSSL
+/* Work around RedHat's b0rken OpenSSL includes */
+#define OPENSSL_NO_KRB5
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#endif
+
 #define CALENDAR_ROOM_NAME     "Calendar"
 #define PRODID "-//Citadel//NONSGML Citadel Calendar//EN"
 
 #define SLEEPING               180             /* TCP connection timeout */
 #define WEBCIT_TIMEOUT         900             /* WebCit session timeout */
 #define PORT_NUM               2000            /* port number to listen on */
-#define SERVER                 "WebCit v5.02"  /* who's in da house */
+#define SERVER                 "WebCit v5.06"  /* who's in da house */
 #define DEVELOPER_ID           0
 #define CLIENT_ID              4
-#define CLIENT_VERSION         502             /* This version of WebCit */
+#define CLIENT_VERSION         506             /* This version of WebCit */
 #define MINIMUM_CIT_VERSION    611             /* min required Citadel vers */
 #define DEFAULT_HOST           "localhost"     /* Default Citadel server */
 #define DEFAULT_PORT           "504"
@@ -37,7 +45,8 @@
 #define QU                     (3)
 #define TARGET                 "webcit01"      /* Target for inline URL's */
 #define HOUSEKEEPING           15              /* Housekeeping frequency */
-#define INITIAL_WORKER_THREADS 5
+#define MIN_WORKER_THREADS     5
+#define MAX_WORKER_THREADS     250
 #define LISTEN_QUEUE_LENGTH    100             /* listen() backlog queue */
 
 #define USERCONFIGROOM         "My Citadel Config"
@@ -113,7 +122,7 @@ struct serv_info {
  */
 struct march {
        struct march *next;
-       char march_name[32];
+       char march_name[128];
        int march_floor;
        int march_order;
 };
@@ -125,7 +134,7 @@ struct march {
 struct roomlisting {
        struct roomlisting *lnext;
        struct roomlisting *rnext;
-       char rlname[64];
+       char rlname[128];
        unsigned rlflags;
        int rlfloor;
        int rlorder;
@@ -162,7 +171,6 @@ struct wc_attachment {
        char *data;
 };
 
-
 /*
  * One of these is kept for each active Citadel session.
  * HTTP transactions are bound to one at a time.
@@ -180,6 +188,7 @@ struct wcsession {
        int is_room_aide;
        int http_sock;
        int serv_sock;
+       int chat_sock;
        unsigned room_flags;
        int wc_view;
        int wc_default_view;
@@ -215,6 +224,12 @@ struct wcsession {
 #endif
        struct wc_attachment *first_attachment;
        char ImportantMessage[SIZ];
+       int outside_frameset_allowed;   /* nonzero if current req is allowed
+                                        * outside of the main frameset */
+       char last_chat_user[SIZ];
+#ifdef HAVE_OPENSSL
+       SSL *ssl;
+#endif
 };
 
 #define extract(dest,source,parmnum)   extract_token(dest,source,parmnum,'|')
@@ -228,6 +243,7 @@ extern char floorlist[128][SIZ];
 extern char *axdefs[];
 extern char *ctdlhost, *ctdlport;
 extern char *server_cookie;
+extern int is_https;
 
 extern struct wcsubst *global_subst;
 
@@ -259,6 +275,8 @@ void serv_printf(const char *format,...);
 char *bstr(char *key);
 void urlesc(char *, char *);
 void urlescputs(char *);
+void jsesc(char *, char *);
+void jsescputs(char *);
 void output_headers(int);
 void wprintf(const char *format,...);
 void output_static(char *what);
@@ -340,6 +358,8 @@ void fmt_time(char *buf, time_t thetime);
 void httpdate(char *buf, time_t thetime);
 void end_webcit_session(void);
 void page_popup(void);
+void chat_recv(void);
+void chat_send(void);
 void http_redirect(char *);
 void clear_local_substs(void);
 void svprintf(char *keyname, int keytype, const char *format,...);
@@ -357,9 +377,10 @@ void edit_vcard(void);
 void submit_vcard(void);
 void striplt(char *);
 void select_user_to_edit(char *message, char *preselect);
-void display_edituser(char *who);
+void display_edituser(char *who, int is_new);
 void create_user(void);
 void edituser(void);
+void do_change_view(int);
 void change_view(void);
 void folders(void);
 void do_stuff_to_msgs(void);
@@ -427,3 +448,15 @@ void do_iconbar(void);
 void display_customize_iconbar(void);
 void commit_iconbar(void);
 int CtdlDecodeQuotedPrintable(char *decoded, char *encoded, int sourcelen);
+void spawn_another_worker_thread(void);
+
+
+
+#ifdef HAVE_OPENSSL
+void init_ssl(void);
+void endtls(void);
+void ssl_lock(int mode, int n, const char *file, int line);
+int starttls(void);
+extern SSL_CTX *ssl_ctx;  
+#endif
+