diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net.h | 14 | ||||
-rw-r--r-- | include/protocol.h | 6 |
2 files changed, 17 insertions, 3 deletions
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 */ diff --git a/include/protocol.h b/include/protocol.h index 60d31ea..c5e657b 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -106,12 +106,12 @@ struct tlv { * Reads last packets received, parses and stores them to be later retreived * via get_tlv. * */ -void get_last_data(cd_t connection); +int get_last_data(cd_t connection); /** Returns tlv's parsed by get_last_data. Returned tlv is only valid until * next call to get_tlv. * */ -struct tlv * get_tlv(void); +struct tlv * get_tlv(cd_t cd); /** * Any modifications made to the pending outgoing packet are nullified. @@ -129,4 +129,6 @@ int push_data(cd_t connection, const char *data, enum tlv_type); * */ void flush_data(cd_t connection); +cd_t protocol_init(void); + #endif /* PROTOCOL_H_INCLUDED */ |