RTIG.hh

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // CERTI - HLA RunTime Infrastructure
00003 // Copyright (C) 2002, 2003, 2004  ONERA
00004 //
00005 // This file is part of CERTI
00006 //
00007 // CERTI is free software ; you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation ; either version 2 of the License, or
00010 // (at your option) any later version.
00011 //
00012 // CERTI is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY ; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with this program ; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00020 //
00021 // $Id: RTIG.hh,v 3.31 2008/11/20 18:21:56 approx Exp $
00022 // ----------------------------------------------------------------------------
00023 
00024 #ifndef CERTI_RTIG_HH
00025 #define CERTI_RTIG_HH
00026 
00027 #include "certi.hh"
00028 #include "NetworkMessage.hh"
00029 #include "NM_Classes.hh"
00030 #include "SecureTCPSocket.hh"
00031 #include "SocketServer.hh"
00032 #include "FederationsList.hh"
00033 #include "AuditFile.hh"
00034 #include "HandleManager.hh"
00035 
00036 namespace certi {
00037 namespace rtig {
00038 
00050 class RTIG
00051 {
00052 public:
00053     RTIG();
00054     ~RTIG();
00055 
00056     static void signalHandler(int sig);
00057     static bool terminate ;
00058     void setVerboseLevel(int level) { verboseLevel = level ; federations.setVerboseLevel(level);}
00059     void execute();
00060 
00061 
00062 private:
00063     // Both methods return the socket, because it may have been closed
00064     // & deleted.
00065   Socket* processIncomingMessage(Socket*) throw (NetworkError) ;
00066     Socket* chooseProcessingMethod(Socket*, NetworkMessage *);
00067 
00068     void openConnection();
00069     void closeConnection(Socket*, bool emergency);
00070 
00071     // Event handlers
00072     void processCreateFederation(Socket*, NetworkMessage*);
00073     void processJoinFederation(Socket*, NetworkMessage*);
00074     void processResignFederation(Socket*,Handle, FederateHandle);
00075     void processDestroyFederation(Socket*, NetworkMessage*);
00076     void processSetClassRelevanceAdvisorySwitch(Socket*, 
00077                     NM_Set_Class_Relevance_Advisory_Switch*);
00078     void processSetInteractionRelevanceAdvisorySwitch(Socket*, 
00079                     NM_Set_Interaction_Relevance_Advisory_Switch*);
00080     void processSetAttributeRelevanceAdvisorySwitch(Socket*,
00081                     NM_Set_Attribute_Relevance_Advisory_Switch*);
00082     void processSetAttributeScopeAdvisorySwitch(Socket*, 
00083                     NM_Set_Attribute_Scope_Advisory_Switch*);
00084     void processSetTimeRegulating(Socket*, NM_Set_Time_Regulating *msg);
00085     void processSetTimeConstrained(Socket*, NM_Set_Time_Constrained *msg);
00086     void processMessageNull(NetworkMessage*);
00087     void processRegisterSynchronization(Socket*, NM_Register_Federation_Synchronization_Point*);
00088     void processSynchronizationAchieved(Socket*, NetworkMessage*);
00089     void processRequestFederationSave(Socket*, NetworkMessage*);
00090     void processFederateSaveBegun(Socket*, NetworkMessage*);
00091     void processFederateSaveStatus(Socket*, NetworkMessage*);
00092     void processRequestFederationRestore(Socket*, NetworkMessage*);
00093     void processFederateRestoreStatus(Socket*, NetworkMessage*);
00094     void processPublishObjectClass(Socket*, NetworkMessage*);
00095     void processSubscribeObjectClass(Socket*, NetworkMessage*);
00096     void processUnpublishObjectClass(Socket*, NetworkMessage*);
00097     void processUnsubscribeObjectClass(Socket*, NetworkMessage*);
00098     void processPublishInteractionClass(Socket*, NetworkMessage*);
00099     void processSubscribeInteractionClass(Socket*, NetworkMessage*);
00100     void processUnpublishInteractionClass(Socket*, NetworkMessage*);
00101     void processUnsubscribeInteractionClass(Socket*, NetworkMessage*msg);
00102     void processRegisterObject(Socket*, NetworkMessage*);
00103     void processUpdateAttributeValues(Socket*, NetworkMessage*);
00104     void processSendInteraction(Socket*, NetworkMessage*);
00105     void processDeleteObject(Socket*, NetworkMessage*);
00106     void processQueryAttributeOwnership(Socket*, NetworkMessage*);
00107     void processNegotiatedOwnershipDivestiture(Socket*, NetworkMessage*);
00108     void processAcquisitionIfAvailable(Socket*, NetworkMessage*);
00109     void processUnconditionalDivestiture(Socket*, NetworkMessage*);
00110     void processOwnershipAcquisition(Socket*, NetworkMessage*);
00111     void processCancelNegotiatedDivestiture(Socket*, NetworkMessage*);
00112     void processAttributeOwnedByFederate(Socket*, NetworkMessage*);
00113     void processReleaseResponse(Socket*, NetworkMessage*);
00114     void processCancelAcquisition(Socket*, NetworkMessage*);
00115     void processCreateRegion(Socket*, NetworkMessage*);
00116     void processModifyRegion(Socket*, NetworkMessage*);
00117     void processDeleteRegion(Socket*, NetworkMessage*);
00118     void processAssociateRegion(Socket*, NetworkMessage*);
00119     void processUnassociateRegion(Socket*, NetworkMessage*);
00120     void processSubscribeAttributesWR(Socket*, NetworkMessage*);
00121     void processUnsubscribeAttributesWR(Socket*, NetworkMessage*);
00122     void processSubscribeInteractionWR(Socket*, NetworkMessage*);
00123     void processUnsubscribeInteractionWR(Socket*, NetworkMessage*);
00124     void processRegisterObjectWithRegion(Socket*, NetworkMessage*);
00125     void processRequestObjectAttributeValueUpdate(Socket*, NetworkMessage*);
00126 
00127 private:
00128     int tcpPort ;
00129     int udpPort ;
00130     int verboseLevel ;
00131     HandleManager<Handle> federationHandles ;
00132     SocketTCP tcpSocketServer ;
00133     SocketUDP udpSocketServer ;
00134     SocketServer socketServer ;
00135     AuditFile auditServer ;
00136     FederationsList federations ;
00137     /* The message buffer used to send Network messages */
00138     MessageBuffer NM_msgBufSend;
00139     /* The message buffer used to receive Network messages */
00140     MessageBuffer NM_msgBufReceive;
00141 };
00142 
00143 }} // namespaces
00144 
00145 #endif // CERTI_RTIG_HH
00146 
00147 // $Id: RTIG.hh,v 3.31 2008/11/20 18:21:56 approx Exp $

Generated on Thu Apr 30 15:53:50 2009 for CERTIDeveloperDocumentation by doxygen 1.5.5