28 #ifndef _MF_STPBOOKINGSESSION_H_
29 #define _MF_STPBOOKINGSESSION_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 <mfstp_booking/DecimalQtyNULL.hpp>
46 #include <mfstp_booking/Logon.hpp>
47 #include <mfstp_booking/Logout.hpp>
48 #include <mfstp_booking/LogoutResponse.hpp>
49 #include <mfstp_booking/Heartbeat.hpp>
50 #include <mfstp_booking/PriceNULL.hpp>
51 #include <mfstp_booking/SecurityDefinition.hpp>
52 #include <mfstp_booking/SecurityDefinitionRequest.hpp>
53 #include <mfstp_booking/Side.hpp>
54 #include <mfstp_booking/SubscriptionRequestType.hpp>
55 #include <mfstp_booking/TradeCaptureReportSpotForward.hpp>
56 #include <mfstp_booking/TradeCaptureReportSwap.hpp>
57 #include <mfstp_booking/Confirmation.hpp>
59 #include <boost/asio.hpp>
60 #include <boost/thread/mutex.hpp>
61 #include <boost/noncopyable.hpp>
123 void confirmation(uint32_t msgSeqNum,
const char * confirmID,
const char * execID);
134 void sendLogonMessage();
135 void sendLogoutMessage();
136 void relogonIfNecessary();
142 bool disconnect(
bool reconnect =
true);
151 template <
typename T>
153 write(msgWrapper.
buf());
156 void write(MFProtoOutputBuffer& outputBuffer);
158 void handle_connect(
const boost::system::error_code& ec);
159 void handle_read(
const boost::system::error_code& ec,
160 size_t bytes_transferred);
162 void onTimer(TimeUtil::Timestamp now);
163 void checkForDeadConnection(TimeUtil::Timestamp now);
164 void sendHeartbeatIfNecessary(TimeUtil::Timestamp now);
165 void closeConnectionIfWaitedTooLongForServerLogoutResponse(
166 TimeUtil::Timestamp now);
169 const std::string& username,
const std::string& password,
170 const std::string& hostname, uint16_t port,
171 bool reconnectOnDisconenect, uint16_t heartBtInt);
176 void write_internal(MFProtoOutputBuffer& outputBuffer);
179 const uint16_t _heartBtInt;
180 boost::asio::ip::tcp::socket _socket;
181 MFProtoInputBuffer _inputBuffer;
182 mutable boost::mutex _outputBufferLock;
183 uint32_t _outputBufferPacketSeqNum;
185 const std::string _username;
186 const std::string _password;
187 const std::string _hostname;
188 const uint16_t _port;
189 const bool _relogonOnDisconnect;
191 long _lastMessageSentTimestamp;
192 long _lastMessageRecvTimestamp;
Applications implement this interface in order to process events from a MFStpBookingSession ...
Definition: MFStpBookingHandler.h:51
MFProtoMsgWrapper< mfstp_booking::TradeCaptureReportSwap > & tradeCaptureReportSwap(int numPartyIDs)
Trade Capture Report Swap
Definition: MFStpBookingSession.cpp:172
void tradeCaptureReportSwapSend()
Trade Capture Report Swap Send
Definition: MFStpBookingSession.cpp:179
void logon()
Sends a logon message with the supplied username and password. Should only be called in the event loo...
Definition: MFStpBookingSession.cpp:111
void logout()
Initiates logout. This should be called so a clean and dirty (one where the socket closes w/o a logou...
Definition: MFStpBookingSession.cpp:130
Central class for managing sessions with MarketFactory. Create sessions using this class...
Definition: MFClient.h:83
uint64_t getSendingTime() const
Retrieve the sending time of the current frame.
Definition: MFStpBookingSession.h:128
void logoutResponse()
The response to a logout from the server. This should be called if a logout is received so that the c...
Definition: MFStpBookingSession.cpp:145
A session with MarketFactory for trading with all the venues for which a user has access...
Definition: MFStpBookingSession.h:69
void tradeCaptureReportSpotForwardSend()
Trade Capture Report Spot Forward Send
Definition: MFStpBookingSession.cpp:164
void confirmation(uint32_t msgSeqNum, const char *confirmID, const char *execID)
Trade booking confirmation message.
Definition: MFStpBookingSession.cpp:187
MFProtoMsgWrapper< mfstp_booking::TradeCaptureReportSpotForward > & tradeCaptureReportSpotForward(int numPartyIDs)
Trade Capture Reort Spot Forward
Definition: MFStpBookingSession.cpp:158
Definition: SessionState.h:37
void securityDefinitionRequest()
A request to receive the definitions of each market.
Definition: MFStpBookingSession.cpp:150
MFProtoOutputBuffer & buf()
Return a reference to the buffer where the object payload is stored.
Definition: MFProtoMsgWrapper.h:34