|
|
1.1 root 1: /* sbbsinet.h */
2:
3: /* Synchronet platform-specific Internet stuff */
4:
5: /* $Id: sbbsinet.h,v 1.11 2000/11/29 05:15:21 rswindell Exp $ */
6:
7: /****************************************************************************
8: * @format.tab-size 4 (Plain Text/Source Code File Header) *
9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
10: * *
11: * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
12: * *
13: * This program is free software; you can redistribute it and/or *
14: * modify it under the terms of the GNU General Public License *
15: * as published by the Free Software Foundation; either version 2 *
16: * of the License, or (at your option) any later version. *
17: * See the GNU General Public License for more details: gpl.txt or *
18: * http://www.fsf.org/copyleft/gpl.html *
19: * *
20: * Anonymous FTP access to the most recent released source is available at *
21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
22: * *
23: * Anonymous CVS access to the development source and modification history *
24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
26: * (just hit return, no password is necessary) *
27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
28: * *
29: * For Synchronet coding style and modification guidelines, see *
30: * http://www.synchro.net/source.html *
31: * *
32: * You are encouraged to submit any modifications (preferably in Unix diff *
33: * format) via e-mail to [email protected] *
34: * *
35: * Note: If this box doesn't appear square, then you need to fix your tabs. *
36: ****************************************************************************/
37:
38: #ifndef _SBBSINET_H
39: #define _SBBSINET_H
40:
41: /***************/
42: /* OS-specific */
43: /***************/
44: #if defined _WIN32 || defined __OS2__ /* Use WinSock */
45:
46: #include <winsock.h> /* socket/bind/etc. */
47:
48: /* Let's agree on a standard WinSock symbol here, people */
49: #ifndef _WINSOCKAPI_
50: #define _WINSOCKAPI_
51: #endif
52:
53: #elif defined __unix__ /* Unix-variant */
54:
55: #include <netdb.h> /* gethostbyname */
56: #include <netinet/in.h> /* IPPROTO_IP */
57: #include <sys/socket.h> /* socket/bind/etc. */
58: #include <sys/ioctl.h> /* FIONBIO */
59: #include <sys/time.h> /* struct timeval */
60: #include <arpa/inet.h> /* inet_ntoa */
61: #include <unistd.h> /* close */
62: #include <errno.h> /* errno */
63:
64: #endif
65:
66: /**********************************/
67: /* Socket Implementation-specific */
68: /**********************************/
69: #ifdef _WINSOCKAPI_
70:
71: #undef EINTR
72: #define EINTR WSAEINTR
73: #undef ENOTSOCK
74: #define ENOTSOCK WSAENOTSOCK
75: #undef EWOULDBLOCK
76: #define EWOULDBLOCK WSAEWOULDBLOCK
77: #undef ECONNRESET
78: #define ECONNRESET WSAECONNRESET
79: #undef ECONNABORTED
80: #define ECONNABORTED WSAECONNABORTED
81:
82: #define s_addr S_un.S_addr
83:
84: #define socklen_t int
85:
86: #define ERROR_VALUE WSAGetLastError()
87:
88: #else /* BSD sockets */
89:
90: /* WinSock-isms */
91: #define HOSTENT struct hostent
92: #define SOCKADDR_IN struct sockaddr_in
93: #define LINGER struct linger
94: #define SOCKET int
95: #define SOCKET_ERROR -1
96: #define INVALID_SOCKET (SOCKET)(~0)
97: #define closesocket close
98: #define ioctlsocket ioctl
99: #define ERROR_VALUE errno
100:
101: #endif /* __unix__ */
102:
103: #ifndef SHUT_RDWR
104: #define SHUT_RDWR 2 /* for shutdown() */
105: #endif
106:
107: #endif /* Don't add anything after this line */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.