]> code.citadel.org Git - citadel.git/blobdiff - webcit-ng/server/webcit.h
Began refactoring CALDAV REPORT flow of control.
[citadel.git] / webcit-ng / server / webcit.h
index 64368b0e5c6169bb206a77d0f8b2e53c6c26522b..70d4c420dfb3b329ded553aeeca1abf4a674db91 100644 (file)
@@ -34,6 +34,7 @@
 #include <stdarg.h>
 #include <limits.h>
 #include <iconv.h>
+#include <libical/ical.h>
 #include <libcitadel.h>
 #define OPENSSL_NO_KRB5                                // Work around RedHat's b0rken OpenSSL includes
 #include <openssl/ssl.h>
@@ -64,7 +65,8 @@ struct http_transaction {                     // The lifetime of an HTTP request goes through this
        char *http_version;                     // stack and sent back down to the web server, which transmits it to
        char *site_prefix;                      // the client.
        Array *request_headers;
-       char *request_body;
+       char *request_body_with_synth_headers;  // This is the request body with some synthetic headers prepended into it.
+       char *request_body;                     // this is just going to be a pointer into request_body_with_synth_headers
        long request_body_length;
        Array *request_parms;                   // anything after the "?" in the URL
        int response_code;
@@ -96,7 +98,7 @@ struct ctdlsession {
 };
 
 struct uploaded_file {                         // things that have been uploaded to the server (such as email attachments)
-       char id[64];
+       char id[10];
        char filename[256];
        char content_type[256];
        long length;
@@ -127,55 +129,114 @@ enum {
 #define CTDL_DIR               "/usr/local/citadel"
 #define DEVELOPER_ID           0
 #define CLIENT_ID              4
-#define TARGET                 "webcit02"      /* Window target for inline URL's */
+#define TARGET                 "webcit02"      // Window target for inline URL's
 #define ROOMNAMELEN            128             // The size of a roomname string
 #define        DAV_MOVE                0               // MOVE=0 COPY=1 don't change these!
 #define DAV_COPY               1               // they are the values used in the Citadel Server MOVE command
 
-void worker_entry(int *);
-void perform_one_http_transaction(struct client_handle *ch);
+void try_login(struct http_transaction *h, struct ctdlsession *c);
+void logout(struct http_transaction *h, struct ctdlsession *c);
+void whoami(struct http_transaction *h, struct ctdlsession *c);
+void biff(struct http_transaction *h, struct ctdlsession *c);
+void ctdl_a(struct http_transaction *h, struct ctdlsession *c);
+void caldav_xml_start(void *data, const char *el, const char **attr);
+void caldav_xml_end(void *data, const char *el);
+void caldav_xml_chardata(void *data, const XML_Char *s, int len);
+StrBuf *fetch_ical(struct ctdlsession *c, long msgnum);
+void caldav_response(struct http_transaction *h, struct ctdlsession *c, StrBuf *ReportOut, StrBuf *ThisHref);
+void caldav_report(struct http_transaction *h, struct ctdlsession *c);
+int ctdl_read_binary(struct ctdlsession *ctdl, char *buf, int bytes_requested);
+int ctdl_readline(struct ctdlsession *ctdl, char *buf, int maxbytes);
+StrBuf *ctdl_readtextmsg(struct ctdlsession *ctdl);
+ssize_t ctdl_write(struct ctdlsession *ctdl, const void *buf, size_t count);
+void ctdl_printf(struct ctdlsession *ctdl, const char *format, ...);
+int uds_connectsock(char *sockpath);
+void extract_auth(struct http_transaction *h, char *authbuf, int authbuflen);
+int login_to_citadel(struct ctdlsession *c, char *auth, char *resultbuf);
+struct ctdlsession *connect_to_citadel(struct http_transaction *h);
+void disconnect_from_citadel(struct ctdlsession *ctdl);
+void serv_info(struct http_transaction *h, struct ctdlsession *c);
+void ctdl_c(struct http_transaction *h, struct ctdlsession *c);
+void ctdl_delete_msgs(struct ctdlsession *c, long *msgnums, int num_msgs);
+void floor_list(struct http_transaction *h, struct ctdlsession *c);
+void ctdl_f(struct http_transaction *h, struct ctdlsession *c);
+void setup_for_forum_view(struct ctdlsession *c);
+JsonValue *json_tokenize_recipients(const char *Key, long keylen, char *recp);
+void json_render_one_message(struct http_transaction *h, struct ctdlsession *c, long msgnum);
+void stripquotes(char *s);
+void extract_charset_from_meta(char *charset, char *meta_http_equiv, char *meta_content);
+StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf *Source);
+void UrlizeText(StrBuf *Target, StrBuf *Source, StrBuf *WrkBuf);
+void url(char *buf, size_t bufsize);
+int client_write(struct client_handle *ch, char *buf, int nbytes);
+int client_read(struct client_handle *ch, char *buf, int nbytes);
+int client_readline(struct client_handle *ch, char *buf, int maxbytes);
+void client_printf(struct client_handle *ch, const char *format, ...);
 void add_response_header(struct http_transaction *h, char *key, char *val);
-void perform_request(struct http_transaction *);
-void do_204(struct http_transaction *);
-void do_404(struct http_transaction *);
-void do_405(struct http_transaction *);
-void do_412(struct http_transaction *);
-void do_502(struct http_transaction *);
-void output_static(struct http_transaction *);
-int uds_connectsock(char *);
-void ctdl_a(struct http_transaction *, struct ctdlsession *);
-void ctdl_f(struct http_transaction *, struct ctdlsession *);
-void ctdl_r(struct http_transaction *, struct ctdlsession *);
-void ctdl_u(struct http_transaction *, struct ctdlsession *);
-void ctdl_p(struct http_transaction *, struct ctdlsession *);
-struct ctdlsession *connect_to_citadel(struct http_transaction *);
-void disconnect_from_citadel(struct ctdlsession *);
+void perform_one_http_transaction(struct client_handle *ch);
 char *header_val(struct http_transaction *h, char *requested_header);
 char *get_url_param(struct http_transaction *h, char *requested_param);
-int unescape_input(char *);
-void http_redirect(struct http_transaction *h, char *to_where);
-char *http_datestring(time_t xtime);
-long *get_msglist(struct ctdlsession *c, char *which_msgs);
-void caldav_report(struct http_transaction *h, struct ctdlsession *c);
+int main(int argc, char **argv);
 long locate_message_by_uid(struct ctdlsession *c, char *uid);
-void ctdl_delete_msgs(struct ctdlsession *c, long *msgnums, int num_msgs);
 void dav_delete_message(struct http_transaction *h, struct ctdlsession *c, long msgnum);
+void dav_move_or_copy_message(struct http_transaction *h, struct ctdlsession *c, long msgnum, int move_or_copy);
 void dav_get_message(struct http_transaction *h, struct ctdlsession *c, long msgnum);
 void dav_put_message(struct http_transaction *h, struct ctdlsession *c, char *euid, long old_msgnum);
-void dav_move_or_copy_message(struct http_transaction *h, struct ctdlsession *c, long msgnum, int move_or_copy);
-ssize_t ctdl_write(struct ctdlsession *ctdl, const void *buf, size_t count);
-int login_to_citadel(struct ctdlsession *c, char *auth, char *resultbuf);
-StrBuf *ctdl_readtextmsg(struct ctdlsession *ctdl);
-StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf *Source);
 void download_mime_component(struct http_transaction *h, struct ctdlsession *c, long msgnum, char *partnum);
+void do_404(struct http_transaction *h);
+void do_405(struct http_transaction *h);
+void do_412(struct http_transaction *h);
+void do_204(struct http_transaction *h);
+void do_502(struct http_transaction *h);
+void request_http_authenticate(struct http_transaction *h);
+void http_redirect(struct http_transaction *h, char *to_where);
+void perform_request(struct http_transaction *h);
+int match_etags(char *taglist, long msgnum);
+void json_stat(struct http_transaction *h, struct ctdlsession *c);
+void json_mailbox(struct http_transaction *h, struct ctdlsession *c);
+void json_msglist(struct http_transaction *h, struct ctdlsession *c, char *which);
+void read_room_info_banner(struct http_transaction *h, struct ctdlsession *c);
+void set_last_read_pointer(struct http_transaction *h, struct ctdlsession *c);
+void object_in_room(struct http_transaction *h, struct ctdlsession *c);
+void report_the_room_itself(struct http_transaction *h, struct ctdlsession *c);
+void options_the_room_itself(struct http_transaction *h, struct ctdlsession *c);
+void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c);
+void get_the_room_itself(struct http_transaction *h, struct ctdlsession *c);
+void the_room_itself(struct http_transaction *h, struct ctdlsession *c);
+void room_list(struct http_transaction *h, struct ctdlsession *c);
+void ctdl_r(struct http_transaction *h, struct ctdlsession *c);
+void output_static(struct http_transaction *h);
+int lingering_close(int fd);
+int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len);
+int webcit_uds_server(char *sockpath, int queue_len);
 StrBuf *text2html(const char *supplied_charset, int treat_as_wiki, char *roomname, long msgnum, StrBuf *Source);
 StrBuf *variformat2html(StrBuf *Source);
-int ctdl_readline(struct ctdlsession *ctdl, char *buf, int maxbytes);
-int ctdl_read_binary(struct ctdlsession *ctdl, char *buf, int bytes_requested);
-void ctdl_c(struct http_transaction *h, struct ctdlsession *c);
-int webserver(char *webserver_interface, int webserver_port, int webserver_protocol);
-void ctdl_printf(struct ctdlsession *ctdl, const char *format,...);
-int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len);
-void UrlizeText(StrBuf* Target, StrBuf *Source, StrBuf *WrkBuf);
-void json_render_one_message(struct http_transaction *h, struct ctdlsession *c, long msgnum);
+void bind_to_key_and_certificate(void);
+void init_ssl(void);
+void update_key_and_cert_if_needed(void);
+void starttls(struct client_handle *ch);
+void endtls(struct client_handle *ch);
+int client_write_ssl(struct client_handle *ch, char *buf, int nbytes);
+int client_read_ssl(struct client_handle *ch, char *buf, int nbytes);
+void upload_handler(char *name, char *filename, char *partnum, char *disp, void *content, char *cbtype, char *cbcharset, size_t length, char *encoding, char *cbid, void *userdata);
 void upload_files(struct http_transaction *h, struct ctdlsession *c);
+void ctdl_p_base(struct http_transaction *h, struct ctdlsession *c);
+void delete_upload(struct uploaded_file this_one);
+void dav_delete_upload(struct http_transaction *h, struct ctdlsession *c, struct uploaded_file this_one);
+struct uploaded_file pop_upload(char *id);
+void attachment_filter(char *name, char *filename, char *partnum, char *disp, void *content, char *cbtype, char *cbcharset, size_t length, char *encoding, char *cbid, void *userdata);
+void load_attachments_from_message(struct http_transaction *h, struct ctdlsession *c, char *name);
+void specific_upload(struct http_transaction *h, struct ctdlsession *c, char *name);
+void ctdl_p(struct http_transaction *h, struct ctdlsession *c);
+void fetch_user_photo(struct http_transaction *h, struct ctdlsession *c, char *username);
+void fetch_user_bio(struct http_transaction *h, struct ctdlsession *c, char *username);
+void object_in_user(struct http_transaction *h, struct ctdlsession *c, char *requested_username);
+void the_user_itself(struct http_transaction *h, struct ctdlsession *c, char *username);
+void user_list(struct http_transaction *h, struct ctdlsession *c);
+void ctdl_u(struct http_transaction *h, struct ctdlsession *c);
+int unescape_input(char *buf);
+char *http_datestring(time_t xtime);
+void spawn_another_worker_thread(int *pointer_to_master_socket);
+void worker_entry(int *pointer_to_master_socket);
+int webserver(char *webserver_interface, int webserver_port, int webserver_protocol);
+Array *get_msglist(struct ctdlsession *c, char *which_msgs);