proxygen
wangle::TLSTicketKeySeeds Struct Reference

#include <TLSTicketKeySeeds.h>

Public Member Functions

bool operator== (const TLSTicketKeySeeds &rhs) const
 
bool isValidRotation (const TLSTicketKeySeeds &next) const
 
bool isEmpty () const
 
bool isNotEmpty () const
 

Static Public Member Functions

static bool areSeedsSubset (const std::vector< std::string > &lhs, const std::vector< std::string > &rhs)
 

Public Attributes

std::vector< std::stringoldSeeds
 
std::vector< std::stringcurrentSeeds
 
std::vector< std::stringnewSeeds
 

Detailed Description

Definition at line 24 of file TLSTicketKeySeeds.h.

Member Function Documentation

static bool wangle::TLSTicketKeySeeds::areSeedsSubset ( const std::vector< std::string > &  lhs,
const std::vector< std::string > &  rhs 
)
inlinestatic

Definition at line 57 of file TLSTicketKeySeeds.h.

References a.

Referenced by isValidRotation().

59  {
60  if (lhs.size() > rhs.size()) {
61  return false;
62  }
63  std::unordered_set<std::string> a{rhs.cbegin(), rhs.cend()};
64  for (const auto& v :
65  std::unordered_set<std::string>{lhs.cbegin(), lhs.cend()}) {
66  if (a.find(v) == a.end()) {
67  return false;
68  }
69  }
70  return true;
71  }
char a
bool wangle::TLSTicketKeySeeds::isEmpty ( ) const
inline

Definition at line 48 of file TLSTicketKeySeeds.h.

Referenced by isValidRotation().

48  {
49  return oldSeeds.empty() && currentSeeds.empty() && newSeeds.empty();
50  }
std::vector< std::string > newSeeds
std::vector< std::string > currentSeeds
std::vector< std::string > oldSeeds
bool wangle::TLSTicketKeySeeds::isNotEmpty ( ) const
inline

Definition at line 52 of file TLSTicketKeySeeds.h.

Referenced by isValidRotation().

52  {
53  return !oldSeeds.empty() && !currentSeeds.empty() && !newSeeds.empty();
54  }
std::vector< std::string > newSeeds
std::vector< std::string > currentSeeds
std::vector< std::string > oldSeeds
bool wangle::TLSTicketKeySeeds::isValidRotation ( const TLSTicketKeySeeds next) const
inline

Definition at line 35 of file TLSTicketKeySeeds.h.

References areSeedsSubset(), currentSeeds, isEmpty(), isNotEmpty(), newSeeds, and oldSeeds.

35  {
36  // First branch corresponds to not having any ticket seeds, and then
37  // adding ticket seeds for the first time. The second branch corresponds to
38  // a compatible ticket seed update. The third branch is the case of setting
39  // a subset of the ticket seeds a second time
40  return (isEmpty() && next.isNotEmpty()) ||
41  (areSeedsSubset(newSeeds, next.currentSeeds) &&
42  areSeedsSubset(currentSeeds, next.oldSeeds)) ||
43  (areSeedsSubset(oldSeeds, next.oldSeeds) &&
44  areSeedsSubset(currentSeeds, next.currentSeeds) &&
45  areSeedsSubset(newSeeds, next.newSeeds));
46  }
std::vector< std::string > newSeeds
std::vector< std::string > currentSeeds
std::vector< std::string > oldSeeds
static bool areSeedsSubset(const std::vector< std::string > &lhs, const std::vector< std::string > &rhs)
def next(obj)
Definition: ast.py:58
bool wangle::TLSTicketKeySeeds::operator== ( const TLSTicketKeySeeds rhs) const
inline

Definition at line 29 of file TLSTicketKeySeeds.h.

References currentSeeds, newSeeds, and oldSeeds.

29  {
30  return (
31  oldSeeds == rhs.oldSeeds && currentSeeds == rhs.currentSeeds &&
32  newSeeds == rhs.newSeeds);
33  }
std::vector< std::string > newSeeds
std::vector< std::string > currentSeeds
FOLLY_PUSH_WARNING RHS rhs
Definition: Traits.h:649
std::vector< std::string > oldSeeds

Member Data Documentation


The documentation for this struct was generated from the following file: