rename xxx_tostring() -> xxx_to_str()

This commit is contained in:
luwenpeng
2024-03-08 13:43:03 +08:00
parent 31c9303a93
commit d7370e0e19
15 changed files with 188 additions and 188 deletions

View File

@@ -392,7 +392,7 @@ void session_run_expirecb(struct session *sess)
* session dump
******************************************************************************/
static void tcp_state_tostring(enum tcp_state state, char *buffer, size_t buffer_len)
static void tcp_state_to_str(enum tcp_state state, char *buffer, size_t buffer_len)
{
if (state == 0)
{
@@ -451,7 +451,7 @@ static void tcp_state_tostring(enum tcp_state state, char *buffer, size_t buffer
}
}
static void udp_state_tostring(enum udp_state state, char *buffer, size_t buffer_len)
static void udp_state_to_str(enum udp_state state, char *buffer, size_t buffer_len)
{
if (state == 0)
{
@@ -470,7 +470,7 @@ static void udp_state_tostring(enum udp_state state, char *buffer, size_t buffer
}
}
const char *session_closing_reason_tostring(enum closing_reason reason)
const char *session_closing_reason_to_str(enum closing_reason reason)
{
switch (reason)
{
@@ -491,7 +491,7 @@ const char *session_closing_reason_tostring(enum closing_reason reason)
}
}
const char *session_state_tostring(enum session_state state)
const char *session_state_to_str(enum session_state state)
{
switch (state)
{
@@ -508,7 +508,7 @@ const char *session_state_tostring(enum session_state state)
}
}
const char *session_type_tostring(enum session_type type)
const char *session_type_to_str(enum session_type type)
{
switch (type)
{
@@ -521,7 +521,7 @@ const char *session_type_tostring(enum session_type type)
}
}
const char *session_dir_tostring(enum session_dir dir)
const char *session_dir_to_str(enum session_dir dir)
{
switch (dir)
{
@@ -534,7 +534,7 @@ const char *session_dir_tostring(enum session_dir dir)
}
}
const char *dup_traffic_flag_tostring(enum dup_traffic_flag flag)
const char *dup_traffic_flag_to_str(enum dup_traffic_flag flag)
{
switch (flag)
{
@@ -550,15 +550,15 @@ const char *dup_traffic_flag_tostring(enum dup_traffic_flag flag)
void session_dump(struct session *sess)
{
char buffer[1024] = {0};
tuple6_tostring(session_get0_key(sess), buffer, sizeof(buffer));
tuple6_to_str(session_get0_key(sess), buffer, sizeof(buffer));
printf("session id : %" PRIu64 "\n", session_get_id(sess));
printf("session key : %s\n", buffer);
printf("session key dir : %s\n", session_dir_tostring(session_get_key_dir(sess)));
printf("session state : %s\n", session_state_tostring(session_get_state(sess)));
printf("session type : %s\n", session_type_tostring(session_get_type(sess)));
printf("session dup traffic flag : %s\n", dup_traffic_flag_tostring(session_get_dup_traffic_flag(sess)));
printf("session closing reason : %s\n", session_closing_reason_tostring(session_get_closing_reason(sess)));
printf("session key dir : %s\n", session_dir_to_str(session_get_key_dir(sess)));
printf("session state : %s\n", session_state_to_str(session_get_state(sess)));
printf("session type : %s\n", session_type_to_str(session_get_type(sess)));
printf("session dup traffic flag : %s\n", dup_traffic_flag_to_str(session_get_dup_traffic_flag(sess)));
printf("session closing reason : %s\n", session_closing_reason_to_str(session_get_closing_reason(sess)));
printf("session c2s packets : %" PRIu64 "\n", session_get_c2s_packets(sess));
printf("session c2s bytes : %" PRIu64 "\n", session_get_c2s_bytes(sess));
printf("session s2c packets : %" PRIu64 "\n", session_get_s2c_packets(sess));
@@ -568,17 +568,17 @@ void session_dump(struct session *sess)
if (session_get_type(sess) == SESSION_TYPE_TCP)
{
memset(buffer, 0, sizeof(buffer));
tcp_state_tostring(session_get_tcp_state(sess), buffer, sizeof(buffer));
tcp_state_to_str(session_get_tcp_state(sess), buffer, sizeof(buffer));
printf("session tcp state : %s\n", buffer);
}
else if (session_get_type(sess) == SESSION_TYPE_UDP)
{
memset(buffer, 0, sizeof(buffer));
udp_state_tostring(session_get_udp_state(sess), buffer, sizeof(buffer));
udp_state_to_str(session_get_udp_state(sess), buffer, sizeof(buffer));
printf("session udp state : %s\n", buffer);
}
printf("session current packet ptr : %p\n", (void *)session_get0_cur_pkt(sess));
printf("session current packet dir : %s\n", session_dir_tostring(session_get_cur_dir(sess)));
printf("session current packet dir : %s\n", session_dir_to_str(session_get_cur_dir(sess)));
printf("session ex data: \n");
for (uint8_t i = 0; i < g_ex_manager.count; i++)
{