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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 DWORD result = 0; | 242 DWORD result = 0; |
243 if (ip.family() == AF_INET) { | 243 if (ip.family() == AF_INET) { |
244 result = send_(hping_, ip.ipv4_address().S_un.S_addr, data_, | 244 result = send_(hping_, ip.ipv4_address().S_un.S_addr, data_, |
245 uint16_t(data_size), &ipopt, reply_, reply_size, timeout); | 245 uint16_t(data_size), &ipopt, reply_, reply_size, timeout); |
246 } else if (ip.family() == AF_INET6) { | 246 } else if (ip.family() == AF_INET6) { |
247 sockaddr_in6 src = {0}; | 247 sockaddr_in6 src = {0}; |
248 sockaddr_in6 dst = {0}; | 248 sockaddr_in6 dst = {0}; |
249 src.sin6_family = AF_INET6; | 249 src.sin6_family = AF_INET6; |
250 dst.sin6_family = AF_INET6; | 250 dst.sin6_family = AF_INET6; |
251 dst.sin6_addr = ip.ipv6_address(); | 251 dst.sin6_addr = ip.ipv6_address(); |
252 result = send6_(hping6_, NULL, NULL, NULL, &src, &dst, data_, | 252 result = send6_(hping6_, nullptr, nullptr, nullptr, &src, &dst, data_, |
253 int16_t(data_size), &ipopt, reply_, reply_size, timeout); | 253 int16_t(data_size), &ipopt, reply_, reply_size, timeout); |
254 } | 254 } |
255 if (result == 0) { | 255 if (result == 0) { |
256 DWORD error = GetLastError(); | 256 DWORD error = GetLastError(); |
257 if (error == IP_PACKET_TOO_BIG) | 257 if (error == IP_PACKET_TOO_BIG) |
258 return PING_TOO_LARGE; | 258 return PING_TOO_LARGE; |
259 if (error == IP_REQ_TIMED_OUT) | 259 if (error == IP_REQ_TIMED_OUT) |
260 return PING_TIMEOUT; | 260 return PING_TIMEOUT; |
261 LOG(LERROR) << "IcmpSendEcho(" << ip.ToSensitiveString() | 261 LOG(LERROR) << "IcmpSendEcho(" << ip.ToSensitiveString() |
262 << ", " << data_size << "): " << error; | 262 << ", " << data_size << "): " << error; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // IcmpHandle - An open handle returned by ICMPCreateFile. | 323 // IcmpHandle - An open handle returned by ICMPCreateFile. |
324 // | 324 // |
325 // DestinationAddress - The destination of the echo request. | 325 // DestinationAddress - The destination of the echo request. |
326 // | 326 // |
327 // RequestData - A buffer containing the data to send in the | 327 // RequestData - A buffer containing the data to send in the |
328 // request. | 328 // request. |
329 // | 329 // |
330 // RequestSize - The number of bytes in the request data buffer. | 330 // RequestSize - The number of bytes in the request data buffer. |
331 // | 331 // |
332 // RequestOptions - Pointer to the IP header options for the request. | 332 // RequestOptions - Pointer to the IP header options for the request. |
333 // May be NULL. | 333 // May be null. |
334 // | 334 // |
335 // ReplyBuffer - A buffer to hold any replies to the request. | 335 // ReplyBuffer - A buffer to hold any replies to the request. |
336 // On return, the buffer will contain an array of | 336 // On return, the buffer will contain an array of |
337 // ICMP_ECHO_REPLY structures followed by the | 337 // ICMP_ECHO_REPLY structures followed by the |
338 // options and data for the replies. The buffer | 338 // options and data for the replies. The buffer |
339 // should be large enough to hold at least one | 339 // should be large enough to hold at least one |
340 // ICMP_ECHO_REPLY structure plus | 340 // ICMP_ECHO_REPLY structure plus |
341 // MAX(RequestSize, 8) bytes of data since an ICMP | 341 // MAX(RequestSize, 8) bytes of data since an ICMP |
342 // error message contains 8 bytes of data. | 342 // error message contains 8 bytes of data. |
343 // | 343 // |
344 // ReplySize - The size in bytes of the reply buffer. | 344 // ReplySize - The size in bytes of the reply buffer. |
345 // | 345 // |
346 // Timeout - The time in milliseconds to wait for replies. | 346 // Timeout - The time in milliseconds to wait for replies. |
347 // | 347 // |
348 // Return Value: | 348 // Return Value: |
349 // | 349 // |
350 // Returns the number of ICMP_ECHO_REPLY structures stored in ReplyBuffer. | 350 // Returns the number of ICMP_ECHO_REPLY structures stored in ReplyBuffer. |
351 // The status of each reply is contained in the structure. If the return | 351 // The status of each reply is contained in the structure. If the return |
352 // value is zero, extended error information is available via | 352 // value is zero, extended error information is available via |
353 // GetLastError(). | 353 // GetLastError(). |
354 // | 354 // |
355 ////////////////////////////////////////////////////////////////////// | 355 ////////////////////////////////////////////////////////////////////// |
356 | 356 |
357 } // namespace rtc | 357 } // namespace rtc |
OLD | NEW |