@ -746,14 +746,7 @@ static void CreateControls(struct etcpmon_app* app) {
" N \r \n O \r \n N \r \n E " , " E \r \n R \r \n R \r \n O \r \n R " , " W \r \n A \r \n R \r \n N " ,
" N \r \n O \r \n N \r \n E " , " E \r \n R \r \n R \r \n O \r \n R " , " W \r \n A \r \n R \r \n N " ,
" I \r \n N \r \n F \r \n O " , " D \r \n E \r \n B \r \n U \r \n G " , " T \r \n R \r \n A \r \n C \r \n E "
" I \r \n N \r \n F \r \n O " , " D \r \n E \r \n B \r \n U \r \n G " , " T \r \n R \r \n A \r \n C \r \n E "
} ;
} ;
static const char * cat_names [ ] = {
app - > debug_cat_count = 0 ;
" UASYNC " , " LL_QUEUE " , " CONNECTION " , " ETCP " , " CRYPTO " ,
" MEMORY " , " TIMING " , " CONFIG " , " TUN " , " ROUTING " ,
" TIMERS " , " NORMALIZER " , " BGP " , " SOCKET " , " CONTROL " ,
" DUMP " , " TRAFFIC " , " DEBUG_CAT " , " GENERAL " , " NAT " , " KEEPALIVE " , " ETCPROUTE " , " BBR "
} ;
int ncat = sizeof ( cat_names ) / sizeof ( cat_names [ 0 ] ) ;
app - > debug_cat_count = ncat ;
CreateWindowExA ( 0 , " STATIC " , " Global: " , WS_CHILD | WS_VISIBLE ,
CreateWindowExA ( 0 , " STATIC " , " Global: " , WS_CHILD | WS_VISIBLE ,
1015 , dy + 2 , 55 , 20 , hWnd , ( HMENU ) IDC_STATIC , hInst , NULL ) ;
1015 , dy + 2 , 55 , 20 , hWnd , ( HMENU ) IDC_STATIC , hInst , NULL ) ;
@ -772,21 +765,6 @@ static void CreateControls(struct etcpmon_app* app) {
WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER | ES_MULTILINE ,
WS_CHILD | WS_VISIBLE | ES_READONLY | ES_CENTER | ES_MULTILINE ,
lx , dy , 22 , 60 , hWnd , ( HMENU ) ( UINT_PTR ) ( IDC_DEBUG_HEADER_BASE + l ) , hInst , NULL ) ;
lx , dy , 22 , 60 , hWnd , ( HMENU ) ( UINT_PTR ) ( IDC_DEBUG_HEADER_BASE + l ) , hInst , NULL ) ;
}
}
dy + = 65 ;
for ( int r = 0 ; r < ncat ; r + + ) {
app - > hDebugCatLabel [ r ] = CreateWindowExA ( 0 , " STATIC " , cat_names [ r ] ,
WS_CHILD | WS_VISIBLE | SS_LEFT | SS_CENTERIMAGE ,
1015 , dy + 1 , 80 , 16 , hWnd , ( HMENU ) ( UINT_PTR ) ( IDC_DEBUG_NAME_BASE + r ) , hInst , NULL ) ;
for ( int l = 0 ; l < 6 ; l + + ) {
int lx = 1100 + l * 22 ;
DWORD style = WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON ;
if ( l = = 0 ) style | = WS_GROUP ;
app - > hDebugCatRadio [ r ] [ l ] = CreateWindowExA ( 0 , " BUTTON " , " " ,
style , lx , dy , 20 , 16 , hWnd , ( HMENU ) ( UINT_PTR ) ( IDC_DEBUG_ROW_BASE + r * 8 + l ) , hInst , NULL ) ;
}
dy + = 18 ;
}
}
}
}
}
@ -1150,10 +1128,50 @@ static void OnDebugRadio(struct etcpmon_app* app, int control_id) {
in_handler = 0 ;
in_handler = 0 ;
}
}
static void RecreateDebugCats ( struct etcpmon_app * app ) {
if ( ! app | | ! app - > client | | ! app - > hWndMain ) return ;
struct etcpmon_client * cl = app - > client ;
if ( cl - > debug_category_count = = 0 ) return ;
HINSTANCE hInst = app - > hInstance ;
HWND hWnd = app - > hWndMain ;
int ncat = cl - > debug_category_count ;
if ( ncat > IDC_DEBUG_MAX_CAT ) ncat = IDC_DEBUG_MAX_CAT ;
app - > debug_cat_count = ncat ;
int dy = 485 + 20 + 22 + 65 ; // GroupBox top + global row + header row + header height
const char * names = cl - > debug_category_names ;
const char * p = names ;
for ( int r = 0 ; r < ncat ; r + + ) {
const char * end = strchr ( p , ' , ' ) ;
size_t len = end ? ( size_t ) ( end - p ) : strlen ( p ) ;
char buf [ 64 ] ;
size_t copy = len < sizeof ( buf ) - 1 ? len : sizeof ( buf ) - 1 ;
memcpy ( buf , p , copy ) ; buf [ copy ] = ' \0 ' ;
app - > hDebugCatLabel [ r ] = CreateWindowExA ( 0 , " STATIC " , buf ,
WS_CHILD | WS_VISIBLE | SS_LEFT | SS_CENTERIMAGE ,
1015 , dy + 1 , 80 , 16 , hWnd , ( HMENU ) ( UINT_PTR ) ( IDC_DEBUG_NAME_BASE + r ) , hInst , NULL ) ;
for ( int l = 0 ; l < 6 ; l + + ) {
int lx = 1100 + l * 22 ;
DWORD style = WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON ;
if ( l = = 0 ) style | = WS_GROUP ;
app - > hDebugCatRadio [ r ] [ l ] = CreateWindowExA ( 0 , " BUTTON " , " " ,
style , lx , dy , 20 , 16 , hWnd , ( HMENU ) ( UINT_PTR ) ( IDC_DEBUG_ROW_BASE + r * 8 + l ) , hInst , NULL ) ;
}
dy + = 18 ;
p = end ? end + 1 : p + len ;
}
}
static void RefreshDebugUI ( struct etcpmon_app * app ) {
static void RefreshDebugUI ( struct etcpmon_app * app ) {
if ( ! app | | ! app - > client ) return ;
if ( ! app | | ! app - > client ) return ;
struct etcpmon_client * cl = app - > client ;
struct etcpmon_client * cl = app - > client ;
if ( app - > debug_cat_count = = 0 & & cl - > debug_category_count > 0 )
RecreateDebugCats ( app ) ;
for ( int l = 0 ; l < = 5 ; l + + ) {
for ( int l = 0 ; l < = 5 ; l + + ) {
if ( app - > hDebugGlobalRadio [ l ] )
if ( app - > hDebugGlobalRadio [ l ] )
SendMessage ( app - > hDebugGlobalRadio [ l ] , BM_SETCHECK ,
SendMessage ( app - > hDebugGlobalRadio [ l ] , BM_SETCHECK ,