From 30513e7a89cc2f9283458100dea298770c7d18de Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Fri, 7 Jun 2019 17:13:13 +0300 Subject: refactor server/client discovery to use TLVs. Signed-off-by: Gediminas Jakutis --- include/net.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'include/net.h') diff --git a/include/net.h b/include/net.h index 8385943..3fbaf5c 100644 --- a/include/net.h +++ b/include/net.h @@ -22,22 +22,11 @@ #ifndef USURPATION_NET_H_INCLUDED #define USURPATION_NET_H_INCLUDED -#ifdef unix #include #include -#endif #include -#define MTU 1500 - -enum response { - ERROR = -1, - A_OK = 0, /* would be "OK", but clashes with some lib definitions */ - NONEWDATA, - DEAD, -}; - /** * Initialises a listening socket and returns the associated network descriptor. */ @@ -52,12 +41,12 @@ int net_close(int nd); * Get last data received from connection associated with network descriptor. * If the pointer pointed by data is NULL, a buffer is allocated by the function * and needs to be free()'d later. Otherwise, the supplied buffer is reused. + * Returns the amount of data acually fetched through recvsize pointer. */ -int net_getlastdata(int nd, char ** const data); +int net_getlastdata(int nd, char ** const data, size_t *recvsize); int net_send(int nd, const char * const buf, size_t buf_size); -#ifdef unix int net_send_addr(int nd, const char * const buf, size_t buf_size, const struct sockaddr_in * const addr); -#endif +void net_flush_read_buffer(int nd); #endif /* USURPATION_NET_H_INCLUDED */ -- cgit v1.2.3