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

Side by Side Diff: net/third_party/udt/src/channel.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/ccc.cpp ('k') | net/third_party/udt/src/channel.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/27/2011
39 *****************************************************************************/
40
41 #ifndef __UDT_CHANNEL_H__
42 #define __UDT_CHANNEL_H__
43
44
45 #include "udt.h"
46 #include "packet.h"
47
48
49 class CChannel
50 {
51 public:
52 CChannel();
53 CChannel(const int& version);
54 ~CChannel();
55
56 // Functionality:
57 // Opne a UDP channel.
58 // Parameters:
59 // 0) [in] addr: The local address that UDP will use.
60 // Returned value:
61 // None.
62
63 void open(const sockaddr* addr = NULL);
64
65 // Functionality:
66 // Opne a UDP channel based on an existing UDP socket.
67 // Parameters:
68 // 0) [in] udpsock: UDP socket descriptor.
69 // Returned value:
70 // None.
71
72 void open(UDPSOCKET udpsock);
73
74 // Functionality:
75 // Disconnect and close the UDP entity.
76 // Parameters:
77 // None.
78 // Returned value:
79 // None.
80
81 void close() const;
82
83 // Functionality:
84 // Get the UDP sending buffer size.
85 // Parameters:
86 // None.
87 // Returned value:
88 // Current UDP sending buffer size.
89
90 int getSndBufSize();
91
92 // Functionality:
93 // Get the UDP receiving buffer size.
94 // Parameters:
95 // None.
96 // Returned value:
97 // Current UDP receiving buffer size.
98
99 int getRcvBufSize();
100
101 // Functionality:
102 // Set the UDP sending buffer size.
103 // Parameters:
104 // 0) [in] size: expected UDP sending buffer size.
105 // Returned value:
106 // None.
107
108 void setSndBufSize(const int& size);
109
110 // Functionality:
111 // Set the UDP receiving buffer size.
112 // Parameters:
113 // 0) [in] size: expected UDP receiving buffer size.
114 // Returned value:
115 // None.
116
117 void setRcvBufSize(const int& size);
118
119 // Functionality:
120 // Query the socket address that the channel is using.
121 // Parameters:
122 // 0) [out] addr: pointer to store the returned socket address.
123 // Returned value:
124 // None.
125
126 void getSockAddr(sockaddr* addr) const;
127
128 // Functionality:
129 // Query the peer side socket address that the channel is connect to.
130 // Parameters:
131 // 0) [out] addr: pointer to store the returned socket address.
132 // Returned value:
133 // None.
134
135 void getPeerAddr(sockaddr* addr) const;
136
137 // Functionality:
138 // Send a packet to the given address.
139 // Parameters:
140 // 0) [in] addr: pointer to the destination address.
141 // 1) [in] packet: reference to a CPacket entity.
142 // Returned value:
143 // Actual size of data sent.
144
145 int sendto(const sockaddr* addr, CPacket& packet) const;
146
147 // Functionality:
148 // Receive a packet from the channel and record the source address.
149 // Parameters:
150 // 0) [in] addr: pointer to the source address.
151 // 1) [in] packet: reference to a CPacket entity.
152 // Returned value:
153 // Actual size of data received.
154
155 int recvfrom(sockaddr* addr, CPacket& packet) const;
156
157 private:
158 void setUDPSockOpt();
159
160 private:
161 int m_iIPversion; // IP version
162 int m_iSockAddrSize; // socket address structure size (pre-de fined to avoid run-time test)
163
164 UDPSOCKET m_iSocket; // socket descriptor
165
166 int m_iSndBufSize; // UDP sending buffer size
167 int m_iRcvBufSize; // UDP receiving buffer size
168 };
169
170
171 #endif
OLDNEW
« no previous file with comments | « net/third_party/udt/src/ccc.cpp ('k') | net/third_party/udt/src/channel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698