libicmp/src/recv/helpers/validate_params.c
2026-03-19 02:43:46 +01:00

25 lines
407 B
C

#include <stddef.h>
#include "internal/icmp_internal.h"
#include "internal/icmp_recv.h"
int
recv_validate_params(struct icmp_handle *h, icmp_callback_t cb)
{
if (NULL == h)
return 0;
if (NULL == cb)
{
icmp_set_error_fmt(h, ICMP_ERR_INVALID, "Callback cannot be NULL");
return 0;
}
if (h->fd < 0)
{
icmp_set_error_fmt(h, ICMP_ERR_INVALID, "Invalid socket FD");
return 0;
}
return 1;
}