#include <ndb_global.h>
#include <ndb_net.h>
#include <netdb.h>
Go to the source code of this file.
Defines | |
| #define | InetErrno errno |
| #define | NDB_CLOSE_SOCKET(x) ::close(x) |
| #define | NDB_INVALID_SOCKET -1 |
| #define | NDB_NONBLOCK O_NONBLOCK |
| #define | NDB_SOCKET_TYPE int |
| #define | NDB_SOCKLEN_T SOCKET_SIZE_TYPE |
Functions | |
| int | Ndb_getInAddr (struct in_addr *dst, const char *address) |
|
|
Definition at line 69 of file NdbTCP.h. Referenced by TCP_Transporter::doReceive(), TCP_Transporter::doSend(), TCP_Transporter::setSocketNonBlocking(), and TCP_Transporter::setSocketOptions(). |
|
|
|
|
Include files needed Definition at line 64 of file NdbTCP.h. Referenced by TCP_Transporter::setSocketNonBlocking(). |
|
|
|
|
|
||||||||||||
|
Convert host name or ip address to in_addr Returns 0 on success -1 on failure Implemented as: gethostbyname if not success inet_addr Definition at line 24 of file NdbTCP.cpp. References GETHOSTBYNAME_BUFF_SIZE, INADDR_NONE, memcpy, min, my_gethostbyname_r(), and my_gethostbyname_r_free(). Referenced by MgmtSrvr::alloc_node_id(), checkTCPConstraints(), SocketClient::init(), SocketServer::setup(), Transporter::Transporter(), SocketServer::tryBind(), and ConfigRetriever::verifyConfig(). 00024 { 00025 // DBUG_ENTER("Ndb_getInAddr"); 00026 { 00027 int tmp_errno; 00028 struct hostent tmp_hostent, *hp; 00029 char buff[GETHOSTBYNAME_BUFF_SIZE]; 00030 hp = my_gethostbyname_r(address,&tmp_hostent,buff,sizeof(buff), 00031 &tmp_errno); 00032 if (hp) 00033 { 00034 memcpy(dst, hp->h_addr, min(sizeof(*dst), (size_t) hp->h_length)); 00035 my_gethostbyname_r_free(); 00036 return 0; //DBUG_RETURN(0); 00037 } 00038 my_gethostbyname_r_free(); 00039 } 00040 /* Try it as aaa.bbb.ccc.ddd. */ 00041 dst->s_addr = inet_addr(address); 00042 if (dst->s_addr != 00043 #ifdef INADDR_NONE 00044 INADDR_NONE 00045 #else 00046 -1 00047 #endif 00048 ) 00049 { 00050 return 0; //DBUG_RETURN(0); 00051 } 00052 // DBUG_PRINT("error",("inet_addr(%s) - %d - %s", 00053 // address, errno, strerror(errno))); 00054 return -1; //DBUG_RETURN(-1); 00055 }
|
1.4.3