SocketAcceptor.h
Go to the documentation of this file.
/* -*- C++ -*- */
/****************************************************************************
** Copyright (c) 2001-2014
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact ask@quickfixengine.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef FIX_SOCKETACCEPTOR_H
#define FIX_SOCKETACCEPTOR_H
#ifdef _MSC_VER
#pragma warning( disable : 4503 4355 4786 4290 )
#endif
#include "Acceptor.h"
#include "SocketServer.h"
#include "SocketConnection.h"
namespace FIX
{
class SocketAcceptor : public Acceptor, SocketServer::Strategy
{
friend class SocketConnection;
public:
SocketAcceptor( Application&, MessageStoreFactory&,
const SessionSettings& ) throw( ConfigError );
SocketAcceptor( Application&, MessageStoreFactory&,
const SessionSettings&, LogFactory& ) throw( ConfigError );
virtual ~SocketAcceptor();
private:
bool readSettings( const SessionSettings& );
typedef std::set < SessionID > Sessions;
typedef std::map < int, Sessions > PortToSessions;
typedef std::map < int, SocketConnection* > SocketConnections;
void onConfigure( const SessionSettings& ) throw ( ConfigError );
void onInitialize( const SessionSettings& ) throw ( RuntimeError );
void onStart();
bool onPoll( double timeout );
void onStop();
void onConnect( SocketServer&, int, int );
void onWrite( SocketServer&, int );
bool onData( SocketServer&, int );
void onDisconnect( SocketServer&, int );
void onError( SocketServer& );
void onTimeout( SocketServer& );
SocketServer* m_pServer;
PortToSessions m_portToSessions;
SocketConnections m_connections;
};
}
#endif //FIX_SOCKETACCEPTOR_H
Acceptor.h
SocketConnection.h
SocketServer.h
FIX::Acceptor
Base for classes which act as an acceptor for incoming connections.
Definition: Acceptor.h:50
FIX::Application
This interface must be implemented to define what your FIX application does.
Definition: Application.h:44
FIX::LogFactory
This interface must be implemented to create a Log.
Definition: Log.h:43
FIX::MessageStoreFactory
This interface must be implemented to create a MessageStore.
Definition: MessageStore.h:42
FIX::SessionSettings
Container for setting dictionaries mapped to sessions.
Definition: SessionSettings.h:221
FIX::SocketAcceptor
Socket implementation of Acceptor.
Definition: SocketAcceptor.h:37
FIX::SocketAcceptor::onConfigure
void onConfigure(const SessionSettings &)
Implemented to configure acceptor.
Definition: SocketAcceptor.cpp:56
FIX::SocketAcceptor::Sessions
std::set< SessionID > Sessions
Definition: SocketAcceptor.h:50
FIX::SocketAcceptor::m_portToSessions
PortToSessions m_portToSessions
Definition: SocketAcceptor.h:69
FIX::SocketAcceptor::onWrite
void onWrite(SocketServer &, int)
Definition: SocketAcceptor.cpp:182
FIX::SocketAcceptor::m_pServer
SocketServer * m_pServer
Definition: SocketAcceptor.h:68
FIX::SocketAcceptor::onStart
void onStart()
Implemented to start listening for connections.
Definition: SocketAcceptor.cpp:111
FIX::SocketAcceptor::onError
void onError(SocketServer &)
Definition: SocketAcceptor.cpp:212
FIX::SocketAcceptor::SocketAcceptor
SocketAcceptor(Application &, MessageStoreFactory &, const SessionSettings &)
Definition: SocketAcceptor.cpp:34
FIX::SocketAcceptor::PortToSessions
std::map< int, Sessions > PortToSessions
Definition: SocketAcceptor.h:51
FIX::SocketAcceptor::onConnect
void onConnect(SocketServer &, int, int)
Definition: SocketAcceptor.cpp:166
FIX::SocketAcceptor::onTimeout
void onTimeout(SocketServer &)
Definition: SocketAcceptor.cpp:216
FIX::SocketAcceptor::onStop
void onStop()
Implemented to stop a running acceptor.
Definition: SocketAcceptor.cpp:162
FIX::SocketAcceptor::readSettings
bool readSettings(const SessionSettings &)
FIX::SocketAcceptor::~SocketAcceptor
virtual ~SocketAcceptor()
Definition: SocketAcceptor.cpp:49
FIX::SocketAcceptor::onInitialize
void onInitialize(const SessionSettings &)
Implemented to initialize acceptor.
Definition: SocketAcceptor.cpp:72
FIX::SocketAcceptor::SocketConnections
std::map< int, SocketConnection * > SocketConnections
Definition: SocketAcceptor.h:52
FIX::SocketAcceptor::onPoll
bool onPoll(double timeout)
Implemented to connect and poll for events.
Definition: SocketAcceptor.cpp:134
FIX::SocketAcceptor::onDisconnect
void onDisconnect(SocketServer &, int)
Definition: SocketAcceptor.cpp:199
FIX::SocketAcceptor::m_connections
SocketConnections m_connections
Definition: SocketAcceptor.h:70
FIX::SocketAcceptor::onData
bool onData(SocketServer &, int)
Definition: SocketAcceptor.cpp:191
FIX::SocketConnection
Encapsulates a socket file descriptor (single-threaded).
Definition: SocketConnection.h:47
FIX::SocketServer::Strategy
Definition: SocketServer.h:87
FIX::SocketServer
Listens for and accepts incoming socket connections on a port.
Definition: SocketServer.h:57
FIX
Definition: Acceptor.cpp:35
FIX::ConfigError
Application is not configured correctly
Definition: Exceptions.h:88
FIX::RuntimeError
Application encountered serious error during runtime
Definition: Exceptions.h:95