B2BITS FIX Antenna HFT
1.0.16
|
#include <B2BITS_Session.h>
Public Types | |
enum | ActiveConnection { PRIMARY_CONNECTION = 0, BACKUP_CONNECTION, RESTORE_CONNECTION } |
Active connection to use. More... | |
typedef SessionRole | Role |
Session role. More... | |
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 |
virtual void | closeMessageStorage ()=0 |
Close message storage. More... | |
virtual void | commitIncomingMessage (Engine::FIXMessageProcessElem *work) const =0 |
Saves incoming message to the session storage if it is not commited yet. More... | |
virtual void | connect (EncryptMethod encryption=Engine::NONE)=0 |
Establishes the FIX session as Acceptor. More... | |
virtual void | connect (int HBI, const std::string &host, int port, EncryptMethod encryption=Engine::NONE, const SessionBackupParameters *backupConn=NULL, ActiveConnection activeConn=PRIMARY_CONNECTION)=0 |
Establishes the FIX session as Initiator. More... | |
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 |
Establishes the FIX session as Initiator using the custom Logon message. More... | |
virtual void | connect (const FixTcpParameters &protocolConfig, const FixTcpBackupParameters *backupConn=NULL)=0 |
Establishes the FIX session over FIX_TCP underlying protocol. More... | |
virtual void | connect (const FixT11TcpParameters &protocolConfig, const FixT11TcpBackupParameters *backupConn=NULL)=0 |
Establishes the FIX session over FIXT11_TCP underlying protocol. More... | |
virtual void | detachStateObserver ()=0 |
virtual void | disconnect (bool forcefullyMarkAsTerminated=false)=0 |
Initiates disconnect of the session. More... | |
virtual void | disconnect (const std::string &logoutText, bool forcefullyMarkAsTerminated=false)=0 |
Initiates disconnect of the session with the given logout text. More... | |
virtual void | disconnectNonGracefully ()=0 |
Closes the telecommunication link and switches the session into the NON_GRACEFULLY_TERMINATED state. More... | |
virtual void | disconnectSync (bool forcefullyMarkAsTerminated=false) |
Initiates synchronous disconnect of the session. More... | |
virtual void | disconnectSync (const std::string &logoutText, bool forcefullyMarkAsTerminated=false) |
Initiates synchronous disconnect of the session with the given logout text. More... | |
virtual ActiveConnection | getActiveConnectionType () const =0 |
Returns current connection type. More... | |
virtual std::auto_ptr < SessionExtraParameters > | getActiveParameters () const =0 |
Returns std::string representation of active session parameters. More... | |
virtual std::auto_ptr < SessionBackupParameters > | getBackupParameters (bool forceLock=true) const =0 |
Returns std::string representation of backup session parameters forceLock - if false then try and may give up and return empty data. More... | |
virtual Engine::EncryptMethod | getEncryptionMethod () const =0 |
Returns the encryption method. More... | |
virtual int | getHBI () const =0 |
Returns Heartbeat interval (HeartBtInt) in seconds. More... | |
virtual const std::string * | getId () const =0 |
Returns the session's ID in the format 'SenderCompID 0x01 TargetCompId'. More... | |
virtual int | getInSeqNum () const =0 |
Returns the incoming sequence numbers for this FIX session (the expected MsgSeqNum of the next incoming message). More... | |
virtual const std::string | getMsgStorageBaseFilePath () const =0 |
Returns message storage base file path. More... | |
virtual int | getOutSeqNum () const =0 |
Returns the outgoing sequence numbers for this FIX session (MsgSeqNum of the next outgoing message). More... | |
virtual std::auto_ptr < SessionExtraParameters > | getPrimaryParameters (bool forceLock=true) const =0 |
Returns std::string representation of primary session parameters forceLock - if false then try and may give up and return empty data. More... | |
virtual void | getReceivedMessages (std::vector< FIXMessage * > *pMessages, const MsgFilter &msgFilter) const =0 |
Retrieves messages received by the session. More... | |
virtual const System::InetAddress & | getRemoteAddress () const =0 |
Returns the remote FIX Engine's IP Address. More... | |
virtual const std::string * | getRemoteHost () const =0 |
Returns the remote FIX Engine's host name. More... | |
virtual IPAddr | getRemoteHostIP () const |
Returns the remote FIX Engine's IP Address. More... | |
virtual int | getRemotePort ()=0 |
Returns the remote FIX Engine's port number. More... | |
virtual Role | getRole () const =0 |
Returns session's role. More... | |
virtual const std::string * | getSender () const =0 |
Returns SenderCompID. More... | |
virtual SessionEx * | getSessionEx () |
Extends session interface. More... | |
virtual System::u64 | getSessionGlobalID ()=0 |
Returns session global id. More... | |
virtual State | getState () const =0 |
Returns session's state;. More... | |
virtual const char * | getStateAsString ()=0 |
Returns current session's state as std::string;. More... | |
virtual MessageStorageType | getStorageType () const =0 |
Returns a session storage type. More... | |
virtual const std::string * | getTarget () const =0 |
Returns TargetCompID. More... | |
virtual UnderlyingProtocol | getUnderlyingProtocol () const =0 |
Returns type of the underlying protocol. More... | |
virtual unsigned | getUserSessionKey () const =0 |
Returns session user key FIXFields::CMIUserSessionKey obtained in logon. More... | |
virtual FIXVersion | getVer () const =0 |
Returns the FIX protocol version. More... | |
virtual bool | isTCPBuffer () const =0 |
Checks if TCP buffer is enabled. More... | |
virtual FIXMessage * | locateSentMessage (int seqNum) const =0 |
Searches for a message by sequence number in the outgoing storage. More... | |
virtual bool | locateSentMessage (int seqNum, std::string &buf) const =0 |
Searches for a message by sequence number in the outgoing storage. More... | |
virtual FIXMessage * | newSkel (const char *msgType, Engine::FIXVersion app_ver=Engine::NA) const =0 |
Creates instance of the message withe same protocol as session is. More... | |
virtual std::size_t | outgoingQueueSize () const =0 |
Returns size of the outgoing message queue. More... | |
virtual void | parse (Parser::LiteFixMessage *msg, const char *ptr, int size, bool clearTheMessageBeforeUse, bool isMakeStandalone, Engine::FIXTagVisitor *callback, bool isIncoming)=0 |
Parses input buffer and fills existing LiteFixMessage with tags. More... | |
virtual void | ping (const std::string &testReqID="")=0 |
Sends Test Request message. More... | |
virtual ProtocolID | protocolID () const =0 |
Returns unique protocol identifier of the session. More... | |
virtual void | put (FIXMessage *pMsg, PutMessageOptions const *options=NULL)=0 |
Sends the given message to the remote FIX engine. More... | |
virtual void | put (const std::string &msgHeader, const std::string &msgBody)=0 |
Sends the given message to the remote FIX engine. More... | |
virtual void | put (const void *binaryMessage, size_t binaryMessageSize, PutMessageOptions const *options=NULL)=0 |
Sends the given binary message to counter-party. More... | |
virtual Application * | registerApplication (Application *pNewApplication, unsigned int delay=300, int maxTries=-1)=0 |
Registers Application. More... | |
virtual void | resetMessageStorage ()=0 |
Reset messages storage, so nothing will be send on ResendRequest. More... | |
virtual void | resetSeqNum (SeqNumResetStrategy strategy=RESET_SEQNUM_AND_SEND_LOGON_STRATEGY)=0 |
Resets sequence numbers according to chosen strategy. More... | |
virtual void | resumeRead ()=0 |
Activates reading from the session socket if it was paused. More... | |
virtual void | setEnableMessageRejecting (bool enable)=0 |
Forcedly sets the value of the Enable Message Rejecting. More... | |
virtual void | setForcedReconnect (bool enable)=0 |
Forcedly sets the value of the Forced Reconnect. More... | |
virtual void | setInSeqNum (int seqNum)=0 |
Forcedly sets the value of the incoming sequence number (the expected MsgSeqNum of the next incoming message). More... | |
virtual void | setIntradayLogoutToleranceMode (bool enable)=0 |
Forcedly sets the value of the Intraday Logout Tolerance Mode. More... | |
virtual void | setOutSeqNum (int seqNum)=0 |
Forcedly sets the value of the outgoing sequence number (MsgSeqNum of the next outgoing message). More... | |
virtual void | setSenderLocationID (const std::string &id)=0 |
Forcedly sets the value of the Sender Location ID. More... | |
virtual void | setSenderSubID (const std::string &id)=0 |
Forcedly sets the value of the Sender Sub ID. More... | |
virtual void | setTargetLocationID (const std::string &id)=0 |
Forcedly sets the value of the Target Location ID. More... | |
virtual void | setTargetSubID (const std::string &id)=0 |
Forcedly sets the value of the Target Sub ID. More... | |
virtual bool | setTCPBuffer (bool enable)=0 |
Enables or disables TCP buffer. More... | |
virtual void | switchConnection ()=0 |
Switch session to the another connection. More... | |
virtual void | syncMessageStorage ()=0 |
Flushes storage cache. More... | |
virtual bool | waitUntilTerminated (int timeout=-1)=0 |
Waits until all internal threads are stopped. More... | |
Public Member Functions inherited from Utils::ReferenceCounter | |
virtual bool | addRef () const throw () |
Increments reference counter. More... | |
long | decrement () const throw () |
virtual long | getNRef () const throw () |
Returns the current value of the reference counter. More... | |
ReferenceCounter () throw () | |
Constructor. More... | |
virtual long | release () const throw () |
Decrements reference counter. More... | |
Static Public Member Functions | |
static const char * | connState2string (ActiveConnection aState) |
Returns the std::string representation of the given connection state value. More... | |
static const char * | messageStorageTypeToString (MessageStorageType value) |
Converts MessageStorageType to string. More... | |
static const char * | role2string (SessionRole role) |
Returns the string representation of the given Role value. More... | |
static const char * | state2string (State state) |
Returns the string representation of the given state value. More... | |
static MessageStorageType | stringToMessageStorageType (char const *value) |
Converts string to MessageStorageType. More... | |
Protected Member Functions | |
Session () | |
Constructor. More... | |
virtual | ~Session () |
Destructor. More... | |
Protected Member Functions inherited from Utils::ReferenceCounter | |
virtual | ~ReferenceCounter () |
Destructor. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Utils::ReferenceCounter | |
volatile System::u32 | m_nRef |
The counter. More... | |
Basic Session.
typedef SessionRole Engine::Session::Role |
Session role.
Sequence numbers reset strategy.
Possible states of Session.
|
inlineprotected |
Constructor.
|
inlineprotectedvirtual |
Destructor.
|
pure virtual |
|
pure virtual |
Close message storage.
Method forcedly closes storage if session is in the NGT/CT state.
|
pure virtual |
Saves incoming message to the session storage if it is not commited yet.
|
pure virtual |
Establishes the FIX session as Acceptor.
encryption | Encrypt method. |
|
pure virtual |
Establishes the FIX session as Initiator.
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 |
|
pure virtual |
Establishes the FIX session as Initiator using the custom Logon message.
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 |
|
pure virtual |
Establishes the FIX session over FIX_TCP underlying protocol.
protocolConfig | - set of the FIX_TCP protocol parameters. |
backupConn | - parameters of the backup connection |
|
pure virtual |
Establishes the FIX session over FIXT11_TCP underlying protocol.
protocolConfig | - set of the FIXT11_TCP protocol parameters. |
backupConn | - parameters of the backup connection |
|
static |
Returns the std::string representation of the given connection state value.
|
pure virtual |
|
pure virtual |
Initiates disconnect of the session.
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. |
|
pure virtual |
Initiates disconnect of the session with the given logout text.
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. |
|
pure virtual |
Closes the telecommunication link and switches the session into the NON_GRACEFULLY_TERMINATED state.
|
virtual |
Initiates synchronous disconnect of the session.
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. |
|
virtual |
Initiates synchronous disconnect of the session with the given logout text.
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. |
|
pure virtual |
Returns current connection type.
|
pure virtual |
Returns std::string representation of active session parameters.
|
pure virtual |
Returns std::string representation of backup session parameters forceLock - if false then try and may give up and return empty data.
|
pure virtual |
Returns the encryption method.
|
pure virtual |
Returns Heartbeat interval (HeartBtInt) in seconds.
|
pure virtual |
Returns the session's ID in the format 'SenderCompID 0x01 TargetCompId'.
|
pure virtual |
Returns the incoming sequence numbers for this FIX session (the expected MsgSeqNum of the next incoming message).
|
pure virtual |
Returns message storage base file path.
Base file path is path to the file set without extension.
|
pure virtual |
Returns the outgoing sequence numbers for this FIX session (MsgSeqNum of the next outgoing message).
|
pure virtual |
Returns std::string representation of primary session parameters forceLock - if false then try and may give up and return empty data.
|
pure virtual |
Retrieves messages received by the session.
pMessages | List of messages. |
msgFilter | specifies selection criteria. |
|
pure virtual |
Returns the remote FIX Engine's IP Address.
Utils::Exception | if no data is available |
|
pure virtual |
Returns the remote FIX Engine's host name.
Utils::Exception | if no data is available |
|
virtual |
Returns the remote FIX Engine's IP Address.
Utils::Exception | if no data is available |
|
pure virtual |
Returns the remote FIX Engine's port number.
|
pure virtual |
Returns session's role.
|
pure virtual |
Returns SenderCompID.
|
virtual |
Extends session interface.
|
pure virtual |
Returns session global id.
|
pure virtual |
Returns session's state;.
|
pure virtual |
Returns current session's state as std::string;.
|
pure virtual |
Returns a session storage type.
|
pure virtual |
Returns TargetCompID.
|
pure virtual |
Returns type of the underlying protocol.
|
pure virtual |
Returns session user key FIXFields::CMIUserSessionKey obtained in logon.
|
pure virtual |
Returns the FIX protocol version.
|
pure virtual |
Checks if TCP buffer is enabled.
|
pure virtual |
Searches for a message by sequence number in the outgoing storage.
|
pure virtual |
Searches for a message by sequence number in the outgoing storage.
[out] | buf | result message |
|
static |
Converts MessageStorageType to string.
|
pure virtual |
Creates instance of the message withe same protocol as session is.
|
pure virtual |
Returns size of the outgoing message queue.
|
pure virtual |
Parses input buffer and fills existing LiteFixMessage with tags.
msg | LiteFixMessage to fill |
ptr | pointer to the buffer |
size | buffer size |
clearTheMessageBeforeUse | if true message will be cleared before parsing |
isMakeStandalone | if true buffer will be copied to the internal storage otherwise links to the passed buffer will be kept |
callback | FIXTagVisitor will be called for each parsed tag. Optional. |
isIncoming | defines if message is incoming (for non-FIX protocols only) |
|
pure virtual |
Sends Test Request message.
testReqID | The 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. |
|
pure virtual |
Returns unique protocol identifier of the session.
|
pure virtual |
Sends the given message to the remote FIX engine.
|
pure virtual |
Sends the given message to the remote FIX engine.
msgHeader | the message header in the native FIX format. |
msgBody | the message body in the native FIX format. |
|
pure virtual |
Sends the given binary message to counter-party.
|
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.
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. |
|
pure virtual |
Reset messages storage, so nothing will be send on ResendRequest.
|
pure virtual |
Resets sequence numbers according to chosen strategy.
|
pure virtual |
Activates reading from the session socket if it was paused.
|
static |
Returns the string representation of the given Role value.
|
pure virtual |
Forcedly sets the value of the Enable Message Rejecting.
|
pure virtual |
Forcedly sets the value of the Forced Reconnect.
|
pure virtual |
Forcedly sets the value of the incoming sequence number (the expected MsgSeqNum of the next incoming message).
|
pure virtual |
Forcedly sets the value of the Intraday Logout Tolerance Mode.
|
pure virtual |
Forcedly sets the value of the outgoing sequence number (MsgSeqNum of the next outgoing message).
|
pure virtual |
Forcedly sets the value of the Sender Location ID.
|
pure virtual |
Forcedly sets the value of the Sender Sub ID.
|
pure virtual |
Forcedly sets the value of the Target Location ID.
|
pure virtual |
Forcedly sets the value of the Target Sub ID.
|
pure virtual |
Enables or disables TCP buffer.
enable | - when true, TCP buffer will be enabled. |
|
static |
Returns the string representation of the given state value.
|
static |
Converts string to MessageStorageType.
|
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.
|
pure virtual |
Flushes storage cache.
Returns when finished.
|
pure virtual |
Waits until all internal threads are stopped.
Method can be called in the INITIAL, NON_GRACEFULLY_TERMINATED and CORRECTLY_TERMINATED states.