Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: net/third_party/udt/src/ccc.h

Issue 6708091: Remove UDT. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/third_party/udt/src/cache.cpp ('k') | net/third_party/udt/src/ccc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*****************************************************************************
2 Copyright (c) 2001 - 2009, The Board of Trustees of the University of Illinois.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8
9 * Redistributions of source code must retain the above
10 copyright notice, this list of conditions and the
11 following disclaimer.
12
13 * Redistributions in binary form must reproduce the
14 above copyright notice, this list of conditions
15 and the following disclaimer in the documentation
16 and/or other materials provided with the distribution.
17
18 * Neither the name of the University of Illinois
19 nor the names of its contributors may be used to
20 endorse or promote products derived from this
21 software without specific prior written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *****************************************************************************/
35
36 /*****************************************************************************
37 written by
38 Yunhong Gu, last updated 05/05/2009
39 *****************************************************************************/
40
41
42 #ifndef __UDT_CCC_H__
43 #define __UDT_CCC_H__
44
45
46 #include "udt.h"
47 #include "packet.h"
48
49
50 class UDT_API CCC
51 {
52 friend class CUDT;
53
54 public:
55 CCC();
56 virtual ~CCC();
57
58 private:
59 CCC(const CCC&);
60 CCC& operator=(const CCC&) {return *this;}
61
62 public:
63
64 // Functionality:
65 // Callback function to be called (only) at the start of a UDT connecti on.
66 // note that this is different from CCC(), which is always called.
67 // Parameters:
68 // None.
69 // Returned value:
70 // None.
71
72 virtual void init() {}
73
74 // Functionality:
75 // Callback function to be called when a UDT connection is closed.
76 // Parameters:
77 // None.
78 // Returned value:
79 // None.
80
81 virtual void close() {}
82
83 // Functionality:
84 // Callback function to be called when an ACK packet is received.
85 // Parameters:
86 // 0) [in] ackno: the data sequence number acknowledged by this ACK.
87 // Returned value:
88 // None.
89
90 virtual void onACK(const int32_t&) {}
91
92 // Functionality:
93 // Callback function to be called when a loss report is received.
94 // Parameters:
95 // 0) [in] losslist: list of sequence number of packets, in the format describled in packet.cpp.
96 // 1) [in] size: length of the loss list.
97 // Returned value:
98 // None.
99
100 virtual void onLoss(const int32_t*, const int&) {}
101
102 // Functionality:
103 // Callback function to be called when a timeout event occurs.
104 // Parameters:
105 // None.
106 // Returned value:
107 // None.
108
109 virtual void onTimeout() {}
110
111 // Functionality:
112 // Callback function to be called when a data is sent.
113 // Parameters:
114 // 0) [in] seqno: the data sequence number.
115 // 1) [in] size: the payload size.
116 // Returned value:
117 // None.
118
119 virtual void onPktSent(const CPacket*) {}
120
121 // Functionality:
122 // Callback function to be called when a data is received.
123 // Parameters:
124 // 0) [in] seqno: the data sequence number.
125 // 1) [in] size: the payload size.
126 // Returned value:
127 // None.
128
129 virtual void onPktReceived(const CPacket*) {}
130
131 // Functionality:
132 // Callback function to Process a user defined packet.
133 // Parameters:
134 // 0) [in] pkt: the user defined packet.
135 // Returned value:
136 // None.
137
138 virtual void processCustomMsg(const CPacket*) {}
139
140 protected:
141
142 // Functionality:
143 // Set periodical acknowldging and the ACK period.
144 // Parameters:
145 // 0) [in] msINT: the period to send an ACK.
146 // Returned value:
147 // None.
148
149 void setACKTimer(const int& msINT);
150
151 // Functionality:
152 // Set packet-based acknowldging and the number of packets to send an A CK.
153 // Parameters:
154 // 0) [in] pktINT: the number of packets to send an ACK.
155 // Returned value:
156 // None.
157
158 void setACKInterval(const int& pktINT);
159
160 // Functionality:
161 // Set RTO value.
162 // Parameters:
163 // 0) [in] msRTO: RTO in macroseconds.
164 // Returned value:
165 // None.
166
167 void setRTO(const int& usRTO);
168
169 // Functionality:
170 // Send a user defined control packet.
171 // Parameters:
172 // 0) [in] pkt: user defined packet.
173 // Returned value:
174 // None.
175
176 void sendCustomMsg(CPacket& pkt) const;
177
178 // Functionality:
179 // retrieve performance information.
180 // Parameters:
181 // None.
182 // Returned value:
183 // Pointer to a performance info structure.
184
185 const CPerfMon* getPerfInfo();
186
187 // Functionality:
188 // Set user defined parameters.
189 // Parameters:
190 // 0) [in] param: the paramters in one buffer.
191 // 1) [in] size: the size of the buffer.
192 // Returned value:
193 // None.
194
195 void setUserParam(const char* param, const int& size);
196
197 private:
198 void setMSS(const int& mss);
199 void setMaxCWndSize(const int& cwnd);
200 void setBandwidth(const int& bw);
201 void setSndCurrSeqNo(const int32_t& seqno);
202 void setRcvRate(const int& rcvrate);
203 void setRTT(const int& rtt);
204
205 protected:
206 const int32_t& m_iSYNInterval; // UDT constant parameter, SYN
207
208 double m_dPktSndPeriod; // Packet sending period, in microsecond s
209 double m_dCWndSize; // Congestion window size, in packets
210
211 int m_iBandwidth; // estimated bandwidth, packets per seco nd
212 double m_dMaxCWndSize; // maximum cwnd size, in packets
213
214 int m_iMSS; // Maximum Packet Size, including all pa cket headers
215 int32_t m_iSndCurrSeqNo; // current maximum seq no sent out
216 int m_iRcvRate; // packet arrive rate at receiver side, packets per second
217 int m_iRTT; // current estimated RTT, microsecond
218
219 char* m_pcParam; // user defined parameter
220 int m_iPSize; // size of m_pcParam
221
222 private:
223 UDTSOCKET m_UDT; // The UDT entity that this congestion c ontrol algorithm is bound to
224
225 int m_iACKPeriod; // Periodical timer to send an ACK, in m illiseconds
226 int m_iACKInterval; // How many packets to send one ACK, in packets
227
228 bool m_bUserDefinedRTO; // if the RTO value is defined by users
229 int m_iRTO; // RTO value, microseconds
230
231 CPerfMon m_PerfInfo; // protocol statistics information
232 };
233
234 class CCCVirtualFactory
235 {
236 public:
237 virtual ~CCCVirtualFactory() {}
238
239 virtual CCC* create() = 0;
240 virtual CCCVirtualFactory* clone() = 0;
241 };
242
243 template <class T>
244 class CCCFactory: public CCCVirtualFactory
245 {
246 public:
247 virtual ~CCCFactory() {}
248
249 virtual CCC* create() {return new T;}
250 virtual CCCVirtualFactory* clone() {return new CCCFactory<T>;}
251 };
252
253 class CUDTCC: public CCC
254 {
255 public:
256 CUDTCC();
257
258 public:
259 virtual void init();
260 virtual void onACK(const int32_t&);
261 virtual void onLoss(const int32_t*, const int&);
262 virtual void onTimeout();
263
264 private:
265 int m_iRCInterval; // UDT Rate control interval
266 uint64_t m_LastRCTime; // last rate increase time
267 bool m_bSlowStart; // if in slow start phase
268 int32_t m_iLastAck; // last ACKed seq no
269 bool m_bLoss; // if loss happened since last rate incr ease
270 int32_t m_iLastDecSeq; // max pkt seq no sent out when last dec rease happened
271 double m_dLastDecPeriod; // value of pktsndperiod when last decre ase happened
272 int m_iNAKCount; // NAK counter
273 int m_iDecRandom; // random threshold on decrease by numbe r of loss events
274 int m_iAvgNAKNum; // average number of NAKs per congestion
275 int m_iDecCount; // number of decreases in a congestion e poch
276 };
277
278 #endif
OLDNEW
« no previous file with comments | « net/third_party/udt/src/cache.cpp ('k') | net/third_party/udt/src/ccc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698