aboutsummaryrefslogtreecommitdiff
path: root/cast/common/certificate/types.h
blob: c3cf7efe2738447775281d0fb972998b8f178ff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CAST_COMMON_CERTIFICATE_TYPES_H_
#define CAST_COMMON_CERTIFICATE_TYPES_H_

#include <stdint.h>

#include <chrono>

namespace openscreen {
namespace cast {

struct ConstDataSpan {
  const uint8_t* data;
  uint32_t length;
};

struct DateTime {
  uint16_t year;
  uint8_t month;
  uint8_t day;
  uint8_t hour;
  uint8_t minute;
  uint8_t second;
};

bool operator<(const DateTime& a, const DateTime& b);
bool operator>(const DateTime& a, const DateTime& b);
bool DateTimeFromSeconds(uint64_t seconds, DateTime* time);

// |time| is assumed to be valid.
std::chrono::seconds DateTimeToSeconds(const DateTime& time);

}  // namespace cast
}  // namespace openscreen

#endif  // CAST_COMMON_CERTIFICATE_TYPES_H_