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