• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_DTLS_WRITABLE_STATE_H_
12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_DTLS_WRITABLE_STATE_H_
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #include "absl/strings/string_view.h"
19 #include "api/rtc_event_log/rtc_event.h"
20 #include "api/units/timestamp.h"
21 #include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h"
22 
23 namespace webrtc {
24 
25 struct LoggedDtlsWritableState {
26   LoggedDtlsWritableState() = default;
LoggedDtlsWritableStateLoggedDtlsWritableState27   explicit LoggedDtlsWritableState(bool writable) : writable(writable) {}
28 
log_time_usLoggedDtlsWritableState29   int64_t log_time_us() const { return timestamp.us(); }
log_time_msLoggedDtlsWritableState30   int64_t log_time_ms() const { return timestamp.ms(); }
log_timeLoggedDtlsWritableState31   Timestamp log_time() const { return timestamp; }
32 
33   Timestamp timestamp = Timestamp::MinusInfinity();
34   bool writable;
35 };
36 
37 class RtcEventDtlsWritableState : public RtcEvent {
38  public:
39   static constexpr Type kType = Type::DtlsWritableState;
40 
41   explicit RtcEventDtlsWritableState(bool writable);
42   ~RtcEventDtlsWritableState() override;
43 
GetType()44   Type GetType() const override { return kType; }
IsConfigEvent()45   bool IsConfigEvent() const override { return false; }
46 
47   std::unique_ptr<RtcEventDtlsWritableState> Copy() const;
48 
writable()49   bool writable() const { return writable_; }
50 
Encode(rtc::ArrayView<const RtcEvent * > batch)51   static std::string Encode(rtc::ArrayView<const RtcEvent*> batch) {
52     // TODO(terelius): Implement
53     return "";
54   }
55 
Parse(absl::string_view encoded_bytes,bool batched,std::vector<LoggedDtlsWritableState> & output)56   static RtcEventLogParseStatus Parse(
57       absl::string_view encoded_bytes,
58       bool batched,
59       std::vector<LoggedDtlsWritableState>& output) {
60     // TODO(terelius): Implement
61     return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__);
62   }
63 
64  private:
65   RtcEventDtlsWritableState(const RtcEventDtlsWritableState& other);
66 
67   const bool writable_;
68 };
69 
70 }  // namespace webrtc
71 
72 #endif  // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_DTLS_WRITABLE_STATE_H_
73