#include <Transporter.hpp>
Inheritance diagram for Transporter:


Definition at line 32 of file Transporter.hpp.
| Transporter::~Transporter | ( | ) | [virtual] |
Destructor
Definition at line 92 of file Transporter.cpp.
References m_socket_client.
00092 { 00093 if (m_socket_client) 00094 delete m_socket_client; 00095 }
| Transporter::Transporter | ( | TransporterRegistry & | , | |
| TransporterType | , | |||
| const char * | lHostName, | |||
| const char * | rHostName, | |||
| int | s_port, | |||
| bool | isMgmConnection, | |||
| NodeId | lNodeId, | |||
| NodeId | rNodeId, | |||
| NodeId | serverNodeId, | |||
| int | byteorder, | |||
| bool | compression, | |||
| bool | checksum, | |||
| bool | signalId | |||
| ) | [protected] |
Definition at line 30 of file Transporter.cpp.
References byteOrder, checksumUsed, compressionUsed, DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, exit, isServer, localHostAddress, localHostName, localNodeId, m_connect_address, m_connected, m_socket_client, m_timeOutMillis, Ndb_getInAddr(), ndbout(), remoteHostAddress, remoteHostName, remoteNodeId, signalIdUsed, and strlen().
00041 : m_s_port(s_port), remoteNodeId(rNodeId), localNodeId(lNodeId), 00042 isServer(lNodeId==serverNodeId), isMgmConnection(_isMgmConnection), 00043 m_packer(_signalId, _checksum), 00044 m_type(_type), 00045 m_transporter_registry(t_reg) 00046 { 00047 DBUG_ENTER("Transporter::Transporter"); 00048 if (rHostName && strlen(rHostName) > 0){ 00049 strncpy(remoteHostName, rHostName, sizeof(remoteHostName)); 00050 Ndb_getInAddr(&remoteHostAddress, rHostName); 00051 } 00052 else 00053 { 00054 if (!isServer) { 00055 ndbout << "Unable to setup transporter. Node " << rNodeId 00056 << " must have hostname. Update configuration." << endl; 00057 exit(-1); 00058 } 00059 remoteHostName[0]= 0; 00060 } 00061 strncpy(localHostName, lHostName, sizeof(localHostName)); 00062 00063 if (strlen(lHostName) > 0) 00064 Ndb_getInAddr(&localHostAddress, lHostName); 00065 00066 DBUG_PRINT("info",("rId=%d lId=%d isServer=%d rHost=%s lHost=%s s_port=%d", 00067 remoteNodeId, localNodeId, isServer, 00068 remoteHostName, localHostName, 00069 s_port)); 00070 00071 byteOrder = _byteorder; 00072 compressionUsed = _compression; 00073 checksumUsed = _checksum; 00074 signalIdUsed = _signalId; 00075 00076 m_connected = false; 00077 m_timeOutMillis = 1000; 00078 00079 m_connect_address.s_addr= 0; 00080 if(s_port<0) 00081 s_port= -s_port; // was dynamic 00082 00083 if (isServer) 00084 m_socket_client= 0; 00085 else 00086 m_socket_client= new SocketClient(remoteHostName, s_port, 00087 new SocketAuthSimple("ndbd", 00088 "ndbd passwd")); 00089 DBUG_VOID_RETURN; 00090 }
Here is the call graph for this function:

| bool Transporter::connect_client | ( | NDB_SOCKET_TYPE | sockfd | ) |
Definition at line 139 of file Transporter.cpp.
References buf, connect_client_impl(), DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, Logger::error(), g_eventLogger, SocketInputStream::gets(), isMgmConnection, localNodeId, m_connect_address, m_connected, m_errorCount, m_s_port, m_type, NDB_CLOSE_SOCKET(), NDB_INVALID_SOCKET, SocketOutputStream::println(), SOCKET_SIZE_TYPE, tt_SHM_TRANSPORTER, and Logger::warning().
00139 { 00140 00141 if(m_connected) 00142 return true; 00143 00144 if (sockfd == NDB_INVALID_SOCKET) 00145 return false; 00146 00147 DBUG_ENTER("Transporter::connect_client"); 00148 00149 DBUG_PRINT("info",("port %d isMgmConnection=%d",m_s_port,isMgmConnection)); 00150 00151 SocketOutputStream s_output(sockfd); 00152 SocketInputStream s_input(sockfd); 00153 00154 // send info about own id 00155 // send info about own transporter type 00156 00157 s_output.println("%d %d", localNodeId, m_type); 00158 // get remote id 00159 int nodeId, remote_transporter_type= -1; 00160 00161 char buf[256]; 00162 if (s_input.gets(buf, 256) == 0) { 00163 NDB_CLOSE_SOCKET(sockfd); 00164 DBUG_RETURN(false); 00165 } 00166 00167 int r= sscanf(buf, "%d %d", &nodeId, &remote_transporter_type); 00168 switch (r) { 00169 case 2: 00170 break; 00171 case 1: 00172 // we're running version prior to 4.1.9 00173 // ok, but with no checks on transporter configuration compatability 00174 break; 00175 default: 00176 NDB_CLOSE_SOCKET(sockfd); 00177 DBUG_RETURN(false); 00178 } 00179 00180 DBUG_PRINT("info", ("nodeId=%d remote_transporter_type=%d", 00181 nodeId, remote_transporter_type)); 00182 00183 if (remote_transporter_type != -1) 00184 { 00185 if (remote_transporter_type != m_type) 00186 { 00187 DBUG_PRINT("error", ("Transporter types mismatch this=%d remote=%d", 00188 m_type, remote_transporter_type)); 00189 NDB_CLOSE_SOCKET(sockfd); 00190 g_eventLogger.error("Incompatible configuration: transporter type " 00191 "mismatch with node %d", nodeId); 00192 DBUG_RETURN(false); 00193 } 00194 } 00195 else if (m_type == tt_SHM_TRANSPORTER) 00196 { 00197 g_eventLogger.warning("Unable to verify transporter compatability with node %d", nodeId); 00198 } 00199 00200 { 00201 struct sockaddr_in addr; 00202 SOCKET_SIZE_TYPE addrlen= sizeof(addr); 00203 int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); 00204 m_connect_address= (&addr)->sin_addr; 00205 } 00206 00207 bool res = connect_client_impl(sockfd); 00208 if(res){ 00209 m_connected = true; 00210 m_errorCount = 0; 00211 } 00212 DBUG_RETURN(res); 00213 }
Here is the call graph for this function:

| bool Transporter::connect_client | ( | ) |
None blocking Use isConnected() to check status
Definition at line 124 of file Transporter.cpp.
References SocketClient::connect(), TransporterRegistry::connect_ndb_mgmd(), isMgmConnection, m_connected, m_socket_client, m_transporter_registry, and NDB_SOCKET_TYPE.
Referenced by TransporterRegistry::connect_client().
00124 { 00125 NDB_SOCKET_TYPE sockfd; 00126 00127 if(m_connected) 00128 return true; 00129 00130 if(isMgmConnection) 00131 sockfd= m_transporter_registry.connect_ndb_mgmd(m_socket_client); 00132 else 00133 sockfd= m_socket_client->connect(); 00134 00135 return connect_client(sockfd); 00136 }
Here is the call graph for this function:

Here is the caller graph for this function:

| virtual bool Transporter::connect_client_impl | ( | NDB_SOCKET_TYPE | sockfd | ) | [protected, pure virtual] |
Implemented in SCI_Transporter, SHM_Transporter, and TCP_Transporter.
Referenced by connect_client().
Here is the caller graph for this function:

| bool Transporter::connect_server | ( | NDB_SOCKET_TYPE | socket | ) |
Definition at line 98 of file Transporter.cpp.
References connect_server_impl(), DBUG_ENTER, DBUG_RETURN, m_connect_address, m_connected, m_errorCount, and SOCKET_SIZE_TYPE.
Referenced by TransporterRegistry::connect_server().
00098 { 00099 // all initial negotiation is done in TransporterRegistry::connect_server 00100 DBUG_ENTER("Transporter::connect_server"); 00101 00102 if(m_connected) 00103 { 00104 DBUG_RETURN(true); // TODO assert(0); 00105 } 00106 00107 { 00108 struct sockaddr_in addr; 00109 SOCKET_SIZE_TYPE addrlen= sizeof(addr); 00110 int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen); 00111 m_connect_address= (&addr)->sin_addr; 00112 } 00113 00114 bool res = connect_server_impl(sockfd); 00115 if(res){ 00116 m_connected = true; 00117 m_errorCount = 0; 00118 } 00119 00120 DBUG_RETURN(res); 00121 }
Here is the call graph for this function:

Here is the caller graph for this function:

| virtual bool Transporter::connect_server_impl | ( | NDB_SOCKET_TYPE | sockfd | ) | [protected, pure virtual] |
Blocking, for max timeOut milli seconds Returns true if connect succeded
Implemented in SCI_Transporter, SHM_Transporter, and TCP_Transporter.
Referenced by connect_server().
Here is the caller graph for this function:

| virtual void Transporter::disconnectImpl | ( | ) | [protected, pure virtual] |
Blocking
Implemented in OSE_Transporter, SCI_Transporter, SHM_Transporter, and TCP_Transporter.
Referenced by doDisconnect().
Here is the caller graph for this function:

| void Transporter::doDisconnect | ( | ) | [virtual] |
Blocking
Reimplemented in OSE_Transporter.
Definition at line 216 of file Transporter.cpp.
References disconnectImpl(), and m_connected.
Referenced by TCP_Transporter::doReceive(), TCP_Transporter::doSend(), SCI_Transporter::initLocalSegment(), TransporterRegistry::removeTransporter(), SCI_Transporter::setupRemoteSegment(), SCI_Transporter::~SCI_Transporter(), SHM_Transporter::~SHM_Transporter(), and TCP_Transporter::~TCP_Transporter().
00216 { 00217 00218 if(!m_connected) 00219 return; //assert(0); TODO will fail 00220 00221 m_connected= false; 00222 disconnectImpl(); 00223 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void* Transporter::get_callback_obj | ( | ) | [inline, protected] |
Definition at line 162 of file Transporter.hpp.
References TransporterRegistry::callbackObj, and m_transporter_registry.
Referenced by TCP_Transporter::doReceive(), TCP_Transporter::doSend(), and report_error().
00162 { return m_transporter_registry.callbackObj; };
Here is the caller graph for this function:

| virtual Uint32 Transporter::get_free_buffer | ( | ) | const [pure virtual] |
Implemented in SCI_Transporter, SHM_Transporter, and TCP_Transporter.
Referenced by TransporterRegistry::get_free_buffer().
Here is the caller graph for this function:

| int Transporter::get_s_port | ( | ) | [inline] |
Get port we're connecting to (signed)
Definition at line 76 of file Transporter.hpp.
References m_s_port.
00076 { return m_s_port; };
| Uint32 Transporter::getErrorCount | ( | ) | [inline, protected] |
Definition at line 188 of file Transporter.hpp.
References m_errorCount.
00189 { 00190 return m_errorCount; 00191 }
| NodeId Transporter::getLocalNodeId | ( | ) | const [inline] |
Local (own) Node Id
Definition at line 182 of file Transporter.hpp.
References localNodeId.
Referenced by TransporterRegistry::connect_server(), and SCI_Transporter::initLocalSegment().
00182 { 00183 return localNodeId; 00184 }
Here is the caller graph for this function:

| NodeId Transporter::getRemoteNodeId | ( | ) | const [inline] |
Remote Node Id
Definition at line 176 of file Transporter.hpp.
References remoteNodeId.
Referenced by TransporterRegistry::createOSETransporter(), TransporterRegistry::createSCITransporter(), TransporterRegistry::createSHMTransporter(), TransporterRegistry::createTCPTransporter(), and TransporterRegistry::performReceive().
00176 { 00177 return remoteNodeId; 00178 }
Here is the caller graph for this function:

Implemented in OSE_Transporter, SCI_Transporter, SHM_Transporter, and TCP_Transporter.
Referenced by TransporterRegistry::prepareSend().
Here is the caller graph for this function:

| virtual bool Transporter::initTransporter | ( | ) | [pure virtual] |
Implemented in OSE_Transporter, SCI_Transporter, SHM_Transporter, and TCP_Transporter.
| bool Transporter::isConnected | ( | ) | const [inline] |
Are we currently connected
Definition at line 170 of file Transporter.hpp.
References m_connected.
Referenced by OSE_Receiver::doReceive(), TransporterRegistry::performReceive(), and TransporterRegistry::prepareSend().
00170 { 00171 return m_connected; 00172 }
Here is the caller graph for this function:

| void Transporter::report_disconnect | ( | int | err | ) | [inline, protected] |
Definition at line 163 of file Transporter.hpp.
References m_transporter_registry, remoteNodeId, and TransporterRegistry::report_disconnect().
Referenced by TCP_Transporter::doReceive(), and TCP_Transporter::doSend().
00163 {m_transporter_registry.report_disconnect(remoteNodeId,err);};
Here is the call graph for this function:

Here is the caller graph for this function:

| void Transporter::report_error | ( | enum TransporterError | err, | |
| const char * | info = 0 | |||
| ) | [inline, protected] |
Definition at line 164 of file Transporter.hpp.
References get_callback_obj(), info, remoteNodeId, and reportError().
Referenced by SHM_Transporter::checkConnected(), SHM_Transporter::connect_client_impl(), SHM_Transporter::connect_server_impl(), TCP_Transporter::disconnectImpl(), SHM_Transporter::disconnectImpl(), SCI_Transporter::disconnectImpl(), SCI_Transporter::disconnectLocal(), SCI_Transporter::disconnectRemote(), TCP_Transporter::doReceive(), SCI_Transporter::doSend(), SCI_Transporter::init_local(), SCI_Transporter::init_remote(), SCI_Transporter::initTransporter(), and SCI_Transporter::setupRemoteSegment().
00165 { reportError(get_callback_obj(), remoteNodeId, err, info); };
Here is the call graph for this function:

Here is the caller graph for this function:

| void Transporter::set_s_port | ( | int | port | ) | [inline] |
Set port to connect to (signed)
Definition at line 81 of file Transporter.hpp.
References m_s_port, m_socket_client, and SocketClient::set_port().
00081 { 00082 m_s_port = port; 00083 if(port<0) 00084 port= -port; 00085 if(m_socket_client) 00086 m_socket_client->set_port(port); 00087 };
Here is the call graph for this function:

Implemented in OSE_Transporter, SCI_Transporter, SHM_Transporter, and TCP_Transporter.
Referenced by TransporterRegistry::prepareSend().
Here is the caller graph for this function:

friend class TransporterRegistry [friend] |
Reimplemented in OSE_Transporter, SCI_Transporter, SHM_Transporter, and TCP_Transporter.
Definition at line 33 of file Transporter.hpp.
int Transporter::byteOrder [protected] |
bool Transporter::checksumUsed [protected] |
bool Transporter::compressionUsed [protected] |
unsigned Transporter::createIndex [protected] |
Definition at line 133 of file Transporter.hpp.
bool Transporter::isMgmConnection [private] |
means that we transform an MGM connection into a transporter connection
Definition at line 147 of file Transporter.hpp.
Referenced by connect_client().
const bool Transporter::isServer [protected] |
Reimplemented in OSE_Transporter.
Definition at line 131 of file Transporter.hpp.
Referenced by SHM_Transporter::disconnectImpl(), SHM_Transporter::setupBuffers(), and Transporter().
struct in_addr Transporter::localHostAddress [protected] |
char Transporter::localHostName[256] [protected] |
const NodeId Transporter::localNodeId [protected] |
Definition at line 129 of file Transporter.hpp.
Referenced by OSE_Transporter::allocPrioASignal(), connect_client(), OSE_Transporter::connectReq(), OSE_Transporter::doDisconnect(), getLocalNodeId(), OSE_Transporter::huntReceived(), SCI_Transporter::init_remote(), SCI_Transporter::initLocalSegment(), OSE_Transporter::initSignals(), SHM_Transporter::setupBuffers(), and Transporter().
struct in_addr Transporter::m_connect_address [private] |
Definition at line 150 of file Transporter.hpp.
Referenced by connect_client(), connect_server(), and Transporter().
bool Transporter::m_connected [protected] |
Reimplemented in SHM_Transporter.
Definition at line 158 of file Transporter.hpp.
Referenced by connect_client(), connect_server(), doDisconnect(), isConnected(), and Transporter().
Uint32 Transporter::m_errorCount [protected] |
Definition at line 154 of file Transporter.hpp.
Referenced by connect_client(), connect_server(), and getErrorCount().
Packer Transporter::m_packer [protected] |
int Transporter::m_s_port [protected] |
Definition at line 126 of file Transporter.hpp.
Referenced by connect_client(), get_s_port(), and set_s_port().
SocketClient* Transporter::m_socket_client [private] |
Definition at line 149 of file Transporter.hpp.
Referenced by connect_client(), set_s_port(), Transporter(), and ~Transporter().
Uint32 Transporter::m_timeOutMillis [protected] |
Definition at line 155 of file Transporter.hpp.
Referenced by SHM_Transporter::connect_common(), and Transporter().
TransporterRegistry& Transporter::m_transporter_registry [protected] |
Definition at line 161 of file Transporter.hpp.
Referenced by connect_client(), SHM_Transporter::connect_client_impl(), SHM_Transporter::connect_server_impl(), get_callback_obj(), and report_disconnect().
TransporterType Transporter::m_type [protected] |
Definition at line 159 of file Transporter.hpp.
Referenced by connect_client(), and TransporterRegistry::connect_server().
struct in_addr Transporter::remoteHostAddress [protected] |
char Transporter::remoteHostName[256] [protected] |
Remote host name/and address
Definition at line 121 of file Transporter.hpp.
Referenced by Transporter().
const NodeId Transporter::remoteNodeId [protected] |
Definition at line 128 of file Transporter.hpp.
Referenced by SHM_Transporter::checkConnected(), SHM_Transporter::connect_client_impl(), SCI_Transporter::connect_client_impl(), TCP_Transporter::connect_common(), SHM_Transporter::connect_common(), SHM_Transporter::connect_server_impl(), SCI_Transporter::connect_server_impl(), OSE_Transporter::connectConf(), OSE_Transporter::connectReq(), SCI_Transporter::disconnectImpl(), OSE_Transporter::disconnectOrd(), OSE_Transporter::doConnect(), TCP_Transporter::doReceive(), TCP_Transporter::doSend(), getRemoteNodeId(), OSE_Transporter::huntReceived(), SCI_Transporter::init_remote(), SCI_Transporter::initLocalSegment(), TCP_Transporter::initTransporter(), report_disconnect(), report_error(), SHM_Transporter::setupBuffers(), and Transporter().
bool Transporter::signalIdUsed [protected] |
1.4.7

