aboutsummaryrefslogtreecommitdiff
path: root/lib/pbdrv/pb-read.c
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-13 17:46:26 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-13 17:46:26 +0200
commit557b995f9641f7cb7a0566eefac7e576debec61a (patch)
tree1b2b0966f6b1671e5accfe0d980ee1f370d21b58 /lib/pbdrv/pb-read.c
parentda57aaed1295d72d8d840c69c0e08c0bcab46aee (diff)
really WIP driver (de)serialization
Diffstat (limited to 'lib/pbdrv/pb-read.c')
-rw-r--r--lib/pbdrv/pb-read.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/pbdrv/pb-read.c b/lib/pbdrv/pb-read.c
index 843420d..ce8b5b1 100644
--- a/lib/pbdrv/pb-read.c
+++ b/lib/pbdrv/pb-read.c
@@ -1,3 +1,39 @@
+#include <mpack.h>
+
#include "pb-read.h"
+// pb_msg_header_t * pbdrv_read_msg_header(mpack_reader_t * reader, pb_msg_header_t * header) {
+// header->type = mpack_expect_u8(reader);
+// header->sender = mpack_expect_u16(reader);
+//
+// return header;
+// }
+//
+// pb_cmd_req_read_t * pbdrv_read_cmd_req_read(mpack_reader_t * reader, pb_cmd_req_read_t * msg) {
+// msg->propid = mpack_expect_u8(reader);
+//
+// return msg;
+// }
+//
+// void * pbdrv_read_unknown(const char * data, size_t size) {
+// mpack_reader_t reader;
+// mpack_reader_init_data(&reader, data, size);
+//
+// void * msg = NULL;
+//
+// pb_msg_header_t header;
+// pbdrv_read_msg_header(&reader, &header);
+// switch (header.type) {
+// case PB_CMD_REQ_READ: {
+// // pb_cmd_req_read_t msg;
+// msg = malloc(sizeof(pb_cmd_req_read_t));
+// pbdrv_read_cmd_req_read(&reader, msg);
+// break;
+// }
+// default: return NULL;
+// }
+//
+// if (mpack_reader_error(&reader) != mpack_ok) return NULL;
+// return NULL;
+// }