B2BITS FIX Antenna C++ 2.33.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Engine::Session Class Referenceabstract

FIX Session. More...

#include <B2BITS_Session.h>

+ Inheritance diagram for Engine::Session:
+ Collaboration diagram for Engine::Session:

Public Types

enum  ActiveConnection { PRIMARY_CONNECTION = 0 , BACKUP_CONNECTION , RESTORE_CONNECTION }
 Active connection to use. More...
 
typedef SessionRole Role
 Session role.
 
enum  SeqNumResetStrategy { RESET_SEQNUM_STRATEGY , RESET_SEQNUM_AND_SEND_LOGON_STRATEGY }
 Sequence numbers reset strategy. More...
 
enum  State {
  ESTABLISHED , INITIAL , NON_GRACEFULLY_TERMINATED , RECONNECT ,
  CORRECTLY_TERMINATED , WAIT_FOR_CONFIRM_LOGON , WAIT_FOR_CONFIRM_LOGOUT , WAIT_FOR_FIRST_LOGON ,
  SWITCH_CONNECTION , WAIT_FOR_FIRST_HELLO , WAIT_FOR_CONFIRM_HELLO , WAIT_FOR_CONNECT
}
 Possible states of Session. More...
 

Public Member Functions

virtual void attachStateObserver (SessionStateObserver *observer)=0
 Attaches session state observer.
 
virtual void closeMessageStorage ()=0
 Close message storage.
 
virtual void connect (const FixT11TcpParameters &protocolConfig, const FixT11TcpBackupParameters *backupConn=NULL, ActiveConnection activeConn=PRIMARY_CONNECTION)=0
 Establishes the FIX session over FIXT11_TCP underlying protocol.
 
virtual void connect (const FixTcpParameters &protocolConfig, const FixTcpBackupParameters *backupConn=NULL, ActiveConnection activeConn=PRIMARY_CONNECTION)=0
 Establishes the FIX session over FIX_TCP underlying protocol.
 
virtual void connect (int HBI, const FIXMessage &customLogonMsg, const std::string &host, int port, const SessionBackupParameters *backupConn=NULL, ActiveConnection activeConn=PRIMARY_CONNECTION)=0
 Establishes the FIX session as Initiator using the custom Logon message.
 
virtual void connect (int HBI, const std::string &host, int port, const SessionBackupParameters *backupConn=NULL, ActiveConnection activeConn=PRIMARY_CONNECTION)=0
 Establishes the FIX session as Initiator.
 
virtual void connect (SessionRole sessionRole=NA_SESSION_ROLE, const SessionBackupParameters *pSessionBackupParameters=NULL)=0
 Establishes the FIX session.
 
virtual void detachStateObserver ()=0
 Detaches session state observer.
 
virtual void disconnect (bool forcefullyMarkAsTerminated=false)=0
 Initiates disconnect of the session.
 
virtual void disconnect (const std::string &logoutText, bool forcefullyMarkAsTerminated=false)=0
 Initiates disconnect of the session with the given logout text.
 
virtual void disconnectNonGracefully ()=0
 Closes the telecommunication link and switches the session into the NON_GRACEFULLY_TERMINATED state.
 
virtual void disconnectSync (bool forcefullyMarkAsTerminated=false)
 Initiates synchronous disconnect of the session.
 
virtual void disconnectSync (const std::string &logoutText, bool forcefullyMarkAsTerminated=false)
 Initiates synchronous disconnect of the session with the given logout text.
 
virtual ActiveConnection getActiveConnectionType () const =0
 Returns current connection type.
 
virtual SessionExtraParameters getActiveParameters () const =0
 Returns std::string representation of active session parameters.
 
virtual FIXVersion getAppBaseVer () const =0
 Returns the FIX application protocol base version.
 
virtual ProtocolIndex getAppVer () const =0
 Returns the FIX application protocol index in the parser.
 
virtual std::unique_ptr< SessionBackupParametersgetBackupParameters () const =0
 Returns std::string representation of backup session parameters.
 
virtual unsigned char getCurrentTagsDelimiter () const =0
 Returns session's tags delimiter that is currently being used;.
 
virtual Engine::EncryptMethod getEncryptionMethod () const =0
 Returns the encryption method.
 
virtual int getHBI () const =0
 Returns Heartbeat interval (HeartBtInt) in seconds.
 
virtual const std::string * getId () const =0
 Returns the session's ID in the format 'SenderCompID 0x01 TargetCompId' or .
 
virtual int getInSeqNum () const =0
 Returns the next expected incoming sequence numbers for this FIX session.
 
virtual std::unique_ptr< InternalStategetInternalState () const =0
 Returns current internal state for this FIX session.
 
virtual const std::string getMsgStorageBaseFilePath () const =0
 Returns message storage base file path.
 
virtual int getOutSeqNum () const =0
 Returns the outgoing sequence numbers for this FIX session (MsgSeqNum of the next outgoing message).
 
virtual int getOutSeqNumNoLock () const =0
 Returns the outgoing sequence numbers for this FIX session (MsgSeqNum of the next outgoing message).
 
virtual SessionExtraParameters getPrimaryParameters () const =0
 Returns std::string representation of primary session parameters.
 
virtual void getReceivedMessages (std::vector< FIXMessage * > *pMessages, const MsgFilter &msgFilter) const =0
 Retrieves messages received by the session.
 
virtual System::InetAddress getRemoteAddress () const =0
 Returns the remote FIX Engine's IP Address.
 
virtual const std::string * getRemoteHost () const =0
 Returns the remote FIX Engine's host name.
 
virtual System::IPAddr getRemoteHostIP () const
 Returns the remote FIX Engine's IP Address.
 
virtual int getRemotePort () const =0
 Returns the remote FIX Engine's port number.
 
virtual Role getRole () const =0
 Returns session's role.
 
virtual const std::string * getSender () const =0
 Returns SenderCompID.
 
virtual SessionEx * getSessionEx ()
 Extends session interface.
 
virtual const SessionIdgetSessionId () const =0
 Returns reference to SessionId.
 
virtual State getState () const =0
 Returns session's state;.
 
virtual const char * getStateAsString () const =0
 Returns current session's state as std::string;.
 
virtual void getStatistics (FixSessionStatisticsLite &statistics) const =0
 Returns Session's Lite statistics.
 
virtual System::u64 getStorageCreationTime () const =0
 Returns storage creation time as number of milliseconds since 1970.01.01 If no storage is assigned with Session, method returns 0.
 
virtual MessageStorageType getStorageType () const =0
 Returns a session storage type.
 
virtual const std::string * getTarget () const =0
 Returns TargetCompID.
 
virtual UnderlyingProtocol getUnderlyingProtocol () const =0
 Returns type of the underlying protocol.
 
virtual FIXVersion getVer () const =0
 Returns the FIX protocol version.
 
virtual void inflate (FIXMessage *pMsg, int msgSeqNumSize, PutMessageOptions const *options=NULL) const =0
 Sets static session level fields in the message and reserves space for volatile session level fields.
 
virtual bool isInEstablishingConnectionMode () const =0
 Returns true if the session is in establishing connection mode (INITIAL, RECONNECT, WAIT_FOR_CONFIRM_LOGON, WAIT_FOR_FIRST_LOGON, or WAIT_FOR_CONNECT states)
 
virtual bool isTCPBuffer () const =0
 
virtual FIXMessagelocateSentMessage (int seqNum) const =0
 Searches for a message by sequence number in the outgoing storage.
 
virtual void lock ()=0
 Locks session's mutex.
 
virtual FIXMessagenewSkel (const char *msgType, Engine::ProtocolIndex app_ver=Engine::NA) const =0
 Creates instance of the FIX message.
 
virtual std::size_t outgoingQueueSize () const =0
 Returns size of the outgoing message queue.
 
virtual FIXMessageparse (std::string const &raw) const =0
 Creates instance of the FIX message.
 
virtual ParserID parserID () const =0
 Returns unique parser identifier of the session.
 
virtual void ping (const std::string &testReqID="")=0
 Sends Test Request message.
 
ParserID protocolID () const
 Returns unique parser identifier of the session.
 
virtual void put (const std::list< PreparedMessage * > &lMsgs)
 Sends the list of given messages to the remote FIX engine in one packet.
 
virtual void put (const std::string &msgHeader, const std::string &msgBody)=0
 Sends the given message to the remote FIX engine.
 
virtual void put (FIXMessage *pMsg, PutMessageOptions const *options=NULL)=0
 Sends the given message to the remote FIX engine.
 
virtual void put (PreparedMessage *pMsg)=0
 Sends the given message to the remote FIX engine.
 
virtual void putAsIs (FIXMessage *msg, int seqNum, bool updateOutSeqNum)=0
 Stores given message to outgoing storage and sends to socket.
 
virtual void putAsIs (PreparedMessage *msg, int seqNum, bool updateOutSeqNum)=0
 Stores given message to outgoing storage and sends to socket.
 
virtual void putAsIsNoLock (FIXMessage *msg, int seqNum, bool updateOutSeqNum)=0
 Stores given message to outgoing storage and sends to socket.
 
virtual void putAsIsNoLock (PreparedMessage *msg, int seqNum, bool updateOutSeqNum)=0
 Stores given message to outgoing storage and sends to socket.
 
virtual ApplicationregisterApplication (Application *pNewApplication, unsigned int delay=300, int maxTries=-1)=0
 Registers Application.
 
virtual void resetMessageStorage ()=0
 Reset messages storage, so nothing will be send on ResendRequest.
 
virtual void resetSeqNum (SeqNumResetStrategy strategy=RESET_SEQNUM_AND_SEND_LOGON_STRATEGY)=0
 Resets sequence numbers according to chosen strategy.
 
virtual void setEnableMessageRejecting (bool enable)=0
 Forcedly sets the value of the Enable Message Rejecting.
 
virtual void setForcedReconnect (bool enable)=0
 Forcedly sets the value of the Forced Reconnect.
 
virtual void setInSeqNum (int seqNum)=0
 Forcedly sets the value of the incoming sequence number (the expected MsgSeqNum of the next incoming message).
 
virtual void setInternalState (InternalState *state)=0
 Forcedly sets the internal state.
 
virtual void setIntradayLogoutToleranceMode (bool enable)=0
 Forcedly sets the value of the Intraday Logout Tolerance Mode.
 
virtual void setOutSeqNum (int seqNum)=0
 Forcedly sets the value of the outgoing sequence number (MsgSeqNum of the next outgoing message).
 
virtual void setOutSeqNumNoLock (int seqNum)=0
 Sets the value of the outgoing sequence number (MsgSeqNum of the next outgoing message).
 
virtual void setSenderLocationID (const std::string &id)=0
 Forcedly sets the value of the Sender Location ID.
 
virtual void setSenderSubID (const std::string &id)=0
 Forcedly sets the value of the Sender Sub ID.
 
virtual void setSessionDestructionEvent (System::ReferenceableManualEvent *event) throw () =0
 Assigns Session with Event object to notify user about session destruction.
 
virtual void setTargetLocationID (const std::string &id)=0
 Forcedly sets the value of the Target Location ID.
 
virtual void setTargetSubID (const std::string &id)=0
 Forcedly sets the value of the Target Sub ID.
 
virtual bool setTCPBuffer (bool enable)=0
 Enables or disables TCP buffer.
 
virtual void switchConnection ()=0
 Switch session to the another connection.
 
virtual void unlock ()=0
 UnLocks session.
 
virtual bool waitForStates (const std::set< State > &states, const std::chrono::milliseconds &timeout=(std::chrono::milliseconds::max)()) const =0
 Waits before session gets into any state among provided.
 
virtual void waitForTerminated () throw () =0
 Blocks execution until all threads accittiated with Session are stopped.
 
- Public Member Functions inherited from Utils::ReferenceCounter
virtual bool addRef () const throw ()
 Increments reference counter.
 
virtual long getNRef () const throw ()
 Returns the current value of the reference counter.
 
 ReferenceCounter () throw ()
 Constructor.
 
virtual long release () const throw ()
 Decrements reference counter.
 

Static Public Member Functions

static const char * connState2string (ActiveConnection aState)
 Returns the std::string representation of the given connection state value.
 
static const char * messageStorageTypeToString (MessageStorageType const &value)
 Converts MessageStorageType to string.
 
static const char * role2string (SessionRole role)
 Returns the string representation of the given Role value.
 
static const char * state2string (State state)
 Returns the string representation of the given state value.
 
static MessageStorageType stringToMessageStorageType (char const *value)
 Converts string to MessageStorageType.
 
static MessageStorageType stringToMessageStorageTypeCaseI (char const *value)
 Converts string to MessageStorageType.
 

Protected Member Functions

 Session ()
 Constructor.
 
virtual ~Session ()
 Destructor.
 
- Protected Member Functions inherited from Utils::ReferenceCounter
long decrement () const throw ()
 Decrements counter and returns new counter value.
 
long increment () const throw ()
 Increments counter and returns new counter value.
 
virtual ~ReferenceCounter ()
 Destructor.
 

Detailed Description

FIX Session.

Provides interface to establish connection, send and receive messages. Instance of the session can be created by Engine::FixEngine class.

Example:

// Create FIX Session
SessionEventListener listener;
Engine::Session* session = Engine::FixEngine::singleton()->createSession( &listener, "sender", "target", Engine::FIX42 );
// Establish connection with acceptor
session->connect( 30, "127.0.0.1", 9999 );
// Create FIX Message
Engine::FIXMessage* msg = session->newSkel( "D" );
// Fill fields of the message
// ...
msg->set( FIXFields::ClOrdID, "1234" );
// Send message
session->put( msg );
// After Engine::Session::put message can be destroyed
// Close connection
session->disconnect();
session->waitForTerminated();
// Destroy session
session->release();
Basic FIX message.
Definition B2BITS_FIXMessage.h:82
virtual void release() const =0
Releases FIX message instance.
Session * createSession(Application *pApp, const std::string &senderCompID, const std::string &targetCompID, FIXVersion appVer=NA, const SessionExtraParameters *pParam=NULL, const MessageStorageType storageType=default_storageType, UnderlyingProtocol underlyingProtocolType=FIX_TCP)
Creates a new FIX Session.
static FixEngine * singleton()
Returns an instance of this class.
FIX Session.
Definition B2BITS_Session.h:171
virtual void connect(SessionRole sessionRole=NA_SESSION_ROLE, const SessionBackupParameters *pSessionBackupParameters=NULL)=0
Establishes the FIX session.
virtual void waitForTerminated()=0
Blocks execution until all threads accittiated with Session are stopped.
virtual FIXMessage * newSkel(const char *msgType, Engine::ProtocolIndex app_ver=Engine::NA) const =0
Creates instance of the FIX message.
virtual void disconnect(bool forcefullyMarkAsTerminated=false)=0
Initiates disconnect of the session.
virtual void put(FIXMessage *pMsg, PutMessageOptions const *options=NULL)=0
Sends the given message to the remote FIX engine.
virtual bool set(int tag, MonthYear value)=0
Updates field value by tag number.
virtual long release() const
Decrements reference counter.
@ FIX42
FIX 4.2.
Definition B2BITS_PubEngineDefines.h:81
static const int ClOrdID
Definition B2BITS_FIXFields.h:66

Member Typedef Documentation

◆ Role

Session role.

Member Enumeration Documentation

◆ ActiveConnection

Active connection to use.

Enumerator
PRIMARY_CONNECTION 

The session connects via primary connection.

BACKUP_CONNECTION 

The session connects via backup connection.

RESTORE_CONNECTION 

The session connects to the previous active connection.

◆ SeqNumResetStrategy

Sequence numbers reset strategy.

Enumerator
RESET_SEQNUM_STRATEGY 
RESET_SEQNUM_AND_SEND_LOGON_STRATEGY 

Should be used to reset sequence numbers on local side. Strategy covers case when sequence numbers on acceptor and initiator sides are reset at specific time on both sides. It should be used in INITIAL, NON_GRACEFULLY_TERMINATED and CORRECTLY_TERMINATED state.

Strategy to reset sequence using ResetSeqNumFlag flag that indicates both sides of a FIX session should reset sequence numbers.

Warning
cannot be used with FIX40.

◆ State

Possible states of Session.

See also
Session::state2string(State state).
Enumerator
ESTABLISHED 

The session is fully established.

INITIAL 

The session has been created, but has not been connected yet.

NON_GRACEFULLY_TERMINATED 

The session has been non-gracefully terminated.

RECONNECT 

The session-initiator has detected the telecommunication link error and is trying to re-establish the link.

CORRECTLY_TERMINATED 

The session has been correctly terminated.

WAIT_FOR_CONFIRM_LOGON 

The session has been connected as an Initiator, the first Logon message has been sent and it is waiting for the conforming Logon message.

WAIT_FOR_CONFIRM_LOGOUT 

Waiting for confirm logout state.

WAIT_FOR_FIRST_LOGON 

The session has been connected as an Acceptor and is waiting for the first Logon message.

SWITCH_CONNECTION 

The session switch to the another connection (backup or primary)

WAIT_FOR_FIRST_HELLO 

The session has been connected as an Acceptor and is waiting for the first Hello message.

WAIT_FOR_CONFIRM_HELLO 

The session has been connected as an Initiator, the first FAST Hello message has been sent and it is waiting for the conforming Hello message.

WAIT_FOR_CONNECT 

The session-initiator is waiting fo async connect to complete.

Constructor & Destructor Documentation

◆ Session()

Engine::Session::Session ( )
inlineprotected

Constructor.

◆ ~Session()

virtual Engine::Session::~Session ( )
inlineprotectedvirtual

Destructor.

Note
It is necessary to call the 'release()' method to free the resources used by this session.

Member Function Documentation

◆ attachStateObserver()

virtual void Engine::Session::attachStateObserver ( SessionStateObserver * observer)
pure virtual

Attaches session state observer.

◆ closeMessageStorage()

virtual void Engine::Session::closeMessageStorage ( )
pure virtual

Close message storage.

Method forcedly closes storage if session is in the NGT/CT state.

◆ connect() [1/5]

virtual void Engine::Session::connect ( const FixT11TcpParameters & protocolConfig,
const FixT11TcpBackupParameters * backupConn = NULL,
ActiveConnection activeConn = PRIMARY_CONNECTION )
pure virtual

Establishes the FIX session over FIXT11_TCP underlying protocol.

Parameters
protocolConfig- set of the FIXT11_TCP protocol parameters.
backupConn- parameters of the backup connection
activeConn- specifies which connection will be used, by default primary connection

◆ connect() [2/5]

virtual void Engine::Session::connect ( const FixTcpParameters & protocolConfig,
const FixTcpBackupParameters * backupConn = NULL,
ActiveConnection activeConn = PRIMARY_CONNECTION )
pure virtual

Establishes the FIX session over FIX_TCP underlying protocol.

Parameters
protocolConfig- set of the FIX_TCP protocol parameters.
backupConn- parameters of the backup connection
activeConn- specifies which connection will be used, by default primary connection

◆ connect() [3/5]

virtual void Engine::Session::connect ( int HBI,
const FIXMessage & customLogonMsg,
const std::string & host,
int port,
const SessionBackupParameters * backupConn = NULL,
ActiveConnection activeConn = PRIMARY_CONNECTION )
pure virtual

Establishes the FIX session as Initiator using the custom Logon message.

Parameters
HBIHeartbeat interval (in seconds)
customLogonMsgthe custom Logon message.
hostremote FIX engine's host name or address.
portremote FIX engine's port.
encryptionEncrypt method.
backupConn- parameters of the backup connection
activeConn- specifies which connection will be used, by default primary connection

◆ connect() [4/5]

virtual void Engine::Session::connect ( int HBI,
const std::string & host,
int port,
const SessionBackupParameters * backupConn = NULL,
ActiveConnection activeConn = PRIMARY_CONNECTION )
pure virtual

Establishes the FIX session as Initiator.

Parameters
HBIHeartbeat interval (seconds)
hostremote FIX engine's host name or address.
portremote FIX engine's port.
encryptionEncrypt method.
backupConn- parameters of the backup connection
activeConn- specifies which connection will be used, by default primary connection

◆ connect() [5/5]

virtual void Engine::Session::connect ( SessionRole sessionRole = NA_SESSION_ROLE,
const SessionBackupParameters * pSessionBackupParameters = NULL )
pure virtual

Establishes the FIX session.

Parameters
sessionRole- session role to connect as. Default - NA_SESSION_ROLE means no role override use pre-configured via session extra parameters or engine.properties role.
pSessionBackupParameters- session backup parameters. It is applicable to initiator sessions only,.

◆ connState2string()

static const char * Engine::Session::connState2string ( ActiveConnection aState)
static

Returns the std::string representation of the given connection state value.

◆ detachStateObserver()

virtual void Engine::Session::detachStateObserver ( )
pure virtual

Detaches session state observer.

◆ disconnect() [1/2]

virtual void Engine::Session::disconnect ( bool forcefullyMarkAsTerminated = false)
pure virtual

Initiates disconnect of the session.

Parameters
forcefullyMarkAsTerminatedif true then the session will be marked as correctly terminated and persistent information about it will not be used during the subsequent connections.
Note
the forcefullyMarkAsTerminated parameter is used only if the IntradayLogoutTolerance configuration option is "false".

◆ disconnect() [2/2]

virtual void Engine::Session::disconnect ( const std::string & logoutText,
bool forcefullyMarkAsTerminated = false )
pure virtual

Initiates disconnect of the session with the given logout text.

Parameters
forcefullyMarkAsTerminatedif true then the session will be marked as correctly terminated and persistent information about it will not be used during the subsequent connections.
logoutTextReason of disconnecting
Note
the forcefullyMarkAsTerminated parameter is used only if the IntradayLogoutTolerance configuration option is "false".

◆ disconnectNonGracefully()

virtual void Engine::Session::disconnectNonGracefully ( )
pure virtual

Closes the telecommunication link and switches the session into the NON_GRACEFULLY_TERMINATED state.

◆ disconnectSync() [1/2]

virtual void Engine::Session::disconnectSync ( bool forcefullyMarkAsTerminated = false)
virtual

Initiates synchronous disconnect of the session.

Parameters
forcefullyMarkAsTerminatedif true then the session will be marked as correctly terminated and persistant information about it will not be used during the subsequent connections.
Note
the forcefullyMarkAsTerminated parameter is used only if the IntradayLogoutTolerance configuration option is "false".

◆ disconnectSync() [2/2]

virtual void Engine::Session::disconnectSync ( const std::string & logoutText,
bool forcefullyMarkAsTerminated = false )
virtual

Initiates synchronous disconnect of the session with the given logout text.

Parameters
forcefullyMarkAsTerminatedif true then the session will be marked as correctly terminated and persistant
logoutTextReason of disconnecting information about it will not be used during the subsequent connections.
Note
the forcefullyMarkAsTerminated parameter is used only if the IntradayLogoutTolerance configuration option is "false".

◆ getActiveConnectionType()

virtual ActiveConnection Engine::Session::getActiveConnectionType ( ) const
pure virtual

Returns current connection type.

◆ getActiveParameters()

virtual SessionExtraParameters Engine::Session::getActiveParameters ( ) const
pure virtual

Returns std::string representation of active session parameters.

Returns
std::string representation of active session parameters or NULL if parameters not exist

◆ getAppBaseVer()

virtual FIXVersion Engine::Session::getAppBaseVer ( ) const
pure virtual

Returns the FIX application protocol base version.

Note
protocol base FIXVersion cannot be used as an unique identifier of the application protocol in the parser

◆ getAppVer()

virtual ProtocolIndex Engine::Session::getAppVer ( ) const
pure virtual

Returns the FIX application protocol index in the parser.

◆ getBackupParameters()

virtual std::unique_ptr< SessionBackupParameters > Engine::Session::getBackupParameters ( ) const
pure virtual

Returns std::string representation of backup session parameters.

Returns
std::string representation of backup session parameters or NULL if parameters not exist

◆ getCurrentTagsDelimiter()

virtual unsigned char Engine::Session::getCurrentTagsDelimiter ( ) const
pure virtual

Returns session's tags delimiter that is currently being used;.

◆ getEncryptionMethod()

virtual Engine::EncryptMethod Engine::Session::getEncryptionMethod ( ) const
pure virtual

Returns the encryption method.

◆ getHBI()

virtual int Engine::Session::getHBI ( ) const
pure virtual

Returns Heartbeat interval (HeartBtInt) in seconds.

◆ getId()

virtual const std::string * Engine::Session::getId ( ) const
pure virtual

Returns the session's ID in the format 'SenderCompID 0x01 TargetCompId' or .

in format 'SenderCompID 0x01 TargetCompId 0x01 qualifier' if session qualifier is available.

◆ getInSeqNum()

virtual int Engine::Session::getInSeqNum ( ) const
pure virtual

Returns the next expected incoming sequence numbers for this FIX session.

◆ getInternalState()

virtual std::unique_ptr< InternalState > Engine::Session::getInternalState ( ) const
pure virtual

Returns current internal state for this FIX session.

◆ getMsgStorageBaseFilePath()

virtual const std::string Engine::Session::getMsgStorageBaseFilePath ( ) const
pure virtual

Returns message storage base file path.

Base file path is path to the file set without extension.

Returns
Returns message storage base file path

◆ getOutSeqNum()

virtual int Engine::Session::getOutSeqNum ( ) const
pure virtual

Returns the outgoing sequence numbers for this FIX session (MsgSeqNum of the next outgoing message).

◆ getOutSeqNumNoLock()

virtual int Engine::Session::getOutSeqNumNoLock ( ) const
pure virtual

Returns the outgoing sequence numbers for this FIX session (MsgSeqNum of the next outgoing message).

Note
Session::lock must be called to use this method.

◆ getPrimaryParameters()

virtual SessionExtraParameters Engine::Session::getPrimaryParameters ( ) const
pure virtual

Returns std::string representation of primary session parameters.

Returns
std::string representation of primary session parameters or NULL if parameters not exist

◆ getReceivedMessages()

virtual void Engine::Session::getReceivedMessages ( std::vector< FIXMessage * > * pMessages,
const MsgFilter & msgFilter ) const
pure virtual

Retrieves messages received by the session.

Parameters
pMessagesList of messages.
msgFilterspecifies selection criteria.
Warning
It's caller's responsibility to release returned messages.

◆ getRemoteAddress()

virtual System::InetAddress Engine::Session::getRemoteAddress ( ) const
pure virtual

Returns the remote FIX Engine's IP Address.

Exceptions
Utils::Exceptionif no data is available

◆ getRemoteHost()

virtual const std::string * Engine::Session::getRemoteHost ( ) const
pure virtual

Returns the remote FIX Engine's host name.

Exceptions
Utils::Exceptionif no data is available

◆ getRemoteHostIP()

virtual System::IPAddr Engine::Session::getRemoteHostIP ( ) const
virtual

Returns the remote FIX Engine's IP Address.

Exceptions
Utils::Exceptionif no data is available

◆ getRemotePort()

virtual int Engine::Session::getRemotePort ( ) const
pure virtual

Returns the remote FIX Engine's port number.

◆ getRole()

virtual Role Engine::Session::getRole ( ) const
pure virtual

Returns session's role.

◆ getSender()

virtual const std::string * Engine::Session::getSender ( ) const
pure virtual

Returns SenderCompID.

◆ getSessionEx()

virtual SessionEx * Engine::Session::getSessionEx ( )
virtual

Extends session interface.

◆ getSessionId()

virtual const SessionId & Engine::Session::getSessionId ( ) const
pure virtual

Returns reference to SessionId.

◆ getState()

virtual State Engine::Session::getState ( ) const
pure virtual

Returns session's state;.

See also
Session::state2string(State).

◆ getStateAsString()

virtual const char * Engine::Session::getStateAsString ( ) const
pure virtual

Returns current session's state as std::string;.

See also
Session::getState()

◆ getStatistics()

virtual void Engine::Session::getStatistics ( FixSessionStatisticsLite & statistics) const
pure virtual

Returns Session's Lite statistics.

◆ getStorageCreationTime()

virtual System::u64 Engine::Session::getStorageCreationTime ( ) const
pure virtual

Returns storage creation time as number of milliseconds since 1970.01.01 If no storage is assigned with Session, method returns 0.

◆ getStorageType()

virtual MessageStorageType Engine::Session::getStorageType ( ) const
pure virtual

Returns a session storage type.

◆ getTarget()

virtual const std::string * Engine::Session::getTarget ( ) const
pure virtual

Returns TargetCompID.

◆ getUnderlyingProtocol()

virtual UnderlyingProtocol Engine::Session::getUnderlyingProtocol ( ) const
pure virtual

Returns type of the underlying protocol.

◆ getVer()

virtual FIXVersion Engine::Session::getVer ( ) const
pure virtual

Returns the FIX protocol version.

◆ inflate()

virtual void Engine::Session::inflate ( FIXMessage * pMsg,
int msgSeqNumSize,
PutMessageOptions const * options = NULL ) const
pure virtual

Sets static session level fields in the message and reserves space for volatile session level fields.

Parameters
[out]pMsgPointer to the FIXMessage to store field values
[in]msgSeqNumSizeNumber of characters for MsgSeqNum field to reserve.
[in]optionsExtra parameters.
See also
Engine::PutMessageOptions.

◆ isInEstablishingConnectionMode()

virtual bool Engine::Session::isInEstablishingConnectionMode ( ) const
pure virtual

Returns true if the session is in establishing connection mode (INITIAL, RECONNECT, WAIT_FOR_CONFIRM_LOGON, WAIT_FOR_FIRST_LOGON, or WAIT_FOR_CONNECT states)

◆ isTCPBuffer()

virtual bool Engine::Session::isTCPBuffer ( ) const
pure virtual

◆ locateSentMessage()

virtual FIXMessage * Engine::Session::locateSentMessage ( int seqNum) const
pure virtual

Searches for a message by sequence number in the outgoing storage.

Returns
Pointer to FIXMessage is message was found; NULL otherwise.

◆ lock()

virtual void Engine::Session::lock ( )
pure virtual

Locks session's mutex.

◆ messageStorageTypeToString()

static const char * Engine::Session::messageStorageTypeToString ( MessageStorageType const & value)
static

Converts MessageStorageType to string.

◆ newSkel()

virtual FIXMessage * Engine::Session::newSkel ( const char * msgType,
Engine::ProtocolIndex app_ver = Engine::NA ) const
pure virtual

Creates instance of the FIX message.

◆ outgoingQueueSize()

virtual std::size_t Engine::Session::outgoingQueueSize ( ) const
pure virtual

Returns size of the outgoing message queue.

Returns
size of the outgoing message queue.

◆ parse()

virtual FIXMessage * Engine::Session::parse ( std::string const & raw) const
pure virtual

Creates instance of the FIX message.

◆ parserID()

virtual ParserID Engine::Session::parserID ( ) const
pure virtual

Returns unique parser identifier of the session.

◆ ping()

virtual void Engine::Session::ping ( const std::string & testReqID = "")
pure virtual

Sends Test Request message.

Parameters
testReqIDThe TestReqID field (tag = 112) - Identifier included in Test Request message to be returned in resulting Heartbeat message. If empty then a timestamp std::string will be used as the value.

◆ protocolID()

ParserID Engine::Session::protocolID ( ) const

Returns unique parser identifier of the session.

Deprecated
Use Engine::Session::parserID().

◆ put() [1/4]

virtual void Engine::Session::put ( const std::list< PreparedMessage * > & lMsgs)
inlinevirtual

Sends the list of given messages to the remote FIX engine in one packet.

After Session::put is return, message can be destroyed by user.

Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ put() [2/4]

virtual void Engine::Session::put ( const std::string & msgHeader,
const std::string & msgBody )
pure virtual

Sends the given message to the remote FIX engine.

Parameters
msgHeaderthe message header in the native FIX format.
msgBodythe message body in the native FIX format.
Warning
msgHeader and msgBody must be terminated by the FIX delimiter character (0x001).
msgHeader must contain at least the 'BeginString' and 'MsgType' fields.
Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ put() [3/4]

virtual void Engine::Session::put ( FIXMessage * pMsg,
PutMessageOptions const * options = NULL )
pure virtual

Sends the given message to the remote FIX engine.

After Session::put is return, message can be destroyed by user.

Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ put() [4/4]

virtual void Engine::Session::put ( PreparedMessage * pMsg)
pure virtual

Sends the given message to the remote FIX engine.

After Session::put is return, message can be destroyed by user.

Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ putAsIs() [1/2]

virtual void Engine::Session::putAsIs ( FIXMessage * msg,
int seqNum,
bool updateOutSeqNum )
pure virtual

Stores given message to outgoing storage and sends to socket.

Method does not fill session level fields (MsgSeqNum, SenderCompID, etc) After Session::putAsIs returns, message can be destroyed by user.

Parameters
msgmessage to send
seqNumGiven message sequence number. Session does not update message's sequence number.
updateOutSeqNumIf true, session will update internal outgoing sequence number.
Warning
It is user's responsibility to set all session level fields like SendingTime, SenderCompID, TargetCompID, etc.
Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ putAsIs() [2/2]

virtual void Engine::Session::putAsIs ( PreparedMessage * msg,
int seqNum,
bool updateOutSeqNum )
pure virtual

Stores given message to outgoing storage and sends to socket.

Method does not fill session level fields (MsgSeqNum, SenderCompID, etc) After Session::putAsIs returns, message can be destroyed by user.

Parameters
msgmessage to send
seqNumGiven message sequence number. Session does not update message's sequence number.
updateOutSeqNumIf true, session will update internal outgoing sequence number.
Warning
It is user's responsibility to set all session level fields like SendingTime, SenderCompID, TargetCompID, etc.
Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ putAsIsNoLock() [1/2]

virtual void Engine::Session::putAsIsNoLock ( FIXMessage * msg,
int seqNum,
bool updateOutSeqNum )
pure virtual

Stores given message to outgoing storage and sends to socket.

Method does not fill session level fields (MsgSeqNum, SenderCompID, etc) After Session::putAsIsNoLock is return, message can be destroyed by user.

Parameters
msgmessage to send
seqNumGiven message sequence number. Session does not update message's sequence number.
updateOutSeqNumIf true, session will update internal outgoing sequence number.
Note
Session::lock must be called to use this method.
Warning
It is user's responsibility to set all session level fields like SendingTime, SenderCompID, TargetCompID, etc.
Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ putAsIsNoLock() [2/2]

virtual void Engine::Session::putAsIsNoLock ( PreparedMessage * msg,
int seqNum,
bool updateOutSeqNum )
pure virtual

Stores given message to outgoing storage and sends to socket.

Method does not fill session level fields (MsgSeqNum, SenderCompID, etc) After Session::putAsIsNoLock is return, message can be destroyed by user.

Parameters
msgmessage to send
seqNumGiven message sequence number. Session does not update message's sequence number.
updateOutSeqNumIf true, session will update internal outgoing sequence number.
Note
Session::lock must be called to use this method.
Warning
It is user's responsibility to set all session level fields like SendingTime, SenderCompID, TargetCompID, etc.
Exceptions
Methodthrows Utils::Exception in case message is incorrect or session is closed.

◆ registerApplication()

virtual Application * Engine::Session::registerApplication ( Application * pNewApplication,
unsigned int delay = 300,
int maxTries = -1 )
pure virtual

Registers Application.

When any application callback executed - new Application coudn't be registered immediately. Session will tries to register new application during delay*triesAmount period.

Parameters
pNewApplicationInstance of class derived from Application that handles session's events.
delay- the time delay in microseconds when session tries to registrate new application
maxTries- the amount of attempts during session tries to registrate new application. '-1' means INFINITE attempt.
Warning
It is vital to call 'registerApplication(NULL)' before calling the 'release' method.
Returns
a pointer to the old application.

◆ resetMessageStorage()

virtual void Engine::Session::resetMessageStorage ( )
pure virtual

Reset messages storage, so nothing will be send on ResendRequest.

Deprecated
Use Engine::Session::resetSeqNum method

◆ resetSeqNum()

virtual void Engine::Session::resetSeqNum ( SeqNumResetStrategy strategy = RESET_SEQNUM_AND_SEND_LOGON_STRATEGY)
pure virtual

Resets sequence numbers according to chosen strategy.

See also
Engine::Session::SeqNumResetStrategy

◆ role2string()

static const char * Engine::Session::role2string ( SessionRole role)
static

Returns the string representation of the given Role value.

◆ setEnableMessageRejecting()

virtual void Engine::Session::setEnableMessageRejecting ( bool enable)
pure virtual

Forcedly sets the value of the Enable Message Rejecting.

◆ setForcedReconnect()

virtual void Engine::Session::setForcedReconnect ( bool enable)
pure virtual

Forcedly sets the value of the Forced Reconnect.

◆ setInSeqNum()

virtual void Engine::Session::setInSeqNum ( int seqNum)
pure virtual

Forcedly sets the value of the incoming sequence number (the expected MsgSeqNum of the next incoming message).

◆ setInternalState()

virtual void Engine::Session::setInternalState ( InternalState * state)
pure virtual

Forcedly sets the internal state.

◆ setIntradayLogoutToleranceMode()

virtual void Engine::Session::setIntradayLogoutToleranceMode ( bool enable)
pure virtual

Forcedly sets the value of the Intraday Logout Tolerance Mode.

◆ setOutSeqNum()

virtual void Engine::Session::setOutSeqNum ( int seqNum)
pure virtual

Forcedly sets the value of the outgoing sequence number (MsgSeqNum of the next outgoing message).

◆ setOutSeqNumNoLock()

virtual void Engine::Session::setOutSeqNumNoLock ( int seqNum)
pure virtual

Sets the value of the outgoing sequence number (MsgSeqNum of the next outgoing message).

Note
Session::lock must be called to use this method.

◆ setSenderLocationID()

virtual void Engine::Session::setSenderLocationID ( const std::string & id)
pure virtual

Forcedly sets the value of the Sender Location ID.

◆ setSenderSubID()

virtual void Engine::Session::setSenderSubID ( const std::string & id)
pure virtual

Forcedly sets the value of the Sender Sub ID.

◆ setSessionDestructionEvent()

virtual void Engine::Session::setSessionDestructionEvent ( System::ReferenceableManualEvent * event)
throw ( )
pure virtual

Assigns Session with Event object to notify user about session destruction.

◆ setTargetLocationID()

virtual void Engine::Session::setTargetLocationID ( const std::string & id)
pure virtual

Forcedly sets the value of the Target Location ID.

◆ setTargetSubID()

virtual void Engine::Session::setTargetSubID ( const std::string & id)
pure virtual

Forcedly sets the value of the Target Sub ID.

◆ setTCPBuffer()

virtual bool Engine::Session::setTCPBuffer ( bool enable)
pure virtual

Enables or disables TCP buffer.

Parameters
enable- when true, TCP buffer will be enabled.
Returns
true, if TCP buffer was enabled before.

◆ state2string()

static const char * Engine::Session::state2string ( State state)
static

Returns the string representation of the given state value.

◆ stringToMessageStorageType()

static MessageStorageType Engine::Session::stringToMessageStorageType ( char const * value)
static

Converts string to MessageStorageType.

◆ stringToMessageStorageTypeCaseI()

static MessageStorageType Engine::Session::stringToMessageStorageTypeCaseI ( char const * value)
static

Converts string to MessageStorageType.

Case insensitive.

◆ switchConnection()

virtual void Engine::Session::switchConnection ( )
pure virtual

Switch session to the another connection.

When current is a primary - switch to the backup. When current is a backup - switch to the primary.

◆ unlock()

virtual void Engine::Session::unlock ( )
pure virtual

UnLocks session.

◆ waitForStates()

virtual bool Engine::Session::waitForStates ( const std::set< State > & states,
const std::chrono::milliseconds & timeout = (std::chrono::milliseconds::max)() ) const
pure virtual

Waits before session gets into any state among provided.

Parameters
states- set of states to wait for.
timeout- maximal time period to wait for. If it equals to std::chrono::milliseconds::max() then wait forever.

Returns true if the session got into any of the states requested during timeout preiod and false otherwise

◆ waitForTerminated()

virtual void Engine::Session::waitForTerminated ( )
throw ( )
pure virtual

Blocks execution until all threads accittiated with Session are stopped.