You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
3.5 KiB
139 lines
3.5 KiB
/* |
|
* etcpmon_gui.h - ETCP Monitor GUI Header |
|
*/ |
|
|
|
#ifndef ETCPMON_GUI_H |
|
#define ETCPMON_GUI_H |
|
|
|
/* Exclude winsock from windows.h to avoid conflict with winsock2.h */ |
|
#ifndef WIN32_LEAN_AND_MEAN |
|
#define WIN32_LEAN_AND_MEAN |
|
#endif |
|
|
|
/* Windows headers */ |
|
#include <windows.h> |
|
#include <stdint.h> |
|
|
|
/* Client structure is defined in etcpmon_client.h */ |
|
struct etcpmon_client; |
|
struct etcpmon_conn_info; |
|
struct etcpmon_rsp_metrics; |
|
struct etcpmon_link_metrics; |
|
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
/* Window class name */ |
|
#define ETCPMON_WINDOW_CLASS "ETCPMonMainWindow" |
|
|
|
/* Control IDs */ |
|
#define IDC_STATIC -1 |
|
#define IDC_EDIT_ADDR 100 |
|
#define IDC_EDIT_PORT 101 |
|
#define IDC_BTN_CONNECT 102 |
|
#define IDC_BTN_DISCONNECT 103 |
|
#define IDC_LIST_CONNECTIONS 104 |
|
#define IDC_TIMER_UPDATE 105 |
|
|
|
/* ETCP Metrics control IDs */ |
|
#define IDC_EDIT_ETCP_NAME 200 |
|
#define IDC_EDIT_ETCP_RTT_LAST 201 |
|
#define IDC_EDIT_ETCP_RTT_AVG10 202 |
|
#define IDC_EDIT_ETCP_RTT_AVG100 203 |
|
#define IDC_EDIT_ETCP_JITTER 204 |
|
#define IDC_EDIT_ETCP_BYTES_SENT 205 |
|
#define IDC_EDIT_ETCP_RETRANS 206 |
|
#define IDC_EDIT_ETCP_ACKS 207 |
|
#define IDC_EDIT_ETCP_INFLIGHT 208 |
|
#define IDC_EDIT_ETCP_LINKS 209 |
|
|
|
/* TUN Metrics control IDs */ |
|
#define IDC_EDIT_TUN_READ_BYTES 300 |
|
#define IDC_EDIT_TUN_WRITE_BYTES 301 |
|
#define IDC_EDIT_TUN_READ_PKTS 302 |
|
#define IDC_EDIT_TUN_WRITE_PKTS 303 |
|
#define IDC_EDIT_TUN_READ_ERRS 304 |
|
#define IDC_EDIT_TUN_WRITE_ERRS 305 |
|
|
|
/* Link list control ID */ |
|
#define IDC_LIST_LINKS 400 |
|
|
|
/* Main application structure */ |
|
struct etcpmon_app { |
|
HINSTANCE hInstance; |
|
HWND hWndMain; |
|
HWND hWndStatus; |
|
|
|
/* Connection controls */ |
|
HWND hEditAddr; |
|
HWND hEditPort; |
|
HWND hBtnConnect; |
|
HWND hBtnDisconnect; |
|
HWND hListConnections; |
|
|
|
/* ETCP metrics controls */ |
|
HWND hEditEtcpName; |
|
HWND hEditEtcpRttLast; |
|
HWND hEditEtcpRttAvg10; |
|
HWND hEditEtcpRttAvg100; |
|
HWND hEditEtcpJitter; |
|
HWND hEditEtcpBytesSent; |
|
HWND hEditEtcpRetrans; |
|
HWND hEditEtcpAcks; |
|
HWND hEditEtcpInflight; |
|
HWND hEditEtcpLinks; |
|
|
|
/* TUN metrics controls */ |
|
HWND hEditTunReadBytes; |
|
HWND hEditTunWriteBytes; |
|
HWND hEditTunReadPkts; |
|
HWND hEditTunWritePkts; |
|
HWND hEditTunReadErrs; |
|
HWND hEditTunWriteErrs; |
|
|
|
/* Links list */ |
|
HWND hListLinks; |
|
|
|
/* Client state - pointer to actual client structure */ |
|
struct etcpmon_client* client; |
|
|
|
/* Timer ID */ |
|
UINT_PTR updateTimer; |
|
int isConnected; |
|
}; |
|
|
|
/* Initialize application */ |
|
int etcpmon_gui_init(struct etcpmon_app* app, HINSTANCE hInstance); |
|
|
|
/* Create main window */ |
|
HWND etcpmon_gui_create_window(struct etcpmon_app* app); |
|
|
|
/* Run message loop */ |
|
int etcpmon_gui_run(struct etcpmon_app* app); |
|
|
|
/* Cleanup */ |
|
void etcpmon_gui_cleanup(struct etcpmon_app* app); |
|
|
|
/* Update connection status display */ |
|
void etcpmon_gui_set_status(struct etcpmon_app* app, const char* text); |
|
|
|
/* Update connection list */ |
|
void etcpmon_gui_update_conn_list(struct etcpmon_app* app, |
|
struct etcpmon_conn_info* list, |
|
uint8_t count); |
|
|
|
/* Update metrics display */ |
|
void etcpmon_gui_update_metrics(struct etcpmon_app* app, |
|
struct etcpmon_rsp_metrics* metrics, |
|
struct etcpmon_link_metrics* links, |
|
uint8_t links_count); |
|
|
|
/* Clear metrics display */ |
|
void etcpmon_gui_clear_metrics(struct etcpmon_app* app); |
|
|
|
#ifdef __cplusplus |
|
} |
|
#endif |
|
|
|
#endif /* ETCPMON_GUI_H */
|
|
|