SocketAcceptor.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIX_SOCKETACCEPTOR_H
00023 #define FIX_SOCKETACCEPTOR_H
00024
00025 #ifdef _MSC_VER
00026 #pragma warning( disable : 4503 4355 4786 4290 )
00027 #endif
00028
00029 #include "Acceptor.h"
00030 #include "SocketServer.h"
00031 #include "SocketConnection.h"
00032
00033 namespace FIX
00034 {
00036 class SocketAcceptor : public Acceptor, SocketServer::Strategy
00037 {
00038 friend class SocketConnection;
00039 public:
00040 SocketAcceptor( Application&, MessageStoreFactory&,
00041 const SessionSettings& ) throw( ConfigError );
00042 SocketAcceptor( Application&, MessageStoreFactory&,
00043 const SessionSettings&, LogFactory& ) throw( ConfigError );
00044
00045 virtual ~SocketAcceptor();
00046
00047 private:
00048 bool readSettings( const SessionSettings& );
00049
00050 typedef std::set < SessionID > Sessions;
00051 typedef std::map < int, Sessions > PortToSessions;
00052 typedef std::map < int, SocketConnection* > SocketConnections;
00053
00054 void onConfigure( const SessionSettings& ) throw ( ConfigError );
00055 void onInitialize( const SessionSettings& ) throw ( RuntimeError );
00056
00057 void onStart();
00058 bool onPoll( double timeout );
00059 void onStop();
00060
00061 void onConnect( SocketServer&, int, int );
00062 void onWrite( SocketServer&, int );
00063 bool onData( SocketServer&, int );
00064 void onDisconnect( SocketServer&, int );
00065 void onError( SocketServer& );
00066 void onTimeout( SocketServer& );
00067
00068 SocketServer* m_pServer;
00069 PortToSessions m_portToSessions;
00070 SocketConnections m_connections;
00071 };
00073 }
00074
00075 #endif //FIX_SOCKETACCEPTOR_H