From 538a328f269dc13399dfeeb7a0e80a89657aa213 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 24 Jan 2024 16:32:07 -0500 Subject: [PATCH] Made our cproto output even more beautiful --- webcit-ng/server/webcit.h | 252 ++++++++++++++++++++++---------------- 1 file changed, 149 insertions(+), 103 deletions(-) diff --git a/webcit-ng/server/webcit.h b/webcit-ng/server/webcit.h index 70d4c420d..57f242f83 100644 --- a/webcit-ng/server/webcit.h +++ b/webcit-ng/server/webcit.h @@ -134,109 +134,155 @@ enum { #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 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_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 main(int argc, char **argv); -long locate_message_by_uid(struct ctdlsession *c, char *uid); -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 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); + +// Everything below here is generated with this command: +// cproto -f2 *.c 2>/dev/null |sed 's/^\/\*/\n\/\//g' | sed 's/\ \*\/$//g' + +// admin_functions.c +void try_login(struct http_transaction *, struct ctdlsession *); +void logout(struct http_transaction *, struct ctdlsession *); +void whoami(struct http_transaction *, struct ctdlsession *); +void biff(struct http_transaction *, struct ctdlsession *); +void ctdl_a(struct http_transaction *, struct ctdlsession *); + +// caldav_reports.c +void caldav_xml_start(void *, const char *, const char **); +void caldav_xml_end(void *, const char *); +void caldav_xml_chardata(void *, const XML_Char *, int); +StrBuf *fetch_ical(struct ctdlsession *, long); +void caldav_response(struct http_transaction *, struct ctdlsession *, StrBuf *, StrBuf *); +void caldav_report(struct http_transaction *, struct ctdlsession *); +void XXXXXXXXXXXXXX(struct http_transaction *, struct ctdlsession *, char *); + +// ctdlclient.c +int ctdl_read_binary(struct ctdlsession *, char *, int); +int ctdl_readline(struct ctdlsession *, char *, int); +StrBuf *ctdl_readtextmsg(struct ctdlsession *); +ssize_t ctdl_write(struct ctdlsession *, const void *, size_t); +void ctdl_printf(struct ctdlsession *, const char *, ...); +int uds_connectsock(char *); +void extract_auth(struct http_transaction *, char *, int); +int login_to_citadel(struct ctdlsession *, char *, char *); +struct ctdlsession *connect_to_citadel(struct http_transaction *); +void disconnect_from_citadel(struct ctdlsession *); + +// ctdl_commands.c +void serv_info(struct http_transaction *, struct ctdlsession *); +void ctdl_c(struct http_transaction *, struct ctdlsession *); + +// ctdlfunctions.c +void ctdl_delete_msgs(struct ctdlsession *, long *, int); + +// floor_functions.c +void floor_list(struct http_transaction *, struct ctdlsession *); +void ctdl_f(struct http_transaction *, struct ctdlsession *); + +// forum_view.c +void setup_for_forum_view(struct ctdlsession *); +JsonValue *json_tokenize_recipients(const char *, long, char *); +void json_render_one_message(struct http_transaction *, struct ctdlsession *, long); + +// html2html.c +void stripquotes(char *); +void extract_charset_from_meta(char *, char *, char *); +StrBuf *html2html(const char *, int, char *, long, StrBuf *); +void UrlizeText(StrBuf *, StrBuf *, StrBuf *); +void url(char *, size_t); + +// http.c +int client_write(struct client_handle *, char *, int); +int client_read(struct client_handle *, char *, int); +int client_readline(struct client_handle *, char *, int); +void client_printf(struct client_handle *, const char *, ...); +void add_response_header(struct http_transaction *, char *, char *); +void perform_one_http_transaction(struct client_handle *); +char *header_val(struct http_transaction *, char *); +char *get_url_param(struct http_transaction *, char *); + +// main.c +int main(int, char **); + +// messages.c +long locate_message_by_uid(struct ctdlsession *, char *); +void dav_delete_message(struct http_transaction *, struct ctdlsession *, long); +void dav_move_or_copy_message(struct http_transaction *, struct ctdlsession *, long, int); +void dav_get_message(struct http_transaction *, struct ctdlsession *, long); +void dav_put_message(struct http_transaction *, struct ctdlsession *, char *, long); +void download_mime_component(struct http_transaction *, struct ctdlsession *, long, char *); + +// request.c +void do_404(struct http_transaction *); +void do_405(struct http_transaction *); +void do_412(struct http_transaction *); +void do_204(struct http_transaction *); +void do_502(struct http_transaction *); +void request_http_authenticate(struct http_transaction *); +void http_redirect(struct http_transaction *, char *); +void perform_request(struct http_transaction *); + +// room_functions.c +Array *get_msglist(struct ctdlsession *, char *); +int match_etags(char *, long); +void json_stat(struct http_transaction *, struct ctdlsession *); +void json_mailbox(struct http_transaction *, struct ctdlsession *); +void json_msglist(struct http_transaction *, struct ctdlsession *, char *); +void read_room_info_banner(struct http_transaction *, struct ctdlsession *); +void set_last_read_pointer(struct http_transaction *, struct ctdlsession *); +void object_in_room(struct http_transaction *, struct ctdlsession *); +void report_the_room_itself(struct http_transaction *, struct ctdlsession *); +void options_the_room_itself(struct http_transaction *, struct ctdlsession *); +void propfind_the_room_itself(struct http_transaction *, struct ctdlsession *); +void get_the_room_itself(struct http_transaction *, struct ctdlsession *); +void the_room_itself(struct http_transaction *, struct ctdlsession *); +void room_list(struct http_transaction *, struct ctdlsession *); +void ctdl_r(struct http_transaction *, struct ctdlsession *); + +// static.c +void output_static(struct http_transaction *); + +// tcp_sockets.c +int lingering_close(int); +int webcit_tcp_server(const char *, int, int); +int webcit_uds_server(char *, int); + +// text2html.c +StrBuf *text2html(const char *, int, char *, long, StrBuf *); +StrBuf *variformat2html(StrBuf *); + +// tls.c 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); +void starttls(struct client_handle *); +void endtls(struct client_handle *); +int client_write_ssl(struct client_handle *, char *, int); +int client_read_ssl(struct client_handle *, char *, int); + +// upload.c +void upload_handler(char *, char *, char *, char *, void *, char *, char *, size_t, char *, char *, void *); +void upload_files(struct http_transaction *, struct ctdlsession *); +void ctdl_p_base(struct http_transaction *, struct ctdlsession *); +void delete_upload(struct uploaded_file); +void dav_delete_upload(struct http_transaction *, struct ctdlsession *, struct uploaded_file); +struct uploaded_file pop_upload(char *); +void attachment_filter(char *, char *, char *, char *, void *, char *, char *, size_t, char *, char *, void *); +void load_attachments_from_message(struct http_transaction *, struct ctdlsession *, char *); +void specific_upload(struct http_transaction *, struct ctdlsession *, char *); +void ctdl_p(struct http_transaction *, struct ctdlsession *); + +// user_functions.c +void fetch_user_photo(struct http_transaction *, struct ctdlsession *, char *); +void fetch_user_bio(struct http_transaction *, struct ctdlsession *, char *); +void object_in_user(struct http_transaction *, struct ctdlsession *, char *); +void the_user_itself(struct http_transaction *, struct ctdlsession *, char *); +void user_list(struct http_transaction *, struct ctdlsession *); +void ctdl_u(struct http_transaction *, struct ctdlsession *); + +// util.c +int unescape_input(char *); +char *http_datestring(time_t); + +// webserver.c +void spawn_another_worker_thread(int *); +void worker_entry(int *); +int webserver(char *, int, int); -- 2.30.2