libicmp/includes/internal/icmp_utils.h
lohhiiccc 2e509336c7 feat(utils): add ICMP checksum and time utilities with tests
- Added `icmp_checksum`.
 - Added `icmp_get_time`.
 - Created unit tests for checksum and time.
 - Set `-D_POSIX_C_SOURCE=199309L` in CPPFLAGS for clock_gettime support.
2026-01-24 22:00:24 +01:00

16 lines
408 B
C

#ifndef ICMP_UTILS_H
#define ICMP_UTILS_H
#include <stdint.h>
#include <stddef.h>
#include <time.h>
/* Checksum calculation (RFC 1071) */
uint16_t icmp_checksum(const void *data, size_t len);
/* Time helpers - return 0 on success, -1 on error */
int icmp_get_time(struct timespec *ts);
int64_t icmp_time_diff_ns(const struct timespec *start,
const struct timespec *end);
#endif