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

Side by Side Diff: jingle/glue/fake_socket_factory.h

Issue 7077019: Unbranch libjingle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 7 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 | « content/renderer/p2p/ipc_socket_factory.cc ('k') | jingle/glue/fake_socket_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_ 5 #ifndef JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_
6 #define JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_ 6 #define JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 16 matching lines...) Expand all
27 public: 27 public:
28 FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager, 28 FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager,
29 const net::IPEndPoint& address); 29 const net::IPEndPoint& address);
30 virtual ~FakeUDPPacketSocket(); 30 virtual ~FakeUDPPacketSocket();
31 31
32 const net::IPEndPoint& endpoint() const { return endpoint_; } 32 const net::IPEndPoint& endpoint() const { return endpoint_; }
33 void DeliverPacket(const net::IPEndPoint& from, 33 void DeliverPacket(const net::IPEndPoint& from,
34 const std::vector<char>& data); 34 const std::vector<char>& data);
35 35
36 // talk_base::AsyncPacketSocket implementation. 36 // talk_base::AsyncPacketSocket implementation.
37 virtual bool GetLocalAddress( 37 virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE;
38 talk_base::SocketAddress* address) const OVERRIDE;
39 virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE; 38 virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE;
40 virtual int Send(const void *pv, size_t cb) OVERRIDE; 39 virtual int Send(const void *pv, size_t cb) OVERRIDE;
41 virtual int SendTo(const void *pv, size_t cb, 40 virtual int SendTo(const void *pv, size_t cb,
42 const talk_base::SocketAddress& addr) OVERRIDE; 41 const talk_base::SocketAddress& addr) OVERRIDE;
43 virtual int Close() OVERRIDE; 42 virtual int Close() OVERRIDE;
44 virtual talk_base::Socket::ConnState GetState() const OVERRIDE; 43 virtual State GetState() const OVERRIDE;
45 virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE; 44 virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE;
46 virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE; 45 virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE;
47 virtual int GetError() const OVERRIDE; 46 virtual int GetError() const OVERRIDE;
48 virtual void SetError(int error) OVERRIDE; 47 virtual void SetError(int error) OVERRIDE;
49 48
50 private: 49 private:
51 enum State { 50 enum InternalState {
52 STATE_OPEN, 51 IS_OPEN,
53 STATE_CLOSED, 52 IS_CLOSED,
54 }; 53 };
55 54
56 scoped_refptr<FakeSocketManager> fake_socket_manager_; 55 scoped_refptr<FakeSocketManager> fake_socket_manager_;
57 net::IPEndPoint endpoint_; 56 net::IPEndPoint endpoint_;
58 talk_base::SocketAddress local_address_; 57 talk_base::SocketAddress local_address_;
59 talk_base::SocketAddress remote_address_; 58 talk_base::SocketAddress remote_address_;
60 State state_; 59 InternalState state_;
61 int error_; 60 int error_;
62 61
63 DISALLOW_COPY_AND_ASSIGN(FakeUDPPacketSocket); 62 DISALLOW_COPY_AND_ASSIGN(FakeUDPPacketSocket);
64 }; 63 };
65 64
66 class FakeSocketManager : public base::RefCountedThreadSafe<FakeSocketManager> { 65 class FakeSocketManager : public base::RefCountedThreadSafe<FakeSocketManager> {
67 public: 66 public:
68 FakeSocketManager(); 67 FakeSocketManager();
69 68
70 void SendPacket(const net::IPEndPoint& from, 69 void SendPacket(const net::IPEndPoint& from,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 scoped_refptr<FakeSocketManager> socket_manager_; 112 scoped_refptr<FakeSocketManager> socket_manager_;
114 net::IPAddressNumber address_; 113 net::IPAddressNumber address_;
115 int last_allocated_port_; 114 int last_allocated_port_;
116 115
117 DISALLOW_COPY_AND_ASSIGN(FakeSocketFactory); 116 DISALLOW_COPY_AND_ASSIGN(FakeSocketFactory);
118 }; 117 };
119 118
120 } // namespace jingle_glue 119 } // namespace jingle_glue
121 120
122 #endif // JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_ 121 #endif // JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_
OLDNEW
« no previous file with comments | « content/renderer/p2p/ipc_socket_factory.cc ('k') | jingle/glue/fake_socket_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698