session manager support tcp reassembly
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user