OLD | NEW |
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 #include "content/browser/renderer_host/p2p/socket_host.h" | 5 #include "content/browser/renderer_host/p2p/socket_host.h" |
6 | 6 |
7 #include "net/base/sys_byteorder.h" | 7 #include "net/base/sys_byteorder.h" |
8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" | 8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
9 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" | 9 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" |
10 #include "content/browser/renderer_host/p2p/socket_host_udp.h" | 10 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 case STUN_DATA_INDICATION: | 59 case STUN_DATA_INDICATION: |
60 *type = static_cast<StunMessageType>(message_type); | 60 *type = static_cast<StunMessageType>(message_type); |
61 return true; | 61 return true; |
62 | 62 |
63 default: | 63 default: |
64 return false; | 64 return false; |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 // static | 68 // static |
| 69 bool P2PSocketHost::IsRequestOrResponse(StunMessageType type) { |
| 70 return type == STUN_BINDING_REQUEST || type == STUN_BINDING_RESPONSE || |
| 71 type == STUN_ALLOCATE_REQUEST || type == STUN_ALLOCATE_RESPONSE; |
| 72 } |
| 73 |
| 74 // static |
69 P2PSocketHost* P2PSocketHost::Create( | 75 P2PSocketHost* P2PSocketHost::Create( |
70 IPC::Message::Sender* message_sender, int routing_id, int id, | 76 IPC::Message::Sender* message_sender, int routing_id, int id, |
71 P2PSocketType type) { | 77 P2PSocketType type) { |
72 switch (type) { | 78 switch (type) { |
73 case P2P_SOCKET_UDP: | 79 case P2P_SOCKET_UDP: |
74 return new P2PSocketHostUdp(message_sender, routing_id, id); | 80 return new P2PSocketHostUdp(message_sender, routing_id, id); |
75 | 81 |
76 case P2P_SOCKET_TCP_SERVER: | 82 case P2P_SOCKET_TCP_SERVER: |
77 return new P2PSocketHostTcpServer(message_sender, routing_id, id); | 83 return new P2PSocketHostTcpServer(message_sender, routing_id, id); |
78 | 84 |
79 case P2P_SOCKET_TCP_CLIENT: | 85 case P2P_SOCKET_TCP_CLIENT: |
80 return new P2PSocketHostTcp(message_sender, routing_id, id); | 86 return new P2PSocketHostTcp(message_sender, routing_id, id); |
81 } | 87 } |
82 | 88 |
83 NOTREACHED(); | 89 NOTREACHED(); |
84 return NULL; | 90 return NULL; |
85 } | 91 } |
OLD | NEW |