certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi libCERTI/SocketUN.cc libCERTI/SocketUN.hh...


From: certi-cvs
Subject: [certi-cvs] certi libCERTI/SocketUN.cc libCERTI/SocketUN.hh...
Date: Mon, 23 Jun 2008 12:49:16 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      08/06/23 12:49:15

Modified files:
        libCERTI       : SocketUN.cc SocketUN.hh 
        RTIA           : main.cc RTIA.cc Communications.hh 
                         CMakeLists.txt Communications.cc RTIA.hh 

Log message:
        Add -p option to RTIA main in order to make
        it possible to choose port from command line.
        (this is not the default behavior though)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/SocketUN.cc?cvsroot=certi&r1=3.22&r2=3.23
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/SocketUN.hh?cvsroot=certi&r1=3.14&r2=3.15
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/main.cc?cvsroot=certi&r1=3.20&r2=3.21
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.cc?cvsroot=certi&r1=3.22&r2=3.23
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/Communications.hh?cvsroot=certi&r1=3.14&r2=3.15
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/CMakeLists.txt?cvsroot=certi&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/Communications.cc?cvsroot=certi&r1=3.30&r2=3.31
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.hh?cvsroot=certi&r1=3.13&r2=3.14

Patches:
Index: libCERTI/SocketUN.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/SocketUN.cc,v
retrieving revision 3.22
retrieving revision 3.23
diff -u -b -r3.22 -r3.23
--- libCERTI/SocketUN.cc        18 Jun 2008 13:11:58 -0000      3.22
+++ libCERTI/SocketUN.cc        23 Jun 2008 12:49:15 -0000      3.23
@@ -54,7 +54,7 @@
 // ----------------------------------------------------------------------------
 //! Called by server to open the socket and wait for the connection.
 void
-SocketUN::acceptUN()
+SocketUN::acceptUN(int RTIA_port)
 {
 #if defined(RTIA_USE_TCP)
        struct sockaddr_in nom_client, nom_serveur;
@@ -77,12 +77,18 @@
        nom_serveur.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 
        // TEMPO : UNIX socket emulation with TCP/IP sockets
-       int pid = getpid();
+       int tcpport;
+       if (RTIA_port>0) {
+               tcpport = RTIA_port; 
+       } else {
+           tcpport = getpid();
+       }
+       
        // make sure it is contained in a short
-       if (pid > 65535)
-               throw RTIinternalError("NOM_FICHIER_SOCKET too long.");
+       if (tcpport > 65535)
+               throw RTIinternalError("TCP Port too big.");
 
-       nom_serveur.sin_port = htons(pid);
+       nom_serveur.sin_port = htons(tcpport);
 
        lg_nom = sizeof(nom_serveur);
 
@@ -154,7 +160,7 @@
 
 // ----------------------------------------------------------------------------
 //! Called by client to connect.
-#ifdef _WIN32
+#ifdef RTIA_USE_TCP
        void SocketUN::connectUN(int Server_pid)
 #else
        int SocketUN::connectUN(pid_t Server_pid)

Index: libCERTI/SocketUN.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/SocketUN.hh,v
retrieving revision 3.14
retrieving revision 3.15
diff -u -b -r3.14 -r3.15
--- libCERTI/SocketUN.hh        18 Jun 2008 11:14:24 -0000      3.14
+++ libCERTI/SocketUN.hh        23 Jun 2008 12:49:15 -0000      3.15
@@ -70,7 +70,7 @@
        #else
                int connectUN(pid_t Server_pid);
        #endif
-       void acceptUN();                                                        
                //Called by server
+       void acceptUN(int RTIA_port);                                           
                        //Called by server
 
        bool isDataReady();
 

Index: RTIA/main.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/main.cc,v
retrieving revision 3.20
retrieving revision 3.21
diff -u -b -r3.20 -r3.21
--- RTIA/main.cc        9 Jun 2008 11:17:12 -0000       3.20
+++ RTIA/main.cc        23 Jun 2008 12:49:15 -0000      3.21
@@ -18,12 +18,13 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: main.cc,v 3.20 2008/06/09 11:17:12 siron Exp $
+// $Id: main.cc,v 3.21 2008/06/23 12:49:15 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
 
 #include "RTIA.hh"
+#include "RTIA_cmdline.h"
 
 #include <sys/types.h>
 #include <signal.h>
@@ -37,7 +38,8 @@
 int normal_end;
 
 // ----------------------------------------------------------------------------
-int main() {
+int 
+main(int argc, char **argv) {
        signal(SIGINT, SignalHandler);
 #ifndef _WIN32
        signal(SIGPIPE, SignalHandler);
@@ -52,8 +54,18 @@
                sleep(atoi(getenv("RTIA_DEBUG")));
        }
 
+       // Command line
+       gengetopt_args_info args ;
+       if (cmdline_parser(argc, argv, &args))
+           exit(EXIT_FAILURE); 
+
        try {
-               RTIA rtia;
+               int rtia_port = 0;
+               if (args.port_given) {
+                       rtia_port = args.port_arg;
+               }
+               
+               RTIA rtia(rtia_port);
 
                try {
                        rtia.execute();
@@ -101,4 +113,4 @@
        throw MemoryExhausted("RTIA has exhausted memory error");
 }
 
-// EOF $Id: main.cc,v 3.20 2008/06/09 11:17:12 siron Exp $
+// EOF $Id: main.cc,v 3.21 2008/06/23 12:49:15 erk Exp $

Index: RTIA/RTIA.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.cc,v
retrieving revision 3.22
retrieving revision 3.23
diff -u -b -r3.22 -r3.23
--- RTIA/RTIA.cc        13 Jun 2008 10:55:13 -0000      3.22
+++ RTIA/RTIA.cc        23 Jun 2008 12:49:15 -0000      3.23
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIA.cc,v 3.22 2008/06/13 10:55:13 erk Exp $
+// $Id: RTIA.cc,v 3.23 2008/06/23 12:49:15 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -38,12 +38,12 @@
 
 // ----------------------------------------------------------------------------
 //! RTIA constructor.
-RTIA::RTIA()
+RTIA::RTIA(int RTIA_port)
 {
     // No SocketServer is passed to the RootObject.
     rootObject = new RootObject(NULL);
 
-    comm   = new Communications();
+    comm   = new Communications(RTIA_port);
     queues = new Queues ;
     fm     = new FederationManagement(comm,&stat);
     om     = new ObjectManagement(comm, fm, rootObject);
@@ -200,4 +200,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA.cc,v 3.22 2008/06/13 10:55:13 erk Exp $
+// $Id: RTIA.cc,v 3.23 2008/06/23 12:49:15 erk Exp $

Index: RTIA/Communications.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/Communications.hh,v
retrieving revision 3.14
retrieving revision 3.15
diff -u -b -r3.14 -r3.15
--- RTIA/Communications.hh      30 May 2008 14:01:06 -0000      3.14
+++ RTIA/Communications.hh      23 Jun 2008 12:49:15 -0000      3.15
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: Communications.hh,v 3.14 2008/05/30 14:01:06 erk Exp $
+// $Id: Communications.hh,v 3.15 2008/06/23 12:49:15 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_COMMUNICATIONS_HH
@@ -47,7 +47,7 @@
                        public SocketUDP
 {
 public:
-    Communications();
+    Communications(int RTIA_port);
     ~Communications();
 
     //! Send a message to RTIG.
@@ -88,4 +88,4 @@
 
 #endif // _CERTI_COMMUNICATIONS_HH
 
-// $Id: Communications.hh,v 3.14 2008/05/30 14:01:06 erk Exp $
+// $Id: Communications.hh,v 3.15 2008/06/23 12:49:15 erk Exp $

Index: RTIA/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/RTIA/CMakeLists.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- RTIA/CMakeLists.txt 7 May 2008 14:14:27 -0000       1.4
+++ RTIA/CMakeLists.txt 23 Jun 2008 12:49:15 -0000      1.5
@@ -3,19 +3,20 @@
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libRTI)
 
 SET(rtia_SRCS
-  Communications.cc
-  DataDistribution.cc
-  DeclarationManagement.cc
-  FederationManagement.cc
-  Files.cc
+  Communications.cc Communications.hh
+  DataDistribution.cc DataDistribution.hh
+  DeclarationManagement.cc DeclarationManagement.hh
+  FederationManagement.cc FederationManagement.hh
+  Files.cc Files.hh
   main.cc
-  ObjectManagement.cc
-  OwnershipManagement.cc
-  RTIA.cc
+  ObjectManagement.cc ObjectManagement.hh
+  OwnershipManagement.cc OwnershipManagement.hh
+  RTIA.cc RTIA.hh
   RTIA_federate.cc
   RTIA_network.cc
-  Statistics.cc
-  TimeManagement.cc
+  RTIA_cmdline.c RTIA_cmdline.h
+  Statistics.cc Statistics.hh
+  TimeManagement.cc TimeManagement.hh  
   )
 
 ADD_EXECUTABLE(rtia ${rtia_SRCS})

Index: RTIA/Communications.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/Communications.cc,v
retrieving revision 3.30
retrieving revision 3.31
diff -u -b -r3.30 -r3.31
--- RTIA/Communications.cc      13 Jun 2008 10:55:14 -0000      3.30
+++ RTIA/Communications.cc      23 Jun 2008 12:49:15 -0000      3.31
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: Communications.cc,v 3.30 2008/06/13 10:55:14 erk Exp $
+// $Id: Communications.cc,v 3.31 2008/06/23 12:49:15 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -90,14 +90,14 @@
 
 // ----------------------------------------------------------------------------
 //! Communications.
-Communications::Communications()
+Communications::Communications(int RTIA_port)
     : SocketUN(), SecureTCPSocket(), SocketUDP()
 {
     char nom_serveur_RTIG[200] ;
     const char *default_host = "localhost" ;
 
     // Federate/RTIA link creation.
-    acceptUN();
+    acceptUN(RTIA_port);
 
     // RTIG TCP link creation.
     const char *certihost = NULL ;
@@ -339,4 +339,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: Communications.cc,v 3.30 2008/06/13 10:55:14 erk Exp $
+// $Id: Communications.cc,v 3.31 2008/06/23 12:49:15 erk Exp $

Index: RTIA/RTIA.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.hh,v
retrieving revision 3.13
retrieving revision 3.14
diff -u -b -r3.13 -r3.14
--- RTIA/RTIA.hh        7 May 2008 09:55:01 -0000       3.13
+++ RTIA/RTIA.hh        23 Jun 2008 12:49:15 -0000      3.14
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIA.hh,v 3.13 2008/05/07 09:55:01 rousse Exp $
+// $Id: RTIA.hh,v 3.14 2008/06/23 12:49:15 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIA_HH
@@ -40,7 +40,7 @@
 class RTIA
 {
 public:
-    RTIA();
+    RTIA(int RTIA_port);
     ~RTIA();
 
     void execute();
@@ -74,4 +74,4 @@
 
 #endif // _CERTI_RTIA_HH
 
-// $Id: RTIA.hh,v 3.13 2008/05/07 09:55:01 rousse Exp $
+// $Id: RTIA.hh,v 3.14 2008/06/23 12:49:15 erk Exp $




reply via email to

[Prev in Thread] Current Thread [Next in Thread]