perfTransporterTest.cpp
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:20k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* Copyright (C) 2003 MySQL AB
  2.    This program is free software; you can redistribute it and/or modify
  3.    it under the terms of the GNU General Public License as published by
  4.    the Free Software Foundation; either version 2 of the License, or
  5.    (at your option) any later version.
  6.    This program is distributed in the hope that it will be useful,
  7.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  8.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9.    GNU General Public License for more details.
  10.    You should have received a copy of the GNU General Public License
  11.    along with this program; if not, write to the Free Software
  12.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  13. #include <ndb_global.h>
  14. #include "TransporterRegistry.hpp"
  15. #include "TransporterDefinitions.hpp"
  16. #include "TransporterCallback.hpp"
  17. #include <RefConvert.hpp>
  18. #include <NdbTick.h>
  19. #include <NdbMain.h>
  20. #include <NdbOut.hpp>
  21. #include <NdbSleep.h>
  22. int basePortTCP = 17000;
  23. SCI_TransporterConfiguration sciTemplate = {
  24.   2000, 
  25.        // Packet size
  26.   2000000,      // Buffer size
  27.   2,           // number of adapters
  28.   1,           // remote node id SCI 
  29.   2,           // Remote node Id SCI
  30.   0,           // local ndb node id (server)
  31.   0,           // remote ndb node id (client)
  32.   0,              // byteOrder;
  33.   false,          // compression;
  34.   true,          // checksum;
  35.   true            // signalId;
  36. };
  37. SHM_TransporterConfiguration shmTemplate = {
  38.   0,      //remoteNodeId
  39.   0,      //localNodeId;
  40.   false,  //compression
  41.   true,   //checksum;
  42.   true,   //signalId;
  43.   0,      //byteOrder;
  44.   123,    //shmKey;
  45.   25000000 //shmSize;
  46. };
  47. TCP_TransporterConfiguration tcpTemplate = {
  48.   17000,          // port; 
  49.   "",             // remoteHostName;
  50.   "",             // localhostname
  51.   2,              // remoteNodeId;
  52.   1,              // localNodeId;
  53.   25000000,        // sendBufferSize - Size of SendBuffer of priority B 
  54.   5000000,         // maxReceiveSize - Maximum no of bytes to receive
  55.   0,              // byteOrder;
  56.   false,          // compression;
  57.   true,           // checksum;
  58.   true            // signalId;
  59. };
  60. OSE_TransporterConfiguration oseTemplate = {
  61.   "",    // remoteHostName;
  62.   "",    // localHostName;
  63.   0,     // remoteNodeId;
  64.   0,     // localNodeId;
  65.   false, // compression;
  66.   true,  // checksum;
  67.   true,  // signalId;
  68.   0,     // byteOrder;
  69.   
  70.   2000,  // prioASignalSize;
  71.   2000,  // prioBSignalSize;
  72.   10     // Recv buf size
  73. };
  74. TransporterRegistry *tReg = 0;
  75. #ifndef OSE_DELTA
  76. #include <signal.h>
  77. #endif
  78. extern "C"
  79. void
  80. signalHandler(int signo){
  81. #ifndef OSE_DELTA
  82.   ::signal(13, signalHandler);
  83. #endif
  84.   char buf[255];
  85.   sprintf(buf,"Signal: %dn", signo);
  86.   ndbout << buf << endl;
  87. }
  88. void 
  89. usage(const char * progName){
  90.   ndbout << "Usage: " << progName << " <type> localNodeId localHostName" 
  91.  << " remoteHostName"
  92.  << " [<loop count>] [<send buf size>] [<recv buf size>]" << endl;
  93.   ndbout << "  type = shm tcp ose sci" << endl;
  94.   ndbout << "  localNodeId - {1,2}" << endl;
  95. }
  96. typedef void (* CreateTransporterFunc)(void * conf, 
  97.        NodeId localNodeId,
  98.        NodeId remoteNodeId,
  99.        const char * localHostName,
  100.        const char * remoteHostName,
  101.        int sendBuf,
  102.        int recvBuf);
  103. void 
  104. createOSETransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
  105. void
  106. createTCPTransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
  107. void
  108. createSHMTransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
  109. void
  110. createSCITransporter(void*, NodeId, NodeId, const char*, const char*, int, int);
  111. struct TestPhase {
  112.   int signalSize;
  113.   int noOfSignals;
  114.   int noOfSignalSent;
  115.   int noOfSignalReceived;
  116.   NDB_TICKS startTime;
  117.   NDB_TICKS stopTime;
  118.   NDB_TICKS accTime;
  119.   int loopCount;
  120.   Uint64 sendLenBytes, sendCount;
  121.   Uint64 recvLenBytes, recvCount;
  122. };
  123. TestPhase testSpec[] = {
  124.    {  1,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals of size 1  word
  125.   ,{  1,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals of size 1  word
  126.   ,{  1,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals of size 1  word
  127.   ,{  1, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals of size 1  word
  128.   ,{  8,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals of size 1  word
  129.   ,{  8,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals of size 1  word
  130.   ,{  8,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals of size 1  word
  131.   ,{  8, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals of size 1  word
  132.   ,{ 16,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals of size 1  word
  133.   ,{ 16,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals of size 1  word
  134.   ,{ 16,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals of size 1  word
  135.   ,{ 16, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals of size 1  word
  136.   ,{ 24,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals of size 1  word
  137.   ,{ 24,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals of size 1  word
  138.   ,{ 24,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals of size 1  word
  139.   ,{ 24, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals of size 1  word
  140.   ,{  0,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals of random size
  141.   ,{  0,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals of random size
  142.   ,{  0,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals of random size
  143.   ,{  0, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals of random size
  144.   ,{ 100,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals 
  145.   ,{ 100,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals 
  146.   ,{ 100,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals 
  147.   ,{ 100, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals 
  148.   ,{ 500,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals 
  149.   ,{ 500,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals 
  150.   ,{ 500,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals 
  151.   ,{ 500, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals 
  152.   ,{ 1000,    10, 0,0, 0,0,0,0,0,0,0 } //    10 signals 
  153.   ,{ 1000,   100, 0,0, 0,0,0,0,0,0,0 } //   100 signals 
  154.   ,{ 1000,  1000, 0,0, 0,0,0,0,0,0,0 } //  1000 signals 
  155.   ,{ 1000, 10000, 0,0, 0,0,0,0,0,0,0 } // 10000 signals 
  156. };
  157. const int noOfTests = sizeof(testSpec)/sizeof(TestPhase);
  158. Uint32 StaticBuffer[1000];
  159. SendStatus
  160. sendSignalTo(NodeId nodeId, int signalSize, Uint32 count){
  161.   if(signalSize == 0)
  162.     signalSize = (rand() % 25) + 1;
  163.   SignalHeader sh;
  164.   sh.theLength               = (signalSize > 25 ? 25 : signalSize);
  165.   sh.theVerId_signalNumber   = count;
  166.   sh.theReceiversBlockNumber = rand();   
  167.   sh.theSendersBlockRef      = rand(); 
  168.   sh.theSendersSignalId      = rand(); 
  169.   sh.theSignalId             = rand(); 
  170.   sh.theTrace                = rand(); 
  171.   
  172.   Uint32 theData[25];
  173.   for(int i = 0; i<25; i++)
  174.     theData[i] = (i+1) * (Uint32)(&theData[i]);
  175.   
  176.   theData[0] = count;
  177.   LinearSectionPtr ptr[3];
  178.   
  179.   if(signalSize <= 25){
  180.     sh.m_noOfSections = 0;
  181.   } else {
  182.     sh.m_noOfSections = 1;
  183.     ptr[0].sz = signalSize - 25;
  184.     ptr[0].p = &StaticBuffer[0];
  185.   }
  186.   return tReg->prepareSend(&sh, 1, theData, nodeId, ptr);
  187. }
  188. void
  189. reportHeader(){
  190.   ndbout << "#SigstSztTimetSig/sectBpstBps-tott"
  191.  << "s lentr len" << endl;
  192. }
  193. void
  194. print(char * dst, int i){
  195.   if(i > 1000000){
  196.     const int d = i / 1000000;
  197.     const int r = (i - (d * 1000000)) / 100000;
  198.     if(d < 100)
  199.       sprintf(dst, "%d.%dM", d, r);
  200.     else
  201.       sprintf(dst, "%dM", d);
  202.   } else if(i > 1000){
  203.     const int d = i / 1000;
  204.     const int r = (i - (d * 1000)) / 100;
  205.     if(d < 100)
  206.       sprintf(dst, "%d.%dk", d, r);
  207.     else
  208.       sprintf(dst, "%dk", d);
  209.   } else {
  210.     sprintf(dst, "%d", i);
  211.   }
  212. }
  213. void
  214. printReport(TestPhase & p){
  215.   if(p.accTime > 0) {
  216.     Uint32 secs = (p.accTime/p.loopCount)/1000;
  217.     Uint32 mill = (p.accTime/p.loopCount)%1000;
  218.     char st[255];
  219.     if(secs > 0){
  220.       sprintf(st, "%d.%.2ds", secs, (mill/10));
  221.     } else {
  222.       sprintf(st, "%dms", mill);
  223.     }
  224.   
  225.     Uint32 sps = (1000*p.noOfSignals*p.loopCount)/p.accTime;
  226.     Uint32 dps = ((4000*p.noOfSignals)/p.accTime)*(p.loopCount*p.signalSize);
  227.     Uint32 bps = ((4000*p.noOfSignals)/p.accTime)*(p.loopCount*(p.signalSize+3));
  228.     if(p.signalSize == 0){
  229.       dps = ((4000*p.noOfSignals)/p.accTime)*(p.loopCount*(13));
  230.       bps = ((4000*p.noOfSignals)/p.accTime)*(p.loopCount*(13+3));
  231.     }
  232.     char ssps[255];
  233.     char sbps[255];
  234.     char sdps[255];
  235.     print(ssps, sps);
  236.     print(sbps, bps);
  237.     print(sdps, dps);
  238.     
  239.     
  240.     char buf[255];
  241.     if(p.signalSize != 0){
  242.       BaseString::snprintf(buf, 255,
  243.        "%dt%dt%st%st%st%st%dt%d",
  244.        p.noOfSignals,
  245.        4*p.signalSize,
  246.        st,
  247.        ssps,
  248.        sdps,
  249.        sbps,
  250.        (int)(p.sendLenBytes / (p.sendCount == 0 ? 1 : p.sendCount)),
  251.        (int)(p.recvLenBytes / (p.recvCount == 0 ? 1 : p.recvCount)));
  252.     } else {
  253.       BaseString::snprintf(buf, 255,
  254.        "%dtrandt%st%st%st%st%dt%d",
  255.        p.noOfSignals,
  256.        st,
  257.        ssps,
  258.        sdps,
  259.        sbps,
  260.        (int)(p.sendLenBytes / (p.sendCount == 0 ? 1 : p.sendCount)),
  261.        (int)(p.recvLenBytes / (p.recvCount == 0 ? 1 : p.recvCount)));
  262.       
  263.     }
  264.     ndbout << buf << endl;
  265.   }
  266. }
  267. int loopCount = 1;
  268. int sendBufSz = -1;
  269. int recvBufSz = -1;
  270. bool      isClient     = false;
  271. bool      isConnected  = false;
  272. bool      isStarted    = false;
  273. int       currentPhase = 0;
  274. TestPhase allPhases[noOfTests];
  275. Uint32    signalToEcho;
  276. Uint32    signalsEchoed;
  277. NDB_TICKS startTime, stopTime;
  278. void
  279. client(NodeId remoteNodeId){
  280.   isClient = true;
  281.   currentPhase = 0;
  282.   memcpy(allPhases, testSpec, sizeof(testSpec));
  283.   int counter = 0;
  284.   int sigCounter = 0;
  285.   while(true){
  286.     TestPhase * current = &allPhases[currentPhase];
  287.     if(current->noOfSignals == current->noOfSignalSent &&
  288.        current->noOfSignals == current->noOfSignalReceived){
  289.       /**
  290.        * Test phase done
  291.        */
  292.       current->stopTime  = NdbTick_CurrentMillisecond();
  293.       current->accTime  += (current->stopTime - current->startTime);
  294.       NdbSleep_MilliSleep(500 / loopCount);
  295.       
  296.       current->startTime = NdbTick_CurrentMillisecond();
  297.       
  298.       current->noOfSignalSent     = 0;
  299.       current->noOfSignalReceived = 0;
  300.       current->loopCount ++;
  301.       if(current->loopCount == loopCount){
  302. printReport(allPhases[currentPhase]);
  303. currentPhase ++;
  304. if(currentPhase == noOfTests){
  305.   /**
  306.    * Now we are done
  307.    */
  308.   break;
  309. }
  310. NdbSleep_MilliSleep(500);
  311. current = &allPhases[currentPhase];
  312. current->startTime = NdbTick_CurrentMillisecond();
  313.       }
  314.     } 
  315.     
  316.     int signalsLeft = current->noOfSignals - current->noOfSignalSent;
  317.     if(signalsLeft > 0){
  318.       for(; signalsLeft > 0; signalsLeft--){
  319. if(sendSignalTo(remoteNodeId,current->signalSize,sigCounter)== SEND_OK){
  320.   current->noOfSignalSent++;
  321.   sigCounter++;
  322. } else {
  323.   ndbout << "Failed to send: " << sigCounter << endl;
  324.   tReg->external_IO(10);
  325.   break;
  326. }
  327.       }
  328.     }
  329.     if(counter % 10 == 0)
  330.       tReg->checkConnections();
  331.     tReg->external_IO(0);
  332.     counter++;
  333.   }
  334. }
  335. void 
  336. server(){
  337.   isClient = false;
  338.   
  339.   signalToEcho = 0;
  340.   signalsEchoed = 0;
  341.   for(int i = 0; i<noOfTests; i++)
  342.     signalToEcho += testSpec[i].noOfSignals;
  343.   
  344.   signalToEcho *= loopCount;
  345.   while(signalToEcho > signalsEchoed){
  346.     tReg->checkConnections();
  347.     for(int i = 0; i<10; i++)
  348.       tReg->external_IO(10);
  349.   }
  350. }
  351. int
  352. main(int argc, const char **argv){
  353.   
  354.   const char * progName = argv[0];
  355.   loopCount = 100;
  356.   sendBufSz = -1;
  357.   recvBufSz = -1;
  358.   
  359.   isClient     = false;
  360.   isConnected  = false;
  361.   isStarted    = false;
  362.   currentPhase = 0;
  363.   signalHandler(0);
  364.   
  365.   if(argc < 5){
  366.     usage(progName);
  367.     return 0;
  368.   }
  369.   
  370.   const char * type = argv[1];
  371.   const NodeId localNodeId   = atoi(argv[2]);
  372.   const char * localHostName = argv[3];
  373.   const char * remoteHost1   = argv[4];
  374.   
  375.   if(argc >= 6)
  376.     loopCount = atoi(argv[5]);
  377.   if(argc >= 7)
  378.     sendBufSz = atoi(argv[6]);
  379.   if(argc >= 8)
  380.     recvBufSz = atoi(argv[7]);
  381.   if(localNodeId < 1 || localNodeId > 2){
  382.     ndbout << "localNodeId = " << localNodeId << endl << endl;
  383.     usage(progName);
  384.     return 0;
  385.   }
  386.   
  387.   if(localNodeId == 1)
  388.     ndbout << "-- ECHO CLIENT --" << endl;
  389.   else
  390.     ndbout << "-- ECHO SERVER --" << endl;
  391.   ndbout << "localNodeId:           " << localNodeId << endl;
  392.   ndbout << "localHostName:         " << localHostName << endl;
  393.   ndbout << "remoteHost1 (node " << (localNodeId == 1?2:1) << "): " 
  394.  << remoteHost1 << endl;
  395.   ndbout << "Loop count: " << loopCount << endl;
  396.   ndbout << "-----------------" << endl;
  397.   
  398.   void * confTemplate = 0;
  399.   CreateTransporterFunc func = 0;
  400.   if(strcasecmp(type, "tcp") == 0){
  401.     func = createTCPTransporter;
  402.     confTemplate = &tcpTemplate;
  403.   } else if(strcasecmp(type, "ose") == 0){
  404.     func = createOSETransporter;
  405.     confTemplate = &oseTemplate;
  406.   } else if(strcasecmp(type, "sci") == 0){
  407.     func = createSCITransporter;
  408.     confTemplate = &sciTemplate;
  409.   } else if(strcasecmp(type, "shm") == 0){
  410.     func = createSHMTransporter;
  411.     confTemplate = &shmTemplate;
  412.   } else {
  413.     ndbout << "Unsupported transporter type" << endl;
  414.     return 0;
  415.   }
  416.   
  417.   ndbout << "Creating transporter registry" << endl;
  418.   tReg = new TransporterRegistry;
  419.   tReg->init(localNodeId);
  420.   
  421.   switch(localNodeId){
  422.   case 1:
  423.     (* func)(confTemplate, 1, 2, localHostName, remoteHost1, 
  424.      sendBufSz, recvBufSz);
  425.     break;
  426.   case 2:
  427.     (* func)(confTemplate, 2, 1, localHostName, remoteHost1,
  428.      sendBufSz, recvBufSz);
  429.     break;
  430.   }
  431.   
  432.   ndbout << "Doing startSending/startReceiving" << endl;
  433.   tReg->startSending();
  434.   tReg->startReceiving();
  435.   
  436.   ndbout << "Connecting" << endl;
  437.   tReg->setPerformState(PerformConnect);
  438.   tReg->checkConnections();
  439.   if(localNodeId == 1)
  440.     client(2);
  441.   else
  442.     server();
  443.     
  444.   isStarted = false;
  445.   
  446.   ndbout << "Sleep 3 secs" << endl;
  447.   NdbSleep_SecSleep(3);
  448.   ndbout << "Doing setPerformState(Disconnect)" << endl;
  449.   tReg->setPerformState(PerformDisconnect);
  450.   
  451.   ndbout << "Doing checkConnections()" << endl;
  452.   tReg->checkConnections();
  453.     
  454.   ndbout << "Deleting transporter registry" << endl;
  455.   delete tReg; tReg = 0;
  456.   
  457.   return 0;
  458. }
  459. void
  460. execute(void* callbackObj, SignalHeader * const header, Uint8 prio, 
  461. Uint32 * const theData,
  462. LinearSectionPtr ptr[3]){
  463.   const NodeId nodeId = refToNode(header->theSendersBlockRef);
  464.  
  465.   if(isClient){
  466.     allPhases[currentPhase].noOfSignalReceived++;
  467.   } else {
  468.     int sleepTime = 10;
  469.     if(theData[0] != signalsEchoed){
  470.       ndbout << "Missing signal theData[0] = " << theData[0] 
  471.      << " signalsEchoed = " << signalsEchoed << endl;
  472.       ndbout << (* header) << endl;
  473.       abort();
  474.     }
  475.     while(tReg->prepareSend(header, prio, theData, nodeId, ptr) != SEND_OK){
  476.       ndbout << "Failed to echo " << theData[0] << endl;
  477.       NdbSleep_MilliSleep(sleepTime);
  478.       // sleepTime += 10;
  479.     }
  480.     signalsEchoed++;
  481.   }
  482. }
  483. void 
  484. copy(Uint32 * & insertPtr, 
  485.      class SectionSegmentPool & thePool, const SegmentedSectionPtr & _ptr){
  486.   abort();
  487. }
  488. void
  489. reportError(void* callbackObj, NodeId nodeId, TransporterError errorCode){
  490.   char buf[255];
  491.   sprintf(buf, "reportError (%d, %x) in perfTest", nodeId, errorCode);
  492.   ndbout << buf << endl;
  493.   if(errorCode & 0x8000 && errorCode != 0x8014){
  494.     abort(); //tReg->setPerformState(nodeId, PerformDisconnect);
  495.   }
  496. }
  497. /**
  498.  * Report average send theLength in bytes (4096 last sends)
  499.  */
  500. void
  501. reportSendLen(void* callbackObj, NodeId nodeId, Uint32 count, Uint64 bytes){
  502.   allPhases[currentPhase].sendCount    += count;
  503.   allPhases[currentPhase].sendLenBytes += bytes;
  504.   if(!isClient){
  505.     ndbout << "reportSendLen(" << nodeId << ", " 
  506.    << (bytes/count) << ")" << endl;
  507.   }
  508. }
  509. /**
  510.  * Report average receive theLength in bytes (4096 last receives)
  511.  */
  512. void
  513. reportReceiveLen(void* callbackObj, NodeId nodeId, Uint32 count, Uint64 bytes){
  514.   allPhases[currentPhase].recvCount    += count;
  515.   allPhases[currentPhase].recvLenBytes += bytes;
  516.   if(!isClient){
  517.     ndbout << "reportReceiveLen(" << nodeId << ", " 
  518.    << (bytes/count) << ")" << endl;
  519.   }
  520. }
  521. /**
  522.  * Report connection established
  523.  */
  524. void
  525. reportConnect(void* callbackObj, NodeId nodeId){
  526.   char buf[255];
  527.   sprintf(buf, "reportConnect(%d)", nodeId);
  528.   ndbout << buf << endl;
  529.   tReg->setPerformState(nodeId, PerformIO);
  530.   
  531.   if(!isStarted){
  532.     isStarted = true;
  533.     startTime = NdbTick_CurrentMillisecond();
  534.     if(isClient){
  535.       reportHeader();
  536.       allPhases[0].startTime = startTime;
  537.     }
  538.   }
  539.   else{
  540.     // Resend signals that were lost when connection failed
  541.     TestPhase * current = &allPhases[currentPhase];
  542.     current->noOfSignalSent = current->noOfSignalReceived;
  543.   }
  544. }
  545. /**
  546.  * Report connection broken
  547.  */
  548. void
  549. reportDisconnect(void* callbackObj, NodeId nodeId, Uint32 errNo){
  550.   char buf[255];
  551.   sprintf(buf, "reportDisconnect(%d)", nodeId);
  552.   ndbout << buf << endl;
  553.   
  554.   if(isStarted)
  555.     tReg->setPerformState(nodeId, PerformConnect);
  556. }
  557. int
  558. checkJobBuffer() {
  559.   /** 
  560.    * Check to see if jobbbuffers are starting to get full
  561.    * and if so call doJob
  562.    */
  563.   return 0;
  564. }
  565. void
  566. createOSETransporter(void * _conf,
  567.      NodeId localNodeId,
  568.      NodeId remoteNodeId,
  569.      const char * localHostName,
  570.      const char * remoteHostName,
  571.      int sendBuf,
  572.      int recvBuf){
  573.   
  574.   ndbout << "Creating OSE transporter from node " 
  575.  << localNodeId << "(" << localHostName << ") to "
  576.  << remoteNodeId << "(" << remoteHostName << ")..." << endl;;
  577.   
  578.   OSE_TransporterConfiguration * conf = (OSE_TransporterConfiguration*)_conf;
  579.   
  580.   if(sendBuf != -1){
  581.     conf->prioBSignalSize = sendBuf;
  582.   }
  583.   if(recvBuf != -1){
  584.     conf->receiveBufferSize = recvBuf;
  585.   }
  586.   ndbout << "tSendBufferSize:    " << conf->prioBSignalSize << endl;
  587.   ndbout << "tReceiveBufferSize: " << conf->receiveBufferSize << endl;
  588.   conf->localNodeId    = localNodeId;
  589.   conf->localHostName  = localHostName;
  590.   conf->remoteNodeId   = remoteNodeId;
  591.   conf->remoteHostName = remoteHostName;
  592.   bool res = tReg->createTransporter(conf);
  593.   if(res)
  594.     ndbout << "... -- Success " << endl;
  595.   else
  596.     ndbout << "... -- Failure " << endl;
  597. }
  598. void
  599. createSCITransporter(void * _conf,
  600.      NodeId localNodeId,
  601.      NodeId remoteNodeId,
  602.      const char * localHostName,
  603.      const char * remoteHostName,
  604.      int sendbuf,
  605.      int recvbuf) {
  606.   ndbout << "Creating SCI transporter from node " 
  607.  << localNodeId << "(" << localHostName << ") to "
  608.  << remoteNodeId << "(" << remoteHostName << ")..." << endl;;
  609.   
  610.   
  611.   SCI_TransporterConfiguration * conf = (SCI_TransporterConfiguration*)_conf;
  612.   conf->remoteSciNodeId0= (Uint16)atoi(localHostName);
  613.   conf->remoteSciNodeId1= (Uint16)atoi(remoteHostName);
  614.   conf->localNodeId    = localNodeId;
  615.   conf->remoteNodeId   = remoteNodeId;
  616.   bool res = tReg->createTransporter(conf);
  617.   if(res)
  618.     ndbout << "... -- Success " << endl;
  619.   else
  620.     ndbout << "... -- Failure " << endl;
  621. }
  622. void
  623. createSHMTransporter(void * _conf,
  624.      NodeId localNodeId,
  625.      NodeId remoteNodeId,
  626.      const char * localHostName,
  627.      const char * remoteHostName,
  628.      int sendbuf,
  629.      int recvbuf) {
  630.   ndbout << "Creating SHM transporter from node " 
  631.  << localNodeId << "(" << localHostName << ") to "
  632.  << remoteNodeId << "(" << remoteHostName << ")..." << endl;;
  633.   
  634.   
  635.   SHM_TransporterConfiguration * conf = (SHM_TransporterConfiguration*)_conf;
  636.   conf->localNodeId    = localNodeId;
  637.   conf->remoteNodeId   = remoteNodeId;
  638.   bool res = tReg->createTransporter(conf);
  639.   if(res)
  640.     ndbout << "... -- Success " << endl;
  641.   else
  642.     ndbout << "... -- Failure " << endl;
  643. }
  644. void
  645. createTCPTransporter(void * _conf,
  646.      NodeId localNodeId,
  647.      NodeId remoteNodeId,
  648.      const char * localHostName,
  649.      const char * remoteHostName,
  650.      int sendBuf,
  651.      int recvBuf){
  652.   ndbout << "Creating TCP transporter from node " 
  653.  << localNodeId << "(" << localHostName << ") to "
  654.  << remoteNodeId << "(" << remoteHostName << ")..." << endl;;
  655.   
  656.   TCP_TransporterConfiguration * conf = (TCP_TransporterConfiguration*)_conf;
  657.   
  658.   int port;
  659.   if(localNodeId == 1 && remoteNodeId == 2) port = basePortTCP + 0;
  660.   if(localNodeId == 1 && remoteNodeId == 3) port = basePortTCP + 1;
  661.   if(localNodeId == 2 && remoteNodeId == 1) port = basePortTCP + 0;
  662.   if(localNodeId == 2 && remoteNodeId == 3) port = basePortTCP + 2;
  663.   if(localNodeId == 3 && remoteNodeId == 1) port = basePortTCP + 1;
  664.   if(localNodeId == 3 && remoteNodeId == 2) port = basePortTCP + 2;
  665.   if(sendBuf != -1){
  666.     conf->sendBufferSize = sendBuf;
  667.   }
  668.   if(recvBuf != -1){
  669.     conf->maxReceiveSize = recvBuf;
  670.   }
  671.   ndbout << "tSendBufferSize:    " << conf->sendBufferSize << endl;
  672.   ndbout << "tReceiveBufferSize: " << conf->maxReceiveSize << endl;
  673.   conf->localNodeId    = localNodeId;
  674.   conf->localHostName  = localHostName;
  675.   conf->remoteNodeId   = remoteNodeId;
  676.   conf->remoteHostName = remoteHostName;
  677.   conf->port           = port;
  678.   bool res = tReg->createTransporter(conf);
  679.   if(res)
  680.     ndbout << "... -- Success " << endl;
  681.   else
  682.     ndbout << "... -- Failure " << endl;
  683. }