SocketInitiator.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_SOCKETINITIATOR_H
00023 #define FIX_SOCKETINITIATOR_H
00024
00025 #ifdef _MSC_VER
00026 #pragma warning( disable : 4503 4355 4786 4290 )
00027 #endif
00028
00029 #include "Initiator.h"
00030 #include "SocketConnector.h"
00031 #include "SocketConnection.h"
00032
00033 namespace FIX
00034 {
00036 class SocketInitiator : public Initiator, SocketConnector::Strategy
00037 {
00038 public:
00039 SocketInitiator( Application&, MessageStoreFactory&,
00040 const SessionSettings& ) throw( ConfigError );
00041 SocketInitiator( Application&, MessageStoreFactory&,
00042 const SessionSettings&, LogFactory& ) throw( ConfigError );
00043
00044 virtual ~SocketInitiator();
00045
00046 private:
00047 typedef std::map < int, SocketConnection* > SocketConnections;
00048 typedef std::map < SessionID, int > SessionToHostNum;
00049
00050 void onConfigure( const SessionSettings& ) throw ( ConfigError );
00051 void onInitialize( const SessionSettings& ) throw ( RuntimeError );
00052
00053 void onStart();
00054 bool onPoll( double timeout );
00055 void onStop();
00056
00057 void doConnect( const SessionID&, const Dictionary& d );
00058 void onConnect( SocketConnector&, int );
00059 void onWrite( SocketConnector&, int );
00060 bool onData( SocketConnector&, int );
00061 void onDisconnect( SocketConnector&, int );
00062 void onError( SocketConnector& );
00063 void onTimeout( SocketConnector& );
00064
00065 void getHost( const SessionID&, const Dictionary&, std::string&, short& );
00066
00067 SessionSettings m_settings;
00068 SessionToHostNum m_sessionToHostNum;
00069 SocketConnector m_connector;
00070 SocketConnections m_pendingConnections;
00071 SocketConnections m_connections;
00072 time_t m_lastConnect;
00073 int m_reconnectInterval;
00074 bool m_noDelay;
00075 int m_sendBufSize;
00076 int m_rcvBufSize;
00077 bool m_stop;
00078 };
00080 }
00081
00082 #endif //FIX_SOCKETINITIATOR_H