summaryrefslogtreecommitdiffstats
path: root/include/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net.h')
-rw-r--r--include/net.h17
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 */