CTR Pia  4.11.3
Game Communication Engine
common_IPacketOutput.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: common_IPacketOutput.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/common/common_definitions.h>
18 
19 #include <pia/common/private/common_Packet.h>
20 
21 
22 namespace nn
23 {
24 namespace pia
25 {
26 namespace common
27 {
28 
29 
30 /*!
31 @cond PRIVATE
32 @brief This class is an interface for writing to \c PacketOld objects.
33 */
34 class IPacketOutput
35 {
36 public:
37 /*!
38 @brief Default constructor.
39 */
40  IPacketOutput(void)
41  {
42  }
43 
44 
45 /*!
46 @brief Destructor.
47 */
48  virtual ~IPacketOutput(void)
49  {
50  }
51 
52  virtual nn::Result OnStationConnectionEvent() = 0;
53 
54 /*!
55 @brief A writing interface.
56 
57 @param[in] packetData The \c Packet object to write.
58 @return If the write is successful, returns a \c Result value for which the \c IsSuccess function will return \c true.
59 @retval ResultInvalidArgument There is an error in one or more arguments (such as there is something wrong with the packet destination).
60 @retval ResultInvalidState The timing by which this function has been called is incorrect (for example, initialization is not finished).
61 @retval ResultBufferIsFull The send failed because the buffer is momentarily full or CPU capacity is maxed out.
62 @retval ResultNetworkConnectionIsLost The network connection was lost.
63 */
64  virtual nn::Result Write(const nn::pia::common::Packet& packetData) = 0;
65 
66 /*!
67 @brief Writer interface.
68 
69 @param[in] packetData The \c PacketOld object to write.
70 @return If the write succeeds, returns a <tt>Result</tt> value for which the <tt>IsSuccess</tt> function will return <tt>true</tt>.
71 @retval ResultInvalidArgument One or more arguments is invalid (for example, there is something wrong with the packet recipient).
72 @retval ResultInvalidState The timing by which this function has been called is incorrect (for example, initialization is not finished).
73 @retval ResultBufferIsFull The send operation failed because the buffer is temporarily full, or the processing capacity is maxed out.
74 @retval ResultNetworkConnectionIsLost The network connection was lost.
75 */
76  //virtual nn::Result Write(const nn::pia::common::PacketOld&) {PIA_RETURN_RESULT(ResultNotImplemented);}
77 
78 
79 /*!
80 @brief Gets the maximum number of recipients we can multicast to.
81 @details The library controls packet generation so that the number of recipients specified in the recipient bitmap is never larger than this value.
82 @return The maximum number of multicast recipients.
83 */
84  virtual u32 GetMulticastDestinationNum() const
85  {
86  return 1;
87  }
88 
89 
90 /*!
91 @brief Gets whether broadcasting is supported.
92 @details If this value is <tt>true</tt>, you can specify <tt>STATION_INDEX_ALL</tt> to generate packets with more bits set than the value returned by the <tt>GetMulticastDestinationNum</tt> function.
93 @return <tt>true</tt> if broadcasting is supported.
94 */
95  virtual bool IsBroadcastSupported() const
96  {
97  return false;
98  }
99 };
100 //! @endcond
101 }
102 }
103 } // end of namespace nn::pia::common
Definition: assert.h:115