From 9c8ece1538d31dba9a416c9f29f88e18510f4c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Sat, 18 May 2019 16:32:20 +0300 Subject: Whole-project: partial implementation of protocol. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit is part of ticket #31. Branch is not in a compiling state. Work is being done on utility functions and protocol implementation. To be completed later. Signed-off-by: Ramūnas Mažeikis --- include/utils.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 include/utils.h (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h new file mode 100644 index 0000000..ca2d2ee --- /dev/null +++ b/include/utils.h @@ -0,0 +1,11 @@ +#ifdef PROJECT_UTILS_H +#define PROJECT_UTILS_H + +typedef int fpi1_t; + +fpi1_t add(fpi1_t a, fpi1_t b); +fpi1_t sub(fpi1_t a, fpi1_t b); +fpi1_t mul(fpi1_t a, fpi1_t b); +fpi1_t div(fpi1_t a, fpi1_t b); + +#endif /* PROJECT_UTILS_H */ -- cgit v1.2.3 From b4165ee0b257aaa9064c5ac82200ff2569a02955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Sun, 19 May 2019 13:52:43 +0300 Subject: Protocol: more work on protocol implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Additional functions implemented for protocol and basic functions to work with uuid. Source is buildable but actual build files are not edited to accomodate the changes. Signed-off-by: Ramūnas Mažeikis --- include/utils.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h index ca2d2ee..daea864 100644 --- a/include/utils.h +++ b/include/utils.h @@ -1,6 +1,19 @@ -#ifdef PROJECT_UTILS_H +#ifndef PROJECT_UTILS_H #define PROJECT_UTILS_H +#include + +typedef struct uuid_s { + uint64_t low; + uint64_t hi; +} uuid_t; + +int cmp_uuid(uuid_t *first, uuid_t *second); + +/* Prints uuid in cannonical format. + */ +void uuid_to_str(uuid_t *to_print, char *buf); + typedef int fpi1_t; fpi1_t add(fpi1_t a, fpi1_t b); -- cgit v1.2.3 From 031caaf9b7745bfc552cc86fb475de1f18d0fd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Sun, 19 May 2019 17:50:53 +0300 Subject: Protocol: Implemented protocol error reporting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now public functions of the protocol can return an error code. More work is done on actual logic. Protocol code has bare-bones doxygen documentation. Signed-off-by: Ramūnas Mažeikis --- include/utils.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h index daea864..e4feb9a 100644 --- a/include/utils.h +++ b/include/utils.h @@ -4,16 +4,11 @@ #include typedef struct uuid_s { - uint64_t low; - uint64_t hi; + char bytes[16]; } uuid_t; int cmp_uuid(uuid_t *first, uuid_t *second); -/* Prints uuid in cannonical format. - */ -void uuid_to_str(uuid_t *to_print, char *buf); - typedef int fpi1_t; fpi1_t add(fpi1_t a, fpi1_t b); -- cgit v1.2.3 From bb70fccb66f55e9cc2b9ed0bf366479828f41346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Mon, 20 May 2019 21:50:19 +0300 Subject: Protocol: implemented request and reply pushing to packet. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/utils.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h index e4feb9a..f92e0fa 100644 --- a/include/utils.h +++ b/include/utils.h @@ -9,6 +9,9 @@ typedef struct uuid_s { int cmp_uuid(uuid_t *first, uuid_t *second); +/** + * Fixed point number with one decimal digit of precision. + */ typedef int fpi1_t; fpi1_t add(fpi1_t a, fpi1_t b); -- cgit v1.2.3 From cabb90c1240015ee5cd17d91573588527bcc2482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Tue, 21 May 2019 17:41:21 +0300 Subject: Protocol: changes to interface and some re-implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/utils.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h index f92e0fa..c769917 100644 --- a/include/utils.h +++ b/include/utils.h @@ -14,9 +14,9 @@ int cmp_uuid(uuid_t *first, uuid_t *second); */ typedef int fpi1_t; -fpi1_t add(fpi1_t a, fpi1_t b); -fpi1_t sub(fpi1_t a, fpi1_t b); -fpi1_t mul(fpi1_t a, fpi1_t b); -fpi1_t div(fpi1_t a, fpi1_t b); +fpi1_t fpi1_add(fpi1_t a, fpi1_t b); +fpi1_t fpi1_sub(fpi1_t a, fpi1_t b); +fpi1_t fpi1_mul(fpi1_t a, fpi1_t b); +fpi1_t fpi1_div(fpi1_t a, fpi1_t b); #endif /* PROJECT_UTILS_H */ -- 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/utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h index c769917..95b553d 100644 --- a/include/utils.h +++ b/include/utils.h @@ -1,5 +1,5 @@ -#ifndef PROJECT_UTILS_H -#define PROJECT_UTILS_H +#ifndef USURPATION_UTILS_H +#define USURPATION_UTILS_H #include @@ -19,4 +19,4 @@ fpi1_t fpi1_sub(fpi1_t a, fpi1_t b); fpi1_t fpi1_mul(fpi1_t a, fpi1_t b); fpi1_t fpi1_div(fpi1_t a, fpi1_t b); -#endif /* PROJECT_UTILS_H */ +#endif /* USURPATION_UTILS_H */ -- cgit v1.2.3