OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 if (type_ == SOCK_DGRAM) { | 45 if (type_ == SOCK_DGRAM) { |
46 if (!server_->Check(FP_UDP, GetLocalAddress(), addr)) { | 46 if (!server_->Check(FP_UDP, GetLocalAddress(), addr)) { |
47 LOG(LS_VERBOSE) << "FirewallSocket outbound UDP packet from " | 47 LOG(LS_VERBOSE) << "FirewallSocket outbound UDP packet from " |
48 << GetLocalAddress().ToSensitiveString() << " to " | 48 << GetLocalAddress().ToSensitiveString() << " to " |
49 << addr.ToSensitiveString() << " dropped"; | 49 << addr.ToSensitiveString() << " dropped"; |
50 return static_cast<int>(cb); | 50 return static_cast<int>(cb); |
51 } | 51 } |
52 } | 52 } |
53 return AsyncSocketAdapter::SendTo(pv, cb, addr); | 53 return AsyncSocketAdapter::SendTo(pv, cb, addr); |
54 } | 54 } |
55 int Recv(void* pv, size_t cb) override { | 55 int Recv(void* pv, size_t cb, int64_t* timestamp) override { |
56 SocketAddress addr; | 56 SocketAddress addr; |
57 return RecvFrom(pv, cb, &addr); | 57 return RecvFrom(pv, cb, &addr, timestamp); |
58 } | 58 } |
59 int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override { | 59 int RecvFrom(void* pv, |
| 60 size_t cb, |
| 61 SocketAddress* paddr, |
| 62 int64_t* timestamp) override { |
60 if (type_ == SOCK_DGRAM) { | 63 if (type_ == SOCK_DGRAM) { |
61 while (true) { | 64 while (true) { |
62 int res = AsyncSocketAdapter::RecvFrom(pv, cb, paddr); | 65 int res = AsyncSocketAdapter::RecvFrom(pv, cb, paddr, timestamp); |
63 if (res <= 0) | 66 if (res <= 0) |
64 return res; | 67 return res; |
65 if (server_->Check(FP_UDP, *paddr, GetLocalAddress())) | 68 if (server_->Check(FP_UDP, *paddr, GetLocalAddress())) |
66 return res; | 69 return res; |
67 LOG(LS_VERBOSE) << "FirewallSocket inbound UDP packet from " | 70 LOG(LS_VERBOSE) << "FirewallSocket inbound UDP packet from " |
68 << paddr->ToSensitiveString() << " to " | 71 << paddr->ToSensitiveString() << " to " |
69 << GetLocalAddress().ToSensitiveString() << " dropped"; | 72 << GetLocalAddress().ToSensitiveString() << " dropped"; |
70 } | 73 } |
71 } | 74 } |
72 return AsyncSocketAdapter::RecvFrom(pv, cb, paddr); | 75 return AsyncSocketAdapter::RecvFrom(pv, cb, paddr, timestamp); |
73 } | 76 } |
74 | 77 |
75 int Listen(int backlog) override { | 78 int Listen(int backlog) override { |
76 if (!server_->tcp_listen_enabled()) { | 79 if (!server_->tcp_listen_enabled()) { |
77 LOG(LS_VERBOSE) << "FirewallSocket listen attempt denied"; | 80 LOG(LS_VERBOSE) << "FirewallSocket listen attempt denied"; |
78 return -1; | 81 return -1; |
79 } | 82 } |
80 | 83 |
81 return AsyncSocketAdapter::Listen(backlog); | 84 return AsyncSocketAdapter::Listen(backlog); |
82 } | 85 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 245 |
243 void FirewallManager::ClearRules() { | 246 void FirewallManager::ClearRules() { |
244 CritScope scope(&crit_); | 247 CritScope scope(&crit_); |
245 for (std::vector<FirewallSocketServer*>::const_iterator it = | 248 for (std::vector<FirewallSocketServer*>::const_iterator it = |
246 servers_.begin(); it != servers_.end(); ++it) { | 249 servers_.begin(); it != servers_.end(); ++it) { |
247 (*it)->ClearRules(); | 250 (*it)->ClearRules(); |
248 } | 251 } |
249 } | 252 } |
250 | 253 |
251 } // namespace rtc | 254 } // namespace rtc |
OLD | NEW |