• 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_TRANSPORT_STATE_H_
12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_DTLS_TRANSPORT_STATE_H_
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #include "absl/strings/string_view.h"
19 #include "api/dtls_transport_interface.h"
20 #include "api/rtc_event_log/rtc_event.h"
21 #include "api/units/timestamp.h"
22 #include "logging/rtc_event_log/events/rtc_event_field_encoding_parser.h"
23 
24 namespace webrtc {
25 
26 struct LoggedDtlsTransportState {
log_time_usLoggedDtlsTransportState27   int64_t log_time_us() const { return timestamp.us(); }
log_time_msLoggedDtlsTransportState28   int64_t log_time_ms() const { return timestamp.ms(); }
log_timeLoggedDtlsTransportState29   Timestamp log_time() const { return timestamp; }
30 
31   Timestamp timestamp = Timestamp::MinusInfinity();
32   DtlsTransportState dtls_transport_state;
33 };
34 
35 class RtcEventDtlsTransportState : public RtcEvent {
36  public:
37   static constexpr Type kType = Type::DtlsTransportState;
38 
39   explicit RtcEventDtlsTransportState(DtlsTransportState state);
40   ~RtcEventDtlsTransportState() override;
41 
GetType()42   Type GetType() const override { return kType; }
IsConfigEvent()43   bool IsConfigEvent() const override { return false; }
44 
45   std::unique_ptr<RtcEventDtlsTransportState> Copy() const;
46 
dtls_transport_state()47   DtlsTransportState dtls_transport_state() const {
48     return dtls_transport_state_;
49   }
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<LoggedDtlsTransportState> & output)56   static RtcEventLogParseStatus Parse(
57       absl::string_view encoded_bytes,
58       bool batched,
59       std::vector<LoggedDtlsTransportState>& output) {
60     // TODO(terelius): Implement
61     return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__);
62   }
63 
64  private:
65   RtcEventDtlsTransportState(const RtcEventDtlsTransportState& other);
66 
67   const DtlsTransportState dtls_transport_state_;
68 };
69 
70 }  // namespace webrtc
71 
72 #endif  // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_DTLS_TRANSPORT_STATE_H_
73