1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#ifndef COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include <string>
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace rappor {
11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)enum Probability {
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PROBABILITY_75,    // 75%
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PROBABILITY_50,    // 50%
15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  PROBABILITY_25,    // 25%
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// An object describing a rappor metric and the parameters used to generate it.
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)//
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// For a full description of the rappor metrics, see
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// http://www.chromium.org/developers/design-documents/rappor
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)struct RapporParameters {
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Get a string representing the parameters, for DCHECK_EQ.
24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string ToString() const;
25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // The maximum number of cohorts we divide clients into.
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  static const int kMaxCohorts;
28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // The number of cohorts to divide the reports for this metric into.
30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  int num_cohorts;
31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // The number of bytes stored in the Bloom filter.
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  int bloom_filter_size_bytes;
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // The number of hash functions used in the Bloom filter.
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  int bloom_filter_hash_function_count;
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // The probability that a bit will be redacted with fake data.
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Probability fake_prob;
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // The probability that a fake bit will be a one.
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Probability fake_one_prob;
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // The probability that a one bit in the redacted data reports as one.
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Probability one_coin_prob;
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // The probability that a zero bit in the redacted data reports as one.
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Probability zero_coin_prob;
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace rappor
49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif  // COMPONENTS_RAPPOR_RAPPOR_PARAMETERS_H_
51