Index Source Files Annotated Class List Alphabetical Class List Class Hierarchy Graphical Class Hierarchy

# SocketInitiator.h

Go to the documentation of this file.

    00001 /* -*- C++ -*- */
    00002
    00003 /****************************************************************************
    00004 ** Copyright (c) quickfixengine.org  All rights reserved.
    00005 **
    00006 ** This file is part of the QuickFIX FIX Engine
    00007 **
    00008 ** This file may be distributed under the terms of the quickfixengine.org
    00009 ** license as defined by quickfixengine.org and appearing in the file
    00010 ** LICENSE included in the packaging of this file.
    00011 **
    00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    00014 **
    00015 ** See http://www.quickfixengine.org/LICENSE for licensing information.
    00016 **
    00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are
    00018 ** not clear to you.
    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