summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/icmp6-packet.h
blob: 16f354fc95a4fc033f4c89fa79ff7def60373c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include <inttypes.h>
#include <netinet/in.h>

#include "macro.h"
#include "time-util.h"

typedef struct ICMP6Pakcet {
        unsigned n_ref;

        struct in6_addr sender_address;
        struct triple_timestamp timestamp;

        size_t raw_size;
        uint8_t raw_packet[];
} ICMP6Packet;

ICMP6Packet* icmp6_packet_ref(ICMP6Packet *p);
ICMP6Packet* icmp6_packet_unref(ICMP6Packet *p);
DEFINE_TRIVIAL_CLEANUP_FUNC(ICMP6Packet*, icmp6_packet_unref);

int icmp6_packet_set_sender_address(ICMP6Packet *p, const struct in6_addr *addr);
int icmp6_packet_get_sender_address(ICMP6Packet *p, struct in6_addr *ret);
int icmp6_packet_get_timestamp(ICMP6Packet *p, clockid_t clock, usec_t *ret);
const struct icmp6_hdr* icmp6_packet_get_header(ICMP6Packet *p);
int icmp6_packet_get_type(ICMP6Packet *p);

int icmp6_packet_receive(int fd, ICMP6Packet **ret);