46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_ping.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/04/26 19:54:25 by tomoron #+# #+# */
|
|
/* Updated: 2025/04/29 01:43:38 by tomoron ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "includes/ft_ping.h"
|
|
|
|
void send_icmp(t_settings set, char *host)
|
|
{
|
|
(void)set;
|
|
(void)host;
|
|
printf("would send to %s\n", host);
|
|
}
|
|
|
|
void ping_host(t_settings set, char *host)
|
|
{
|
|
int i;
|
|
|
|
i = 0;
|
|
while(i < set.count || set.count == -1)
|
|
{
|
|
send_icmp(set, host);
|
|
usleep(set.interval * 1000 * 1000);
|
|
i++;
|
|
}
|
|
}
|
|
|
|
void send_pings(t_settings set)
|
|
{
|
|
t_host_list *cur;
|
|
|
|
cur = set.hosts;
|
|
while(cur)
|
|
{
|
|
ping_host(set, cur->host);
|
|
cur = cur->next;
|
|
}
|
|
}
|