xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/qbone/platform/icmp_packet.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_QBONE_PLATFORM_ICMP_PACKET_H_
6 #define QUICHE_QUIC_QBONE_PLATFORM_ICMP_PACKET_H_
7 
8 #include <netinet/icmp6.h>
9 #include <netinet/in.h>
10 
11 #include <functional>
12 
13 #include "absl/strings/string_view.h"
14 #include "quiche/quic/platform/api/quic_ip_address.h"
15 #include "quiche/common/quiche_callbacks.h"
16 
17 namespace quic {
18 
19 // Creates an ICMPv6 packet, returning a packed string representation of the
20 // packet to |cb|. The resulting packet is given to a callback because it's
21 // stack allocated inside CreateIcmpPacket.
22 void CreateIcmpPacket(in6_addr src, in6_addr dst, const icmp6_hdr& icmp_header,
23                       absl::string_view body,
24                       quiche::UnretainedCallback<void(absl::string_view)> cb);
25 
26 }  // namespace quic
27 
28 #endif  // QUICHE_QUIC_QBONE_PLATFORM_ICMP_PACKET_H_
29