diff options
author | 2019-05-20 21:50:19 +0300 | |
---|---|---|
committer | 2019-05-20 21:50:19 +0300 | |
commit | bb70fccb66f55e9cc2b9ed0bf366479828f41346 (patch) | |
tree | d87cd7b469a912c1a4be293add4b1e765842e4f6 /src/common/protocol_private.h | |
parent | 031caaf9b7745bfc552cc86fb475de1f18d0fd6d (diff) | |
download | usurpation-bb70fccb66f55e9cc2b9ed0bf366479828f41346.tar.gz usurpation-bb70fccb66f55e9cc2b9ed0bf366479828f41346.tar.bz2 usurpation-bb70fccb66f55e9cc2b9ed0bf366479828f41346.zip |
Protocol: implemented request and reply pushing to packet.
First implementation of complete protocol interface. While the
first implementation does compile, the interface might change
due to demands from other parts of the project.
For now reqest is a tlv that is an unsigned int which represents
what message to repeat from daemon.
A reply is also a tlv made of two parts --- message sequence
number of type msg_ixd_t and the actual null terminated string.
All of the above is subject to change.
More docs. Doxygen is on the way.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
Diffstat (limited to 'src/common/protocol_private.h')
-rw-r--r-- | src/common/protocol_private.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/common/protocol_private.h b/src/common/protocol_private.h index 0c0b7f9..b74c0eb 100644 --- a/src/common/protocol_private.h +++ b/src/common/protocol_private.h @@ -75,23 +75,39 @@ size_t get_tlvs( const struct packet_data * const data, * */ int push_string(char *str); -/* Reinterprets char * as fpi1_t * and appends it to the outgoing packet as a +/** Reinterprets char * as fpi1_t * and appends it to the outgoing packet as a * tlv. */ int push_fpi1(char *num); -/* Reinterprets char * as time_t * and appends it to the outgoing packet as a +/** Reinterprets char * as time_t * and appends it to the outgoing packet as a * tlv. */ int push_timestamp(char *data); -/* Not implemented yet. */ +/** + * Pushes a request for daemon to repeat a message identified by a msg_index_t. + * + * @param data Pointer to a msg_index_t. + * + * @return 0 on success or E_PACKET_OVERFLOW, if not enough space is available + * to push all the data. + */ int push_request(char *data); -/* Not implemented yet. */ +/** + * Pushes a message to the outgoing packet buffer as a reply. A reply is just + * a null terminated string. + * + * @param data msg_idx_t representing sequence number since beggining of + * connection and a null-terminated string. + * + * @return On success --- 0 or E_PACKET_OVERFLOW, if not enough buffer is + * available. + */ int push_reply(char *data); -/* Reinterprets char * as uuid_t * and appends it to the outgoing packet as a +/** Reinterprets char * as uuid_t * and appends it to the outgoing packet as a * tlv. */ int push_uuid(char *data); |