indent -kr -i8 -brf -bbb -fnc -l132 -nce on all of webcit-classic
[citadel.git] / webcit / sockets.h
1
2 /*
3  * Copyright (c) 1996-2013 by the citadel.org team
4  *
5  * This program is open source software.  You can redistribute it and/or
6  * modify it under the terms of the GNU General Public License, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13
14 int connect_to_citadel(char *);
15 int connectsock(char *, char *);
16 int serv_getln(char *strbuf, int bufsize);
17 int StrBuf_ServGetln(StrBuf * buf);
18
19 /*
20  * parse & check the server reply 
21  *
22  * Line         the line containing the server reply
23  * FullState    if you need more than just the major number, this is returns it. Ignored if NULL.
24  * PutImportantMessage if you want to forward the text part of the server reply to the user, specify 1; 
25  *              the result will be put into the 'Important Message' framework.
26  * MajorOK      in case of which major number not to put the ImportantMessage? 0 for all.
27  *
28  * returns the most significant digit of the server status
29  */
30
31 int GetServerStatusMsg(StrBuf * Line, long *FullState, int PutImportantMessage, int MajorOK);
32
33 /*
34  * to migrate old calls.... 
35  */
36 #define GetServerStatus(a, b) GetServerStatusMsg(a, b, 0, 0)
37
38 int serv_puts(const char *string);
39
40 int serv_write(const char *buf, int nbytes);
41 int serv_putbuf(const StrBuf * string);
42 int serv_printf(const char *format, ...) __attribute__((__format__(__printf__, 1, 2)));
43 int serv_read_binary(StrBuf * Ret, size_t total_len, StrBuf * Buf);
44 void serv_read_binary_to_http(StrBuf * MimeType, size_t total_len, int is_static, int detect_mime);
45 int StrBuf_ServGetBLOB(StrBuf * buf, long BlobSize);
46 int StrBuf_ServGetBLOBBuffered(StrBuf * buf, long BlobSize);
47 int read_server_text(StrBuf * Buf, long *nLines);
48
49 void text_to_server(char *ptr);
50 void text_to_server_qp(const StrBuf * SendMeEncoded);
51 void server_to_text(void);
52 int lingering_close(int fd);