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

## 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
bool | m_millisecondsInTimeStamp
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 45 of file Session.h.

## Member Typedef Documentation

## SessionIDs

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

private

Definition at line 221 of file Session.h.

## Sessions

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

private

Definition at line 220 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 41 of file Session.cpp.

References addSession(), checkSessionTime(), FIX::MessageStoreFactory::create(), FIX::LogFactory::create(), FIX::SessionState::heartBtInt(), FIX::SessionState::initiate(), FIX::SessionState::log(), m_application, m_messageStoreFactory, m_pLogFactory, m_sessionID, m_state, FIX::Application::onCreate(), FIX::SessionState::onEvent(), reset(), FIX::SessionState::store(), and FIX::TYPE::UtcTimeStamp.

: 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" );
}
FIX::MessageStoreFactory::create
virtual MessageStore * create(const SessionID &)=0
FIX::Application::onCreate
virtual void onCreate(const SessionID &)=0
Notification of a session begin created.
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:323
FIX::LogFactory::create
virtual Log * create()=0
FIX::Session::m_messageStoreFactory
MessageStoreFactory & m_messageStoreFactory
Definition: Session.h:324
FIX::Session::addSession
static bool addSession(Session &)
Definition: Session.cpp:1466
FIX::Session::m_checkLatency
bool m_checkLatency
Definition: Session.h:312
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::Session::reset
void reset()
Definition: Session.h:66
FIX::SessionState::log
Log * log()
Definition: SessionState.h:91
FIX::SessionState::initiate
bool initiate() const
Definition: SessionState.h:68
FIX::Session::m_checkCompId
bool m_checkCompId
Definition: Session.h:311
FIX::Session::m_maxLatency
int m_maxLatency
Definition: Session.h:313
FIX::Session::m_application
Application & m_application
Definition: Session.h:303
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:314
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308
FIX::Session::m_pLogFactory
LogFactory * m_pLogFactory
Definition: Session.h:325
FIX::Session::m_millisecondsInTimeStamp
bool m_millisecondsInTimeStamp
Definition: Session.h:318
FIX::Session::m_logonTime
TimeRange m_logonTime
Definition: Session.h:306
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::Session::m_targetDefaultApplVerID
std::string m_targetDefaultApplVerID
Definition: Session.h:309
FIX::Session::m_validateLengthAndChecksum
bool m_validateLengthAndChecksum
Definition: Session.h:320
FIX::Session::checkSessionTime
bool checkSessionTime(const UtcTimeStamp &timeStamp)
Definition: Session.h:242
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674
FIX::Session::m_resetOnDisconnect
bool m_resetOnDisconnect
Definition: Session.h:316
FIX::Session::m_sessionTime
TimeRange m_sessionTime
Definition: Session.h:305
FIX::Session::m_persistMessages
bool m_persistMessages
Definition: Session.h:319
FIX::Session::m_sendRedundantResendRequests
bool m_sendRedundantResendRequests
Definition: Session.h:310
FIX::Session::m_pResponder
Responder * m_pResponder
Definition: Session.h:326
FIX::Session::m_resetOnLogout
bool m_resetOnLogout
Definition: Session.h:315
FIX::SessionState::store
MessageStore * store()
Definition: SessionState.h:89
FIX::Session::m_refreshOnLogon
bool m_refreshOnLogon
Definition: Session.h:317
FIX::SessionState::heartBtInt
void heartBtInt(const HeartBtInt &value)
Definition: SessionState.h:94
FIX::ApplVerID_FIX50
const char ApplVerID_FIX50[]
Definition: FixValues.h:810

## ~Session()

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

virtual

Definition at line 83 of file Session.cpp.

References FIX::MessageStoreFactory::destroy(), FIX::LogFactory::destroy(), FIX::SessionState::log(), m_messageStoreFactory, m_pLogFactory, m_state, removeSession(), and FIX::SessionState::store().

{
removeSession( *this );
m_messageStoreFactory.destroy( m_state.store() );
if ( m_pLogFactory && m_state.log() )
m_pLogFactory->destroy( m_state.log() );
}
FIX::Session::m_messageStoreFactory
MessageStoreFactory & m_messageStoreFactory
Definition: Session.h:324
FIX::LogFactory::destroy
virtual void destroy(Log *)=0
FIX::SessionState::log
Log * log()
Definition: SessionState.h:91
FIX::Session::m_pLogFactory
LogFactory * m_pLogFactory
Definition: Session.h:325
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::MessageStoreFactory::destroy
virtual void destroy(MessageStore *)=0
FIX::Session::removeSession
static void removeSession(Session &)
Definition: Session.cpp:1480
FIX::SessionState::store
MessageStore * store()
Definition: SessionState.h:89

## Member Function Documentation

## addSession()

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

static private

Definition at line 1466 of file Session.cpp.

References m_sessionID, s_mutex, s_sessionIDs, and s_sessions.

Referenced by Session().

{
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;
}
FIX::Session::s_sessions
static Sessions s_sessions
Definition: Session.h:329
FIX::Session::s_sessionIDs
static SessionIDs s_sessionIDs
Definition: Session.h:330
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332

## checkSessionTime()

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

inline private

Definition at line 242 of file Session.h.

References FIX::SessionState::getCreationTime(), FIX::TimeRange::isInSameRange(), m_sessionTime, and m_state.

Referenced by next(), Session(), and setResponder().

{
UtcTimeStamp creationTime = m_state.getCreationTime();
return m_sessionTime.isInSameRange( timeStamp, creationTime );
}
FIX::SessionState::getCreationTime
UtcTimeStamp getCreationTime() const
Definition: SessionState.h:189
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674
FIX::Session::m_sessionTime
TimeRange m_sessionTime
Definition: Session.h:305
FIX::TimeRange::isInSameRange
static bool isInSameRange(const UtcTimeOnly &start, const UtcTimeOnly &end, const DateTime &time1, const DateTime &time2)
Definition: TimeRange.h:76

## disconnect()

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

Definition at line 542 of file Session.cpp.

References FIX::SessionState::clearQueue(), FIX::Responder::disconnect(), FIX::SessionState::logoutReason(), m_application, m_mutex, m_pResponder, m_resetOnDisconnect, m_sessionID, m_state, FIX::SessionState::onEvent(), FIX::Application::onLogout(), FIX::SessionState::receivedLogon(), FIX::SessionState::receivedReset(), FIX::SessionState::resendRange(), FIX::SessionState::reset(), FIX::SessionState::sentLogon(), FIX::SessionState::sentLogout(), and FIX::SessionState::sentReset().

Referenced by next(), nextLogon(), nextLogout(), FIX::SocketInitiator::onDisconnect(), FIX::SocketAcceptor::onDisconnect(), FIX::ThreadedSocketConnection::read(), reset(), setResponder(), and verify().

{
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 );
}
FIX::Application::onLogout
virtual void onLogout(const SessionID &)=0
Notification of a session logging off or disconnecting.
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionState::receivedReset
bool receivedReset() const
Definition: SessionState.h:62
FIX::SessionState::sentReset
bool sentReset() const
Definition: SessionState.h:65
FIX::Session::m_application
Application & m_application
Definition: Session.h:303
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::reset
void reset()
Definition: SessionState.h:191
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:53
FIX::SessionState::resendRange
ResendRange resendRange() const
Definition: SessionState.h:85
FIX::SessionState::logoutReason
std::string logoutReason() const
Definition: SessionState.h:150
FIX::SessionState::sentLogon
bool sentLogon() const
Definition: SessionState.h:59
FIX::SessionState::clearQueue
void clearQueue()
Definition: SessionState.h:169
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Responder::disconnect
virtual void disconnect()=0
FIX::Session::m_mutex
Mutex m_mutex
Definition: Session.h:327
FIX::Session::m_resetOnDisconnect
bool m_resetOnDisconnect
Definition: Session.h:316
FIX::Session::m_pResponder
Responder * m_pResponder
Definition: Session.h:326
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:56

## doBadCompID()

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

private

Definition at line 1059 of file Session.cpp.

References generateLogout(), generateReject(), and FIX::SessionRejectReason_COMPID_PROBLEM.

Referenced by isCorrectCompID(), and verify().

{
generateReject( msg, SessionRejectReason_COMPID_PROBLEM );
generateLogout();
}
FIX::Session::generateReject
void generateReject(const Message &, int err, int field=0)
Definition: Session.cpp:720
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905
FIX::SessionRejectReason_COMPID_PROBLEM
const int SessionRejectReason_COMPID_PROBLEM
Definition: FixValues.h:1864

## doBadTime()

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

private

Definition at line 1053 of file Session.cpp.

References generateLogout(), generateReject(), and FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM.

Referenced by isCorrectCompID(), and verify().

{
generateReject( msg, SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM );
generateLogout();
}
FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
const int SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
Definition: FixValues.h:1881
FIX::Session::generateReject
void generateReject(const Message &, int err, int field=0)
Definition: Session.cpp:720
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905

## doesSessionExist()

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

static

Definition at line 1397 of file Session.cpp.

References s_mutex, and s_sessions.

Referenced by getDataDictionaryProvider().

{
Locker locker( s_mutex );
return s_sessions.end() != s_sessions.find( sessionID );
}
FIX::Session::s_sessions
static Sessions s_sessions
Definition: Session.h:329
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332

## doPossDup()

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

private

Definition at line 1065 of file Session.cpp.

References generateLogout(), generateReject(), FIX::FieldMap::getField(), FIX::FieldMap::getFieldIfSet(), FIX::Message::getHeader(), FIX::FIELD::MsgType, FIX::MsgType_SequenceReset, FIX::FIELD::OrigSendingTime, FIX::FIELD::SendingTime, FIX::SessionRejectReason_REQUIRED_TAG_MISSING, and FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM.

Referenced by doTargetTooLow(), and isCorrectCompID().

{
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;
}
FIX::FIELD::OrigSendingTime
const int OrigSendingTime
Definition: FixFieldNumbers.h:921
FIX::MsgType_SequenceReset
const char MsgType_SequenceReset[]
Definition: FixValues.h:646
FIX::FIELD::SendingTime
const int SendingTime
Definition: FixFieldNumbers.h:1447
FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
const int SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
Definition: FixValues.h:1881
FIX::Session::generateReject
void generateReject(const Message &, int err, int field=0)
Definition: Session.cpp:720
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905
FIX::SessionRejectReason_REQUIRED_TAG_MISSING
const int SessionRejectReason_REQUIRED_TAG_MISSING
Definition: FixValues.h:1871
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## doTargetTooHigh()

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

private

Definition at line 1113 of file Session.cpp.

References FIX::FIELD::BeginString, FIX::IntConvertor::convert(), generateResendRequest(), getExpectedTargetNum(), FIX::FieldMap::getField(), FIX::Message::getHeader(), m_sendRedundantResendRequests, m_state, FIX::FIELD::MsgSeqNum, FIX::SessionState::onEvent(), FIX::SessionState::queue(), FIX::SessionState::resendRange(), and FIX::SessionState::resendRequested().

Referenced by isCorrectCompID(), nextLogon(), and verify().

{
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 );
}
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::SessionState::ResendRange
std::pair< int, int > ResendRange
Definition: SessionState.h:83
FIX::Session::generateResendRequest
void generateResendRequest(const BeginString &, const MsgSeqNum &)
Definition: Session.cpp:643
FIX::SessionState::queue
void queue(int msgSeqNum, const Message &message)
Definition: SessionState.h:155
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::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::resendRange
ResendRange resendRange() const
Definition: SessionState.h:85
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::FIELD::BeginString
const int BeginString
Definition: FixFieldNumbers.h:499
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::Session::m_sendRedundantResendRequests
bool m_sendRedundantResendRequests
Definition: Session.h:310

## doTargetTooLow()

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

private

Definition at line 1093 of file Session.cpp.

References doPossDup(), generateLogout(), getExpectedTargetNum(), FIX::FieldMap::getField(), FIX::FieldMap::getFieldIfSet(), FIX::Message::getHeader(), FIX::FIELD::MsgSeqNum, and FIX::FIELD::PossDupFlag.

Referenced by isCorrectCompID(), and verify().

{
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 );
}
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905
FIX::FIELD::PossDupFlag
const int PossDupFlag
Definition: FixFieldNumbers.h:1284
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::Session::doPossDup
bool doPossDup(const Message &msg)
Definition: Session.cpp:1065

## fill()

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

private

Definition at line 114 of file Session.cpp.

References FIX::SessionID::getBeginString(), getExpectedSenderNum(), FIX::SessionID::getSenderCompID(), FIX::SessionID::getTargetCompID(), insertSendingTime(), FIX::SessionState::lastSentTime(), m_sessionID, m_state, FIX::FIELD::MsgSeqNum, and FIX::FieldMap::setField().

Referenced by generateBusinessReject(), generateHeartbeat(), generateLogon(), generateLogout(), generateReject(), generateResendRequest(), generateSequenceReset(), generateTestRequest(), and sendRaw().

{
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 );
}
FIX::Session::getExpectedSenderNum
int getExpectedSenderNum()
Definition: Session.h:211
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionID::getTargetCompID
const TargetCompID & getTargetCompID() const
Definition: SessionID.h:57
FIX::SessionState::lastSentTime
void lastSentTime(const UtcTimeStamp &value)
Definition: SessionState.h:101
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::Session::insertSendingTime
void insertSendingTime(Header &)
Definition: Session.cpp:91
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::SessionID::getSenderCompID
const SenderCompID & getSenderCompID() const
Definition: SessionID.h:55

## fromCallback()

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

private

Definition at line 1044 of file Session.cpp.

References FIX::Application::fromAdmin(), FIX::Application::fromApp(), FIX::Message::isAdminMsgType(), m_application, and m_sessionID.

Referenced by isCorrectCompID(), and verify().

{
if ( Message::isAdminMsgType( msgType ) )
m_application.fromAdmin( msg, m_sessionID );
else
m_application.fromApp( msg, m_sessionID );
}
FIX::Message::isAdminMsgType
static bool isAdminMsgType(const MsgType &msgType)
Definition: Message.h:250
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::Application::fromApp
virtual void fromApp(const Message &, const SessionID &)=0
Notification of app message being received from target.
FIX::Application::fromAdmin
virtual void fromAdmin(const Message &, const SessionID &)=0
Notification of admin message being received from target.
FIX::Session::m_application
Application & m_application
Definition: Session.h:303

## generateBusinessReject()

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

private

Definition at line 842 of file Session.cpp.

References FIX::FIELD::BusinessRejectReason, FIX::BusinessRejectReason_APPLICATION_NOT_AVAILABLE, FIX::BusinessRejectReason_APPLICATION_NOT_AVAILABLE_TEXT, FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING, FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT, FIX::BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME, FIX::BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME_TEXT, FIX::BusinessRejectReason_NOT_AUTHORIZED, FIX::BusinessRejectReason_NOT_AUTHORIZED_TEXT, FIX::BusinessRejectReason_OTHER, FIX::BusinessRejectReason_OTHER_TEXT, FIX::BusinessRejectReason_UNKNOWN_ID, FIX::BusinessRejectReason_UNKNOWN_ID_TEXT, FIX::BusinessRejectReason_UNKNOWN_MESSAGE_TYPE, FIX::BusinessRejectReason_UNKNOWN_SECURITY, FIX::BusinessRejectReason_UNKNOWN_SECURITY_TEXT, FIX::BusinessRejectReason_UNSUPPORTED_MESSAGE_TYPE_TEXT, FIX::IntConvertor::convert(), FIX::FIELD::DefaultApplVerID, fill(), FIX::FieldMap::getField(), FIX::Message::getHeader(), FIX::SessionState::incrNextTargetMsgSeqNum(), FIX::SessionID::isFIXT(), m_senderDefaultApplVerID, m_sessionID, m_state, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, FIX::MsgType_BusinessMessageReject, FIX::SessionState::onEvent(), populateRejectReason(), FIX::FIELD::RefMsgType, FIX::FIELD::RefSeqNum, sendRaw(), and FIX::FieldMap::setField().

Referenced by isCorrectCompID(), and next().

{
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 );
}
FIX::BusinessRejectReason_UNKNOWN_ID
const int BusinessRejectReason_UNKNOWN_ID
Definition: FixValues.h:3271
FIX::Session::populateRejectReason
void populateRejectReason(Message &, int field, const std::string &)
Definition: Session.cpp:916
FIX::FIELD::RefMsgType
const int RefMsgType
Definition: FixFieldNumbers.h:602
FIX::BusinessRejectReason_OTHER
const int BusinessRejectReason_OTHER
Definition: FixValues.h:3272
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::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::BusinessRejectReason_NOT_AUTHORIZED
const int BusinessRejectReason_NOT_AUTHORIZED
Definition: FixValues.h:3275
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT
const char BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING_TEXT[]
Definition: Values.h:58
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:154
FIX::BusinessRejectReason_UNKNOWN_MESSAGE_TYPE
const int BusinessRejectReason_UNKNOWN_MESSAGE_TYPE
Definition: FixValues.h:3274
FIX::BusinessRejectReason_UNKNOWN_ID_TEXT
const char BusinessRejectReason_UNKNOWN_ID_TEXT[]
Definition: Values.h:54
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::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::BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME
const int BusinessRejectReason_DELIVERTO_FIRM_NOT_AVAILABLE_AT_THIS_TIME
Definition: FixValues.h:3269
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::BusinessRejectReason_OTHER_TEXT
const char BusinessRejectReason_OTHER_TEXT[]
Definition: Values.h:53
FIX::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:61
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::MsgType_BusinessMessageReject
const char MsgType_BusinessMessageReject[]
Definition: FixValues.h:626
FIX::FIELD::DefaultApplVerID
const int DefaultApplVerID
Definition: FixFieldNumbers.h:1171
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::FIELD::RefSeqNum
const int RefSeqNum
Definition: FixFieldNumbers.h:111
FIX::BusinessRejectReason_UNKNOWN_SECURITY_TEXT
const char BusinessRejectReason_UNKNOWN_SECURITY_TEXT[]
Definition: Values.h:55
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::FIELD::BusinessRejectReason
const int BusinessRejectReason
Definition: FixFieldNumbers.h:1526
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## generateHeartbeat() [1/2]

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

private

Definition at line 685 of file Session.cpp.

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

Referenced by isCorrectCompID(), next(), and nextTestRequest().

{
Message heartbeat;
heartbeat.getHeader().setField( MsgType( "0" ) );
fill( heartbeat.getHeader() );
sendRaw( heartbeat );
}
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## generateHeartbeat() [2/2]

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

private

Definition at line 693 of file Session.cpp.

References fill(), FIX::FieldMap::getField(), FIX::Message::getHeader(), FIX::FIELD::MsgType, sendRaw(), FIX::FieldMap::setField(), and FIX::FIELD::TestReqID.

{
Message heartbeat;
heartbeat.getHeader().setField( MsgType( "0" ) );
fill( heartbeat.getHeader() );
try
{
TestReqID testReqID;
testRequest.getField( testReqID );
heartbeat.setField( testReqID );
}
catch ( FieldNotFound& ) {}
sendRaw( heartbeat );
}
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::TestReqID
const int TestReqID
Definition: FixFieldNumbers.h:1484
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## generateLogon() [1/2]

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

private

Definition at line 602 of file Session.cpp.

References FIX::FIELD::DefaultApplVerID, FIX::FIELD::EncryptMethod, fill(), FIX::Message::getHeader(), FIX::SessionState::heartBtInt(), FIX::SessionID::isFIXT(), FIX::SessionState::lastReceivedTime(), logon(), m_refreshOnLogon, m_resetOnLogon, m_senderDefaultApplVerID, m_sessionID, m_state, FIX::FIELD::MsgType, refresh(), FIX::SessionState::reset(), FIX::FIELD::ResetSeqNumFlag, sendRaw(), FIX::SessionState::sentLogon(), FIX::FieldMap::setField(), shouldSendReset(), and FIX::SessionState::testRequest().

Referenced by isCorrectCompID(), next(), and nextLogon().

{
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 );
}
FIX::SessionState::lastReceivedTime
void lastReceivedTime(const UtcTimeStamp &value)
Definition: SessionState.h:108
FIX::SessionState::testRequest
int testRequest() const
Definition: SessionState.h:77
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::Session::refresh
void refresh()
Definition: Session.h:68
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:314
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308
FIX::FIELD::EncryptMethod
const int EncryptMethod
Definition: FixFieldNumbers.h:155
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::reset
void reset()
Definition: SessionState.h:191
FIX::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:61
FIX::Session::shouldSendReset
bool shouldSendReset()
Definition: Session.cpp:1013
FIX::SessionState::sentLogon
bool sentLogon() const
Definition: SessionState.h:59
FIX::FIELD::DefaultApplVerID
const int DefaultApplVerID
Definition: FixFieldNumbers.h:1171
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::ResetSeqNumFlag
const int ResetSeqNumFlag
Definition: FixFieldNumbers.h:163
FIX::Session::m_refreshOnLogon
bool m_refreshOnLogon
Definition: Session.h:317
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363
FIX::SessionState::heartBtInt
void heartBtInt(const HeartBtInt &value)
Definition: SessionState.h:94
FIX::Session::logon
void logon()
Definition: Session.h:55

## generateLogon() [2/2]

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

private

Definition at line 625 of file Session.cpp.

References FIX::FIELD::DefaultApplVerID, FIX::FIELD::EncryptMethod, fill(), FIX::FieldMap::getField(), FIX::Message::getHeader(), FIX::FIELD::HeartBtInt, FIX::SessionID::isFIXT(), logon(), m_senderDefaultApplVerID, m_sessionID, m_state, FIX::FIELD::MsgType, FIX::SessionState::receivedReset(), FIX::FIELD::ResetSeqNumFlag, sendRaw(), FIX::SessionState::sentLogon(), and FIX::FieldMap::setField().

{
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 );
}
FIX::FIELD::HeartBtInt
const int HeartBtInt
Definition: FixFieldNumbers.h:240
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionState::receivedReset
bool receivedReset() const
Definition: SessionState.h:62
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308
FIX::FIELD::EncryptMethod
const int EncryptMethod
Definition: FixFieldNumbers.h:155
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:61
FIX::SessionState::sentLogon
bool sentLogon() const
Definition: SessionState.h:59
FIX::FIELD::DefaultApplVerID
const int DefaultApplVerID
Definition: FixFieldNumbers.h:1171
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::ResetSeqNumFlag
const int ResetSeqNumFlag
Definition: FixFieldNumbers.h:163
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363
FIX::Session::logon
void logon()
Definition: Session.h:55

## generateLogout()

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

private

Definition at line 905 of file Session.cpp.

References fill(), FIX::Message::getHeader(), logout(), m_state, FIX::FIELD::MsgType, FIX::MsgType_Logout, sendRaw(), FIX::SessionState::sentLogout(), FIX::FieldMap::setField(), and FIX::FIELD::Text.

Referenced by doBadCompID(), doBadTime(), doPossDup(), doTargetTooLow(), isCorrectCompID(), next(), nextLogout(), and reset().

{
Message logout;
logout.getHeader().setField( MsgType( MsgType_Logout ) );
fill( logout.getHeader() );
if ( text.length() )
logout.setField( Text( text ) );
sendRaw( logout );
m_state.sentLogout( true );
}
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::FIELD::Text
const int Text
Definition: FixFieldNumbers.h:256
FIX::Session::logout
void logout(const std::string &reason="")
Definition: Session.h:57
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::MsgType_Logout
const char MsgType_Logout[]
Definition: FixValues.h:622
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:56
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## generateReject() [1/2]

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

private

Definition at line 720 of file Session.cpp.

References FIX::BeginString_FIX42, FIX::IntConvertor::convert(), fill(), FIX::SessionID::getBeginString(), getExpectedTargetNum(), FIX::FieldMap::getField(), FIX::FieldMap::getFieldIfSet(), FIX::Message::getHeader(), FIX::SessionState::incrNextTargetMsgSeqNum(), m_sessionID, m_state, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, FIX::MsgType_Logon, FIX::MsgType_SequenceReset, FIX::SessionState::onEvent(), populateRejectReason(), FIX::SessionState::receivedLogon(), FIX::FIELD::RefMsgType, FIX::FIELD::RefSeqNum, FIX::Message::reverseRoute(), sendRaw(), FIX::FIELD::SessionRejectReason, FIX::SessionRejectReason_COMPID_PROBLEM, FIX::SessionRejectReason_COMPID_PROBLEM_TEXT, FIX::SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE, FIX::SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE_TEXT, FIX::SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP, FIX::SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP_TEXT, FIX::SessionRejectReason_INVALID_MSGTYPE, FIX::SessionRejectReason_INVALID_MSGTYPE_TEXT, FIX::SessionRejectReason_INVALID_TAG_NUMBER, FIX::SessionRejectReason_INVALID_TAG_NUMBER_TEXT, FIX::SessionRejectReason_REQUIRED_TAG_MISSING, FIX::SessionRejectReason_REQUIRED_TAG_MISSING_TEXT, FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM, FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM_TEXT, FIX::SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE, FIX::SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE_TEXT, FIX::SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE, FIX::SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE_TEXT, FIX::SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER, FIX::SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER_TEXT, FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE, FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT, FIX::SessionRejectReason_VALUE_IS_INCORRECT, FIX::SessionRejectReason_VALUE_IS_INCORRECT_TEXT, and FIX::FieldMap::setField().

Referenced by doBadCompID(), doBadTime(), doPossDup(), isCorrectCompID(), next(), and nextSequenceReset().

{
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 );
}
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::SessionRejectReason_COMPID_PROBLEM_TEXT
const char SessionRejectReason_COMPID_PROBLEM_TEXT[]
Definition: Values.h:47
FIX::Session::populateRejectReason
void populateRejectReason(Message &, int field, const std::string &)
Definition: Session.cpp:916
FIX::FIELD::RefMsgType
const int RefMsgType
Definition: FixFieldNumbers.h:602
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
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::SessionRejectReason_INVALID_TAG_NUMBER_TEXT
const char SessionRejectReason_INVALID_TAG_NUMBER_TEXT[]
Definition: Values.h:38
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
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::SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER
const int SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER
Definition: FixValues.h:1875
FIX::SessionRejectReason_VALUE_IS_INCORRECT_TEXT
const char SessionRejectReason_VALUE_IS_INCORRECT_TEXT[]
Definition: Values.h:43
FIX::MsgType_SequenceReset
const char MsgType_SequenceReset[]
Definition: FixValues.h:646
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:154
FIX::SessionRejectReason_INVALID_MSGTYPE
const int SessionRejectReason_INVALID_MSGTYPE
Definition: FixValues.h:1880
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::SessionRejectReason_INVALID_MSGTYPE_TEXT
const char SessionRejectReason_INVALID_MSGTYPE_TEXT[]
Definition: Values.h:49
FIX::SessionRejectReason_REQUIRED_TAG_MISSING_TEXT
const char SessionRejectReason_REQUIRED_TAG_MISSING_TEXT[]
Definition: Values.h:39
FIX::SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
const int SessionRejectReason_SENDINGTIME_ACCURACY_PROBLEM
Definition: FixValues.h:1881
FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT
const char SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE_TEXT[]
Definition: Values.h:42
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::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:53
FIX::SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE
const int SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE
Definition: FixValues.h:1869
FIX::SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE
const int SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE
Definition: FixValues.h:1866
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::MsgType_Logon
const char MsgType_Logon[]
Definition: FixValues.h:614
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::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::SessionRejectReason_COMPID_PROBLEM
const int SessionRejectReason_COMPID_PROBLEM
Definition: FixValues.h:1864
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
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::SessionRejectReason_INVALID_TAG_NUMBER
const int SessionRejectReason_INVALID_TAG_NUMBER
Definition: FixValues.h:1877
FIX::FIELD::RefSeqNum
const int RefSeqNum
Definition: FixFieldNumbers.h:111
FIX::SessionRejectReason_REQUIRED_TAG_MISSING
const int SessionRejectReason_REQUIRED_TAG_MISSING
Definition: FixValues.h:1871
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363
FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE
const int SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE
Definition: FixValues.h:1879
FIX::SessionRejectReason_VALUE_IS_INCORRECT
const int SessionRejectReason_VALUE_IS_INCORRECT
Definition: FixValues.h:1878

## generateReject() [2/2]

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

private

Definition at line 815 of file Session.cpp.

References FIX::BeginString_FIX42, fill(), FIX::SessionID::getBeginString(), FIX::FieldMap::getField(), FIX::Message::getHeader(), FIX::SessionState::incrNextTargetMsgSeqNum(), m_sessionID, m_state, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, FIX::MsgType_Logon, FIX::MsgType_SequenceReset, FIX::SessionState::onEvent(), FIX::FIELD::RefMsgType, FIX::FIELD::RefSeqNum, FIX::Message::reverseRoute(), sendRaw(), FIX::FieldMap::setField(), and FIX::FIELD::Text.

{
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 );
}
FIX::FIELD::RefMsgType
const int RefMsgType
Definition: FixFieldNumbers.h:602
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::MsgType_SequenceReset
const char MsgType_SequenceReset[]
Definition: FixValues.h:646
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::FIELD::Text
const int Text
Definition: FixFieldNumbers.h:256
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::MsgType_Logon
const char MsgType_Logon[]
Definition: FixValues.h:614
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::FIELD::RefSeqNum
const int RefSeqNum
Definition: FixFieldNumbers.h:111
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## generateResendRequest()

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

private

Definition at line 643 of file Session.cpp.

References FIX::FIELD::BeginSeqNo, FIX::BeginString_FIX41, FIX::BeginString_FIX42, FIX::IntConvertor::convert(), FIX::FIELD::EndSeqNo, fill(), generateSequenceReset(), getExpectedTargetNum(), FIX::Message::getHeader(), m_state, FIX::FIELD::MsgType, FIX::SessionState::onEvent(), FIX::SessionState::resendRange(), sendRaw(), and FIX::FieldMap::setField().

Referenced by doTargetTooHigh(), and isCorrectCompID().

{
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 );
}
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::FIELD::BeginSeqNo
const int BeginSeqNo
Definition: FixFieldNumbers.h:610
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::FIELD::EndSeqNo
const int EndSeqNo
Definition: FixFieldNumbers.h:1198
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:154
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::resendRange
ResendRange resendRange() const
Definition: SessionState.h:85
FIX::BeginString_FIX41
const char BeginString_FIX41[]
Definition: Values.h:35
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## generateSequenceReset()

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

private

Definition at line 666 of file Session.cpp.

References FIX::IntConvertor::convert(), fill(), FIX::FIELD::GapFillFlag, FIX::FieldMap::getField(), FIX::Message::getHeader(), insertOrigSendingTime(), m_state, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, FIX::FIELD::NewSeqNo, FIX::SessionState::onEvent(), FIX::FIELD::PossDupFlag, FIX::FIELD::SendingTime, sendRaw(), and FIX::FieldMap::setField().

Referenced by generateResendRequest(), isCorrectCompID(), and nextResendRequest().

{
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 ) );
}
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
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::FIELD::SendingTime
const int SendingTime
Definition: FixFieldNumbers.h:1447
FIX::FIELD::GapFillFlag
const int GapFillFlag
Definition: FixFieldNumbers.h:1291
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::PossDupFlag
const int PossDupFlag
Definition: FixFieldNumbers.h:1284
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::Session::insertOrigSendingTime
void insertOrigSendingTime(Header &, const UtcTimeStamp &when=UtcTimeStamp())
Definition: Session.cpp:103
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## generateTestRequest()

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

private

Definition at line 709 of file Session.cpp.

References fill(), FIX::Message::getHeader(), FIX::FIELD::MsgType, sendRaw(), FIX::FieldMap::setField(), and FIX::FIELD::TestReqID.

Referenced by isCorrectCompID(), and next().

{
Message testRequest;
testRequest.getHeader().setField( MsgType( "1" ) );
fill( testRequest.getHeader() );
TestReqID testReqID( id );
testRequest.setField( testReqID );
sendRaw( testRequest );
}
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::TestReqID
const int TestReqID
Definition: FixFieldNumbers.h:1484
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## get()

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

private

## getCheckCompId()

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

inline

Definition at line 137 of file Session.h.

References m_checkCompId.

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

{ return m_checkCompId; }
FIX::Session::m_checkCompId
bool m_checkCompId
Definition: Session.h:311

## getCheckLatency()

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

inline

Definition at line 142 of file Session.h.

References m_checkLatency.

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

{ return m_checkLatency; }
FIX::Session::m_checkLatency
bool m_checkLatency
Definition: Session.h:312

## getDataDictionaryProvider()

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

inline

Definition at line 79 of file Session.h.

References doesSessionExist(), getSessions(), isSessionRegistered(), lookupSession(), m_dataDictionaryProvider, numSessions(), registerSession(), reverse(), FIX::FIELD::SenderCompID, sendToTarget(), FIX::FIELD::TargetCompID, and unregisterSession().

{ return m_dataDictionaryProvider; }
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:323

## getExpectedSenderNum()

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

inline

Definition at line 211 of file Session.h.

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

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

{ return m_state.getNextSenderMsgSeqNum(); }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::getNextSenderMsgSeqNum
int getNextSenderMsgSeqNum() const
Definition: SessionState.h:177

## getExpectedTargetNum()

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

inline

Definition at line 212 of file Session.h.

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

Referenced by doTargetTooHigh(), doTargetTooLow(), generateReject(), generateResendRequest(), nextQueued(), nextSequenceReset(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), and shouldSendReset().

{ return m_state.getNextTargetMsgSeqNum(); }
FIX::SessionState::getNextTargetMsgSeqNum
int getNextTargetMsgSeqNum() const
Definition: SessionState.h:179
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## getHeartBtInt()

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

inline

Definition at line 217 of file Session.h.

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

{ return m_state.heartBtInt(); }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::heartBtInt
void heartBtInt(const HeartBtInt &value)
Definition: SessionState.h:94

## getLog()

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

inline

Definition at line 214 of file Session.h.

References m_state.

Referenced by FIX::SocketInitiator::doConnect(), FIX::ThreadedSocketInitiator::doConnect(), FIX::SocketConnection::read(), and FIX::ThreadedSocketConnection::read().

{ return &m_state; }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## getLogonTime()

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

inline

Definition at line 117 of file Session.h.

References m_logonTime.

{ return m_logonTime; }
FIX::Session::m_logonTime
TimeRange m_logonTime
Definition: Session.h:306

## getLogonTimeout()

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

inline

Definition at line 152 of file Session.h.

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

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

{ return m_state.logonTimeout(); }
FIX::SessionState::logonTimeout
int logonTimeout() const
Definition: SessionState.h:71
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## getLogoutTimeout()

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

inline

Definition at line 157 of file Session.h.

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

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

{ return m_state.logoutTimeout(); }
FIX::SessionState::logoutTimeout
int logoutTimeout() const
Definition: SessionState.h:74
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## getMaxLatency()

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

inline

Definition at line 147 of file Session.h.

References m_maxLatency.

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

{ return m_maxLatency; }
FIX::Session::m_maxLatency
int m_maxLatency
Definition: Session.h:313

## getMillisecondsInTimeStamp()

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

inline

Definition at line 182 of file Session.h.

References m_millisecondsInTimeStamp.

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

{ return m_millisecondsInTimeStamp; }
FIX::Session::m_millisecondsInTimeStamp
bool m_millisecondsInTimeStamp
Definition: Session.h:318

## getPersistMessages()

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

inline

Definition at line 187 of file Session.h.

References m_persistMessages.

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

{ return m_persistMessages; }
FIX::Session::m_persistMessages
bool m_persistMessages
Definition: Session.h:319

## getRefreshOnLogon()

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

inline

Definition at line 177 of file Session.h.

References m_refreshOnLogon.

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

{ return m_refreshOnLogon; }
FIX::Session::m_refreshOnLogon
bool m_refreshOnLogon
Definition: Session.h:317

## getResetOnDisconnect()

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

inline

Definition at line 172 of file Session.h.

References m_resetOnDisconnect.

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

{ return m_resetOnDisconnect; }
FIX::Session::m_resetOnDisconnect
bool m_resetOnDisconnect
Definition: Session.h:316

## getResetOnLogon()

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

inline

Definition at line 162 of file Session.h.

References m_resetOnLogon.

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

{ return m_resetOnLogon; }
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:314

## getResetOnLogout()

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

inline

Definition at line 167 of file Session.h.

References m_resetOnLogout.

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

{ return m_resetOnLogout; }
FIX::Session::m_resetOnLogout
bool m_resetOnLogout
Definition: Session.h:315

## getSenderDefaultApplVerID()

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

inline

Definition at line 122 of file Session.h.

References m_senderDefaultApplVerID.

Referenced by FIX::MessageCracker::crack().

{ return m_senderDefaultApplVerID; }
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308

## getSendRedundantResendRequests()

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

inline

Definition at line 132 of file Session.h.

References m_sendRedundantResendRequests.

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

{ return m_sendRedundantResendRequests; }
FIX::Session::m_sendRedundantResendRequests
bool m_sendRedundantResendRequests
Definition: Session.h:310

## getSessionID()

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

inline

Definition at line 75 of file Session.h.

References m_sessionID.

Referenced by FIX::SocketConnection::isValidSession(), FIX::SocketInitiator::onConnect(), FIX::SocketInitiator::onDisconnect(), FIX::SocketConnection::read(), FIX::ThreadedSocketConnection::setSession(), FIX::ThreadedSocketInitiator::socketThread(), FIX::Initiator::stop(), FIX::Acceptor::stop(), FIX::SocketConnection::~SocketConnection(), and FIX::ThreadedSocketConnection::~ThreadedSocketConnection().

{ return m_sessionID; }
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304

## getSessions()

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

static

Definition at line 1392 of file Session.cpp.

References s_sessionIDs.

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

{
return s_sessionIDs;
}
FIX::Session::s_sessionIDs
static SessionIDs s_sessionIDs
Definition: Session.h:330

## getStore()

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

inline

Definition at line 215 of file Session.h.

References m_state.

{ return &m_state; }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## getTargetDefaultApplVerID()

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

inline

Definition at line 127 of file Session.h.

References m_targetDefaultApplVerID.

{ return m_targetDefaultApplVerID; }
FIX::Session::m_targetDefaultApplVerID
std::string m_targetDefaultApplVerID
Definition: Session.h:309

## getValidateLengthAndChecksum()

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

inline

Definition at line 192 of file Session.h.

References m_validateLengthAndChecksum.

{ return m_validateLengthAndChecksum; }
FIX::Session::m_validateLengthAndChecksum
bool m_validateLengthAndChecksum
Definition: Session.h:320

## insertOrigSendingTime()

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

private

Definition at line 103 of file Session.cpp.

References FIX::BeginString_FIX42, FIX::BeginString_FIXT11, FIX::SessionID::getBeginString(), m_millisecondsInTimeStamp, m_sessionID, FIX::FIELD::OrigSendingTime, and FIX::FieldMap::setField().

Referenced by generateSequenceReset(), and resend().

{
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) );
}
FIX::FIELD::OrigSendingTime
const int OrigSendingTime
Definition: FixFieldNumbers.h:921
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::BeginString_FIXT11
const char BeginString_FIXT11[]
Definition: Values.h:30
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::Session::m_millisecondsInTimeStamp
bool m_millisecondsInTimeStamp
Definition: Session.h:318
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53

## insertSendingTime()

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

private

Definition at line 91 of file Session.cpp.

References FIX::BeginString_FIX42, FIX::BeginString_FIXT11, FIX::SessionID::getBeginString(), m_millisecondsInTimeStamp, m_sessionID, FIX::FIELD::SendingTime, and FIX::FieldMap::setField().

Referenced by fill(), and resend().

{
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) );
}
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::BeginString_FIXT11
const char BeginString_FIXT11[]
Definition: Values.h:30
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::FIELD::SendingTime
const int SendingTime
Definition: FixFieldNumbers.h:1447
FIX::Session::m_millisecondsInTimeStamp
bool m_millisecondsInTimeStamp
Definition: Session.h:318
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674

## isAcceptor()

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

inline

Definition at line 114 of file Session.h.

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

{ return !m_state.initiate(); }
FIX::SessionState::initiate
bool initiate() const
Definition: SessionState.h:68
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## isCorrectCompID()

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

inline private

Definition at line 251 of file Session.h.

References FIX::FIELD::BeginString, doBadCompID(), doBadTime(), doPossDup(), doTargetTooHigh(), doTargetTooLow(), fromCallback(), generateBusinessReject(), generateHeartbeat(), generateLogon(), generateLogout(), generateReject(), generateResendRequest(), generateSequenceReset(), generateTestRequest(), FIX::SessionID::getSenderCompID(), FIX::SessionID::getTargetCompID(), m_checkCompId, m_sessionID, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, nextHeartbeat(), nextLogon(), nextLogout(), nextQueued(), nextReject(), nextResendRequest(), nextSequenceReset(), nextTestRequest(), populateRejectReason(), shouldSendReset(), validLogonState(), and verify().

Referenced by verify().

{
if( !m_checkCompId ) return true;
return
m_sessionID.getSenderCompID().getValue() == targetCompID.getValue()
&& m_sessionID.getTargetCompID().getValue() == senderCompID.getValue();
}
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionID::getTargetCompID
const TargetCompID & getTargetCompID() const
Definition: SessionID.h:57
FIX::Session::m_checkCompId
bool m_checkCompId
Definition: Session.h:311
FIX::SessionID::getSenderCompID
const SenderCompID & getSenderCompID() const
Definition: SessionID.h:55

## isEnabled()

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

inline

Definition at line 59 of file Session.h.

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

Referenced by FIX::Initiator::connect(), next(), nextLogon(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), FIX::Initiator::stop(), and FIX::Acceptor::stop().

{ return m_state.enabled(); }
FIX::SessionState::enabled
bool enabled() const
Definition: SessionState.h:50
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## isGoodTime()

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

inline private

Definition at line 236 of file Session.h.

References m_checkLatency, and m_maxLatency.

Referenced by verify().

{
if ( !m_checkLatency ) return true;
UtcTimeStamp now;
return labs( now - sendingTime ) <= m_maxLatency;
}
FIX::Session::m_checkLatency
bool m_checkLatency
Definition: Session.h:312
FIX::Session::m_maxLatency
int m_maxLatency
Definition: Session.h:313
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674

## isInitiator()

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

inline

Definition at line 112 of file Session.h.

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

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

{ return m_state.initiate(); }
FIX::SessionState::initiate
bool initiate() const
Definition: SessionState.h:68
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## isLoggedOn()

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

inline

Definition at line 65 of file Session.h.

References receivedLogon(), and sentLogon().

Referenced by FIX::Initiator::isLoggedOn(), next(), nextLogon(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), FIX::ThreadedSocketConnection::processStream(), FIX::SocketConnection::readMessages(), and sendRaw().

{ return receivedLogon() && sentLogon(); }
FIX::Session::sentLogon
bool sentLogon()
Definition: Session.h:62
FIX::Session::receivedLogon
bool receivedLogon()
Definition: Session.h:64

## isLogonTime()

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

inline

Definition at line 110 of file Session.h.

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

Referenced by next(), and nextLogon().

{ return m_logonTime.isInRange(time); }
FIX::TimeRange::isInRange
static bool isInRange(const UtcTimeOnly &start, const UtcTimeOnly &end, const DateTime &time)
Definition: TimeRange.h:43
FIX::Session::m_logonTime
TimeRange m_logonTime
Definition: Session.h:306

## isSessionRegistered()

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

static

Definition at line 1438 of file Session.cpp.

References s_mutex, and s_registered.

Referenced by getDataDictionaryProvider(), FIX::SocketConnection::isValidSession(), registerSession(), and FIX::ThreadedSocketConnection::setSession().

{
Locker locker( s_mutex );
return s_registered.end() != s_registered.find( sessionID );
}
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332
FIX::Session::s_registered
static Sessions s_registered
Definition: Session.h:331

## isSessionTime()

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

inline

Definition at line 108 of file Session.h.

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

Referenced by FIX::Initiator::connect(), FIX::SocketInitiator::doConnect(), FIX::ThreadedSocketInitiator::doConnect(), FIX::HttpConnection::processRoot(), and FIX::HttpConnection::processSession().

{ return m_sessionTime.isInRange(time); }
FIX::TimeRange::isInRange
static bool isInRange(const UtcTimeOnly &start, const UtcTimeOnly &end, const DateTime &time)
Definition: TimeRange.h:43
FIX::Session::m_sessionTime
TimeRange m_sessionTime
Definition: Session.h:305

## isTargetTooHigh()

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

inline private

Definition at line 247 of file Session.h.

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

Referenced by nextLogon(), nextResendRequest(), and verify().

{ return msgSeqNum > ( m_state.getNextTargetMsgSeqNum() ); }
FIX::SessionState::getNextTargetMsgSeqNum
int getNextTargetMsgSeqNum() const
Definition: SessionState.h:179
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## isTargetTooLow()

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

inline private

Definition at line 249 of file Session.h.

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

Referenced by nextResendRequest(), and verify().

{ return msgSeqNum < ( m_state.getNextTargetMsgSeqNum() ); }
FIX::SessionState::getNextTargetMsgSeqNum
int getNextTargetMsgSeqNum() const
Definition: SessionState.h:179
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## logon()

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

inline

Definition at line 55 of file Session.h.

References FIX::SessionState::enabled(), FIX::SessionState::logoutReason(), and m_state.

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

{ m_state.enabled( true ); m_state.logoutReason( "" ); }
FIX::SessionState::enabled
bool enabled() const
Definition: SessionState.h:50
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::logoutReason
std::string logoutReason() const
Definition: SessionState.h:150

## logout()

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

inline

Definition at line 57 of file Session.h.

References FIX::SessionState::enabled(), FIX::SessionState::logoutReason(), and m_state.

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

{ m_state.enabled( false ); m_state.logoutReason( reason ); }
FIX::SessionState::enabled
bool enabled() const
Definition: SessionState.h:50
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::logoutReason
std::string logoutReason() const
Definition: SessionState.h:150

## lookupSession() [1/2]

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

static

Definition at line 1403 of file Session.cpp.

References s_mutex, and s_sessions.

Referenced by FIX::Initiator::connect(), FIX::MessageCracker::crack(), FIX::SocketInitiator::doConnect(), FIX::ThreadedSocketInitiator::doConnect(), getDataDictionaryProvider(), FIX::Initiator::isLoggedOn(), lookupSession(), FIX::HttpConnection::processDisableSessions(), FIX::HttpConnection::processEnableSessions(), FIX::HttpConnection::processRefreshSession(), FIX::HttpConnection::processRefreshSessions(), FIX::HttpConnection::processResetSession(), FIX::HttpConnection::processResetSessions(), FIX::HttpConnection::processRoot(), FIX::HttpConnection::processSession(), FIX::SocketConnection::read(), registerSession(), sendToTarget(), FIX::ThreadedSocketConnection::setSession(), FIX::ThreadedSocketInitiator::socketThread(), FIX::Initiator::stop(), and FIX::Acceptor::stop().

{
Locker locker( s_mutex );
Sessions::iterator find = s_sessions.find( sessionID );
if ( find != s_sessions.end() )
return find->second;
else
return 0;
}
FIX::Session::s_sessions
static Sessions s_sessions
Definition: Session.h:329
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332

## lookupSession() [2/2]

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

static

Definition at line 1413 of file Session.cpp.

References FIX::FIELD::BeginString, FIELD_GET_REF, FIX::Message::getHeader(), lookupSession(), FIX::FIELD::SenderCompID, FIX::Message::setStringHeader(), and FIX::FIELD::TargetCompID.

{
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; }
}
FIX::Session::lookupSession
static Session * lookupSession(const SessionID &)
Definition: Session.cpp:1403
reverse
void reverse(I begin, I end)
Definition: pugixml.cpp:6009
FIX::FIELD::TargetCompID
const int TargetCompID
Definition: FixFieldNumbers.h:217
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124
FIX::FIELD::BeginString
const int BeginString
Definition: FixFieldNumbers.h:499
FIELD_GET_REF
#define FIELD_GET_REF(MAP, FLD)
Definition: FieldMap.h:238

## next() [1/4]

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

Definition at line 125 of file Session.cpp.

References FIX::TYPE::UtcTimeStamp.

Referenced by next(), nextQueued(), nextResendRequest(), FIX::SocketConnection::onTimeout(), FIX::ThreadedSocketConnection::processStream(), FIX::ThreadedSocketConnection::read(), FIX::SocketConnection::read(), FIX::SocketConnection::readMessages(), setResponder(), and FIX::ThreadedSocketInitiator::socketThread().

{
next( UtcTimeStamp() );
}
FIX::Session::next
void next()
Definition: Session.cpp:125
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674

## next() [2/4]

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

Definition at line 130 of file Session.cpp.

References FIX::SessionState::alreadySentLogon(), checkSessionTime(), disconnect(), generateHeartbeat(), generateLogon(), generateLogout(), generateTestRequest(), FIX::SessionState::heartBtInt(), isEnabled(), isLoggedOn(), isLogonTime(), FIX::SessionState::logonTimedOut(), FIX::SessionState::logoutReason(), FIX::SessionState::logoutTimedOut(), m_state, FIX::SessionState::needHeartbeat(), FIX::SessionState::needTestRequest(), FIX::SessionState::onEvent(), FIX::SessionState::receivedLogon(), reset(), FIX::SessionState::sentLogout(), FIX::SessionState::shouldSendLogon(), FIX::SessionState::testRequest(), FIX::SessionState::timedOut(), and FIX::SessionState::withinHeartBeat().

{
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();
}
}
FIX::Session::isEnabled
bool isEnabled()
Definition: Session.h:59
FIX::Session::generateHeartbeat
void generateHeartbeat()
Definition: Session.cpp:685
FIX::SessionState::needHeartbeat
bool needHeartbeat() const
Definition: SessionState.h:138
FIX::SessionState::testRequest
int testRequest() const
Definition: SessionState.h:77
FIX::SessionState::needTestRequest
bool needTestRequest() const
Definition: SessionState.h:143
FIX::Session::reset
void reset()
Definition: Session.h:66
FIX::SessionState::shouldSendLogon
bool shouldSendLogon() const
Definition: SessionState.h:115
FIX::SessionState::timedOut
bool timedOut() const
Definition: SessionState.h:133
FIX::Session::isLogonTime
bool isLogonTime(const UtcTimeStamp &time)
Definition: Session.h:110
FIX::Session::generateLogon
void generateLogon()
Definition: Session.cpp:602
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
FIX::SessionState::withinHeartBeat
bool withinHeartBeat() const
Definition: SessionState.h:127
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:53
FIX::Session::checkSessionTime
bool checkSessionTime(const UtcTimeStamp &timeStamp)
Definition: Session.h:242
FIX::SessionState::logoutReason
std::string logoutReason() const
Definition: SessionState.h:150
FIX::SessionState::logonTimedOut
bool logonTimedOut() const
Definition: SessionState.h:117
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::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905
FIX::SessionState::logoutTimedOut
bool logoutTimedOut() const
Definition: SessionState.h:122
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:56
FIX::IOException
IO Error.
Definition: Exceptions.h:238
FIX::SessionState::heartBtInt
void heartBtInt(const HeartBtInt &value)
Definition: SessionState.h:94
FIX::SessionState::alreadySentLogon
bool alreadySentLogon() const
Definition: SessionState.h:116
FIX::Session::isLoggedOn
bool isLoggedOn()
Definition: Session.h:65

## next() [3/4]

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

Definition at line 1174 of file Session.cpp.

References disconnect(), FIX::DataDictionaryProvider::getApplicationDataDictionary(), FIX::SessionID::getBeginString(), FIX::DataDictionaryProvider::getSessionDataDictionary(), FIX::identifyType(), FIX::SessionID::isFIXT(), m_dataDictionaryProvider, m_senderDefaultApplVerID, m_sessionID, m_state, m_validateLengthAndChecksum, FIX::MsgType_Logon, next(), FIX::SessionState::onEvent(), and FIX::SessionState::onIncoming().

{
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;
}
}
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:323
FIX::Session::next
void next()
Definition: Session.cpp:125
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
FIX::DataDictionaryProvider::getSessionDataDictionary
const DataDictionary & getSessionDataDictionary(const BeginString &beginString) const
Definition: DataDictionaryProvider.cpp:38
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::Session::m_validateLengthAndChecksum
bool m_validateLengthAndChecksum
Definition: Session.h:320
FIX::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:61
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::SessionState::onIncoming
void onIncoming(const std::string &string)
Definition: SessionState.h:200
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::MsgType_Logon
const char MsgType_Logon[]
Definition: FixValues.h:614
FIX::identifyType
MsgType identifyType(const std::string &message)
Parse the type of a message from a string.
Definition: Message.h:355

## next() [4/4]

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

Definition at line 1208 of file Session.cpp.

References FIX::FIELD::ApplVerID, FIX::FIELD::BeginString, FIX::BeginString_FIX42, FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING, FIX::BusinessRejectReason_UNKNOWN_MESSAGE_TYPE, checkSessionTime(), FIX::FIELD::DefaultApplVerID, disconnect(), FIX::FieldNotFound::field, FIX::InvalidTagNumber::field, FIX::RequiredTagMissing::field, FIX::TagNotDefinedForMessage::field, FIX::NoTagValue::field, FIX::IncorrectTagValue::field, FIX::IncorrectDataFormat::field, FIX::TagOutOfOrder::field, FIX::RepeatedTag::field, FIX::RepeatingGroupCountMismatch::field, FIELD_GET_REF, FIELD_THROW_IF_NOT_FOUND, generateBusinessReject(), generateLogout(), generateReject(), FIX::DataDictionaryProvider::getApplicationDataDictionary(), FIX::SessionID::getBeginString(), FIX::FieldMap::getField(), FIX::FieldMap::getFieldIfSet(), FIX::Message::getHeader(), FIX::DataDictionaryProvider::getSessionDataDictionary(), FIX::SessionState::incrNextTargetMsgSeqNum(), FIX::Message::isApp(), FIX::SessionID::isFIXT(), isLoggedOn(), LOGEX, m_dataDictionaryProvider, m_sessionID, m_state, m_targetDefaultApplVerID, FIX::FIELD::MsgType, FIX::MsgType_Heartbeat, FIX::MsgType_Logon, FIX::MsgType_Logout, FIX::MsgType_Reject, FIX::MsgType_ResendRequest, FIX::MsgType_SequenceReset, FIX::MsgType_TestRequest, next(), nextHeartbeat(), nextLogon(), nextLogout(), nextQueued(), nextReject(), nextResendRequest(), nextSequenceReset(), nextTestRequest(), FIX::SessionState::onEvent(), reset(), FIX::FIELD::SenderCompID, FIX::SessionRejectReason_INCORRECT_DATA_FORMAT_FOR_VALUE, FIX::SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP, FIX::SessionRejectReason_INVALID_MSGTYPE, FIX::SessionRejectReason_INVALID_TAG_NUMBER, FIX::SessionRejectReason_REQUIRED_TAG_MISSING, FIX::SessionRejectReason_TAG_APPEARS_MORE_THAN_ONCE, FIX::SessionRejectReason_TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE, FIX::SessionRejectReason_TAG_SPECIFIED_OUT_OF_REQUIRED_ORDER, FIX::SessionRejectReason_TAG_SPECIFIED_WITHOUT_A_VALUE, FIX::SessionRejectReason_VALUE_IS_INCORRECT, setTargetDefaultApplVerID(), FIX::FIELD::TargetCompID, FIX::Message::toApplVerID(), FIX::DataDictionary::validate(), and verify().

{
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();
}
FIX::FIELD::ApplVerID
const int ApplVerID
Definition: FixFieldNumbers.h:425
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIELD_THROW_IF_NOT_FOUND
#define FIELD_THROW_IF_NOT_FOUND(MAP, FLD)
Definition: FieldMap.h:240
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:323
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::Session::nextReject
void nextReject(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:312
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Session::next
void next()
Definition: Session.cpp:125
FIX::Message::toApplVerID
static ApplVerID toApplVerID(const BeginString &value)
Definition: Message.h:257
FIX::MsgType_ResendRequest
const char MsgType_ResendRequest[]
Definition: FixValues.h:666
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::Session::nextResendRequest
void nextResendRequest(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:344
FIX::MsgType_SequenceReset
const char MsgType_SequenceReset[]
Definition: FixValues.h:646
FIX::SessionRejectReason_INVALID_MSGTYPE
const int SessionRejectReason_INVALID_MSGTYPE
Definition: FixValues.h:1880
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::BusinessRejectReason_UNKNOWN_MESSAGE_TYPE
const int BusinessRejectReason_UNKNOWN_MESSAGE_TYPE
Definition: FixValues.h:3274
FIX::BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING
const int BusinessRejectReason_CONDITIONALLY_REQUIRED_FIELD_MISSING
Definition: FixValues.h:3270
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
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::SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP
const int SessionRejectReason_INCORRECT_NUMINGROUP_COUNT_FOR_REPEATING_GROUP
Definition: FixValues.h:1873
FIX::Session::generateReject
void generateReject(const Message &, int err, int field=0)
Definition: Session.cpp:720
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::Session::m_targetDefaultApplVerID
std::string m_targetDefaultApplVerID
Definition: Session.h:309
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::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:61
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::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::MsgType_TestRequest
const char MsgType_TestRequest[]
Definition: FixValues.h:629
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124
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::FIELD::DefaultApplVerID
const int DefaultApplVerID
Definition: FixFieldNumbers.h:1171
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::FIELD::BeginString
const int BeginString
Definition: FixFieldNumbers.h:499
FIX::SessionRejectReason_INVALID_TAG_NUMBER
const int SessionRejectReason_INVALID_TAG_NUMBER
Definition: FixValues.h:1877
FIX::MsgType_Logout
const char MsgType_Logout[]
Definition: FixValues.h:622
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1145
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::Session::nextLogout
void nextLogout(const Message &, const UtcTimeStamp &timeStamp)
Definition: Session.cpp:295
FIELD_GET_REF
#define FIELD_GET_REF(MAP, FLD)
Definition: FieldMap.h:238
FIX::Session::setTargetDefaultApplVerID
void setTargetDefaultApplVerID(const std::string &targetDefaultApplVerID)
Definition: Session.h:129
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363
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::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::isLoggedOn
bool isLoggedOn()
Definition: Session.h:65

## nextHeartbeat()

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

private

Definition at line 280 of file Session.cpp.

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

Referenced by isCorrectCompID(), and next().

{
if ( !verify( heartbeat ) ) return ;
m_state.incrNextTargetMsgSeqNum();
nextQueued( timeStamp );
}
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1145

## nextLogon()

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

private

Definition at line 202 of file Session.cpp.

References disconnect(), doTargetTooHigh(), generateLogon(), FIX::FieldMap::getField(), FIX::FieldMap::getFieldIfSet(), FIX::Message::getHeader(), FIX::SessionState::heartBtInt(), FIX::SessionState::incrNextTargetMsgSeqNum(), FIX::SessionState::initiate(), isEnabled(), isLoggedOn(), isLogonTime(), isTargetTooHigh(), m_application, m_refreshOnLogon, m_resetOnLogon, m_sessionID, m_state, FIX::FIELD::MsgSeqNum, nextQueued(), FIX::SessionState::onEvent(), FIX::Application::onLogon(), FIX::SessionState::receivedLogon(), FIX::SessionState::receivedReset(), refresh(), FIX::SessionState::reset(), FIX::FIELD::ResetSeqNumFlag, FIX::FIELD::SenderCompID, FIX::SessionState::sentReset(), FIX::SessionState::shouldSendLogon(), FIX::FIELD::TargetCompID, and verify().

Referenced by isCorrectCompID(), and next().

{
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 );
}
FIX::Session::isEnabled
bool isEnabled()
Definition: Session.h:59
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Application::onLogon
virtual void onLogon(const SessionID &)=0
Notification of a session successfully logging on.
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionState::shouldSendLogon
bool shouldSendLogon() const
Definition: SessionState.h:115
FIX::Session::refresh
void refresh()
Definition: Session.h:68
FIX::SessionState::initiate
bool initiate() const
Definition: SessionState.h:68
FIX::Session::isLogonTime
bool isLogonTime(const UtcTimeStamp &time)
Definition: Session.h:110
FIX::SessionState::receivedReset
bool receivedReset() const
Definition: SessionState.h:62
FIX::Session::doTargetTooHigh
void doTargetTooHigh(const Message &msg)
Definition: Session.cpp:1113
FIX::Session::generateLogon
void generateLogon()
Definition: Session.cpp:602
FIX::SessionState::sentReset
bool sentReset() const
Definition: SessionState.h:65
FIX::Session::m_application
Application & m_application
Definition: Session.h:303
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:314
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
FIX::Session::isTargetTooHigh
bool isTargetTooHigh(const MsgSeqNum &msgSeqNum)
Definition: Session.h:247
FIX::FIELD::TargetCompID
const int TargetCompID
Definition: FixFieldNumbers.h:217
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::reset
void reset()
Definition: SessionState.h:191
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:53
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::FIELD::ResetSeqNumFlag
const int ResetSeqNumFlag
Definition: FixFieldNumbers.h:163
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1145
FIX::Session::m_refreshOnLogon
bool m_refreshOnLogon
Definition: Session.h:317
FIX::SessionState::heartBtInt
void heartBtInt(const HeartBtInt &value)
Definition: SessionState.h:94
FIX::Session::logon
void logon()
Definition: Session.h:55
FIX::Session::isLoggedOn
bool isLoggedOn()
Definition: Session.h:65

## nextLogout()

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

private

Definition at line 295 of file Session.cpp.

References disconnect(), generateLogout(), FIX::SessionState::incrNextTargetMsgSeqNum(), m_resetOnLogout, m_state, FIX::SessionState::onEvent(), FIX::SessionState::reset(), FIX::SessionState::sentLogout(), and verify().

Referenced by isCorrectCompID(), and next().

{
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();
}
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::reset
void reset()
Definition: SessionState.h:191
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905
FIX::Session::logout
void logout(const std::string &reason="")
Definition: Session.h:57
FIX::Session::m_resetOnLogout
bool m_resetOnLogout
Definition: Session.h:315
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:56

## nextQueued() [1/2]

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

private

Definition at line 1145 of file Session.cpp.

References getExpectedTargetNum().

Referenced by isCorrectCompID(), next(), nextHeartbeat(), nextLogon(), nextReject(), and nextTestRequest().

{
while ( nextQueued( getExpectedTargetNum(), timeStamp ) ) {}
}
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1145

## nextQueued() [2/2]

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

private

Definition at line 1150 of file Session.cpp.

References FIX::IntConvertor::convert(), FIX::FieldMap::getField(), FIX::Message::getHeader(), FIX::SessionState::incrNextTargetMsgSeqNum(), m_state, FIX::FIELD::MsgType, FIX::MsgType_Logon, FIX::MsgType_ResendRequest, next(), FIX::SessionState::onEvent(), and FIX::SessionState::retrieve().

{
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;
}
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Session::next
void next()
Definition: Session.cpp:125
FIX::SessionState::retrieve
bool retrieve(int msgSeqNum, Message &message)
Definition: SessionState.h:157
FIX::MsgType_ResendRequest
const char MsgType_ResendRequest[]
Definition: FixValues.h:666
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:154
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::MsgType_Logon
const char MsgType_Logon[]
Definition: FixValues.h:614
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## nextReject()

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

private

Definition at line 312 of file Session.cpp.

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

Referenced by isCorrectCompID(), and next().

{
if ( !verify( reject, false, true ) ) return ;
m_state.incrNextTargetMsgSeqNum();
nextQueued( timeStamp );
}
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1145

## nextResendRequest()

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

private

Definition at line 344 of file Session.cpp.

References FIX::FIELD::ApplVerID, FIX::FIELD::BeginSeqNo, FIX::BeginString_FIX42, FIX::IntConvertor::convert(), FIX::FIELD::EndSeqNo, generateSequenceReset(), FIX::SessionState::get(), FIX::DataDictionaryProvider::getApplicationDataDictionary(), FIX::SessionID::getBeginString(), getExpectedSenderNum(), FIX::FieldMap::getField(), FIX::FieldMap::getFieldIfSet(), FIX::Message::getHeader(), FIX::SessionState::getNextSenderMsgSeqNum(), FIX::DataDictionaryProvider::getSessionDataDictionary(), FIX::SessionState::incrNextTargetMsgSeqNum(), FIX::Message::isAdminMsgType(), FIX::SessionID::isFIXT(), isTargetTooHigh(), isTargetTooLow(), m_dataDictionaryProvider, m_mutex, m_persistMessages, m_senderDefaultApplVerID, m_sessionID, m_state, m_validateLengthAndChecksum, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, next(), FIX::SessionState::onEvent(), resend(), send(), FIX::Message::setStringHeader(), FIX::Message::toString(), and verify().

Referenced by isCorrectCompID(), and next().

{
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();
}
FIX::FIELD::ApplVerID
const int ApplVerID
Definition: FixFieldNumbers.h:425
FIX::FIELD::BeginSeqNo
const int BeginSeqNo
Definition: FixFieldNumbers.h:610
FIX::Session::send
bool send(Message &)
Definition: Session.cpp:452
FIX::Message::isAdminMsgType
static bool isAdminMsgType(const MsgType &msgType)
Definition: Message.h:250
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::Session::getExpectedSenderNum
int getExpectedSenderNum()
Definition: Session.h:211
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:323
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::FIELD::EndSeqNo
const int EndSeqNo
Definition: FixFieldNumbers.h:1198
FIX::Session::next
void next()
Definition: Session.cpp:125
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:154
FIX::Session::isTargetTooLow
bool isTargetTooLow(const MsgSeqNum &msgSeqNum)
Definition: Session.h:249
FIX::Session::generateSequenceReset
void generateSequenceReset(int, int)
Definition: Session.cpp:666
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308
FIX::Session::isTargetTooHigh
bool isTargetTooHigh(const MsgSeqNum &msgSeqNum)
Definition: Session.h:247
FIX::DataDictionaryProvider::getSessionDataDictionary
const DataDictionary & getSessionDataDictionary(const BeginString &beginString) const
Definition: DataDictionaryProvider.cpp:38
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::Session::m_validateLengthAndChecksum
bool m_validateLengthAndChecksum
Definition: Session.h:320
FIX::SessionID::isFIXT
const bool isFIXT() const
Definition: SessionID.h:61
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Session::m_mutex
Mutex m_mutex
Definition: Session.h:327
FIX::Session::m_persistMessages
bool m_persistMessages
Definition: Session.h:319
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::Session::resend
bool resend(Message &message)
Definition: Session.cpp:572
FIX::SessionState::getNextSenderMsgSeqNum
int getNextSenderMsgSeqNum() const
Definition: SessionState.h:177
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## nextSequenceReset()

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

private

Definition at line 319 of file Session.cpp.

References FIX::IntConvertor::convert(), FIX::FIELD::GapFillFlag, generateReject(), getExpectedTargetNum(), FIX::FieldMap::getFieldIfSet(), m_state, FIX::FIELD::MsgSeqNum, FIX::FIELD::NewSeqNo, FIX::SessionState::onEvent(), FIX::SessionRejectReason_VALUE_IS_INCORRECT, FIX::SessionState::setNextTargetMsgSeqNum(), and verify().

Referenced by isCorrectCompID(), and next().

{
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 );
}
}
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::SessionState::setNextTargetMsgSeqNum
void setNextTargetMsgSeqNum(int n)
Definition: SessionState.h:183
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::FIELD::GapFillFlag
const int GapFillFlag
Definition: FixFieldNumbers.h:1291
FIX::Session::generateReject
void generateReject(const Message &, int err, int field=0)
Definition: Session.cpp:720
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::SessionRejectReason_VALUE_IS_INCORRECT
const int SessionRejectReason_VALUE_IS_INCORRECT
Definition: FixValues.h:1878

## nextTestRequest()

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

private

Definition at line 287 of file Session.cpp.

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

Referenced by isCorrectCompID(), and next().

{
if ( !verify( testRequest ) ) return ;
generateHeartbeat( testRequest );
m_state.incrNextTargetMsgSeqNum();
nextQueued( timeStamp );
}
FIX::Session::verify
bool verify(const Message &msg, bool checkTooHigh=true, bool checkTooLow=true)
Definition: Session.cpp:941
FIX::Session::generateHeartbeat
void generateHeartbeat()
Definition: Session.cpp:685
FIX::SessionState::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: SessionState.h:187
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::Session::nextQueued
void nextQueued(const UtcTimeStamp &timeStamp)
Definition: Session.cpp:1145

## numSessions()

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

static

Definition at line 1460 of file Session.cpp.

References s_mutex, and s_sessions.

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

{
Locker locker( s_mutex );
return s_sessions.size();
}
FIX::Session::s_sessions
static Sessions s_sessions
Definition: Session.h:329
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332

## persist()

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

private

Definition at line 592 of file Session.cpp.

References FIX::SessionState::incrNextSenderMsgSeqNum(), m_persistMessages, m_state, FIX::FIELD::MsgSeqNum, and FIX::SessionState::set().

Referenced by sendRaw().

{
MsgSeqNum msgSeqNum;
message.getHeader().getField( msgSeqNum );
if( m_persistMessages )
m_state.set( msgSeqNum, messageString );
m_state.incrNextSenderMsgSeqNum();
}
FIX::SessionState::set
bool set(int s, const std::string &m)
Definition: SessionState.h:172
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::incrNextSenderMsgSeqNum
void incrNextSenderMsgSeqNum()
Definition: SessionState.h:185
FIX::Session::m_persistMessages
bool m_persistMessages
Definition: Session.h:319
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333

## populateRejectReason() [1/2]

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

private

Definition at line 916 of file Session.cpp.

References FIX::BeginString_FIX42, FIX::SessionID::getBeginString(), FIX::FieldMap::getField(), FIX::Message::getHeader(), m_sessionID, FIX::FIELD::MsgType, FIX::MsgType_Reject, FIX::FIELD::RefTagID, FIX::FieldMap::setField(), and FIX::FIELD::Text.

Referenced by generateBusinessReject(), generateReject(), and isCorrectCompID().

{
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() ) );
}
}
FIX::BeginString_FIX42
const char BeginString_FIX42[]
Definition: Values.h:34
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::FIELD::Text
const int Text
Definition: FixFieldNumbers.h:256
FIX::FIELD::RefTagID
const int RefTagID
Definition: FixFieldNumbers.h:1379
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363
FIX::MsgType_Reject
const char MsgType_Reject[]
Definition: FixValues.h:682

## populateRejectReason() [2/2]

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

private

Definition at line 936 of file Session.cpp.

References FIX::FieldMap::setField(), and FIX::FIELD::Text.

{
reject.setField( Text( text ) );
}
FIX::FIELD::Text
const int Text
Definition: FixFieldNumbers.h:256

## receivedLogon()

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

inline

Definition at line 64 of file Session.h.

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

Referenced by isLoggedOn().

{ return m_state.receivedLogon(); }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:53

## refresh()

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

inline

Definition at line 68 of file Session.h.

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

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

{ m_state.refresh(); }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::refresh
void refresh()
Definition: SessionState.h:193

## registerSession()

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

static

Definition at line 1444 of file Session.cpp.

References isSessionRegistered(), lookupSession(), s_mutex, and s_registered.

Referenced by getDataDictionaryProvider(), FIX::SocketConnection::read(), and FIX::ThreadedSocketConnection::setSession().

{
Locker locker( s_mutex );
Session* pSession = lookupSession( sessionID );
if ( pSession == 0 ) return 0;
if ( isSessionRegistered( sessionID ) ) return 0;
s_registered[ sessionID ] = pSession;
return pSession;
}
FIX::Session::lookupSession
static Session * lookupSession(const SessionID &)
Definition: Session.cpp:1403
FIX::Session::isSessionRegistered
static bool isSessionRegistered(const SessionID &)
Definition: Session.cpp:1438
FIX::Session::Session
Session(Application &, MessageStoreFactory &, const SessionID &, const DataDictionaryProvider &, const TimeRange &, int heartBtInt, LogFactory *pLogFactory)
Definition: Session.cpp:41
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332
FIX::Session::s_registered
static Sessions s_registered
Definition: Session.h:331

## removeSession()

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

static private

Definition at line 1480 of file Session.cpp.

References m_sessionID, s_mutex, s_registered, s_sessionIDs, and s_sessions.

Referenced by ~Session().

{
Locker locker( s_mutex );
s_sessions.erase( s.m_sessionID );
s_sessionIDs.erase( s.m_sessionID );
s_registered.erase( s.m_sessionID );
}
FIX::Session::s_sessions
static Sessions s_sessions
Definition: Session.h:329
FIX::Session::s_sessionIDs
static SessionIDs s_sessionIDs
Definition: Session.h:330
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332
FIX::Session::s_registered
static Sessions s_registered
Definition: Session.h:331

## resend()

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

private

Definition at line 572 of file Session.cpp.

References FIX::FieldMap::getField(), FIX::Message::getHeader(), insertOrigSendingTime(), insertSendingTime(), m_application, m_sessionID, FIX::FIELD::MsgSeqNum, FIX::FIELD::PossDupFlag, FIX::FIELD::SendingTime, FIX::FieldMap::setField(), and FIX::Application::toApp().

Referenced by nextResendRequest().

{
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; }
}
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::FIELD::SendingTime
const int SendingTime
Definition: FixFieldNumbers.h:1447
FIX::Application::toApp
virtual void toApp(Message &, const SessionID &)=0
Notification of app message being sent to target.
FIX::Session::m_application
Application & m_application
Definition: Session.h:303
FIX::Session::insertSendingTime
void insertSendingTime(Header &)
Definition: Session.cpp:91
FIX::FIELD::PossDupFlag
const int PossDupFlag
Definition: FixFieldNumbers.h:1284
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::Session::insertOrigSendingTime
void insertOrigSendingTime(Header &, const UtcTimeStamp &when=UtcTimeStamp())
Definition: Session.cpp:103

## reset()

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

inline

Definition at line 66 of file Session.h.

References disconnect(), generateLogout(), m_state, and FIX::SessionState::reset().

Referenced by next(), FIX::HttpConnection::processResetSession(), FIX::HttpConnection::processResetSessions(), Session(), and setResponder().

{ generateLogout(); disconnect(); m_state.reset(); }
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::reset
void reset()
Definition: SessionState.h:191
FIX::Session::generateLogout
void generateLogout(const std::string &text="")
Definition: Session.cpp:905

## send() [1/2]

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

Definition at line 452 of file Session.cpp.

References FIX::Message::getHeader(), FIX::FIELD::OrigSendingTime, FIX::FIELD::PossDupFlag, FIX::FieldMap::removeField(), and sendRaw().

Referenced by nextResendRequest(), sendRaw(), sendToTarget(), and setResponder().

{
message.getHeader().removeField( FIELD::PossDupFlag );
message.getHeader().removeField( FIELD::OrigSendingTime );
return sendRaw( message );
}
FIX::FIELD::OrigSendingTime
const int OrigSendingTime
Definition: FixFieldNumbers.h:921
FIX::Session::sendRaw
bool sendRaw(Message &, int msgSeqNum=0)
Definition: Session.cpp:459
FIX::FIELD::PossDupFlag
const int PossDupFlag
Definition: FixFieldNumbers.h:1284

## send() [2/2]

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

private

Definition at line 535 of file Session.cpp.

References m_pResponder, m_state, FIX::SessionState::onOutgoing(), and FIX::Responder::send().

{
if ( !m_pResponder ) return false;
m_state.onOutgoing( string );
return m_pResponder->send( string );
}
FIX::SessionState::onOutgoing
void onOutgoing(const std::string &string)
Definition: SessionState.h:202
FIX::Responder::send
virtual bool send(const std::string &)=0
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::Session::m_pResponder
Responder * m_pResponder
Definition: Session.h:326

## sendRaw()

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

private

Definition at line 459 of file Session.cpp.

References fill(), getExpectedSenderNum(), FIX::FieldMap::getFieldIfSet(), FIX::Message::getHeader(), FIX::Message::isAdminMsgType(), isLoggedOn(), m_application, m_mutex, m_sessionID, m_state, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, FIX::SessionState::onEvent(), persist(), FIX::SessionState::receivedReset(), FIX::SessionState::reset(), FIX::FIELD::ResetSeqNumFlag, send(), FIX::SessionState::sentReset(), FIX::FieldMap::setField(), shouldSendReset(), FIX::Application::toAdmin(), FIX::Application::toApp(), and FIX::Message::toString().

Referenced by generateBusinessReject(), generateHeartbeat(), generateLogon(), generateLogout(), generateReject(), generateResendRequest(), generateSequenceReset(), generateTestRequest(), and send().

{
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;
}
}
FIX::Session::send
bool send(Message &)
Definition: Session.cpp:452
FIX::Message::isAdminMsgType
static bool isAdminMsgType(const MsgType &msgType)
Definition: Message.h:250
FIX::Session::getExpectedSenderNum
int getExpectedSenderNum()
Definition: Session.h:211
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::SessionState::receivedReset
bool receivedReset() const
Definition: SessionState.h:62
FIX::Application::toApp
virtual void toApp(Message &, const SessionID &)=0
Notification of app message being sent to target.
FIX::SessionState::sentReset
bool sentReset() const
Definition: SessionState.h:65
FIX::Session::m_application
Application & m_application
Definition: Session.h:303
FIX::Session::persist
void persist(const Message &, const std::string &)
Definition: Session.cpp:592
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::reset
void reset()
Definition: SessionState.h:191
FIX::Application::toAdmin
virtual void toAdmin(Message &, const SessionID &)=0
Notification of admin message being sent to target.
FIX::Session::shouldSendReset
bool shouldSendReset()
Definition: Session.cpp:1013
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Session::m_mutex
Mutex m_mutex
Definition: Session.h:327
FIX::Session::fill
void fill(Header &)
Definition: Session.cpp:114
FIX::FIELD::ResetSeqNumFlag
const int ResetSeqNumFlag
Definition: FixFieldNumbers.h:163
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363
FIX::Session::isLoggedOn
bool isLoggedOn()
Definition: Session.h:65

## sendToTarget() [1/4]

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

static

Definition at line 1351 of file Session.cpp.

Referenced by getDataDictionaryProvider(), and sendToTarget().

{
try
{
SessionID sessionID = message.getSessionID( qualifier );
return sendToTarget( message, sessionID );
}
catch ( FieldNotFound& ) { throw SessionNotFound(); }
}
FIX::Session::sendToTarget
static bool sendToTarget(Message &message, const std::string &qualifier="")
Definition: Session.cpp:1351

## sendToTarget() [2/4]

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

static

Definition at line 1362 of file Session.cpp.

References lookupSession(), send(), and sendToTarget().

{
message.setSessionID( sessionID );
Session* pSession = lookupSession( sessionID );
if ( !pSession ) throw SessionNotFound();
return pSession->send( message );
}
FIX::Session::lookupSession
static Session * lookupSession(const SessionID &)
Definition: Session.cpp:1403
FIX::Session::Session
Session(Application &, MessageStoreFactory &, const SessionID &, const DataDictionaryProvider &, const TimeRange &, int heartBtInt, LogFactory *pLogFactory)
Definition: Session.cpp:41

## sendToTarget() [3/4]

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

static

Definition at line 1372 of file Session.cpp.

References FIX::Message::getHeader(), sendToTarget(), and FIX::FieldMap::setField().

{
message.getHeader().setField( senderCompID );
message.getHeader().setField( targetCompID );
return sendToTarget( message, qualifier );
}
FIX::Session::sendToTarget
static bool sendToTarget(Message &message, const std::string &qualifier="")
Definition: Session.cpp:1351

## 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 1384 of file Session.cpp.

References FIX::FIELD::SenderCompID, sendToTarget(), and FIX::FIELD::TargetCompID.

{
return sendToTarget( message, SenderCompID( sender ),
TargetCompID( target ), qualifier );
}
FIX::Session::sendToTarget
static bool sendToTarget(Message &message, const std::string &qualifier="")
Definition: Session.cpp:1351
FIX::FIELD::TargetCompID
const int TargetCompID
Definition: FixFieldNumbers.h:217
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124

## sentLogon()

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

inline

Definition at line 62 of file Session.h.

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

Referenced by isLoggedOn().

{ return m_state.sentLogon(); }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::sentLogon
bool sentLogon() const
Definition: SessionState.h:59

## sentLogout()

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

inline

Definition at line 63 of file Session.h.

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

{ return m_state.sentLogout(); }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:56

## set()

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

private

## setCheckCompId()

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

inline

Definition at line 139 of file Session.h.

References m_checkCompId.

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

{ m_checkCompId = value; }
FIX::Session::m_checkCompId
bool m_checkCompId
Definition: Session.h:311

## setCheckLatency()

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

inline

Definition at line 144 of file Session.h.

References m_checkLatency.

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

{ m_checkLatency = value; }
FIX::Session::m_checkLatency
bool m_checkLatency
Definition: Session.h:312

## setDataDictionaryProvider()

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

inline

Definition at line 77 of file Session.h.

References m_dataDictionaryProvider.

{ m_dataDictionaryProvider = dataDictionaryProvider; }
FIX::Session::m_dataDictionaryProvider
DataDictionaryProvider m_dataDictionaryProvider
Definition: Session.h:323

## setLogonTime()

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

inline

Definition at line 119 of file Session.h.

References m_logonTime.

{ m_logonTime = value; }
FIX::Session::m_logonTime
TimeRange m_logonTime
Definition: Session.h:306

## setLogonTimeout()

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

inline

Definition at line 154 of file Session.h.

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

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

{ m_state.logonTimeout( value ); }
FIX::SessionState::logonTimeout
int logonTimeout() const
Definition: SessionState.h:71
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## setLogoutTimeout()

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

inline

Definition at line 159 of file Session.h.

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

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

{ m_state.logoutTimeout( value ); }
FIX::SessionState::logoutTimeout
int logoutTimeout() const
Definition: SessionState.h:74
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## setMaxLatency()

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

inline

Definition at line 149 of file Session.h.

References m_maxLatency.

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

{ m_maxLatency = value; }
FIX::Session::m_maxLatency
int m_maxLatency
Definition: Session.h:313

## setMillisecondsInTimeStamp()

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

inline

Definition at line 184 of file Session.h.

References m_millisecondsInTimeStamp.

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

{ m_millisecondsInTimeStamp = value; }
FIX::Session::m_millisecondsInTimeStamp
bool m_millisecondsInTimeStamp
Definition: Session.h:318

## setNextSenderMsgSeqNum()

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

inline

Definition at line 70 of file Session.h.

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

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

{ m_state.setNextSenderMsgSeqNum( num ); }
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::setNextSenderMsgSeqNum
void setNextSenderMsgSeqNum(int n)
Definition: SessionState.h:181

## setNextTargetMsgSeqNum()

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

inline

Definition at line 72 of file Session.h.

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

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

{ m_state.setNextTargetMsgSeqNum( num ); }
FIX::SessionState::setNextTargetMsgSeqNum
void setNextTargetMsgSeqNum(int n)
Definition: SessionState.h:183
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322

## setPersistMessages()

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

inline

Definition at line 189 of file Session.h.

References m_persistMessages.

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

{ m_persistMessages = value; }
FIX::Session::m_persistMessages
bool m_persistMessages
Definition: Session.h:319

## setRefreshOnLogon()

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

inline

Definition at line 179 of file Session.h.

References m_refreshOnLogon.

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

{ m_refreshOnLogon = value; }
FIX::Session::m_refreshOnLogon
bool m_refreshOnLogon
Definition: Session.h:317

## setResetOnDisconnect()

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

inline

Definition at line 174 of file Session.h.

References m_resetOnDisconnect.

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

{ m_resetOnDisconnect = value; }
FIX::Session::m_resetOnDisconnect
bool m_resetOnDisconnect
Definition: Session.h:316

## setResetOnLogon()

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

inline

Definition at line 164 of file Session.h.

References m_resetOnLogon.

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

{ m_resetOnLogon = value; }
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:314

## setResetOnLogout()

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

inline

Definition at line 169 of file Session.h.

References m_resetOnLogout.

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

{ m_resetOnLogout = value; }
FIX::Session::m_resetOnLogout
bool m_resetOnLogout
Definition: Session.h:315

## setResponder()

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

inline

Definition at line 197 of file Session.h.

References checkSessionTime(), disconnect(), m_pResponder, next(), reset(), send(), and FIX::TYPE::UtcTimeStamp.

Referenced by FIX::ThreadedSocketConnection::setSession(), and FIX::ThreadedSocketConnection::~ThreadedSocketConnection().

{
if( !checkSessionTime(UtcTimeStamp()) )
reset();
m_pResponder = pR;
}
FIX::Session::reset
void reset()
Definition: Session.h:66
FIX::Session::checkSessionTime
bool checkSessionTime(const UtcTimeStamp &timeStamp)
Definition: Session.h:242
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674
FIX::Session::m_pResponder
Responder * m_pResponder
Definition: Session.h:326

## setSenderDefaultApplVerID()

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

inline

Definition at line 124 of file Session.h.

References m_senderDefaultApplVerID.

{ m_senderDefaultApplVerID = senderDefaultApplVerID; }
FIX::Session::m_senderDefaultApplVerID
std::string m_senderDefaultApplVerID
Definition: Session.h:308

## setSendRedundantResendRequests()

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

inline

Definition at line 134 of file Session.h.

References m_sendRedundantResendRequests.

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

{ m_sendRedundantResendRequests = value; }
FIX::Session::m_sendRedundantResendRequests
bool m_sendRedundantResendRequests
Definition: Session.h:310

## setTargetDefaultApplVerID()

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

inline

Definition at line 129 of file Session.h.

References m_targetDefaultApplVerID.

Referenced by next().

{ m_targetDefaultApplVerID = targetDefaultApplVerID; }
FIX::Session::m_targetDefaultApplVerID
std::string m_targetDefaultApplVerID
Definition: Session.h:309

## setValidateLengthAndChecksum()

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

inline

Definition at line 194 of file Session.h.

References m_validateLengthAndChecksum.

{ m_validateLengthAndChecksum = value; }
FIX::Session::m_validateLengthAndChecksum
bool m_validateLengthAndChecksum
Definition: Session.h:320

## shouldSendReset()

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

private

Definition at line 1013 of file Session.cpp.

References FIX::BeginString_FIX41, FIX::SessionID::getBeginString(), getExpectedSenderNum(), getExpectedTargetNum(), m_resetOnDisconnect, m_resetOnLogon, m_resetOnLogout, and m_sessionID.

Referenced by generateLogon(), isCorrectCompID(), and sendRaw().

{
std::string beginString = m_sessionID.getBeginString();
return beginString >= FIX::BeginString_FIX41
&& ( m_resetOnLogon ||
m_resetOnLogout ||
m_resetOnDisconnect )
&& ( getExpectedSenderNum() == 1 )
&& ( getExpectedTargetNum() == 1 );
}
FIX::Session::getExpectedTargetNum
int getExpectedTargetNum()
Definition: Session.h:212
FIX::Session::getExpectedSenderNum
int getExpectedSenderNum()
Definition: Session.h:211
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::Session::m_resetOnLogon
bool m_resetOnLogon
Definition: Session.h:314
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::BeginString_FIX41
const char BeginString_FIX41[]
Definition: Values.h:35
FIX::Session::m_resetOnDisconnect
bool m_resetOnDisconnect
Definition: Session.h:316
FIX::Session::m_resetOnLogout
bool m_resetOnLogout
Definition: Session.h:315

## unregisterSession()

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

static

Definition at line 1454 of file Session.cpp.

References s_mutex, and s_registered.

Referenced by getDataDictionaryProvider(), FIX::Acceptor::stop(), FIX::SocketConnection::~SocketConnection(), and FIX::ThreadedSocketConnection::~ThreadedSocketConnection().

{
Locker locker( s_mutex );
s_registered.erase( sessionID );
}
FIX::Session::s_mutex
static Mutex s_mutex
Definition: Session.h:332
FIX::Session::s_registered
static Sessions s_registered
Definition: Session.h:331

## validLogonState()

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

private

Definition at line 1024 of file Session.cpp.

References m_state, FIX::MsgType_Logon, FIX::MsgType_Logout, FIX::MsgType_Reject, FIX::MsgType_SequenceReset, FIX::SessionState::receivedLogon(), FIX::SessionState::receivedReset(), FIX::SessionState::sentLogon(), FIX::SessionState::sentLogout(), and FIX::SessionState::sentReset().

Referenced by isCorrectCompID(), and verify().

{
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;
}
FIX::MsgType_SequenceReset
const char MsgType_SequenceReset[]
Definition: FixValues.h:646
FIX::SessionState::receivedReset
bool receivedReset() const
Definition: SessionState.h:62
FIX::SessionState::sentReset
bool sentReset() const
Definition: SessionState.h:65
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::receivedLogon
bool receivedLogon() const
Definition: SessionState.h:53
FIX::SessionState::sentLogon
bool sentLogon() const
Definition: SessionState.h:59
FIX::MsgType_Logon
const char MsgType_Logon[]
Definition: FixValues.h:614
FIX::MsgType_Logout
const char MsgType_Logout[]
Definition: FixValues.h:622
FIX::SessionState::sentLogout
bool sentLogout() const
Definition: SessionState.h:56
FIX::MsgType_Reject
const char MsgType_Reject[]
Definition: FixValues.h:682

## verify()

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

private

Definition at line 941 of file Session.cpp.

References FIX::IntConvertor::convert(), disconnect(), doBadCompID(), doBadTime(), doTargetTooHigh(), doTargetTooLow(), FIELD_GET_PTR, FIELD_GET_REF, fromCallback(), FIX::Message::getHeader(), isCorrectCompID(), isGoodTime(), isTargetTooHigh(), isTargetTooLow(), FIX::SessionState::lastReceivedTime(), m_sessionID, m_state, FIX::FIELD::MsgSeqNum, FIX::FIELD::MsgType, FIX::SessionState::onEvent(), FIX::SessionState::resendRange(), FIX::SessionState::resendRequested(), FIX::FIELD::SenderCompID, FIX::FIELD::SendingTime, FIX::FIELD::TargetCompID, FIX::SessionState::testRequest(), and validLogonState().

Referenced by isCorrectCompID(), next(), nextHeartbeat(), nextLogon(), nextLogout(), nextReject(), nextResendRequest(), nextSequenceReset(), and nextTestRequest().

{
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;
}
FIX::SessionState::lastReceivedTime
void lastReceivedTime(const UtcTimeStamp &value)
Definition: SessionState.h:108
FIX::Session::isGoodTime
bool isGoodTime(const SendingTime &sendingTime)
Definition: Session.h:236
FIX::SessionState::ResendRange
std::pair< int, int > ResendRange
Definition: SessionState.h:83
FIX::SessionState::testRequest
int testRequest() const
Definition: SessionState.h:77
FIX::Session::doBadTime
void doBadTime(const Message &msg)
Definition: Session.cpp:1053
FIX::Session::m_sessionID
SessionID m_sessionID
Definition: Session.h:304
FIX::Session::validLogonState
bool validLogonState(const MsgType &msgType)
Definition: Session.cpp:1024
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::isTargetTooLow
bool isTargetTooLow(const MsgSeqNum &msgSeqNum)
Definition: Session.h:249
FIX::FIELD::SendingTime
const int SendingTime
Definition: FixFieldNumbers.h:1447
FIX::Session::doTargetTooHigh
void doTargetTooHigh(const Message &msg)
Definition: Session.cpp:1113
FIX::Session::disconnect
void disconnect()
Definition: Session.cpp:542
FIX::Session::isTargetTooHigh
bool isTargetTooHigh(const MsgSeqNum &msgSeqNum)
Definition: Session.h:247
FIX::FIELD::TargetCompID
const int TargetCompID
Definition: FixFieldNumbers.h:217
FIX::Session::m_state
SessionState m_state
Definition: Session.h:322
FIX::SessionState::resendRange
ResendRange resendRange() const
Definition: SessionState.h:85
FIX::Session::fromCallback
void fromCallback(const MsgType &msgType, const Message &msg, const SessionID &sessionID)
Definition: Session.cpp:1044
FIX::Session::isCorrectCompID
bool isCorrectCompID(const SenderCompID &senderCompID, const TargetCompID &targetCompID)
Definition: Session.h:251
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124
FIX::SessionState::onEvent
void onEvent(const std::string &string)
Definition: SessionState.h:204
FIX::Session::doBadCompID
void doBadCompID(const Message &msg)
Definition: Session.cpp:1059
FIX::TYPE::UtcTimeStamp
Definition: FieldTypes.h:674
FIX::Session::doTargetTooLow
bool doTargetTooLow(const Message &msg)
Definition: Session.cpp:1093
FIX::FIELD::MsgSeqNum
const int MsgSeqNum
Definition: FixFieldNumbers.h:1333
FIELD_GET_PTR
#define FIELD_GET_PTR(MAP, FLD)
Definition: FieldMap.h:236
FIELD_GET_REF
#define FIELD_GET_REF(MAP, FLD)
Definition: FieldMap.h:238
FIX::FIELD::MsgType
const int MsgType
Definition: FixFieldNumbers.h:363

## Member Data Documentation

## m_application

Application& FIX::Session::m_application

private

Definition at line 303 of file Session.h.

Referenced by disconnect(), fromCallback(), nextLogon(), resend(), sendRaw(), and Session().

## m_checkCompId

bool FIX::Session::m_checkCompId

private

Definition at line 311 of file Session.h.

Referenced by getCheckCompId(), isCorrectCompID(), and setCheckCompId().

## m_checkLatency

bool FIX::Session::m_checkLatency

private

Definition at line 312 of file Session.h.

Referenced by getCheckLatency(), isGoodTime(), and setCheckLatency().

## m_dataDictionaryProvider

DataDictionaryProvider FIX::Session::m_dataDictionaryProvider

private

Definition at line 323 of file Session.h.

Referenced by getDataDictionaryProvider(), next(), nextResendRequest(), and setDataDictionaryProvider().

## m_logonTime

TimeRange FIX::Session::m_logonTime

private

Definition at line 306 of file Session.h.

Referenced by getLogonTime(), isLogonTime(), and setLogonTime().

## m_maxLatency

int FIX::Session::m_maxLatency

private

Definition at line 313 of file Session.h.

Referenced by getMaxLatency(), isGoodTime(), and setMaxLatency().

## m_messageStoreFactory

MessageStoreFactory& FIX::Session::m_messageStoreFactory

private

Definition at line 324 of file Session.h.

Referenced by Session(), and ~Session().

## m_millisecondsInTimeStamp

bool FIX::Session::m_millisecondsInTimeStamp

private

Definition at line 318 of file Session.h.

Referenced by getMillisecondsInTimeStamp(), insertOrigSendingTime(), insertSendingTime(), and setMillisecondsInTimeStamp().

## m_mutex

Mutex FIX::Session::m_mutex

private

Definition at line 327 of file Session.h.

Referenced by disconnect(), nextResendRequest(), and sendRaw().

## m_persistMessages

bool FIX::Session::m_persistMessages

private

Definition at line 319 of file Session.h.

Referenced by getPersistMessages(), nextResendRequest(), persist(), and setPersistMessages().

## m_pLogFactory

LogFactory* FIX::Session::m_pLogFactory

private

Definition at line 325 of file Session.h.

Referenced by Session(), and ~Session().

## m_pResponder

Responder* FIX::Session::m_pResponder

private

Definition at line 326 of file Session.h.

Referenced by disconnect(), send(), and setResponder().

## m_refreshOnLogon

bool FIX::Session::m_refreshOnLogon

private

Definition at line 317 of file Session.h.

Referenced by generateLogon(), getRefreshOnLogon(), nextLogon(), and setRefreshOnLogon().

## m_resetOnDisconnect

bool FIX::Session::m_resetOnDisconnect

private

Definition at line 316 of file Session.h.

Referenced by disconnect(), getResetOnDisconnect(), setResetOnDisconnect(), and shouldSendReset().

## m_resetOnLogon

bool FIX::Session::m_resetOnLogon

private

Definition at line 314 of file Session.h.

Referenced by generateLogon(), getResetOnLogon(), nextLogon(), setResetOnLogon(), and shouldSendReset().

## m_resetOnLogout

bool FIX::Session::m_resetOnLogout

private

Definition at line 315 of file Session.h.

Referenced by getResetOnLogout(), nextLogout(), setResetOnLogout(), and shouldSendReset().

## m_senderDefaultApplVerID

std::string FIX::Session::m_senderDefaultApplVerID

private

Definition at line 308 of file Session.h.

Referenced by generateBusinessReject(), generateLogon(), getSenderDefaultApplVerID(), next(), nextResendRequest(), and setSenderDefaultApplVerID().

## m_sendRedundantResendRequests

bool FIX::Session::m_sendRedundantResendRequests

private

Definition at line 310 of file Session.h.

Referenced by doTargetTooHigh(), getSendRedundantResendRequests(), and setSendRedundantResendRequests().

## m_sessionID

SessionID FIX::Session::m_sessionID

private

Definition at line 304 of file Session.h.

Referenced by addSession(), disconnect(), fill(), fromCallback(), generateBusinessReject(), generateLogon(), generateReject(), getSessionID(), insertOrigSendingTime(), insertSendingTime(), isCorrectCompID(), next(), nextLogon(), nextResendRequest(), populateRejectReason(), removeSession(), resend(), sendRaw(), Session(), shouldSendReset(), and verify().

## m_sessionTime

TimeRange FIX::Session::m_sessionTime

private

Definition at line 305 of file Session.h.

Referenced by checkSessionTime(), and isSessionTime().

## m_state

SessionState FIX::Session::m_state

private

Definition at line 322 of file Session.h.

Referenced by checkSessionTime(), disconnect(), doTargetTooHigh(), fill(), generateBusinessReject(), generateLogon(), generateLogout(), generateReject(), generateResendRequest(), generateSequenceReset(), getExpectedSenderNum(), getExpectedTargetNum(), getHeartBtInt(), getLog(), getLogonTimeout(), getLogoutTimeout(), getStore(), isAcceptor(), isEnabled(), isInitiator(), isTargetTooHigh(), isTargetTooLow(), logon(), logout(), next(), nextHeartbeat(), nextLogon(), nextLogout(), nextQueued(), nextReject(), nextResendRequest(), nextSequenceReset(), nextTestRequest(), persist(), receivedLogon(), refresh(), reset(), send(), sendRaw(), sentLogon(), sentLogout(), Session(), setLogonTimeout(), setLogoutTimeout(), setNextSenderMsgSeqNum(), setNextTargetMsgSeqNum(), validLogonState(), verify(), and ~Session().

## m_targetDefaultApplVerID

std::string FIX::Session::m_targetDefaultApplVerID

private

Definition at line 309 of file Session.h.

Referenced by getTargetDefaultApplVerID(), next(), and setTargetDefaultApplVerID().

## m_validateLengthAndChecksum

bool FIX::Session::m_validateLengthAndChecksum

private

Definition at line 320 of file Session.h.

Referenced by getValidateLengthAndChecksum(), next(), nextResendRequest(), and setValidateLengthAndChecksum().

## s_mutex

Mutex FIX::Session::s_mutex

static private

Definition at line 332 of file Session.h.

Referenced by addSession(), doesSessionExist(), isSessionRegistered(), lookupSession(), numSessions(), registerSession(), removeSession(), and unregisterSession().

## s_registered

Session::Sessions FIX::Session::s_registered

static private

Definition at line 331 of file Session.h.

Referenced by isSessionRegistered(), registerSession(), removeSession(), and unregisterSession().

## s_sessionIDs

Session::SessionIDs FIX::Session::s_sessionIDs

static private

Definition at line 330 of file Session.h.

Referenced by addSession(), getSessions(), and removeSession().

## s_sessions

Session::Sessions FIX::Session::s_sessions

static private

Definition at line 329 of file Session.h.

Referenced by addSession(), doesSessionExist(), lookupSession(), numSessions(), and removeSession().

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

- Session.h
- Session.cpp