#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< Message > | MessageBatch |
typedef MsgBatch< FlatMessage > | FlatMessageBatch |
typedef FlatMessageBatch | SerializedMessageBatch |
typedef std::set< std::string > | InboundMessageLogFilter |
typedef std::set< std::string > | OutboundMessageLogFilter |
typedef std::vector< Tag > | ScrambledFields |
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 |
typedef MsgBatch<FlatMessage> FlatMessageBatch |
typedef std::set<std::string> InboundMessageLogFilter |
typedef std::pair<unsigned short, unsigned short> LocalPortRange |
typedef MsgBatch<Message> MessageBatch |
typedef std::set<std::string> OutboundMessageLogFilter |
typedef std::vector<Tag> ScrambledFields |
Session | ( | const std::string & | senderCompId, |
const std::string & | targetCompId, | ||
const Dictionary & | dictionary, | ||
ISessionListener * | listener, | ||
SessionStorageType::Enum | storageType = SessionStorageType::FileBased , |
||
ISessionStorage * | storage = ONIXS_FIXENGINE_NULLPTR |
||
) |
senderCompId | Assigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages). |
targetCompId | Assigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages). |
dictionary | FIX dictionary to be used by the session. |
listener | Instance of ISessionListener interface which will receive and handle miscellaneous Session events. |
storageType | Session storage type. |
storage | Pluggable 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 |
||
) |
reactor | An instance of an externally managed reactor. |
senderCompId | Assigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages). |
targetCompId | Assigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages). |
dictionary | FIX dictionary to be used by the session. |
listener | Instance of ISessionListener interface which will receive and handle miscellaneous Session events. |
storageType | Session storage type. |
storage | Pluggable 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 |
||
) |
senderCompId | Assigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages). |
targetCompId | Assigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages). |
dictionary | FIX dictionary to be used by the session. |
keepSequenceNumbersAfterLogout | Option to keep sequence numbers after the exchange of Logout (MsgType=5) messages. |
listener | Instance of ISessionListener interface which will receive and handle miscellaneous Session events. |
storageType | Session storage type. |
storage | Pluggable 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 |
||
) |
reactor | An instance of an externally managed reactor. |
senderCompId | Assigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages). |
targetCompId | Assigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages). |
dictionary | FIX dictionary to be used by the session. |
keepSequenceNumbersAfterLogout | Option to keep sequence numbers after the exchange of Logout (MsgType=5) messages. |
listener | Instance of ISessionListener interface which will receive and handle miscellaneous Session events. |
storageType | Session storage type. |
storage | Pluggable 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 |
||
) |
senderCompId | Assigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages). |
targetCompId | Assigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages). |
dictionary | FIX dictionary to be used by the session. |
keepSequenceNumbersAfterLogout | Option to keep sequence numbers after the exchange of Logout (MsgType=5) messages. |
listener | Instance of ISessionListener interface which will receive and handle miscellaneous Session events. |
customSessionKey | Custom key that can be used to distinguish sessions with the same values of the SenderCompID, TargetCompID and the FIX Protocol version. |
storageType | Session storage type. |
storage | Pluggable 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 |
||
) |
reactor | An instance of an externally managed reactor. |
senderCompId | Assigned value used to identify firm sending message (SenderCompID (tag=49) field value in outgoing messages). |
targetCompId | Assigned value used to identify receiving firm (TargetCompID (tag=56) field value in outgoing messages). |
dictionary | FIX dictionary to be used by the session. |
keepSequenceNumbersAfterLogout | Option to keep sequence numbers after the exchange of Logout (MsgType=5) messages. |
listener | Instance of ISessionListener interface which will receive and handle miscellaneous Session events. |
customSessionKey | Custom key that can be used to distinguish sessions with the same values of the SenderCompID, TargetCompID and the FIX Protocol version. |
storageType | Session storage type. |
storage | Pluggable Session storage. |
~Session | ( | ) |
Destructor.
Session& breakConnection | ( | ) |
Terminates the FIX connection in the non-graceful way (without the exchange of Logout (MsgType=5) messages).
|
static |
Returns 'true' if given flags work as expected and a real data is not sent to the wire, otherwise - 'false'.
warmupFlags | Warmup flags for checking. |
baseListenPort | Base listen port to use during the checking. |
localNetworkInterface | IP address to bind for listen and outgoing test sockets. |
Session& clearOutboundQueue | ( | bool | removeFragmentedPacket = false | ) |
Removes all messages from the outbound queue.
removeFragmentedPacket | - specifies whether to remove last packet which is partly sent. |
Sets the socket TCP connect timeout.
TimeSpan connectTimeout | ( | ) | const |
Returns the socket TCP connect timeout (30 sec by default).
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.
std::string counterpartyIpAddress | ( | ) | const |
Returns the counterparty address.
size_t counterpartyPort | ( | ) | const |
Returns the counterparty port number.
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.
const std::string& customKey | ( | ) | const |
Returns Session's Custom Key.
Dictionary dictionary | ( | ) | const |
EncryptionMethod::Enum encryptionMethod | ( | ) | const |
Returns the current encryption method.
Session& encryptionMethod | ( | EncryptionMethod::Enum | newEncryptionMethod | ) |
Sets the encryption method.
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.
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.
Session& flushSessionStorage | ( | ) |
Flushes all internal buffers of the underlying storage.
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.
Session& inboundMessageLogFilter | ( | const InboundMessageLogFilter & | filter | ) |
Sets incoming message types to be filtered out from the logs.
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.
Session& inSeqNum | ( | SequenceNumber | seqNum | ) |
Sets the expected sequence number of the next incoming message.
int listenPort | ( | ) | const |
Returns the port to listen on for incoming FIX Connections in Acceptor mode.
Session& listenPort | ( | int | listenPort | ) |
Sets the port to listen on for incoming FIX Connections in Acceptor mode.
std::string localNetworkInterface | ( | ) | const |
Returns the local network interface from which you intend to send and receive data.
Session& localNetworkInterface | ( | const std::string & | localNetworkInterface | ) |
Sets the local network interface from which you intend to send and receive data.
unsigned short localPort | ( | ) | const |
Returns the local port from which you intend to send and receive data.
LocalPortRange localPortRange | ( | ) | const |
Returns the local port range, the first available port from this range will be used to send and receive data.
Session& localPortRange | ( | LocalPortRange | portRange | ) |
Sets the local port range, the first available port from this range will be used to send and receive data.
bool logBeforeSending | ( | ) | const |
Returns 'true' if outbound messages are logged before sending, otherwise - 'false'.
By default, the value is 'true'.
Session& logBeforeSending | ( | bool | value | ) |
Option to switch on/off logging of outbound messages before/after sending.
Session& logDirectory | ( | const std::string & | value | ) |
Inbound and outbound messages, session's state data are stored in this directory.
Exception | if the session state is not Disconnected. |
const std::string& logDirectory | ( | ) | const |
Inbound and outbound messages, session's state data are stored in this directory.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
text | Free format text string that is sent to the counterparty in the Text(58) field of the initial Logout message. |
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.
customLogoutMessage | Custom Logout message that is sent to the counterparty. |
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.
text | Free format text string that is sent to the counterparty in the Text(58) field of the initial Logout message. |
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.
customLogoutMessage | Custom Logout message that is sent to the counterparty. |
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.
OutboundMessageLogFilter outboundMessageLogFilter | ( | ) | const |
Returns outgoing message types to be filtered out from the logs.
Session& outboundMessageLogFilter | ( | const OutboundMessageLogFilter & | filter | ) |
Sets outgoing message types to be filtered out from the logs.
size_t outboundQueueBytes | ( | ) | const |
Returns the total number of bytes in the outbound queue.
SequenceNumber outSeqNum | ( | ) | const |
Returns the sequence number of the next outgoing message.
Session& outSeqNum | ( | SequenceNumber | seqNum | ) |
Sets the sequence number of the next outgoing message.
void preFill | ( | Message & | msg | ) | const |
Pre-fills session-level fields that are constant during the session's lifetime - SenderCompId, TargetCompId, SenderLocationId, TargetLocationID, SenderSubID, TargetSubID.
void preFill | ( | FlatMessage & | msg | ) | const |
Pre-fills the following fields in the message or messages batch for sending as is:
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.
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.
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.
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.
int reconnectAttempts | ( | ) | const |
Session& reconnectInterval | ( | int | value | ) |
Sets the time interval between the attempts to restore the FIX connection (in seconds).
int reconnectInterval | ( | ) | const |
Session& registerListener | ( | ISessionListener * | listener | ) |
Registers the Session listener.
Exception | if 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.
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.
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.
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).
Session& resendRequestMaximumRange | ( | int | range | ) |
Sets the maximum number of messages to be requested in one Resend Request (MsgType=2) message.
range | Maximum number of messages to be requested in one Resend Request (MsgType=2) message. Cannot be negative. |
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).
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.
TimeSpan resendTimeout | ( | ) | const |
Returns the timeout during which counterparty should send a reply to the "Resend Request" message.
Session& resetLocalSequenceNumbers | ( | ) |
Backups the current log files and resets the local sequence numbers to 1.
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.
SessionRole::Enum role | ( | ) | const |
Returns the session role.
void scheduleShrinkToFit | ( | ) |
Schedule the memory usage optimization.
The session will perform the actual memory usage optimization in two phases:
Session& scrambleLogonFields | ( | const ScrambledFields & | fields | ) |
Sets scrambled fields in the Logon(A) message, in the session storage, for security reasons.
ScrambledFields scrambleLogonFields | ( | ) | const |
Returns scrambled fields in the Logon(A) message.
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.
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.
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.
msgs | Message batch to send. |
maxPacketSize | The 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. |
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.
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.
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.
msgs | Message batch to send. |
maxPacketSize | The 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. |
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.
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.
const std::string& senderCompId | ( | ) | const |
Returns the assigned value used to identify firm sending message (the SenderCompID (tag 49) field value in outgoing messages).
std::string senderLocationId | ( | ) | const |
Returns the SenderLocationID (tag 142) field values for all outgoing messages.
Session& senderLocationId | ( | const std::string & | value | ) |
Sets the SenderLocationID (tag 142) field values for all outgoing messages.
std::string senderSubId | ( | ) | const |
Returns the SenderSubID (tag 50) field values for all outgoing messages.
Session& senderSubId | ( | const std::string & | value | ) |
Sets the SenderSubID (tag 50) field values for all outgoing messages.
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.
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.
refSeqNumber | MsgSeqNum of rejected message. |
text | Message to explain the reason for rejection. |
Session& sendResendRequest | ( | SequenceNumber | beginSeqNumber | ) |
Sends the Resend Request (MsgType 2) message.
beginSeqNumber | Begin sequence number of the first requested message in the range. |
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).
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.
testReqId | The identifier included in Test Request (MsgType 1) message to be returned in resulting Heartbeat (MsgType 0) message from the counterparty. |
timeout | The maximum interval to wait until the reply is received from the counterparty. |
Session& shutdown | ( | ) |
Shutdowns the session.
OnixS::Sockets::Handle socketHandle | ( | ) |
Returns the socket handle which the session uses to transmit FIX data.
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.
Session& sslCaFile | ( | const std::string & | value | ) |
Sets the path to the trusted certification authority certificate file in (Privacy Enhanced Mail) Base64 encoded (.pem) format.
std::string sslCaFile | ( | ) | const |
Returns the path to trusted certification authority certificate file in (Privacy Enhanced Mail) Base64 encoded (.pem) format.
std::string sslCertificateFile | ( | ) | const |
Returns the SSL certificate file.
Session& sslCertificateFile | ( | const std::string & | file | ) |
Sets the SSL certificate file.
std::string sslPrivateKeyFile | ( | ) | const |
Returns the SSL private key file.
Session& sslPrivateKeyFile | ( | const std::string & | file | ) |
Sets the SSL private key file.
Cryptography::SecureString sslPrivateKeyPassword | ( | ) | const |
Returns the SSL private key file password.
Session& sslPrivateKeyPassword | ( | const Cryptography::SecureString & | password | ) |
Sets the SSL private key file password.
Session& sslVerifyPeer | ( | bool | verify | ) |
Set option to request peer certificates and perform the certificate verification.
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).
SessionState::Enum state | ( | ) | const |
Returns Session's state.
const std::string& storageId | ( | ) | const |
Returns the underlying storage Id.
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).
std::string targetLocationId | ( | ) | const |
Returns the TargetLocationID (tag 143) field values for all outgoing messages.
Session& targetLocationId | ( | const std::string & | value | ) |
Sets the TargetLocationID (tag 143) field values for all outgoing messages.
std::string targetSubId | ( | ) | const |
Returns the TargetSubID (tag 57) field values for all outgoing messages.
Session& targetSubId | ( | const std::string & | value | ) |
Sets the TargetSubID (tag 57) field values for all outgoing messages.
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.
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").
Exception | if the session state is not Disconnected. |
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.
Session& throttlingLimit | ( | size_t | messagesCount, |
size_t | intervalInMs = 1000 |
||
) |
Sets throttling limit parameters.
messagesCount | Message limit per a time unit. |
intervalInMs | Time interval to limit messages. |
std::string toString | ( | ) | const |
Returns the session string presentation.
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.
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 |
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.
msg | Message to warm up the assembly part of the sending path. |
warmupFlags | Specific flags which can be used to turn on the warmup feature for a specific NIC. |
|
static |
|
static |
|
static |