28 #ifndef _MF_TRADEDATEROLLOVERSESSION_H_
29 #define _MF_TRADEDATEROLLOVERSESSION_H_
31 #define USERNAME_LENGTH 32
32 #define PASSWORD_LENGTH 32
33 #define CLORDID_LENGTH 32
34 #define STRATEGY_PARAMETERS_LENGTH 32
35 #define CONFIRMID_LENGTH 32
36 #define EXECID_LENGTH 32
40 #include <MFProtoInputBuffer.h>
41 #include <MFProtoOutputBuffer.h>
42 #include <MFProtoMsgWrapper.h>
43 #include <SessionState.h>
45 #include <mftradedaterollover/LogonResponse.hpp>
46 #include <mftradedaterollover/Logout.hpp>
47 #include <mftradedaterollover/LogoutResponse.hpp>
48 #include <mftradedaterollover/Heartbeat.hpp>
49 #include <mftradedaterollover/TradeDateRequest.hpp>
50 #include <mftradedaterollover/TradeDateReport.hpp>
51 #include <mftradedaterollover/TradeDateType.hpp>
52 #include <mftradedaterollover/GroupSizeEncoding.hpp>
53 #include <mftradedaterollover/MessageHeader.hpp>
55 #include <boost/asio.hpp>
56 #include <boost/thread/mutex.hpp>
57 #include <boost/noncopyable.hpp>
109 void sendLogonMessage();
110 void sendLogoutMessage();
111 void relogonIfNecessary();
117 bool disconnect(
bool reconnect =
true);
126 template <
typename T>
128 write(msgWrapper.
buf());
131 void write(MFProtoOutputBuffer& outputBuffer);
133 void handle_connect(
const boost::system::error_code& ec);
134 void handle_read(
const boost::system::error_code& ec,
135 size_t bytes_transferred);
137 void onTimer(TimeUtil::Timestamp now);
138 void checkForDeadConnection(TimeUtil::Timestamp now);
139 void sendHeartbeatIfNecessary(TimeUtil::Timestamp now);
140 void closeConnectionIfWaitedTooLongForServerLogoutResponse(
141 TimeUtil::Timestamp now);
144 const std::string& username,
const std::string& password,
145 const std::string& hostname, uint16_t port,
146 bool reconnectOnDisconenect, uint16_t heartBtInt);
150 void write_internal(MFProtoOutputBuffer& outputBuffer);
153 const uint16_t _heartBtInt;
154 boost::asio::ip::tcp::socket _socket;
155 MFProtoInputBuffer _inputBuffer;
156 mutable boost::mutex _outputBufferLock;
157 uint32_t _outputBufferPacketSeqNum;
159 const std::string _username;
160 const std::string _password;
161 const std::string _hostname;
162 const uint16_t _port;
163 const bool _relogonOnDisconnect;
165 long _lastMessageSentTimestamp;
166 long _lastMessageRecvTimestamp;
A wrapper to encapsulate an SBE class instance and the buffer where the message payload is actually s...
Definition: MFProtoMsgWrapper.h:17
Applications implement this interface in order to process events from a MFTradeRollOverDateSession ...
Definition: MFTradeDateRollOverHandler.h:48
void logoutResponse()
The response to a logout from the server. This should be called if a logout is received so that the c...
Definition: MFTradeDateRollOverSession.cpp:142
void tradeDateRequest()
The trade date roll over request message sent to the server. This should be called to initiate a subs...
Definition: MFTradeDateRollOverSession.cpp:148
Central class for managing sessions with MarketFactory. Create sessions using this class...
Definition: MFClient.h:83
void logout()
Initiates logout. This should be called so a clean and dirty (one where the socket closes w/o a logou...
Definition: MFTradeDateRollOverSession.cpp:127
uint64_t getSendingTime() const
Retrieve the sending time of the current frame.
Definition: MFTradeDateRollOverSession.h:106
mftradedaterollover::TradeDateRequest & createTradeDateRequest()
Creates a Trade Date Roll Over Request message
Definition: MFTradeDateRollOverSession.cpp:153
void logon()
Sends a logon message with the supplied username and password. Should only be called in the event loo...
Definition: MFTradeDateRollOverSession.cpp:108
Definition: SessionState.h:37
MFProtoOutputBuffer & buf()
Return a reference to the buffer where the object payload is stored.
Definition: MFProtoMsgWrapper.h:34
A session with MarketFactory for trading with all the venues for which a user has access...
Definition: MFTradeDateRollOverSession.h:65