summaryrefslogtreecommitdiffstats
path: root/include/net.h
diff options
context:
space:
mode:
authorGravatar Gediminas Jakutis <gediminas@varciai.lt> 2019-05-26 14:55:36 +0300
committerGravatar Gediminas Jakutis <gediminas@varciai.lt> 2019-05-26 14:55:36 +0300
commit03d020c10113db431efeb6ae0d3380b2553387ac (patch)
tree6dc073fa8ecdb015b0cd3a7ab92b9b66001bdd89 /include/net.h
parentcce1aad04a2ce4ea0447ec8f3f4c41a8936d4a1a (diff)
parentb25865cc827f4a6a9c31f3d92a4e443485fd5d93 (diff)
downloadusurpation-03d020c10113db431efeb6ae0d3380b2553387ac.tar.gz
usurpation-03d020c10113db431efeb6ae0d3380b2553387ac.tar.bz2
usurpation-03d020c10113db431efeb6ae0d3380b2553387ac.zip
Merge branch '31-Net-Protocol-Handling'
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
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 */