OnixS C++ FIX Engine  4.12.0
API Documentation
SessionConnectionSettings.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable OnixS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
22 #include <string>
23 #include <vector>
24 
26 
27 namespace OnixS {
28 namespace FIX {
29 namespace Scheduling {
30 /// The counterparty host name.
31 typedef std::string Host;
32 
33 /// The counterparty socket port.
34 typedef unsigned Port;
35 
36 /// The collection of parameters required to establish
37 /// a connection with a counterparty (session-acceptor).
39 {
40 public:
41  /// Initializes the blank instance.
42  Counterparty();
43 
44  /// Identifies a counterparty.
45  Counterparty(const Host & host, Port port);
46 
47  /// Initializes as a clone of another instance.
48  Counterparty(const Counterparty & other);
49 
50  /// Cleans everything up.
51  ~Counterparty();
52 
53  /// Defines the remote host to which the session must connect to.
54  const Host & host() const;
55 
56  /// Defines the port number to which the session must connect to.
57  Port port() const;
58 
59  /// Reinitializes an instance from another one.
60  Counterparty & operator = (const Counterparty & other);
61 
62 private:
63  Host * host_;
64  Port port_;
65 };
66 
67 
68 /// The ordered series of counterparties.
69 typedef std::vector<Counterparty> Counterparties;
70 
71 
72 /// The collection of connection-related attributes for the session.
74 {
75 public:
76  /// Initializes an instance from another one.
78  const SessionConnectionSettings & other);
79 
80  /// Cleans an instance up.
81  virtual ~SessionConnectionSettings();
82 
83  /// Specifies whether the session must be
84  /// connected as an acceptor or initiator.
85  SessionRole::Enum role() const;
86 
87  /// If the session must be logged on in the role of an initiator,
88  /// defines the value for the heartbeat interval in seconds.
89  /// Otherwise it has an undefined value.
90  unsigned heartBeatInterval() const;
91 
92  /// If the session must be logged on in the role of an initiator,
93  /// defines whether the 'SetResetSequenceNumbers' flag must be
94  /// sent within the logon message. Otherwise it has an undefined value.
95  bool setResetSequenceNumbers() const;
96 
97  /// If the session must be logged on in the role of an initiator,
98  /// defines the custom logon message which must be sent at
99  /// the logon. Otherwise it returns the NULL value.
100  Message * logonMessage() const;
101 
102  /// The list of all counterparties.
103  /// It is not used if the session must be logged on as an acceptor.
104  const Counterparties & counterparties() const;
105 
106  /// Copies all settings from another instance.
108  operator = (const SessionConnectionSettings & other);
109 
110 protected:
111  /// Initializes an instance with the given session role.
113 
114  /// Updates the heartbeat interval value.
115  void heartBeatInterval(unsigned interval);
116 
117  /// Updates the session reset sequence numbers policy.
118  void setResetSequenceNumbers(bool resetSeqNumbers);
119 
120  /// Assigns the custom logon message.
121  void logonMessage(const Message & message);
122 
123  /// The editable collection of counterparties.
124  Counterparties & counterparties();
125 
126 private:
127  SessionRole::Enum role_;
128 
129  unsigned heartBeatInterval_;
130 
131  bool resetSeqNumbers_;
132 
133  Message * logonMessage_;
134 
135  Counterparties * counterparties_;
136 };
137 
138 inline
141 {
142  return role_;
143 }
144 
145 inline
146 unsigned
148 {
149  return heartBeatInterval_;
150 }
151 
152 inline
153 bool
155 {
156  return resetSeqNumbers_;
157 }
158 
159 inline
160 Message *
162 {
163  return logonMessage_;
164 }
165 
166 inline
167 const Counterparties &
169 {
170  return *counterparties_;
171 }
172 
173 /// Session connection settings for session-acceptors.
174 class
178 {
179 public:
180  /// Initializes settings for sessions-acceptors.
182 };
183 
184 /// Session connection settings for session-initiators.
185 class
189 {
190 public:
191  /// Initializes an instance with session-initiator related attributes.
192  /// @param host Defines the remote host to which the session must connect to.
193  /// @param port Defines the port number to which the session must connect to.
195  const Host & host, Port port);
196 
197  /// Initializes an instance with session-initiator related attributes.
198  /// @param host Defines the remote host to which the session must connect to.
199  /// @param port Defines the port number to which the session must connect to.
200  /// @param resetSessionSequenceNumbers Defines whether
201  /// the 'SetResetSequenceNumbers' flag must be sent within the logon message.
203  const Host & host, Port port,
204  bool resetSessionSequenceNumbers);
205 
206  /// Initializes an instance with session-initiator related attributes.
207  /// @param host Defines the remote host to which the session must connect to.
208  /// @param port Defines the port number to which the session must connect to.
209  /// @param heartbeatInterval Defines the time interval between heartbeats
210  /// messages.
212  const Host & host, Port port,
213  unsigned heartbeatInterval);
214 
215  /// Initializes an instance with session-initiator related attributes.
216  /// @param host Defines the remote host to which the session must connect to.
217  /// @param port Defines the port number to which the session must connect to.
218  /// @param customLogonMessage Defines the custom logon message which should
219  /// be used at the logon.
221  const Host & host, Port port,
222  const Message & customLogonMessage);
223 
224  /// Initializes an instance with session-initiator related attributes.
225  /// @param host Defines the remote host to which the session must connect to.
226  /// @param port Defines the port number to which the session must connect to.
227  /// @param heartbeatInterval Defines the time interval between heartbeats
228  /// @param resetSessionSequenceNumbers Defines whether
229  /// the 'SetResetSequenceNumbers' flag must be sent within the logon message.
230  /// @param customLogonMessage Optionally defines the custom logon message
231  /// which should be used at the logon.
233  const Host & host,
234  Port port,
235  unsigned heartbeatInterval,
236  bool resetSessionSequenceNumbers,
237  const Message * customLogonMessage = ONIXS_FIXENGINE_NULLPTR);
238 
239  /// Adds one more counterparty for the list of counterparties session should try to connect to.
240  void addCounterparty(const Host & host, Port port);
241 };
242 }
243 }
244 }
The collection of connection-related attributes for the session.
std::string Host
The counterparty host name.
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
Message * logonMessage() const
If the session must be logged on in the role of an initiator, defines the custom logon message which ...
Session connection settings for session-initiators.
The collection of parameters required to establish a connection with a counterparty (session-acceptor...
unsigned heartBeatInterval() const
If the session must be logged on in the role of an initiator, defines the value for the heartbeat int...
Session connection settings for session-acceptors.
SessionRole::Enum role() const
Specifies whether the session must be connected as an acceptor or initiator.
unsigned Port
The counterparty socket port.
const Counterparties & counterparties() const
The list of all counterparties.
Encapsulates operations over a FIX Message.
Definition: Message.h:49
bool setResetSequenceNumbers() const
If the session must be logged on in the role of an initiator, defines whether the &#39;SetResetSequenceNu...
std::vector< Counterparty > Counterparties
The ordered series of counterparties.