FIX::Session Class Reference

Maintains the state and implements the logic of a FIX session. More...

`#include <Session.h>`

Collaboration diagram for FIX::Session:
[legend]

## Public Member Functions

| Session (Application &, MessageStoreFactory &, const SessionID &, const DataDictionaryProvider &, const TimeRange &, int heartBtInt, LogFactory *pLogFactory)
virtual | ~Session ()
void | logon ()
void | logout (const std::string &reason="")
bool | isEnabled ()
bool | sentLogon ()
bool | sentLogout ()
bool | receivedLogon ()
bool | isLoggedOn ()
void | reset () throw ( IOException )
void | refresh () throw ( IOException )
void | setNextSenderMsgSeqNum (int num) throw ( IOException )
void | setNextTargetMsgSeqNum (int num) throw ( IOException )
const SessionID & | getSessionID () const
void | setDataDictionaryProvider (const DataDictionaryProvider &dataDictionaryProvider)
const DataDictionaryProvider & | getDataDictionaryProvider () const
bool | isSessionTime (const UtcTimeStamp &time)
bool | isLogonTime (const UtcTimeStamp &time)
bool | isInitiator ()
bool | isAcceptor ()
const TimeRange & | getLogonTime ()
void | setLogonTime (const TimeRange &value)
const std::string & | getSenderDefaultApplVerID ()
void | setSenderDefaultApplVerID (const std::string &senderDefaultApplVerID)
const std::string & | getTargetDefaultApplVerID ()
void | setTargetDefaultApplVerID (const std::string &targetDefaultApplVerID)
bool | getSendRedundantResendRequests ()
void | setSendRedundantResendRequests (bool value)
bool | getCheckCompId ()
void | setCheckCompId (bool value)
bool | getCheckLatency ()
void | setCheckLatency (bool value)
int | getMaxLatency ()
void | setMaxLatency (int value)
int | getLogonTimeout ()
void | setLogonTimeout (int value)
int | getLogoutTimeout ()
void | setLogoutTimeout (int value)
bool | getResetOnLogon ()
void | setResetOnLogon (bool value)
bool | getResetOnLogout ()
void | setResetOnLogout (bool value)
bool | getResetOnDisconnect ()
void | setResetOnDisconnect (bool value)
bool | getRefreshOnLogon ()
void | setRefreshOnLogon (bool value)
bool | getMillisecondsInTimeStamp ()
void | setMillisecondsInTimeStamp (bool value)
int | getTimestampPrecision ()
void | setTimestampPrecision (int precision)
bool | getPersistMessages ()
void | setPersistMessages (bool value)
bool | getValidateLengthAndChecksum ()
void | setValidateLengthAndChecksum (bool value)
void | setResponder (Responder *pR)
bool | send (Message &)
void | next ()
void | next (const UtcTimeStamp &timeStamp)
void | next (const std::string &, const UtcTimeStamp &timeStamp, bool queued=false)
void | next (const Message &, const UtcTimeStamp &timeStamp, bool queued=false)
void | disconnect ()
int | getExpectedSenderNum ()
int | getExpectedTargetNum ()
Log * | getLog ()
const MessageStore * | getStore ()
const HeartBtInt & | getHeartBtInt () const

## Static Public Member Functions

static bool | sendToTarget (Message &message, const std::string &qualifier="") throw ( SessionNotFound )
static bool | sendToTarget (Message &message, const SessionID &sessionID) throw ( SessionNotFound )
static bool | sendToTarget (Message &, const SenderCompID &senderCompID, const TargetCompID &targetCompID, const std::string &qualifier="") throw ( SessionNotFound )
static bool | sendToTarget (Message &message, const std::string &senderCompID, const std::string &targetCompID, const std::string &qualifier="") throw ( SessionNotFound )
static std::set< SessionID > | getSessions ()
static bool | doesSessionExist (const SessionID &)
static Session * | lookupSession (const SessionID &)
static Session * | lookupSession (const std::string &, bool reverse=false)
static bool | isSessionRegistered (const SessionID &)
static Session * | registerSession (const SessionID &)
static void | unregisterSession (const SessionID &)
static size_t | numSessions ()

## Private Types

typedef std::map< SessionID, Session * > | Sessions
typedef std::set< SessionID > | SessionIDs

## Private Member Functions

bool | send (const std::string &)
bool | sendRaw (Message &, int msgSeqNum=0)
bool | resend (Message &message)
void | persist (const Message &, const std::string &) throw ( IOException )
void | insertSendingTime (Header &)
void | insertOrigSendingTime (Header &, const UtcTimeStamp &when=UtcTimeStamp())
void | fill (Header &)
bool | isGoodTime (const SendingTime &sendingTime)
bool | checkSessionTime (const UtcTimeStamp &timeStamp)
bool | isTargetTooHigh (const MsgSeqNum &msgSeqNum)
bool | isTargetTooLow (const MsgSeqNum &msgSeqNum)
bool | isCorrectCompID (const SenderCompID &senderCompID, const TargetCompID &targetCompID)
bool | shouldSendReset ()
bool | validLogonState (const MsgType &msgType)
void | fromCallback (const MsgType &msgType, const Message &msg, const SessionID &sessionID)
void | doBadTime (const Message &msg)
void | doBadCompID (const Message &msg)
bool | doPossDup (const Message &msg)
bool | doTargetTooLow (const Message &msg)
void | doTargetTooHigh (const Message &msg)
void | nextQueued (const UtcTimeStamp &timeStamp)
bool | nextQueued (int num, const UtcTimeStamp &timeStamp)
void | nextLogon (const Message &, const UtcTimeStamp &timeStamp)
void | nextHeartbeat (const Message &, const UtcTimeStamp &timeStamp)
void | nextTestRequest (const Message &, const UtcTimeStamp &timeStamp)
void | nextLogout (const Message &, const UtcTimeStamp &timeStamp)
void | nextReject (const Message &, const UtcTimeStamp &timeStamp)
void | nextSequenceReset (const Message &, const UtcTimeStamp &timeStamp)
void | nextResendRequest (const Message &, const UtcTimeStamp &timeStamp)
void | generateLogon ()
void | generateLogon (const Message &)
void | generateResendRequest (const BeginString &, const MsgSeqNum &)
void | generateSequenceReset (int, int)
void | generateHeartbeat ()
void | generateHeartbeat (const Message &)
void | generateTestRequest (const std::string &)
void | generateReject (const Message &, int err, int field=0)
void | generateReject (const Message &, const std::string &)
void | generateBusinessReject (const Message &, int err, int field=0)
void | generateLogout (const std::string &text="")
void | populateRejectReason (Message &, int field, const std::string &)
void | populateRejectReason (Message &, const std::string &)
bool | verify (const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
bool | set (int s, const Message &m)
bool | get (int s, Message &m) const
Message * | newMessage (const std::string &msgType) const

## Static Private Member Functions

static bool | addSession (Session &)
static void | removeSession (Session &)

## Private Attributes

Application & | m_application
SessionID | m_sessionID
TimeRange | m_sessionTime
TimeRange | m_logonTime
std::string | m_senderDefaultApplVerID
std::string | m_targetDefaultApplVerID
bool | m_sendRedundantResendRequests
bool | m_checkCompId
bool | m_checkLatency
int | m_maxLatency
bool | m_resetOnLogon
bool | m_resetOnLogout
bool | m_resetOnDisconnect
bool | m_refreshOnLogon
int | m_timestampPrecision
bool | m_persistMessages
bool | m_validateLengthAndChecksum
SessionState | m_state
DataDictionaryProvider | m_dataDictionaryProvider
MessageStoreFactory & | m_messageStoreFactory
LogFactory * | m_pLogFactory
Responder * | m_pResponder
Mutex | m_mutex

## Static Private Attributes

static Sessions | s_sessions
static SessionIDs | s_sessionIDs
static Sessions | s_registered
static Mutex | s_mutex

## Detailed Description

Maintains the state and implements the logic of a FIX session.

Definition at line 62 of file Session.h.

## Member Typedef Documentation

## SessionIDs

typedef std::set< SessionID > FIX::Session::SessionIDs

private

Definition at line 268 of file Session.h.

## Sessions

typedef std::map< SessionID, Session* > FIX::Session::Sessions

private

Definition at line 267 of file Session.h.

## Constructor & Destructor Documentation

## Session()

FIX::Session::Session | ( | Application & | application,
|  | MessageStoreFactory & | messageStoreFactory,
|  | const SessionID & | sessionID,
|  | const DataDictionaryProvider & | dataDictionaryProvider,
|  | const TimeRange & | sessionTime,
|  | int | heartBtInt,
|  | LogFactory * | pLogFactory
| ) |  |

Definition at line 58 of file Session.cpp.

{
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;

References FIX::TYPE::UtcTimeStamp.

## ~Session()

FIX::Session::~Session | ( |  | ) |

virtual

Definition at line 100 of file Session.cpp.

: 0) );
}
void Session::insertOrigSendingTime( Header& header, const UtcTimeStamp& when )
{
bool showMilliseconds = false;
if( m_sessionID.getBeginString() == BeginString_FIXT11 )

## Member Function Documentation

## addSession()

bool FIX::Session::addSession | ( | Session & | s | ) |

static private

Definition at line 1576 of file Session.cpp.

## checkSessionTime()

bool FIX::Session::checkSessionTime | ( | const UtcTimeStamp & | timeStamp | ) |

inline private

Definition at line 289 of file Session.h.

Referenced by fill(), and getRefreshOnLogon().

## disconnect()

void FIX::Session::disconnect | ( |  | ) |

Definition at line 630 of file Session.cpp.

{
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;
}

Referenced by nextLogon(), FIX::SocketInitiator::onDisconnect(), and FIX::SocketAcceptor::onWrite().

## doBadCompID()

void FIX::Session::doBadCompID | ( | const Message & | msg | ) |

private

Definition at line 1169 of file Session.cpp.

{
if ( !header.getFieldIfSet( origSendingTime ) )
{
generateReject( msg, SessionRejectReason_REQUIRED_TAG_MISSING, origSendingTime.getTag() );
return false;

References generateReject(), and FIX::FieldMap::getFieldIfSet().

## doBadTime()

void FIX::Session::doBadTime | ( | const Message & | msg | ) |

private

Definition at line 1163 of file Session.cpp.

{

## doesSessionExist()

bool FIX::Session::doesSessionExist | ( | const SessionID & | sessionID | ) |

static

Definition at line 1507 of file Session.cpp.

{
Message message;
if ( !message.setStringHeader( string ) )
return 0;

References FIX::Message::setStringHeader().

## doPossDup()

bool FIX::Session::doPossDup | ( | const Message & | msg | ) |

private

Definition at line 1175 of file Session.cpp.

{
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() );
}

References generateLogout(), and generateReject().

## doTargetTooHigh()

void FIX::Session::doTargetTooHigh | ( | const Message & | msg | ) |

private

Definition at line 1223 of file Session.cpp.

{
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

References FIX::IntConvertor::convert(), m_state, and FIX::SessionState::onEvent().

## doTargetTooLow()

bool FIX::Session::doTargetTooLow | ( | const Message & | msg | ) |

private

Definition at line 1203 of file Session.cpp.

{
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() )

## fill()

void FIX::Session::fill | ( | Header & | header | ) |

private

Definition at line 131 of file Session.cpp.

{
try
{
if ( !checkSessionTime(timeStamp) )
{ reset(); return; }
if( !isEnabled() || !isLogonTime(timeStamp) )
{
if( isLoggedOn() )
{

References checkSessionTime(), isEnabled(), isLoggedOn(), isLogonTime(), m_state, reset(), and FIX::SessionState::sentLogout().

Referenced by generateHeartbeat().

## fromCallback()

void FIX::Session::fromCallback | ( | const MsgType & | msgType,
|  | const Message & | msg,
|  | const SessionID & | sessionID
| ) |  |

private

Definition at line 1154 of file Session.cpp.

{
const Header & header = msg.getHeader();
OrigSendingTime origSendingTime;

## generateBusinessReject()

void FIX::Session::generateBusinessReject | ( | const Message & | message,
|  | int | err,
|  | int | field = `0`
| ) |  |

private

Definition at line 948 of file Session.cpp.

{
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 )
{
SmartPtr<Message> pMsg(newMessage("5"));
Message & logout = *pMsg;
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 )
{

References FIX::BusinessRejectReason_APPLICATION_NOT_AVAILABLE_TEXT, FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT, FIX::BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME_TEXT, FIX::BusinessRejectReason_NOT_AUTHORIZED_TEXT, FIX::BusinessRejectReason_OTHER_TEXT, FIX::BusinessRejectReason_UNKNOWN_ID_TEXT, FIX::BusinessRejectReason_UNKNOWN_SECURITY_TEXT, and FIX::BusinessRejectReason_UNSUPPORTED_MESSAGE_TYPE_TEXT.

## generateHeartbeat() [1/2]

void FIX::Session::generateHeartbeat | ( |  | ) |

private

Definition at line 781 of file Session.cpp.

{
TestReqID testReqID;
testRequest.getField( testReqID );
heartbeat.setField( testReqID );
}
catch ( FieldNotFound& ) {}
sendRaw( heartbeat );

## generateHeartbeat() [2/2]

void FIX::Session::generateHeartbeat | ( | const Message & | testRequest | ) |

private

Definition at line 791 of file Session.cpp.

{
SmartPtr<Message> pMsg(newMessage("1"));
Message & testRequest = *pMsg;
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();

References fill(), FIX::Message::getHeader(), newMessage(), sendRaw(), and FIX::FieldMap::setField().

## generateLogon() [1/2]

void FIX::Session::generateLogon | ( |  | ) |

private

Definition at line 690 of file Session.cpp.

{
SmartPtr<Message> pMsg(newMessage("A"));
Message & logon = *pMsg;
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() );

## generateLogon() [2/2]

void FIX::Session::generateLogon | ( | const Message & | aLogon | ) |

private

Definition at line 715 of file Session.cpp.

{
SmartPtr<Message> pMsg(newMessage("2"));
Message & resendRequest = *pMsg;
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 );

## generateLogout()

void FIX::Session::generateLogout | ( | const std::string & | text = `""` | ) |

private

Definition at line 1013 of file Session.cpp.

{
reject.setField( RefTagID( field ) );
reject.setField( Text( text ) );
}
else
{
std::stringstream stream;
stream << text << " (" << field << ")";

Referenced by doPossDup(), next(), and nextHeartbeat().

## generateReject() [1/2]

void FIX::Session::generateReject | ( | const Message & | message,
|  | const std::string & | str
| ) |  |

private

Definition at line 919 of file Session.cpp.

: " + str );
}
void Session::generateBusinessReject( const Message& message, int err, int field )
{
SmartPtr<Message> pMsg(newMessage("j"));
Message & reject = *pMsg;
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 ) );

## generateReject() [2/2]

void FIX::Session::generateReject | ( | const Message & | message,
|  | int | err,
|  | int | field = `0`
| ) |  |

private

Definition at line 822 of file Session.cpp.

{
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();
SmartPtr<Message> pMsg(newMessage("3"));
Message & reject = *pMsg;
reject.getHeader().setField( MsgType( "3" ) );
reject.reverseRoute( message.getHeader() );
fill( reject.getHeader() );
MsgType msgType;
MsgSeqNum msgSeqNum;
message.getHeader().getField( msgType );
message.getHeader().getField( msgSeqNum );

Referenced by doBadCompID(), and doPossDup().

## generateResendRequest()

void FIX::Session::generateResendRequest | ( | const BeginString & | beginString,
|  | const MsgSeqNum & | msgSeqNum
| ) |  |

private

Definition at line 735 of file Session.cpp.

: "
+ IntConvertor::convert( beginSeqNo ) +
" TO: " + IntConvertor::convert( endSeqNo ) );
m_state.resendRange( beginSeqNo, msgSeqNum - 1 );
}
void Session::generateSequenceReset
( int beginSeqNo, int endSeqNo )
{
SmartPtr<Message> pMsg(newMessage("4"));
Message & sequenceReset = *pMsg;
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 ) );

## generateSequenceReset()

void FIX::Session::generateSequenceReset | ( | int | beginSeqNo,
|  | int | endSeqNo
| ) |  |

private

Definition at line 760 of file Session.cpp.

: "
+ IntConvertor::convert( newSeqNo ) );
}
void Session::generateHeartbeat()
{
SmartPtr<Message> pMsg(newMessage("0"));
Message & heartbeat = *pMsg;
heartbeat.getHeader().setField( MsgType( "0" ) );
fill( heartbeat.getHeader() );
sendRaw( heartbeat );
}
void Session::generateHeartbeat( const Message& testRequest )
{
SmartPtr<Message> pMsg(newMessage("0"));
Message & heartbeat = *pMsg;
heartbeat.getHeader().setField( MsgType( "0" ) );

## generateTestRequest()

void FIX::Session::generateTestRequest | ( | const std::string & | id | ) |

private

Definition at line 809 of file Session.cpp.

{

## get()

bool FIX::Session::get | ( | int | s,
|  | Message & | m
| ) |  | const

private

## getCheckCompId()

bool FIX::Session::getCheckCompId | ( |  | ) |

inline

Definition at line 171 of file Session.h.

{ return m_resetOnDisconnect; }

Referenced by FIX::HttpConnection::processSession().

## getCheckLatency()

bool FIX::Session::getCheckLatency | ( |  | ) |

inline

Definition at line 176 of file Session.h.

{ return m_refreshOnLogon; }

Referenced by FIX::HttpConnection::processSession().

## getDataDictionaryProvider()

const DataDictionaryProvider& FIX::Session::getDataDictionaryProvider | ( |  | ) | const

inline

Definition at line 113 of file Session.h.

{ return m_state.initiate(); }
bool isAcceptor()

References FIX::SessionState::initiate(), and m_state.

## getExpectedSenderNum()

int FIX::Session::getExpectedSenderNum | ( |  | ) |

inline

Definition at line 258 of file Session.h.

{ return msgSeqNum > ( m_state.getNextTargetMsgSeqNum() ); }

Referenced by nextResendRequest(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), and sendRaw().

## getExpectedTargetNum()

int FIX::Session::getExpectedTargetNum | ( |  | ) |

inline

Definition at line 259 of file Session.h.

{ return msgSeqNum > ( m_state.getNextTargetMsgSeqNum() ); }

Referenced by nextReject(), FIX::HttpConnection::processRoot(), and FIX::HttpConnection::processSession().

## getHeartBtInt()

const HeartBtInt& FIX::Session::getHeartBtInt | ( |  | ) | const

inline

Definition at line 264 of file Session.h.

{

## getLog()

Log* FIX::Session::getLog | ( |  | ) |

inline

Definition at line 261 of file Session.h.

{ return msgSeqNum > ( m_state.getNextTargetMsgSeqNum() ); }

References FIX::SessionState::getNextTargetMsgSeqNum(), and m_state.

## getLogonTime()

const TimeRange& FIX::Session::getLogonTime | ( |  | ) |

inline

Definition at line 151 of file Session.h.

{ return m_state.logonTimeout(); }

## getLogonTimeout()

int FIX::Session::getLogonTimeout | ( |  | ) |

inline

Definition at line 186 of file Session.h.

{ return m_timestampPrecision; }

Referenced by FIX::HttpConnection::processSession().

## getLogoutTimeout()

int FIX::Session::getLogoutTimeout | ( |  | ) |

inline

Definition at line 191 of file Session.h.

{ return m_timestampPrecision; }
void setTimestampPrecision(int precision)

References m_timestampPrecision.

Referenced by FIX::HttpConnection::processSession().

## getMaxLatency()

int FIX::Session::getMaxLatency | ( |  | ) |

inline

Definition at line 181 of file Session.h.

{ return (m_timestampPrecision == 3); }

Referenced by FIX::HttpConnection::processSession().

## getMillisecondsInTimeStamp()

bool FIX::Session::getMillisecondsInTimeStamp | ( |  | ) |

inline

Definition at line 216 of file Session.h.

Referenced by FIX::HttpConnection::processSession().

## getPersistMessages()

bool FIX::Session::getPersistMessages | ( |  | ) |

inline

Definition at line 234 of file Session.h.

Referenced by FIX::HttpConnection::processSession().

## getRefreshOnLogon()

bool FIX::Session::getRefreshOnLogon | ( |  | ) |

inline

Definition at line 211 of file Session.h.

{
if( !checkSessionTime(UtcTimeStamp()) )

References checkSessionTime(), and FIX::TYPE::UtcTimeStamp.

Referenced by FIX::HttpConnection::processSession().

## getResetOnDisconnect()

bool FIX::Session::getResetOnDisconnect | ( |  | ) |

inline

Definition at line 206 of file Session.h.

{ return m_validateLengthAndChecksum; }
void setValidateLengthAndChecksum ( bool value )

References m_validateLengthAndChecksum.

Referenced by FIX::HttpConnection::processSession().

## getResetOnLogon()

bool FIX::Session::getResetOnLogon | ( |  | ) |

inline

Definition at line 196 of file Session.h.

{ return m_persistMessages; }

Referenced by FIX::HttpConnection::processSession().

## getResetOnLogout()

bool FIX::Session::getResetOnLogout | ( |  | ) |

inline

Definition at line 201 of file Session.h.

{ return m_persistMessages; }
void setPersistMessages ( bool value )

References m_persistMessages.

Referenced by FIX::HttpConnection::processSession().

## getSenderDefaultApplVerID()

const std::string& FIX::Session::getSenderDefaultApplVerID | ( |  | ) |

inline

Definition at line 156 of file Session.h.

{ return m_state.logoutTimeout(); }

## getSendRedundantResendRequests()

bool FIX::Session::getSendRedundantResendRequests | ( |  | ) |

inline

Definition at line 166 of file Session.h.

{ return m_resetOnLogout; }

Referenced by FIX::HttpConnection::processSession().

## getSessionID()

const SessionID& FIX::Session::getSessionID | ( |  | ) | const

inline

Definition at line 109 of file Session.h.

{ return m_sessionTime.isInRange(time); }
bool isLogonTime(const UtcTimeStamp& time)

References FIX::TimeRange::isInRange(), and m_sessionTime.

Referenced by FIX::SocketInitiator::onDisconnect().

## getSessions()

std::set< SessionID > FIX::Session::getSessions | ( |  | ) |

static

Definition at line 1502 of file Session.cpp.

Referenced by FIX::HttpConnection::processDisableSessions(), FIX::HttpConnection::processEnableSessions(), FIX::HttpConnection::processRefreshSessions(), FIX::HttpConnection::processResetSessions(), and FIX::HttpConnection::processRoot().

## getStore()

const MessageStore* FIX::Session::getStore | ( |  | ) |

inline

Definition at line 262 of file Session.h.

{ return msgSeqNum < ( m_state.getNextTargetMsgSeqNum() ); }

References FIX::SessionState::getNextTargetMsgSeqNum(), and m_state.

## getTargetDefaultApplVerID()

const std::string& FIX::Session::getTargetDefaultApplVerID | ( |  | ) |

inline

Definition at line 161 of file Session.h.

{ return m_resetOnLogon; }

## getTimestampPrecision()

int FIX::Session::getTimestampPrecision | ( |  | ) |

inline

Definition at line 224 of file Session.h.

{ return m_state.getNextSenderMsgSeqNum(); }
int getExpectedTargetNum() { return m_state.getNextTargetMsgSeqNum(); }

References FIX::SessionState::getNextSenderMsgSeqNum(), and m_state.

## getValidateLengthAndChecksum()

bool FIX::Session::getValidateLengthAndChecksum | ( |  | ) |

inline

Definition at line 239 of file Session.h.

## insertOrigSendingTime()

void FIX::Session::insertOrigSendingTime | ( | Header & | header,
|  | const UtcTimeStamp & | when = `UtcTimeStamp ()`
| ) |  |

private

Definition at line 120 of file Session.cpp.

{
next( UtcTimeStamp() );
}

## insertSendingTime()

void FIX::Session::insertSendingTime | ( | Header & | header | ) |

private

Definition at line 108 of file Session.cpp.

: 0) );
}
void Session::fill( Header& header )
{
UtcTimeStamp now;
m_state.lastSentTime( now );
header.setField( m_sessionID.getBeginString() );

## isAcceptor()

bool FIX::Session::isAcceptor | ( |  | ) |

inline

Definition at line 148 of file Session.h.

{ return m_maxLatency; }
void setMaxLatency ( int value )

References m_maxLatency.

## isCorrectCompID()

bool FIX::Session::isCorrectCompID | ( | const SenderCompID & | senderCompID,
|  | const TargetCompID & | targetCompID
| ) |  |

inline private

Definition at line 298 of file Session.h.

## isEnabled()

bool FIX::Session::isEnabled | ( |  | ) |

inline

Definition at line 93 of file Session.h.

Referenced by fill(), FIX::Initiator::getSessionSettings(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), and FIX::Initiator::stop().

## isGoodTime()

bool FIX::Session::isGoodTime | ( | const SendingTime & | sendingTime | ) |

inline private

Definition at line 283 of file Session.h.

## isInitiator()

bool FIX::Session::isInitiator | ( |  | ) |

inline

Definition at line 146 of file Session.h.

{ return m_maxLatency; }

Referenced by FIX::HttpConnection::processRoot(), and FIX::HttpConnection::processSession().

## isLoggedOn()

bool FIX::Session::isLoggedOn | ( |  | ) |

inline

Definition at line 99 of file Session.h.

Referenced by fill(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), and sendRaw().

## isLogonTime()

bool FIX::Session::isLogonTime | ( | const UtcTimeStamp & | time | ) |

inline

Definition at line 144 of file Session.h.

{ m_checkLatency = value; }

References m_checkLatency.

Referenced by fill().

## isSessionRegistered()

bool FIX::Session::isSessionRegistered | ( | const SessionID & | sessionID | ) |

static

Definition at line 1548 of file Session.cpp.

{
Locker locker( s_mutex );
s_registered.erase( sessionID );
}

References s_mutex, and s_registered.

Referenced by FIX::ThreadedSocketConnection::setSession().

## isSessionTime()

bool FIX::Session::isSessionTime | ( | const UtcTimeStamp & | time | ) |

inline

Definition at line 142 of file Session.h.

{ return m_checkLatency; }

References m_checkLatency.

Referenced by FIX::Initiator::getSessionSettings(), FIX::HttpConnection::processRoot(), and FIX::HttpConnection::processSession().

## isTargetTooHigh()

bool FIX::Session::isTargetTooHigh | ( | const MsgSeqNum & | msgSeqNum | ) |

inline private

Definition at line 294 of file Session.h.

## isTargetTooLow()

bool FIX::Session::isTargetTooLow | ( | const MsgSeqNum & | msgSeqNum | ) |

inline private

Definition at line 296 of file Session.h.

## logon()

void FIX::Session::logon | ( |  | ) |

inline

Definition at line 89 of file Session.h.

Referenced by FIX::HttpConnection::processEnableSessions(), and FIX::HttpConnection::processSession().

## logout()

void FIX::Session::logout | ( | const std::string & | reason = `""` | ) |

inline

Definition at line 91 of file Session.h.

Referenced by FIX::HttpConnection::processDisableSessions(), FIX::HttpConnection::processSession(), and FIX::Initiator::stop().

## lookupSession() [1/2]

Session * FIX::Session::lookupSession | ( | const SessionID & | sessionID | ) |

static

Definition at line 1513 of file Session.cpp.

{
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 ),

References FIELD_GET_REF, FIX::Message::getHeader(), and reverse().

Referenced by FIX::Initiator::getSessionSettings(), FIX::HttpConnection::processDisableSessions(), FIX::HttpConnection::processEnableSessions(), FIX::HttpConnection::processRefreshSession(), FIX::HttpConnection::processRefreshSessions(), FIX::HttpConnection::processResetSession(), FIX::HttpConnection::processResetSessions(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), and FIX::Initiator::stop().

## lookupSession() [2/2]

Session * FIX::Session::lookupSession | ( | const std::string & | string,
|  | bool | reverse = `false`
| ) |  |

static

Definition at line 1523 of file Session.cpp.

{ 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;
}

## newMessage()

Message * FIX::Session::newMessage | ( | const std::string & | msgType | ) | const

private

Definition at line 509 of file Session.cpp.

{
const DataDictionary& applicationDD =
m_dataDictionaryProvider.getApplicationDataDictionary(m_senderDefaultApplVerID);
const message_order & msgOrder = applicationDD.getMessageOrderedFields(msgType);
msg = new Message(hdrOrder, trlOrder, msgOrder);
}
}
return msg;
}
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;

Referenced by generateHeartbeat().

## next() [1/4]

void FIX::Session::next | ( |  | ) |

Definition at line 142 of file Session.cpp.

{
m_state.onEvent( "Initiated logout request" );
generateLogout( m_state.logoutReason() );
}

References generateLogout(), FIX::SessionState::logoutReason(), m_state, and FIX::SessionState::onEvent().

Referenced by FIX::SocketConnection::readMessage().

## next() [2/4]

void FIX::Session::next | ( | const Message & | message,
|  | const UtcTimeStamp & | timeStamp,
|  | bool | queued = `false`
| ) |  |

Definition at line 1318 of file Session.cpp.

{
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 );

References FIELD_GET_REF, FIX::SessionID::isFIXT(), m_sessionID, setTargetDefaultApplVerID(), and FIX::Message::toApplVerID().

## next() [3/4]

void FIX::Session::next | ( | const std::string & | msg,
|  | const UtcTimeStamp & | timeStamp,
|  | bool | queued = `false`
| ) |  |

Definition at line 1284 of file Session.cpp.

{
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() )

## next() [4/4]

void FIX::Session::next | ( | const UtcTimeStamp & | timeStamp | ) |

Definition at line 147 of file Session.cpp.

{
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;
}

## nextHeartbeat()

void FIX::Session::nextHeartbeat | ( | const Message & | heartbeat,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 297 of file Session.cpp.

{
m_state.onEvent( "Received logout request" );
generateLogout();
m_state.onEvent( "Sending logout response" );

References generateLogout(), m_state, and FIX::SessionState::onEvent().

## nextLogon()

void FIX::Session::nextLogon | ( | const Message & | logon,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 219 of file Session.cpp.

{
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 )

References disconnect(), m_state, and FIX::SessionState::onEvent().

## nextLogout()

void FIX::Session::nextLogout | ( | const Message & | logout,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 312 of file Session.cpp.

{
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;
}

References FIX::SessionState::incrNextTargetMsgSeqNum(), m_state, nextQueued(), and verify().

## nextQueued() [1/2]

void FIX::Session::nextQueued | ( | const UtcTimeStamp & | timeStamp | ) |

private

Definition at line 1255 of file Session.cpp.

{
m_state.incrNextTargetMsgSeqNum();
}
else

References FIX::SessionState::incrNextTargetMsgSeqNum(), and m_state.

Referenced by nextLogout().

## nextQueued() [2/2]

bool FIX::Session::nextQueued | ( | int | num,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 1260 of file Session.cpp.

{
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 );

## nextReject()

void FIX::Session::nextReject | ( | const Message & | reject,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 329 of file Session.cpp.

{
m_state.onEvent( "Received SequenceReset FROM: "
+ IntConvertor::convert( getExpectedTargetNum() ) +

References FIX::IntConvertor::convert(), getExpectedTargetNum(), m_state, and FIX::SessionState::onEvent().

## nextResendRequest()

void FIX::Session::nextResendRequest | ( | const Message & | resendRequest,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 361 of file Session.cpp.

{ 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;
for ( i = messages.begin(); i != messages.end(); ++i )
{
SmartPtr<FIX::Message> pMsg;
std::string strMsgType;
const DataDictionary& sessionDD =
m_dataDictionaryProvider.getSessionDataDictionary(m_sessionID.getBeginString());
if (sessionDD.isMessageFieldsOrderPreserved())
{
std::string::size_type equalSign = (*i).find("\00135=");
equalSign += 4;
std::string::size_type soh = (*i).find_first_of('\001', equalSign);
strMsgType = (*i).substr(equalSign, soh - equalSign);
#ifdef HAVE_EMX
if (FIX::Message::isAdminMsgType(strMsgType) == false)
{
equalSign = (*i).find("\0019426=", soh);
if (equalSign == std::string::npos)
throw FIX::IOException("EMX message type (9426) not found");
equalSign += 6;
soh = (*i).find_first_of('\001', equalSign);
if (soh == std::string::npos)
throw FIX::IOException("EMX message type (9426) soh char not found");
strMsgType.assign((*i).substr(equalSign, soh - equalSign));
}
#endif
}
if( m_sessionID.isFIXT() )
{
Message msg;
msg.setStringHeader(*i);
ApplVerID applVerID;
if( !msg.getHeader().getFieldIfSet(applVerID) )
applVerID = m_senderDefaultApplVerID;
const DataDictionary& applicationDD =
m_dataDictionaryProvider.getApplicationDataDictionary(applVerID);
if (strMsgType.empty())
pMsg.reset( new Message( *i, sessionDD, applicationDD, m_validateLengthAndChecksum ));
else
{
const message_order & hdrOrder = sessionDD.getHeaderOrderedFields();
const message_order & trlOrder = sessionDD.getTrailerOrderedFields();
const message_order & msgOrder = applicationDD.getMessageOrderedFields(strMsgType);
pMsg.reset( new Message( hdrOrder, trlOrder, msgOrder, *i, sessionDD, applicationDD, m_validateLengthAndChecksum ));
}
}
else
{
if (strMsgType.empty())
pMsg.reset( new Message( *i, sessionDD, m_validateLengthAndChecksum ));
else
{
const message_order & hdrOrder = sessionDD.getHeaderOrderedFields();
const message_order & trlOrder = sessionDD.getTrailerOrderedFields();
const message_order & msgOrder = sessionDD.getMessageOrderedFields(strMsgType);
pMsg.reset(new Message(hdrOrder, trlOrder, msgOrder, *i, sessionDD, m_validateLengthAndChecksum ));
}
}
Message & msg = *pMsg;
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();
}
Message * Session::newMessage(const std::string & msgType) const
{
Message * msg = 0;
const DataDictionary& sessionDD =
m_dataDictionaryProvider.getSessionDataDictionary(m_sessionID.getBeginString());
if (!sessionDD.isMessageFieldsOrderPreserved())
{
msg = new Message();
}
else
{
const message_order & hdrOrder = sessionDD.getHeaderOrderedFields();
const message_order & trlOrder = sessionDD.getTrailerOrderedFields();
if (!m_sessionID.isFIXT() || Message::isAdminMsgType(msgType) )
{

References getExpectedSenderNum().

## nextSequenceReset()

void FIX::Session::nextSequenceReset | ( | const Message & | sequenceReset,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 336 of file Session.cpp.

{
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();

## nextTestRequest()

void FIX::Session::nextTestRequest | ( | const Message & | testRequest,
|  | const UtcTimeStamp & | timeStamp
| ) |  |

private

Definition at line 304 of file Session.cpp.

## numSessions()

size_t FIX::Session::numSessions | ( |  | ) |

static

Definition at line 1570 of file Session.cpp.

{

Referenced by FIX::HttpConnection::processRoot().

## persist()

void FIX::Session::persist | ( | const Message & | message,
|  | const std::string & | messageString
| ) |  |
throw | ( | IOException
| ) |  |

private

Definition at line 680 of file Session.cpp.

Referenced by sendRaw().

## populateRejectReason() [1/2]

void FIX::Session::populateRejectReason | ( | Message & | reject,
|  | const std::string & | text
| ) |  |

private

Definition at line 1046 of file Session.cpp.

## populateRejectReason() [2/2]

void FIX::Session::populateRejectReason | ( | Message & | reject,
|  | int | field,
|  | const std::string & | text
| ) |  |

private

Definition at line 1026 of file Session.cpp.

{
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 );

## receivedLogon()

bool FIX::Session::receivedLogon | ( |  | ) |

inline

Definition at line 98 of file Session.h.

## refresh()

void FIX::Session::refresh | ( |  | ) |
throw | ( | IOException
| ) |  |

inline

Definition at line 102 of file Session.h.

{ return m_sessionTime.isInRange(time); }

Referenced by FIX::HttpConnection::processRefreshSession(), and FIX::HttpConnection::processRefreshSessions().

## registerSession()

Session * FIX::Session::registerSession | ( | const SessionID & | sessionID | ) |

static

Definition at line 1554 of file Session.cpp.

{
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 );

References s_mutex, and s_sessions.

Referenced by FIX::ThreadedSocketConnection::setSession().

## removeSession()

void FIX::Session::removeSession | ( | Session & | s | ) |

static private

Definition at line 1590 of file Session.cpp.

## resend()

bool FIX::Session::resend | ( | Message & | message | ) |

private

Definition at line 660 of file Session.cpp.

{ 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()
{
SmartPtr<Message> pMsg(newMessage("A"));
Message & logon = *pMsg;
logon.getHeader().setField( MsgType( "A" ) );

## reset()

void FIX::Session::reset | ( |  | ) |
throw | ( | IOException
| ) |  |

inline

Definition at line 100 of file Session.h.

{ return m_sessionTime.isInRange(time); }

Referenced by fill(), FIX::HttpConnection::processResetSession(), and FIX::HttpConnection::processResetSessions().

## send() [1/2]

bool FIX::Session::send | ( | const std::string & | string | ) |

private

Definition at line 623 of file Session.cpp.

{
m_state.receivedLogon( false );
m_state.sentLogon( false );

## send() [2/2]

bool FIX::Session::send | ( | Message & | message | ) |

Definition at line 540 of file Session.cpp.

Referenced by sendRaw().

## sendRaw()

bool FIX::Session::sendRaw | ( | Message & | message,
|  | int | msgSeqNum = `0`
| ) |  |

private

Definition at line 547 of file Session.cpp.

{
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();

References getExpectedSenderNum(), isLoggedOn(), m_application, m_sessionID, m_state, persist(), FIX::SessionState::receivedReset(), FIX::SessionState::reset(), send(), FIX::SessionState::sentReset(), and FIX::Application::toAdmin().

Referenced by generateHeartbeat().

## sendToTarget() [1/4]

bool FIX::Session::sendToTarget | ( | Message & | message,
|  | const SenderCompID & | senderCompID,
|  | const TargetCompID & | targetCompID,
|  | const std::string & | qualifier = `""`
| ) |  |
throw | ( | SessionNotFound
| ) |  |

static

Definition at line 1482 of file Session.cpp.

{
return s_sessionIDs;
}
bool Session::doesSessionExist( const SessionID& sessionID )
{

## sendToTarget() [2/4]

bool FIX::Session::sendToTarget | ( | Message & | message,
|  | const SessionID & | sessionID
| ) |  |
throw | ( | SessionNotFound
| ) |  |

static

Definition at line 1472 of file Session.cpp.

{

## sendToTarget() [3/4]

bool FIX::Session::sendToTarget | ( | Message & | message,
|  | const std::string & | qualifier = `""`
| ) |  |
throw | ( | SessionNotFound
| ) |  |

static

Definition at line 1461 of file Session.cpp.

{

## sendToTarget() [4/4]

bool FIX::Session::sendToTarget | ( | Message & | message,
|  | const std::string & | senderCompID,
|  | const std::string & | targetCompID,
|  | const std::string & | qualifier = `""`
| ) |  |
throw | ( | SessionNotFound
| ) |  |

static

Definition at line 1494 of file Session.cpp.

{
Locker locker( s_mutex );
Sessions::iterator find = s_sessions.find( sessionID );
if ( find != s_sessions.end() )

## sentLogon()

bool FIX::Session::sentLogon | ( |  | ) |

inline

Definition at line 96 of file Session.h.

## sentLogout()

bool FIX::Session::sentLogout | ( |  | ) |

inline

Definition at line 97 of file Session.h.

## set()

bool FIX::Session::set | ( | int | s,
|  | const Message & | m
| ) |  |

private

## setCheckCompId()

void FIX::Session::setCheckCompId | ( | bool | value | ) |

inline

Definition at line 173 of file Session.h.

{ return m_resetOnDisconnect; }
void setResetOnDisconnect( bool value )

References m_resetOnDisconnect.

Referenced by FIX::HttpConnection::processSession().

## setCheckLatency()

void FIX::Session::setCheckLatency | ( | bool | value | ) |

inline

Definition at line 178 of file Session.h.

{ return m_refreshOnLogon; }
void setRefreshOnLogon( bool value )

References m_refreshOnLogon.

Referenced by FIX::HttpConnection::processSession().

## setDataDictionaryProvider()

void FIX::Session::setDataDictionaryProvider | ( | const DataDictionaryProvider & | dataDictionaryProvider | ) |

inline

Definition at line 111 of file Session.h.

{ return m_logonTime.isInRange(time); }
bool isInitiator()

References FIX::TimeRange::isInRange(), and m_logonTime.

## setLogonTime()

void FIX::Session::setLogonTime | ( | const TimeRange & | value | ) |

inline

Definition at line 153 of file Session.h.

{ return m_state.logonTimeout(); }
void setLogonTimeout ( int value )

References FIX::SessionState::logonTimeout(), and m_state.

## setLogonTimeout()

void FIX::Session::setLogonTimeout | ( | int | value | ) |

inline

Definition at line 188 of file Session.h.

{ return m_timestampPrecision; }

Referenced by FIX::HttpConnection::processSession().

## setLogoutTimeout()

void FIX::Session::setLogoutTimeout | ( | int | value | ) |

inline

Definition at line 193 of file Session.h.

{
if (precision < 0 || precision > 9)

Referenced by FIX::HttpConnection::processSession().

## setMaxLatency()

void FIX::Session::setMaxLatency | ( | int | value | ) |

inline

Definition at line 183 of file Session.h.

{ return (m_timestampPrecision == 3); }
void setMillisecondsInTimeStamp ( bool value )

References m_timestampPrecision.

Referenced by FIX::HttpConnection::processSession().

## setMillisecondsInTimeStamp()

void FIX::Session::setMillisecondsInTimeStamp | ( | bool | value | ) |

inline

Definition at line 218 of file Session.h.

{ return m_state.getNextSenderMsgSeqNum(); }

Referenced by FIX::HttpConnection::processSession().

## setNextSenderMsgSeqNum()

void FIX::Session::setNextSenderMsgSeqNum | ( | int | num | ) |
throw | ( | IOException
| ) |  |

inline

Definition at line 104 of file Session.h.

{ return m_sessionTime.isInRange(time); }

Referenced by FIX::HttpConnection::processSession().

## setNextTargetMsgSeqNum()

void FIX::Session::setNextTargetMsgSeqNum | ( | int | num | ) |
throw | ( | IOException
| ) |  |

inline

Definition at line 106 of file Session.h.

{ return m_sessionTime.isInRange(time); }

Referenced by FIX::HttpConnection::processSession().

## setPersistMessages()

void FIX::Session::setPersistMessages | ( | bool | value | ) |

inline

Definition at line 236 of file Session.h.

Referenced by FIX::HttpConnection::processSession().

## setRefreshOnLogon()

void FIX::Session::setRefreshOnLogon | ( | bool | value | ) |

inline

Definition at line 213 of file Session.h.

Referenced by FIX::HttpConnection::processSession().

## setResetOnDisconnect()

void FIX::Session::setResetOnDisconnect | ( | bool | value | ) |

inline

Definition at line 208 of file Session.h.

{ m_validateLengthAndChecksum = value; }

References m_validateLengthAndChecksum.

Referenced by FIX::HttpConnection::processSession().

## setResetOnLogon()

void FIX::Session::setResetOnLogon | ( | bool | value | ) |

inline

Definition at line 198 of file Session.h.

{ return m_persistMessages; }

Referenced by FIX::HttpConnection::processSession().

## setResetOnLogout()

void FIX::Session::setResetOnLogout | ( | bool | value | ) |

inline

Definition at line 203 of file Session.h.

{ m_persistMessages = value; }

References m_persistMessages.

Referenced by FIX::HttpConnection::processSession().

## setResponder()

void FIX::Session::setResponder | ( | Responder * | pR | ) |

inline

Definition at line 244 of file Session.h.

{

## setSenderDefaultApplVerID()

void FIX::Session::setSenderDefaultApplVerID | ( | const std::string & | senderDefaultApplVerID | ) |

inline

Definition at line 158 of file Session.h.

{ return m_state.logoutTimeout(); }
void setLogoutTimeout ( int value )

References FIX::SessionState::logoutTimeout(), and m_state.

## setSendRedundantResendRequests()

void FIX::Session::setSendRedundantResendRequests | ( | bool | value | ) |

inline

Definition at line 168 of file Session.h.

{ return m_resetOnLogout; }
void setResetOnLogout ( bool value )

References m_resetOnLogout.

Referenced by FIX::HttpConnection::processSession().

## setTargetDefaultApplVerID()

void FIX::Session::setTargetDefaultApplVerID | ( | const std::string & | targetDefaultApplVerID | ) |

inline

Definition at line 163 of file Session.h.

{ return m_resetOnLogon; }
void setResetOnLogon ( bool value )

References m_resetOnLogon.

Referenced by next().

## setTimestampPrecision()

void FIX::Session::setTimestampPrecision | ( | int | precision | ) |

inline

Definition at line 226 of file Session.h.

{ return &m_state; }
const MessageStore* getStore() { return &m_state; }
const HeartBtInt& getHeartBtInt() const { return m_state.heartBtInt(); }
private:

References m_state.

## setValidateLengthAndChecksum()

void FIX::Session::setValidateLengthAndChecksum | ( | bool | value | ) |

inline

Definition at line 241 of file Session.h.

{

## shouldSendReset()

bool FIX::Session::shouldSendReset | ( |  | ) |

private

Definition at line 1123 of file Session.cpp.

## unregisterSession()

void FIX::Session::unregisterSession | ( | const SessionID & | sessionID | ) |

static

Definition at line 1564 of file Session.cpp.

{
s_sessions[ s.m_sessionID ] = &s;
s_sessionIDs.insert( s.m_sessionID );
return true;
}

References m_sessionID, s_sessionIDs, and s_sessions.

Referenced by FIX::ThreadedSocketConnection::ThreadedSocketConnection().

## validLogonState()

bool FIX::Session::validLogonState | ( | const MsgType & | msgType | ) |

private

Definition at line 1134 of file Session.cpp.

{
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 )

## verify()

bool FIX::Session::verify | ( | const Message & | msg,
|  | bool | checkTooHigh = `true`,
|  | bool | checkTooLow = `true`
| ) |  |

private

Definition at line 1051 of file Session.cpp.

{
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;

Referenced by nextLogout().

## Member Data Documentation

## m_application

Application& FIX::Session::m_application

private

Definition at line 352 of file Session.h.

Referenced by sendRaw().

## m_checkCompId

bool FIX::Session::m_checkCompId

private

Definition at line 360 of file Session.h.

## m_checkLatency

bool FIX::Session::m_checkLatency

private

Definition at line 361 of file Session.h.

Referenced by isLogonTime(), and isSessionTime().

## m_dataDictionaryProvider

DataDictionaryProvider FIX::Session::m_dataDictionaryProvider

private

Definition at line 372 of file Session.h.

## m_logonTime

TimeRange FIX::Session::m_logonTime

private

Definition at line 355 of file Session.h.

Referenced by setDataDictionaryProvider().

## m_maxLatency

int FIX::Session::m_maxLatency

private

Definition at line 362 of file Session.h.

Referenced by isAcceptor().

## m_messageStoreFactory

MessageStoreFactory& FIX::Session::m_messageStoreFactory

private

Definition at line 373 of file Session.h.

## m_mutex

Mutex FIX::Session::m_mutex

private

Definition at line 376 of file Session.h.

## m_persistMessages

bool FIX::Session::m_persistMessages

private

Definition at line 368 of file Session.h.

Referenced by getResetOnLogout(), and setResetOnLogout().

## m_pLogFactory

LogFactory* FIX::Session::m_pLogFactory

private

Definition at line 374 of file Session.h.

## m_pResponder

Responder* FIX::Session::m_pResponder

private

Definition at line 375 of file Session.h.

## m_refreshOnLogon

bool FIX::Session::m_refreshOnLogon

private

Definition at line 366 of file Session.h.

Referenced by setCheckLatency().

## m_resetOnDisconnect

bool FIX::Session::m_resetOnDisconnect

private

Definition at line 365 of file Session.h.

Referenced by setCheckCompId().

## m_resetOnLogon

bool FIX::Session::m_resetOnLogon

private

Definition at line 363 of file Session.h.

Referenced by setTargetDefaultApplVerID().

## m_resetOnLogout

bool FIX::Session::m_resetOnLogout

private

Definition at line 364 of file Session.h.

Referenced by setSendRedundantResendRequests().

## m_senderDefaultApplVerID

std::string FIX::Session::m_senderDefaultApplVerID

private

Definition at line 357 of file Session.h.

## m_sendRedundantResendRequests

bool FIX::Session::m_sendRedundantResendRequests

private

Definition at line 359 of file Session.h.

## m_sessionID

SessionID FIX::Session::m_sessionID

private

Definition at line 353 of file Session.h.

Referenced by next(), sendRaw(), and unregisterSession().

## m_sessionTime

TimeRange FIX::Session::m_sessionTime

private

Definition at line 354 of file Session.h.

Referenced by getSessionID().

## m_state

SessionState FIX::Session::m_state

private

Definition at line 371 of file Session.h.

Referenced by doTargetTooHigh(), fill(), getDataDictionaryProvider(), getLog(), getStore(), getTimestampPrecision(), next(), nextHeartbeat(), nextLogon(), nextLogout(), nextQueued(), nextReject(), sendRaw(), setLogonTime(), setSenderDefaultApplVerID(), and setTimestampPrecision().

## m_targetDefaultApplVerID

std::string FIX::Session::m_targetDefaultApplVerID

private

Definition at line 358 of file Session.h.

## m_timestampPrecision

int FIX::Session::m_timestampPrecision

private

Definition at line 367 of file Session.h.

Referenced by getLogoutTimeout(), and setMaxLatency().

## m_validateLengthAndChecksum

bool FIX::Session::m_validateLengthAndChecksum

private

Definition at line 369 of file Session.h.

Referenced by getResetOnDisconnect(), and setResetOnDisconnect().

## s_mutex

Mutex FIX::Session::s_mutex

static private

Definition at line 381 of file Session.h.

Referenced by isSessionRegistered(), and registerSession().

## s_registered

Session::Sessions FIX::Session::s_registered

static private

Definition at line 380 of file Session.h.

Referenced by isSessionRegistered().

## s_sessionIDs

Session::SessionIDs FIX::Session::s_sessionIDs

static private

Definition at line 379 of file Session.h.

Referenced by unregisterSession().

## s_sessions

Session::Sessions FIX::Session::s_sessions

static private

Definition at line 378 of file Session.h.

Referenced by registerSession(), and unregisterSession().

The documentation for this class was generated from the following files:

- Session.h
- Session.cpp

FIX::SessionState::reset
void reset()
Definition: SessionState.h:225
FIX::Session::checkSessionTime
bool checkSessionTime(const UtcTimeStamp &timeStamp)
Definition: Session.h:289
FIX::SessionRejectReason_VALUE_IS_INCORRECT_TEXT
const char SessionRejectReason_VALUE_IS_INCORRECT_TEXT[]
Definition: Values.h:60
FIX::Session::generateBusinessReject
void generateBusinessReject(const Message &, int err, int field=0)
Definition: Session.cpp:948
FIX::Session::m_targetDefaultApplVerID
std::string m_targetDefaultApplVerID
Definition: Session.h:358
FIX::Session::doTargetTooLow
bool doTargetTooLow(const Message &msg)
Definition: Session.cpp:1203
FIX::Session::m_resetOnLogout
bool m_resetOnLogout
Definition: Session.h:364
FIX::SessionState::alreadySentLogon
bool alreadySentLogon() const
Definition: SessionState.h:150
FIX::BeginString_FIX41
const char BeginString_FIX41[]
Definition: Values.h:52
FIX::Message::toApplVerID
static ApplVerID toApplVerID(const BeginString &value)
Definition: Message.h:324
FIX::Session::m_maxLatency
int m_maxLatency
Definition: Session.h:362
FIX::Session::setTargetDefaultApplVerID
void setTargetDefaultApplVerID(const std::string &targetDefaultApplVerID)
Definition: Session.h:163
FIX::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:95
FIX::Session::setMaxLatency
void setMaxLatency(int value)
Definition: Session.h:183
FIX::SessionRejectReason_COMPID_PROBLEM_TEXT
const char SessionRejectReason_COMPID_PROBLEM_TEXT[]
Definition: Values.h:64
FIX::Session::generateReject
void generateReject(const Message &, int err, int field=0)
Definition: Session.cpp:822
FIX::Session::nextReject
void nextReject(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:329
FIX::SessionState::withinHeartBeat
bool withinHeartBeat() const
Definition: SessionState.h:161
FIX::Application::toAdmin
virtual void toAdmin(Message &, const SessionID &)=0
Notification of admin message being sent to target.
FIX::Session::lookupSession
static Session * lookupSession(const SessionID &)
Definition: Session.cpp:1513
FIX::SessionState::logonTimeout
int logonTimeout() const
Definition: SessionState.h:105
FIX::Session::nextLogon
void nextLogon(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:219
FIX::MessageStoreFactory::create
virtual MessageStore * create(const SessionID &)=0
FIX::SessionState::getNextTargetMsgSeqNum
int getNextTargetMsgSeqNum() const
Definition: SessionState.h:213
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:363
FIX::SessionState::testRequest
int testRequest() const
Definition: SessionState.h:111
FIX::SessionState::timedOut
bool timedOut() const
Definition: SessionState.h:167
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:51
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:1051
FIX::Session::setTimestampPrecision
void setTimestampPrecision(int precision)
Definition: Session.h:226
FIX::SessionState::queue
void queue(int msgSeqNum, const Message &message)
Definition: SessionState.h:189
FIX::BusinessRejectReason_NOT_AUTHORIZED_TEXT
const char BusinessRejectReason_NOT_AUTHORIZED_TEXT[]
Definition: Values.h:76
FIX::BusinessRejectReason_UNKNOWN_ID_TEXT
const char BusinessRejectReason_UNKNOWN_ID_TEXT[]
Definition: Values.h:71
FIX::Session::isAcceptor
bool isAcceptor()
Definition: Session.h:148
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:259
FIX::Session::s_sessionIDs
static SessionIDs s_sessionIDs
Definition: Session.h:379
LOGEX
#define LOGEX(method)
Definition: Session.cpp:55
FIX::Session::isTargetTooLow
bool isTargetTooLow(const MsgSeqNum &msgSeqNum)
Definition: Session.h:296
FIX::DataDictionary::getMessageOrderedFields
message_order const & getMessageOrderedFields(const std::string &msgType) const
Definition: DataDictionary.cpp:498
FIX::Session::m_timestampPrecision
int m_timestampPrecision
Definition: Session.h:367
FIX::SessionState::needTestRequest
bool needTestRequest() const
Definition: SessionState.h:177
FIX::Session::reset
void reset()
Definition: Session.h:100
FIX::Session::refresh
void refresh()
Definition: Session.h:102
FIX::SessionState::receivedReset
bool receivedReset() const
Definition: SessionState.h:96
FIX::Session::setResetOnLogout
void setResetOnLogout(bool value)
Definition: Session.h:203
FIX::SessionState::getNextSenderMsgSeqNum
int getNextSenderMsgSeqNum() const
Definition: SessionState.h:211
FIX::Session::setValidateLengthAndChecksum
void setValidateLengthAndChecksum(bool value)
Definition: Session.h:241
FIX::Session::removeSession
static void removeSession(Session &)
Definition: Session.cpp:1590
FIX::SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP_TEXT
const char SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP_TEXT[]
Definition: Values.h:69
FIX::SessionRejectReason_REQUIRED_TAG_MISSING_TEXT
const char SessionRejectReason_REQUIRED_TAG_MISSING_TEXT[]
Definition: Values.h:56
FIELD_THROW_IF_NOT_FOUND
#define FIELD_THROW_IF_NOT_FOUND(MAP, FLD)
Definition: FieldMap.h:378
FIX::Session::m_persistMessages
bool m_persistMessages
Definition: Session.h:368
FIX::Session::doBadCompID
void doBadCompID(const Message &msg)
Definition: Session.cpp:1169
FIX::Session::s_sessions
static Sessions s_sessions
Definition: Session.h:378
FIX::Session::registerSession
static Session * registerSession(const SessionID &)
Definition: Session.cpp:1554
FIX::BusinessRejectReason_UNSUPPORTED_MESSAGE_TYPE_TEXT
const char BusinessRejectReason_UNSUPPORTED_MESSAGE_TYPE_TEXT[]
Definition: Values.h:73
FIX::SessionState::ResendRange
std::pair< int, int > ResendRange
Definition: SessionState.h:117
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:353
FIX::SessionState::onOutgoing
void onOutgoing(const std::string &string)
Definition: SessionState.h:236
FIX::MessageStoreFactory::destroy
virtual void destroy(MessageStore *)=0
FIX::SessionState::log
Log * log()
Definition: SessionState.h:125
FIX::Responder::send
virtual bool send(const std::string &)=0
FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT
const char BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT[]
Definition: Values.h:75
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:90
FIX::Session::doBadTime
void doBadTime(const Message &msg)
Definition: Session.cpp:1163
FIX::Session::generateSequenceReset
void generateSequenceReset(int, int)
Definition: Session.cpp:760
FIX::Session::m_sessionTime
TimeRange m_sessionTime
Definition: Session.h:354
FIX::Session::generateResendRequest
void generateResendRequest(const BeginString &, const MsgSeqNum &)
Definition: Session.cpp:735
FIX::Session::next
void next()
Definition: Session.cpp:142
FIX::SessionState::retrieve
bool retrieve(int msgSeqNum, Message &message)
Definition: SessionState.h:191
FIX::IOException
IO Error.
Definition: Exceptions.h:255
FIX::Session::m_state
SessionState m_state
Definition: Session.h:371
FIX::Session::m_messageStoreFactory
MessageStoreFactory & m_messageStoreFactory
Definition: Session.h:373
FIX::SessionState::get
void get(int b, int e, std::vector< std::string > &m) const
Definition: SessionState.h:208
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:357
FIX::TYPE::UtcTimeStamp
@ UtcTimeStamp
Definition: FieldTypes.h:940
FIX::SessionState::initiate
bool initiate() const
Definition: SessionState.h:102
FIX::Session::validLogonState
bool validLogonState(const MsgType &msgType)
Definition: Session.cpp:1134
FIX::DataDictionaryProvider::getSessionDataDictionary
const DataDictionary & getSessionDataDictionary(const BeginString &beginString) const
Definition: DataDictionaryProvider.cpp:55
FIX::BeginString_FIXT11
const char BeginString_FIXT11[]
Definition: Values.h:47
FIX::Session::s_registered
static Sessions s_registered
Definition: Session.h:380
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:170
FIX::DataDictionaryProvider::getApplicationDataDictionary
const DataDictionary & getApplicationDataDictionary(const ApplVerID &applVerID) const
Definition: DataDictionaryProvider.cpp:66
FIX::Session::setResetOnDisconnect
void setResetOnDisconnect(bool value)
Definition: Session.h:208
FIX::Session::isLogonTime
bool isLogonTime(const UtcTimeStamp &time)
Definition: Session.h:144
FIX::Session::doesSessionExist
static bool doesSessionExist(const SessionID &)
Definition: Session.cpp:1507
FIX::Session::m_checkLatency
bool m_checkLatency
Definition: Session.h:361
FIX::SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE_TEXT
const char SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE_TEXT[]
Definition: Values.h:57
FIX::DataDictionary::getHeaderOrderedFields
message_order const & getHeaderOrderedFields() const
Definition: DataDictionary.cpp:458
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:87
FIX::Session::generateLogon
void generateLogon()
Definition: Session.cpp:690
FIX::Session::isSessionRegistered
static bool isSessionRegistered(const SessionID &)
Definition: Session.cpp:1548
FIX::LogFactory::destroy
virtual void destroy(Log *)=0
FIX::Session::generateTestRequest
void generateTestRequest(const std::string &)
Definition: Session.cpp:809
FIX::Session::populateRejectReason
void populateRejectReason(Message &, int field, const std::string &)
Definition: Session.cpp:1026
FIX::Session::fromCallback
void fromCallback(const MsgType &msgType, const Message &msg, const SessionID &sessionID)
Definition: Session.cpp:1154
FIX::SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE_TEXT
const char SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE_TEXT[]
Definition: Values.h:67
FIX::Responder::disconnect
virtual void disconnect()=0
FIX::Session::setLogoutTimeout
void setLogoutTimeout(int value)
Definition: Session.h:193
FIX::Session::Session
Session(Application &, MessageStoreFactory &, const SessionID &, const DataDictionaryProvider &, const TimeRange &, int heartBtInt, LogFactory *pLogFactory)
Definition: Session.cpp:58
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:547
FIX::BusinessRejectReason_OTHER_TEXT
const char BusinessRejectReason_OTHER_TEXT[]
Definition: Values.h:70
FIX::SessionState::sentLogon
bool sentLogon() const
Definition: SessionState.h:93
FIX::SessionRejectReason_INVALID_TAG_NUMBER_TEXT
const char SessionRejectReason_INVALID_TAG_NUMBER_TEXT[]
Definition: Values.h:55
FIX::SessionState::onIncoming
void onIncoming(const std::string &string)
Definition: SessionState.h:234
FIX::BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME_TEXT
const char BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME_TEXT[]
Definition: Values.h:77
FIX::SessionState::logoutTimeout
int logoutTimeout() const
Definition: SessionState.h:108
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:131
FIX::Message::isAdminMsgType
static bool isAdminMsgType(const MsgType &msgType)
Definition: Message.h:317
FIX::DataDictionary::validate
static void validate(const Message &message, const DataDictionary *const pSessionDD, const DataDictionary *const pAppID)
Validate a message.
Definition: DataDictionary.cpp:123
FIX::SessionState::logoutReason
std::string logoutReason() const
Definition: SessionState.h:184
FIX::Session::isLoggedOn
bool isLoggedOn()
Definition: Session.h:99
FIX::SessionState::lastReceivedTime
void lastReceivedTime(const UtcTimeStamp &value)
Definition: SessionState.h:142
FIX::Session::addSession
static bool addSession(Session &)
Definition: Session.cpp:1576
FIX::Session::setPersistMessages
void setPersistMessages(bool value)
Definition: Session.h:236
FIX::Session::isCorrectCompID
bool isCorrectCompID(const SenderCompID &senderCompID, const TargetCompID &targetCompID)
Definition: Session.h:298
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:87
FIX::SessionState::shouldSendLogon
bool shouldSendLogon() const
Definition: SessionState.h:149
FIX::Session::getHeartBtInt
const HeartBtInt & getHeartBtInt() const
Definition: Session.h:264
FIX::Session::m_application
Application & m_application
Definition: Session.h:352
FIX::Session::isInitiator
bool isInitiator()
Definition: Session.h:146
reverse
void reverse(I begin, I end)
Definition: pugixml.cpp:6009
FIX::Session::getExpectedSenderNum
int getExpectedSenderNum()
Definition: Session.h:258
FIX::SessionState::resendRequested
bool resendRequested() const
Definition: SessionState.h:114
FIX::Session::isEnabled
bool isEnabled()
Definition: Session.h:93
FIX::Session::doTargetTooHigh
void doTargetTooHigh(const Message &msg)
Definition: Session.cpp:1223
FIX::Application::onCreate
virtual void onCreate(const SessionID &)=0
Notification of a session begin created.
FIX::TimeRange::isInRange
static bool isInRange(const UtcTimeOnly &start, const UtcTimeOnly &end, const DateTime &time)
Definition: TimeRange.h:77
FIX::SessionState::store
MessageStore * store()
Definition: SessionState.h:123
FIX::Session::nextSequenceReset
void nextSequenceReset(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:336
FIX::Session::isTargetTooHigh
bool isTargetTooHigh(const MsgSeqNum &msgSeqNum)
Definition: Session.h:294
FIX::Session::nextResendRequest
void nextResendRequest(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:361
FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM_TEXT
const char SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM_TEXT[]
Definition: Values.h:65
FIX::Session::shouldSendReset
bool shouldSendReset()
Definition: Session.cpp:1123
FIX::SessionState::logoutTimedOut
bool logoutTimedOut() const
Definition: SessionState.h:156
FIX::Session::generateHeartbeat
void generateHeartbeat()
Definition: Session.cpp:781
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:630
FIX::Session::nextHeartbeat
void nextHeartbeat(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:297
FIX::Session::setResetOnLogon
void setResetOnLogon(bool value)
Definition: Session.h:198
FIELD_GET_PTR
#define FIELD_GET_PTR(MAP, FLD)
Definition: FieldMap.h:374
FIX::SessionRejectReason_INVALID_MSGTYPE_TEXT
const char SessionRejectReason_INVALID_MSGTYPE_TEXT[]
Definition: Values.h:66
FIX::Session::m_logonTime
TimeRange m_logonTime
Definition: Session.h:355
FIX::SessionState::sentReset
bool sentReset() const
Definition: SessionState.h:99
FIX::Session::~Session
virtual ~Session()
Definition: Session.cpp:100
FIX::Session::logon
void logon()
Definition: Session.h:89
FIX::SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER_TEXT
const char SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER_TEXT[]
Definition: Values.h:68
FIX::Session::sendToTarget
static bool sendToTarget(Message &message, const std::string &qualifier="")
Definition: Session.cpp:1461
FIX::Session::setMillisecondsInTimeStamp
void setMillisecondsInTimeStamp(bool value)
Definition: Session.h:218
FIX::identifyType
MsgType identifyType(const std::string &message)
Parse the type of a message from a string.
Definition: Message.h:434
FIX::Application::onLogon
virtual void onLogon(const SessionID &)=0
Notification of a session successfully logging on.
FIX::Session::m_pResponder
Responder * m_pResponder
Definition: Session.h:375
FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT
const char SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT[]
Definition: Values.h:59
FIX::SessionState::needHeartbeat
bool needHeartbeat() const
Definition: SessionState.h:172
FIX::Session::logout
void logout(const std::string &reason="")
Definition: Session.h:91
FIX::Application::fromApp
virtual void fromApp(const Message &, const SessionID &)=0
Notification of app message being received from target.
FIX::Session::persist
void persist(const Message &, const std::string &)
Definition: Session.cpp:680
FIX::Session::nextTestRequest
void nextTestRequest(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:304
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:238
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:372
FIX::Session::m_mutex
Mutex m_mutex
Definition: Session.h:376
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:381
FIX::Session::m_validateLengthAndChecksum
bool m_validateLengthAndChecksum
Definition: Session.h:369
FIX::BusinessRejectReason_UNKNOWN_SECURITY_TEXT
const char BusinessRejectReason_UNKNOWN_SECURITY_TEXT[]
Definition: Values.h:72
FIX::LogFactory::create
virtual Log * create()=0
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:1013
FIX::Session::getStore
const MessageStore * getStore()
Definition: Session.h:262
FIX::Session::insertSendingTime
void insertSendingTime(Header &)
Definition: Session.cpp:108
FIX::BusinessRejectReason_APPLICATION_NOT_AVAILABLE_TEXT
const char BusinessRejectReason_APPLICATION_NOT_AVAILABLE_TEXT[]
Definition: Values.h:74
FIELD_GET_REF
#define FIELD_GET_REF(MAP, FLD)
Definition: FieldMap.h:376
FIX::Session::resend
bool resend(Message &message)
Definition: Session.cpp:660
FIX::SessionState::set
bool set(int s, const std::string &m)
Definition: SessionState.h:206
FIX::SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE_TEXT
const char SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE_TEXT[]
Definition: Values.h:61
FIX::Session::setRefreshOnLogon
void setRefreshOnLogon(bool value)
Definition: Session.h:213
FIX::Session::nextLogout
void nextLogout(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:312
FIX::Session::m_refreshOnLogon
bool m_refreshOnLogon
Definition: Session.h:366
FIX::SessionState::incrNextSenderMsgSeqNum
void incrNextSenderMsgSeqNum()
Definition: SessionState.h:219
FIX::Application::toApp
virtual void toApp(Message &, const SessionID &)=0
Notification of app message being sent to target.
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:221
FIX::Session::m_pLogFactory
LogFactory * m_pLogFactory
Definition: Session.h:374
FIX::SessionState::resendRange
ResendRange resendRange() const
Definition: SessionState.h:119
FIX::SessionState::logonTimedOut
bool logonTimedOut() const
Definition: SessionState.h:151
FIX::Session::m_resetOnDisconnect
bool m_resetOnDisconnect
Definition: Session.h:365
FIX::Session::setLogonTimeout
void setLogonTimeout(int value)
Definition: Session.h:188
FIX::SessionState::lastSentTime
void lastSentTime(const UtcTimeStamp &value)
Definition: SessionState.h:135
FIX::Application::fromAdmin
virtual void fromAdmin(const Message &, const SessionID &)=0
Notification of admin message being received from target.
FIX::Session::send
bool send(Message &)
Definition: Session.cpp:540
FIX::Session::insertOrigSendingTime
void insertOrigSendingTime(Header &, const UtcTimeStamp &when=UtcTimeStamp())
Definition: Session.cpp:120
FIX::SessionState::heartBtInt
void heartBtInt(const HeartBtInt &value)
Definition: SessionState.h:128
FIX::Session::newMessage
Message * newMessage(const std::string &msgType) const
Definition: Session.cpp:509
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1255