libicmp/includes/internal/icmp_packet_internal.h
lohhiiccc ace00ea0f2 feat: rework icmp_parse_ip_header
Extend icmp_parse_ip_header to allow optional extraction of destination
IP address and protocol from the IP header
2026-02-05 22:26:49 +01:00

21 lines
659 B
C

#ifndef ICMP_PACKET_INTERNAL_H
#define ICMP_PACKET_INTERNAL_H
#include <stdint.h>
#include <stddef.h>
#include <netinet/in.h>
int icmp_build_packet(void *buffer, size_t buffer_len, uint8_t type,
uint8_t code, uint32_t header_rest,
const void *payload, size_t payload_len);
int icmp_parse_ip_header(const void *buffer, size_t buffer_len,
uint8_t *ttl, struct in_addr *src_addr,
size_t *ip_hdr_len, struct in_addr *dst_addr,
uint8_t *protocol);
int icmp_parse_icmp_payload(const void *buffer, size_t buffer_len,
size_t ip_hdr_len, uint8_t *type, uint8_t *code,
const void **payload, size_t *payload_len);
#endif