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

Side by Side Diff: webrtc/p2p/client/basicportallocator.h

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: google::int32 Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 }; 163 };
164 164
165 void OnConfigReady(PortConfiguration* config); 165 void OnConfigReady(PortConfiguration* config);
166 void OnConfigStop(); 166 void OnConfigStop();
167 void AllocatePorts(); 167 void AllocatePorts();
168 void OnAllocate(); 168 void OnAllocate();
169 void DoAllocate(); 169 void DoAllocate();
170 void OnNetworksChanged(); 170 void OnNetworksChanged();
171 void OnAllocationSequenceObjectsCreated(); 171 void OnAllocationSequenceObjectsCreated();
172 void DisableEquivalentPhases(rtc::Network* network, 172 void DisableEquivalentPhases(rtc::Network* network,
173 PortConfiguration* config, uint32* flags); 173 PortConfiguration* config,
174 uint32_t* flags);
174 void AddAllocatedPort(Port* port, AllocationSequence* seq, 175 void AddAllocatedPort(Port* port, AllocationSequence* seq,
175 bool prepare_address); 176 bool prepare_address);
176 void OnCandidateReady(Port* port, const Candidate& c); 177 void OnCandidateReady(Port* port, const Candidate& c);
177 void OnPortComplete(Port* port); 178 void OnPortComplete(Port* port);
178 void OnPortError(Port* port); 179 void OnPortError(Port* port);
179 void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto); 180 void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto);
180 void OnPortDestroyed(PortInterface* port); 181 void OnPortDestroyed(PortInterface* port);
181 void OnShake(); 182 void OnShake();
182 void MaybeSignalCandidatesAllocationDone(); 183 void MaybeSignalCandidatesAllocationDone();
183 void OnPortAllocationComplete(AllocationSequence* seq); 184 void OnPortAllocationComplete(AllocationSequence* seq);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 kInit, // Initial state. 250 kInit, // Initial state.
250 kRunning, // Started allocating ports. 251 kRunning, // Started allocating ports.
251 kStopped, // Stopped from running. 252 kStopped, // Stopped from running.
252 kCompleted, // All ports are allocated. 253 kCompleted, // All ports are allocated.
253 254
254 // kInit --> kRunning --> {kCompleted|kStopped} 255 // kInit --> kRunning --> {kCompleted|kStopped}
255 }; 256 };
256 AllocationSequence(BasicPortAllocatorSession* session, 257 AllocationSequence(BasicPortAllocatorSession* session,
257 rtc::Network* network, 258 rtc::Network* network,
258 PortConfiguration* config, 259 PortConfiguration* config,
259 uint32 flags); 260 uint32_t flags);
260 ~AllocationSequence(); 261 ~AllocationSequence();
261 bool Init(); 262 bool Init();
262 void Clear(); 263 void Clear();
263 264
264 State state() const { return state_; } 265 State state() const { return state_; }
265 266
266 // Disables the phases for a new sequence that this one already covers for an 267 // Disables the phases for a new sequence that this one already covers for an
267 // equivalent network setup. 268 // equivalent network setup.
268 void DisableEquivalentPhases(rtc::Network* network, 269 void DisableEquivalentPhases(rtc::Network* network,
269 PortConfiguration* config, 270 PortConfiguration* config,
270 uint32* flags); 271 uint32_t* flags);
271 272
272 // Starts and stops the sequence. When started, it will continue allocating 273 // Starts and stops the sequence. When started, it will continue allocating
273 // new ports on its own timed schedule. 274 // new ports on its own timed schedule.
274 void Start(); 275 void Start();
275 void Stop(); 276 void Stop();
276 277
277 // MessageHandler 278 // MessageHandler
278 void OnMessage(rtc::Message* msg); 279 void OnMessage(rtc::Message* msg);
279 280
280 void EnableProtocol(ProtocolType proto); 281 void EnableProtocol(ProtocolType proto);
281 bool ProtocolEnabled(ProtocolType proto) const; 282 bool ProtocolEnabled(ProtocolType proto) const;
282 283
283 // Signal from AllocationSequence, when it's done with allocating ports. 284 // Signal from AllocationSequence, when it's done with allocating ports.
284 // This signal is useful, when port allocation fails which doesn't result 285 // This signal is useful, when port allocation fails which doesn't result
285 // in any candidates. Using this signal BasicPortAllocatorSession can send 286 // in any candidates. Using this signal BasicPortAllocatorSession can send
286 // its candidate discovery conclusion signal. Without this signal, 287 // its candidate discovery conclusion signal. Without this signal,
287 // BasicPortAllocatorSession doesn't have any event to trigger signal. This 288 // BasicPortAllocatorSession doesn't have any event to trigger signal. This
288 // can also be achieved by starting timer in BPAS. 289 // can also be achieved by starting timer in BPAS.
289 sigslot::signal1<AllocationSequence*> SignalPortAllocationComplete; 290 sigslot::signal1<AllocationSequence*> SignalPortAllocationComplete;
290 291
291 protected: 292 protected:
292 // For testing. 293 // For testing.
293 void CreateTurnPort(const RelayServerConfig& config); 294 void CreateTurnPort(const RelayServerConfig& config);
294 295
295 private: 296 private:
296 typedef std::vector<ProtocolType> ProtocolList; 297 typedef std::vector<ProtocolType> ProtocolList;
297 298
298 bool IsFlagSet(uint32 flag) { return ((flags_ & flag) != 0); } 299 bool IsFlagSet(uint32_t flag) { return ((flags_ & flag) != 0); }
299 void CreateUDPPorts(); 300 void CreateUDPPorts();
300 void CreateTCPPorts(); 301 void CreateTCPPorts();
301 void CreateStunPorts(); 302 void CreateStunPorts();
302 void CreateRelayPorts(); 303 void CreateRelayPorts();
303 void CreateGturnPort(const RelayServerConfig& config); 304 void CreateGturnPort(const RelayServerConfig& config);
304 305
305 void OnReadPacket(rtc::AsyncPacketSocket* socket, 306 void OnReadPacket(rtc::AsyncPacketSocket* socket,
306 const char* data, 307 const char* data,
307 size_t size, 308 size_t size,
308 const rtc::SocketAddress& remote_addr, 309 const rtc::SocketAddress& remote_addr,
309 const rtc::PacketTime& packet_time); 310 const rtc::PacketTime& packet_time);
310 311
311 void OnPortDestroyed(PortInterface* port); 312 void OnPortDestroyed(PortInterface* port);
312 313
313 BasicPortAllocatorSession* session_; 314 BasicPortAllocatorSession* session_;
314 rtc::Network* network_; 315 rtc::Network* network_;
315 rtc::IPAddress ip_; 316 rtc::IPAddress ip_;
316 PortConfiguration* config_; 317 PortConfiguration* config_;
317 State state_; 318 State state_;
318 uint32 flags_; 319 uint32_t flags_;
319 ProtocolList protocols_; 320 ProtocolList protocols_;
320 rtc::scoped_ptr<rtc::AsyncPacketSocket> udp_socket_; 321 rtc::scoped_ptr<rtc::AsyncPacketSocket> udp_socket_;
321 // There will be only one udp port per AllocationSequence. 322 // There will be only one udp port per AllocationSequence.
322 UDPPort* udp_port_; 323 UDPPort* udp_port_;
323 std::vector<TurnPort*> turn_ports_; 324 std::vector<TurnPort*> turn_ports_;
324 int phase_; 325 int phase_;
325 }; 326 };
326 327
327 } // namespace cricket 328 } // namespace cricket
328 329
329 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ 330 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698