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