diff options
Diffstat (limited to 'include/net.h')
-rw-r--r-- | include/net.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/include/net.h b/include/net.h index 34f557a..e4ca0a6 100644 --- a/include/net.h +++ b/include/net.h @@ -19,10 +19,10 @@ * 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 dgsize 512 +#define MTU 1500 enum response { ERROR = -1, @@ -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); -int net_getlastdata(int nd, char * const data); -#endif /* NET_H_INCLUDED */ +/** + * 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 /* USURPATION_NET_H_INCLUDED */ |