# Communications.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002-2005  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: Communications.hh,v 3.17 2008/10/12 11:46:39 gotthardp Exp $
    00022 // ----------------------------------------------------------------------------
    00023
    00024 #ifndef _CERTI_COMMUNICATIONS_HH
    00025 #define _CERTI_COMMUNICATIONS_HH
    00026
    00027 #include "certi.hh"
    00028 #include "NetworkMessage.hh"
    00029 #include "Message.hh"
    00030 #include "SocketUN.hh"
    00031 #include "SocketTCP.hh"
    00032 #include "SocketUDP.hh"
    00033 #ifdef FEDERATION_USES_MULTICAST
    00034 #include "SocketMC.hh"
    00035 #endif
    00036
    00037 #include <list>
    00038
    00039 namespace certi {
    00040 namespace rtia {
    00041
    00042 class Communications
    00043 {
    00044 public:
    00045     Communications(int RTIA_port);
    00046     ~Communications();
    00047
    00049     void sendMessage(NetworkMessage *Msg);
    00050     void sendUN(Message *Msg);
    00051     void receiveUN(Message *Msg);
    00052     void readMessage(int&, NetworkMessage **, Message **, struct timeval *);
    00053     void requestFederateService(Message *req);
    00054     unsigned long getAddress();
    00055     unsigned int getPort();
    00063     NetworkMessage* waitMessage(NetworkMessage::Type type_msg,
    00064                                 FederateHandle numeroFedere);
    00065
    00066     MessageBuffer NM_msgBufSend,NM_msgBufReceive;
    00067     MessageBuffer msgBufSend, msgBufReceive ;
    00068
    00069 protected:
    00070     SocketUN *socketUN;
    00071 #ifdef FEDERATION_USES_MULTICAST
    00072     SocketMC *socketMC;
    00073 #endif
    00074     SocketTCP *socketTCP;
    00075     SocketUDP *socketUDP;
    00076
    00077 private:
    00083     std::list<NetworkMessage *> waitingList ;
    00084
    00085     bool searchMessage(NetworkMessage::Type type_msg,
    00086                FederateHandle numeroFedere,
    00087                NetworkMessage **msg);
    00088 };
    00089
    00090 }} // namespace certi/rtia
    00091
    00092 #endif // _CERTI_COMMUNICATIONS_HH
    00093
    00094 // $Id: Communications.hh,v 3.17 2008/10/12 11:46:39 gotthardp Exp $