summaryrefslogtreecommitdiffabout
path: root/KLogDlg.h
Unidiff
Diffstat (limited to 'KLogDlg.h') (more/less context) (ignore whitespace changes)
-rw-r--r--KLogDlg.h198
1 files changed, 198 insertions, 0 deletions
diff --git a/KLogDlg.h b/KLogDlg.h
new file mode 100644
index 0000000..f6fed53
--- a/dev/null
+++ b/KLogDlg.h
@@ -0,0 +1,198 @@
1// KLogDlg.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CKLogDlg dialog
6
7class CKLogDlg;
8class CKLogSocket : public CSyslogSocket {
9public:
10 CKLogDlg* m_Daddy;
11 virtual void Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin);
12};
13
14 class CHostMask: public CObject{
15public:
16 virtual void Serialize(CArchive& ar);
17 DWORDm_Host;
18 DWORDm_Mask;
19 BOOL IsThis(DWORD host){ return (host&m_Mask)==(m_Host&m_Mask); }
20 CHostMask(): m_Host(0), m_Mask(0) {}
21 CHostMask(DWORD host,DWORD mask) : m_Host(host), m_Mask(mask) {}
22 CString String();
23
24 DECLARE_SERIAL( CHostMask )
25};
26 class CLogEntry: public CObject {
27public:
28 CLogEntry(CLogEntry& src);
29 CLogEntry& operator=(CLogEntry& src);
30 CTime m_Time;
31 CString m_Source;
32 CString m_Data;
33 UINT m_Priority;
34 UINT m_Facility;
35 DECLARE_SERIAL( CLogEntry )
36public:
37 CLogEntry();
38};
39
40 typedefCTypedPtrList<CObList,CHostMask*> CAccessList;
41typedef CList<CLogEntry*,CLogEntry*> CLog;
42
43 class CLogger : public CObject{
44public:
45 void LookupHost(CKLogDlg *daddy);
46 void LogLine(CKLogDlg *dad,UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin);
47 BOOL IsHostFine(DWORD saddr);
48 virtual void Serialize(CArchive& ar);
49 virtual ~CLogger();
50 void PlayWave();
51 CLogger(BOOL bAll=FALSE);
52 CStringm_Desc;
53 enum{
54 logToFile=0, logToHost=1, logToNone=2,
55 };
56 int m_LogTo;
57 CStringm_LogToName;
58 SOCKADDR_IN m_LogToHost;
59 BOOL m_LogPattern[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities];
60 CAccessList m_Hosts;
61 CStringm_Sound;
62 CLog m_Log;
63 DECLARE_SERIAL( CLogger )
64};
65
66typedef CMap<CLogger*,CLogger*,CLogger*,CLogger*> CLoggers;
67
68class CTrayer;
69class CKLogDlg : public CDialog
70{
71// Construction
72public:
73 BOOL m_bDontWarn;
74 BOOL m_bWarnBlocking;
75 CSyslogSocket m_SLS;
76 virtual ~CKLogDlg();
77 void SaveSettings();
78 void LoadSettings();
79 BOOL m_bExiting;
80 BOOL m_bShown;
81 CTrayer* m_Trayer;
82 virtual BOOL PreTranslateMessage(MSG* pMsg);
83 void AddLogLine(CLogEntry *le);
84 void LogMessage(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin);
85 CKLogSocket m_KLS;
86 virtual void Serialize(CArchive& ar);
87 void TotalCleanUp();
88 BITMAP m_bitmapBack;
89 CBitmap m_bmpBack;
90 void UpdateLogLength(BOOL bSave=TRUE,BOOL update=FALSE);
91 int m_LogItems;
92 void UpdateLogto(BOOL bSave=TRUE,BOOL update=TRUE);
93 void UpdatePriface(BOOL bSave=TRUE,BOOL update=TRUE);
94 static UINT m_PriorityCtls[CSyslogSocket::totalPriorities];
95 CLogger* m_Logger;
96 void SetTab(CLogger* l);
97 int m_iTriggered;
98 int m_iNormal;
99 CImageList m_Images;
100 CLoggers m_Logs;
101 CKLogDlg(CWnd* pParent = NULL);// standard constructor
102
103 DECLARE_SERIAL( CKLogDlg )
104
105// Dialog Data
106 //{{AFX_DATA(CKLogDlg)
107 enum { IDD = IDD_KLOG_DIALOG };
108 CButtonm_LogPatternCtl;
109 CButtonm_FilesCtl;
110 CSpinButtonCtrlm_LogLenSpinCtl;
111 CStaticm_LogLengthCtl;
112 CButtonm_PriInvertCtl;
113 CButtonm_LogtoFileCtl;
114 CButtonm_LogtoHostCtl;
115 CButtonm_LogtoNoneCtl;
116 CStaticm_HFNameCaptionCtl;
117 CListBoxm_hlCtl;
118 CButtonm_BrowseSoundCtl;
119 CButtonm_PriNoneCtl;
120 CButtonm_hlRemoveCtl;
121 CEditm_hlMaskCtl;
122 CEditm_hlIPCtl;
123 CButtonm_hlAddCtl;
124 CButtonm_PriAllCtl;
125 CComboBoxm_SoundCtl;
126 CButtonm_RemoveCtl;
127 CButtonm_PlaySoundCtl;
128 CListBoxm_Log;
129 CEditm_HFNameCtl;
130 CComboBoxm_FacilityCtl;
131 CButtonm_BrowseCtl;
132 CEditm_DescCtl;
133 CTabCtrlm_Tabs;
134 int m_Logto;
135 CStringm_Desc;
136 CStringm_Facility;
137 CStringm_HFName;
138 CStringm_HFNameCaption;
139 CStringm_hlIP;
140 CStringm_hlMask;
141 CStringm_Sound;
142 //}}AFX_DATA
143
144 // ClassWizard generated virtual function overrides
145 //{{AFX_VIRTUAL(CKLogDlg)
146 protected:
147 virtual void DoDataExchange(CDataExchange* pDX);// DDX/DDV support
148 //}}AFX_VIRTUAL
149
150// Implementation
151protected:
152 CToolTipCtrl m_tooltip;
153 HICON m_hIcon;
154
155 // Generated message map functions
156 //{{AFX_MSG(CKLogDlg)
157 virtual BOOL OnInitDialog();
158 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
159 afx_msg void OnDestroy();
160 afx_msg void OnPaint();
161 afx_msg HCURSOR OnQueryDragIcon();
162 afx_msg void OnAdd();
163 afx_msg void OnSelchangeTabs(NMHDR* pNMHDR, LRESULT* pResult);
164 afx_msg void OnSelchangeFacility();
165 afx_msg void OnPriority();
166 afx_msg void OnLogto();
167 afx_msg void OnPriAll();
168 afx_msg void OnPriNone();
169 afx_msg void OnChangeDesc();
170 afx_msg void OnPriInvert();
171 afx_msg void OnHlAdd();
172 afx_msg void OnSelchangeHosts();
173 afx_msg void OnHlRemove();
174 afx_msg void OnRemove();
175 afx_msg void OnPlaysound();
176 afx_msg void OnEditchangeSound();
177 afx_msg void OnKillfocusSound();
178 afx_msg void OnDeltaposLoglenspin(NMHDR* pNMHDR, LRESULT* pResult);
179 afx_msg void OnExit();
180 afx_msg void OnFiles();
181 afx_msg void OnFilesExport();
182 afx_msg void OnFilesImport();
183 afx_msg void OnBrowsesound();
184 afx_msg void OnKillfocusHostfile();
185 virtual void OnOK();
186 afx_msg void OnBrowse();
187 afx_msg void OnFilesReset();
188 afx_msg void OnSelchangeLog();
189 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
190 afx_msg void OnClose();
191 afx_msg void OnTrayAboutklog();
192 afx_msg void OnTrayExit();
193 afx_msg void OnTrayShowklogwindow();
194 afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
195 afx_msg void OnLogpattern();
196 //}}AFX_MSG
197 DECLARE_MESSAGE_MAP()
198};