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 (FILE *)NULL on error */
12 int SockOpen(const char *host, const char *service, const char *options,
14 #else /* INET6_ENABLE */
15 int SockOpen(const char *host, int clientPort, const char *options,
17 #endif /* INET6_ENABLE */
19 /* Returns 1 if this socket is OK, 0 if it isn't select()able
20 * on - probably because it's been closed. You should
21 * always check this function before passing stuff to the
22 * select()-based waiter, as otherwise it may loop.
24 int SockCheckOpen(int fd);
27 Get a string terminated by an '\n' (matches interface of fgets).
28 Pass it a valid socket, a buffer for the string, and
29 the length of the buffer (including the trailing \0)
30 returns length of buffer on success, -1 on failure.
32 int SockRead(int sock, char *buf, int len);
35 * Peek at the next socket character without actually reading it.
37 int SockPeek(int sock);
40 Write a chunk of bytes to the socket (matches interface of fwrite).
41 Returns number of bytes successfully written.
43 int SockWrite(int sock, char *buf, int size);
46 Send formatted output to the socket (matches interface of fprintf).
47 Returns number of bytes successfully written.
49 #if defined(HAVE_STDARG_H)
50 int SockPrintf(int sock, const char *format, ...) ;
56 Close a socket previously opened by SockOpen. This allows for some
57 additional clean-up if necessary.
59 int SockClose(int sock);
64 int UnixOpen(const char *path);
67 int SSLOpen(int sock, char *mycert, char *mykey, char *myproto, int certck, char *certpath,
68 char *fingerprint, char *servercname, char *label);
69 #endif /* SSL_ENABLE */