libicmp/includes/internal/icmp_packet.h

38 lines
609 B
C

#ifndef ICMP_PACKET_H
#define ICMP_PACKET_H
#include <stdint.h>
/* ICMP Header Structure (RFC 792) */
struct icmp_header {
uint8_t type;
uint8_t code;
uint16_t checksum;
union {
struct {
uint16_t id;
uint16_t seq;
} echo;
uint32_t gateway;
struct {
uint16_t unused;
uint16_t mtu;
} frag;
} un;
} __attribute__((packed));
/* IP Header Structure */
struct ip_header {
uint8_t version_ihl;
uint8_t tos;
uint16_t total_len;
uint16_t id;
uint16_t frag_off;
uint8_t ttl;
uint8_t protocol;
uint16_t checksum;
uint32_t saddr;
uint32_t daddr;
} __attribute__((packed));
#endif