add sockets to gui

This commit is contained in:
Evgeny committed 2026-04-14 21:50:32 +03:00
1 parent cd63f5a1b3
commit ad35bbab15
3 files changed
+24 -1

No files matched your search

+1
View File
@@ -476,6 +476,7 @@ static void handle_response(struct etcpmon_client* client, uint8_t msg_type,
struct etcpmon_rsp_socket_list* rsp = (struct etcpmon_rsp_socket_list*)payload;
uint8_t count = rsp->count;
if (count > 16) count = 16; /* Limit to prevent buffer overflow */
if (payload_size < sizeof(*rsp) + count * sizeof(struct etcpmon_socket_info)) break;
if (client->socket_list) {
+4 -1
View File
@@ -955,11 +955,14 @@ static const char* nat_type_to_string(uint8_t nat_type) {
void etcpmon_gui_update_socket_list(struct etcpmon_app* app,
struct etcpmon_socket_info* list,
uint8_t count) {
if (!app || !app->hListSockets) return;
if (!app || !app->hListSockets || !list || count == 0 || count > 32) return;
SendMessage(app->hListSockets, LB_RESETCONTENT, 0, 0);
for (uint8_t i = 0; i < count; i++) {
if (!list[i].ip || list[i].ip[0] == '\0') continue;
if (!list[i].name || list[i].name[0] == '\0') continue;
char display[128];
const char* nat_str = nat_type_to_string(list[i].nat_type);
if (list[i].is_ipv6) {