1 /*
2  *  Copyright (c) 2019 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 #include "api/test/network_emulation/network_emulation_interfaces.h"
11 
12 #include "rtc_base/net_helper.h"
13 
14 namespace webrtc {
EmulatedIpPacket(const rtc::SocketAddress & from,const rtc::SocketAddress & to,rtc::CopyOnWriteBuffer data,Timestamp arrival_time,uint16_t application_overhead)15 EmulatedIpPacket::EmulatedIpPacket(const rtc::SocketAddress& from,
16                                    const rtc::SocketAddress& to,
17                                    rtc::CopyOnWriteBuffer data,
18                                    Timestamp arrival_time,
19                                    uint16_t application_overhead)
20     : from(from),
21       to(to),
22       data(data),
23       headers_size(to.ipaddr().overhead() + application_overhead +
24                    cricket::kUdpHeaderSize),
25       arrival_time(arrival_time) {
26   RTC_DCHECK(to.family() == AF_INET || to.family() == AF_INET6);
27 }
28 
29 }  // namespace webrtc
30