#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);