#include "quiche/quic/test_tools/test_ip_packets.h"
#include <cstdint>
#include <limits>
#include <string>
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "quiche/quic/core/internet_checksum.h"
#include "quiche/quic/platform/api/quic_socket_address.h"
#include "quiche/common/platform/api/quiche_logging.h"
#include "quiche/common/quiche_data_writer.h"
#include "quiche/common/quiche_endian.h"
#include "quiche/common/quiche_ip_address.h"
#include "quiche/common/quiche_ip_address_family.h"
#if defined(__linux__)
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/udp.h>
#endif
namespace quic::test {
namespace {
constexpr uint16_t kIpv4HeaderSize = …;
constexpr uint16_t kIpv6HeaderSize = …;
constexpr uint16_t kUdpHeaderSize = …;
constexpr uint8_t kUdpProtocol = …;
#if defined(__linux__)
static_assert …;
static_assert …;
static_assert …;
static_assert …;
#endif
std::string CreateIpv4Header(int payload_length,
quiche::QuicheIpAddress source_address,
quiche::QuicheIpAddress destination_address,
uint8_t protocol) { … }
std::string CreateIpv6Header(int payload_length,
quiche::QuicheIpAddress source_address,
quiche::QuicheIpAddress destination_address,
uint8_t next_header) { … }
}
std::string CreateIpPacket(const quiche::QuicheIpAddress& source_address,
const quiche::QuicheIpAddress& destination_address,
absl::string_view payload,
IpPacketPayloadType payload_type) { … }
std::string CreateUdpPacket(const QuicSocketAddress& source_address,
const QuicSocketAddress& destination_address,
absl::string_view payload) { … }
}