CTR Pia  4.11.3
Game Communication Engine
transport_ReliableBroadcastProtocol.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: transport_ReliableBroadcastProtocol.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/transport/transport_definitions.h>
18 
19 #include <pia/transport/transport_Protocol.h>
20 #include <pia/common/common_Time.h>
21 
22 
23 namespace nn
24 {
25 namespace pia
26 {
27 namespace transport
28 {
29 class ProtocolMessageWriter;
30 class ProtocolMessageReader;
31 }
32 }
33 }
34 
35 
36 namespace nn
37 {
38 namespace pia
39 {
40 namespace transport
41 {
42 
43 
44 /*!
45 @brief Represents a protocol for sending a large volume of data to all stations.
46 
47 @date 2014-07-16 Changed the specifications so that <tt>ResultTemporaryUnavailable</tt> is returned when the <tt>StartSend</tt> or <tt>StartReceive</tt> function is called during joint sessions or during state transitions between sessions.
48 @date 2014-07-10 Fixed broken links in the API reference.
49 @date 2014-07-01 Changed the specifications of <tt>TransferSetting</tt>. Use <tt>TransferSetting::GetSourceStationId</tt> to get the sender's <tt>StationId</tt>.
50 @date 2014-04-02 Revised the documentation for the <tt>IsXXXX</tt> functions in the <tt>Configuration</tt> class.
51 @date 2013-05-27 Fixed an incorrect return value sometimes returned from the <tt>Cancel</tt> function.
52 @date 2013-04-25 Refactored code. This breaks backward compatibility.
53 @date 2012-03-29 The value specified in the <tt>SetThroughputLimit</tt> function is now set as the default value when communication starts.
54 @date 2012-10-29 Improved throughput by tuning the way that data is sent.
55 @date 2012-10-17 Fixed a bug where the <tt>GetProgress</tt> function might halt on an assertion.
56 @date 2012-09-18 Added the <tt>SetThroughputLimit</tt> and <tt>GetThroughputLimit</tt> functions.
57 @date 2012-09-10 Tuned throughput.
58 @date 2012-08-21 Initial version.
59 */
61 {
62 public:
63  PIA_PROTOCOL_TYPE_INFO(PROTOCOL_TYPE_RELIABLE_BROADCAST);
64 
65 /*!
66 @cond PRIVATE
67 @brief Instantiates the object with default parameters (default constructor).
68 
69 @details Do not call this constructor directly from applications.
70 Use the <tt>@ref Transport::CreateProtocol</tt> function to create an instance.
71 */
73  //! @endcond
74 
75 
76 /*!
77 @cond PRIVATE
78 @brief Destructor.
79 
80 @details Do not call this destructor directly from applications.
81 Use the <tt>@ref Transport::DestroyProtocol</tt> function to destroy an instance.
82 */
83  virtual ~ReliableBroadcastProtocol();
84  //! @endcond
85 
86 
87 /*!
88 @brief Initializes the instance. Make this call between the <tt>BeginSetup</tt> and <tt>EndSetup</tt> functions.
89 
90 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
91 
92 @retval ResultAlreadyInitialized Indicates that the instance is already initialized. Programming error. Fix your program so that this error is not returned.
93 
94 @see Finalize
95 */
96  nn::Result Initialize();
97 
98 
99 /*!
100 @brief Finalizes the class instance.
101 @see Initialize
102 */
103  void Finalize();
104 
105 
106 /*!
107 @cond PRIVATE
108 @brief Starts communication.
109 
110 @param[in] myStationIndex The <tt>StationIndex</tt> value of the local station. Specify a value in the range from <tt>STATION_INDEX_1</tt> to <var>maxConnections</var>.
111 
112 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds.
113 
114 @retval ResultNotInitialized Indicates that the instance is not initialized. Programming error. Fix your program so that this error is not returned.
115 @retval ResultInvalidState Indicates that stations are already communicating. Programming error. Fix your program so that this error is not returned.
116 @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
117 */
118  virtual nn::Result Startup(StationIndex myStationIndex);
119  //! @endcond
120 
121 
122 /*!
123 @cond PRIVATE
124 @brief Ends communication.
125 */
126  virtual void Cleanup();
127  //! @endcond
128 
129 
130 /*!
131 @cond PRIVATE
132 @brief The main process.
133 
134 @return Returns <tt>nn::ResultSuccess</tt>.
135 */
136  virtual nn::Result Dispatch();
137  //! @endcond
138 
139 
140 /*!
141 @cond PRIVATE
142 @brief Switches the connection status.
143 
144 @param[in] event Specifies the event representing the operation.
145 
146 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds.
147 
148 @retval ResultInvalidState Indicates that communication is not active. Programming error. Fix your program so that this error is not returned.
149 @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
150 */
151  virtual nn::Result UpdateProtocolEvent(const transport::ProtocolEvent& event);
152  //! @endcond
153 
154 private:
155 /*!
156 @cond PRIVATE
157 @brief Enumerates the operational modes of the protocol.
158 */
159  enum Mode
160  {
161  MODE_INVALID = 0x00000000,
162  MODE_WAIT = 0x01000000,
163  MODE_SEND = 0x02000000,
164  MODE_RECEIVE = 0x03000000
165  };
166  //! @endcond
167 
168 
169 /*!
170 @cond PRIVATE
171 @brief Enumerates the progress statuses of the protocol.
172 */
173  enum Condition
174  {
175  CONDITION_WAIT = 0x00010000,
176  CONDITION_IN_PROGRESS = 0x00020000,
177  CONDITION_SUCCESS = 0x00030000,
178  CONDITION_FAILURE = 0x00040000
179  };
180  //! @endcond
181 
182 
183 /*!
184 @cond PRIVATE
185 @brief Gets the current operation mode.
186 @return Returns the current operation mode.
187 */
188  Mode GetMode() const
189  {
190  return static_cast<Mode>(m_State & 0xFF000000);
191  }
192  //! @endcond
193 
194 
195 /*!
196 @cond PRIVATE
197 @brief Gets the current progress.
198 @return Returns the current progress.
199 */
200  Condition GetCondition() const
201  {
202  return static_cast<Condition>(m_State & 0x00FF0000);
203  }
204  //! @endcond
205 
206 
207 public:
208 /*!
209 @brief Enumerates the operational states.
210 */
211  enum State
212  {
213  STATE_INVALID = MODE_INVALID | CONDITION_WAIT, //!< Indicates not participating in a session.
214  STATE_WAIT = MODE_WAIT | CONDITION_WAIT, //!< Indicates currently doing nothing.
215  STATE_SENDING = MODE_SEND | CONDITION_IN_PROGRESS, //!< Indicates sending.
216  STATE_SEND_SUCCESS = MODE_SEND | CONDITION_SUCCESS, //!< Indicates that sending was successful.
217  STATE_SEND_FAILURE = MODE_SEND | CONDITION_FAILURE, //!< Indicates failure to send.
218  STATE_RECEIVING = MODE_RECEIVE | CONDITION_IN_PROGRESS, //!< Indicates receiving.
219  STATE_RECEIVE_SUCCESS = MODE_RECEIVE | CONDITION_SUCCESS, //!< Indicates that receiving was successful.
220  STATE_RECEIVE_FAILURE = MODE_RECEIVE | CONDITION_FAILURE, //!< Indicates failure to receive.
221 
222  // The following are for internal management.
223  //! @cond PRIVATE
224  STATE_SEND_CANCELING = STATE_SENDING | 0x1, // Indicates currently canceling the send operation locally.
225  STATE_SEND_REJECTING = STATE_SENDING | 0x2, // Indicates that the receiver is currently rejecting and canceling the send operation.
226  STATE_SEND_ABANDONING = STATE_SENDING | 0x3, // Indicates currently abandoning the send operation in favor of a send operation from another system.
227  STATE_SEND_COMPLETING = STATE_SENDING | 0x4, // Indicates that data has reached all session members and completion is being notified.
228  STATE_SEND_CANCELED = STATE_SEND_FAILURE | 0x1, // Indicates that the send operation was canceled locally.
229  STATE_SEND_REJECTED = STATE_SEND_FAILURE | 0x2, // Indicates that the send operation was rejected by the receiving station.
230  STATE_SEND_ABANDONED = STATE_SEND_FAILURE | 0x3, // Indicates that the send operation was abandoned because of send priority arbitration.
231  STATE_RECEIVE_READY = STATE_RECEIVING | 0x1, // Indicates currently ready to receive.
232  STATE_RECEIVE_CANCELING = STATE_RECEIVING | 0x2, // Indicates currently canceling the receive operation.
233  STATE_RECEIVE_CANCELED_BEFORE_START = STATE_RECEIVE_FAILURE | 0x1, // Indicates that the receive operation was canceled locally (before the receive operation began).
234  STATE_RECEIVE_CANCELED = STATE_RECEIVE_FAILURE | 0x2, // Indicates that the receive operation was canceled locally.
235  STATE_RECEIVE_INTERRUPTED = STATE_RECEIVE_FAILURE | 0x3, // Indicates failed to receive because the sender canceled the send operation.
236  STATE_RECEIVE_MISMATCH = STATE_RECEIVE_FAILURE | 0x4 // Indicates that receive settings do not match the request.
237  //! @endcond
238  };
239 
240 
241 /*!
242 @brief Gets the current operational state.
243 @return Returns the current operational state.
244 */
245  State GetState() const
246  {
247  return static_cast<State>(m_State & 0xFFFF0000);
248  }
249 
250 
251 /*!
252 @brief Gets whether asynchronous send and receive operations are currently executing.
253 
254 @details This function returns <tt>true</tt> if the <tt>GetState</tt> function returns <tt>STATE_SENDING</tt> or <tt>STATE_RECEIVING</tt>.
255 
256 @return Returns <tt>true</tt> if asynchronous processing of send and receive operations is in progress.
257 @see GetState
258 */
259  bool IsRunning() const
260  {
261  return (GetCondition() == CONDITION_IN_PROGRESS);
262  }
263 
264 
265 /*!
266 @brief Represents methods used to transfer data.
267 
268 @details We recommend you use the constants provided for typical cases, because some combinations of settings are meaningless.
269 
270 */
272  {
273  public:
274 /*!
275 @brief Instantiates the object with default parameters (default constructor).
276 Initialized with the same values as <tt>CURRENT_CONNECTION_SYNC</tt>.
277 */
279  : m_Value(CURRENT_CONNECTION_SYNC.m_Value)
280  {
281  }
282 
283 /*!
284 @cond PRIVATE
285 @brief Converts from <tt>u16</tt>.
286 */
287  Configuration(u16 config)
288  : m_Value(config)
289  {
290  }
291  //! @endcond
292 
293 
294 /*!
295 @cond PRIVATE
296 @brief Converts to <tt>u16</tt>.
297 */
298  operator u16() const
299  {
300  return m_Value;
301  }
302  //! @endcond
303 
304 
305 /*!
306 @brief Gets whether to also send data to stations that join the session after the send operation begins.
307 @return Returns <tt>true</tt> if data is also sent to stations that join the session while the send operation is ongoing.
308 Returns <tt>false</tt> if data is sent only to stations that are in the session at the time that the send operation starts.
309 @see SetSendToNewcomer
310 */
311  bool IsSendToNewcomer() const
312  {
313  return IsFlagOn(FLAG_SEND_TO_NEWCOMER);
314  }
315 
316 /*!
317 @brief Gets the setting that controls whether to synchronize the completion of receive operations.
318 @return Returns <tt>true</tt> if the state changes to <tt>STATE_RECEIVE_SUCCESS</tt> when all stations have finished receiving the data.
319 Returns <tt>false</tt> if each station transitions to <tt>STATE_RECEIVE_SUCCESS</tt> when it has received all of the data.
320 @see SetSynchronizeCompletion
321 */
323  {
324  return IsFlagOn(FLAG_SYNCRONIZE_COMPLETION);
325  }
326 
327 /*!
328 @brief Gets the setting for determining whether to maintain a state of <tt>STATE_SENDING</tt> even after data has been sent to all receiving stations.
329 
330 @details If this is set to <tt>true</tt>, the state will not change to <tt>STATE_SEND_SUCCESS</tt> automatically.
331 If you call the <tt>ReliableBroadcastProtocol::FinishSendEndless</tt> function, subsequent operations are the same as if <tt>false</tt> was specified for this setting. The state transitions to <tt>STATE_SEND_SUCCESS</tt> after data has been sent to all receiving stations.
332 
333 @return Returns <tt>true</tt> if the <tt>STATE_SENDING</tt> state is to be maintained after data is sent to all receiving stations and also if data will be sent to any stations that join later.
334 Returns <tt>false</tt> if the state changes to <tt>STATE_SEND_SUCCESS</tt> after data has been sent to all recipients and no more data will be sent.
335 
336 @see SetSendEndless
337 
338 */
339  bool IsSendEndless() const
340  {
341  return IsFlagOn(FLAG_SEND_ENDLESS);
342  }
343 
344 /*!
345 @brief Gets the setting for determining whether a send operation had failed or been abandoned when the receiving station rejects a receive operation.
346 @return Returns <tt>true</tt> if the state transitions to <tt>STATE_SEND_FAILURE</tt>, and the entire send operation fails when a transmission is rejected.
347 Returns <tt>false</tt> if only the rejected station does not receive the data, and the station continues to send to the other recipients.
348 @see SetFailIfRejected
349 */
350  bool IsFailIfRejected() const
351  {
352  return IsFlagOn(FLAG_FAIL_IF_REJECTED);
353  }
354 
355 /*!
356 @brief Gets the setting for determining whether a send operation automatically fails on one station if two stations try to send each other data at the same time.
357 
358 @details If this setting is <tt>true</tt> and there is a conflict between sending stations, the data being sent from the sending station with the largest <tt>StationIndex</tt> value fails.
359 If two stations are sending data, and this setting is <tt>true</tt> for one and <tt>false</tt> for the other, the send operation sent from the station for which it is set to <tt>true</tt> fails.
360 If the setting is <tt>false</tt> for both stations, each station maintains a state of <tt>STATE_SENDING</tt> while waiting for the other station to receive. Neither station ever completes its send operation unless the application handles this case appropriately.
361 
362 @return Returns <tt>true</tt> if the station stops transmission and goes to the <tt>STATE_SEND_FAILURE</tt> state when it gets a receive request for which the <tt>IsMediateRequest</tt> returns <tt>false</tt>, or a receive request from a receiving station with a <tt>StationIndex</tt> lower than that of the local station.
363 Returns <tt>false</tt> if the station does not automatically go to the <tt>STATE_SEND_FAILURE</tt> state, depending on the receive requests it gets from recipients.
364 
365 @see SetMediateRequest
366 
367 
368 */
369  bool IsMediateRequest() const
370  {
371  return IsFlagOn(FLAG_MEDIATE_REQUEST);
372  }
373 
374 
375 /*!
376 @brief Sets whether to also send data to stations that join the session after the send operation begins.
377 
378 @details For more information about the meaning of this setting, see the <tt>IsSendToNewcomer</tt> function.
379 
380 @param[in] isOn Set to <tt>true</tt> to enable the setting.
381 @see IsSendToNewcomer
382 */
383  void SetSendToNewcomer(bool isOn)
384  {
385  SetFlag(FLAG_SEND_TO_NEWCOMER, isOn);
386  }
387 
388 /*!
389 @brief Sets whether to synchronize completion of receive operations.
390 
391 @details For more information about the meaning of this setting, see the <tt>IsSynchronizeCompletion</tt> function.
392 
393 @param[in] isOn Set to <tt>true</tt> to enable the setting.
394 @see IsSynchronizeCompletion
395 */
396  void SetSynchronizeCompletion(bool isOn)
397  {
398  SetFlag(FLAG_SYNCRONIZE_COMPLETION, isOn);
399  }
400 
401 /*!
402 @brief Sets whether the instance maintains a state of <tt>STATE_SENDING</tt> even after data has been successfully sent to all receiving stations.
403 
404 @details For more information about the meaning of this setting, see the <tt>IsSendEndless</tt> function.
405 
406 @param[in] isOn Set to <tt>true</tt> to enable the setting.
407 @see IsSendEndless
408 */
409  void SetSendEndless(bool isOn)
410  {
411  SetFlag(FLAG_SEND_ENDLESS, isOn);
412  }
413 
414 /*!
415 @brief Sets whether to treat a send operation as a send failure and suspend sending data when a receiving station rejects receiving data.
416 
417 @details For more information about the meaning of this setting, see the <tt>IsFailIfRejected</tt> function.
418 
419 @param[in] isOn Set to <tt>true</tt> to enable the setting.
420 @see IsFailIfRejected
421 */
422  void SetFailIfRejected(bool isOn)
423  {
424  SetFlag(FLAG_FAIL_IF_REJECTED, isOn);
425  }
426 
427 /*!
428 @brief Sets whether a send operation automatically fails on one station when two stations try to send data to each other at the same time.
429 
430 @details For more information about the meaning of this setting, see the <tt>IsMediateRequest</tt> function.
431 
432 @param[in] isOn Set to <tt>true</tt> to enable the setting.
433 @see IsMediateRequest
434 */
435  void SetMediateRequest(bool isOn)
436  {
437  SetFlag(FLAG_MEDIATE_REQUEST, isOn);
438  }
439 
440 
441 /*!
442 @brief Represents the configuration for synchronized transfer of data to currently connected stations.
443 
444 @details This configuration assumes that stations will proceed to the next state in the sequence if one of the stations can successfully send data to all of the other stations after the deadline for joining the session has passed.
445 
446 @li <tt>IsSendToNewcomer</tt>: <tt>false</tt>
447 @li <tt>IsSynchronizeCompletion</tt>: <tt>true</tt>
448 @li <tt>IsSendEndless</tt>: <tt>false</tt>
449 @li <tt>IsFailIfRejected</tt>: <tt>true</tt>
450 @li <tt>IsMediateRequest</tt>: <tt>true</tt>
451 */
453 
454 /*!
455 @brief Represents the configuration for asynchronously sending data to currently connected stations.
456 
457 @details Unlike <tt>CURRENT_CONNECTION_SYNC</tt>, this configuration assumes that receiving stations do not need to wait for data to be delivered to other receiving stations.
458 
459 @li <tt>IsSendToNewcomer</tt>: <tt>false</tt>
460 @li <tt>IsSynchronizeCompletion</tt>: <tt>false</tt>
461 @li <tt>IsSendEndless</tt>: <tt>false</tt>
462 @li <tt>IsFailIfRejected</tt>: <tt>false</tt>
463 @li <tt>IsMediateRequest</tt>: <tt>true</tt>
464 */
466 
467 /*!
468 @brief Represents the configuration for sending data to any stations that may join the session, in addition to currently connected stations, and waits for all stations to finish receiving data.
469 
470 @details This configuration assumes that data being shared is sent in advance while awaiting matchmaking, that sending is ended by <tt>FinishSendEndless</tt> after matchmaking ends, and that all stations then proceed to the next state in the sequence.
471 
472 @li <tt>IsSendToNewcomer</tt>: <tt>true</tt>
473 @li <tt>IsSynchronizeCompletion</tt>: <tt>true</tt>
474 @li <tt>IsSendEndless</tt>: <tt>true</tt>
475 @li <tt>IsFailIfRejected</tt>: <tt>true</tt>
476 @li <tt>IsMediateRequest</tt>: <tt>false</tt>
477 
478 
479 */
481 
482 /*!
483 @brief Represents the configuration for continuing to send data to stations that may join the session in addition to currently connected stations.
484 
485 @details This setting is for a use case where specific data is sent to stations as they join the session. The stations then proceed to the next sequence in the order they receive the data.
486 
487 @li <tt>IsSendToNewcomer</tt>: <tt>true</tt>
488 @li <tt>IsSynchronizeCompletion</tt>: <tt>false</tt>
489 @li <tt>IsSendEndless</tt>: <tt>true</tt>
490 @li <tt>IsFailIfRejected</tt>: <tt>false</tt>
491 @li <tt>IsMediateRequest</tt>: <tt>false</tt>
492 
493 */
495 
496 
497  private:
498  enum Flag
499  {
500  FLAG_SEND_TO_NEWCOMER = 1 << 0,
501  FLAG_SYNCRONIZE_COMPLETION = 1 << 1,
502  FLAG_SEND_ENDLESS = 1 << 2,
503  FLAG_FAIL_IF_REJECTED = 1 << 3,
504  FLAG_MEDIATE_REQUEST = 1 << 4
505  };
506 
507  bool IsFlagOn(Flag flag) const
508  {
509  return ((m_Value & flag) == flag);
510  }
511  void SetFlag(Flag flag, bool isOn)
512  {
513  if (isOn)
514  {
515  m_Value |= flag;
516  }
517  else
518  {
519  m_Value &= ~flag;
520  }
521  }
522 
523  u16 m_Value;
524  };
525 
526 
527 /*!
528 @brief Stores data transfer settings.
529 */
531  {
532  StationIndex m_SourceStationIndex; //!< The sender's <tt>StationIndex</tt> value.
533  u32 m_DataSize; //!< Specifies the size (in bytes) of the data being transferred.
534  u32 m_UserData; //!< Specifies the user information set by the sender.
535  Configuration m_Configuration; //!< Specifies the method used to transfer data.
536  StationId GetSourceStationId() const; //!< Gets the sender's <tt>StationId</tt>.
537  };
538 
539 
540 /*!
541 @brief Gets the current data transfer settings.
542 
543 @return Retrieves send settings if the function is executed during or after a send operation, or the receive settings if it is during or after a receive operation.
544 Returns <tt>NULL</tt> if no data has been received, such as when the receive starts before a receive request comes in, or when the <tt>Cancel</tt> function is executed in that state.
545 */
546  const TransferSetting* GetCurrentTransferSetting() const;
547 
548 
549 /*!
550 @brief Gets information about whether the specified station is to receive data currently being sent.
551 
552 @details Normally, all other stations participating in the session receive data.
553 If <tt>@ref Configuration::IsSendToNewcomer</tt> is <tt>false</tt>, stations that joined the session after the start of the transmissions are excluded as recipients.
554 If <tt>@ref Configuration::IsFailIfRejected</tt> is <tt>false</tt>, stations that rejected the transmission or for which reception failed are excluded as recipients.
555 
556 @param[in] stationId Specifies the <tt>StationId</tt> of the station that you are checking to determine whether it is a receiving station.
557 
558 @return Returns <tt>true</tt> if the specified station is a receiving station, and <tt>false</tt> otherwise.
559 Returns <tt>false</tt> if the local station is currently sending data and the operation has not completed.
560 */
561  bool IsSendTarget(nn::pia::StationId stationId) const;
562 
563 /*!
564 @cond PRIVATE
565 @brief Gets the current data transfer settings.
566 */
567  bool IsSendTarget(nn::pia::StationIndex stationIndex) const;
568  //! @endcond
569 
570 
571 /*!
572 @brief Gets the progress status of the send/receive operation.
573 
574 @details The value representing progress of a send operation can decrease while sending data because if the number of receiving stations changes.
575 
576 @return Returns the amount of data (in bytes) that has been sent and received.
577 You can retrieve the average amount of data sent to receiving stations during or after a send operation.
578 You can get the amount of the data received by the local station while or after receiving it.
579 */
580  size_t GetProgress() const;
581 
582 
583 /*!
584 @brief Gets the progress status of data being sent to a particular receiving station.
585 
586 @param[in] stationId Specifies the <tt>StationId</tt> of the station receiving the data.
587 
588 @return Returns the amount of data (in bytes) that has been sent to the specified station.
589 <tt>0</tt> is returned if there is no send operation in progress or completed, or if an invalid <tt>StationId</tt> was specified.
590 */
591  size_t GetSendProgress(nn::pia::StationId stationId) const;
592 
593 
594 /*!
595 @cond PRIVATE
596 @brief Gets the progress status of data being sent to a particular receiving station.
597 */
598  size_t GetSendProgress(nn::pia::StationIndex stationIndex) const;
599  //! @endcond
600 
601 
602 /*!
603 @brief Starts sending data.
604 
605 @details If this function call succeeds, the state of the station changes to <tt>STATE_SENDING</tt>.
606 If the call fails with a return value of <tt>ResultInvalidArgument</tt>, the <tt>Reset</tt> function is called.
607 
608 @details Data cannot be sent across joint session processes.
609 
610 @param[in] cpData Specifies a pointer to the data being sent.
611 You must maintain the specified buffer while the state is <tt>STATE_SENDING</tt> (while <tt>IsRunning</tt> returns <tt>true</tt>).
612 There is no guarantee that data will be sent in order. You cannot just rewrite the first <tt>GetProgress()</tt> bytes of data in the buffer.
613 @param[in] dataSize Specifies the size of the data to send.
614 @param[in] configuration Specifies operations during data transfer.
615 @param[in] userData Specifies additional information included in the data to send.
616 Applications running on the receiving station can view this information before receiving the data, and use it for purposes such as identifying the data.
617 
618 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
619 
620 @retval ResultInvalidState Indicates that the station has not joined the session or that another send/receive operation is in progress. Programming error. Fix your program so that this error is not returned.
621 @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
622 @retval ResultTemporaryUnavailable The API function is temporarily unavailable because the joint session process is in progress. Handle appropriately in the application.
623 */
624  nn::Result StartSend(const void* cpData, size_t dataSize, Configuration configuration, u32 userData = 0);
625 
626 
627 /*!
628 @brief Stops sending data sent using any configuration for which the <tt>Configuration::IsSendEndless</tt> function returns <tt>true</tt>.
629 For more information about operations, see the <tt>Configuration::IsSendEndless</tt> function.
630 
631 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
632 
633 @retval ResultInvalidState Not currently sending data, or not configured for the <tt>@ref nn::pia::transport::ReliableBroadcastProtocol::Configuration::IsSendEndless "Configuration::IsSendEndless"</tt> function to return <tt>true</tt>. Programming error. Fix your program so that this error is not returned.
634 
635 @see Configuration::IsSendEndless
636 */
637  nn::Result FinishSendEndless();
638 
639 
640 /*!
641 @brief Starts receiving data.
642 
643 @details To start receiving data on the local station in response to a <tt>GetRequest</tt> call, call this function with arguments specified in accordance with the settings for receiving data.
644 If you know in advance what to expect (because of the application's sequence, for example), you can call this function before the receive request comes so that you waste less time receiving the data than if you were to wait for the receive request to arrive.
645 If this function call succeeds, the local station enters <tt>STATE_RECEIVING</tt> state.
646 If the call fails with a return value of <tt>ResultInvalidArgument</tt>, the <tt>Reset</tt> function is called.
647 
648 @details Data cannot be received across joint session processes.
649 
650 @param[out] pBuffer Specifies the buffer that receives the data.
651 Data cannot be accessed while the local station's state is <tt>STATE_RECEIVING</tt> (while <tt>IsRunning</tt> returns <tt>true</tt>).
652 Data is not guaranteed to be in order. You may not be able to access the first number of bytes given by <tt>GetProgress</tt>.
653 @param[in] bufferSize Specifies the size of the receive buffer.
654 If the size of the requested data is larger than this value, this function succeeds, but the station enters <tt>STATE_RECEIVE_FAILURE</tt> state.
655 @param[in] sourceStationId Specifies the station the data is being received from.
656 
657 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
658 
659 @retval ResultInvalidState Indicates that the station has not joined the session or that another send/receive operation is in progress. Programming error. Fix your program so that this error is not returned.
660 @retval ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
661 @retval ResultTemporaryUnavailable The API function is temporarily unavailable because the joint session process is in progress. Handle appropriately in the application.
662 
663 @see GetRequest
664 
665 */
666  nn::Result StartReceive(void* pBuffer, size_t bufferSize, StationId sourceStationId);
667 
668 
669 /*!
670 @cond PRIVATE
671 @brief Starts receiving data.
672 */
673  nn::Result StartReceive(void* pBuffer, size_t bufferSize, StationIndex sourceStationIndex);
674  //! @endcond
675 
676 
677 /*!
678 @brief Stops sending or receiving data.
679 
680 @details If this function is called when the state is <tt>STATE_SENDING</tt> and the action is then canceled in the <tt>common::Scheduler::Dispatch</tt> function, the station ordinarily goes to <tt>STATE_SEND_FAILURE</tt>.
681 However, the station may also enter <tt>STATE_SEND_SUCCESS</tt>, depending on the timing.
682 The receiving station also transitions to <tt>STATE_RECEIVE_FAILURE</tt> (or <tt>STATE_RECEIVE_SUCCESS</tt>).
683 
684 If this function is called when the state is <tt>STATE_RECEIVING</tt> and the action is then canceled in the <tt>common::Scheduler::Dispatch</tt> function, the station ordinarily goes to <tt>STATE_RECEIVE_FAILURE</tt>.
685 However, the station may also enter <tt>STATE_RECEIVE_SUCCESS</tt>, depending on the timing. If this happens, you can access received data.
686 Sending itself is suspended if the station is not configured to run in a way that the <tt>Configuration::IsFailIfRejected(</tt> function returns <tt>true</tt>.
687 
688 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
689 
690 @retval ResultInvalidState Indicates that data is not currently being sent/received. Programming error. Fix your program so that this error is not returned.
691 
692 @see StartSend, StartReceive
693 */
694  nn::Result Cancel();
695 
696 
697 /*!
698 @brief Discards information about the result of sending and receiving data and returns to the <tt>STATE_WAIT</tt> state.
699 
700 @details This function fails if data is currently being sent or received. To call the function at such times, first call the <tt>Cancel</tt> function to suspend the send or receive operation, and then call this function.
701 Rather than always using this function, you can also start sending and receiving data directly from the following states: <tt>STATE_SEND_SUCCESS</tt>, <tt>STATE_SEND_FAILURE</tt>, <tt>STATE_RECEIVE_SUCCESS</tt>, and <tt>STATE_RECEIVE_FAILURE</tt>
702 
703 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
704 
705 @retval ResultInvalidState Indicates that the station has not joined in the session or is currently sending or receiving data. Programming error. Fix your program so that this error is not returned.
706 
707 */
708  nn::Result Reset();
709 
710 
711 /*!
712 @brief Gets receive requests that have been delivered.
713 
714 @details To get this data, prepare a buffer of the required size and call the <tt>StartReceive</tt> function.
715 Call the <tt>RejectRequest</tt> function if you do not want to receive the data.
716 When multiple receive requests have arrived, you can get the receive request with the highest priority (the request from the sender with the lowest <tt>StationIndex</tt>, regardless of the value of the <tt>Configuration::IsMediateRequest</tt> function).
717 
718 @return Returns a pointer to the receive request.
719 This function returns <tt>NULL</tt> if a receive request has not been delivered.
720 
721 @see StartReceive, RejectRequest
722 */
723  const TransferSetting* GetRequest() const;
724 
725 
726 /*!
727 @brief Gets receive requests from a particular station.
728 
729 @details To get this data, prepare a buffer of the required size and call the <tt>StartReceive</tt> function.
730 
731 @param[in] stationId Specifies the <tt>StationId</tt> of the station you want to get a receive request from.
732 
733 @return Returns a pointer to the receive request.
734 This function returns <tt>NULL</tt> if a receive request has not been delivered.
735 
736 @see StartReceive, RejectRequest
737 */
738  const TransferSetting* GetRequest(nn::pia::StationId stationId) const;
739 
740 
741 /*!
742 @cond PRIVATE
743 @brief Gets receive requests from a particular station.
744 */
745  const TransferSetting* GetRequest(nn::pia::StationIndex stationIndex) const;
746  //! @endcond
747 
748 
749 /*!
750 @brief Rejects receive requests retrieved with the <tt>GetRequest</tt> function.
751 
752 @details The send operation itself is suspended when the transfer protocol is configured such that the <tt>@ref Configuration::IsFailIfRejected</tt> function returns <tt>true</tt>.
753 Calling this function on a receive request currently being received is equivalent to calling the <tt>Cancel</tt> function.
754 
755 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
756 
757 @retval ResultInvalidState Indicates that the <tt>GetRequest</tt> function has returned <tt>NULL</tt>. Programming error. Fix your program so that this error is not returned.
758 
759 @see GetRequest
760 */
761  nn::Result RejectRequest();
762 
763 
764 /*!
765 @brief Rejects receive requests retrieved with the <tt>@ref GetRequest ( nn::pia::StationId )</tt> function.
766 
767 @details The send operation itself is suspended when the transfer protocol is configured such that the <tt>@ref Configuration::IsFailIfRejected</tt> function returns <tt>true</tt>.
768 Calling this function on a receive request currently being received is equivalent to calling the <tt>Cancel</tt> function.
769 
770 @param[in] stationId Specifies the <tt>StationId</tt> of the station you want to reject a receive request from.
771 
772 @return Returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function returns <tt>true</tt> if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
773 
774 @retval ResultInvalidState Indicates that the <tt>GetRequest ( nn::pia::StationId )</tt> function has returned <tt>NULL</tt>. Programming error. Fix your program so that this error is not returned.
775 
776 @see GetRequest
777 */
778  nn::Result RejectRequest(nn::pia::StationId stationId);
779 
780 
781 /*!
782 @cond PRIVATE
783 @brief Rejects receive requests retrieved with the <tt>@ref GetRequest ( StationIndex )</tt> function.
784 */
785  nn::Result RejectRequest(nn::pia::StationIndex stationIndex);
786  //! @endcond
787 
788 
789 /*!
790 @brief Sets the maximum amount of data that this protocol sends per call to the <tt>common::Scheduler::Dispatch</tt> function.
791 
792 @details The average amount of data sent by this protocol per call to the <tt>common::Scheduler::Dispatch</tt> function is kept under the value specified to this function.
793 Data may still momentarily be sent at rates greater than specified.
794 
795 To temporarily stop sending data, a sender must specify <tt>0</tt> in this function. Setting a value of <tt>0</tt> completely stops this protocol from sending data.
796 Change the setting to a positive value if you want to start sending data again.
797 If you try to cancel data transfer by calling the <tt>Cancel</tt> function while sending is paused, the cancellation does not complete and notification of the cancellation is not sent while <tt>0</tt> is specified for this value.
798 Conversely, the data transfer does not proceed if a receiving station sets this value to <tt>0</tt>, because the receiving station also sends small amounts of data (such as acknowledgement packets).
799 
800 Use the default value for the best performance.
801 The default is six packets worth of data. This value is not constant because the size of a single packet can vary depending on the MTU and other settings.
802 
803 Set this value after communication starts, because the default value is reset when communication starts.
804 
805 @param[in] throughputLimit Specifies the amount of send data to configure (in bytes).
806 
807 @see GetThroughputLimit
808 
809 
810 
811 
812 
813 */
814  void SetThroughputLimit(u32 throughputLimit)
815  {
816  m_ThroughputLimit = throughputLimit;
817  }
818 
819 
820 /*!
821 @brief Gets the maximum amount of data that this protocol can send per call to the <tt>common::Scheduler::Dispatch</tt> function.
822 
823 @return Returns the amount of data that the protocol sends per call to the <tt>common::Scheduler::Dispatch</tt> function.
824 
825 @see SetThroughputLimit
826 */
827  u32 GetThroughputLimit() const
828  {
829  return m_ThroughputLimit;
830  }
831 
832 
833 /*!
834 @brief Prints information that is useful for debugging.
835 
836 @param[in] flag Specifies the bitwise OR of trace flags. For more information, see the <tt>@ref TraceFlag</tt> type.
837 */
838  virtual void Trace(u64 flag) const;
839 
840 
841 private:
842  static const u16 cInvalidMessageIdx = 0xffff;
843 
844  // Manage progress.
845  class Progress
846  {
847  public:
848  u32 GetCount() const;
849  bool IsOn(u32 idx) const;
850  bool IsAllOff() const;
851  bool IsComplete() const
852  {
853  return m_FirstOffIdx >= m_UnitNum;
854  }
855 
856  protected:
857  static const u32 cFlagBlockNum = 4;
858  u32 m_UnitNum;
859  u32 m_FirstOffIdx;
860  u32 m_Flag[cFlagBlockNum];
861  };
862 
863  // Manage progress while receiving.
864  class ReceiverProgress : public Progress
865  {
866  public:
867  void Clear(u32 unitNum);
868  bool Raise(u32 idx);
869  void Get(u32* pOffset, u64* pFlag) const;
870  };
871 
872  // Manage progress while sending.
873  class SenderProgress : public Progress
874  {
875  public:
876  void Clear(u32 unitNum);
877  bool Update(u32 offset, u64 flag);
878  bool IsReceivable(u32 offset) const;
879  void UpdateMessageIdx(u32 unitIdx, u16 messageIdx);
880  u32 GetFirstOffIdx() const
881  {
882  return m_FirstOffIdx;
883  }
884  u32 GetUnitNum() const
885  {
886  return m_UnitNum;
887  }
888  u16 GetSendMessageIdx(u32 unitIdx) const;
889 
890  private:
891  static const u32 cDataSize = cFlagBlockNum * 32;
892 
893  u16 m_SendMessageIdx[cDataSize];
894  };
895 
896 
897  // Message types.
898  enum MessageType
899  {
900  eMTInvalid = 0x00,
901  eMTRequest = 0x11,
902  eMTData = 0x12,
903  eMTCancel = 0x18,
904  eMTComplete = 0x19,
905  eMTDataAck = 0x21,
906  eMTCommandAck = 0x28,
907  eMTReject = 0x29
908  };
909 
910 
911  // Access messages.
912  class MessageAccessor
913  {
914  public:
915  MessageAccessor()
916  : m_Type(eMTInvalid)
917  {
918  }
919  bool IsSenderMessage() const
920  {
921  return (m_Type & 0xf0) == 0x10;
922  }
923  bool IsReceiverMessage() const
924  {
925  return (m_Type & 0xf0) == 0x20;
926  }
927  bool IsDataMessage() const
928  {
929  return m_Type == eMTData;
930  }
931 
932  u32 GetMessageSize() const;
933  static bool Unpack(MessageAccessor* pAccessor, const ProtocolMessageReader& reader, u32* pMessageIdx);
934  static bool Pack(ProtocolMessageWriter* pWriter, const MessageAccessor& accessor, u32 messageIdx);
935 
936  public:
937  MessageType m_Type;
938  u16 m_Id;
939 
940  u32 m_TotalSize;
941  u16 m_UnitSize;
942  u32 m_UserData;
943  Configuration m_Configuration;
944 
945  u32 m_Index;
946  const void* m_cpPayload;
947  u16 m_PayloadSize;
948 
949  u32 m_AckOffset;
950  u64 m_AckFlag;
951  };
952 
953 
954  // Internal control of transfer settings.
955  struct InnerTransferSetting : public TransferSetting
956  {
957  public:
958  bool IsValid() const
959  {
960  return (m_DataSize > 0);
961  }
962  bool IsPriorTo(const TransferSetting& setting) const;
963 
964  public:
965  u16 m_Id;
966  u16 m_UnitSize;
967  u32 m_UnitNum;
968  };
969 
970 
971  // Sending station states.
972  enum SenderState
973  {
974  eSSNothing,
975  eSSSending,
976  eSSRejected,
977  eSSFinished
978  };
979 
980  // Receiving station states.
981  enum ReceiverState
982  {
983  eRSNothing,
984  eRSReceiving,
985  eRSRejecting,
986  eRSFinished,
987  eRSRejected
988  };
989 
990  // Manage the status of all communicating stations.
991  class Station
992  {
993  public:
994  Station();
995  void Initialize(ReliableBroadcastProtocol* pProtocol);
996 
997  void Startup(StationIndex stationId);
998  void Cleanup();
999 
1000  void HandleMessage(const MessageAccessor& accessor);
1001  bool SendAck();
1002 
1003  void ForceReserveReject()
1004  {
1005  m_ReservedAckFlag |= eRAFReject;
1006  }
1007 
1008  void RejectSend();
1009 
1010  void ClearReceiverState()
1011  {
1012  m_ReceiverState = eRSNothing;
1013  }
1014  void StartReceive(u16 receiveId, u32 unitNum);
1015 
1016  bool IsConnected() const
1017  {
1018  return MyStationIndex() != STATION_INDEX_INVALID;
1019  }
1020  StationIndex GetStationIndex() const
1021  {
1022  return MyStationIndex();
1023  }
1024  SenderState GetSenderState() const
1025  {
1026  return m_SenderState;
1027  }
1028  ReceiverState GetReceiverState() const
1029  {
1030  return m_ReceiverState;
1031  }
1032  const InnerTransferSetting& GetRequest() const
1033  {
1034  return m_Request;
1035  }
1036  const SenderProgress* GetProgress() const
1037  {
1038  return &m_Progress;
1039  }
1040 
1041  u16 GetReturnedMessageIdx() const
1042  {
1043  return m_ReturnedMessageIdx;
1044  }
1045  u16 GetReceivedMessageIdx() const
1046  {
1047  return m_ReceivedMessageIdx;
1048  }
1049 
1050  void HandleMessageIdx(u32 messageIdx);
1051 
1052  u32 GetNextSendUnitIndex(bool isOnlyPrior, u32 dispatchCount) const;
1053 
1054  bool IsNeedSendRequest() const
1055  {
1056  return (GetReceiverState() == eRSReceiving) && m_IsNeedSendRequest;
1057  }
1058 
1059  void RecordSendData(u32 dispatchCount, u16 unitIdx, u16 messageIdx);
1060 
1061  private:
1062  void UpdateRequest(const MessageAccessor& accessor);
1063  bool CheckRequest(const MessageAccessor& accessor) const;
1064 
1065  StationIndex& MyStationIndex()
1066  {
1067  return m_Request.m_SourceStationIndex;
1068  }
1069  StationIndex MyStationIndex() const
1070  {
1071  return m_Request.m_SourceStationIndex;
1072  }
1073  u16& SenderSequenceId()
1074  {
1075  return m_Request.m_Id;
1076  }
1077  u16 SenderSequenceId() const
1078  {
1079  return m_Request.m_Id;
1080  }
1081 
1082  private:
1083  ReliableBroadcastProtocol* m_pProtocol;
1084 
1085  InnerTransferSetting m_Request;
1086  SenderState m_SenderState;
1087 
1088  enum ReservedAckFlag
1089  {
1090  eRAFNone = 0x0,
1091  eRAFRequest = 0x1,
1092  eRAFData = 0x2,
1093  eRAFReject = 0x4,
1094  eRAFCommand = 0x8
1095  };
1096  u32 m_ReservedAckFlag;
1097 
1098  SenderProgress m_Progress;
1099  u16 m_ReceivingId;
1100  ReceiverState m_ReceiverState;
1101 
1102  u16 m_ReturnedMessageIdx;
1103  u16 m_ReceivedMessageIdx;
1104 
1105  bool m_IsNeedSendRequest;
1106 
1107  u32 m_LastSentDataDispatchCount;
1108  };
1109 
1110  // Is the other station valid?
1111  bool IsValidStation(StationIndex stationId) const
1112  {
1113  return (stationId >= STATION_INDEX_1) && (stationId < static_cast<StationIndex>(m_MaxConnections)) && (stationId != m_LocalStationIndex);
1114  }
1115 
1116  // Get information about another station.
1117  Station* GetStation(StationIndex stationId)
1118  {
1119  PIA_ASSERT(IsValidStation(stationId));
1120  return &m_paStation[stationId < m_LocalStationIndex ? stationId : stationId - 1];
1121  }
1122 
1123  // Get information about another station.
1124  const Station* GetStation(StationIndex stationId) const
1125  {
1126  PIA_ASSERT(IsValidStation(stationId));
1127  return &m_paStation[stationId < m_LocalStationIndex ? stationId : stationId - 1];
1128  }
1129 
1130  static u32 CalcProgress(const InnerTransferSetting& transferSetting, const Progress& progress);
1131 
1132  void UpdateState();
1133  bool DispatchSendAck();
1134  bool DispatchSendCommand();
1135  bool DispatchSendData();
1136  void DispatchOnReceiveCanceling();
1137 
1138  void PushRequest(const MessageAccessor& accessor, const Station& sender);
1139  bool PushData(const MessageAccessor& accessor, const Station& sender);
1140  void PushComplete(const MessageAccessor& accessor, const Station& sender);
1141  void PushCancel(const MessageAccessor& accessor, const Station& sender);
1142 
1143  bool CreateMessage(const MessageAccessor& accessor, Station* pDestinationStation);
1144  u32 IssueMessageIdx(const Station* cpDestStation);
1145 
1146  static bool IsSameSetting(const InnerTransferSetting& setting, const MessageAccessor& accessor);
1147 
1148 
1149  u32 m_MaxConnections;
1150 
1151  State m_State;
1152  StationIndex m_LocalStationIndex;
1153 
1154  InnerTransferSetting m_TransferSetting;
1155 
1156  void* m_pReceiveBuffer;
1157  ReceiverProgress m_ReceiveProgress;
1158 
1159  const void* m_cpSendBuffer;
1160  u16 m_NextSendId;
1161  u32 m_NextSendCommandStationIndex;
1162  u32 m_NextSendDataStationIndex;
1163  bool m_IsFinishSendEndless;
1164 
1165  u32 m_NextSendAckStationIndex;
1166 
1167  u16 m_SentMessageIdx;
1168 
1169  u32 m_ThroughputLimit;
1170  u32 m_RestThroughputLimit;
1171 
1172  u32 m_DispatchCount;
1173 
1174  Station* m_paStation;
1175 
1176  common::Time m_StartSendTime;
1177 
1178  static const u32 cDefaultPacketNumPerDispatch;
1179 };
1180 }
1181 }
1182 } // end of namespace nn::pia::transport
Configuration()
Instantiates the object with default parameters (default constructor). Initialized with the same valu...
Definition: transport_ReliableBroadcastProtocol.h:278
bool IsRunning() const
Gets whether asynchronous send and receive operations are currently executing.
Definition: transport_ReliableBroadcastProtocol.h:259
u32 GetThroughputLimit() const
Gets the maximum amount of data that this protocol can send per call to the common::Scheduler::Dispat...
Definition: transport_ReliableBroadcastProtocol.h:827
Stores data transfer settings.
Definition: transport_ReliableBroadcastProtocol.h:530
Represents methods used to transfer data.
Definition: transport_ReliableBroadcastProtocol.h:271
Class that represents time.
Definition: common_Time.h:39
StationIndex
Enumerates StationIndex values.
Definition: platformCtr.h:44
Definition of the StationId identifying the station within the session.
Definition: types.h:33
Definition: assert.h:115
ID indicating Player 1.
Definition: platformCtr.h:46
bool IsFailIfRejected() const
Gets the setting for determining whether a send operation had failed or been abandoned when the recei...
Definition: transport_ReliableBroadcastProtocol.h:350
bool IsSynchronizeCompletion() const
Gets the setting that controls whether to synchronize the completion of receive operations.
Definition: transport_ReliableBroadcastProtocol.h:322
ID indicating a station that is not present in the session.
Definition: platformCtr.h:59
virtual void Trace(u64 flag) const
Prints information that is useful for debugging.
void Finalize(void)
Initializes the transport module. This function does nothing and returns if it is called before the I...
void SetThroughputLimit(u32 throughputLimit)
Sets the maximum amount of data that this protocol sends per call to the common::Scheduler::Dispatch ...
Definition: transport_ReliableBroadcastProtocol.h:814
Configuration m_Configuration
Specifies the method used to transfer data.
Definition: transport_ReliableBroadcastProtocol.h:535
Represents a protocol for sending a large volume of data to all stations.
Definition: transport_ReliableBroadcastProtocol.h:60
bool IsMediateRequest() const
Gets the setting for determining whether a send operation automatically fails on one station if two s...
Definition: transport_ReliableBroadcastProtocol.h:369
static const Configuration CURRENT_CONNECTION_SYNC
Represents the configuration for synchronized transfer of data to currently connected stations...
Definition: transport_ReliableBroadcastProtocol.h:452
State GetState() const
Gets the current operational state.
Definition: transport_ReliableBroadcastProtocol.h:245
static const Configuration SHARE_DATA_ASYNC
Represents the configuration for continuing to send data to stations that may join the session in add...
Definition: transport_ReliableBroadcastProtocol.h:494
Protocol base class.
Definition: transport_Protocol.h:44
void SetSendToNewcomer(bool isOn)
Sets whether to also send data to stations that join the session after the send operation begins...
Definition: transport_ReliableBroadcastProtocol.h:383
static const Configuration CURRENT_CONNECTION_ASYNC
Represents the configuration for asynchronously sending data to currently connected stations...
Definition: transport_ReliableBroadcastProtocol.h:465
bool IsSendEndless() const
Gets the setting for determining whether to maintain a state of STATE_SENDING even after data has bee...
Definition: transport_ReliableBroadcastProtocol.h:339
void SetSynchronizeCompletion(bool isOn)
Sets whether to synchronize completion of receive operations.
Definition: transport_ReliableBroadcastProtocol.h:396
StationIndex m_SourceStationIndex
The sender&#39;s StationIndex value.
Definition: transport_ReliableBroadcastProtocol.h:532
State
Enumerates the operational states.
Definition: transport_ReliableBroadcastProtocol.h:211
void SetSendEndless(bool isOn)
Sets whether the instance maintains a state of STATE_SENDING even after data has been successfully se...
Definition: transport_ReliableBroadcastProtocol.h:409
u32 m_UserData
Specifies the user information set by the sender.
Definition: transport_ReliableBroadcastProtocol.h:534
static const Configuration SHARE_DATA_SYNC
Represents the configuration for sending data to any stations that may join the session, in addition to currently connected stations, and waits for all stations to finish receiving data.
Definition: transport_ReliableBroadcastProtocol.h:480
nn::Result Initialize(void)
Initializes the transport module.
u32 m_DataSize
Specifies the size (in bytes) of the data being transferred.
Definition: transport_ReliableBroadcastProtocol.h:533
void SetFailIfRejected(bool isOn)
Sets whether to treat a send operation as a send failure and suspend sending data when a receiving st...
Definition: transport_ReliableBroadcastProtocol.h:422
bool IsSendToNewcomer() const
Gets whether to also send data to stations that join the session after the send operation begins...
Definition: transport_ReliableBroadcastProtocol.h:311
void SetMediateRequest(bool isOn)
Sets whether a send operation automatically fails on one station when two stations try to send data t...
Definition: transport_ReliableBroadcastProtocol.h:435