| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include <netinet/in.h> |
| 5 |
|
| 6 |
#include "sd-forward.h" |
| 7 |
#include "time-util.h" |
| 8 |
|
| 9 |
typedef struct ICMP6Packet { |
| 10 |
unsigned n_ref; |
| 11 |
int ifindex; |
| 12 |
|
| 13 |
struct in6_addr sender_address; |
| 14 |
struct triple_timestamp timestamp; |
| 15 |
|
| 16 |
size_t raw_size; |
| 17 |
uint8_t raw_packet[]; |
| 18 |
} ICMP6Packet; |
| 19 |
|
| 20 |
ICMP6Packet* icmp6_packet_ref(ICMP6Packet *p); |
| 21 |
ICMP6Packet* icmp6_packet_unref(ICMP6Packet *p); |
| 22 |
DEFINE_TRIVIAL_CLEANUP_FUNC(ICMP6Packet*, icmp6_packet_unref); |
| 23 |
|
| 24 |
/* IPv6 Header is 40 bytes and reserves 2 bytes to represent the Payload Length. Thus, the max payload size, |
| 25 |
* including extension headers, is 65535 bytes (2^16 - 1). Jumbograms can be larger (2^32 - 1). */ |
| 26 |
#define ICMP6_MAX_NORMAL_PAYLOAD_SIZE 65535 |
| 27 |
|
| 28 |
int icmp6_packet_set_sender_address(ICMP6Packet *p, const struct in6_addr *addr); |
| 29 |
int icmp6_packet_get_sender_address(ICMP6Packet *p, struct in6_addr *ret); |
| 30 |
int icmp6_packet_get_timestamp(ICMP6Packet *p, clockid_t clock, usec_t *ret); |
| 31 |
const struct icmp6_hdr* icmp6_packet_get_header(ICMP6Packet *p); |
| 32 |
int icmp6_packet_get_type(ICMP6Packet *p); |
| 33 |
|
| 34 |
int icmp6_packet_receive(int fd, ICMP6Packet **ret); |