/[resiprocate]/main/reTurn/reTurnServer.cxx
ViewVC logotype

Diff of /main/reTurn/reTurnServer.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7348 by sgodin, Mon Oct 22 16:52:21 2007 UTC revision 7365 by sgodin, Sun Oct 28 16:52:18 2007 UTC
# Line 58  Line 58 
58      // Initialize server.      // Initialize server.
59      asio::io_service ioService;                       // The one and only ioService for the stunServer      asio::io_service ioService;                       // The one and only ioService for the stunServer
60      reTurn::TurnManager turnManager(ioService);         // The one and only Turn Manager      reTurn::TurnManager turnManager(ioService);         // The one and only Turn Manager
     reTurn::RequestHandler requestHandler(turnManager); // The one and only RequestHandler  
61    
62      unsigned int turnPort = resip::Data(argv[2]).convertUnsignedLong();      unsigned short turnPort = (unsigned short)resip::Data(argv[2]).convertUnsignedLong();
63      unsigned int stunPort = resip::Data(argv[3]).convertUnsignedLong();      unsigned short stunPort = (unsigned short)resip::Data(argv[3]).convertUnsignedLong();
64      unsigned int altStunPort = resip::Data(argv[5]).convertUnsignedLong();      unsigned short altStunPort = (unsigned short)resip::Data(argv[5]).convertUnsignedLong();
65      unsigned int tlsPort = turnPort + 1;      unsigned short tlsPort = turnPort + 1;
66        asio::ip::address turnAddress = asio::ip::address::from_string(argv[1]);
67        asio::ip::address altStunAddress = asio::ip::address::from_string(argv[4]);
68    
69      reTurn::UdpServer* udpTurnServer=0;      reTurn::UdpServer* udpTurnServer=0;
70      reTurn::TcpServer* tcpTurnServer=0;      reTurn::TcpServer* tcpTurnServer=0;
# Line 73  Line 74 
74      reTurn::UdpServer* a2p1StunUdpServer=0;      reTurn::UdpServer* a2p1StunUdpServer=0;
75      reTurn::UdpServer* a2p2StunUdpServer=0;      reTurn::UdpServer* a2p2StunUdpServer=0;
76    
77        // The one and only RequestHandler - if stun port is non-zero, then assume RFC3489 support is enabled and pass settings to request handler
78        reTurn::RequestHandler requestHandler(turnManager, stunPort != 0 ? &turnAddress : 0, stunPort != 0 ? &turnPort : 0, stunPort != 0 ? &altStunAddress : 0, stunPort != 0 ? &altStunPort : 0);
79    
80      if(turnPort != 0)      if(turnPort != 0)
81      {      {
82         udpTurnServer = new reTurn::UdpServer(ioService, requestHandler, argv[1], turnPort);         udpTurnServer = new reTurn::UdpServer(ioService, requestHandler, turnAddress, turnPort);
83         tcpTurnServer = new reTurn::TcpServer(ioService, requestHandler, argv[1], turnPort);         tcpTurnServer = new reTurn::TcpServer(ioService, requestHandler, turnAddress, turnPort);
84         tlsTurnServer = new reTurn::TlsServer(ioService, requestHandler, argv[1], tlsPort);         tlsTurnServer = new reTurn::TlsServer(ioService, requestHandler, turnAddress, tlsPort);
85      }      }
86    
87      if(stunPort != 0)      if(stunPort != 0)  // if stun port is non-zero, then assume RFC3489 support is enabled
88      {      {
89         a1p1StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, argv[1], stunPort);         a1p1StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, turnAddress, stunPort);
90         a1p2StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, argv[1], altStunPort);         a1p2StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, turnAddress, altStunPort);
91         a2p1StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, argv[4], stunPort);         a2p1StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, altStunAddress, stunPort);
92         a2p2StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, argv[4], altStunPort);         a2p2StunUdpServer = new reTurn::UdpServer(ioService, requestHandler, altStunAddress, altStunPort);
93         a1p1StunUdpServer->setAlternateUdpServers(a1p2StunUdpServer, a2p1StunUdpServer, a2p2StunUdpServer);         a1p1StunUdpServer->setAlternateUdpServers(a1p2StunUdpServer, a2p1StunUdpServer, a2p2StunUdpServer);
94         a1p2StunUdpServer->setAlternateUdpServers(a1p1StunUdpServer, a2p2StunUdpServer, a2p1StunUdpServer);         a1p2StunUdpServer->setAlternateUdpServers(a1p1StunUdpServer, a2p2StunUdpServer, a2p1StunUdpServer);
95         a2p1StunUdpServer->setAlternateUdpServers(a2p2StunUdpServer, a1p1StunUdpServer, a1p2StunUdpServer);         a2p1StunUdpServer->setAlternateUdpServers(a2p2StunUdpServer, a1p1StunUdpServer, a1p2StunUdpServer);

Legend:
Removed from v.7348  
changed lines
  Added in v.7365

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27