session manager support tcp reassembly

This commit is contained in:
luwenpeng
2024-03-26 15:09:03 +08:00
parent 5b92d6d8de
commit eb281ab789
30 changed files with 1917 additions and 88 deletions

View File

@@ -56,7 +56,20 @@ struct session_manager_options *sess_mgr_opts = &stellar_context.config.sess_mgr
static const char *log_config_file = "./conf/log.toml";
static const char *stellar_config_file = "./conf/stellar.toml";
// TODO
static void hex_dump(const char *payload, uint32_t len)
{
printf("Payload Length: %d\n", len);
for (uint32_t i = 0; i < len; i++)
{
if (i > 0 && i % 16 == 0)
{
printf("\n");
}
printf("%02x ", (uint8_t)payload[i]);
}
printf("\n");
}
void *plugin_manager_new_ctx()
{
return NULL;
@@ -74,8 +87,22 @@ void plugin_manager_dispatch(void *plugin_mgr, struct session *sess, const struc
return;
}
uint32_t len = 0;
const char *payload = NULL;
printf("=> plugin dispatch session: %p\n", sess);
session_dump(sess);
if (session_get_type(sess) == SESSION_TYPE_TCP)
{
payload = session_peek_tcp_payload(sess, &len);
if (payload && len > 0)
{
hex_dump(payload, len);
}
session_consume_tcp_payload(sess, len);
}
printf("<= plugin dispatch session\n");
}