00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _CERTI_SOCKET_SERVER_HH
00026 #define _CERTI_SOCKET_SERVER_HH
00027
00028 #include "certi.hh"
00029 #include "Socket.hh"
00030 #include "SocketTCP.hh"
00031 #include "SocketUDP.hh"
00032 #include "NetworkMessage.hh"
00033 #include "SecurityLevel.hh"
00034 #include "SecureTCPSocket.hh"
00035
00036 #include <list>
00037
00038 namespace certi {
00039
00040
00042 class SocketTuple
00043 {
00044 public:
00045 Handle Federation ;
00046 FederateHandle Federate ;
00047
00048 SocketTCP *ReliableLink ;
00049 SocketUDP *BestEffortLink ;
00050
00051 SocketTuple(Socket *theTCPLink);
00052 ~SocketTuple();
00053 };
00054
00055
00063 class CERTI_EXPORT SocketServer : private std::list<SocketTuple *>
00064 {
00065 public:
00066 SocketServer(SocketTCP *tcp_socket,
00067 SocketUDP *udp_socket, int the_port);
00068
00069 ~SocketServer();
00070
00071
00072
00073
00074 void open()
00075 throw (RTIinternalError);
00076
00077 void close(long socket,
00078 Handle &federation_referenced,
00079 FederateHandle &federate_referenced)
00080 throw (RTIinternalError);
00081
00082 void setReferences(long the_socket,
00083 Handle federation_reference,
00084 FederateHandle federate_reference,
00085 unsigned long the_address,
00086 unsigned int the_port)
00087 throw (RTIinternalError);
00088
00089
00090
00091
00092 void checkMessage(long socket, NetworkMessage *message) const
00093 throw (SecurityError);
00094
00095
00096
00097
00098 int addToFDSet(fd_set *select_fdset);
00099 Socket *getActiveSocket(fd_set *select_fdset) const ;
00100
00101
00102
00103
00104 Socket *getSocketLink(Handle the_federation,
00105 FederateHandle the_federate,
00106 TransportType the_type = RELIABLE) const
00107 throw (FederateNotExecutionMember, RTIinternalError);
00108
00109 SocketTuple *getWithReferences(Handle the_federation,
00110 FederateHandle the_federate) const
00111 throw (FederateNotExecutionMember);
00112
00113 private:
00114
00115 SocketTCP *ServerSocketTCP ;
00116 SocketUDP *ServerSocketUDP ;
00117
00118
00119
00120
00121
00122 SocketTuple *getWithSocket(long socket_descriptor) const
00123 throw (RTIinternalError);
00124 };
00125
00126 }
00127
00128 #endif // _CERTI_SOCKET_SERVER_HH
00129
00130