]> Pileus Git - ~andy/fetchmail/blob - socket.h
Prototypes everywhere.
[~andy/fetchmail] / socket.h
1 /*
2  * socket.h -- declarations for socket library functions
3  *
4  * Design and implementation by Carl Harris <ceharris@mal.com>
5  *
6  * For license terms, see the file COPYING in this directory.
7  */
8
9 #ifndef SOCKET__
10 #define SOCKET__
11
12 /*
13 Create a new client socket 
14 returns (FILE *)NULL on error 
15 */
16 FILE *Socket(char *host, int clientPort);
17
18 /* 
19 Get a string terminated by an '\n', delete any '\r' and the '\n'.
20 Pass it a valid socket, a buffer for the string, and
21 the length of the buffer (including the trailing \0)
22 returns 0 for success. 
23 */
24 int SockGets(char *buf, int len, FILE *sockfp);
25
26 /*
27 Write a chunk of bytes to the socket.
28 Returns 0 for success.
29 */
30 int SockWrite(char *buf, int len, FILE *sockfp);
31
32 /* 
33 Send formatted output to the socket, followed
34 by a CR-LF.
35 Returns 0 for success.
36 */
37 #if defined(HAVE_STDARG_H)
38 int SockPrintf(FILE *sockfp, char *format, ...) ;
39 #else
40 int SockPrintf();
41 #endif
42  
43 #endif /* SOCKET__ */