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 |
11 #include "webrtc/base/winping.h" | 11 #include "webrtc/base/winping.h" |
12 | 12 |
13 #include <assert.h> | |
14 #include <Iphlpapi.h> | 13 #include <Iphlpapi.h> |
15 | 14 |
16 #include <algorithm> | 15 #include <algorithm> |
17 | 16 |
18 #include "webrtc/base/byteorder.h" | 17 #include "webrtc/base/byteorder.h" |
| 18 #include "webrtc/base/checks.h" |
19 #include "webrtc/base/common.h" | 19 #include "webrtc/base/common.h" |
20 #include "webrtc/base/ipaddress.h" | 20 #include "webrtc/base/ipaddress.h" |
21 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
22 #include "webrtc/base/nethelpers.h" | 22 #include "webrtc/base/nethelpers.h" |
23 #include "webrtc/base/socketaddress.h" | 23 #include "webrtc/base/socketaddress.h" |
24 | 24 |
25 namespace rtc { | 25 namespace rtc { |
26 | 26 |
27 ////////////////////////////////////////////////////////////////////// | 27 ////////////////////////////////////////////////////////////////////// |
28 // Found in IPExport.h | 28 // Found in IPExport.h |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 WinPing::PingResult WinPing::Ping(IPAddress ip, | 211 WinPing::PingResult WinPing::Ping(IPAddress ip, |
212 uint32_t data_size, | 212 uint32_t data_size, |
213 uint32_t timeout, | 213 uint32_t timeout, |
214 uint8_t ttl, | 214 uint8_t ttl, |
215 bool allow_fragments) { | 215 bool allow_fragments) { |
216 if (data_size == 0 || timeout == 0 || ttl == 0) { | 216 if (data_size == 0 || timeout == 0 || ttl == 0) { |
217 LOG(LERROR) << "IcmpSendEcho: data_size/timeout/ttl is 0."; | 217 LOG(LERROR) << "IcmpSendEcho: data_size/timeout/ttl is 0."; |
218 return PING_INVALID_PARAMS; | 218 return PING_INVALID_PARAMS; |
219 } | 219 } |
220 | 220 |
221 assert(IsValid()); | 221 RTC_DCHECK(IsValid()); |
222 | 222 |
223 IP_OPTION_INFORMATION ipopt; | 223 IP_OPTION_INFORMATION ipopt; |
224 memset(&ipopt, 0, sizeof(ipopt)); | 224 memset(&ipopt, 0, sizeof(ipopt)); |
225 if (!allow_fragments) | 225 if (!allow_fragments) |
226 ipopt.Flags |= IP_FLAG_DF; | 226 ipopt.Flags |= IP_FLAG_DF; |
227 ipopt.Ttl = ttl; | 227 ipopt.Ttl = ttl; |
228 | 228 |
229 uint32_t reply_size = ReplySize(data_size, ip.family()); | 229 uint32_t reply_size = ReplySize(data_size, ip.family()); |
230 | 230 |
231 if (data_size > dlen_) { | 231 if (data_size > dlen_) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // Return Value: | 349 // Return Value: |
350 // | 350 // |
351 // Returns the number of ICMP_ECHO_REPLY structures stored in ReplyBuffer. | 351 // Returns the number of ICMP_ECHO_REPLY structures stored in ReplyBuffer. |
352 // The status of each reply is contained in the structure. If the return | 352 // The status of each reply is contained in the structure. If the return |
353 // value is zero, extended error information is available via | 353 // value is zero, extended error information is available via |
354 // GetLastError(). | 354 // GetLastError(). |
355 // | 355 // |
356 ////////////////////////////////////////////////////////////////////// | 356 ////////////////////////////////////////////////////////////////////// |
357 | 357 |
358 } // namespace rtc | 358 } // namespace rtc |
OLD | NEW |