2 * socket.h -- declarations for socket library functions
4 * For license terms, see the file COPYING in this directory.
10 /* Create a new client socket; returns -1 on error */
11 int SockOpen(const char *host, const char *service, const char *plugin);
13 /* Returns 1 if this socket is OK, 0 if it isn't select()able
14 * on - probably because it's been closed. You should
15 * always check this function before passing stuff to the
16 * select()-based waiter, as otherwise it may loop.
18 int SockCheckOpen(int fd);
21 Get a string terminated by an '\n' (matches interface of fgets).
22 Pass it a valid socket, a buffer for the string, and
23 the length of the buffer (including the trailing \0)
24 returns length of buffer on success, -1 on failure.
26 int SockRead(int sock, char *buf, int len);
29 * Peek at the next socket character without actually reading it.
31 int SockPeek(int sock);
34 Write a chunk of bytes to the socket (matches interface of fwrite).
35 Returns number of bytes successfully written.
37 int SockWrite(int sock, char *buf, int size);
40 Send formatted output to the socket (matches interface of fprintf).
41 Returns number of bytes successfully written.
43 #if defined(HAVE_STDARG_H)
44 int SockPrintf(int sock, const char *format, ...) ;
50 Close a socket previously opened by SockOpen. This allows for some
51 additional clean-up if necessary.
53 int SockClose(int sock);
58 int UnixOpen(const char *path);
61 int SSLOpen(int sock, char *mycert, char *mykey, char *myproto, int certck, char *certpath,
62 char *fingerprint, char *servercname, char *label);
63 #endif /* SSL_ENABLE */