Engine::Session Class Reference

#include <B2BITS_Session.h>

Inheritance diagram for Engine::Session:

Inheritance graph
[legend]
Collaboration diagram for Engine::Session:

Collaboration graph
[legend]

List of all members.

Public Types

enum  ActiveConnection { PRIMARY_CONNECTION = 0, BACKUP_CONNECTION, RESTORE_CONNECTION }
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
}
enum  Role { NA, INITIATOR, ACCEPTOR }
 Defines role of session. More...

Public Member Functions

virtual void connect (EncryptMethod encryption=Engine::NONE)=0
virtual void connect (int HBI, const std::string &host, int port, EncryptMethod encryption=Engine::NONE, const SessionBackupParameters *backupConn=NULL, ActiveConnection activeConn=PRIMARY_CONNECTION)=0
virtual void connect (int HBI, const FIXMessage &customLogonMsg, const std::string &host, int port, EncryptMethod encryption=Engine::NONE, const SessionBackupParameters *backupConn=NULL, ActiveConnection activeConn=PRIMARY_CONNECTION)=0
virtual void connect (const FixTcpParameters &protocolConfig, const FixTcpBackupParameters *backupConn=NULL)=0
virtual void connect (const FixT11TcpParameters &protocolConfig, const FixT11TcpBackupParameters *backupConn=NULL)=0
virtual UnderlyingProtocol getUnderlyingProtocol () const =0
virtual void disconnect (bool forcefullyMarkAsTerminated=false)=0
virtual void disconnect (const std::string &logoutText, bool forcefullyMarkAsTerminated=false)=0
virtual void disconnectNonGracefully ()=0
virtual void switchConnection ()=0
virtual void resetSeqNum ()=0
virtual ApplicationregisterApplication (Application *pNewApplication, unsigned int delay=300, int maxTries=-1)=0
virtual void put (FIXMessage *pMsg)=0
virtual void put (const std::string &msgHeader, const std::string &msgBody)=0
virtual State getState ()=0
virtual const char * getStateAsString ()=0
virtual void setInSeqNum (int seqNum)=0
virtual void setOutSeqNum (int seqNum)=0
virtual void setSenderLocationID (const std::string &id)=0
virtual void setTargetLocationID (const std::string &id)=0
virtual void setSenderSubID (const std::string &id)=0
virtual void setTargetSubID (const std::string &id)=0
virtual void setEnableMessageRejecting (bool enable)=0
virtual void setIntradayLogoutToleranceMode (bool enable)=0
virtual void setForcedReconnect (bool enable)=0
virtual const std::string * getSender () const =0
virtual const std::string * getTarget () const =0
virtual int getHBI () const =0
virtual FIXVersion getVer () const =0
virtual int getInSeqNum ()=0
virtual int getOutSeqNum ()=0
virtual void ping (const std::string &testReqID="")=0
virtual int getRemotePort ()=0
virtual const std::string * getRemoteHost ()=0
virtual const System::InetAddress & getRemoteAddress () const =0
virtual Role getRole () const =0
virtual const std::string * getId () const =0
virtual Engine::EncryptMethod getEncryptionMethod () const =0
 Returns the encryption method.
virtual bool setTCPBuffer (bool enable)=0
virtual bool isTCPBuffer () const =0
virtual void getReceivedMessages (std::vector< FIXMessage * > *pMessages, const MsgFilter &msgFilter) const =0
virtual const std::string * getMsgStorageName () const =0
virtual SessionEx * getSessionEx ()
virtual FIXMessagelocateSentMessage (int seqNum) const =0
virtual FIXMessagenewSkel (const char *msgType) const =0

Static Public Member Functions

static const char * state2string (State state)

Protected Member Functions

 Session ()
virtual ~Session ()

Friends

class SessionDataProvider


Detailed Description

Basic Session.

Member Enumeration Documentation

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.

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.

Defines role of session.

Enumerator:
NA  NA.
INITIATOR  Session is acceptor.
ACCEPTOR  Session is initiator.


Constructor & Destructor Documentation

Engine::Session::Session (  )  [inline, protected]

Constructor.

virtual Engine::Session::~Session (  )  [inline, protected, virtual]

Destructor.

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


Member Function Documentation

virtual void Engine::Session::connect ( EncryptMethod  encryption = Engine::NONE  )  [pure virtual]

Establishes the FIX session as Acceptor.

Parameters:
encryption Encrypt method.

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

Establishes the FIX session as Initiator.

Parameters:
HBI Heartbeat interval (seconds)
host remote FIX engine's host name or address.
port remote FIX engine's port.
encryption Encrypt method.
backupConn - parameters of the backup connection
activeConn - specifies which connection will be used, by default primary connection

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

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

Parameters:
HBI Heartbeat interval (in seconds)
customLogonMsg the custom Logon message.
host remote FIX engine's host name or address.
port remote FIX engine's port.
encryption Encrypt method.
backupConn - parameters of the backup connection
activeConn - specifies which connection will be used, by default primary connection

virtual void Engine::Session::connect ( const FixTcpParameters protocolConfig,
const FixTcpBackupParameters backupConn = NULL 
) [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

virtual void Engine::Session::connect ( const FixT11TcpParameters protocolConfig,
const FixT11TcpBackupParameters backupConn = NULL 
) [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

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

Returns type of the underlying protocol

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

Initiates disconnect of the session.

Parameters:
forcefullyMarkAsTerminated if 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".

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:
forcefullyMarkAsTerminated if true then the session will be marked as correctly terminated and persistant
logoutText Reason 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".

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

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

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.

virtual void Engine::Session::resetSeqNum (  )  [pure virtual]

Sends the Logon message with the ResetSeqNumFlag flat that indicates both sides of a FIX session should reset sequence numbers.

Warning:
cannot be used with FIX40.

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:
pNewApplication Instance 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.

virtual void Engine::Session::put ( FIXMessage pMsg  )  [pure virtual]

Sends the given message to the remote FIX engine.

Warning:
Method throws Utils::Exception in case message is incorrect or session is closed.

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:
msgHeader the message header in the native FIX format.
msgBody the 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.

Method throws Utils::Exception in case message is incorrect or session is closed.

virtual State Engine::Session::getState (  )  [pure virtual]

Returns session's state;

See also:
Session::state2string(State).

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

Returns current session's state as string;

See also:
Session::getState()

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

Returns the string representation of the given state value.

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

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

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

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

Forcedly sets the value of the Sender Location ID.

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

Forcedly sets the value of the Target Location ID.

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

Forcedly sets the value of the Sender Sub ID.

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

Forcedly sets the value of the Target Sub ID.

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

Forcedly sets the value of the Enable Message Rejecting.

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

Forcedly sets the value of the Intraday Logout Tolerance Mode.

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

Forcedly sets the value of the Forced Reconnect.

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

Returns SenderCompID.

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

Returns TargetCompID.

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

Returns Heartbeat interval (HeartBtInt) in seconds.

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

Returns the FIX protocol version.

virtual int Engine::Session::getInSeqNum (  )  [pure virtual]

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

virtual int Engine::Session::getOutSeqNum (  )  [pure virtual]

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

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

Sends Test Request message.

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

virtual int Engine::Session::getRemotePort (  )  [pure virtual]

Returns the remote FIX Engine's port number.

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

Returns the remote FIX Engine's host name.

Exceptions:
Utils::Exception if no data is available

virtual const System::InetAddress& Engine::Session::getRemoteAddress (  )  const [pure virtual]

Returns the remote FIX Engine's IP Address.

Exceptions:
Utils::Exception if no data is available

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

Returns session's role.

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

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

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.

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

Retrieves messages received by the session.

Parameters:
pMessages List of messages.
msgFilter specifies selection criteria.
Warning:
It's caller's responsibility to release returned messages.


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

Generated on Fri Apr 17 12:27:21 2009 for B2BITS FIX Antenna C++ by  doxygen 1.5.6