-
Notifications
You must be signed in to change notification settings - Fork 1
/
WndExtra.h
145 lines (133 loc) · 4.65 KB
/
WndExtra.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*------------------------------------------------------------------------------
-- FILE: WndExtra.h
-- PROGRAM: Dean and the Rockets' Wireless Protocol Testing and Evaluation
-- DATE: Dec 03, 2010
-- DESIGNER: Dean Morin, Ian Lee, Daniel Wright, Marcel Vangrootheest
------------------------------------------------------------------------------*/
#ifndef WNDEXTRA_H
#define WNDEXTRA_H
#include <Windows.h>
#include "List.h"
/*--------------------------------Macros--------------------------------------*/
#define ASCII_DIGIT_OFFSET 48 // the ascii value for '0'
#define PADDING 10 // the distance between the edge of the
// client area, and any text
#define NO_OF_PORTS 9 // the number of ports available from the
// "Select Ports" dropdown
#define CHARS_PER_LINE 80 // characters per line
#define LINES_PER_SCRN 24 // lines per screen
#define TIMER 3003 // the id for timer
#define DISPLAY_ERROR(x) MessageBox(NULL, TEXT(x), TEXT(""), MB_OK)
#define X pwd->displayBuf.cxCursor
#define Y pwd->displayBuf.cyCursor
#define X_POS pwd->displayBuf.cxCursor * pwd->displayBuf.cxChar \
+ PADDING
#define Y_POS pwd->displayBuf.cyCursor * pwd->displayBuf.cyChar \
+ PADDING
#define CHAR_WIDTH pwd->displayBuf.cxChar
#define CHAR_HEIGHT pwd->displayBuf.cyChar
#define CHARACTER(x, y) pwd->displayBuf.rows[y]->columns[x]
#define SET_BUFFER(c, x, y) pwd->displayBuf.rows[y]->columns[x].character = c;
#define ROW(y) pwd->displayBuf.rows[y]
#define CUR_FG_COLOR pwd->displayBuf.fgColor
#define CUR_BG_COLOR pwd->displayBuf.bgColor
#define CUR_STYLE pwd->displayBuf.style
#define BRIGHTNESS pwd->displayBuf.brightness
#define ESC_VAL(x) pwd->dwEscSeqValues[x]
#define WINDOW_TOP pwd->cyWindowTop
#define WINDOW_BOTTOM pwd->cyWindowBottom
#define DL_STATE pwd->statsInfo.dlState
#define NUM_FILES pwd->statsInfo.numFiles
#define UP_FRAMES pwd->statsInfo.upFrames
#define DOWN_FRAMES pwd->statsInfo.downFrames
#define UP_FRAMES_ACKD pwd->statsInfo.upFramesACKd
#define DOWN_FRAMES_ACKD pwd->statsInfo.downFramesACKd
#define SENT_ACK pwd->statsInfo.sentACK
#define REC_ACK pwd->statsInfo.recACK
#define SENT_EOT pwd->statsInfo.sentEOT
#define REC_EOT pwd->statsInfo.recEOT
#define SENT_RVI pwd->statsInfo.sentRVI
#define REC_RVI pwd->statsInfo.recRVI
/*-------------------------------Structures-----------------------------------*/
typedef struct STATEINFO_tag {
INT rxSeq;
INT iState;
DWORD dwTimeout;
INT itoCount;
INT iFailedENQCount;
} STATEINFO, *PSTATEINFO;
typedef struct charInfo {
CHAR character;
BYTE fgColor;
BYTE bgColor;
BYTE style;
} CHARINFO;
typedef struct DTRInfo {
FLOAT dRate;
FLOAT uRate;
FLOAT edRate;
FLOAT euRate;
FLOAT odRate;
FLOAT ouRate;
FLOAT oedRate;
FLOAT oeuRate;
} DTRINFO;
typedef struct statsInfo {
INT dlState;
INT numFiles;
INT upFrames;
INT downFrames;
INT upFramesACKd;
INT downFramesACKd;
INT sentACK;
INT recACK;
INT sentEOT;
INT recEOT;
INT sentRVI;
INT recRVI;
} STATSINFO;
typedef struct line {
CHARINFO columns[CHARS_PER_LINE];
} LINE, *PLINE;
typedef struct displayBuf {
PLINE rows[LINES_PER_SCRN];
UINT cxChar;
UINT cyChar;
INT cxCursor;
INT cyCursor;
HFONT hFont;
BYTE fgColor;
BYTE bgColor;
BYTE style;
BYTE brightness;
} DISPLAYBUF;
typedef struct wndData {
HWND hDlgStats;
HWND hDlgDebug;
HANDLE hPort;
HANDLE hFileReceive;
HANDLE hFileTransmit;
LPTSTR lpszCommName;
BOOL bConnected;
HANDLE hThread;
DWORD dwThreadid;
INT cyWindowTop;
INT cyWindowBottom;
STATSINFO statsInfo;
DTRINFO dtrInfo;
INT FTPQueueSize;
INT PTFQueueSize;
PFRAME_NODE FTPBuffHead;
PFRAME_NODE PTFBuffHead;
PFRAME_NODE FTPBuffTail;
PFRAME_NODE PTFBuffTail;
INT NumOfReads;
BYTE TxSequenceNumber;
PBYTE_NODE pReadBufHead;
PBYTE_NODE pReadBufTail;
BOOL bDebug;
DISPLAYBUF displayBuf;
INT NumOfFrames;
BOOL wordWrap;
} WNDDATA, *PWNDDATA;
#endif