00001 /* Copyright (C) 2003 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifndef NDB_TCP_H 00018 #define NDB_TCP_H 00019 00020 #include <ndb_global.h> 00021 #include <ndb_net.h> 00022 00023 #if defined NDB_OSE || defined NDB_SOFTOSE 00024 00027 #include "inet.h" 00028 00029 #include <netdb.h> 00030 00031 #define NDB_NONBLOCK FNDELAY 00032 #define NDB_SOCKET_TYPE int 00033 #define NDB_INVALID_SOCKET -1 00034 #define _NDB_CLOSE_SOCKET(x) close(x) 00035 00039 typedef int socklen_t; 00040 00041 #define InetErrno (* inet_errno()) 00042 00043 #elif defined NDB_WIN32 00044 00048 #include <winsock2.h> 00049 #include <ws2tcpip.h> 00050 00051 #define InetErrno WSAGetLastError() 00052 #define EWOULDBLOCK WSAEWOULDBLOCK 00053 #define NDB_SOCKET_TYPE SOCKET 00054 #define NDB_INVALID_SOCKET INVALID_SOCKET 00055 #define _NDB_CLOSE_SOCKET(x) closesocket(x) 00056 00057 #else 00058 00062 #include <netdb.h> 00063 00064 #define NDB_NONBLOCK O_NONBLOCK 00065 #define NDB_SOCKET_TYPE int 00066 #define NDB_INVALID_SOCKET -1 00067 #define _NDB_CLOSE_SOCKET(x) ::close(x) 00068 00069 #define InetErrno errno 00070 00071 #endif 00072 00073 #define NDB_SOCKLEN_T SOCKET_SIZE_TYPE 00074 00075 #ifdef __cplusplus 00076 extern "C" { 00077 #endif 00078 00090 int Ndb_getInAddr(struct in_addr * dst, const char *address); 00091 00092 #ifdef DBUG_OFF 00093 #define NDB_CLOSE_SOCKET(fd) _NDB_CLOSE_SOCKET(fd) 00094 #else 00095 int NDB_CLOSE_SOCKET(int fd); 00096 #endif 00097 00098 int Ndb_check_socket_hup(NDB_SOCKET_TYPE sock); 00099 00100 #ifdef __cplusplus 00101 } 00102 #endif 00103 00104 #endif
1.4.7

