diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2018-08-01 23:12:41 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2018-08-01 23:12:41 +0200 |
commit | a239f9feadd015fa91d391df01365dcade8ce503 (patch) | |
tree | 979554817c2069a525e94e2ad5f6346b53e19eb5 /icmp_client.h | |
parent | 9f2fccfdc2eae83efbde1e3ae94a2cc220537983 (diff) |
Threaded communication (icmpd)
Diffstat (limited to 'icmp_client.h')
-rw-r--r-- | icmp_client.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/icmp_client.h b/icmp_client.h index 78cfe7a..3474f5d 100644 --- a/icmp_client.h +++ b/icmp_client.h @@ -3,21 +3,24 @@ #include "icmp.h" -struct icmp_client_incoming { - const uint8_t *data; // points to internal buffer - size_t length; // length of 'data' - - int id, seqnum; -}; - // 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_client_incoming icmp_client_communicate( - int sock, const char *ip_address, - int id, int seqnum, +struct icmp_incoming icmp_client_communicate( + int sock, uint32_t addr, + int seqnum, const void *data, size_t length); |