* custom sockets need to work buffered too...
[citadel.git] / citadel / clientsocket.h
1 /*
2  * $Id$
3  *
4  * Header file for TCP client socket library
5  *
6  * Copyright (c) 1987-2009 by the citadel.org team
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 3 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 int sock_connect(char *host, char *service, char *protocol);
24 int sock_read_to(int *sock, char *buf, int bytes, int timeout, int keep_reading_until_full);
25 int sock_read(int *sock, char *buf, int bytes, int keep_reading_until_full);
26 int sock_write(int sock, char *buf, int nbytes);
27 int ml_sock_gets(int *sock, char *buf);
28 int sock_getln(int *sock, char *buf, int bufsize);
29 int CtdlSockGetLine(int *sock, StrBuf *Target);
30 int sock_puts(int sock, char *buf);
31
32
33 /* 
34  * This looks dumb, but it's being done for future portability
35  */
36 #define sock_close(sock)                close(sock)
37 #define sock_shutdown(sock, how)        shutdown(sock, how)
38
39 /* 
40  * Default timeout for client sessions
41  */
42 #define CLIENT_TIMEOUT          600