SocketAcceptor.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 
3 /****************************************************************************
4 ** Copyright (c) 2001-2014
5 **
6 ** This file is part of the QuickFIX FIX Engine
7 **
8 ** This file may be distributed under the terms of the quickfixengine.org
9 ** license as defined by quickfixengine.org and appearing in the file
10 ** LICENSE included in the packaging of this file.
11 **
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 **
15 ** See http://www.quickfixengine.org/LICENSE for licensing information.
16 **
17 ** Contact ask@quickfixengine.org if any conditions of this licensing are
18 ** not clear to you.
19 **
20 ****************************************************************************/
21 
22 #ifndef FIX_SOCKETACCEPTOR_H
23 #define FIX_SOCKETACCEPTOR_H
24 
25 #ifdef _MSC_VER
26 #pragma warning( disable : 4503 4355 4786 4290 )
27 #endif
28 
29 #include "Acceptor.h"
30 #include "SocketServer.h"
31 #include "SocketConnection.h"
32 
33 namespace FIX
34 {
37 {
38  friend class SocketConnection;
39 public:
41  const SessionSettings& ) throw( ConfigError );
43  const SessionSettings&, LogFactory& ) throw( ConfigError );
44 
45  virtual ~SocketAcceptor();
46 
47 private:
48  bool readSettings( const SessionSettings& );
49 
50  typedef std::set < SessionID > Sessions;
51  typedef std::map < int, Sessions > PortToSessions;
52  typedef std::map < int, SocketConnection* > SocketConnections;
53 
54  void onConfigure( const SessionSettings& ) throw ( ConfigError );
55  void onInitialize( const SessionSettings& ) throw ( RuntimeError );
56 
57  void onStart();
58  bool onPoll( double timeout );
59  void onStop();
60 
61  void onConnect( SocketServer&, int, int );
62  void onWrite( SocketServer&, int );
63  bool onData( SocketServer&, int );
64  void onDisconnect( SocketServer&, int );
65  void onError( SocketServer& );
66  void onTimeout( SocketServer& );
67 
69  PortToSessions m_portToSessions;
70  SocketConnections m_connections;
71 };
73 }
74 
75 #endif //FIX_SOCKETACCEPTOR_H
bool readSettings(const SessionSettings &)
void onInitialize(const SessionSettings &)
Implemented to initialize acceptor.
void onStart()
Implemented to start listening for connections.
void onStop()
Implemented to stop a running acceptor.
void onConnect(SocketServer &, int, int)
std::map< int, Sessions > PortToSessions
SocketConnections m_connections
SocketAcceptor(Application &, MessageStoreFactory &, const SessionSettings &)
void onDisconnect(SocketServer &, int)
Definition: Acceptor.cpp:34
This interface must be implemented to define what your FIX application does.
Definition: Application.h:43
Application encountered serious error during runtime
Definition: Exceptions.h:94
Application is not configured correctly
Definition: Exceptions.h:87
Container for setting dictionaries mapped to sessions.
Base for classes which act as an acceptor for incoming connections.
Definition: Acceptor.h:49
bool onPoll(double timeout)
Implemented to connect and poll for events.
void onConfigure(const SessionSettings &)
Implemented to configure acceptor.
void onWrite(SocketServer &, int)
This interface must be implemented to create a Log.
Definition: Log.h:42
PortToSessions m_portToSessions
void onTimeout(SocketServer &)
This interface must be implemented to create a MessageStore.
Definition: MessageStore.h:41
std::set< SessionID > Sessions
void onError(SocketServer &)
SocketServer * m_pServer
Encapsulates a socket file descriptor (single-threaded).
Socket implementation of Acceptor.
Listens for and accepts incoming socket connections on a port.
Definition: SocketServer.h:56
std::map< int, SocketConnection *> SocketConnections
bool onData(SocketServer &, int)

Generated on Wed Aug 28 2019 14:13:46 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001