summaryrefslogtreecommitdiffstats
path: root/include/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net.h')
-rw-r--r--include/net.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/net.h b/include/net.h
index ce8c8e2..e4ca0a6 100644
--- a/include/net.h
+++ b/include/net.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#ifndef NET_H_INCLUDED
-#define NET_H_INCLUDED
+#ifndef USURPATION_NET_H_INCLUDED
+#define USURPATION_NET_H_INCLUDED
#define MTU 1500
@@ -33,9 +33,21 @@ enum response {
TMPFILE,
};
-
+/**
+ * Initialises a listening socket and returns the associated network descriptor.
+ */
int net_init(const unsigned short int port);
+
+/**
+ * Closes connection associated with network descriptor.
+ */
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.
+ */
int net_getlastdata(int nd, char ** const data);
-#endif /* NET_H_INCLUDED */
+#endif /* USURPATION_NET_H_INCLUDED */