~vlad-lesin/percona-server/mysql-5.0.33-original

« back to all changes in this revision

Viewing changes to ndb/include/portlib/NdbTCP.h

  • Committer: Vlad Lesin
  • Date: 2012-07-31 09:21:34 UTC
  • Revision ID: vladislav.lesin@percona.com-20120731092134-zfodx022b7992wsi
VirginĀ 5.0.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; either version 2 of the License, or
 
6
   (at your option) any later version.
 
7
 
 
8
   This program is distributed in the hope that it will be useful,
 
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
   GNU General Public License for more details.
 
12
 
 
13
   You should have received a copy of the GNU General Public License
 
14
   along with this program; if not, write to the Free Software
 
15
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
16
 
 
17
#ifndef NDB_TCP_H
 
18
#define NDB_TCP_H
 
19
 
 
20
#include <ndb_global.h>
 
21
#include <ndb_net.h>
 
22
 
 
23
#if defined NDB_OSE || defined NDB_SOFTOSE
 
24
/**
 
25
 * Include files needed
 
26
 */
 
27
#include "inet.h"
 
28
 
 
29
#include <netdb.h>
 
30
 
 
31
#define NDB_NONBLOCK FNDELAY
 
32
#define NDB_SOCKET_TYPE int
 
33
#define NDB_INVALID_SOCKET -1
 
34
#define _NDB_CLOSE_SOCKET(x) close(x)
 
35
 
 
36
/**
 
37
 * socklen_t not defined in the header files of OSE 
 
38
 */
 
39
typedef int socklen_t;
 
40
 
 
41
#define InetErrno (* inet_errno())
 
42
 
 
43
#elif defined NDB_WIN32
 
44
 
 
45
/**
 
46
 * Include files needed
 
47
 */
 
48
#include <winsock2.h>
 
49
#include <ws2tcpip.h>
 
50
 
 
51
#define InetErrno WSAGetLastError()
 
52
#define EWOULDBLOCK WSAEWOULDBLOCK
 
53
#define NDB_SOCKET_TYPE SOCKET
 
54
#define NDB_INVALID_SOCKET INVALID_SOCKET
 
55
#define _NDB_CLOSE_SOCKET(x) closesocket(x)
 
56
 
 
57
#else
 
58
 
 
59
/**
 
60
 * Include files needed
 
61
 */
 
62
#include <netdb.h>
 
63
 
 
64
#define NDB_NONBLOCK O_NONBLOCK
 
65
#define NDB_SOCKET_TYPE int
 
66
#define NDB_INVALID_SOCKET -1
 
67
#define _NDB_CLOSE_SOCKET(x) ::close(x)
 
68
 
 
69
#define InetErrno errno
 
70
 
 
71
#endif
 
72
 
 
73
#define NDB_SOCKLEN_T SOCKET_SIZE_TYPE
 
74
 
 
75
#ifdef  __cplusplus
 
76
extern "C" {
 
77
#endif
 
78
 
 
79
/**
 
80
 * Convert host name or ip address to in_addr
 
81
 *
 
82
 * Returns  0 on success
 
83
 *         -1 on failure
 
84
 *
 
85
 * Implemented as:
 
86
 *   gethostbyname
 
87
 *   if not success
 
88
 *      inet_addr
 
89
 */
 
90
int Ndb_getInAddr(struct in_addr * dst, const char *address);
 
91
 
 
92
#ifdef DBUG_OFF
 
93
#define NDB_CLOSE_SOCKET(fd) _NDB_CLOSE_SOCKET(fd)
 
94
#else
 
95
int NDB_CLOSE_SOCKET(int fd);
 
96
#endif
 
97
 
 
98
int Ndb_check_socket_hup(NDB_SOCKET_TYPE sock);
 
99
 
 
100
#ifdef  __cplusplus
 
101
}
 
102
#endif
 
103
 
 
104
#endif