diff options
author | 2019-05-21 17:41:21 +0300 | |
---|---|---|
committer | 2019-05-21 17:41:21 +0300 | |
commit | cabb90c1240015ee5cd17d91573588527bcc2482 (patch) | |
tree | 0e3b07fa887ca25a12e32f5c126407d149483a21 /src/common/protocol_private.h | |
parent | bb70fccb66f55e9cc2b9ed0bf366479828f41346 (diff) | |
download | usurpation-cabb90c1240015ee5cd17d91573588527bcc2482.tar.gz usurpation-cabb90c1240015ee5cd17d91573588527bcc2482.tar.bz2 usurpation-cabb90c1240015ee5cd17d91573588527bcc2482.zip |
Protocol: changes to interface and some re-implementation.
Most functions exposed in protocol.h take a connection descriptor
(cd_t) as first argument. This allows for multiple connections. Device
gets only one connection which means that cd_t is effectively 0 all
the time.
Additionaly, any function that actually does anything with a
connection descriptor instead of just passing it to another function
must be implemented separately in device and daemon.
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 | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/common/protocol_private.h b/src/common/protocol_private.h index b74c0eb..eecbc15 100644 --- a/src/common/protocol_private.h +++ b/src/common/protocol_private.h @@ -37,7 +37,8 @@ * */ #define PACKET_MAX_SIZE (512) -/** Returns the amount of tlv's int a packet. +/** + * Returns the amount of tlv's int a packet. * * If a tlv reports length that goes beyond the end of a packet, errno is set * to TLV_OVERFLOW. To check this, set errno to 0 first. @@ -73,17 +74,17 @@ size_t get_tlvs( const struct packet_data * const data, * @return Returns 0 on success. Otherwise: E_PACKET_OVERFLOW. * * */ -int push_string(char *str); +int push_string(cd_t connection, char *str); /** Reinterprets char * as fpi1_t * and appends it to the outgoing packet as a * tlv. */ -int push_fpi1(char *num); +int push_fpi1(cd_t connection, char *num); /** Reinterprets char * as time_t * and appends it to the outgoing packet as a * tlv. */ -int push_timestamp(char *data); +int push_timestamp(cd_t connection, char *data); /** * Pushes a request for daemon to repeat a message identified by a msg_index_t. @@ -93,7 +94,7 @@ int push_timestamp(char *data); * @return 0 on success or E_PACKET_OVERFLOW, if not enough space is available * to push all the data. */ -int push_request(char *data); +int push_request(cd_t connection, char *data); /** * Pushes a message to the outgoing packet buffer as a reply. A reply is just @@ -105,16 +106,16 @@ int push_request(char *data); * @return On success --- 0 or E_PACKET_OVERFLOW, if not enough buffer is * available. */ -int push_reply(char *data); +int push_reply(cd_t connection, char *data); /** Reinterprets char * as uuid_t * and appends it to the outgoing packet as a * tlv. */ -int push_uuid(char *data); +int push_uuid(cd_t connection, char *data); /* Appends tlv_type and size of data to a packet effectively creating a tlv * header. */ -int push_tlv_header(enum tlv_type type, size_t size); +int push_tlv_header(cd_t connection, enum tlv_type type, size_t size); #endif /* PROTOCOL_H_PRIVATE */ |