OnixS C++ FIX Engine  4.9.0
API Documentation
Session Class Reference

#include <OnixS/FIXEngine/FIX/Session.h>

Classes

class  MsgBatch
 
class  MsgBatchHelper
 
struct  ProxySettings
 

Public Types

typedef std::pair< unsigned short, unsigned short > LocalPortRange
 
typedef MsgBatch< MessageMessageBatch
 
typedef MsgBatch< FlatMessageFlatMessageBatch
 
typedef FlatMessageBatch SerializedMessageBatch
 
typedef std::set< std::string > InboundMessageLogFilter
 
typedef std::set< std::string > OutboundMessageLogFilter
 
typedef std::vector< TagScrambledFields
 

Public Member Functions

 Session (const std::string &senderCompId, const std::string &targetCompId, const Dictionary &dictionary, ISessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, ISessionStorage *storage=ONIXS_FIXENGINE_NULLPTR)
 
 Session (ISessionReactor *reactor, const std::string &senderCompId, const std::string &targetCompId, const Dictionary &dictionary, ISessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, ISessionStorage *storage=ONIXS_FIXENGINE_NULLPTR)
 
 Session (const std::string &senderCompId, const std::string &targetCompId, const Dictionary &dictionary, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, ISessionStorage *storage=ONIXS_FIXENGINE_NULLPTR)
 
 Session (ISessionReactor *reactor, const std::string &senderCompId, const std::string &targetCompId, const Dictionary &dictionary, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, SessionStorageType::Enum storageType=SessionStorageType::FileBased, ISessionStorage *storage=ONIXS_FIXENGINE_NULLPTR)
 
 Session (const std::string &senderCompId, const std::string &targetCompId, const Dictionary &dictionary, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, const std::string &customSessionKey, SessionStorageType::Enum storageType=SessionStorageType::FileBased, ISessionStorage *storage=ONIXS_FIXENGINE_NULLPTR)
 
 Session (ISessionReactor *reactor, const std::string &senderCompId, const std::string &targetCompId, const Dictionary &dictionary, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, const std::string &customSessionKey, SessionStorageType::Enum storageType=SessionStorageType::FileBased, ISessionStorage *storage=ONIXS_FIXENGINE_NULLPTR)
 
 ~Session ()
 
SessionclearOutboundQueue (bool removeFragmentedPacket=false)
 
SessionState::Enum state () const
 
EncryptionMethod::Enum encryptionMethod () const
 
SessionencryptionMethod (EncryptionMethod::Enum newEncryptionMethod)
 
int listenPort () const
 
SessionlistenPort (int listenPort)
 
std::string localNetworkInterface () const
 
SessionlocalNetworkInterface (const std::string &localNetworkInterface)
 
unsigned short localPort () const
 
LocalPortRange localPortRange () const
 
SessionlocalPortRange (LocalPortRange portRange)
 
bool tcpNoDelayOption () const
 
SessiontcpNoDelayOption (bool improveLatency=true)
 
bool sendLogoutOnException () const
 
SessionsendLogoutOnException (bool sendLogoutOnException)
 
bool validateUnknownMessages () const
 
SessionvalidateUnknownMessages (bool)
 
bool validateUnknownFields () const
 
SessionvalidateUnknownFields (bool)
 
bool validateRequiredFields () const
 
SessionvalidateRequiredFields (bool)
 
bool validateFieldValues () const
 
SessionvalidateFieldValues (bool)
 
bool validateEmptyFieldValues () const
 
SessionvalidateEmptyFieldValues (bool)
 
bool validateRepeatingGroupEntryCount () const
 
SessionvalidateRepeatingGroupEntryCount (bool)
 
bool validateRepeatingGroupLeadingTag () const
 
SessionvalidateRepeatingGroupLeadingTag (bool)
 
bool validateDuplicatedField () const
 
SessionvalidateDuplicatedField (bool)
 
bool validateChecksum () const
 
SessionvalidateChecksum (bool)
 
unsigned messageGrouping () const
 
SessionmessageGrouping (unsigned numberOfMessagesToGroup)
 
ThreadingModel::Enum threadingModel () const
 
SessionthreadingModel (ThreadingModel::Enum value)
 
bool useSpinLock () const
 
SessionuseSpinLock (bool value)
 
int reasonableTransmissionTime () const
 
SessionreasonableTransmissionTime (int value)
 
SessionreconnectAttempts (int value)
 
int reconnectAttempts () const
 
SessionreconnectInterval (int value)
 
int reconnectInterval () const
 
SessionreceiveSpinningTimeoutUsec (int usec)
 
int receiveSpinningTimeout () const
 
SessionsendSpinningTimeoutUsec (int usec)
 
int sendSpinningTimeout () const
 
SessionsupportNextExpectedMsgSeqNum (bool support)
 
bool supportNextExpectedMsgSeqNum () const
 
std::string sslCertificateFile () const
 
SessionsslCertificateFile (const std::string &file)
 
std::string sslPrivateKeyFile () const
 
SessionsslPrivateKeyFile (const std::string &file)
 
Cryptography::SecureString sslPrivateKeyPassword () const
 
SessionsslPrivateKeyPassword (const Cryptography::SecureString &password)
 
SessionsslVerifyPeer (bool verify)
 
bool sslVerifyPeer () const
 
SessionsslCaFile (const std::string &value)
 
std::string sslCaFile () const
 
SessionlogonAsAcceptor ()
 
SessionlogonAsInitiator (const std::string &host, int port, bool setResetSeqNumFlag)
 
SessionlogonAsInitiator (const std::string &host, int port)
 
SessionlogonAsInitiator (const std::string &host, int port, int heartbeatIntervalSec)
 
SessionlogonAsInitiator (const std::string &host, int port, int heartbeatIntervalSec, bool setResetSeqNumFlag)
 
SessionlogonAsInitiator (const std::string &host, int port, int heartbeatIntervalSec, Message *customLogonMsg)
 
SessionlogonAsInitiator (const std::string &host, int port, int heartbeatIntervalSec, Message *customLogonMsg, bool setResetSeqNumFlag)
 
Threading::SharedFuture< void > logonAsInitiatorAsync (const std::string &host, int port, int heartbeatIntervalSec, Message *customLogonMsg, bool setResetSeqNumFlag)
 
Sessionlogout ()
 
Sessionlogout (const std::string &text)
 
Threading::SharedFuture< void > logoutAsync (const std::string &text)
 
Sessionlogout (Message *customLogoutMessage)
 
Sessionlogout (FlatMessage *customLogoutMessage)
 
Threading::SharedFuture< void > logoutAsync (Message *customLogoutMessage)
 
Threading::SharedFuture< void > logoutAsync (FlatMessage *customLogoutMessage)
 
SessionbreakConnection ()
 
Sessionsend (Message *msg)
 
Sessionsend (FlatMessage *msg)
 
Sessionsend (FlatMessage *msg, SessionSendMode::Enum mode)
 
Sessionsend (MessageBatch &msgs, size_t maxPacketSize=(std::numeric_limits< size_t >::max)())
 
Sessionsend (FlatMessageBatch &msgs, size_t maxPacketSize=(std::numeric_limits< size_t >::max)())
 
Sessionsend (FlatMessageBatch &msgs, SessionSendMode::Enum mode, size_t maxPacketSize=(std::numeric_limits< size_t >::max)())
 
SessionsendAsIs (FlatMessage *msg)
 
SessionsendAsIs (FlatMessageBatch &msgs, size_t maxPacketSize=(std::numeric_limits< size_t >::max)())
 
Sessionthrottle ()
 
SessionthrottlingLimit (size_t messagesCount, size_t intervalInMs=1000)
 
SessionwarmUp (FlatMessage *msg, int warmupFlags=0)
 
void preFill (Message &msg) const
 
void preFill (FlatMessage &msg) const
 
void preFill (FlatMessageBatch &msgs) const
 
Sessionshutdown ()
 
 operator const std::string & () const
 
const std::string & storageId () const
 
SessionflushSessionStorage ()
 
std::string counterpartyHost () const
 
std::string counterpartyIpAddress () const
 
size_t counterpartyPort () const
 
const std::string & customKey () const
 
size_t outboundQueueBytes () const
 
int heartbeatIntervalSec () const
 
bool logInboundMessages () const
 
SessionlogInboundMessages (bool value)
 
bool logOutboundMessages () const
 
SessionlogOutboundMessages (bool value)
 
InboundMessageLogFilter inboundMessageLogFilter () const
 
SessioninboundMessageLogFilter (const InboundMessageLogFilter &filter)
 
OutboundMessageLogFilter outboundMessageLogFilter () const
 
SessionoutboundMessageLogFilter (const OutboundMessageLogFilter &filter)
 
bool logBeforeSending () const
 
SessionlogBeforeSending (bool value)
 
SequenceNumber inSeqNum () const
 
SessioninSeqNum (SequenceNumber seqNum)
 
SequenceNumber outSeqNum () const
 
SessionoutSeqNum (SequenceNumber seqNum)
 
SessionresendRequestMaximumRange (int range)
 
int resendRequestMaximumRange () const
 
SessionresendingQueueSize (size_t value)
 
size_t resendingQueueSize () const
 
SessionRole::Enum role () const
 
const std::string & senderCompId () const
 
bool specifyLastMsgSeqNumProcessed () const
 
SessionspecifyLastMsgSeqNumProcessed (bool specify)
 
bool updateSendingTimeField () const
 
SessionupdateSendingTimeField (bool specify)
 
SessionsendingTimeFormat (TimestampFormat::Enum format)
 
const std::string & targetCompId () const
 
Dictionary dictionary () const
 
const OnixS::Threading::CpuIndexesreceivingThreadAffinity () const
 
SessionreceivingThreadAffinity (const OnixS::Threading::CpuIndexes &cpuIndexes)
 
SessionreceivingThreadAffinity (const OnixS::Threading::CpuIndex cpuIndex)
 
const OnixS::Threading::CpuIndexessendingThreadAffinity () const
 
SessionsendingThreadAffinity (const OnixS::Threading::CpuIndexes &cpuIndexes)
 
SessionsendingThreadAffinity (const OnixS::Threading::CpuIndex cpuIndex)
 
int receivingThreadPriority () const
 
SessionreceivingThreadPriority (int priority)
 
int sendingThreadPriority () const
 
SessionsendingThreadPriority (int priority)
 
int receivingThreadPolicy () const
 
SessionreceivingThreadPolicy (int policy)
 
int sendingThreadPolicy () const
 
SessionsendingThreadPolicy (int policy)
 
MessagefindSentMessage (SequenceNumber messageSequenceNumber)
 
FlatMessagefindSentFlatMessage (SequenceNumber messageSequenceNumber)
 
MsgBatchTraits< Message >::MsgBatchType findSentMessages (SequenceNumber beginSequenceNumber, SequenceNumber endSequenceNumber)
 
MsgBatchTraits< FlatMessage >::MsgBatchType findSentFlatMessages (SequenceNumber beginSequenceNumber, SequenceNumber endSequenceNumber)
 
SessionreportNewMessagesWhileWaitingForMissedMessages (bool report)
 
bool reportNewMessagesWhileWaitingForMissedMessages () const
 
SessionsendResendRequestOnEachMessageGap (bool send)
 
bool sendResendRequestOnEachMessageGap () const
 
SessionrequestOnlyMissedMessages (bool request)
 
bool requestOnlyMissedMessages () const
 
SessionconsiderRejectOnResendRequestAsGapFill (bool consider)
 
bool considerRejectOnResendRequestAsGapFill () const
 
SessionignoreLessThanExpectedSequenceNumber (bool ignore)
 
bool ignoreLessThanExpectedSequenceNumber () const
 
SessionresetLocalSequenceNumbersOnLogon (bool reset)
 
bool resetLocalSequenceNumbersOnLogon () const
 
SessionincomingMessageGapQueueMaximumSize (size_t maxSize)
 
size_t incomingMessageGapQueueMaximumSize () const
 
SessionregisterListener (ISessionListener *listener)
 
SessionunregisterListener (ISessionListener *listener)
 
SessionunregisterAllListeners ()
 
SessionresetLocalSequenceNumbers ()
 
SessionresetSeqNumViaLogonExchange ()
 
std::string senderSubId () const
 
SessionsenderSubId (const std::string &value)
 
std::string targetSubId () const
 
SessiontargetSubId (const std::string &value)
 
std::string senderLocationId () const
 
SessionsenderLocationId (const std::string &value)
 
std::string targetLocationId () const
 
SessiontargetLocationId (const std::string &value)
 
SessionvalidateSequenceNumbers (bool value)
 
bool validateSequenceNumbers () const
 
std::string threadNameSuffix () const
 
SessionthreadNameSuffix (const std::string &value)
 
SessionsendTestRequest (const std::string &testReqId="", const TimeSpan &timeout=TimeSpan::zero())
 
SessionsendResendRequest (SequenceNumber beginSeqNumber)
 
SessionsendReject (SequenceNumber refSeqNumber, const std::string &text)
 
Timestamp creationTime () const
 
std::string toString () const
 
OnixS::Sockets::Handle socketHandle ()
 
SessionsocketOptions (const OnixS::Sockets::SocketOptions &options)
 
SessionlogDirectory (const std::string &value)
 
const std::string & logDirectory () const
 
SessionresendTimeout (const TimeSpan &timeout)
 
TimeSpan resendTimeout () const
 
SessionscrambleLogonFields (const ScrambledFields &fields)
 
ScrambledFields scrambleLogonFields () const
 
SessionsendQueueMaxSize (size_t size)
 
size_t sendQueueMaxSize () const
 
SessionconnectTimeout (const TimeSpan &timeout)
 
TimeSpan connectTimeout () const
 
int receiveBufferSize () const
 
SessionreceiveBufferSize (int value)
 
int sendBufferSize () const
 
SessionsendBufferSize (int value)
 
void scheduleShrinkToFit ()
 
SessionproxySettings (const ProxySettings &settings)
 
ProxySettings proxySettings () const
 
MessageMode::Enum messageMode () const
 
void messageMode (MessageMode::Enum mode)
 

Static Public Member Functions

static bool checkWarmupFlags (int warmupFlags, unsigned short baseListenPort=5000, const std::string &localNetworkInterface="127.0.0.1")
 

Static Public Attributes

static const unsigned int ResendRequestMaximumRangeNoLimit
 
static const int UndefinedPriorityAndPolicy
 
static const OnixS::Sockets::Handle InvalidSocketHandle
 

Friends

class Engine::Impl
 

Detailed Description

Definition at line 97 of file Session.h.

Member Typedef Documentation

Definition at line 862 of file Session.h.

typedef std::set<std::string> InboundMessageLogFilter

Incoming message types to be filtered out from the logs.

Definition at line 1088 of file Session.h.

typedef std::pair<unsigned short, unsigned short> LocalPortRange

Local port range type.

Definition at line 299 of file Session.h.

Definition at line 861 of file Session.h.

typedef std::set<std::string> OutboundMessageLogFilter

Outgoing message types to be filtered out from the logs.

Definition at line 1107 of file Session.h.

typedef std::vector<Tag> ScrambledFields

Collection of scrambled tags.

Definition at line 1672 of file Session.h.

Definition at line 863 of file Session.h.

Constructor & Destructor Documentation

Session ( const std::string &  senderCompId,
const std::string &  targetCompId,
const Dictionary dictionary,
ISessionListener listener,
SessionStorageType::Enum  storageType = SessionStorageType::FileBased,
ISessionStorage storage = ONIXS_FIXENGINE_NULLPTR 
)

Creates the FIX Session.

Parameters
senderCompIdAssigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages).
targetCompIdAssigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages).
dictionaryFIX dictionary to be used by the session.
listenerInstance of ISessionListener interface which will receive and handle miscellaneous Session events.
storageTypeSession storage type.
storagePluggable Session storage.
Session ( ISessionReactor reactor,
const std::string &  senderCompId,
const std::string &  targetCompId,
const Dictionary dictionary,
ISessionListener listener,
SessionStorageType::Enum  storageType = SessionStorageType::FileBased,
ISessionStorage storage = ONIXS_FIXENGINE_NULLPTR 
)

Creates the FIX Session.

Parameters
reactorAn instance of an externally managed reactor.
senderCompIdAssigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages).
targetCompIdAssigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages).
dictionaryFIX dictionary to be used by the session.
listenerInstance of ISessionListener interface which will receive and handle miscellaneous Session events.
storageTypeSession storage type.
storagePluggable Session storage.
Session ( const std::string &  senderCompId,
const std::string &  targetCompId,
const Dictionary dictionary,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
SessionStorageType::Enum  storageType = SessionStorageType::FileBased,
ISessionStorage storage = ONIXS_FIXENGINE_NULLPTR 
)

Creates the FIX Session.

Parameters
senderCompIdAssigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages).
targetCompIdAssigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages).
dictionaryFIX dictionary to be used by the session.
keepSequenceNumbersAfterLogoutOption to keep sequence numbers after the exchange of Logout (MsgType=5) messages.
listenerInstance of ISessionListener interface which will receive and handle miscellaneous Session events.
storageTypeSession storage type.
storagePluggable Session storage.
Session ( ISessionReactor reactor,
const std::string &  senderCompId,
const std::string &  targetCompId,
const Dictionary dictionary,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
SessionStorageType::Enum  storageType = SessionStorageType::FileBased,
ISessionStorage storage = ONIXS_FIXENGINE_NULLPTR 
)

Creates the FIX Session.

Parameters
reactorAn instance of an externally managed reactor.
senderCompIdAssigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages).
targetCompIdAssigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages).
dictionaryFIX dictionary to be used by the session.
keepSequenceNumbersAfterLogoutOption to keep sequence numbers after the exchange of Logout (MsgType=5) messages.
listenerInstance of ISessionListener interface which will receive and handle miscellaneous Session events.
storageTypeSession storage type.
storagePluggable Session storage.
Session ( const std::string &  senderCompId,
const std::string &  targetCompId,
const Dictionary dictionary,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
const std::string &  customSessionKey,
SessionStorageType::Enum  storageType = SessionStorageType::FileBased,
ISessionStorage storage = ONIXS_FIXENGINE_NULLPTR 
)

Creates the FIX Session.

Parameters
senderCompIdAssigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages).
targetCompIdAssigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages).
dictionaryFIX dictionary to be used by the session.
keepSequenceNumbersAfterLogoutOption to keep sequence numbers after the exchange of Logout (MsgType=5) messages.
listenerInstance of ISessionListener interface which will receive and handle miscellaneous Session events.
customSessionKeyCustom key that can be used to distinguish sessions with the same values of the SenderCompID, TargetCompID and the FIX Protocol version.
storageTypeSession storage type.
storagePluggable Session storage.
Session ( ISessionReactor reactor,
const std::string &  senderCompId,
const std::string &  targetCompId,
const Dictionary dictionary,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
const std::string &  customSessionKey,
SessionStorageType::Enum  storageType = SessionStorageType::FileBased,
ISessionStorage storage = ONIXS_FIXENGINE_NULLPTR 
)

Creates the FIX Session.

Parameters
reactorAn instance of an externally managed reactor.
senderCompIdAssigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages).
targetCompIdAssigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages).
dictionaryFIX dictionary to be used by the session.
keepSequenceNumbersAfterLogoutOption to keep sequence numbers after the exchange of Logout (MsgType=5) messages.
listenerInstance of ISessionListener interface which will receive and handle miscellaneous Session events.
customSessionKeyCustom key that can be used to distinguish sessions with the same values of the SenderCompID, TargetCompID and the FIX Protocol version.
storageTypeSession storage type.
storagePluggable Session storage.
~Session ( )

Destructor.

Member Function Documentation

Session& breakConnection ( )

Terminates the FIX connection in the non-graceful way (without the exchange of Logout (MsgType=5) messages).

Note
This call is thread-safe.
static bool checkWarmupFlags ( int  warmupFlags,
unsigned short  baseListenPort = 5000,
const std::string &  localNetworkInterface = "127.0.0.1" 
)
static

Returns 'true' if given flags work as expected and a real data is not sent to the wire, otherwise - 'false'.

Parameters
warmupFlagsWarmup flags for checking.
baseListenPortBase listen port to use during the checking.
localNetworkInterfaceIP address to bind for listen and outgoing test sockets.
Note
This call is thread-safe.
Session& clearOutboundQueue ( bool  removeFragmentedPacket = false)

Removes all messages from the outbound queue.

Parameters
removeFragmentedPacket- specifies whether to remove last packet which is partly sent.
Note
This call is thread-safe.
Session& connectTimeout ( const TimeSpan timeout)

Sets the socket TCP connect timeout.

Note
This call is thread-safe.
TimeSpan connectTimeout ( ) const

Returns the socket TCP connect timeout (30 sec by default).

Note
This call is thread-safe.
Session& considerRejectOnResendRequestAsGapFill ( bool  consider)

By default if the "Session Level Reject" message is received in replay to the "Resend Request" then this is considered as a serious problem and the FIX connection will be closed.

This property allows to change this behavior and consider the "Session Level Reject" on the "Resend Request" as the "Sequence Reset Gap Fill" message.

bool considerRejectOnResendRequestAsGapFill ( ) const

Returns 'true' if the "Reject" on the "Resend Request" is considered as the "Sequence Reset Gap Fill" message, otherwise - 'false'.

std::string counterpartyHost ( ) const

Returns the counterparty host name.

Note
The method performs a DNS request for the first time. Therefore, it can block the thread execution for a long time until the DNS request is completed.
This call is thread-safe.
std::string counterpartyIpAddress ( ) const

Returns the counterparty address.

Note
This call is thread-safe.
size_t counterpartyPort ( ) const

Returns the counterparty port number.

Note
This call is thread-safe.
Timestamp creationTime ( ) const

Returns the time when logical session was created or last sequence number reset operation was performed.

Originating value is extracted from attached storage using ISessionStorage::sessionCreationTime() method.

Note
This call is thread-safe.
const std::string& customKey ( ) const

Returns Session's Custom Key.

Note
This call is thread-safe.
Dictionary dictionary ( ) const

Instance of the FIX dictionary or standard FIX messages dictionary which is used by the session.

EncryptionMethod::Enum encryptionMethod ( ) const

Returns the current encryption method.

Note
This call is thread-safe.
Session& encryptionMethod ( EncryptionMethod::Enum  newEncryptionMethod)

Sets the encryption method.

Note
This call is thread-safe.
FlatMessage* findSentFlatMessage ( SequenceNumber  messageSequenceNumber)
MsgBatchTraits<FlatMessage>::MsgBatchType findSentFlatMessages ( SequenceNumber  beginSequenceNumber,
SequenceNumber  endSequenceNumber 
)
Message* findSentMessage ( SequenceNumber  messageSequenceNumber)

Returns the sent message if it can be found by the given message sequence number, otherwise - NULL.

Note
The returned message is owned by the application and should be released after usage.
This call is thread-safe.
MsgBatchTraits<Message>::MsgBatchType findSentMessages ( SequenceNumber  beginSequenceNumber,
SequenceNumber  endSequenceNumber 
)

Returns an array of sent messages if it can be found by the given message sequence number range, otherwise - empty array.

Note
The returned messages are owned by the application and should be released after usage.
This call is thread-safe.
Session& flushSessionStorage ( )

Flushes all internal buffers of the underlying storage.

Note
This call is thread-safe.
int heartbeatIntervalSec ( ) const

Returns the Heartbeat interval (in seconds).

Session& ignoreLessThanExpectedSequenceNumber ( bool  ignore)

By default if the incoming message has a sequence number less than expected and the PossDupFlag is not set, it indicates a serious error and leads to FIX connection closing.

This property allows to change this behavior and consider the sequence number of the incoming message, which less than expected, as an expected one.

bool ignoreLessThanExpectedSequenceNumber ( ) const

Returns 'true' if the sequence number of the incoming message, which less than expected, is considered as an expected one, otherwise - 'false'.

InboundMessageLogFilter inboundMessageLogFilter ( ) const

Returns incoming message types to be filtered out from the logs.

Note
This call is thread-safe.
Session& inboundMessageLogFilter ( const InboundMessageLogFilter filter)

Sets incoming message types to be filtered out from the logs.

Note
This call is thread-safe.
Session& incomingMessageGapQueueMaximumSize ( size_t  maxSize)

If requestOnlyMissedMessages option is true and the sequence number of an incoming FIX message greater that expected then the resend functionality is run and this incoming message is stored in the incoming message gap queue for further processing.

This property allows to set maximum size of that queue.

size_t incomingMessageGapQueueMaximumSize ( ) const

Returns maximum size of the incoming message gap queue.

By default, the value equal to 1000.

SequenceNumber inSeqNum ( ) const

Returns the expected sequence number of the next incoming message.

Note
This call is thread-safe.
Session& inSeqNum ( SequenceNumber  seqNum)

Sets the expected sequence number of the next incoming message.

Note
This call is thread-safe.
int listenPort ( ) const

Returns the port to listen on for incoming FIX Connections in Acceptor mode.

Note
This call is thread-safe.
Session& listenPort ( int  listenPort)

Sets the port to listen on for incoming FIX Connections in Acceptor mode.

Note
This call is thread-safe.
std::string localNetworkInterface ( ) const

Returns the local network interface from which you intend to send and receive data.

Note
This call is thread-safe.
Session& localNetworkInterface ( const std::string &  localNetworkInterface)

Sets the local network interface from which you intend to send and receive data.

Note
This call is thread-safe.
unsigned short localPort ( ) const

Returns the local port from which you intend to send and receive data.

Note
This call is thread-safe.
LocalPortRange localPortRange ( ) const

Returns the local port range, the first available port from this range will be used to send and receive data.

Note
This call is thread-safe.
Session& localPortRange ( LocalPortRange  portRange)

Sets the local port range, the first available port from this range will be used to send and receive data.

Note
This call is thread-safe.
bool logBeforeSending ( ) const

Returns 'true' if outbound messages are logged before sending, otherwise - 'false'.

By default, the value is 'true'.

Note
This call is thread-safe.
Session& logBeforeSending ( bool  value)

Option to switch on/off logging of outbound messages before/after sending.

Note
This call is thread-safe.
Session& logDirectory ( const std::string &  value)

Inbound and outbound messages, session's state data are stored in this directory.

Note
This method can be called only when the session is disconnected.
Exceptions
Exceptionif the session state is not Disconnected.
Note
This call is thread-safe.
const std::string& logDirectory ( ) const

Inbound and outbound messages, session's state data are stored in this directory.

Note
This call is thread-safe.
bool logInboundMessages ( ) const

Returns 'true' if inbound messages are logged, otherwise - 'false'.

By default, the value is 'true'.

Session& logInboundMessages ( bool  value)

Option to log inbound messages.

Session& logonAsAcceptor ( )

Establishes the FIX Connection as Acceptor.

Acceptor is the receiving party of the FIX session. It listens for the incoming connection on the pre-defined port. The acceptor has responsibility to perform first level authentication and formally declare the connection request "accepted" through transmission of an acknowledgment Logon message.

Note
This call is thread-safe.
Session& logonAsInitiator ( const std::string &  host,
int  port,
bool  setResetSeqNumFlag 
)

Establishes FIX Connection as Initiator using the ResetSeqNumFlag (tag 141) field.

Initiator establishes the telecommunications link and initiates the session via transmission of the initial Logon message. The method is blocked until the acknowledgment Logon message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval.

Note
This call is thread-safe.
Session& logonAsInitiator ( const std::string &  host,
int  port 
)

Establishes FIX Connection as Initiator.

Initiator establishes the telecommunications link and initiates the session via transmission of the initial Logon message. The method is blocked until the acknowledgment Logon message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval.

Note
This call is thread-safe.
Session& logonAsInitiator ( const std::string &  host,
int  port,
int  heartbeatIntervalSec 
)

Establishes FIX Connection as Initiator using the given Heartbeat interval (seconds).

The method is blocked until the acknowledgment Logon message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval.

Note
This call is thread-safe.
Session& logonAsInitiator ( const std::string &  host,
int  port,
int  heartbeatIntervalSec,
bool  setResetSeqNumFlag 
)

Establishes FIX Connection as Initiator using the given Heartbeat interval (seconds) and the ResetSeqNumFlag(141) field.

The method is blocked until the acknowledgment Logon message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval.

Note
This call is thread-safe.
Session& logonAsInitiator ( const std::string &  host,
int  port,
int  heartbeatIntervalSec,
Message customLogonMsg 
)

Establishes FIX Connection as Initiator using the custom Logon message.

The method is blocked until the acknowledgment Logon message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval.

Note
This call is thread-safe.
Session& logonAsInitiator ( const std::string &  host,
int  port,
int  heartbeatIntervalSec,
Message customLogonMsg,
bool  setResetSeqNumFlag 
)

Establishes FIX Connection as Initiator using the custom Logon message and the ResetSeqNumFlag(141) field.

The method is blocked until the acknowledgment Logon message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval.

Note
This call is thread-safe.
Threading::SharedFuture<void> logonAsInitiatorAsync ( const std::string &  host,
int  port,
int  heartbeatIntervalSec,
Message customLogonMsg,
bool  setResetSeqNumFlag 
)

Establishes FIX Connection asynchronously as Initiator using the custom Logon message and the ResetSeqNumFlag(141) field.

The method returns immediately without waiting the acknowledgment Logon message. Returns the SharedFuture object that can be used to wait for the result of the asynchronous logon method.

Note
This call is thread-safe.
Session& logout ( )

Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method is blocked until the acknowledgment Logout message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval or, in case there are no incoming messages, heartbeat interval plus reasonable transmission time.

Note
This call is thread-safe.
Session& logout ( const std::string &  text)

Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method is blocked until the acknowledgment Logout message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval or, in case there are no incoming messages, heartbeat interval plus reasonable transmission time.

Parameters
textFree format text string that is sent to the counterparty in the Text(58) field of the initial Logout message.
Note
This call is thread-safe.
Session& logout ( Message customLogoutMessage)

Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method is blocked until the acknowledgment Logout message is received or the timeout expired. The timeout value is equal to the triple heartbeat interval or, in case there are no incoming messages, heartbeat interval plus reasonable transmission time.

Parameters
customLogoutMessageCustom Logout message that is sent to the counterparty.
Note
This call is thread-safe.
Session& logout ( FlatMessage customLogoutMessage)
Threading::SharedFuture<void> logoutAsync ( const std::string &  text)

Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method returns immediately without waiting the acknowledgment Logout message. Returns the SharedFuture object that can be used to wait for the result of the asynchronous logout method.

Parameters
textFree format text string that is sent to the counterparty in the Text(58) field of the initial Logout message.
Note
This call is thread-safe.
Threading::SharedFuture<void> logoutAsync ( Message customLogoutMessage)

Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method returns immediately without waiting the acknowledgment Logout message. Returns the SharedFuture object that can be used to wait for the result of the asynchronous logout method.

Parameters
customLogoutMessageCustom Logout message that is sent to the counterparty.
Note
This call is thread-safe.
Threading::SharedFuture<void> logoutAsync ( FlatMessage customLogoutMessage)
bool logOutboundMessages ( ) const

Returns 'true' if outbound messages are logged, otherwise - 'false'.

By default, the value is 'true'.

Session& logOutboundMessages ( bool  value)

Option to log outbound messages.

unsigned messageGrouping ( ) const

Returns the number of messages that should be written to the outgoing TCP buffer together.

When it is not set, the corresponding Engine setting's value is used (0 by default).

Session& messageGrouping ( unsigned  numberOfMessagesToGroup)

Sets the number of messages that should be written to the outgoing TCP buffer together.

MessageMode::Enum messageMode ( ) const

Returns the session message mode.

void messageMode ( MessageMode::Enum  mode)

Sets the session message mode.

operator const std::string & ( ) const

Returns the text description of this session.

Note
This call is thread-safe.
OutboundMessageLogFilter outboundMessageLogFilter ( ) const

Returns outgoing message types to be filtered out from the logs.

Note
This call is thread-safe.
Session& outboundMessageLogFilter ( const OutboundMessageLogFilter filter)

Sets outgoing message types to be filtered out from the logs.

Note
This call is thread-safe.
size_t outboundQueueBytes ( ) const

Returns the total number of bytes in the outbound queue.

Note
This call is thread-safe.
SequenceNumber outSeqNum ( ) const

Returns the sequence number of the next outgoing message.

Note
This call is thread-safe.
Session& outSeqNum ( SequenceNumber  seqNum)

Sets the sequence number of the next outgoing message.

Note
This call is thread-safe.
void preFill ( Message msg) const

Pre-fills session-level fields that are constant during the session's lifetime - SenderCompId, TargetCompId, SenderLocationId, TargetLocationID, SenderSubID, TargetSubID.

Note
This call is thread-safe.
void preFill ( FlatMessage msg) const

Pre-fills the following fields in the message or messages batch for sending as is:

  • Session-level fields that are constant during the session's lifetime - SenderCompId, TargetCompId, SenderLocationId, TargetLocationI, SenderSubID, TargetSubID.
  • MsgSeqNum field in accordance with the session outgoing sequence number.
  • SendingTime field.
  • BodyLength and CheckSum fields.
Note
This call is thread-safe.
void preFill ( FlatMessageBatch msgs) const
Session& proxySettings ( const ProxySettings settings)

Sets HTTP proxy settings.

ProxySettings proxySettings ( ) const

Returns HTTP proxy settings.

int reasonableTransmissionTime ( ) const

Returns the reasonable transmission time as % from heartbeatIntervalSec value.

When it is not set, the corresponding Engine setting's value is used (20% by default).

Session& reasonableTransmissionTime ( int  value)

Sets the reasonable transmission time as % from heartbeatIntervalSec value.

When either end of the connection has not received any data for (heartbeatIntervalSec() * (100 + reasonableTransmissionTime())/100) seconds, it will transmit a Test Request message.

If there is still no Heartbeat message received after (heartbeatIntervalSec * (100 + reasonableTransmissionTime())/100) seconds then the connection should be considered lost and corrective action be initiated.

int receiveBufferSize ( ) const

Returns the size of the TCP buffer allocated to the FIX connection for receiving data.

If '-1' then the default operating system value is used.

Note
This call is thread-safe.
Session& receiveBufferSize ( int  value)

Sets the size of the TCP buffer allocated to the FIX connection for receiving data.

If '-1' then the default operating system value is used.

Note
This call is thread-safe.
int receiveSpinningTimeout ( ) const

Returns the current receive spinning timeout value (in microseconds).

By default, the value is zero and receive spinning is not used.

Session& receiveSpinningTimeoutUsec ( int  usec)

Sets the non-blocking receive spinning timeout (in microseconds) before the receiving thread enters into the blocking wait mode.

Note
Should not be greater than 1 sec (minimal heartbeatIntervalSec()).
const OnixS::Threading::CpuIndexes& receivingThreadAffinity ( ) const

Returns the CPU affinity of the receiving thread.

Session& receivingThreadAffinity ( const OnixS::Threading::CpuIndexes cpuIndexes)

Sets the CPU affinity of the receiving thread.

Session& receivingThreadAffinity ( const OnixS::Threading::CpuIndex  cpuIndex)

Sets the CPU affinity of the receiving thread to a CPU.

int receivingThreadPolicy ( ) const

Returns the scheduling policy of the receiving thread.

Session& receivingThreadPolicy ( int  policy)

Sets the scheduling policy of the receiving thread.

int receivingThreadPriority ( ) const

Returns the priority of the receiving thread.

Session& receivingThreadPriority ( int  priority)

Sets the priority of the receiving thread.

Session& reconnectAttempts ( int  value)

Sets the number of attempts to restore the FIX connection.

int reconnectAttempts ( ) const

Returns the number of attempts to restore the FIX connection.

When it is not set, the corresponding Engine setting's value is used (3 by default).

Session& reconnectInterval ( int  value)

Sets the time interval between the attempts to restore the FIX connection (in seconds).

int reconnectInterval ( ) const

Returns the time interval between the attempts to restore the FIX connection (in seconds).

When it is not set, the corresponding Engine setting's value is used (180 by default).

Session& registerListener ( ISessionListener listener)

Registers the Session listener.

Exceptions
Exceptionif the listener is already registered.
Session& reportNewMessagesWhileWaitingForMissedMessages ( bool  report)

When the message gap is detected the "Resend Request" FIX Message is sent and Session state is changed to "AwaitReplyOnResendRequest".

By default in this state the incoming new messages (without the PossDupFlag (tag #43) flag) are ignored because we expect them to be re-sent later again with the PossDupFlag flag.

This property allows to change this behavior and report the new messages anyway.

Note
In this mode messages could be reported out of the original order: e.g. MsgSeqNum could be: 3 (original), 4 (original), 2 (PossDupFlag='Y'), 3 (PossDupFlag='Y'), 4 (PossDupFlag='Y') and some messages could be received two times: first time without PossDupFlag='Y' and second time - with this flag.
bool reportNewMessagesWhileWaitingForMissedMessages ( ) const

Returns 'true' if the new messages are reported even when the message gap is detected and the reply on the "Resend Request" message is expected, otherwise - 'false'.

Session& requestOnlyMissedMessages ( bool  request)

By default the "Resend Request" message requests all messages begin from the first missed one.

This property allows to change this behavior and request only missed messages.

Note
This method can be called only when the session is disconnected.
bool requestOnlyMissedMessages ( ) const

Returns 'true' if the "Resend Request" message requests only missed messages, otherwise - 'false'.

Session& resendingQueueSize ( size_t  value)

Sets the number of sent messages that are available for resending on counterparty's Resend Request <2> message.

Note
This call is thread-safe.
size_t resendingQueueSize ( ) const

Returns the number of sent messages that are available for resending on counterparty's Resend Request <2> message.

By default value is -1 that means that the corresponding Engine setting's value is used ('1000' by default).

Note
This call is thread-safe.
Session& resendRequestMaximumRange ( int  range)

Sets the maximum number of messages to be requested in one Resend Request (MsgType=2) message.

See also
Session::ResendRequestMaximumRangeNoLimit.
Parameters
rangeMaximum number of messages to be requested in one Resend Request (MsgType=2) message. Cannot be negative.
Note
This call is thread-safe.
int resendRequestMaximumRange ( ) const

Returns the maximum number of messages to be requested in one Resend Request (MsgType=2) message.

By default, the value is zero (no limit).

See also
Session::ResendRequestMaximumRangeNoLimit.
Note
This call is thread-safe.
Session& resendTimeout ( const TimeSpan timeout)

Sets the timeout during which counterparty should send a reply to the "Resend Request" message.

If a counterparty does not reply or reply incorrectly during this timeout, then the ISessionListener::onWarning is called. By default, the resend request timeout equal to zero, which means an infinite timeout.

Note
The resend timeout is checked when an incoming message is received or when the receive timeout is elapsed. Therefore, the actual timeout can be greater than the specified one or can be rounded to the value equal to the heartbeat interval + reasonable transmission time.
This call is thread-safe.
TimeSpan resendTimeout ( ) const

Returns the timeout during which counterparty should send a reply to the "Resend Request" message.

Note
This call is thread-safe.
Session& resetLocalSequenceNumbers ( )

Backups the current log files and resets the local sequence numbers to 1.

Note
This method can be called only when the session is disconnected.
This call is thread-safe.
Session& resetLocalSequenceNumbersOnLogon ( bool  reset)

Option to automatically reset the local sequence numbers to 1 during every logon.

bool resetLocalSequenceNumbersOnLogon ( ) const

Returns 'true' if local sequence numbers are reset automatically to 1 during every logon, otherwise - 'false'.

Session& resetSeqNumViaLogonExchange ( )

Sends a Logon message with the ResetSeqNumFlag set.

Note
This call is thread-safe.
SessionRole::Enum role ( ) const

Returns the session role.

Note
This call is thread-safe.
void scheduleShrinkToFit ( )

Schedule the memory usage optimization.

The session will perform the actual memory usage optimization in two phases:

  • After receiving and processing the next incoming session-level message (receiving part).
  • Before sending the next outgoing session-level message (sending part).
Session& scrambleLogonFields ( const ScrambledFields fields)

Sets scrambled fields in the Logon(A) message, in the session storage, for security reasons.

Note
This call is thread-safe.
ScrambledFields scrambleLogonFields ( ) const

Returns scrambled fields in the Logon(A) message.

Session& send ( Message msg)

Sends the message to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in replay to the resend request when the connection is established with the counterparty and the sequence numbers mismatch is detected.

Note
This call is asynchronous.
This call is thread-safe.
Session& send ( FlatMessage msg)
Session& send ( FlatMessage msg,
SessionSendMode::Enum  mode 
)

Performs sending via a specific API (e.g.

zero-copy send) of the message to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in replay to the resend request when the connection is established with the counterparty and the sequence numbers mismatch is detected.

Note
This call is asynchronous.
This call is thread-safe.
Session& send ( MessageBatch msgs,
size_t  maxPacketSize = (std::numeric_limits< size_t >::max)() 
)

Sends messages in a batch to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in replay to the resend request when the connection is established with the counterparty and the sequence numbers mismatch is detected.

Parameters
msgsMessage batch to send.
maxPacketSizeThe maximum number of bytes written to the socket's send buffer together. This parameter could be used to reduce the probability that the operating system will fragment a FIX message across multiple TCP packets.
Note
The message batch should not be empty and maxPacketSize parameter should not be less than any message size in the batch. Otherwise, the method call can produce an error and the session can close the connection.
This call is asynchronous.
This call is thread-safe.
Session& send ( FlatMessageBatch msgs,
size_t  maxPacketSize = (std::numeric_limits< size_t >::max)() 
)
Session& send ( FlatMessageBatch msgs,
SessionSendMode::Enum  mode,
size_t  maxPacketSize = (std::numeric_limits< size_t >::max)() 
)

Performs sending via a specific API (e.g.

zero-copy send) of messages to the counterparty.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in replay to the resend request when the connection is established with the counterparty and the sequence numbers mismatch is detected.

Note
This call is asynchronous.
This call is thread-safe.
Session& sendAsIs ( FlatMessage msg)

Sends serialized message(s) to the counterparty without any fields updating.

One can use the preFill method to prepare message(s) for sending.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in replay to the resend request when the connection is established with the counterparty and the sequence numbers mismatch is detected.

Note
This call is asynchronous.
This call is thread-safe.
Session& sendAsIs ( FlatMessageBatch msgs,
size_t  maxPacketSize = (std::numeric_limits< size_t >::max)() 
)

Sends serialized message(s) to the counterparty without any fields updating.

One can use the preFill method to prepare message(s) for sending.

As soon as a session is created, it is possible to start sending messages via the session. If the session is not established, the messages are stored in the session storage and will be sent in replay to the resend request when the connection is established with the counterparty and the sequence numbers mismatch is detected.

Parameters
msgsMessage batch to send.
maxPacketSizeThe maximum number of bytes written to the socket's send buffer together. This parameter could be used to reduce the probability that the operating system will fragment a FIX message across multiple TCP packets.
Note
The message batch should not be empty and maxPacketSize parameter should not be less than any message size in the batch. Otherwise, the method call can produce an error and the session can close the connection.
This call is asynchronous.
This call is thread-safe.
int sendBufferSize ( ) const

Returns the size of the TCP buffer allocated to the FIX connection for sending data.

If '-1' then the default operating system value is used.

Note
This call is thread-safe.
Session& sendBufferSize ( int  value)

Sets the size of the TCP buffer allocated to the FIX connection for sending data.

If '-1' then the default operating system value is used.

Note
This call is thread-safe.
const std::string& senderCompId ( ) const

Returns the assigned value used to identify firm sending message (the SenderCompID (tag 49) field value in outgoing messages).

Note
This call is thread-safe.
std::string senderLocationId ( ) const

Returns the SenderLocationID (tag 142) field values for all outgoing messages.

Note
This call is thread-safe.
Session& senderLocationId ( const std::string &  value)

Sets the SenderLocationID (tag 142) field values for all outgoing messages.

Note
This call is thread-safe.
std::string senderSubId ( ) const

Returns the SenderSubID (tag 50) field values for all outgoing messages.

Note
This call is thread-safe.
Session& senderSubId ( const std::string &  value)

Sets the SenderSubID (tag 50) field values for all outgoing messages.

Note
This call is thread-safe.
const OnixS::Threading::CpuIndexes& sendingThreadAffinity ( ) const

Returns the CPU affinity of the sending thread.

Session& sendingThreadAffinity ( const OnixS::Threading::CpuIndexes cpuIndexes)

Sets the CPU affinity index of the sending thread.

Session& sendingThreadAffinity ( const OnixS::Threading::CpuIndex  cpuIndex)

Sets the CPU affinity index of the sending thread a CPU.

int sendingThreadPolicy ( ) const

Returns the scheduling policy of the sending thread.

Session& sendingThreadPolicy ( int  policy)

Sets the scheduling policy of the sending thread.

int sendingThreadPriority ( ) const

Returns the priority of the sending thread.

Session& sendingThreadPriority ( int  priority)

Sets the priority of the sending thread.

Session& sendingTimeFormat ( TimestampFormat::Enum  format)

Sets the time format of SendingTime of every sent message.

By default, the YYYYMMDDHHMMSSMsec format is used.

bool sendLogoutOnException ( ) const

Returns the option that controls whether to send the logout message before dropping the telecommunication link, in case of exception.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& sendLogoutOnException ( bool  sendLogoutOnException)

Sets value of the option that controls whether to send the logout message before dropping the telecommunication link, in case of exception.

Session& sendQueueMaxSize ( size_t  size)

Sets the send queue maximum size in bytes.

The TCP connection will be disconnected when an overflow issue happens and the sending queue size exceeds this size.

Note
This call is thread-safe.
size_t sendQueueMaxSize ( ) const

Returns the send queue maximum size in bytes.

When it is not set, the corresponding Engine setting's value is used (0.5 GB by default).

Session& sendReject ( SequenceNumber  refSeqNumber,
const std::string &  text 
)

Sends the Reject (MsgType 3) message.

Parameters
refSeqNumberMsgSeqNum of rejected message.
textMessage to explain the reason for rejection.
Note
This call is thread-safe.
Session& sendResendRequest ( SequenceNumber  beginSeqNumber)

Sends the Resend Request (MsgType 2) message.

Note
Normally, "Resend Request" message is sent automatically. This method allows to simulate a sequence gap by sending this message manually. This can be needed in some venue specific cases. This method should not be used in the normal work.
Parameters
beginSeqNumberBegin sequence number of the first requested message in the range.
Note
This call is thread-safe.
Session& sendResendRequestOnEachMessageGap ( bool  send)

By default the "Resend Request" message is sent only once - when the first gap is detected.

This property allows to change this behavior and send the "Resend Request" message on each detected message sequence number gap.

bool sendResendRequestOnEachMessageGap ( ) const

Returns 'true' if the "Resend Request" message is sent on each detected message sequence number gap, otherwise - 'false'.

int sendSpinningTimeout ( ) const

Returns the current send spinning timeout value (in microseconds).

By default, the value is zero and send spinning is not used.

Session& sendSpinningTimeoutUsec ( int  usec)

Sets the send spinning timeout (in microseconds) of the Session::send(..) method to wait for the socket sending buffer availability in the spin loop mode before placing the message to the outgoing queue (to be sent later by the sending thread).

Note
Should not be greater than 1 sec (minimal heartbeatIntervalSec()).
Session& sendTestRequest ( const std::string &  testReqId = "",
const TimeSpan timeout = TimeSpan::zero() 
)

Sends the Test Request (MsgType 1) message.

If the timeout is specified, the method blocks until the heartbeat message is received from the counterparty or timeout ended.

Parameters
testReqIdThe identifier included in Test Request (MsgType 1) message to be returned in resulting Heartbeat (MsgType 0) message from the counterparty.
timeoutThe maximum interval to wait until the reply is received from the counterparty.
Note
This call is thread-safe.
Session& shutdown ( )

Shutdowns the session.

Note
This call is thread-safe.
OnixS::Sockets::Handle socketHandle ( )

Returns the socket handle which the session uses to transmit FIX data.

Note
This call is thread-safe.
Session& socketOptions ( const OnixS::Sockets::SocketOptions options)

Additional options, which should be set to the session socket when it is created.

For initiator sessions, options are set before socket connect(..) call. For acceptor sessions, options are set after socket accept(..) call.

bool specifyLastMsgSeqNumProcessed ( ) const

Returns 'true' if the LastMsgSeqNumProcessed (tag 369) field is specified on every message sent, otherwise - 'false'.

By default, the option value is false.

Session& specifyLastMsgSeqNumProcessed ( bool  specify)

Option to specify the LastMsgSeqNumProcessed (tag 369) field on every message sent.

Useful for detecting a backlog with a counterparty.

Note
Option does not affect the FlatMessage send.
Session& sslCaFile ( const std::string &  value)

Sets the path to the trusted certification authority certificate file in (Privacy Enhanced Mail) Base64 encoded (.pem) format.

Note
This call is thread-safe.
std::string sslCaFile ( ) const

Returns the path to trusted certification authority certificate file in (Privacy Enhanced Mail) Base64 encoded (.pem) format.

Note
This call is thread-safe.
std::string sslCertificateFile ( ) const

Returns the SSL certificate file.

Note
This call is thread-safe.
Session& sslCertificateFile ( const std::string &  file)

Sets the SSL certificate file.

Note
Only the (Privacy Enhanced Mail) Base 64 Encoded (.pem) SSL certificates are supported.
This call is thread-safe.
std::string sslPrivateKeyFile ( ) const

Returns the SSL private key file.

Note
This call is thread-safe.
Session& sslPrivateKeyFile ( const std::string &  file)

Sets the SSL private key file.

Note
Only the (Privacy Enhanced Mail) Base 64 Encoded (.pem) SSL certificates are supported.
This call is thread-safe.
Cryptography::SecureString sslPrivateKeyPassword ( ) const

Returns the SSL private key file password.

Note
This call is thread-safe.
Session& sslPrivateKeyPassword ( const Cryptography::SecureString password)

Sets the SSL private key file password.

Note
This call is thread-safe.
Session& sslVerifyPeer ( bool  verify)

Set option to request peer certificates and perform the certificate verification.

Note
This call is thread-safe.
bool sslVerifyPeer ( ) const

Returns option to request peer certificates and perform the certificate verification.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Note
This call is thread-safe.
SessionState::Enum state ( ) const

Returns Session's state.

Note
This call is thread-safe.
const std::string& storageId ( ) const

Returns the underlying storage Id.

Note
This call is thread-safe.
Session& supportNextExpectedMsgSeqNum ( bool  support)

Sets NextExpectedMsgSeqNum field (tag 789) support in Logon messages.

bool supportNextExpectedMsgSeqNum ( ) const

Returns 'true' if NextExpectedMsgSeqNum field (tag 789) is supported in Logon messages, otherwise - 'false'.

By default, the option value is false.

const std::string& targetCompId ( ) const

Returns the Assigned value used to identify receiving firm (the TargetCompID (tag 56) field value in outgoing messages).

Note
This call is thread-safe.
std::string targetLocationId ( ) const

Returns the TargetLocationID (tag 143) field values for all outgoing messages.

Note
This call is thread-safe.
Session& targetLocationId ( const std::string &  value)

Sets the TargetLocationID (tag 143) field values for all outgoing messages.

Note
This call is thread-safe.
std::string targetSubId ( ) const

Returns the TargetSubID (tag 57) field values for all outgoing messages.

Note
This call is thread-safe.
Session& targetSubId ( const std::string &  value)

Sets the TargetSubID (tag 57) field values for all outgoing messages.

Note
This call is thread-safe.
bool tcpNoDelayOption ( ) const

Returns option to improve latency at the expense of message throughput (TCP_NODELAY socket option).

When it is not set, the corresponding Engine setting's value is used ('true' by default).

Session& tcpNoDelayOption ( bool  improveLatency = true)

Sets value of option to improve latency at the expense of message throughput (TCP_NODELAY socket option).

ThreadingModel::Enum threadingModel ( ) const

Returns the connection mode.

Session& threadingModel ( ThreadingModel::Enum  value)

Sets the connection mode.

std::string threadNameSuffix ( ) const

Returns the thread name suffix for receiving (R:threadNameSuffix) and sending (S:threadNameSuffix) threads.

Note
This call is thread-safe.
Session& threadNameSuffix ( const std::string &  value)

Sets the thread name suffix for receiving ("R:threadNameSuffix") and sending ("S:threadNameSuffix") threads.

If threadNameSuffix is not specified, it is set by default to ("R:senderCompId-targetCompId")("S:senderCompId-targetCompId").

Note
This method can be called only when the session is disconnected.
Exceptions
Exceptionif the session state is not Disconnected.
Note
This call is thread-safe.
Session& throttle ( )

Performs throttling of a session that must be called before each of a send function call.

If the count of messages per a time unit exceeds a throttling limit, the function will be blocked until the given time interval is passed.

Note
This call is thread-safe.
Session& throttlingLimit ( size_t  messagesCount,
size_t  intervalInMs = 1000 
)

Sets throttling limit parameters.

Parameters
messagesCountMessage limit per a time unit.
intervalInMsTime interval to limit messages.
Note
This call is thread-safe.
std::string toString ( ) const

Returns the session string presentation.

Note
This call is thread-safe.
Session& unregisterAllListeners ( )

Un-registers all Session listener.

Session& unregisterListener ( ISessionListener listener)

Un-registers the Session listener.

bool updateSendingTimeField ( ) const

Returns 'true' if updating of SendingTime is turn on for every message, otherwise - 'false'.

By default, the option value is true.

Session& updateSendingTimeField ( bool  specify)

Option to specify updating of SendingTime of every sent message.

bool useSpinLock ( ) const

Returns whether the Session uses spinlock.

Session& useSpinLock ( bool  value)

Sets the Session to use spinlock.

bool validateChecksum ( ) const

Returns the option that controls the validation of the checksum of the incoming message.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateChecksum ( bool  )

Sets the validation of the checksum of the incoming message.

bool validateDuplicatedField ( ) const

Returns the option that controls duplicated field validation.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateDuplicatedField ( bool  )

Sets value of the option that controls duplicated field validation.

bool validateEmptyFieldValues ( ) const

Returns option to validate the empty field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateEmptyFieldValues ( bool  )

Sets option to validate the empty field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.

bool validateFieldValues ( ) const

Returns option to validate the field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateFieldValues ( bool  )

Sets option to validate the field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.

bool validateRepeatingGroupEntryCount ( ) const

Returns the option that controls repeating group entry count validation.

When it is not set, the corresponding Engine setting's value is used ('true' by default).

Session& validateRepeatingGroupEntryCount ( bool  )

Sets value of the option that controls repeating group entry count validation.

bool validateRepeatingGroupLeadingTag ( ) const

Returns the option that controls repeating group leading tag validation.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateRepeatingGroupLeadingTag ( bool  )

Sets value of the option that controls repeating group leading tag validation.

bool validateRequiredFields ( ) const

Returns option to validate the presence of required fields in inbound and outbound messages.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateRequiredFields ( bool  )

Sets option to validate the presence of required fields in inbound and outbound messages.

Session& validateSequenceNumbers ( bool  value)

Options to turn on/off incoming message sequence numbers validation.

bool validateSequenceNumbers ( ) const

Returns the current status of incoming message sequence numbers validation.

By default the option value is true.

bool validateUnknownFields ( ) const

Returns option to validate the presence of unknown fields.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateUnknownFields ( bool  )

Sets option to validate the presence of unknown fields.

bool validateUnknownMessages ( ) const

Returns option to validate the presence of unknown FIX messages.

When it is not set, the corresponding Engine setting's value is used ('false' by default).

Session& validateUnknownMessages ( bool  )

Sets option to validate the presence of unknown FIX messages.

Session& warmUp ( FlatMessage msg,
int  warmupFlags = 0 
)

This method warms up the sending path.

Parameters
msgMessage to warm up the assembly part of the sending path.
warmupFlagsSpecific flags which can be used to turn on the warmup feature for a specific NIC.
Note
This call is thread-safe.

Friends And Related Function Documentation

friend class Engine::Impl
friend

Definition at line 1809 of file Session.h.

Member Data Documentation

const OnixS::Sockets::Handle InvalidSocketHandle
static

Represents invalid value of socket handle.

Definition at line 1617 of file Session.h.

const unsigned int ResendRequestMaximumRangeNoLimit
static

Represents unlimited number of messages to be requested in one Resend Request (MsgType=2) message.

Default value is 0.

Definition at line 1170 of file Session.h.

const int UndefinedPriorityAndPolicy
static

Represents undefined value of priority and policy.

Definition at line 1298 of file Session.h.


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