From 36b3e7f310c624b7b4e31829090dd02131c528d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Tue, 21 May 2019 19:16:22 +0300 Subject: Protocol: implementation of device-side protocol. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parts of protocol specific for device are implementepd to reflect the fact that the device is a client. This effectively means that device gets a single connection only and severe memory restrictions about which the daemon might get informed about in the future. Signed-off-by: Ramūnas Mažeikis --- include/net.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/net.h') diff --git a/include/net.h b/include/net.h index 34f557a..6860455 100644 --- a/include/net.h +++ b/include/net.h @@ -33,9 +33,21 @@ enum response { TMPFILE, }; - +/** + * Initialises connection with daemon and returns a 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. + * Function mallocates a buffer for data received from packet. Don't forget to + * free the buffer. + */ int net_getlastdata(int nd, char * const data); #endif /* NET_H_INCLUDED */ -- cgit v1.2.3 From b25865cc827f4a6a9c31f3d92a4e443485fd5d93 Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Sun, 26 May 2019 14:46:36 +0300 Subject: common: cosmetic changes. Signed-off-by: Gediminas Jakutis --- include/net.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/net.h') diff --git a/include/net.h b/include/net.h index 6860455..59071a5 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 dgsize 512 @@ -50,4 +50,4 @@ int net_close(int nd); */ int net_getlastdata(int nd, char * const data); -#endif /* NET_H_INCLUDED */ +#endif /* USURPATION_NET_H_INCLUDED */ -- cgit v1.2.3