diff options
author | 2019-06-07 17:13:13 +0300 | |
---|---|---|
committer | 2019-06-07 17:13:13 +0300 | |
commit | 30513e7a89cc2f9283458100dea298770c7d18de (patch) | |
tree | 244ce464f2f8a363418c4e9f256f7958f771a979 /include/net.h | |
parent | 75c92f6776a69c1dddee3ee63af5d59e89184828 (diff) | |
download | usurpation-30513e7a89cc2f9283458100dea298770c7d18de.tar.gz usurpation-30513e7a89cc2f9283458100dea298770c7d18de.tar.bz2 usurpation-30513e7a89cc2f9283458100dea298770c7d18de.zip |
refactor server/client discovery to use TLVs.
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'include/net.h')
-rw-r--r-- | include/net.h | 17 |
1 files changed, 3 insertions, 14 deletions
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 <sys/socket.h> #include <netinet/in.h> -#endif #include <stddef.h> -#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 */ |