SocketInitiator.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_SOCKETINITIATOR_H
23 #define FIX_SOCKETINITIATOR_H
24 
25 #ifdef _MSC_VER
26 #pragma warning( disable : 4503 4355 4786 4290 )
27 #endif
28 
29 #include "Initiator.h"
30 #include "SocketConnector.h"
31 #include "SocketConnection.h"
32 
33 namespace FIX
34 {
37 {
38 public:
40  const SessionSettings& ) throw( ConfigError );
42  const SessionSettings&, LogFactory& ) throw( ConfigError );
43 
44  virtual ~SocketInitiator();
45 
46 private:
47  typedef std::map < int, SocketConnection* > SocketConnections;
48  typedef std::map < SessionID, int > SessionToHostNum;
49 
50  void onConfigure( const SessionSettings& ) throw ( ConfigError );
51  void onInitialize( const SessionSettings& ) throw ( RuntimeError );
52 
53  void onStart();
54  bool onPoll( double timeout );
55  void onStop();
56 
57  void doConnect( const SessionID&, const Dictionary& d );
58  void onConnect( SocketConnector&, int );
59  void onWrite( SocketConnector&, int );
60  bool onData( SocketConnector&, int );
61  void onDisconnect( SocketConnector&, int );
62  void onError( SocketConnector& );
63  void onTimeout( SocketConnector& );
64 
65  void getHost( const SessionID&, const Dictionary&, std::string&, short&, std::string&, short& );
66 
68  SessionToHostNum m_sessionToHostNum;
70  SocketConnections m_pendingConnections;
71  SocketConnections m_connections;
72  time_t m_lastConnect;
74  bool m_noDelay;
77 };
79 }
80 
81 #endif //FIX_SOCKETINITIATOR_H
void onConnect(SocketConnector &, int)
void onStart()
Implemented to start connecting to targets.
SessionSettings m_settings
void getHost(const SessionID &, const Dictionary &, std::string &, short &, std::string &, short &)
SocketConnections m_pendingConnections
SocketConnector m_connector
void doConnect(const SessionID &, const Dictionary &d)
Implemented to connect a session to its target.
Connects sockets to remote ports and addresses.
Socket implementation of Initiator.
SessionToHostNum m_sessionToHostNum
void onConfigure(const SessionSettings &)
Implemented to configure acceptor.
void onStop()
Implemented to stop a running initiator.
SocketInitiator(Application &, MessageStoreFactory &, const SessionSettings &)
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.
bool onPoll(double timeout)
Implemented to connect and poll for events.
std::map< int, SocketConnection *> SocketConnections
This interface must be implemented to create a Log.
Definition: Log.h:42
This interface must be implemented to create a MessageStore.
Definition: MessageStore.h:41
SocketConnections m_connections
void onDisconnect(SocketConnector &, int)
bool onData(SocketConnector &, int)
For storage and retrieval of key/value pairs.
Definition: Dictionary.h:36
std::map< SessionID, int > SessionToHostNum
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition: SessionID.h:30
void onInitialize(const SessionSettings &)
Implemented to initialize initiator.
void onWrite(SocketConnector &, int)
void onError(SocketConnector &)
Base for classes which act as an initiator for establishing connections.
Definition: Initiator.h:51
void onTimeout(SocketConnector &)

Generated on Sun Apr 15 2018 21:44:02 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001