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: 36011 $ 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 /* 34 Please see man pages for details 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 /* 50 Please see man pages for details 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 /* 78 Please see man pages for details 79 80 81 82 */ 83 Receiver(void); 84 85 86 /* 87 Please see man pages for details 88 89 90 91 */ 92 ~Receiver(void); 93 94 95 /* 96 Please see man pages for details 97 98 99 100 101 102 103 104 105 106 107 108 */ 109 nn::Result Initialize(const ReceiverConfig &config); 110 111 112 /* 113 Please see man pages for details 114 115 116 117 118 */ 119 void Finalize(void); 120 121 122 /* 123 Please see man pages for details 124 125 126 127 128 129 130 131 132 133 134 */ 135 nn::Result Wait(void); 136 137 138 /* 139 Please see man pages for details 140 141 142 143 144 145 146 147 148 149 */ 150 nn::Result Close(void); 151 152 153 /* 154 Please see man pages for details 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 */ 171 nn::Result Receive(void *pBuf, size_t *pRecvSize, size_t bufSize); 172 173 174 /* 175 Please see man pages for details 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 */ 193 nn::Result Process(void); 194 195 196 /* 197 Please see man pages for details 198 199 200 201 202 203 204 205 */ 206 void Cancel(void); 207 208 209 /* 210 Please see man pages for details 211 212 213 */ 214 enum ReceiverState GetStatus(void) const; 215 216 217 /* 218 Please see man pages for details 219 220 221 222 223 */ 224 void SetPacketLossRatio(int per); 225 226 227 /* 228 229 230 231 */ 232 void PrintDebugInfo(void) const; 233 234 235 private: 236 /* 237 Please see man pages for details 238 */ 239 Receiver (const Receiver&); 240 241 242 /* 243 Please see man pages for details 244 */ 245 Receiver& operator=(const Receiver&); 246 247 248 /* 249 Please see man pages for details 250 */ 251 ReceiverImpl *m_pImpl; 252 }; 253 254 255 }}} // namespace nn::rdt::CTR 256 257 #endif // end of NN_RDT_RECEIVER_H_ 258