source: sock.h @ 12c6634

Last change on this file since 12c6634 was 701acdd4, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-12-16T17:58:00Z

Non-blocking SSL handshakes for GnuTLS. The rest might come later, but is
slightly less important.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#ifndef _WIN32
2#include <unistd.h>
3#include <sys/socket.h>
4#include <netinet/in.h>
5#include <arpa/inet.h>
6#include <netdb.h>
7#define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK)
8#define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0)
9#define sockerr_again() (errno == EINPROGRESS || errno == EINTR)
10#define closesocket(a) close(a)
11#else
12# include <winsock2.h>
13# ifndef _MSC_VER
14#  include <ws2tcpip.h>
15# endif
16# if !defined(BITLBEE_CORE) && defined(_MSC_VER)
17#   pragma comment(lib,"bitlbee.lib")
18# endif
19# include <io.h>
20# define read(a,b,c) recv(a,b,c,0)
21# define write(a,b,c) send(a,b,c,0)
22# define umask _umask
23# define mode_t int
24# define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); }
25# define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); }
26# define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK)
27# define ETIMEDOUT WSAETIMEDOUT
28# define sleep(a) Sleep(a*1000)
29#endif
Note: See TracBrowser for help on using the repository browser.