OnixS C++ FIX Engine 2.79.1.0
C:/Users/Pasha/_Dev/fixforge-cpp/fix/cppEngine/include/OnixS/FIX/Scheduling/SessionConnectionSettings.h
00001 /*
00002 * Copyright 2005-2011 Onix Solutions Limited [OnixS]. All rights reserved. 
00003 * 
00004 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law 
00005 * and international copyright treaties. 
00006 * 
00007 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
00008 * Services Agreement (the Agreement) and Customer end user license agreements granting 
00009 * a non-assignable, non-transferable and non-exclusive license to use the software 
00010 * for it's own data processing purposes under the terms defined in the Agreement.
00011 * 
00012 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part 
00013 * of this source code or associated reference material to any other location for further reproduction
00014 * or redistribution, and any amendments to this copyright notice, are expressly prohibited. 
00015 *
00016 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with 
00017 * the terms of the Agreement is a violation of copyright law. 
00018 */
00019 
00020 #if !defined(__ONIXS_FIXENGINE_SCHEDULING_SESSIONCONNECTIONSETTINGS_H__)
00021 #define __ONIXS_FIXENGINE_SCHEDULING_SESSIONCONNECTIONSETTINGS_H__
00022 
00023 #include <string>
00024 #include <vector>
00025 
00026 #include "OnixS/FIX/Session.h"
00027 
00028 namespace OnixS
00029 {
00030     namespace FIX
00031     {
00032         namespace Scheduling
00033         {
00035             typedef std::string Host;
00036             
00038             typedef unsigned Port;
00039 
00042             class ONIXS_FIXENGINE_API Counterparty
00043             {
00044             public:
00046                 Counterparty();
00047                 
00049                 Counterparty(const Host& host, Port port);
00050                 
00052                 Counterparty(const Counterparty& other);
00053 
00055                 ~Counterparty();
00056 
00058                 const Host& host() const;
00059 
00061                 Port port() const;
00062 
00064                 Counterparty& operator =(const Counterparty& other);
00065 
00066             private:
00067                 Host* host_;
00068                 Port port_;
00069             };
00070 
00071 
00073             typedef std::vector<Counterparty> Counterparties;
00074 
00075 
00077             class ONIXS_FIXENGINE_API SessionConnectionSettings
00078             {
00079             public:
00081                 SessionConnectionSettings(
00082                     const SessionConnectionSettings& other);
00083 
00085                 virtual ~SessionConnectionSettings();
00086 
00089                 Session::Role role() const;
00090                 
00094                 unsigned heartBeatInterval() const;
00095                 
00099                 bool setResetSequenceNumbers() const;
00100 
00104                 Message* logonMessage() const;
00105 
00108                 const Counterparties& counterparties() const;
00109 
00111                 SessionConnectionSettings& 
00112                 operator =(const SessionConnectionSettings& other);
00113 
00114             protected:
00116                 SessionConnectionSettings(Session::Role role);
00117 
00119                 void heartBeatInterval(unsigned interval);
00120 
00122                 void setResetSequenceNumbers(bool resetSeqNumbers);
00123 
00125                 void logonMessage(const Message& message);
00126 
00128                 Counterparties& counterparties();
00129 
00130             private:
00131                 Session::Role role_;
00132                 
00133                 unsigned heartBeatInterval_;
00134                 
00135                 bool resetSeqNumbers_;
00136 
00137                 Message* logonMessage_;
00138 
00139                 Counterparties* counterparties_;
00140             };
00141 
00142             inline 
00143             Session::Role 
00144             SessionConnectionSettings::role() const
00145             {
00146                 return role_;
00147             }
00148                 
00149             inline 
00150             unsigned 
00151             SessionConnectionSettings::heartBeatInterval() const
00152             {
00153                 return heartBeatInterval_;
00154             }
00155             
00156             inline 
00157             bool 
00158             SessionConnectionSettings::setResetSequenceNumbers() const
00159             {
00160                 return resetSeqNumbers_;
00161             }
00162 
00163             inline 
00164             Message* 
00165             SessionConnectionSettings::logonMessage() const
00166             {
00167                 return logonMessage_;
00168             }
00169 
00170             inline 
00171             const Counterparties& 
00172             SessionConnectionSettings::counterparties() const
00173             {
00174                 return *counterparties_;
00175             }
00176 
00178             class 
00179             ONIXS_FIXENGINE_API 
00180             AcceptorConnectionSettings 
00181                 : public SessionConnectionSettings
00182             {
00183             public:
00185                 AcceptorConnectionSettings();
00186             };
00187 
00188             // Session connection settings for session as initiators.
00189             class 
00190             ONIXS_FIXENGINE_API 
00191             InitiatorConnectionSettings 
00192                 : public SessionConnectionSettings
00193             {
00194             public:
00198                 InitiatorConnectionSettings(
00199                     const Host& host, Port port);
00200 
00206                 InitiatorConnectionSettings(
00207                     const Host& host, Port port,
00208                     bool resetSessionSequenceNumbers);
00209 
00215                 InitiatorConnectionSettings(
00216                     const Host& host, Port port,
00217                     unsigned heartbeatInterval);
00218 
00224                 InitiatorConnectionSettings(
00225                     const Host& host, Port port,
00226                     const Message& customLogonMessage);
00227 
00236                 InitiatorConnectionSettings(
00237                     const Host& host, 
00238                     Port port,
00239                     unsigned heartbeatInterval,
00240                     bool resetSessionSequenceNumbers,
00241                     const Message* customLogonMessage = NULL);
00242 
00245                 void addCounterparty(const Host& host, Port port);
00246             };
00247         }
00248     }
00249 }
00250 
00251 #endif // __ONIXS_FIXENGINE_SCHEDULING_SESSIONCONNECTIONSETTINGS_H__