summaryrefslogtreecommitdiff
path: root/icmp_server.h
blob: f1f4e9f96b218e7780b0e16c1d87cf41fb19cced (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#pragma once

#include "icmp.h"


// Returns -1 on error with errno.
int icmp_server_open_socket(void);

// Returns {.data=NULL} on error with errno.
// Receives only ECHO.
struct icmp_incoming icmp_server_receive(int sock);

// Returns -1 on error with errno.
int icmp_server_send_reply(
		int sock, uint32_t addr,
		int id, int seqnum,
		const void *data, size_t length);