summaryrefslogtreecommitdiffhomepage
path: root/ios/PacketTunnelCore/Pinger/IPv4Header.h
blob: 64e09b6ae1a7dbaaf0e32015151143ab15f9ba54 (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
31
32
33
//
//  IPv4Header.h
//  PacketTunnelCore
//
//  Created by pronebird on 24/08/2022.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

#ifndef IPV4HEADER_H
#define IPV4HEADER_H

#include <stdint.h>
#include <AssertMacros.h>

struct IPv4Header {
    uint8_t versionAndHeaderLength;
    uint8_t differentiatedServices;
    uint16_t totalLength;
    uint16_t identification;
    uint16_t flagsAndFragmentOffset;
    uint8_t timeToLive;
    uint8_t protocol;
    uint16_t headerChecksum;
    uint8_t sourceAddress[4];
    uint8_t destinationAddress[4];
    // options...
    // data...
} __attribute__((packed));
typedef struct IPv4Header IPv4Header;

__Check_Compile_Time(sizeof(IPv4Header) == 20);

#endif /* IPV4HEADER_H */