blob: c3ac309cf7292fbec8a545e016ca319b73c485ad [file] [log] [blame]
michaeltfcea39d2017-04-20 05:39:30 -07001/*
2 * Copyright 2017 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef RTC_TOOLS_NETWORK_TESTER_PACKET_LOGGER_H_
12#define RTC_TOOLS_NETWORK_TESTER_PACKET_LOGGER_H_
michaeltfcea39d2017-04-20 05:39:30 -070013
14#include <fstream>
15#include <string>
16
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "rtc_base/ignore_wundef.h"
michaeltfcea39d2017-04-20 05:39:30 -070018
19#ifdef WEBRTC_NETWORK_TESTER_PROTO
20RTC_PUSH_IGNORING_WUNDEF()
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "rtc_tools/network_tester/network_tester_packet.pb.h"
michaeltfcea39d2017-04-20 05:39:30 -070022RTC_POP_IGNORING_WUNDEF()
23using webrtc::network_tester::packet::NetworkTesterPacket;
24#else
25class NetworkTesterPacket;
26#endif // WEBRTC_NETWORK_TESTER_PROTO
27
28namespace webrtc {
29
30class PacketLogger {
31 public:
32 explicit PacketLogger(const std::string& log_file_path);
33 ~PacketLogger();
34
Artem Titov6cae2d52022-01-26 15:01:10 +000035 PacketLogger(const PacketLogger&) = delete;
36 PacketLogger& operator=(const PacketLogger&) = delete;
37
michaeltfcea39d2017-04-20 05:39:30 -070038 void LogPacket(const NetworkTesterPacket& packet);
39
40 private:
41 std::ofstream packet_logger_stream_;
michaeltfcea39d2017-04-20 05:39:30 -070042};
43
44} // namespace webrtc
45
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020046#endif // RTC_TOOLS_NETWORK_TESTER_PACKET_LOGGER_H_