certi-cvs
[Top][All Lists]
Advanced

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

certi RTIA/FederationManagement.cc RTIA/Federat...


From: certi-cvs
Subject: certi RTIA/FederationManagement.cc RTIA/Federat...
Date: Tue, 11 Dec 2007 16:44:21 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     ROUSSELOT <rousse>      07/12/11 16:44:21

Modified files:
        RTIA           : FederationManagement.cc FederationManagement.hh 
                         RTIA_federate.cc 
        RTIG           : Federation.cc FederationsList.cc 
                         FederationsList.hh RTIG_processing.cc 
        include        : certi.hh 
        libCERTI       : Message.cc Message.hh MessageBody.cc 
                         MessageBody.hh Message_R.cc Message_W.cc 
                         NetworkMessage.cc NetworkMessage.hh 
                         NetworkMessage_RW.cc 
        libRTI         : RTIambPrivateRefs.cc 

Log message:
        constant MAX_FEDFILE_NAME_LENGTH deleted
        FED file name of any name authorized

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.cc?cvsroot=certi&r1=3.36&r2=3.37
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.hh?cvsroot=certi&r1=3.19&r2=3.20
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_federate.cc?cvsroot=certi&r1=3.55&r2=3.56
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.71&r2=3.72
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.cc?cvsroot=certi&r1=3.46&r2=3.47
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.hh?cvsroot=certi&r1=3.36&r2=3.37
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG_processing.cc?cvsroot=certi&r1=3.45&r2=3.46
http://cvs.savannah.gnu.org/viewcvs/certi/include/certi.hh?cvsroot=certi&r1=3.21&r2=3.22
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.cc?cvsroot=certi&r1=3.41&r2=3.42
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.hh?cvsroot=certi&r1=3.38&r2=3.39
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/MessageBody.cc?cvsroot=certi&r1=3.14&r2=3.15
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/MessageBody.hh?cvsroot=certi&r1=3.14&r2=3.15
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message_R.cc?cvsroot=certi&r1=3.9&r2=3.10
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message_W.cc?cvsroot=certi&r1=3.10&r2=3.11
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NetworkMessage.cc?cvsroot=certi&r1=3.21&r2=3.22
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NetworkMessage.hh?cvsroot=certi&r1=3.26&r2=3.27
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NetworkMessage_RW.cc?cvsroot=certi&r1=3.34&r2=3.35
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.cc?cvsroot=certi&r1=3.8&r2=3.9

Patches:
Index: RTIA/FederationManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.cc,v
retrieving revision 3.36
retrieving revision 3.37
diff -u -b -r3.36 -r3.37
--- RTIA/FederationManagement.cc        19 Nov 2007 10:20:53 -0000      3.36
+++ RTIA/FederationManagement.cc        11 Dec 2007 16:44:19 -0000      3.37
@@ -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: FederationManagement.cc,v 3.36 2007/11/19 10:20:53 erk Exp $
+// $Id: FederationManagement.cc,v 3.37 2007/12/11 16:44:19 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -67,7 +67,7 @@
 
     _nom_federation[0] = 0 ;
     _nom_federe[0] = 0 ;
-    _FEDid[0] = 0 ;
+    _FEDid = NULL ;
 }
 
 // ----------------------------------------------------------------------------
@@ -122,15 +122,20 @@
         {
         requete.type = NetworkMessage::CREATE_FEDERATION_EXECUTION ;
         strcpy(requete.federationName, theName);
+        requete.FEDid = new char[strlen(_FEDid)+1] ;
         strcpy(requete.FEDid, _FEDid) ;
 
-        G.Out(pdGendoc,"createFederationExecution====>send Message to RTIG");
+        G.Out(pdGendoc,"createFederationExecution====>   send Message to 
RTIG");
 
         comm->sendMessage(&requete);
 
         comm->waitMessage(&reponse, 
NetworkMessage::CREATE_FEDERATION_EXECUTION,
                           federate);
+
+        G.Out(pdGendoc,"createFederationExecution<== receive Message from 
RTIG");
+
         // We have to see if C_F_E is OK.
+
         if (reponse.exception == e_NO_EXCEPTION)
             {
             strcpy(_nom_federation, theName);
@@ -231,7 +236,7 @@
 {
     NetworkMessage requete, reponse, requeteFED ;
     int i, nb ;
-    char filename[MAX_FEDFILE_NAME_LENGTH] ; // Needed for working file name
+    char *filename ; // Needed for working file name
 
     G.Out(pdGendoc,"enter FederationManagement::joinFederationExecution");
     D.Out(pdInit, "Join Federation %s as %s.", Federation, Federate);
@@ -268,16 +273,19 @@
             {
            stat->rtiService(NetworkMessage::GET_FED_FILE);
             // RTIA have to open a new file for working
-            // We have to build a name for working file, name begins by _RTIA_
-            strcpy(filename,"_RTIA_");
-
+            // We have to build a name for working file, name begins by _RTIA_ 
(6 char)
             // First pid converted in char and added
-            // Then federation name added also
-            // Last file type : fed or xml ?
+            // Then federation name
+            // File type (4)
             char pid_name[10];
             sprintf(pid_name,"%d_",getpid());
+
+            filename = new char[6+strlen(pid_name)+strlen(Federation)+4+1] ;
+            strcpy(filename,"_RTIA_");
             strcat(filename,pid_name); 
             strcat(filename,Federation);     
+            // Last file type : fed or xml ?
+   
             string filename_RTIG = reponse.FEDid ;
             int nbcar_filename_RTIG=filename_RTIG.length();        
             string extension = filename_RTIG.substr(nbcar_filename_RTIG-3,3) ;
@@ -292,6 +300,7 @@
               else 
                   throw CouldNotOpenFED("nor .fed nor .xml"); 
             // FED filename for working must be stored
+            _FEDid =  new char[strlen(filename)+1] ;
             strcpy(_FEDid,filename) ;              
             // RTIA opens working file
             FILE *fdd;
@@ -302,6 +311,8 @@
             requeteFED.type = NetworkMessage::GET_FED_FILE ;
             strcpy(requeteFED.federationName, Federation);
             strcpy(requeteFED.federateName, Federate);
+            requeteFED.FEDid = new char[strlen(filename)+1] ;
+            strcpy(requeteFED.FEDid,filename) ;
             if ( e == e_NO_EXCEPTION)
                 requeteFED.number = 0 ;  // OK for open
             else
@@ -340,6 +351,8 @@
                 strcpy(requeteFED.federationName, Federation);
                 strcpy(requeteFED.federateName, Federate);
                 requeteFED.number = num_line ;  
+                requeteFED.FEDid = new char[strlen(filename)+1] ;
+                strcpy(requeteFED.FEDid,filename) ; 
                 comm->sendMessage(&requeteFED);            
                 }
             // close working file
@@ -930,4 +943,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: FederationManagement.cc,v 3.36 2007/11/19 10:20:53 erk Exp $
+// $Id: FederationManagement.cc,v 3.37 2007/12/11 16:44:19 rousse Exp $

Index: RTIA/FederationManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.hh,v
retrieving revision 3.19
retrieving revision 3.20
diff -u -b -r3.19 -r3.20
--- RTIA/FederationManagement.hh        16 Nov 2007 15:04:21 -0000      3.19
+++ RTIA/FederationManagement.hh        11 Dec 2007 16:44:19 -0000      3.20
@@ -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: FederationManagement.hh,v 3.19 2007/11/16 15:04:21 rousse Exp $
+// $Id: FederationManagement.hh,v 3.20 2007/12/11 16:44:19 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIA_FEDERATION_MANAGEMENT
@@ -100,7 +100,7 @@
     Handle _numero_federation ;
     FederateHandle federate ;
     bool _fin_execution ;
-    char _FEDid[MAX_FEDFILE_NAME_LENGTH + 1 ] ;
+    char *_FEDid ;
 
 private:
     Communications *comm ;
@@ -122,4 +122,4 @@
 
 #endif // _CERTI_RTIA_FEDERATION_MANAGEMENT
 
-// $Id: FederationManagement.hh,v 3.19 2007/11/16 15:04:21 rousse Exp $
+// $Id: FederationManagement.hh,v 3.20 2007/12/11 16:44:19 rousse Exp $

Index: RTIA/RTIA_federate.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_federate.cc,v
retrieving revision 3.55
retrieving revision 3.56
diff -u -b -r3.55 -r3.56
--- RTIA/RTIA_federate.cc       5 Dec 2007 12:29:39 -0000       3.55
+++ RTIA/RTIA_federate.cc       11 Dec 2007 16:44:19 -0000      3.56
@@ -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_federate.cc,v 3.55 2007/12/05 12:29:39 approx Exp $
+// $Id: RTIA_federate.cc,v 3.56 2007/12/11 16:44:19 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -104,10 +104,13 @@
         D.Out(pdTrace,
               "Receiving Message from Federate, type CreateFederation.");
         // Store FEDid for future usage (JOIN_FEDERATION_EXECUTION) into fm
+        fm->_FEDid = new char[strlen(req->getFEDid())+1] ;
         strcpy(fm->_FEDid, req->getFEDid()) ;
         fm->createFederationExecution(req->getFederationName(), e);
         D.Out(pdTrace, "Receiving Message from Federate, "
               "type CreateFederation done.");
+        // RTIA needs FEDid into the answer (rep Message) to federate
+        rep.setFEDid(fm->_FEDid) ;
         break ;
 
       case Message::DESTROY_FEDERATION_EXECUTION:
@@ -678,7 +681,6 @@
 
         try {
             rep.setName(om->getObjectClassName(req->getObjectClass()).c_str());
-std::cout<<"rep.setName"<<std::endl;
         }
         catch (ObjectClassNotDefined) {
             rep.setException(e_ObjectClassNotDefined);
@@ -892,6 +894,7 @@
         throw RTIinternalError("");
     }
     stat.federateService(req->type);
+    G.Out(pdGendoc,"exit  chooseFederateProcessing");
 }
 
 // ----------------------------------------------------------------------------
@@ -1250,4 +1253,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA_federate.cc,v 3.55 2007/12/05 12:29:39 approx Exp $
+// $Id: RTIA_federate.cc,v 3.56 2007/12/11 16:44:19 rousse Exp $

Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.71
retrieving revision 3.72
diff -u -b -r3.71 -r3.72
--- RTIG/Federation.cc  5 Dec 2007 12:29:39 -0000       3.71
+++ RTIG/Federation.cc  11 Dec 2007 16:44:19 -0000      3.72
@@ -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: Federation.cc,v 3.71 2007/12/05 12:29:39 approx Exp $
+// $Id: Federation.cc,v 3.72 2007/12/11 16:44:19 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -151,7 +151,8 @@
     // Default Attribute values
     handle = federation_handle ;
 
-    FEDid = strdup(FEDid_name) ;
+    FEDid = new char[strlen(FEDid_name)+1] ;
+    strcpy(FEDid,FEDid_name);
 
     D.Out(pdInit, "New Federation created with Handle %d, now reading FOM.",
           handle);
@@ -406,6 +407,7 @@
 const char *
 Federation::getFEDid() const
 {
+    assert(FEDid != NULL );
     return FEDid ;
 }
 
@@ -2239,5 +2241,5 @@
 
 }} // namespace certi/rtig
 
-// $Id: Federation.cc,v 3.71 2007/12/05 12:29:39 approx Exp $
+// $Id: Federation.cc,v 3.72 2007/12/11 16:44:19 rousse Exp $
 

Index: RTIG/FederationsList.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.cc,v
retrieving revision 3.46
retrieving revision 3.47
diff -u -b -r3.46 -r3.47
--- RTIG/FederationsList.cc     5 Dec 2007 12:29:39 -0000       3.46
+++ RTIG/FederationsList.cc     11 Dec 2007 16:44:19 -0000      3.47
@@ -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: FederationsList.cc,v 3.46 2007/12/05 12:29:39 approx Exp $
+// $Id: FederationsList.cc,v 3.47 2007/12/11 16:44:19 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -328,16 +328,16 @@
                            bool &is_syncing,
                            SocketMC* &comm_mc)
 #else
-    void FederationsList::info(Handle handle,
+    char * FederationsList::info(Handle handle,
                                int &nb_federates,
                                int &nb_regulators,
-                               bool &is_syncing,
-                               char *FED_Filename)
+                               bool &is_syncing)
 #endif
     throw (FederationExecutionDoesNotExist, RTIinternalError)
 {
+    char * FED_Filename = NULL ;
     Federation *federation ;
-
+    G.Out(pdGendoc,"enter FederationsList::info");
     // It may raise RTIinternalError
     checkHandle(handle);
 
@@ -347,11 +347,16 @@
     nb_federates = federation->getNbFederates();
     nb_regulators = federation->getNbRegulators();
     is_syncing = federation->isSynchronizing();
+    // We need federation FEDid
+    FED_Filename = new char[strlen(federation->getFEDid()+1)];
     strcpy(FED_Filename,federation->getFEDid());
 
 #ifdef FEDERATION_USES_MULTICAST
     comm_mc = federation->MCLink ;
 #endif
+    G.Out(pdGendoc,"exit  FederationsList::info");
+    // Return FEDid
+    return FED_Filename ;
 }
 
 // ----------------------------------------------------------------------------
@@ -1510,5 +1515,5 @@
 
 }} // certi::rtig
 
-// EOF $Id: FederationsList.cc,v 3.46 2007/12/05 12:29:39 approx Exp $
+// EOF $Id: FederationsList.cc,v 3.47 2007/12/11 16:44:19 rousse Exp $
 

Index: RTIG/FederationsList.hh
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.hh,v
retrieving revision 3.36
retrieving revision 3.37
diff -u -b -r3.36 -r3.37
--- RTIG/FederationsList.hh     5 Dec 2007 12:29:40 -0000       3.36
+++ RTIG/FederationsList.hh     11 Dec 2007 16:44:20 -0000      3.37
@@ -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: FederationsList.hh,v 3.36 2007/12/05 12:29:40 approx Exp $
+// $Id: FederationsList.hh,v 3.37 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIG_FEDERATIONS_LIST_HH
@@ -79,11 +79,10 @@
               bool &is_syncing,
               SocketMC* &comm_mc)
 #else
-        void info(Handle theHandle,
+        char * info(Handle theHandle,
                   int &nb_federes,
                   int &nb_regulateurs,
-                  bool &is_syncing,
-                  char *FED_Filename)
+                  bool &is_syncing)
 #endif
         throw (FederationExecutionDoesNotExist, RTIinternalError);
 
@@ -277,6 +276,20 @@
     void destroyObject(Handle theHandle,
                        FederateHandle theFederateHandle,
                        ObjectHandle theObjectHandle,
+                      FederationTime theTime,
+                      const char *theUserTag)
+        throw (FederateNotExecutionMember,
+               FederationExecutionDoesNotExist,
+               DeletePrivilegeNotHeld,
+               ObjectNotKnown,
+               SaveInProgress,
+               RestoreInProgress,
+              InvalidFederationTime,
+               RTIinternalError);
+
+    void destroyObject(Handle theHandle,
+                       FederateHandle theFederateHandle,
+                       ObjectHandle theObjectHandle,
                        const char *theUserTag)
         throw (FederateNotExecutionMember,
                FederationExecutionDoesNotExist,
@@ -576,4 +589,4 @@
 
 #endif // _CERTI_RTIG_FEDERATIONS_LIST_HH
 
-// $Id: FederationsList.hh,v 3.36 2007/12/05 12:29:40 approx Exp $
+// $Id: FederationsList.hh,v 3.37 2007/12/11 16:44:20 rousse Exp $

Index: RTIG/RTIG_processing.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG_processing.cc,v
retrieving revision 3.45
retrieving revision 3.46
diff -u -b -r3.45 -r3.46
--- RTIG/RTIG_processing.cc     5 Dec 2007 12:29:40 -0000       3.45
+++ RTIG/RTIG_processing.cc     11 Dec 2007 16:44:20 -0000      3.46
@@ -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: RTIG_processing.cc,v 3.45 2007/12/05 12:29:40 approx Exp $
+// $Id: RTIG_processing.cc,v 3.46 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -105,7 +105,9 @@
     if ( rep.exception == e_NO_EXCEPTION )
         {
         rep.federation = h ;
+        rep.FEDid = new char [strlen(FEDid)+1] ;
         strcpy(rep.FEDid,FEDid) ;
+        strcpy(rep.federationName,federation);
         }
 
     G.Out(pdGendoc,"processCreateFederation===>write");
@@ -126,7 +128,7 @@
 {
     char *federation = req->federationName ;
     char *federate = req->federateName ;
-    char filename[MAX_FEDFILE_NAME_LENGTH + 1] ;
+    char *filename = NULL ;
     
     unsigned int peer = req->bestEffortPeer ;
     unsigned long address = req->bestEffortAddress ;
@@ -160,7 +162,7 @@
                       pause, com_mc);
     assert(com_mc != NULL);
 #else
-    federations.info(num_federation, nb_federes, nb_regulateurs, pause, 
filename);
+    filename = federations.info(num_federation, nb_federes, nb_regulateurs, 
pause);
 #endif
 
     // Store Federate <->Socket reference.
@@ -202,6 +204,7 @@
     repFED.federate = num_federe ;
     repFED.federation = num_federation ;
     repFED.number = 0 ;
+    repFED.FEDid = new char[strlen(filename)+1] ;
     strcpy(repFED.FEDid,filename) ;
     repFED.exception = e ;
     // Send answer
@@ -232,7 +235,7 @@
             repFED.federate = num_federe ;
             repFED.federation = num_federation ;
             repFED.number = num_line ;
-            assert ( strlen(filename) <= MAX_FEDFILE_NAME_LENGTH ) ;
+            repFED.FEDid = new char[strlen(filename)+1] ;
             strcpy(repFED.FEDid,filename) ;
             // line transfered
             repFED.handleArraySize = 1 ;
@@ -254,6 +257,7 @@
         repFED.federate = num_federe ;
         repFED.federation = num_federation ;
         repFED.number = 0 ;
+        repFED.FEDid = new char[strlen(filename)+1] ;
         strcpy(repFED.FEDid,filename) ;   
 
         // Send answer
@@ -1318,4 +1322,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG_processing.cc,v 3.45 2007/12/05 12:29:40 approx Exp $
+// $Id: RTIG_processing.cc,v 3.46 2007/12/11 16:44:20 rousse Exp $

Index: include/certi.hh
===================================================================
RCS file: /sources/certi/certi/include/certi.hh,v
retrieving revision 3.21
retrieving revision 3.22
diff -u -b -r3.21 -r3.22
--- include/certi.hh    27 Nov 2007 13:25:22 -0000      3.21
+++ include/certi.hh    11 Dec 2007 16:44:20 -0000      3.22
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: certi.hh,v 3.21 2007/11/27 13:25:22 erk Exp $
+// $Id: certi.hh,v 3.22 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_HH_INCLUDED
@@ -71,7 +71,6 @@
 #define MAX_BYTES_PER_VALUETYPE 128
 #undef MAX_PARAMETERS_PER_CLASS
 #define MAX_PARAMETERS_PER_CLASS 50
-#define MAX_FEDFILE_NAME_LENGTH 100
 
 // next used in MessageBody constructor with no size
 // EN. change from 500-->536 because HeaderStruct is 36
@@ -326,4 +325,4 @@
 
 #endif // CERTI_HH_INCLUDED
 
-// $Id: certi.hh,v 3.21 2007/11/27 13:25:22 erk Exp $
+// $Id: certi.hh,v 3.22 2007/12/11 16:44:20 rousse Exp $

Index: libCERTI/Message.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.cc,v
retrieving revision 3.41
retrieving revision 3.42
diff -u -b -r3.41 -r3.42
--- libCERTI/Message.cc 27 Nov 2007 08:42:53 -0000      3.41
+++ libCERTI/Message.cc 11 Dec 2007 16:44:20 -0000      3.42
@@ -64,7 +64,7 @@
     dimension = 0 ;
     number = 0 ;
     region = 0 ;
-    FEDid[0] = '\0' ;
+    FEDid = NULL ;
     for ( int i=0 ; i<MAX_ATTRIBUTES_PER_CLASS ; i++ )
         {
         valueArray[i].length = 0 ;
@@ -566,10 +566,12 @@
 void
 Message::setFEDid(const char *NewFEDid)
 {
-    if (strlen(NewFEDid) > MAX_FEDFILE_NAME_LENGTH)
-        throw ValueLengthExceeded("FEDFILE name too long to fit in Message.");
+    //if (strlen(NewFEDid) > MAX_FEDFILE_NAME_LENGTH)
+    //    throw ValueLengthExceeded("FEDFILE name too long to fit in 
Message.");
 
+    FEDid = new char [strlen(NewFEDid)+1] ;
     strcpy(FEDid, NewFEDid);
+
 }
 
 // ----------------------------------------------------------------------------
@@ -627,6 +629,7 @@
         memcpy(valueArray[i].value, msg.valueArray[i].value, 
msg.valueArray[i].length );
         }
 
+    FEDid = new char [strlen(msg.FEDid)+1] ;
     strcpy(FEDid, msg.FEDid) ;
 
     return *this ;

Index: libCERTI/Message.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.hh,v
retrieving revision 3.38
retrieving revision 3.39
diff -u -b -r3.38 -r3.39
--- libCERTI/Message.hh 20 Nov 2007 09:04:54 -0000      3.38
+++ libCERTI/Message.hh 11 Dec 2007 16:44:20 -0000      3.39
@@ -469,7 +469,8 @@
     char federateName[MAX_FEDERATE_NAME_LENGTH + 1] ;
     char federationName[MAX_FEDERATION_NAME_LENGTH + 1] ;
     char tag[MAX_USER_TAG_LENGTH + 1] ;
-    char FEDid[MAX_FEDFILE_NAME_LENGTH + 1] ;
+    // char FEDid[MAX_FEDFILE_NAME_LENGTH + 1] ;
+    char *FEDid ;
     // valueArray is now a ValueLengthPair
     ValueLengthPair valueArray[MAX_ATTRIBUTES_PER_CLASS] ;
 };

Index: libCERTI/MessageBody.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/MessageBody.cc,v
retrieving revision 3.14
retrieving revision 3.15
diff -u -b -r3.14 -r3.15
--- libCERTI/MessageBody.cc     20 Nov 2007 09:04:54 -0000      3.14
+++ libCERTI/MessageBody.cc     11 Dec 2007 16:44:20 -0000      3.15
@@ -17,7 +17,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: MessageBody.cc,v 3.14 2007/11/20 09:04:54 erk Exp $
+// $Id: MessageBody.cc,v 3.15 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -78,6 +78,7 @@
 // ----------------------------------------------------------------------------
 void MessageBody::sPutS(char *pData)
 {//Write a string into Buffer
+assert(pData != NULL);
 unsigned short dataSize= strlen(pData); 
 
 if ((dataSize + sizeof(unsigned short)) < bSize)
@@ -181,4 +182,4 @@
 
 } // certi
 
-// $Id: MessageBody.cc,v 3.14 2007/11/20 09:04:54 erk Exp $
+// $Id: MessageBody.cc,v 3.15 2007/12/11 16:44:20 rousse Exp $

Index: libCERTI/MessageBody.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/MessageBody.hh,v
retrieving revision 3.14
retrieving revision 3.15
diff -u -b -r3.14 -r3.15
--- libCERTI/MessageBody.hh     4 Oct 2007 12:47:30 -0000       3.14
+++ libCERTI/MessageBody.hh     11 Dec 2007 16:44:20 -0000      3.15
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: MessageBody.hh,v 3.14 2007/10/04 12:47:30 rousse Exp $
+// $Id: MessageBody.hh,v 3.15 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef LIBCERTI_MESSAGE_BODY_HH
@@ -87,4 +87,4 @@
 
 #endif // LIBCERTI_MESSAGE_BODY_HH
 
-// $Id: MessageBody.hh,v 3.14 2007/10/04 12:47:30 rousse Exp $
+// $Id: MessageBody.hh,v 3.15 2007/12/11 16:44:20 rousse Exp $

Index: libCERTI/Message_R.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message_R.cc,v
retrieving revision 3.9
retrieving revision 3.10
diff -u -b -r3.9 -r3.10
--- libCERTI/Message_R.cc       5 Dec 2007 12:29:40 -0000       3.9
+++ libCERTI/Message_R.cc       11 Dec 2007 16:44:20 -0000      3.10
@@ -17,7 +17,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Message_R.cc,v 3.9 2007/12/05 12:29:40 approx Exp $
+// $Id: Message_R.cc,v 3.10 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -39,12 +39,12 @@
 Message::read(SocketUN *socket)
     throw (NetworkError, NetworkSignal)
 {
-
+    G.Out(pdGendoc,"enter Message::read");
     bool has_body = readHeader(socket);
 
     if (has_body)
       readBody(socket);
-
+    G.Out(pdGendoc,"exit  Message::read");
 }
 
 // ----------------------------------------------------------------------------
@@ -52,6 +52,8 @@
 void
 Message::readBody(SocketUN *socket)
 {
+    G.Out(pdGendoc,"enter Message::readBody body size=%d,",header.bodySize);
+ 
     assert(header.bodySize > 0);
 
     MessageBody body(header.bodySize);
@@ -453,6 +455,7 @@
             throw RTIinternalError("Message: Unknown Type for Body(Read).");
         }
     }
+    G.Out(pdGendoc,"exit  Message::readBody");
 }
 
 // ----------------------------------------------------------------------------
@@ -462,6 +465,8 @@
 bool
 Message::readHeader(SocketUN *socket)
 {
+    G.Out(pdGendoc,"enter Message::readHeader header 
size=%d",sizeof(MessageHeader));
+
     // 1- Read Header from Socket
     socket->receive((const unsigned char *) &header, sizeof(MessageHeader));
 
@@ -469,12 +474,14 @@
     type = header.type ;
     exception = header.exception ;
     setFederationTime(header.date);
-
     // If the message carry an exception, the Body will only contain the
     // exception reason.
 
     if (exception != e_NO_EXCEPTION)
+        {
+        G.Out(pdGendoc,"exit  Message::readHeader carrying an exception");
         return true ;
+        }
 
     // 2- Determine if body exists or not
     // NULL, UAV and SendInteraction are the most common ones.
@@ -620,10 +627,14 @@
 
       default:
         D.Out(pdExcept, "Unknown type %d in ReadHeader.", header.type);
+        G.Out(pdGendoc,"exit  Message::readHeader on RTIinternalError unknown 
type");
         throw RTIinternalError("Message: Received unknown Header type.");
     }
 
     // 4- Return depends on body
+    G.Out(pdGendoc,"      Message::readHeader 
header.bodySize=%d",header.bodySize);
+    G.Out(pdGendoc,"exit  Message::readHeader");
+
     return header.bodySize != 0 ;
 }
 
@@ -680,8 +691,18 @@
 void
 Message::readFEDid(MessageBody &body)
 {
-    body.readString(FEDid, MAX_FEDFILE_NAME_LENGTH);
+    G.Out(pdGendoc,"enter Message::readFEDid");
+    short FEDidSize ;
+    FEDidSize = body.readShortInt() ;
+    FEDid = new char[FEDidSize+1] ;
+    if ( FEDidSize == 0 )
+        FEDid[0] = '\0' ;
+    else
+        body.readString(FEDid,FEDidSize);
+    G.Out(pdGendoc,"               readFEDid FEDid=%s",FEDid);
+    G.Out(pdGendoc,"exit  Message::readFEDid");
 }
+
 // ----------------------------------------------------------------------------
 //! readValueArray.
 void
@@ -704,4 +725,4 @@
 
 } // namespace certi
 
-// $Id: Message_R.cc,v 3.9 2007/12/05 12:29:40 approx Exp $
+// $Id: Message_R.cc,v 3.10 2007/12/11 16:44:20 rousse Exp $

Index: libCERTI/Message_W.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message_W.cc,v
retrieving revision 3.10
retrieving revision 3.11
diff -u -b -r3.10 -r3.11
--- libCERTI/Message_W.cc       5 Dec 2007 12:29:40 -0000       3.10
+++ libCERTI/Message_W.cc       11 Dec 2007 16:44:20 -0000      3.11
@@ -17,7 +17,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: Message_W.cc,v 3.10 2007/12/05 12:29:40 approx Exp $
+// $Id: Message_W.cc,v 3.11 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -39,12 +39,12 @@
 Message::write(SocketUN *socket)
     throw (NetworkError, NetworkSignal)
 {
-
+    G.Out(pdGendoc,"enter Message::write");
     bool result ;
     result = writeHeader(socket);
     if (result)
         writeBody(socket);
-
+    G.Out(pdGendoc,"exit  Message::write");
 }
 
 // ----------------------------------------------------------------------------
@@ -56,7 +56,7 @@
 Message::writeBody(SocketUN *socket)
 {
     MessageBody body ;
-
+    G.Out(pdGendoc,"enter Message::writeBody body size=%d",header.bodySize);   
 
     // 0- Copy the Header at the beginning of the Body, in order to
     // make a single Socket->Emettre call while sending both.
     // WARNING: As the Body size is not known yet, we will have to
@@ -78,6 +78,7 @@
           // Note : relevant only on federate request
           case CREATE_FEDERATION_EXECUTION:
             body.writeString(federationName);
+            body.writeShortInt(strlen(FEDid));
             body.writeString(FEDid);
             break ;
 
@@ -464,7 +465,9 @@
 
     // 3- Write Header to socket, then write Body to socket.
     // socket->send((void *) &Header, sizeof(MessageHeader));
+    G.Out(pdGendoc,"Message::writeBody type= %d 
body.size=%d",header.type,body.size());
     socket->send(body.getBuffer(), body.size());
+    G.Out(pdGendoc,"exit  Message::writeBody");
 }
 
 // ----------------------------------------------------------------------------
@@ -483,6 +486,7 @@
 bool
 Message::writeHeader(SocketUN *socket)
 {
+    G.Out(pdGendoc,"enter Message::writeHeader header 
size=%d",sizeof(MessageHeader));
     // 1- Clear Header
     memset((void *) &header, '\0', sizeof(MessageHeader));
 
@@ -498,6 +502,7 @@
 
     if (exception != e_NO_EXCEPTION) {
         header.bodySize = 1 ;
+        G.Out(pdGendoc,"exit  Message::writeHeader carrying exception");
         return true ;
     }
 
@@ -664,6 +669,7 @@
     if (header.bodySize == 0)
         socket->send((const unsigned char *) &header, sizeof(MessageHeader));
 
+    G.Out(pdGendoc,"exit  Message::writeHeader");
     return header.bodySize != 0 ;
 }
 
@@ -689,4 +695,4 @@
 
 } // namespace certi
 
-// $Id: Message_W.cc,v 3.10 2007/12/05 12:29:40 approx Exp $
+// $Id: Message_W.cc,v 3.11 2007/12/11 16:44:20 rousse Exp $

Index: libCERTI/NetworkMessage.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/NetworkMessage.cc,v
retrieving revision 3.21
retrieving revision 3.22
diff -u -b -r3.21 -r3.22
--- libCERTI/NetworkMessage.cc  13 Nov 2007 13:25:40 -0000      3.21
+++ libCERTI/NetworkMessage.cc  11 Dec 2007 16:44:20 -0000      3.22
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: NetworkMessage.cc,v 3.21 2007/11/13 13:25:40 rousse Exp $
+// $Id: NetworkMessage.cc,v 3.22 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -30,7 +30,7 @@
 using std::vector ;
 
 namespace certi {
-
+static PrettyDebug G("GENDOC",__FILE__);
 // ----------------------------------------------------------------------------
 void
 NetworkMessage::display(const char *s)
@@ -68,7 +68,7 @@
     federationName[0] = '\0' ;
     federateName[0] = '\0' ;
     label[0] = '\0' ;
-    FEDid[0] = '\0' ;
+    FEDid = NULL ;
 
     bestEffortPeer = -1 ;
     bestEffortAddress = 0 ;
@@ -232,10 +232,12 @@
 NetworkMessage::read(Socket *socket)
     throw (NetworkError, NetworkSignal)
 {
+    G.Out(pdGendoc,"enter NetworkMessage::read");
     bool has_body = readHeader(socket);
 
     if (has_body)
         readBody(socket);
+    G.Out(pdGendoc,"exit  NetworkMessage::read");
 }
 
 // ----------------------------------------------------------------------------
@@ -305,9 +307,8 @@
 void
 NetworkMessage::setFEDid(const char *NewFEDid)
 {
-    if (strlen(NewFEDid) > MAX_FEDFILE_NAME_LENGTH)
-        throw ValueLengthExceeded("FEDFILE name too long to fit in Network 
Message.");
-
+    assert ( NewFEDid != NULL) ;
+    FEDid = new char[strlen(NewFEDid)+1] ;
     strcpy(FEDid, NewFEDid);
 }
 
@@ -315,8 +316,18 @@
 void
 NetworkMessage::readFEDid(MessageBody &body)
 {
-    body.readString(FEDid, MAX_FEDFILE_NAME_LENGTH);
+    G.Out(pdGendoc,"enter NetworkMessage::readFEDid");
+    short FEDidSize ;
+    FEDidSize = body.readShortInt() ;
+    FEDid = new char[FEDidSize+1] ;
+    if ( FEDidSize == 0 )
+        FEDid[0] = '\0' ;
+    else
+        body.readString(FEDid,FEDidSize);
+    G.Out(pdGendoc,"                      readFEDid FEDid=%s",FEDid);
+    G.Out(pdGendoc,"exit  NetworkMessage::readFEDid");
 }
+
 } // namespace certi
 
-// $Id: NetworkMessage.cc,v 3.21 2007/11/13 13:25:40 rousse Exp $
+// $Id: NetworkMessage.cc,v 3.22 2007/12/11 16:44:20 rousse Exp $

Index: libCERTI/NetworkMessage.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/NetworkMessage.hh,v
retrieving revision 3.26
retrieving revision 3.27
diff -u -b -r3.26 -r3.27
--- libCERTI/NetworkMessage.hh  13 Nov 2007 13:25:40 -0000      3.26
+++ libCERTI/NetworkMessage.hh  11 Dec 2007 16:44:20 -0000      3.27
@@ -17,7 +17,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: NetworkMessage.hh,v 3.26 2007/11/13 13:25:40 rousse Exp $
+// $Id: NetworkMessage.hh,v 3.27 2007/12/11 16:44:20 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef CERTI_NETWORK_MESSAGE_HH
@@ -243,7 +243,7 @@
     FederateHandle federate ;
     char federationName[MAX_FEDERATION_NAME_LENGTH + 1] ;
     char federateName[MAX_FEDERATE_NAME_LENGTH + 1] ;
-    char FEDid[MAX_FEDFILE_NAME_LENGTH + 1] ;
+    char *FEDid ;
 
     int bestEffortPeer ;
     unsigned long bestEffortAddress ;
@@ -322,4 +322,4 @@
 
 #endif // CERTI_NETWORK_MESSAGE_HH
 
-// $Id: NetworkMessage.hh,v 3.26 2007/11/13 13:25:40 rousse Exp $
+// $Id: NetworkMessage.hh,v 3.27 2007/12/11 16:44:20 rousse Exp $

Index: libCERTI/NetworkMessage_RW.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/NetworkMessage_RW.cc,v
retrieving revision 3.34
retrieving revision 3.35
diff -u -b -r3.34 -r3.35
--- libCERTI/NetworkMessage_RW.cc       5 Dec 2007 12:29:40 -0000       3.34
+++ libCERTI/NetworkMessage_RW.cc       11 Dec 2007 16:44:21 -0000      3.35
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: NetworkMessage_RW.cc,v 3.34 2007/12/05 12:29:40 approx Exp $
+// $Id: NetworkMessage_RW.cc,v 3.35 2007/12/11 16:44:21 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -46,7 +46,7 @@
 {
     MessageBody body ;
     unsigned short i ;
-
+    G.Out(pdGendoc,"enter NetworkMessage::readBody body 
size=%d",Header.bodySize);
     if (Header.bodySize == 0)
         throw RTIinternalError("ReadBody should not have been called.");
 
@@ -68,7 +68,7 @@
     switch(Header.type) {
       case GET_FED_FILE:
         number = body.readShortInt();
-        body.readString(FEDid,MAX_FEDFILE_NAME_LENGTH);
+        readFEDid(body);
         if ( number >= 1 )  // open (0) and close (0) no more information
             {
             ValueArray[0].length = body.readLongInt();
@@ -96,7 +96,6 @@
             ValueArray[i].length = body.readLongInt();
             body.readBlock(ValueArray[i].value, ValueArray[i].length) ;
        }
-G.Out(pdGendoc,"readBody REFLECT_ATTRIBUTE_VALUES objectClass=%d",objectClass);
        break ;
        
        // -- O_I Variable Part With Date(Body Not Empty) --
@@ -291,16 +290,16 @@
        throw RTIinternalError("Unknown/Unimplemented type for body.");
     }
     }
-
+    G.Out(pdGendoc,"exit NetworkMessage::readBody");
 }
 
 // ----------------------------------------------------------------------------
 bool
 NetworkMessage::readHeader(Socket *socket)
 {
+    G.Out(pdGendoc,"enter NetworkMessage::readHeader header 
size=%d",sizeof(HeaderStruct));
     // 1- Read Header from Socket
     socket->receive((void *) &Header, sizeof(HeaderStruct));
-
     // 2- Parse Header(Static Part)
     type = Header.type ;
     exception = Header.exception ;
@@ -310,7 +309,10 @@
     // exception reason.
 
     if (exception != e_NO_EXCEPTION)
+        {
+        G.Out(pdGendoc,"exit  Message::readHeader carrying an exception");
         return true ;
+        }
 
     // 2- Parse Header according to its type(Variable Part)
     switch (Header.type) {
@@ -468,6 +470,7 @@
     }
 
     // 4- If Header.bodySize is not 0, return RTI_TRUE, else RTI_FALSE
+    G.Out(pdGendoc,"exit  NetworkMessage::readHeader");
     return Header.bodySize ;
 }
 
@@ -499,6 +502,7 @@
     switch(Header.type) {
       case GET_FED_FILE:
         body.writeShortInt(number);
+        body.writeShortInt(strlen(FEDid));
         body.writeString(FEDid);
         if ( number >= 1 )  // open (0) and close (0) no more information
             {
@@ -520,7 +524,6 @@
        break ;
 
       case REFLECT_ATTRIBUTE_VALUES:
-G.Out(pdGendoc,"writeBody REFLECT_ATTRIBUTE_VALUES %d",objectClass);
        body.writeLongInt(object);
        body.writeString(label);
         body.writeLongInt(boolean);
@@ -550,6 +553,7 @@
 
       case CREATE_FEDERATION_EXECUTION:
        body.writeString(federationName);
+        body.writeShortInt(strlen(FEDid));
        body.writeString(FEDid);
        break ;
 
@@ -771,7 +775,6 @@
        break ;
 
       case REFLECT_ATTRIBUTE_VALUES:
-G.Out(pdGendoc,"writeHeader REFLECT_ATTRIBUTE_VALUES 
objectClass=%d",objectClass);
        Header.bodySize = 1 ;
         Header.VP.O_I.handle = objectClass ;
         Header.VP.O_I.size = handleArraySize ;
@@ -980,4 +983,4 @@
 
 } // namespace certi
 
-// $Id: NetworkMessage_RW.cc,v 3.34 2007/12/05 12:29:40 approx Exp $
+// $Id: NetworkMessage_RW.cc,v 3.35 2007/12/11 16:44:21 rousse Exp $

Index: libRTI/RTIambPrivateRefs.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambPrivateRefs.cc,v
retrieving revision 3.8
retrieving revision 3.9
diff -u -b -r3.8 -r3.9
--- libRTI/RTIambPrivateRefs.cc 5 Dec 2007 12:29:40 -0000       3.8
+++ libRTI/RTIambPrivateRefs.cc 11 Dec 2007 16:44:21 -0000      3.9
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RTIambPrivateRefs.cc,v 3.8 2007/12/05 12:29:40 approx Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.9 2007/12/11 16:44:21 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -29,6 +29,7 @@
 
 namespace {
 PrettyDebug D("LIBRTI", __FILE__);
+static PrettyDebug G("GENDOC",__FILE__);
 }
 
 RTIambPrivateRefs::RTIambPrivateRefs()
@@ -58,6 +59,7 @@
 void
 RTIambPrivateRefs::executeService(Message *req, Message *rep)
 {
+    G.Out(pdGendoc,"enter RTIambPrivateRefs::executeService");
     // raise exception if reentrant call.
        // FIXME EN: On SMP machine may we really 
        //           guarantee that the following protection
@@ -85,7 +87,7 @@
     }
     catch (NetworkError) {
         std::cerr << "libRTI: exception: NetworkError (read)" << std::endl ;
-        throw RTIinternalError("libRTI: Network Read Error");
+        throw RTIinternalError("libRTI: Network Read Error waiting RTI reply");
     }
 
     D.Out(pdDebug, "RTIA reply received.");
@@ -100,6 +102,7 @@
     D.Out(pdDebug, "processing returned exception (from reply).");
     processException(rep);
     D.Out(pdDebug, "exception processed.");
+    G.Out(pdGendoc,"exit RTIambPrivateRefs::executeService");
 }
 
 // ----------------------------------------------------------------------------
@@ -544,4 +547,4 @@
     }
 }
 
-// $Id: RTIambPrivateRefs.cc,v 3.8 2007/12/05 12:29:40 approx Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.9 2007/12/11 16:44:21 rousse Exp $




reply via email to

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