1 /*-------------------------------------------------------------------------- 2 Project: Horizon 3 File: rdt_Receiver.h 4 5 Copyright (C)2010 Nintendo Co., Ltd. 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 $Rev: 38644 $ 14 *-------------------------------------------------------------------------*/ 15 16 ////#include <stdafx.h> 17 18 #ifndef NN_RDT_RECEIVER_H_ 19 #define NN_RDT_RECEIVER_H_ 20 21 22 #include <nn/rdt/CTR/rdt_define.h> 23 24 #include <nn/types.h> 25 #include <nn/Result.h> 26 27 28 namespace nn { namespace rdt { namespace CTR { 29 30 31 class ReceiverImpl; 32 33 /* Please see man pages for details 34 35 */ 36 struct ReceiverConfig{ 37 void *pWorkBuf; // 38 void *pRecvBuf; // 39 u16 recvBufSize; // 40 u16 nodeId; // 41 u8 port; // 42 u8 padding[3]; // 43 #ifdef _WIN32 44 SOCKET sock; 45 #endif 46 }; 47 48 49 /* Please see man pages for details 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 */ 73 class Receiver{ 74 public: 75 static const size_t RECEIVER_WORKBUF_SIZE = 128; // 76 77 /* Please see man pages for details 78 79 80 81 82 */ 83 Receiver(void); 84 85 86 /* Please see man pages for details 87 88 89 90 91 */ 92 ~Receiver(void); 93 94 95 /* Please see man pages for details 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 */ 116 nn::Result Initialize(const ReceiverConfig &config); 117 118 119 /* Please see man pages for details 120 121 122 123 124 125 */ 126 void Finalize(void); 127 128 129 /* Please see man pages for details 130 131 132 133 134 135 136 137 138 139 140 141 */ 142 nn::Result Wait(void); 143 144 145 /* Please see man pages for details 146 147 148 149 150 151 152 153 154 155 156 */ 157 nn::Result Close(void); 158 159 160 /* Please see man pages for details 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 */ 182 nn::Result Receive(void *pBuf, size_t *pRecvSize, size_t bufSize); 183 184 185 /* Please see man pages for details 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 */ 204 nn::Result Process(void); 205 206 207 /* Please see man pages for details 208 209 210 211 212 213 214 215 216 */ 217 void Cancel(void); 218 219 220 /* Please see man pages for details 221 222 223 224 */ 225 enum ReceiverState GetStatus(void) const; 226 227 228 /* Please see man pages for details 229 230 231 232 233 234 */ 235 void SetPacketLossRatio(int per); 236 237 238 /* Please see man pages for details 239 240 241 242 */ 243 void PrintDebugInfo(void) const; 244 245 246 private: 247 /* Please see man pages for details 248 249 */ 250 Receiver (const Receiver&); 251 252 253 /* Please see man pages for details 254 255 */ 256 Receiver& operator=(const Receiver&); 257 258 259 /* Please see man pages for details 260 261 */ 262 ReceiverImpl *m_pImpl; 263 }; 264 265 266 }}} // namespace nn::rdt::CTR 267 268 #endif // end of NN_RDT_RECEIVER_H_ 269