Session.cpp
Go to the documentation of this file.
/****************************************************************************
** 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.
**
****************************************************************************/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#include "config.h"
#endif
#include "Session.h"
#include "Values.h"
#include <algorithm>
#include <iostream>
namespace FIX
{
Session::Sessions Session::s_sessions;
Session::SessionIDs Session::s_sessionIDs;
Session::Sessions Session::s_registered;
Mutex Session::s_mutex;
#define LOGEX( method ) try { method; } catch( std::exception& e ) \
{ m_state.onEvent( e.what() ); }
Session::Session( Application& application,
MessageStoreFactory& messageStoreFactory,
const SessionID& sessionID,
const DataDictionaryProvider& dataDictionaryProvider,
const TimeRange& sessionTime,
int heartBtInt, LogFactory* pLogFactory )
: m_application( application ),
m_sessionID( sessionID ),
m_sessionTime( sessionTime ),
m_logonTime( sessionTime ),
m_senderDefaultApplVerID(ApplVerID_FIX50),
m_targetDefaultApplVerID(ApplVerID_FIX50),
m_sendRedundantResendRequests( false ),
m_checkCompId( true ),
m_checkLatency( true ),
m_maxLatency( 120 ),
m_resetOnLogon( false ),
m_resetOnLogout( false ),
m_resetOnDisconnect( false ),
m_refreshOnLogon( false ),
m_millisecondsInTimeStamp( true ),
m_persistMessages( true ),
m_validateLengthAndChecksum( true ),
m_dataDictionaryProvider( dataDictionaryProvider ),
m_messageStoreFactory( messageStoreFactory ),
m_pLogFactory( pLogFactory ),
m_pResponder( 0 )
{
m_state.heartBtInt( heartBtInt );
m_state.initiate( heartBtInt != 0 );
m_state.store( m_messageStoreFactory.create( m_sessionID ) );
if ( m_pLogFactory )
m_state.log( m_pLogFactory->create( m_sessionID ) );
if( !checkSessionTime(UtcTimeStamp()) )
reset();
addSession( *this );
m_application.onCreate( m_sessionID );
m_state.onEvent( "Created session" );
}
Session::~Session()
{
removeSession( *this );
m_messageStoreFactory.destroy( m_state.store() );
if ( m_pLogFactory && m_state.log() )
m_pLogFactory->destroy( m_state.log() );
}
void Session::insertSendingTime( Header& header )
{
UtcTimeStamp now;
bool showMilliseconds = false;
if( m_sessionID.getBeginString() == BeginString_FIXT11 )
showMilliseconds = true;
else
showMilliseconds = m_sessionID.getBeginString() >= BeginString_FIX42;
header.setField( SendingTime(now, showMilliseconds && m_millisecondsInTimeStamp) );
}
void Session::insertOrigSendingTime( Header& header, const UtcTimeStamp& when )
{
bool showMilliseconds = false;
if( m_sessionID.getBeginString() == BeginString_FIXT11 )
showMilliseconds = true;
else
showMilliseconds = m_sessionID.getBeginString() >= BeginString_FIX42;
header.setField( OrigSendingTime(when, showMilliseconds && m_millisecondsInTimeStamp) );
}
void Session::fill( Header& header )
{
UtcTimeStamp now;
m_state.lastSentTime( now );
header.setField( m_sessionID.getBeginString() );
header.setField( m_sessionID.getSenderCompID() );
header.setField( m_sessionID.getTargetCompID() );
header.setField( MsgSeqNum( getExpectedSenderNum() ) );
insertSendingTime( header );
}
void Session::next()
{
next( UtcTimeStamp() );
}
void Session::next( const UtcTimeStamp& timeStamp )
{
try
{
if ( !checkSessionTime(timeStamp) )
{ reset(); return; }
if( !isEnabled() || !isLogonTime(timeStamp) )
{
if( isLoggedOn() )
{
if( !m_state.sentLogout() )
{
m_state.onEvent( "Initiated logout request" );
generateLogout( m_state.logoutReason() );
}
}
else
return;
}
if ( !m_state.receivedLogon() )
{
if ( m_state.shouldSendLogon() && isLogonTime(timeStamp) )
{
generateLogon();
m_state.onEvent( "Initiated logon request" );
}
else if ( m_state.alreadySentLogon() && m_state.logonTimedOut() )
{
m_state.onEvent( "Timed out waiting for logon response" );
disconnect();
}
return ;
}
if ( m_state.heartBtInt() == 0 ) return ;
if ( m_state.logoutTimedOut() )
{
m_state.onEvent( "Timed out waiting for logout response" );
disconnect();
}
if ( m_state.withinHeartBeat() ) return ;
if ( m_state.timedOut() )
{
m_state.onEvent( "Timed out waiting for heartbeat" );
disconnect();
}
else
{
if ( m_state.needTestRequest() )
{
generateTestRequest( "TEST" );
m_state.testRequest( m_state.testRequest() + 1 );
m_state.onEvent( "Sent test request TEST" );
}
else if ( m_state.needHeartbeat() )
{
generateHeartbeat();
}
}
}
catch ( FIX::IOException& e )
{
m_state.onEvent( e.what() );
disconnect();
}
}
void Session::nextLogon( const Message& logon, const UtcTimeStamp& timeStamp )
{
SenderCompID senderCompID;
TargetCompID targetCompID;
logon.getHeader().getField( senderCompID );
logon.getHeader().getField( targetCompID );
if( m_refreshOnLogon )
refresh();
if( !isEnabled() )
{
m_state.onEvent( "Session is not enabled for logon" );
disconnect();
return;
}
if( !isLogonTime(timeStamp) )
{
m_state.onEvent( "Received logon outside of valid logon time" );
disconnect();
return;
}
ResetSeqNumFlag resetSeqNumFlag(false);
logon.getFieldIfSet(resetSeqNumFlag);
m_state.receivedReset( resetSeqNumFlag );
if( m_state.receivedReset() )
{
m_state.onEvent( "Logon contains ResetSeqNumFlag=Y, reseting sequence numbers to 1" );
if( !m_state.sentReset() ) m_state.reset();
}
if( m_state.shouldSendLogon() && !m_state.receivedReset() )
{
m_state.onEvent( "Received logon response before sending request" );
disconnect();
return;
}
if( !m_state.initiate() && m_resetOnLogon )
m_state.reset();
if( !verify( logon, false, true ) )
return;
m_state.receivedLogon( true );
if ( !m_state.initiate()
|| (m_state.receivedReset() && !m_state.sentReset()) )
{
logon.getFieldIfSet(m_state.heartBtInt());
m_state.onEvent( "Received logon request" );
generateLogon( logon );
m_state.onEvent( "Responding to logon request" );
}
else
m_state.onEvent( "Received logon response" );
m_state.sentReset( false );
m_state.receivedReset( false );
MsgSeqNum msgSeqNum;
logon.getHeader().getField( msgSeqNum );
if ( isTargetTooHigh( msgSeqNum ) && !resetSeqNumFlag )
{
doTargetTooHigh( logon );
}
else
{
m_state.incrNextTargetMsgSeqNum();
nextQueued( timeStamp );
}
if ( isLoggedOn() )
m_application.onLogon( m_sessionID );
}
void Session::nextHeartbeat( const Message& heartbeat, const UtcTimeStamp& timeStamp )
{
if ( !verify( heartbeat ) ) return ;
m_state.incrNextTargetMsgSeqNum();
nextQueued( timeStamp );
}
void Session::nextTestRequest( const Message& testRequest, const UtcTimeStamp& timeStamp )
{
if ( !verify( testRequest ) ) return ;
generateHeartbeat( testRequest );
m_state.incrNextTargetMsgSeqNum();
nextQueued( timeStamp );
}
void Session::nextLogout( const Message& logout, const UtcTimeStamp& timeStamp )
{
if ( !verify( logout, false, false ) ) return ;
if ( !m_state.sentLogout() )
{
m_state.onEvent( "Received logout request" );
generateLogout();
m_state.onEvent( "Sending logout response" );
}
else
m_state.onEvent( "Received logout response" );
m_state.incrNextTargetMsgSeqNum();
if ( m_resetOnLogout ) m_state.reset();
disconnect();
}
void Session::nextReject( const Message& reject, const UtcTimeStamp& timeStamp )
{
if ( !verify( reject, false, true ) ) return ;
m_state.incrNextTargetMsgSeqNum();
nextQueued( timeStamp );
}
void Session::nextSequenceReset( const Message& sequenceReset, const UtcTimeStamp& timeStamp )
{
bool isGapFill = false;
GapFillFlag gapFillFlag;
if ( sequenceReset.getFieldIfSet( gapFillFlag ) )
{
isGapFill = gapFillFlag;
}
if ( !verify( sequenceReset, isGapFill, isGapFill ) ) return ;
NewSeqNo newSeqNo;
if ( sequenceReset.getFieldIfSet( newSeqNo ) )
{
m_state.onEvent( "Received SequenceReset FROM: "
+ IntConvertor::convert( getExpectedTargetNum() ) +
" TO: " + IntConvertor::convert( newSeqNo ) );
if ( newSeqNo > getExpectedTargetNum() )
m_state.setNextTargetMsgSeqNum( MsgSeqNum( newSeqNo ) );
else if ( newSeqNo < getExpectedTargetNum() )
generateReject( sequenceReset, SessionRejectReason_VALUE_IS_INCORRECT );
}
}
void Session::nextResendRequest( const Message& resendRequest, const UtcTimeStamp& timeStamp )
{
if ( !verify( resendRequest, false, false ) ) return ;
Locker l( m_mutex );
BeginSeqNo beginSeqNo;
EndSeqNo endSeqNo;
resendRequest.getField( beginSeqNo );
resendRequest.getField( endSeqNo );
m_state.onEvent( "Received ResendRequest FROM: "
+ IntConvertor::convert( beginSeqNo ) +
" TO: " + IntConvertor::convert( endSeqNo ) );
std::string beginString = m_sessionID.getBeginString();
if ( (beginString >= FIX::BeginString_FIX42 && endSeqNo == 0) ||
(beginString <= FIX::BeginString_FIX42 && endSeqNo == 999999) ||
(endSeqNo >= getExpectedSenderNum()) )
{ endSeqNo = getExpectedSenderNum() - 1; }
if ( !m_persistMessages )
{
endSeqNo = EndSeqNo(endSeqNo + 1);
int next = m_state.getNextSenderMsgSeqNum();
if( endSeqNo > next )
endSeqNo = EndSeqNo(next);
generateSequenceReset( beginSeqNo, endSeqNo );
return;
}
std::vector < std::string > messages;
m_state.get( beginSeqNo, endSeqNo, messages );
std::vector < std::string > ::iterator i;
MsgSeqNum msgSeqNum(0);
MsgType msgType;
int begin = 0;
int current = beginSeqNo;
std::string messageString;
Message msg;
for ( i = messages.begin(); i != messages.end(); ++i )
{
const DataDictionary& sessionDD =
m_dataDictionaryProvider.getSessionDataDictionary(m_sessionID.getBeginString());
if( m_sessionID.isFIXT() )
{
msg.setStringHeader(*i);
ApplVerID applVerID;
if( !msg.getHeader().getFieldIfSet(applVerID) )
applVerID = m_senderDefaultApplVerID;
const DataDictionary& applicationDD =
m_dataDictionaryProvider.getApplicationDataDictionary(applVerID);
msg = Message( *i, sessionDD, applicationDD, m_validateLengthAndChecksum );
}
else
{
msg = Message( *i, sessionDD, m_validateLengthAndChecksum );
}
msg.getHeader().getField( msgSeqNum );
msg.getHeader().getField( msgType );
if( (current != msgSeqNum) && !begin )
begin = current;
if ( Message::isAdminMsgType( msgType ) )
{
if ( !begin ) begin = msgSeqNum;
}
else
{
if ( resend( msg ) )
{
if ( begin ) generateSequenceReset( begin, msgSeqNum );
send( msg.toString(messageString) );
m_state.onEvent( "Resending Message: "
+ IntConvertor::convert( msgSeqNum ) );
begin = 0;
}
else
{ if ( !begin ) begin = msgSeqNum; }
}
current = msgSeqNum + 1;
}
if ( begin )
{
generateSequenceReset( begin, msgSeqNum + 1 );
}
if ( endSeqNo > msgSeqNum )
{
endSeqNo = EndSeqNo(endSeqNo + 1);
int next = m_state.getNextSenderMsgSeqNum();
if( endSeqNo > next )
endSeqNo = EndSeqNo(next);
generateSequenceReset( beginSeqNo, endSeqNo );
}
resendRequest.getHeader().getField( msgSeqNum );
if( !isTargetTooHigh(msgSeqNum) && !isTargetTooLow(msgSeqNum) )
m_state.incrNextTargetMsgSeqNum();
}
bool Session::send( Message& message )
{
message.getHeader().removeField( FIELD::PossDupFlag );
message.getHeader().removeField( FIELD::OrigSendingTime );
return sendRaw( message );
}
bool Session::sendRaw( Message& message, int num )
{
Locker l( m_mutex );
try
{
Header& header = message.getHeader();
MsgType msgType;
header.getFieldIfSet(msgType);
fill( header );
std::string messageString;
if ( num )
header.setField( MsgSeqNum( num ) );
if ( Message::isAdminMsgType( msgType ) )
{
m_application.toAdmin( message, m_sessionID );
if( msgType == "A" && !m_state.receivedReset() )
{
ResetSeqNumFlag resetSeqNumFlag( false );
message.getFieldIfSet(resetSeqNumFlag);
if( resetSeqNumFlag )
{
m_state.reset();
message.getHeader().setField( MsgSeqNum(getExpectedSenderNum()) );
}
m_state.sentReset( resetSeqNumFlag );
}
message.toString( messageString );
if( !num )
persist( message, messageString );
if (
msgType == "A" || msgType == "5"
|| msgType == "2" || msgType == "4"
|| isLoggedOn() )
{
send( messageString );
}
}
else
{
// do not send application messages if they will just be cleared
if( !isLoggedOn() && shouldSendReset() )
return false;
try
{
m_application.toApp( message, m_sessionID );
message.toString( messageString );
if( !num )
persist( message, messageString );
if ( isLoggedOn() )
send( messageString );
}
catch ( DoNotSend& ) { return false; }
}
return true;
}
catch ( IOException& e )
{
m_state.onEvent( e.what() );
return false;
}
}
bool Session::send( const std::string& string )
{
if ( !m_pResponder ) return false;
m_state.onOutgoing( string );
return m_pResponder->send( string );
}
void Session::disconnect()
{
Locker l(m_mutex);
if ( m_pResponder )
{
m_state.onEvent( "Disconnecting" );
m_pResponder->disconnect();
m_pResponder = 0;
}
if ( m_state.receivedLogon() || m_state.sentLogon() )
{
m_state.receivedLogon( false );
m_state.sentLogon( false );
m_application.onLogout( m_sessionID );
}
m_state.sentLogout( false );
m_state.receivedReset( false );
m_state.sentReset( false );
m_state.clearQueue();
m_state.logoutReason();
if ( m_resetOnDisconnect )
m_state.reset();
m_state.resendRange( 0, 0 );
}
bool Session::resend( Message& message )
{
SendingTime sendingTime;
MsgSeqNum msgSeqNum;
Header& header = message.getHeader();
header.getField( sendingTime );
header.getField( msgSeqNum );
insertOrigSendingTime( header, sendingTime );
header.setField( PossDupFlag( true ) );
insertSendingTime( header );
try
{
m_application.toApp( message, m_sessionID );
return true;
}
catch ( DoNotSend& )
{ return false; }
}
void Session::persist( const Message& message, const std::string& messageString )
throw ( IOException )
{
MsgSeqNum msgSeqNum;
message.getHeader().getField( msgSeqNum );
if( m_persistMessages )
m_state.set( msgSeqNum, messageString );
m_state.incrNextSenderMsgSeqNum();
}
void Session::generateLogon()
{
Message logon;
logon.getHeader().setField( MsgType( "A" ) );
logon.setField( EncryptMethod( 0 ) );
logon.setField( m_state.heartBtInt() );
if( m_sessionID.isFIXT() )
logon.setField( DefaultApplVerID(m_senderDefaultApplVerID) );
if( m_refreshOnLogon )
refresh();
if( m_resetOnLogon )
m_state.reset();
if( shouldSendReset() )
logon.setField( ResetSeqNumFlag(true) );
fill( logon.getHeader() );
UtcTimeStamp now;
m_state.lastReceivedTime( now );
m_state.testRequest( 0 );
m_state.sentLogon( true );
sendRaw( logon );
}
void Session::generateLogon( const Message& aLogon )
{
Message logon;
EncryptMethod encryptMethod;
HeartBtInt heartBtInt;
logon.setField( EncryptMethod( 0 ) );
if( m_sessionID.isFIXT() )
logon.setField( DefaultApplVerID(m_senderDefaultApplVerID) );
if( m_state.receivedReset() )
logon.setField( ResetSeqNumFlag(true) );
aLogon.getField( heartBtInt );
logon.getHeader().setField( MsgType( "A" ) );
logon.setField( heartBtInt );
fill( logon.getHeader() );
sendRaw( logon );
m_state.sentLogon( true );
}
void Session::generateResendRequest( const BeginString& beginString, const MsgSeqNum& msgSeqNum )
{
Message resendRequest;
BeginSeqNo beginSeqNo( ( int ) getExpectedTargetNum() );
EndSeqNo endSeqNo( msgSeqNum - 1 );
if ( beginString >= FIX::BeginString_FIX42 )
endSeqNo = 0;
else if( beginString <= FIX::BeginString_FIX41 )
endSeqNo = 999999;
resendRequest.getHeader().setField( MsgType( "2" ) );
resendRequest.setField( beginSeqNo );
resendRequest.setField( endSeqNo );
fill( resendRequest.getHeader() );
sendRaw( resendRequest );
m_state.onEvent( "Sent ResendRequest FROM: "
+ IntConvertor::convert( beginSeqNo ) +
" TO: " + IntConvertor::convert( endSeqNo ) );
m_state.resendRange( beginSeqNo, msgSeqNum - 1 );
}
void Session::generateSequenceReset
( int beginSeqNo, int endSeqNo )
{
Message sequenceReset;
NewSeqNo newSeqNo( endSeqNo );
sequenceReset.getHeader().setField( MsgType( "4" ) );
sequenceReset.getHeader().setField( PossDupFlag( true ) );
sequenceReset.setField( newSeqNo );
fill( sequenceReset.getHeader() );
SendingTime sendingTime;
sequenceReset.getHeader().getField( sendingTime );
insertOrigSendingTime( sequenceReset.getHeader(), sendingTime );
sequenceReset.getHeader().setField( MsgSeqNum( beginSeqNo ) );
sequenceReset.setField( GapFillFlag( true ) );
sendRaw( sequenceReset, beginSeqNo );
m_state.onEvent( "Sent SequenceReset TO: "
+ IntConvertor::convert( newSeqNo ) );
}
void Session::generateHeartbeat()
{
Message heartbeat;
heartbeat.getHeader().setField( MsgType( "0" ) );
fill( heartbeat.getHeader() );
sendRaw( heartbeat );
}
void Session::generateHeartbeat( const Message& testRequest )
{
Message heartbeat;
heartbeat.getHeader().setField( MsgType( "0" ) );
fill( heartbeat.getHeader() );
try
{
TestReqID testReqID;
testRequest.getField( testReqID );
heartbeat.setField( testReqID );
}
catch ( FieldNotFound& ) {}
sendRaw( heartbeat );
}
void Session::generateTestRequest( const std::string& id )
{
Message testRequest;
testRequest.getHeader().setField( MsgType( "1" ) );
fill( testRequest.getHeader() );
TestReqID testReqID( id );
testRequest.setField( testReqID );
sendRaw( testRequest );
}
void Session::generateReject( const Message& message, int err, int field )
{
std::string beginString = m_sessionID.getBeginString();
Message reject;
reject.getHeader().setField( MsgType( "3" ) );
reject.reverseRoute( message.getHeader() );
fill( reject.getHeader() );
MsgSeqNum msgSeqNum;
MsgType msgType;
message.getHeader().getField( msgType );
if( message.getHeader().getFieldIfSet( msgSeqNum ) )
{
if( msgSeqNum.getString() != "" )
reject.setField( RefSeqNum( msgSeqNum ) );
}
if ( beginString >= FIX::BeginString_FIX42 )
{
if( msgType.getString() != "" )
reject.setField( RefMsgType( msgType ) );
if ( (beginString == FIX::BeginString_FIX42
&& err <= SessionRejectReason_INVALID_MSGTYPE)
|| beginString > FIX::BeginString_FIX42 )
{
reject.setField( SessionRejectReason( err ) );
}
}
if ( msgType != MsgType_Logon && msgType != MsgType_SequenceReset
&& msgSeqNum == getExpectedTargetNum() )
{ m_state.incrNextTargetMsgSeqNum(); }
const char* reason = 0;
switch ( err )
{
case SessionRejectReason_INVALID_TAG_NUMBER:
reason = SessionRejectReason_INVALID_TAG_NUMBER_TEXT;
break;
case SessionRejectReason_REQUIRED_TAG_MISSING:
reason = SessionRejectReason_REQUIRED_TAG_MISSING_TEXT;
break;
case SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE:
reason = SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE_TEXT;
break;
case SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE:
reason = SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT;
break;
case SessionRejectReason_VALUE_IS_INCORRECT:
reason = SessionRejectReason_VALUE_IS_INCORRECT_TEXT;
break;
case SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE:
reason = SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE_TEXT;
break;
case SessionRejectReason_COMPID_PROBLEM:
reason = SessionRejectReason_COMPID_PROBLEM_TEXT;
break;
case SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM:
reason = SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM_TEXT;
break;
case SessionRejectReason_INVALID_MSGTYPE:
reason = SessionRejectReason_INVALID_MSGTYPE_TEXT;
break;
case SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE:
reason = SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE_TEXT;
break;
case SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER:
reason = SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER_TEXT;
break;
case SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP:
reason = SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP_TEXT;
};
if ( reason && ( field || err == SessionRejectReason_INVALID_TAG_NUMBER ) )
{
populateRejectReason( reject, field, reason );
m_state.onEvent( "Message " + msgSeqNum.getString() + " Rejected: "
+ reason + ":" + IntConvertor::convert( field ) );
}
else if ( reason )
{
populateRejectReason( reject, reason );
m_state.onEvent( "Message " + msgSeqNum.getString()
+ " Rejected: " + reason );
}
else
m_state.onEvent( "Message " + msgSeqNum.getString() + " Rejected" );
if ( !m_state.receivedLogon() )
throw std::runtime_error( "Tried to send a reject while not logged on" );
sendRaw( reject );
}
void Session::generateReject( const Message& message, const std::string& str )
{
std::string beginString = m_sessionID.getBeginString();
Message reject;
reject.getHeader().setField( MsgType( "3" ) );
reject.reverseRoute( message.getHeader() );
fill( reject.getHeader() );
MsgType msgType;
MsgSeqNum msgSeqNum;
message.getHeader().getField( msgType );
message.getHeader().getField( msgSeqNum );
if ( beginString >= FIX::BeginString_FIX42 )
reject.setField( RefMsgType( msgType ) );
reject.setField( RefSeqNum( msgSeqNum ) );
if ( msgType != MsgType_Logon && msgType != MsgType_SequenceReset )
m_state.incrNextTargetMsgSeqNum();
reject.setField( Text( str ) );
sendRaw( reject );
m_state.onEvent( "Message " + msgSeqNum.getString()
+ " Rejected: " + str );
}
void Session::generateBusinessReject( const Message& message, int err, int field )
{
Message reject;
reject.getHeader().setField( MsgType( MsgType_BusinessMessageReject ) );
if( m_sessionID.isFIXT() )
reject.setField( DefaultApplVerID(m_senderDefaultApplVerID) );
fill( reject.getHeader() );
MsgType msgType;
MsgSeqNum msgSeqNum;
message.getHeader().getField( msgType );
message.getHeader().getField( msgSeqNum );
reject.setField( RefMsgType( msgType ) );
reject.setField( RefSeqNum( msgSeqNum ) );
reject.setField( BusinessRejectReason( err ) );
m_state.incrNextTargetMsgSeqNum();
const char* reason = 0;
switch ( err )
{
case BusinessRejectReason_OTHER:
reason = BusinessRejectReason_OTHER_TEXT;
break;
case BusinessRejectReason_UNKNOWN_ID:
reason = BusinessRejectReason_UNKNOWN_ID_TEXT;
break;
case BusinessRejectReason_UNKNOWN_SECURITY:
reason = BusinessRejectReason_UNKNOWN_SECURITY_TEXT;
break;
case BusinessRejectReason_UNKNOWN_MESSAGE_TYPE:
reason = BusinessRejectReason_UNSUPPORTED_MESSAGE_TYPE_TEXT;
break;
case BusinessRejectReason_APPLICATION_NOT_AVAILABLE:
reason = BusinessRejectReason_APPLICATION_NOT_AVAILABLE_TEXT;
break;
case BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING:
reason = BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT;
break;
case BusinessRejectReason_NOT_AUTHORIZED:
reason = BusinessRejectReason_NOT_AUTHORIZED_TEXT;
break;
case BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME:
reason = BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME_TEXT;
break;
};
if ( reason && field )
{
populateRejectReason( reject, field, reason );
m_state.onEvent( "Message " + msgSeqNum.getString() + " Rejected: "
+ reason + ":" + IntConvertor::convert( field ) );
}
else if ( reason )
{
populateRejectReason( reject, reason );
m_state.onEvent( "Message " + msgSeqNum.getString()
+ " Rejected: " + reason );
}
else
m_state.onEvent( "Message " + msgSeqNum.getString() + " Rejected" );
sendRaw( reject );
}
void Session::generateLogout( const std::string& text )
{
Message logout;
logout.getHeader().setField( MsgType( MsgType_Logout ) );
fill( logout.getHeader() );
if ( text.length() )
logout.setField( Text( text ) );
sendRaw( logout );
m_state.sentLogout( true );
}
void Session::populateRejectReason( Message& reject, int field,
const std::string& text )
{
MsgType msgType;
reject.getHeader().getField( msgType );
if ( msgType == MsgType_Reject
&& m_sessionID.getBeginString() >= FIX::BeginString_FIX42 )
{
reject.setField( RefTagID( field ) );
reject.setField( Text( text ) );
}
else
{
std::stringstream stream;
stream << text << " (" << field << ")";
reject.setField( Text( stream.str() ) );
}
}
void Session::populateRejectReason( Message& reject, const std::string& text )
{
reject.setField( Text( text ) );
}
bool Session::verify( const Message& msg, bool checkTooHigh,
bool checkTooLow )
{
const MsgType* pMsgType = 0;
const MsgSeqNum* pMsgSeqNum = 0;
try
{
const Header& header = msg.getHeader();
pMsgType = FIELD_GET_PTR( header, MsgType );
const SenderCompID& senderCompID = FIELD_GET_REF( header, SenderCompID );
const TargetCompID& targetCompID = FIELD_GET_REF( header, TargetCompID );
const SendingTime& sendingTime = FIELD_GET_REF( header, SendingTime );
if( checkTooHigh || checkTooLow )
pMsgSeqNum = FIELD_GET_PTR( header, MsgSeqNum );
if ( !validLogonState( *pMsgType ) )
throw std::logic_error( "Logon state is not valid for message" );
if ( !isGoodTime( sendingTime ) )
{
doBadTime( msg );
return false;
}
if ( !isCorrectCompID( senderCompID, targetCompID ) )
{
doBadCompID( msg );
return false;
}
if ( checkTooHigh && isTargetTooHigh( *pMsgSeqNum ) )
{
doTargetTooHigh( msg );
return false;
}
else if ( checkTooLow && isTargetTooLow( *pMsgSeqNum ) )
{
doTargetTooLow( msg );
return false;
}
if ( (checkTooHigh || checkTooLow) && m_state.resendRequested() )
{
SessionState::ResendRange range = m_state.resendRange();
if ( *pMsgSeqNum >= range.second )
{
m_state.onEvent ("ResendRequest for messages FROM: " +
IntConvertor::convert (range.first) + " TO: " +
IntConvertor::convert (range.second) +
" has been satisfied.");
m_state.resendRange (0, 0);
}
}
}
catch ( std::exception& e )
{
m_state.onEvent( e.what() );
disconnect();
return false;
}
UtcTimeStamp now;
m_state.lastReceivedTime( now );
m_state.testRequest( 0 );
fromCallback( pMsgType ? *pMsgType : MsgType(), msg, m_sessionID );
return true;
}
bool Session::shouldSendReset()
{
std::string beginString = m_sessionID.getBeginString();
return beginString >= FIX::BeginString_FIX41
&& ( m_resetOnLogon ||
m_resetOnLogout ||
m_resetOnDisconnect )
&& ( getExpectedSenderNum() == 1 )
&& ( getExpectedTargetNum() == 1 );
}
bool Session::validLogonState( const MsgType& msgType )
{
if ( (msgType == MsgType_Logon && m_state.sentReset())
|| (m_state.receivedReset()) )
return true;
if ( (msgType == MsgType_Logon && !m_state.receivedLogon())
|| (msgType != MsgType_Logon && m_state.receivedLogon()) )
return true;
if ( msgType == MsgType_Logout && m_state.sentLogon() )
return true;
if ( msgType != MsgType_Logout && m_state.sentLogout() )
return true;
if ( msgType == MsgType_SequenceReset )
return true;
if ( msgType == MsgType_Reject )
return true;
return false;
}
void Session::fromCallback( const MsgType& msgType, const Message& msg,
const SessionID& sessionID )
{
if ( Message::isAdminMsgType( msgType ) )
m_application.fromAdmin( msg, m_sessionID );
else
m_application.fromApp( msg, m_sessionID );
}
void Session::doBadTime( const Message& msg )
{
generateReject( msg, SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM );
generateLogout();
}
void Session::doBadCompID( const Message& msg )
{
generateReject( msg, SessionRejectReason_COMPID_PROBLEM );
generateLogout();
}
bool Session::doPossDup( const Message& msg )
{
const Header & header = msg.getHeader();
OrigSendingTime origSendingTime;
SendingTime sendingTime;
MsgType msgType;
header.getField( msgType );
header.getField( sendingTime );
if ( msgType != MsgType_SequenceReset )
{
if ( !header.getFieldIfSet( origSendingTime ) )
{
generateReject( msg, SessionRejectReason_REQUIRED_TAG_MISSING, origSendingTime.getField() );
return false;
}
if ( origSendingTime > sendingTime )
{
generateReject( msg, SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM );
generateLogout();
return false;
}
}
return true;
}
bool Session::doTargetTooLow( const Message& msg )
{
const Header & header = msg.getHeader();
PossDupFlag possDupFlag(false);
MsgSeqNum msgSeqNum;
header.getFieldIfSet(possDupFlag);
header.getField( msgSeqNum );
if ( !possDupFlag )
{
std::stringstream stream;
stream << "MsgSeqNum too low, expecting " << getExpectedTargetNum()
<< " but received " << msgSeqNum;
generateLogout( stream.str() );
throw std::logic_error( stream.str() );
}
return doPossDup( msg );
}
void Session::doTargetTooHigh( const Message& msg )
{
const Header & header = msg.getHeader();
BeginString beginString;
MsgSeqNum msgSeqNum;
header.getField( beginString );
header.getField( msgSeqNum );
m_state.onEvent( "MsgSeqNum too high, expecting "
+ IntConvertor::convert( getExpectedTargetNum() )
+ " but received "
+ IntConvertor::convert( msgSeqNum ) );
m_state.queue( msgSeqNum, msg );
if( m_state.resendRequested() )
{
SessionState::ResendRange range = m_state.resendRange();
if( !m_sendRedundantResendRequests && msgSeqNum >= range.first )
{
m_state.onEvent ("Already sent ResendRequest FROM: " +
IntConvertor::convert (range.first) + " TO: " +
IntConvertor::convert (range.second) +
". Not sending another.");
return;
}
}
generateResendRequest( beginString, msgSeqNum );
}
void Session::nextQueued( const UtcTimeStamp& timeStamp )
{
while ( nextQueued( getExpectedTargetNum(), timeStamp ) ) {}
}
bool Session::nextQueued( int num, const UtcTimeStamp& timeStamp )
{
Message msg;
MsgType msgType;
if( m_state.retrieve( num, msg ) )
{
m_state.onEvent( "Processing QUEUED message: "
+ IntConvertor::convert( num ) );
msg.getHeader().getField( msgType );
if( msgType == MsgType_Logon
|| msgType == MsgType_ResendRequest )
{
m_state.incrNextTargetMsgSeqNum();
}
else
{
next( msg, timeStamp, true );
}
return true;
}
return false;
}
void Session::next( const std::string& msg, const UtcTimeStamp& timeStamp, bool queued )
{
try
{
m_state.onIncoming( msg );
const DataDictionary& sessionDD =
m_dataDictionaryProvider.getSessionDataDictionary(m_sessionID.getBeginString());
if( m_sessionID.isFIXT() )
{
const DataDictionary& applicationDD =
m_dataDictionaryProvider.getApplicationDataDictionary(m_senderDefaultApplVerID);
next( Message( msg, sessionDD, applicationDD, m_validateLengthAndChecksum ), timeStamp, queued );
}
else
{
next( Message( msg, sessionDD, m_validateLengthAndChecksum ), timeStamp, queued );
}
}
catch( InvalidMessage& e )
{
m_state.onEvent( e.what() );
try
{
if( identifyType(msg) == MsgType_Logon )
{
m_state.onEvent( "Logon message is not valid" );
disconnect();
}
} catch( MessageParseError& ) {}
throw e;
}
}
void Session::next( const Message& message, const UtcTimeStamp& timeStamp, bool queued )
{
const Header& header = message.getHeader();
try
{
if ( !checkSessionTime(timeStamp) )
{ reset(); return; }
const MsgType& msgType = FIELD_GET_REF( header, MsgType );
const BeginString& beginString = FIELD_GET_REF( header, BeginString );
// make sure these fields are present
FIELD_THROW_IF_NOT_FOUND( header, SenderCompID );
FIELD_THROW_IF_NOT_FOUND( header, TargetCompID );
if ( beginString != m_sessionID.getBeginString() )
throw UnsupportedVersion();
if( msgType == MsgType_Logon )
{
if( m_sessionID.isFIXT() )
{
const DefaultApplVerID& applVerID = FIELD_GET_REF( message, DefaultApplVerID );
setTargetDefaultApplVerID(applVerID);
}
else
{
setTargetDefaultApplVerID(Message::toApplVerID(beginString));
}
}
const DataDictionary& sessionDataDictionary =
m_dataDictionaryProvider.getSessionDataDictionary(m_sessionID.getBeginString());
if( m_sessionID.isFIXT() && message.isApp() )
{
ApplVerID applVerID = m_targetDefaultApplVerID;
header.getFieldIfSet(applVerID);
const DataDictionary& applicationDataDictionary =
m_dataDictionaryProvider.getApplicationDataDictionary(applVerID);
DataDictionary::validate( message, &sessionDataDictionary, &applicationDataDictionary );
}
else
{
sessionDataDictionary.validate( message );
}
if ( msgType == MsgType_Logon )
nextLogon( message, timeStamp );
else if ( msgType == MsgType_Heartbeat )
nextHeartbeat( message, timeStamp );
else if ( msgType == MsgType_TestRequest )
nextTestRequest( message, timeStamp );
else if ( msgType == MsgType_SequenceReset )
nextSequenceReset( message, timeStamp );
else if ( msgType == MsgType_Logout )
nextLogout( message, timeStamp );
else if ( msgType == MsgType_ResendRequest )
nextResendRequest( message,timeStamp );
else if ( msgType == MsgType_Reject )
nextReject( message, timeStamp );
else
{
if ( !verify( message ) ) return ;
m_state.incrNextTargetMsgSeqNum();
}
}
catch ( MessageParseError& e )
{ m_state.onEvent( e.what() ); }
catch ( RequiredTagMissing & e )
{ LOGEX( generateReject( message, SessionRejectReason_REQUIRED_TAG_MISSING, e.field ) ); }
catch ( FieldNotFound & e )
{
if( header.getField(FIELD::BeginString) >= FIX::BeginString_FIX42 && message.isApp() )
{
LOGEX( generateBusinessReject( message, BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING, e.field ) );
}
else
{
LOGEX( generateReject( message, SessionRejectReason_REQUIRED_TAG_MISSING, e.field ) );
if ( header.getField(FIELD::MsgType) == MsgType_Logon )
{
m_state.onEvent( "Required field missing from logon" );
disconnect();
}
}
}
catch ( InvalidTagNumber & e )
{ LOGEX( generateReject( message, SessionRejectReason_INVALID_TAG_NUMBER, e.field ) ); }
catch ( NoTagValue & e )
{ LOGEX( generateReject( message, SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE, e.field ) ); }
catch ( TagNotDefinedForMessage & e )
{ LOGEX( generateReject( message, SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE, e.field ) ); }
catch ( InvalidMessageType& )
{ LOGEX( generateReject( message, SessionRejectReason_INVALID_MSGTYPE ) ); }
catch ( UnsupportedMessageType& )
{
if ( header.getField(FIELD::BeginString) >= FIX::BeginString_FIX42 )
{ LOGEX( generateBusinessReject( message, BusinessRejectReason_UNKNOWN_MESSAGE_TYPE ) ); }
else
{ LOGEX( generateReject( message, "Unsupported message type" ) ); }
}
catch ( TagOutOfOrder & e )
{ LOGEX( generateReject( message, SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER, e.field ) ); }
catch ( IncorrectDataFormat & e )
{ LOGEX( generateReject( message, SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE, e.field ) ); }
catch ( IncorrectTagValue & e )
{ LOGEX( generateReject( message, SessionRejectReason_VALUE_IS_INCORRECT, e.field ) ); }
catch ( RepeatedTag & e )
{ LOGEX( generateReject( message, SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE, e.field ) ); }
catch ( RepeatingGroupCountMismatch & e )
{ LOGEX( generateReject( message, SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP, e.field ) ); }
catch ( InvalidMessage& e )
{ m_state.onEvent( e.what() ); }
catch ( RejectLogon& e )
{
m_state.onEvent( e.what() );
generateLogout( e.what() );
disconnect();
}
catch ( UnsupportedVersion& )
{
if ( header.getField(FIELD::MsgType) == MsgType_Logout )
nextLogout( message, timeStamp );
else
{
generateLogout( "Incorrect BeginString" );
m_state.incrNextTargetMsgSeqNum();
}
}
catch ( IOException& e )
{
m_state.onEvent( e.what() );
disconnect();
}
if( !queued )
nextQueued( timeStamp );
if( isLoggedOn() )
next();
}
bool Session::sendToTarget( Message& message, const std::string& qualifier )
throw( SessionNotFound )
{
try
{
SessionID sessionID = message.getSessionID( qualifier );
return sendToTarget( message, sessionID );
}
catch ( FieldNotFound& ) { throw SessionNotFound(); }
}
bool Session::sendToTarget( Message& message, const SessionID& sessionID )
throw( SessionNotFound )
{
message.setSessionID( sessionID );
Session* pSession = lookupSession( sessionID );
if ( !pSession ) throw SessionNotFound();
return pSession->send( message );
}
bool Session::sendToTarget
( Message& message,
const SenderCompID& senderCompID,
const TargetCompID& targetCompID,
const std::string& qualifier )
throw( SessionNotFound )
{
message.getHeader().setField( senderCompID );
message.getHeader().setField( targetCompID );
return sendToTarget( message, qualifier );
}
bool Session::sendToTarget
( Message& message, const std::string& sender, const std::string& target,
const std::string& qualifier )
throw( SessionNotFound )
{
return sendToTarget( message, SenderCompID( sender ),
TargetCompID( target ), qualifier );
}
std::set<SessionID> Session::getSessions()
{
return s_sessionIDs;
}
bool Session::doesSessionExist( const SessionID& sessionID )
{
Locker locker( s_mutex );
return s_sessions.end() != s_sessions.find( sessionID );
}
Session* Session::lookupSession( const SessionID& sessionID )
{
Locker locker( s_mutex );
Sessions::iterator find = s_sessions.find( sessionID );
if ( find != s_sessions.end() )
return find->second;
else
return 0;
}
Session* Session::lookupSession( const std::string& string, bool reverse )
{
Message message;
if ( !message.setStringHeader( string ) )
return 0;
try
{
const Header& header = message.getHeader();
const BeginString& beginString = FIELD_GET_REF( header, BeginString );
const SenderCompID& senderCompID = FIELD_GET_REF( header, SenderCompID );
const TargetCompID& targetCompID = FIELD_GET_REF( header, TargetCompID );
if ( reverse )
{
return lookupSession( SessionID( beginString, SenderCompID( targetCompID ),
TargetCompID( senderCompID ) ) );
}
return lookupSession( SessionID( beginString, senderCompID,
targetCompID ) );
}
catch ( FieldNotFound& ) { return 0; }
}
bool Session::isSessionRegistered( const SessionID& sessionID )
{
Locker locker( s_mutex );
return s_registered.end() != s_registered.find( sessionID );
}
Session* Session::registerSession( const SessionID& sessionID )
{
Locker locker( s_mutex );
Session* pSession = lookupSession( sessionID );
if ( pSession == 0 ) return 0;
if ( isSessionRegistered( sessionID ) ) return 0;
s_registered[ sessionID ] = pSession;
return pSession;
}
void Session::unregisterSession( const SessionID& sessionID )
{
Locker locker( s_mutex );
s_registered.erase( sessionID );
}
size_t Session::numSessions()
{
Locker locker( s_mutex );
return s_sessions.size();
}
bool Session::addSession( Session& s )
{
Locker locker( s_mutex );
Sessions::iterator it = s_sessions.find( s.m_sessionID );
if ( it == s_sessions.end() )
{
s_sessions[ s.m_sessionID ] = &s;
s_sessionIDs.insert( s.m_sessionID );
return true;
}
else
return false;
}
void Session::removeSession( Session& s )
{
Locker locker( s_mutex );
s_sessions.erase( s.m_sessionID );
s_sessionIDs.erase( s.m_sessionID );
s_registered.erase( s.m_sessionID );
}
}
FIX::FIELD::ApplVerID
const int ApplVerID
Definition: FixFieldNumbers.h:425
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::Session::isEnabled
bool isEnabled()
Definition: Session.h:59
FIX::SessionRejectReason_COMPID_PROBLEM_TEXT
const char SessionRejectReason_COMPID_PROBLEM_TEXT[]
Definition: Values.h:47
FIX::FIELD::OrigSendingTime
const int OrigSendingTime
Definition: FixFieldNumbers.h:921
FIX::BusinessRejectReason_UNKNOWN_ID
const int BusinessRejectReason_UNKNOWN_ID
Definition: FixValues.h:3271
FIX::FIELD::BeginSeqNo
const int BeginSeqNo
Definition: FixFieldNumbers.h:610
FIX::SessionState::lastReceivedTime
void lastReceivedTime(const UtcTimeStamp &value)
Definition: SessionState.h:108
FIX::IncorrectDataFormat
Field has a badly formatted value.
Definition: Exceptions.h:146
FIX::Session::lookupSession
static Session * lookupSession(const SessionID &)
Definition: Session.cpp:1403
FIX::MessageStoreFactory::create
virtual MessageStore * create(const SessionID &)=0
FIX::Session::~Session
virtual ~Session()
Definition: Session.cpp:83
FIX::Session::populateRejectReason
void populateRejectReason(Message &, int field, const std::string &)
Definition: Session.cpp:916
FIX::SessionState::onOutgoing
void onOutgoing(const std::string &string)
Definition: SessionState.h:202
FIX::Session::isGoodTime
bool isGoodTime(const SendingTime &sendingTime)
Definition: Session.h:236
FIX::Session::send
bool send(Message &)
Definition: Session.cpp:452
FIX::FIELD::RefMsgType
const int RefMsgType
Definition: FixFieldNumbers.h:602
FIX::UnsupportedMessageType
Message type not supported by application.
Definition: Exceptions.h:176
FIX::Message::isAdminMsgType
static bool isAdminMsgType(const MsgType &msgType)
Definition: Message.h:250
FIX::FieldMap::getFieldIfSet
bool getFieldIfSet(FieldBase &field) const
Get a field if set.
Definition: FieldMap.h:102
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::BusinessRejectReason_OTHER
const int BusinessRejectReason_OTHER
Definition: FixValues.h:3272
FIX::TimeRange
Keeps track of when session is active.
Definition: TimeRange.h:34
FIX::BusinessRejectReason_NOT_AUTHORIZED_TEXT
const char BusinessRejectReason_NOT_AUTHORIZED_TEXT[]
Definition: Values.h:59
FIX::BusinessRejectReason_APPLICATION_NOT_AVAILABLE
const int BusinessRejectReason_APPLICATION_NOT_AVAILABLE
Definition: FixValues.h:3267
FIX::Application::onCreate
virtual void onCreate(const SessionID &)=0
Notification of a session begin created.
FIX::FIELD::HeartBtInt
const int HeartBtInt
Definition: FixFieldNumbers.h:240
FIELD_THROW_IF_NOT_FOUND
#define FIELD_THROW_IF_NOT_FOUND(MAP, FLD)
Definition: FieldMap.h:240
FIX::Session::getExpectedSenderNum
int getExpectedSenderNum()
Definition: Session.h:211
FIX::RepeatingGroupCountMismatch
Repeated group count not equal to actual count.
Definition: Exceptions.h:208
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:323
FIX::SessionState::ResendRange
std::pair< int, int > ResendRange
Definition: SessionState.h:83
FIX::LogFactory::create
virtual Log * create()=0
FIX::Application::onLogout
virtual void onLogout(const SessionID &)=0
Notification of a session logging off or disconnecting.
FIX::Session::generateHeartbeat
void generateHeartbeat()
Definition: Session.cpp:685
FIX::DataDictionary
Represents a data dictionary for a version of FIX.
Definition: DataDictionary.h:49
FIX::Session::unregisterSession
static void unregisterSession(const SessionID &)
Definition: Session.cpp:1454
FIX::SessionState::needHeartbeat
bool needHeartbeat() const
Definition: SessionState.h:138
FIX::IncorrectTagValue::field
int field
Definition: Exceptions.h:142
FIX::SessionState::testRequest
int testRequest() const
Definition: SessionState.h:77
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::Session
Maintains the state and implements the logic of a FIX session.
Definition: Session.h:45
FIX::Session::doBadTime
void doBadTime(const Message &msg)
Definition: Session.cpp:1053
FIX::Session::nextReject
void nextReject(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:312
FIX::Session::m_messageStoreFactory
MessageStoreFactory & m_messageStoreFactory
Definition: Session.h:324
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::MessageParseError
Unable to parse message.
Definition: Exceptions.h:73
FIX::Session::addSession
static bool addSession(Session &)
Definition: Session.cpp:1466
FIX::BeginString_FIXT11
const char BeginString_FIXT11[]
Definition: Values.h:30
FIX::Message::isApp
bool isApp() const
Definition: Message.h:229
FIX::Message::reverseRoute
void reverseRoute(const Header &)
Add header informations depending on a source message.
Definition: Message.cpp:81
FIX::SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE_TEXT
const char SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE_TEXT[]
Definition: Values.h:44
FIX::SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE_TEXT
const char SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE_TEXT[]
Definition: Values.h:50
FIX::BusinessRejectReason_NOT_AUTHORIZED
const int BusinessRejectReason_NOT_AUTHORIZED
Definition: FixValues.h:3275
FIX::RepeatedTag
Repeated tag not part of repeating group.
Definition: Exceptions.h:199
FIX::SessionNotFound
Session cannot be found for specified action.
Definition: Exceptions.h:231
FIX::SessionRejectReason_INVALID_TAG_NUMBER_TEXT
const char SessionRejectReason_INVALID_TAG_NUMBER_TEXT[]
Definition: Values.h:38
FIX::FIELD::EndSeqNo
const int EndSeqNo
Definition: FixFieldNumbers.h:1198
FIX::Session::next
void next()
Definition: Session.cpp:125
FIX::SessionState::set
bool set(int s, const std::string &m)
Definition: SessionState.h:172
FIX::Session::numSessions
static size_t numSessions()
Definition: Session.cpp:1460
FIX::SessionState::setNextTargetMsgSeqNum
void setNextTargetMsgSeqNum(int n)
Definition: SessionState.h:183
FIX::Responder::send
virtual bool send(const std::string &)=0
FIX::RequiredTagMissing::field
int field
Definition: Exceptions.h:115
FIX::TagNotDefinedForMessage::field
int field
Definition: Exceptions.h:124
FIX::DataDictionaryProvider
Queries for DataDictionary based on appropriate version of FIX.
Definition: DataDictionaryProvider.h:42
FIX::Message::toApplVerID
static ApplVerID toApplVerID(const BeginString &value)
Definition: Message.h:257
FIX::SessionState::retrieve
bool retrieve(int msgSeqNum, Message &message)
Definition: SessionState.h:157
FIX::InvalidTagNumber::field
int field
Definition: Exceptions.h:106
reverse
void reverse(I begin, I end)
Definition: pugixml.cpp:6009
FIX::Message::setStringHeader
bool setStringHeader(const std::string &string)
Set a messages header from a string This is an optimization that can be used to get useful informatio...
Definition: Message.cpp:380
FIX::Application::onLogon
virtual void onLogon(const SessionID &)=0
Notification of a session successfully logging on.
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::MsgType_ResendRequest
const char MsgType_ResendRequest[]
Definition: FixValues.h:666
FIX::SessionState::needTestRequest
bool needTestRequest() const
Definition: SessionState.h:143
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE
const int SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE
Definition: FixValues.h:1874
FIX::Session::nextTestRequest
void nextTestRequest(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:287
FIX::Session::reset
void reset()
Definition: Session.h:66
FIX::SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER
const int SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER
Definition: FixValues.h:1875
FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT
const char BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT[]
Definition: Values.h:58
FIX::SessionState::shouldSendLogon
bool shouldSendLogon() const
Definition: SessionState.h:115
FIX::Session::validLogonState
bool validLogonState(const MsgType &msgType)
Definition: Session.cpp:1024
FIX::Application::fromApp
virtual void fromApp(const Message &, const SessionID &)=0
Notification of app message being received from target.
FIX::Session::nextResendRequest
void nextResendRequest(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:344
FIX::Session::generateResendRequest
void generateResendRequest(const BeginString &, const MsgSeqNum &)
Definition: Session.cpp:643
FIX::SessionRejectReason_VALUE_IS_INCORRECT_TEXT
const char SessionRejectReason_VALUE_IS_INCORRECT_TEXT[]
Definition: Values.h:43
FIX::SessionState::queue
void queue(int msgSeqNum, const Message &message)
Definition: SessionState.h:155
FIX::LogFactory::destroy
virtual void destroy(Log *)=0
FIX::SessionID::getTargetCompID
const TargetCompID & getTargetCompID() const
Definition: SessionID.h:57
FIX::Session::refresh
void refresh()
Definition: Session.h:68
FIX::SessionState::log
Log * log()
Definition: SessionState.h:91
FIX::SessionState::initiate
bool initiate() const
Definition: SessionState.h:68
FIX::SessionState::timedOut
bool timedOut() const
Definition: SessionState.h:133
FIX::Session::isSessionRegistered
static bool isSessionRegistered(const SessionID &)
Definition: Session.cpp:1438
FIX::MsgType_SequenceReset
const char MsgType_SequenceReset[]
Definition: FixValues.h:646
FIX::SessionState::lastSentTime
void lastSentTime(const UtcTimeStamp &value)
Definition: SessionState.h:101
FIX::InvalidTagNumber
Tag number does not exist in specification.
Definition: Exceptions.h:101
FIX::FIELD::NewSeqNo
const int NewSeqNo
Definition: FixFieldNumbers.h:836
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:154
FIX::SessionState::resendRequested
bool resendRequested() const
Definition: SessionState.h:80
FIX::Session::isLogonTime
bool isLogonTime(const UtcTimeStamp &time)
Definition: Session.h:110
FIX::RepeatingGroupCountMismatch::field
int field
Definition: Exceptions.h:213
FIX::RepeatedTag::field
int field
Definition: Exceptions.h:204
FIX::Session::isTargetTooLow
bool isTargetTooLow(const MsgSeqNum &msgSeqNum)
Definition: Session.h:249
FIX::FIELD::SendingTime
const int SendingTime
Definition: FixFieldNumbers.h:1447
FIX::SessionState::receivedReset
bool receivedReset() const
Definition: SessionState.h:62
FIX::Header
Definition: Message.h:47
FIX::Session::s_sessions
static Sessions s_sessions
Definition: Session.h:329
FIX::SessionRejectReason_INVALID_MSGTYPE
const int SessionRejectReason_INVALID_MSGTYPE
Definition: FixValues.h:1880
FIX
Definition: Acceptor.cpp:34
FIX::Message::getHeader
const Header & getHeader() const
Getter for the message header.
Definition: Message.h:192
FIX::Session::registerSession
static Session * registerSession(const SessionID &)
Definition: Session.cpp:1444
FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM_TEXT
const char SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM_TEXT[]
Definition: Values.h:48
FIX::FIELD::SessionRejectReason
const int SessionRejectReason
Definition: FixFieldNumbers.h:902
FIX::Session::doTargetTooHigh
void doTargetTooHigh(const Message &msg)
Definition: Session.cpp:1113
FIX::Session::generateLogon
void generateLogon()
Definition: Session.cpp:602
FIX::SessionRejectReason_INVALID_MSGTYPE_TEXT
const char SessionRejectReason_INVALID_MSGTYPE_TEXT[]
Definition: Values.h:49
FIX::DataDictionary::validate
static void validate(const Message &message, const DataDictionary *const pSessionDD, const DataDictionary *const pAppID)
Validate a message.
Definition: DataDictionary.cpp:117
FIX::Session::Session
Session(Application &, MessageStoreFactory &, const SessionID &, const DataDictionaryProvider &, const TimeRange &, int heartBtInt, LogFactory *pLogFactory)
Definition: Session.cpp:41
FIX::Session::generateSequenceReset
void generateSequenceReset(int, int)
Definition: Session.cpp:666
FIX::SessionRejectReason_REQUIRED_TAG_MISSING_TEXT
const char SessionRejectReason_REQUIRED_TAG_MISSING_TEXT[]
Definition: Values.h:39
FIX::Application::fromAdmin
virtual void fromAdmin(const Message &, const SessionID &)=0
Notification of admin message being received from target.
FIX::Application
This interface must be implemented to define what your FIX application does.
Definition: Application.h:43
FIX::FieldMap::getField
FieldBase & getField(FieldBase &field) const
Get a field without type checking.
Definition: FieldMap.h:112
FIX::Application::toApp
virtual void toApp(Message &, const SessionID &)=0
Notification of app message being sent to target.
FIX::Session::getSessions
static std::set< SessionID > getSessions()
Definition: Session.cpp:1392
FIX::FIELD::GapFillFlag
const int GapFillFlag
Definition: FixFieldNumbers.h:1291
FIX::Session::sendToTarget
static bool sendToTarget(Message &message, const std::string &qualifier="")
Definition: Session.cpp:1351
FIX::SessionState::sentReset
bool sentReset() const
Definition: SessionState.h:65
FIX::BusinessRejectReason_UNKNOWN_MESSAGE_TYPE
const int BusinessRejectReason_UNKNOWN_MESSAGE_TYPE
Definition: FixValues.h:3274
FIX::Session::m_application
Application & m_application
Definition: Session.h:303
FIX::BusinessRejectReason_UNKNOWN_ID_TEXT
const char BusinessRejectReason_UNKNOWN_ID_TEXT[]
Definition: Values.h:54
FIX::InvalidMessageType
Not a known message type.
Definition: Exceptions.h:169
FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
const int SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
Definition: FixValues.h:1881
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:314
FIX::TagOutOfOrder::field
int field
Definition: Exceptions.h:195
FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING
const int BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING
Definition: FixValues.h:3270
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308
FIX::BusinessRejectReason_APPLICATION_NOT_AVAILABLE_TEXT
const char BusinessRejectReason_APPLICATION_NOT_AVAILABLE_TEXT[]
Definition: Values.h:57
FIX::Locker
Locks/Unlocks a mutex using RAII.
Definition: Mutex.h:95
FIX::BusinessRejectReason_UNSUPPORTED_MESSAGE_TYPE_TEXT
const char BusinessRejectReason_UNSUPPORTED_MESSAGE_TYPE_TEXT[]
Definition: Values.h:56
FIX::BusinessRejectReason_UNKNOWN_SECURITY
const int BusinessRejectReason_UNKNOWN_SECURITY
Definition: FixValues.h:3266
FIX::UnsupportedVersion
Version of FIX is not supported.
Definition: Exceptions.h:183
FIX::FIELD::EncryptMethod
const int EncryptMethod
Definition: FixFieldNumbers.h:155
FIX::Session::m_pLogFactory
LogFactory * m_pLogFactory
Definition: Session.h:325
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
FIX::Session::persist
void persist(const Message &, const std::string &)
Definition: Session.cpp:592
FIX::Session::s_sessionIDs
static SessionIDs s_sessionIDs
Definition: Session.h:330
FIX::Message::toString
std::string toString(int beginStringField=FIELD::BeginString, int bodyLengthField=FIELD::BodyLength, int checkSumField=FIELD::CheckSum) const
Get a string representation of the message.
Definition: Message.cpp:167
FIX::Session::isTargetTooHigh
bool isTargetTooHigh(const MsgSeqNum &msgSeqNum)
Definition: Session.h:247
FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT
const char SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT[]
Definition: Values.h:42
FIX::DataDictionaryProvider::getSessionDataDictionary
const DataDictionary & getSessionDataDictionary(const BeginString &beginString) const
Definition: DataDictionaryProvider.cpp:38
FIX::FIELD::TargetCompID
const int TargetCompID
Definition: FixFieldNumbers.h:217
FIX::SessionState::withinHeartBeat
bool withinHeartBeat() const
Definition: SessionState.h:127
FIX::Session::m_millisecondsInTimeStamp
bool m_millisecondsInTimeStamp
Definition: Session.h:318
FIX::FieldNotFound::field
int field
Definition: Exceptions.h:62
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332
FIX::SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP
const int SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP
Definition: FixValues.h:1873
FIX::SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP_TEXT
const char SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP_TEXT[]
Definition: Values.h:52
FIX::BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME
const int BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME
Definition: FixValues.h:3269
FIX::Session::generateReject
void generateReject(const Message &, int err, int field=0)
Definition: Session.cpp:720
FIX::SessionState::get
void get(int b, int e, std::vector< std::string > &m) const
Definition: SessionState.h:174
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::DataDictionaryProvider::getApplicationDataDictionary
const DataDictionary & getApplicationDataDictionary(const ApplVerID &applVerID) const
Definition: DataDictionaryProvider.cpp:49
FIX::TagOutOfOrder
Tag is not in the correct order.
Definition: Exceptions.h:190
FIX::Session::m_targetDefaultApplVerID
std::string m_targetDefaultApplVerID
Definition: Session.h:309
FIX::SessionState::reset
void reset()
Definition: SessionState.h:191
FIX::LogFactory
This interface must be implemented to create a Log.
Definition: Log.h:42
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:53
FIX::Message
Base class for all FIX messages.
Definition: Message.h:67
FIX::FieldNotFound
Field not found inside a message.
Definition: Exceptions.h:57
FIX::SessionState::resendRange
ResendRange resendRange() const
Definition: SessionState.h:85
FIX::Application::toAdmin
virtual void toAdmin(Message &, const SessionID &)=0
Notification of admin message being sent to target.
FIX::MessageStoreFactory::destroy
virtual void destroy(MessageStore *)=0
FIX::Session::m_validateLengthAndChecksum
bool m_validateLengthAndChecksum
Definition: Session.h:320
LOGEX
#define LOGEX(method)
Definition: Session.cpp:38
FIX::SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE
const int SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE
Definition: FixValues.h:1869
FIX::Session::checkSessionTime
bool checkSessionTime(const UtcTimeStamp &timeStamp)
Definition: Session.h:242
FIX::FieldMap::setField
void setField(const FieldBase &field, bool overwrite=true)
Set a field without type checking.
Definition: FieldMap.h:79
FIX::BusinessRejectReason_OTHER_TEXT
const char BusinessRejectReason_OTHER_TEXT[]
Definition: Values.h:53
FIX::SessionState::incrNextSenderMsgSeqNum
void incrNextSenderMsgSeqNum()
Definition: SessionState.h:185
FIX::Session::insertSendingTime
void insertSendingTime(Header &)
Definition: Session.cpp:91
FIX::SessionState::logoutReason
std::string logoutReason() const
Definition: SessionState.h:150
FIX::Session::fromCallback
void fromCallback(const MsgType &msgType, const Message &msg, const SessionID &sessionID)
Definition: Session.cpp:1044
FIX::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:61
FIX::Session::shouldSendReset
bool shouldSendReset()
Definition: Session.cpp:1013
FIX::SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE
const int SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE
Definition: FixValues.h:1866
FIX::Session::nextHeartbeat
void nextHeartbeat(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:280
FIX::MessageStoreFactory
This interface must be implemented to create a MessageStore.
Definition: MessageStore.h:41
FIX::DoNotSend
Indicates user does not want to send a message.
Definition: Exceptions.h:217
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::FIELD::Text
const int Text
Definition: FixFieldNumbers.h:256
FIX::MsgType_TestRequest
const char MsgType_TestRequest[]
Definition: FixValues.h:629
FIX::SessionState::logonTimedOut
bool logonTimedOut() const
Definition: SessionState.h:117
FIX::FieldMap::removeField
void removeField(int field)
Remove a field. If field is not present, this is a no-op.
Definition: FieldMap.cpp:117
FIX::BeginString_FIX41
const char BeginString_FIX41[]
Definition: Values.h:35
FIX::SessionState::sentLogon
bool sentLogon() const
Definition: SessionState.h:59
FIX::Session::isCorrectCompID
bool isCorrectCompID(const SenderCompID &senderCompID, const TargetCompID &targetCompID)
Definition: Session.h:251
FIX::SessionState::clearQueue
void clearQueue()
Definition: SessionState.h:169
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124
FIX::SessionState::onIncoming
void onIncoming(const std::string &string)
Definition: SessionState.h:200
FIX::Session::generateTestRequest
void generateTestRequest(const std::string &)
Definition: Session.cpp:709
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Session::nextLogon
void nextLogon(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:202
FIX::MsgType_Logon
const char MsgType_Logon[]
Definition: FixValues.h:614
FIX::MsgType_BusinessMessageReject
const char MsgType_BusinessMessageReject[]
Definition: FixValues.h:626
FIX::FIELD::DefaultApplVerID
const int DefaultApplVerID
Definition: FixFieldNumbers.h:1171
FIX::Session::removeSession
static void removeSession(Session &)
Definition: Session.cpp:1480
FIX::Responder::disconnect
virtual void disconnect()=0
FIX::SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER_TEXT
const char SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER_TEXT[]
Definition: Values.h:51
FIX::Session::doBadCompID
void doBadCompID(const Message &msg)
Definition: Session.cpp:1059
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905
FIX::Session::generateBusinessReject
void generateBusinessReject(const Message &, int err, int field=0)
Definition: Session.cpp:842
FIX::Session::logout
void logout(const std::string &reason="")
Definition: Session.h:57
FIX::Session::m_mutex
Mutex m_mutex
Definition: Session.h:327
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::UtcTimeStamp
Date and Time represented in UTC.
Definition: FieldTypes.h:399
FIX::SessionRejectReason_COMPID_PROBLEM
const int SessionRejectReason_COMPID_PROBLEM
Definition: FixValues.h:1864
FIX::Session::m_resetOnDisconnect
bool m_resetOnDisconnect
Definition: Session.h:316
FIX::FIELD::PossDupFlag
const int PossDupFlag
Definition: FixFieldNumbers.h:1284
FIX::FIELD::ResetSeqNumFlag
const int ResetSeqNumFlag
Definition: FixFieldNumbers.h:163
FIX::Session::doTargetTooLow
bool doTargetTooLow(const Message &msg)
Definition: Session.cpp:1093
FIX::FIELD::BeginString
const int BeginString
Definition: FixFieldNumbers.h:499
FIX::Session::m_persistMessages
bool m_persistMessages
Definition: Session.h:319
FIX::Session::SessionIDs
std::set< SessionID > SessionIDs
Definition: Session.h:221
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIELD_GET_PTR
#define FIELD_GET_PTR(MAP, FLD)
Definition: FieldMap.h:236
FIX::FIELD::RefTagID
const int RefTagID
Definition: FixFieldNumbers.h:1379
FIX::SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE_TEXT
const char SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE_TEXT[]
Definition: Values.h:40
FIX::SessionID
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition: SessionID.h:30
FIX::Session::m_sendRedundantResendRequests
bool m_sendRedundantResendRequests
Definition: Session.h:310
FIX::SessionRejectReason_INVALID_TAG_NUMBER
const int SessionRejectReason_INVALID_TAG_NUMBER
Definition: FixValues.h:1877
FIX::IncorrectDataFormat::field
int field
Definition: Exceptions.h:151
FIX::Session::m_pResponder
Responder * m_pResponder
Definition: Session.h:326
FIX::SessionState::logoutTimedOut
bool logoutTimedOut() const
Definition: SessionState.h:122
FIX::FIELD::TestReqID
const int TestReqID
Definition: FixFieldNumbers.h:1484
FIX::RequiredTagMissing
Required field is not in message.
Definition: Exceptions.h:110
FIX::FIELD::RefSeqNum
const int RefSeqNum
Definition: FixFieldNumbers.h:111
FIX::NoTagValue
Field exists in message without a value.
Definition: Exceptions.h:128
FIX::IncorrectTagValue
Field has a value that is out of range.
Definition: Exceptions.h:137
FIX::identifyType
MsgType identifyType(const std::string &message)
Parse the type of a message from a string.
Definition: Message.h:355
FIX::Session::insertOrigSendingTime
void insertOrigSendingTime(Header &, const UtcTimeStamp &when=UtcTimeStamp())
Definition: Session.cpp:103
FIX::MsgType_Logout
const char MsgType_Logout[]
Definition: FixValues.h:622
FIX::Session::m_resetOnLogout
bool m_resetOnLogout
Definition: Session.h:315
FIX::Session::resend
bool resend(Message &message)
Definition: Session.cpp:572
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1145
FIX::SessionState::getNextSenderMsgSeqNum
int getNextSenderMsgSeqNum() const
Definition: SessionState.h:177
FIX::MsgType_Heartbeat
const char MsgType_Heartbeat[]
Definition: FixValues.h:634
FIX::SessionRejectReason_REQUIRED_TAG_MISSING
const int SessionRejectReason_REQUIRED_TAG_MISSING
Definition: FixValues.h:1871
FIX::InvalidMessage
Not a recognizable message.
Definition: Exceptions.h:80
FIX::BusinessRejectReason_UNKNOWN_SECURITY_TEXT
const char BusinessRejectReason_UNKNOWN_SECURITY_TEXT[]
Definition: Values.h:55
FIX::SessionID::getSenderCompID
const SenderCompID & getSenderCompID() const
Definition: SessionID.h:55
FIX::SessionState::store
MessageStore * store()
Definition: SessionState.h:89
FIX::Session::m_refreshOnLogon
bool m_refreshOnLogon
Definition: Session.h:317
FIX::Session::s_registered
static Sessions s_registered
Definition: Session.h:331
FIX::RejectLogon
User wants to reject permission to logon.
Definition: Exceptions.h:224
FIX::BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME_TEXT
const char BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME_TEXT[]
Definition: Values.h:60
FIX::Session::nextLogout
void nextLogout(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:295
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:56
FIELD_GET_REF
#define FIELD_GET_REF(MAP, FLD)
Definition: FieldMap.h:238
FIX::TagNotDefinedForMessage
Field does not belong to message.
Definition: Exceptions.h:119
FIX::NoTagValue::field
int field
Definition: Exceptions.h:133
FIX::Session::setTargetDefaultApplVerID
void setTargetDefaultApplVerID(const std::string &targetDefaultApplVerID)
Definition: Session.h:129
FIX::IOException
IO Error.
Definition: Exceptions.h:238
FIX::FIELD::BusinessRejectReason
const int BusinessRejectReason
Definition: FixFieldNumbers.h:1526
Session.h
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363
FIX::SessionState::heartBtInt
void heartBtInt(const HeartBtInt &value)
Definition: SessionState.h:94
FIX::ApplVerID_FIX50
const char ApplVerID_FIX50[]
Definition: FixValues.h:810
FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE
const int SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE
Definition: FixValues.h:1879
FIX::Session::nextSequenceReset
void nextSequenceReset(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:319
FIX::Session::logon
void logon()
Definition: Session.h:55
Values.h
FIX::SessionState::alreadySentLogon
bool alreadySentLogon() const
Definition: SessionState.h:116
FIX::Session::doPossDup
bool doPossDup(const Message &msg)
Definition: Session.cpp:1065
FIX::MsgType_Reject
const char MsgType_Reject[]
Definition: FixValues.h:682
FIX::SessionRejectReason_VALUE_IS_INCORRECT
const int SessionRejectReason_VALUE_IS_INCORRECT
Definition: FixValues.h:1878
FIX::Session::doesSessionExist
static bool doesSessionExist(const SessionID &)
Definition: Session.cpp:1397
FIX::Session::Sessions
std::map< SessionID, Session *> Sessions
Definition: Session.h:220
FIX::Session::isLoggedOn
bool isLoggedOn()
Definition: Session.h:65