- 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.
16 lines
408 B
C
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
|