1 /*-------------------------------------------------------------------------- 2 Project: Horizon 3 File: rdt_Sender.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_SENDER_H_ 19 #define NN_RDT_SENDER_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 SenderImpl; 32 33 /* Please see man pages for details 34 35 */ 36 struct SenderConfig{ 37 void *pWorkBuf; // 38 void *pSendBuf; // 39 u16 sendBufSize; // 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 */ 74 class Sender{ 75 public: 76 static const size_t SENDER_WORKBUF_SIZE = 32 * 1024; // 77 78 /* Please see man pages for details 79 80 81 82 83 */ 84 Sender(void); 85 86 87 /* Please see man pages for details 88 89 90 91 92 */ 93 ~Sender(void); 94 95 96 /* Please see man pages for details 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 */ 117 nn::Result Initialize(const SenderConfig &config); 118 119 120 /* Please see man pages for details 121 122 123 124 125 126 */ 127 void Finalize(void); 128 129 130 /* Please see man pages for details 131 132 133 134 135 136 137 138 139 140 141 142 */ 143 nn::Result Open(void); 144 145 146 /* Please see man pages for details 147 148 149 150 151 152 153 154 155 156 157 158 159 */ 160 nn::Result Close(void); 161 162 163 /* Please see man pages for details 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 */ 184 nn::Result Send(const void *pBuf, size_t bufSize); 185 186 187 /* Please see man pages for details 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 */ 211 nn::Result Process(void); 212 213 214 /* Please see man pages for details 215 216 217 218 219 220 221 222 223 */ 224 void Cancel(void); 225 226 227 /* Please see man pages for details 228 229 230 231 */ 232 enum SenderState GetStatus(void) const; 233 234 235 /* Please see man pages for details 236 237 238 239 240 241 */ 242 void SetPacketLossRatio(int per); 243 244 245 /* Please see man pages for details 246 247 248 249 */ 250 void PrintDebugInfo(void) const; 251 252 253 private: 254 /* Please see man pages for details 255 256 */ 257 Sender (const Sender&); 258 259 260 /* Please see man pages for details 261 262 */ 263 Sender& operator=(const Sender&); 264 265 266 /* Please see man pages for details 267 268 */ 269 SenderImpl *m_pImpl; 270 }; 271 272 273 }}} // namespace nn::rdt::CTR 274 275 #endif // end of NN_RDT_SENDER_H_ 276