OnixS C++ FIX Engine 2.79.1.0
Session Class Reference

List of all members.

Public Types

enum  SessionStorageType { FileBasedStorage, MemoryBasedStorage, PluggableStorage }
enum  State {
  DISCONNECTED, LOGON_IN_PROGRESS, LOGOUT_IN_PROGRESS, ACTIVE,
  RECONNECTING
}
enum  EncryptionMethod { NONE, SSL }
enum  Role { NA, INITIATOR, ACCEPTOR }

Public Member Functions

 Session (const std::string &senderCompId, const std::string &targetCompId, Version version, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, SessionStorageType storageType=FileBasedStorage, ISessionStorage *storage=NULL)
 Session (const std::string &senderCompId, const std::string &targetCompId, Version version, ISessionListener *listener, SessionStorageType storageType=FileBasedStorage, ISessionStorage *storage=NULL)
 Session (const std::string &senderCompId, const std::string &targetCompId, const Dialect &dialect, ISessionListener *listener, SessionStorageType storageType=FileBasedStorage, ISessionStorage *storage=NULL)
 Session (const std::string &senderCompId, const std::string &targetCompId, const Dialect &dialect, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, SessionStorageType storageType=FileBasedStorage, ISessionStorage *storage=NULL)
 Session (const std::string &senderCompId, const std::string &targetCompId, Version version, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, const std::string &customSessionKey, SessionStorageType storageType=FileBasedStorage, ISessionStorage *storage=NULL)
 Session (const std::string &senderCompId, const std::string &targetCompId, const Dialect &dialect, bool keepSequenceNumbersAfterLogout, OnixS::FIX::ISessionListener *listener, const std::string &customSessionKey, SessionStorageType storageType=FileBasedStorage, ISessionStorage *storage=NULL)
 ~Session ()
void clearOutboundQueue ()
State getState ()
EncryptionMethod getEncryptionMethod () const
void setEncryptionMethod (EncryptionMethod newEncryptionMethod)
int getListenPort () const
void setListenPort (int listenPort)
void setLocalNetworkInterface (const std::string &localNetworkInterface)
const std::string & getLocalNetworkInterface ()
void setTcpNoDelayOption (bool value=true)
bool getTcpNoDelayOption () const
void setSslCertificateFile (const std::string &file)
void setSslPrivateKeyFile (const std::string &file)
void setSslPrivateKeyPassword (const std::string &password)
void logonAsAcceptor ()
void logonAsInitiator (const std::string &host, int port, bool setResetSeqNumFlag)
void logonAsInitiator (const std::string &host, int port)
void logonAsInitiator (const std::string &host, int port, int heartBtInt)
void logonAsInitiator (const std::string &host, int port, int heartBtInt, bool setResetSeqNumFlag)
void logonAsInitiator (const std::string &host, int port, int heartBtInt, Message *customLogonMsg)
void logonAsInitiator (const std::string &host, int port, int heartBtInt, Message *customLogonMsg, bool setResetSeqNumFlag)
void logout ()
void logout (const std::string &text)
void logout (Message *customLogoutMessage)
void breakConnection ()
void send (Message *message)
void shutdown ()
 operator const std::string & ()
const std::string & getStorageID ()
std::string getCounterpartyHost ()
std::string getCounterpartyIpAddress ()
size_t getCounterpartyPort ()
const std::string & getCustomKey () const
size_t getOutboundQueueBytes ()
size_t getOutboundQueueCount ()
int getHeartBtInt ()
bool getLogInboundMessages () const
void setLogInboundMessages (bool value)
bool getLogOutboundMessages () const
void setLogOutboundMessages (bool value)
int getInSeqNum ()
void setInSeqNum (int seqNum)
int getOutSeqNum ()
void setOutSeqNum (int seqNum)
System::ThreadId getReceivingThreadId () const
Role getRole ()
const std::string & getSenderCompID ()
System::ThreadId getSendingThreadId () const
const std::string & getTargetCompID ()
Version getVersion ()
const Dialectdialect ()
MessagefindSentMessage (int messageSequenceNumber)
void registerListener (ISessionListener *listener)
void unregisterListener ()
void reset ()
void resetSeqNumViaLogonExchange ()
void senderSubID (const std::string &value)
void targetSubID (const std::string &value)
void senderLocationID (const std::string &value)
void targetLocationID (const std::string &value)
void sendTestRequest (const std::string &testReqID="")

Static Public Member Functions

static const char * storageType2String (SessionStorageType value)
static const char * state2string (State state)

Friends

struct Engine::Impl

Detailed Description

FIX Session - a bi-directional stream of ordered messages between two parties within a continuous sequence number series.


Member Enumeration Documentation

Enumerator:
NONE 

No encryption.

SSL 

Secure Sockets Layer.

Session Storage type.

Enumerator:
FileBasedStorage 

File based storage. Session's state and messages are persisted to the file system.

MemoryBasedStorage 

Memory based storage. Session's state and messages are NOT persisted.

PluggableStorage 

Custom session storage.


Constructor & Destructor Documentation

Session ( const std::string &  senderCompId,
const std::string &  targetCompId,
Version  version,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
SessionStorageType  storageType = FileBasedStorage,
ISessionStorage storage = NULL 
)

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).
versionVersion of the FIX messaging specification (protocol) 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,
Version  version,
ISessionListener listener,
SessionStorageType  storageType = FileBasedStorage,
ISessionStorage storage = NULL 
)

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).
versionVersion of the FIX messaging specification (protocol) 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 Dialect dialect,
ISessionListener listener,
SessionStorageType  storageType = FileBasedStorage,
ISessionStorage storage = NULL 
)

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).
dialectFIX dialect 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 Dialect dialect,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
SessionStorageType  storageType = FileBasedStorage,
ISessionStorage storage = NULL 
)

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).
dialectFIX dialect 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,
Version  version,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
const std::string &  customSessionKey,
SessionStorageType  storageType = FileBasedStorage,
ISessionStorage storage = NULL 
)

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).
versionVersion of the FIX messaging specification (protocol) 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 ( const std::string &  senderCompId,
const std::string &  targetCompId,
const Dialect dialect,
bool  keepSequenceNumbersAfterLogout,
OnixS::FIX::ISessionListener listener,
const std::string &  customSessionKey,
SessionStorageType  storageType = FileBasedStorage,
ISessionStorage storage = NULL 
)

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).
dialectFIX dialect 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.

Member Function Documentation

void breakConnection ( )

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

const Dialect& dialect ( )

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

bool getLogInboundMessages ( ) const
Returns:
'true' if inbound messages are logged, otherwise - 'false'.
bool getLogOutboundMessages ( ) const
Returns:
'true' if outbound messages are logged, otherwise - 'false'.
void 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.

void logonAsInitiator ( const std::string &  host,
int  port,
bool  setResetSeqNumFlag 
)

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

Initiator establishes the telecommunications link and initiates the session via transmission of the initial Logon message.

void 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.

void logout ( )

Terminates the FIX Connection.

The initial Logout message is sent to the counterparty and the method blocks until the acknowledgment Logout message is received.

void logout ( Message customLogoutMessage)

Terminates the FIX Connection.

Parameters:
customLogoutMessageCustom Logout message that is sent to the counterparty.
void logout ( const std::string &  text)

Terminates the FIX Connection.

Parameters:
textFree format text string that is sent to the counterparty in the Text(58) field of the initial Logout message.
void registerListener ( ISessionListener listener)

Registers the Session listener.

Exceptions:
Exceptionif the listener is already registered.
void reset ( )

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

Note:
This method can be called only when the session is disconnected.
void send ( Message 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 will be sent when the connection is established with the counterparty.

Note:
This call is asynchronous.
void setSslCertificateFile ( const std::string &  file)

Sets the SSL certificate file.

Note:
Only the (Privacy Enhanced Mail) Base 64 Encoded (.pem) SSL certificates are supported.
void setSslPrivateKeyFile ( const std::string &  file)

Sets the SSL private key file.

Note:
Only the (Privacy Enhanced Mail) Base 64 Encoded (.pem) SSL certificates are supported.
void shutdown ( )

Shutdowns the session.