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.
 
 
 
 
 
 

186 lines
5.0 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;
/* Graph constants */
#include "etcpmon_graph.h"
#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
/* Graph control IDs */
#define IDC_GRAPH 500
#define IDC_STATIC_GRAPH 501
#define IDC_LIST_CHANNELS 502
/* Channel block IDs - 8 channels, 4 columns x 2 rows */
#define IDC_CH_NAME_0 510
#define IDC_CH_VALUE_0 520
#define IDC_CH_CHECK_0 530
#define IDC_CH_NAME_1 511
#define IDC_CH_VALUE_1 521
#define IDC_CH_CHECK_1 531
#define IDC_CH_NAME_2 512
#define IDC_CH_VALUE_2 522
#define IDC_CH_CHECK_2 532
#define IDC_CH_NAME_3 513
#define IDC_CH_VALUE_3 523
#define IDC_CH_CHECK_3 533
#define IDC_CH_NAME_4 514
#define IDC_CH_VALUE_4 524
#define IDC_CH_CHECK_4 534
#define IDC_CH_NAME_5 515
#define IDC_CH_VALUE_5 525
#define IDC_CH_CHECK_5 535
#define IDC_CH_NAME_6 516
#define IDC_CH_VALUE_6 526
#define IDC_CH_CHECK_6 536
#define IDC_CH_NAME_7 517
#define IDC_CH_VALUE_7 527
#define IDC_CH_CHECK_7 537
/* 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;
/* Graph controls (managed by graph module) */
HWND hGraphWnd;
HWND hChannelName[GRAPH_METRICS_COUNT];
HWND hChannelValue[GRAPH_METRICS_COUNT];
HWND hChannelCheck[GRAPH_METRICS_COUNT];
int graph_cursor_x;
int graph_cursor_y;
int graph_cursor_active;
/* 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);
/* Update graph with new metrics */
void etcpmon_gui_update_graph(struct etcpmon_app* app,
struct etcpmon_rsp_metrics* metrics);
#ifdef __cplusplus
}
#endif
#endif /* ETCPMON_GUI_H */