QuickFIX: /home/omiller/Development/autobuild/quickfix/src/C++/SocketAcceptor.h Source File

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

# SocketAcceptor.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_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