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

Side by Side Diff: net/third_party/udt/src/packet.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/md5.cpp ('k') | net/third_party/udt/src/packet.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 - 2011, 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 01/02/2011
39 *****************************************************************************/
40
41 #ifndef __UDT_PACKET_H__
42 #define __UDT_PACKET_H__
43
44
45 #include "udt.h"
46
47 #ifdef WIN32
48 struct iovec
49 {
50 int iov_len;
51 char* iov_base;
52 };
53 #endif
54
55 class CChannel;
56
57 class CPacket
58 {
59 friend class CChannel;
60 friend class CSndQueue;
61 friend class CRcvQueue;
62
63 public:
64 int32_t& m_iSeqNo; // alias: sequence number
65 int32_t& m_iMsgNo; // alias: message number
66 int32_t& m_iTimeStamp; // alias: timestamp
67 int32_t& m_iID; // alias: socket ID
68 char*& m_pcData; // alias: data/control information
69
70 static const int m_iPktHdrSize; // packet header size
71
72 public:
73 CPacket();
74 ~CPacket();
75
76 // Functionality:
77 // Get the payload or the control information field length.
78 // Parameters:
79 // None.
80 // Returned value:
81 // the payload or the control information field length.
82
83 int getLength() const;
84
85 // Functionality:
86 // Set the payload or the control information field length.
87 // Parameters:
88 // 0) [in] len: the payload or the control information field length.
89 // Returned value:
90 // None.
91
92 void setLength(const int& len);
93
94 // Functionality:
95 // Pack a Control packet.
96 // Parameters:
97 // 0) [in] pkttype: packet type filed.
98 // 1) [in] lparam: pointer to the first data structure, explained by th e packet type.
99 // 2) [in] rparam: pointer to the second data structure, explained by t he packet type.
100 // 3) [in] size: size of rparam, in number of bytes;
101 // Returned value:
102 // None.
103
104 void pack(const int& pkttype, void* lparam = NULL, void* rparam = NULL, const int& size = 0);
105
106 // Functionality:
107 // Read the packet vector.
108 // Parameters:
109 // None.
110 // Returned value:
111 // Pointer to the packet vector.
112
113 iovec* getPacketVector();
114
115 // Functionality:
116 // Read the packet flag.
117 // Parameters:
118 // None.
119 // Returned value:
120 // packet flag (0 or 1).
121
122 int getFlag() const;
123
124 // Functionality:
125 // Read the packet type.
126 // Parameters:
127 // None.
128 // Returned value:
129 // packet type filed (000 ~ 111).
130
131 int getType() const;
132
133 // Functionality:
134 // Read the extended packet type.
135 // Parameters:
136 // None.
137 // Returned value:
138 // extended packet type filed (0x000 ~ 0xFFF).
139
140 int getExtendedType() const;
141
142 // Functionality:
143 // Read the ACK-2 seq. no.
144 // Parameters:
145 // None.
146 // Returned value:
147 // packet header field (bit 16~31).
148
149 int32_t getAckSeqNo() const;
150
151 // Functionality:
152 // Read the message boundary flag bit.
153 // Parameters:
154 // None.
155 // Returned value:
156 // packet header field [1] (bit 0~1).
157
158 int getMsgBoundary() const;
159
160 // Functionality:
161 // Read the message inorder delivery flag bit.
162 // Parameters:
163 // None.
164 // Returned value:
165 // packet header field [1] (bit 2).
166
167 bool getMsgOrderFlag() const;
168
169 // Functionality:
170 // Read the message sequence number.
171 // Parameters:
172 // None.
173 // Returned value:
174 // packet header field [1] (bit 3~31).
175
176 int32_t getMsgSeq() const;
177
178 // Functionality:
179 // Clone this packet.
180 // Parameters:
181 // None.
182 // Returned value:
183 // Pointer to the new packet.
184
185 CPacket* clone() const;
186
187 protected:
188 uint32_t m_nHeader[4]; // The 128-bit header field
189 iovec m_PacketVector[2]; // The 2-demension vector of UDT packet [header, data]
190
191 int32_t __pad;
192
193 protected:
194 CPacket& operator=(const CPacket&);
195 };
196
197 ////////////////////////////////////////////////////////////////////////////////
198
199 class CHandShake
200 {
201 public:
202 CHandShake();
203
204 int serialize(char* buf, int& size);
205 int deserialize(const char* buf, const int& size);
206
207 public:
208 static const int m_iContentSize; // Size of hand shake data
209
210 public:
211 int32_t m_iVersion; // UDT version
212 int32_t m_iType; // UDT socket type
213 int32_t m_iISN; // random initial sequence number
214 int32_t m_iMSS; // maximum segment size
215 int32_t m_iFlightFlagSize; // flow control window size
216 int32_t m_iReqType; // connection request type: 1: regular connectio n request, 0: rendezvous connection request, -1/-2: response
217 int32_t m_iID; // socket ID
218 int32_t m_iCookie; // cookie
219 uint32_t m_piPeerIP[4]; // The IP address that the peer's UDP port is bo und to
220 };
221
222
223 #endif
OLDNEW
« no previous file with comments | « net/third_party/udt/src/md5.cpp ('k') | net/third_party/udt/src/packet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698