diff options
author | 2019-05-21 19:28:23 +0300 | |
---|---|---|
committer | 2019-05-21 19:28:23 +0300 | |
commit | 5ca7e24e58f6bd657787b9235247149ffff420ae (patch) | |
tree | 86dc508026ce7fcc8431b52efe1315c3b983b469 /src/common/protocol.c | |
parent | 36b3e7f310c624b7b4e31829090dd02131c528d5 (diff) | |
download | usurpation-5ca7e24e58f6bd657787b9235247149ffff420ae.tar.gz usurpation-5ca7e24e58f6bd657787b9235247149ffff420ae.tar.bz2 usurpation-5ca7e24e58f6bd657787b9235247149ffff420ae.zip |
Protocol: common no longer has device-specific implementations.
Forgot to remove device-specific code from common protocol code.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
Diffstat (limited to 'src/common/protocol.c')
-rw-r--r-- | src/common/protocol.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/common/protocol.c b/src/common/protocol.c index 3d63771..dc0f532 100644 --- a/src/common/protocol.c +++ b/src/common/protocol.c @@ -33,47 +33,6 @@ #define READ_AS(from, type) (*(type*)(from)) -#define GET_MSG_CHAR(i) (msg_buf[(i) % MSG_BUF_SIZE]) -#define SET_MSG_CHAR(i, ch) msg_buf[(i) % MSG_BUF_SIZE] = (ch) - -/* Increment message cursor */ -#define IMC(x) ((msg_cursor + (x)) % MSG_BUF_SIZE) - -/* Begins at 2 because this way we'll have two null's at the beggining - * indicating that going back is not possible. - * */ -static int msg_cursor = 2; - -/** - * Message buffer. - * - * Two consecutive null's indicate that going back is not possible. - * */ -static char msg_buf[MSG_BUF_SIZE] = {0}; - -static int tlv_cursor = 0; -static struct tlv tlv_buf[TLV_BUF_SIZE] = {0}; - -static size_t packet_cursor = 0; -/* Outgoing packet. - * */ -static char packet_buf[PACKET_MAX_SIZE] = {0}; - -static int push_bytes(cd_t connection, const void * const data, const size_t size) -{ - if (packet_cursor + size >= PACKET_MAX_SIZE) { - return E_PACKET_OVERFLOW; - } - memcpy(packet_buf + packet_cursor, data, size); - packet_cursor += size; - return 0; -} - -void clear_data(cd_t connection) -{ - packet_cursor = 0; -} - int push_data(cd_t connection, const char *data, enum tlv_type type) { int ret = E_UNKNOWN_TYPE; |