metrics_util.h 730 B

1234567891011121314151617181920
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef CHROMECAST_METRICS_METRICS_UTIL_H_
  5. #define CHROMECAST_METRICS_METRICS_UTIL_H_
  6. #include "net/base/ip_address.h"
  7. namespace chromecast {
  8. // Pack last two bytes of IPv4 or IPv6 address into value used for logging
  9. // partial sender IP fragments (e.g. discovery code and virtual connection
  10. // details). If the address is empty or not valid IPv4/IPv6 then zeros will
  11. // be filled into the packed fragment.
  12. uint32_t GetIPAddressFragmentForLogging(const net::IPAddressBytes& sender_ip);
  13. } // namespace chromecast
  14. #endif // CHROMECAST_METRICS_METRICS_UTIL_H_