blob: 3474f5dc9b59f17f04997b4ae09d6ca1d33e2ea2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#pragma once
#include "icmp.h"
// Returns -1 on error with errno.
int icmp_client_open_socket(void);
// Returns {.data=NULL} on error with errno.
// Receives only ECHOREPLY.
struct icmp_incoming icmp_client_receive(int sock);
// Only actual IPv4 addresses allowed. Sends data in 'data' with length 'length'.
int icmp_client_send(
int sock, uint32_t addr,
int seqnum,
const void *data, size_t length);
// Only actual IPv4 addresses allowed. Sends data in 'data' with length 'length', and
// returns pointer to internal buffer with reply data. Buffer is invalidated on next
// call to the function.
// Returns {.data=NULL} on error with errno.
struct icmp_incoming icmp_client_communicate(
int sock, uint32_t addr,
int seqnum,
const void *data, size_t length);
|