summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore35
-rw-r--r--ActionPage.cpp278
-rw-r--r--ActionPage.h78
-rw-r--r--ActivityView.cpp297
-rw-r--r--ActivityView.h65
-rw-r--r--BigBrotherDoc.cpp1039
-rw-r--r--BigBrotherDoc.h183
-rw-r--r--BigBrotherView.cpp485
-rw-r--r--BigBrotherView.h89
-rw-r--r--COPYING19
-rw-r--r--GeneralPage.cpp168
-rw-r--r--GeneralPage.h52
-rw-r--r--HostPropertyPages.cpp124
-rw-r--r--HostPropertyPages.h58
-rw-r--r--KTAGS12
-rw-r--r--MainFrm.cpp299
-rw-r--r--MainFrm.h65
-rw-r--r--Preferences.cpp93
-rw-r--r--Preferences.h48
-rw-r--r--README32
-rw-r--r--SettingsPage.cpp186
-rw-r--r--SettingsPage.h61
-rw-r--r--bigbrother.clw313
-rw-r--r--bigbrother.cpp181
-rw-r--r--bigbrother.h41
-rw-r--r--bigbrother.mak1451
-rw-r--r--bigbrother.rc729
-rw-r--r--help/IDI_GOINGDOWN.bmpbin0 -> 246 bytes
-rw-r--r--help/IDI_HOST.bmpbin0 -> 246 bytes
-rw-r--r--help/IDI_HOSTDOWN.bmpbin0 -> 246 bytes
-rw-r--r--help/IDI_NOHOST.bmpbin0 -> 246 bytes
-rw-r--r--help/IDI_PINGING.bmpbin0 -> 246 bytes
-rw-r--r--help/bbullet.bmpbin0 -> 222 bytes
-rw-r--r--help/bigbro.cnt29
-rw-r--r--help/bigbrother.hpj33
-rw-r--r--help/bigbrother.rtf295
-rw-r--r--help/bigbrother.xml229
-rw-r--r--help/green.bmpbin0 -> 1318 bytes
-rw-r--r--help/red.bmpbin0 -> 1318 bytes
-rw-r--r--help/yellow.bmpbin0 -> 1318 bytes
-rw-r--r--install/custom.rch10
-rw-r--r--install/install.cpp68
-rw-r--r--install/install.rc182
-rw-r--r--install/resource.h24
-rw-r--r--makehelp.bat35
-rw-r--r--res/3angle.avibin0 -> 7656 bytes
-rw-r--r--res/BigBrotherDoc.icobin0 -> 1078 bytes
-rw-r--r--res/bigbrother.icobin0 -> 1078 bytes
-rw-r--r--res/bigbrother.rc213
-rw-r--r--res/goingdown.icobin0 -> 1078 bytes
-rw-r--r--res/host-down.wavbin0 -> 5978 bytes
-rw-r--r--res/host-up.wavbin0 -> 5978 bytes
-rw-r--r--res/host.icobin0 -> 766 bytes
-rw-r--r--res/hostdown.icobin0 -> 1078 bytes
-rw-r--r--res/junktoolbar.bmpbin0 -> 598 bytes
-rw-r--r--res/maintoolbar.bmpbin0 -> 1438 bytes
-rw-r--r--res/nohost.icobin0 -> 1078 bytes
-rw-r--r--res/pending.icobin0 -> 1078 bytes
-rw-r--r--res/pinging.icobin0 -> 1078 bytes
-rw-r--r--resource.h131
-rw-r--r--shared-code/BTreendex.h595
-rw-r--r--shared-code/BellsNWhistles.h146
-rw-r--r--shared-code/BitSet.h105
-rw-r--r--shared-code/Dynamide.h443
-rw-r--r--shared-code/FindIFace.h125
-rw-r--r--shared-code/LRUCache.h113
-rw-r--r--shared-code/RegEx.cpp1697
-rw-r--r--shared-code/RegEx.h158
-rw-r--r--shared-code/SNMPExtDll.h252
-rw-r--r--shared-code/SNMPOIDs.h221
-rw-r--r--shared-code/SNMPeer.h286
-rw-r--r--shared-code/install.h370
-rw-r--r--shared-code/ip_icmp.h91
-rw-r--r--shared-code/kHelpers.h159
-rw-r--r--shared-code/kICMP.cpp300
-rw-r--r--shared-code/kICMP.h80
-rw-r--r--shared-code/kinhelp.xsl250
-rw-r--r--shared-code/ms_icmp.h77
-rw-r--r--shared-data/browse-icon.icobin0 -> 1078 bytes
-rw-r--r--shared-data/install-icon.icobin0 -> 2998 bytes
-rw-r--r--shared-data/klever-background.bmpbin0 -> 2578 bytes
-rw-r--r--shared-data/play-icon.icobin0 -> 1078 bytes
-rw-r--r--stdafx.cpp6
-rw-r--r--stdafx.h33
84 files changed, 13037 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01ef0bb
--- a/dev/null
+++ b/.gitignore
@@ -0,0 +1,35 @@
1
2# /
3/Debug
4/Release
5/Releast
6/debug
7/release
8/releast
9/DEBUG
10/RELEASE
11/RELEAST
12/*.mdp
13/*.ncb
14/*.aps
15/redist
16
17# /help/
18/help/BIGBRO.HLP
19/help/bigbro.hm
20/help/bigbro.GID
21
22# /install/
23/install/debug
24/install/pure
25/install/canned
26/install/static
27/install/Debug
28/install/Pure
29/install/Canned
30/install/Static
31/install/DEBUG
32/install/PURE
33/install/CANNED
34/install/STATIC
35/install/*.aps
diff --git a/ActionPage.cpp b/ActionPage.cpp
new file mode 100644
index 0000000..ec9699c
--- a/dev/null
+++ b/ActionPage.cpp
@@ -0,0 +1,278 @@
1// ActionPage.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "ActionPage.h"
7#include "HostPropertyPages.h"
8#include "BigBrotherDoc.h"
9#include "BigBrotherView.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CActionPage property page
19
20IMPLEMENT_DYNCREATE(CActionPage, CPropertyPage)
21
22CActionPage::CActionPage() : CPropertyPage(CActionPage::IDD)
23{
24 //{{AFX_DATA_INIT(CActionPage)
25 m_bCustomDn = FALSE;
26 m_bCustomUp = FALSE;
27 m_OverrideAction = FALSE;
28 m_bPlayASoundDn = FALSE;
29 m_bPlayASoundUp = FALSE;
30 m_CustomDn = _T("");
31 m_CustomUp = _T("");
32 m_SoundDn = _T("");
33 m_SoundUp = _T("");
34 //}}AFX_DATA_INIT
35 m_PreplayIcon = AfxGetApp()->LoadIcon(IDI_PREPLAY);
36 m_BrowseIcon = AfxGetApp()->LoadIcon(IDI_BROWSESOUND);
37}
38
39CActionPage::~CActionPage()
40{
41}
42
43void CActionPage::DoDataExchange(CDataExchange* pDX)
44{
45 CPropertyPage::DoDataExchange(pDX);
46 //{{AFX_DATA_MAP(CActionPage)
47 DDX_Control(pDX, IDC_BROWSE_SOUND_UP, m_BrowseUpCtl);
48 DDX_Control(pDX, IDC_BROWSE_SOUND_DOWN, m_BrowseDnCtl);
49 DDX_Control(pDX, IDC_PREVIEW_SOUND_UP, m_SoundPreviewUp);
50 DDX_Control(pDX, IDC_PREVIEW_SOUND_DOWN, m_SoundPreviewDn);
51 DDX_Control(pDX, IDC_SOUND_UP, m_SoundUpCtl);
52 DDX_Control(pDX, IDC_SOUND_DOWN, m_SoundDnCtl);
53 DDX_Control(pDX, IDC_PROGRAM_UP, m_CustomUpCtl);
54 DDX_Control(pDX, IDC_PROGRAM_DOWN, m_CustomDnCtl);
55 DDX_Control(pDX, IDC_PLAYASOUND_UP, m_bPlayASoundUpCtl);
56 DDX_Control(pDX, IDC_PLAYASOUND_DOWN, m_bPlayASoundDnCtl);
57 DDX_Control(pDX, IDC_OVERRIDE_ACTION, m_OverrideActionCtl);
58 DDX_Control(pDX, IDC_CUSTOM_UP, m_bCustomUpCtl);
59 DDX_Control(pDX, IDC_CUSTOM_DOWN, m_bCustomDnCtl);
60 DDX_Check(pDX, IDC_CUSTOM_DOWN, m_bCustomDn);
61 DDX_Check(pDX, IDC_CUSTOM_UP, m_bCustomUp);
62 DDX_Check(pDX, IDC_OVERRIDE_ACTION, m_OverrideAction);
63 DDX_Check(pDX, IDC_PLAYASOUND_DOWN, m_bPlayASoundDn);
64 DDX_Check(pDX, IDC_PLAYASOUND_UP, m_bPlayASoundUp);
65 DDX_Text(pDX, IDC_PROGRAM_DOWN, m_CustomDn);
66 DDX_Text(pDX, IDC_PROGRAM_UP, m_CustomUp);
67 DDX_CBString(pDX, IDC_SOUND_DOWN, m_SoundDn);
68 DDX_CBString(pDX, IDC_SOUND_UP, m_SoundUp);
69 //}}AFX_DATA_MAP
70}
71
72
73BEGIN_MESSAGE_MAP(CActionPage, CPropertyPage)
74 //{{AFX_MSG_MAP(CActionPage)
75 ON_BN_CLICKED(IDC_CUSTOM_DOWN, OnCustomDown)
76 ON_BN_CLICKED(IDC_CUSTOM_UP, OnCustomUp)
77 ON_BN_CLICKED(IDC_OVERRIDE_ACTION, OnOverrideAction)
78 ON_BN_CLICKED(IDC_PLAYASOUND_DOWN, OnPlayasoundDown)
79 ON_BN_CLICKED(IDC_PLAYASOUND_UP, OnPlayasoundUp)
80 ON_BN_CLICKED(IDC_PREVIEW_SOUND_UP, OnPreviewSoundUp)
81 ON_BN_CLICKED(IDC_PREVIEW_SOUND_DOWN, OnPreviewSoundDown)
82 ON_BN_CLICKED(IDC_BROWSE_SOUND_DOWN, OnBrowseSoundDown)
83 ON_BN_CLICKED(IDC_BROWSE_SOUND_UP, OnBrowseSoundUp)
84 //}}AFX_MSG_MAP
85END_MESSAGE_MAP()
86
87/////////////////////////////////////////////////////////////////////////////
88// CActionPage message handlers
89
90void CActionPage::SetupControls()
91{
92 m_bPlayASoundUpCtl.EnableWindow(m_OverrideAction);
93 m_bPlayASoundDnCtl.EnableWindow(m_OverrideAction);
94 m_bCustomUpCtl.EnableWindow(m_OverrideAction);
95 m_bCustomDnCtl.EnableWindow(m_OverrideAction);
96 m_SoundUpCtl.EnableWindow(m_bPlayASoundUp&&m_OverrideAction);
97 m_SoundDnCtl.EnableWindow(m_bPlayASoundDn&&m_OverrideAction);
98 m_SoundPreviewUp.EnableWindow(m_bPlayASoundUp);
99 m_SoundPreviewDn.EnableWindow(m_bPlayASoundDn);
100 m_BrowseUpCtl.EnableWindow(m_bPlayASoundUp&&m_OverrideAction);
101 m_BrowseDnCtl.EnableWindow(m_bPlayASoundDn&&m_OverrideAction);
102 m_CustomUpCtl.EnableWindow(m_bCustomUp&&m_OverrideAction);
103 m_CustomDnCtl.EnableWindow(m_bCustomDn&&m_OverrideAction);
104}
105
106void CActionPage::UpdatePage()
107{
108 if(!m_dad->m_Brother)
109 return;
110 if(::IsWindow(m_hWnd)){
111 m_SoundPreviewUp.SetIcon(m_PreplayIcon);
112 m_SoundPreviewDn.SetIcon(m_PreplayIcon);
113 m_BrowseUpCtl.SetIcon(m_BrowseIcon);
114 m_BrowseDnCtl.SetIcon(m_BrowseIcon);
115 if(m_dad->m_Brother->m_Daddy)
116 m_OverrideActionCtl.EnableWindow(TRUE);
117 else
118 m_OverrideActionCtl.EnableWindow(FALSE);
119 }
120 if(m_dad->m_Brother->flags&CBrother::flagsOverrideActions)
121 m_OverrideAction=TRUE;
122 else
123 m_OverrideAction=FALSE;
124 if(m_dad->m_Brother->m_Up.flags&CAction::flagsPlayASound)
125 m_bPlayASoundUp=TRUE;
126 else
127 m_bPlayASoundUp=FALSE;
128 if(m_dad->m_Brother->m_Up.flags&CAction::flagsRunCustom)
129 m_bCustomUp=TRUE;
130 else
131 m_bCustomUp=FALSE;
132 if(m_dad->m_Brother->m_Down.flags&CAction::flagsPlayASound)
133 m_bPlayASoundDn=TRUE;
134 else
135 m_bPlayASoundDn=FALSE;
136 if(m_dad->m_Brother->m_Down.flags&CAction::flagsRunCustom)
137 m_bCustomDn=TRUE;
138 else
139 m_bCustomDn=FALSE;
140 m_SoundUp=m_dad->m_Brother->m_Up.m_Sound;
141 m_CustomUp=m_dad->m_Brother->m_Up.m_Custom;
142 m_SoundDn=m_dad->m_Brother->m_Down.m_Sound;
143 m_CustomDn=m_dad->m_Brother->m_Down.m_Custom;
144 if(::IsWindow(m_hWnd)){
145 UpdateData(FALSE);
146 SetupControls();
147 }
148}
149
150BOOL CActionPage::OnSetActive()
151{
152 UpdatePage();
153 return CPropertyPage::OnSetActive();
154}
155
156void CActionPage::UpdateBrother()
157{
158 if(!m_dad->m_Brother){
159 TRACE0("No brother on update\n");
160 return;
161 }
162 if(::IsWindow(m_hWnd))
163 UpdateData();
164CBrother toCompare;
165 toCompare = *m_dad->m_Brother;
166 if(m_OverrideAction)
167 m_dad->m_Brother->flags|=CBrother::flagsOverrideActions;
168 else
169 m_dad->m_Brother->flags&=~CBrother::flagsOverrideActions;
170 if(m_bPlayASoundUp)
171 m_dad->m_Brother->m_Up.flags|=CAction::flagsPlayASound;
172 else
173 m_dad->m_Brother->m_Up.flags&=~CAction::flagsPlayASound;
174 m_dad->m_Brother->m_Up.m_Sound=m_SoundUp;
175 if(m_bCustomUp)
176 m_dad->m_Brother->m_Up.flags|=CAction::flagsRunCustom;
177 else
178 m_dad->m_Brother->m_Up.flags&=~CAction::flagsRunCustom;
179 m_dad->m_Brother->m_Up.m_Custom=m_CustomUp;
180 if(m_bPlayASoundDn)
181 m_dad->m_Brother->m_Down.flags|=CAction::flagsPlayASound;
182 else
183 m_dad->m_Brother->m_Down.flags&=~CAction::flagsPlayASound;
184 m_dad->m_Brother->m_Down.m_Sound=m_SoundDn;
185 if(m_bCustomDn)
186 m_dad->m_Brother->m_Down.flags|=CAction::flagsRunCustom;
187 else
188 m_dad->m_Brother->m_Down.flags&=~CAction::flagsRunCustom;
189 m_dad->m_Brother->m_Down.m_Custom=m_CustomDn;
190 m_dad->m_Brother->ParentalAdjust();
191 if(toCompare!=(*m_dad->m_Brother)){
192 ASSERT(m_dad->m_Daddy);
193 CDocument *pDoc = m_dad->m_Daddy->GetDocument();
194 ASSERT(pDoc);
195 pDoc->SetModifiedFlag();
196 }
197 if(::IsWindow(m_hWnd)){
198 UpdateData(FALSE);
199 SetupControls();
200 }
201}
202
203BOOL CActionPage::OnKillActive()
204{
205 UpdateBrother();
206 return CPropertyPage::OnKillActive();
207}
208
209void CActionPage::OnCustomDown()
210{
211 UpdateBrother();
212 if(m_bCustomDn)
213 m_CustomDnCtl.SetFocus();
214}
215
216void CActionPage::OnCustomUp()
217{
218 UpdateBrother();
219 if(m_bCustomUp)
220 m_CustomUpCtl.SetFocus();
221}
222
223void CActionPage::OnOverrideAction()
224{
225 UpdateBrother();
226}
227
228void CActionPage::OnPlayasoundDown()
229{
230 UpdateBrother();
231 if(m_bPlayASoundDn)
232 m_SoundDnCtl.SetFocus();
233}
234
235void CActionPage::OnPlayasoundUp()
236{
237 UpdateBrother();
238 if(m_bPlayASoundUp)
239 m_SoundUpCtl.SetFocus();
240}
241
242void CActionPage::OnPreviewSoundUp()
243{
244 ASSERT(m_bPlayASoundUp);
245 UpdateBrother();
246 CAction::PlayASound(m_SoundUp);
247}
248
249void CActionPage::OnPreviewSoundDown()
250{
251 ASSERT(m_bPlayASoundDn);
252 UpdateBrother();
253 CAction::PlayASound(m_SoundDn);
254}
255
256void CActionPage::OnBrowseSoundDown()
257{
258 BrowseCtl(m_SoundDnCtl);
259}
260
261void CActionPage::OnBrowseSoundUp()
262{
263 BrowseCtl(m_SoundUpCtl);
264}
265
266void CActionPage::BrowseCtl(CComboBox& ctl)
267{
268CString filter;
269 filter.LoadString(IDS_WAVFILTER);
270CString title;
271 title.LoadString(IDS_SOUND_SELECT);
272CFileDialog cfd(TRUE,NULL,NULL,OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,filter,this);
273 cfd.m_ofn.lpstrTitle=title;
274 if(cfd.DoModal()==IDOK){
275 ctl.SetWindowText(cfd.GetPathName());
276 UpdateBrother();
277 }
278}
diff --git a/ActionPage.h b/ActionPage.h
new file mode 100644
index 0000000..570abd0
--- a/dev/null
+++ b/ActionPage.h
@@ -0,0 +1,78 @@
1// ActionPage.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CActionPage dialog
6
7class CHostPropertyPages;
8class CActionPage : public CPropertyPage
9{
10 DECLARE_DYNCREATE(CActionPage)
11
12// Construction
13public:
14 void BrowseCtl(CComboBox& ctl);
15 HICON m_BrowseIcon;
16 HICON m_PreplayIcon;
17 void UpdateBrother();
18 void UpdatePage();
19 void SetupControls();
20 CHostPropertyPages* m_dad;
21 CActionPage();
22 ~CActionPage();
23
24// Dialog Data
25 //{{AFX_DATA(CActionPage)
26 enum { IDD = IDD_PROPS_ACTION };
27 CButtonm_BrowseUpCtl;
28 CButtonm_BrowseDnCtl;
29 CButtonm_SoundPreviewUp;
30 CButtonm_SoundPreviewDn;
31 CComboBoxm_SoundUpCtl;
32 CComboBoxm_SoundDnCtl;
33 CEditm_CustomUpCtl;
34 CEditm_CustomDnCtl;
35 CButtonm_bPlayASoundUpCtl;
36 CButtonm_bPlayASoundDnCtl;
37 CButtonm_OverrideActionCtl;
38 CButtonm_bCustomUpCtl;
39 CButtonm_bCustomDnCtl;
40 BOOLm_bCustomDn;
41 BOOLm_bCustomUp;
42 BOOLm_OverrideAction;
43 BOOLm_bPlayASoundDn;
44 BOOLm_bPlayASoundUp;
45 CStringm_CustomDn;
46 CStringm_CustomUp;
47 CStringm_SoundDn;
48 CStringm_SoundUp;
49 //}}AFX_DATA
50
51
52// Overrides
53 // ClassWizard generate virtual function overrides
54 //{{AFX_VIRTUAL(CActionPage)
55 public:
56 virtual BOOL OnSetActive();
57 virtual BOOL OnKillActive();
58 protected:
59 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
60 //}}AFX_VIRTUAL
61
62// Implementation
63protected:
64 // Generated message map functions
65 //{{AFX_MSG(CActionPage)
66 afx_msg void OnCustomDown();
67 afx_msg void OnCustomUp();
68 afx_msg void OnOverrideAction();
69 afx_msg void OnPlayasoundDown();
70 afx_msg void OnPlayasoundUp();
71 afx_msg void OnPreviewSoundUp();
72 afx_msg void OnPreviewSoundDown();
73 afx_msg void OnBrowseSoundDown();
74 afx_msg void OnBrowseSoundUp();
75 //}}AFX_MSG
76 DECLARE_MESSAGE_MAP()
77
78};
diff --git a/ActivityView.cpp b/ActivityView.cpp
new file mode 100644
index 0000000..664b3d4
--- a/dev/null
+++ b/ActivityView.cpp
@@ -0,0 +1,297 @@
1// ActivityView.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "ActivityView.h"
7
8#include "BigBrotherDoc.h"
9
10#ifdef _DEBUG
11#define new DEBUG_NEW
12#undef THIS_FILE
13static char THIS_FILE[] = __FILE__;
14#endif
15
16/////////////////////////////////////////////////////////////////////////////
17// CActivityView
18
19IMPLEMENT_DYNCREATE(CActivityView, CScrollView)
20
21CActivityView::CActivityView()
22{
23 m_Background = GetSysColor(COLOR_MENU);
24 //RGB(128,255,128);
25 m_BoxColor = RGB(192,255,255);
26 m_Red = RGB(255,0,0);
27 m_Green = RGB(0,192,0);
28 m_Yellow = RGB(255,255,0);
29 m_Dim = RGB(192,192,192);
30 m_Brothers = new CBrotherList;
31}
32
33CActivityView::~CActivityView()
34{
35 delete m_Brothers;
36}
37
38
39BEGIN_MESSAGE_MAP(CActivityView, CScrollView)
40 //{{AFX_MSG_MAP(CActivityView)
41 ON_WM_ERASEBKGND()
42 ON_WM_CREATE()
43 ON_WM_MOUSEMOVE()
44 ON_WM_LBUTTONDOWN()
45 ON_WM_LBUTTONUP()
46 ON_WM_SIZE()
47 //}}AFX_MSG_MAP
48END_MESSAGE_MAP()
49
50/////////////////////////////////////////////////////////////////////////////
51// CActivityView drawing
52
53void CActivityView::OnInitialUpdate()
54{
55 CScrollView::OnInitialUpdate();
56
57 OnUpdate(NULL,0,NULL);
58}
59
60void CActivityView::OnDraw(CDC* pDC)
61{
62CBigBrotherDoc* pDoc = (CBigBrotherDoc*)GetDocument();
63 if(!pDoc)
64 return;
65 ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
66 if(m_Brothers->IsEmpty())
67 return;
68BOOL bt = FALSE, et=FALSE;
69BOOL isAny = FALSE;
70CTime beginTime, endTime;
71POSITION p = m_Brothers->GetHeadPosition();
72 while(p){
73 CBrother *b = m_Brothers->GetNext(p);
74 ASSERT(b);
75 if(b->m_Log.IsEmpty())
76 continue;
77 isAny=TRUE;
78 if((!bt) || b->m_Log.GetHead()->m_Time<beginTime){
79 bt=TRUE;
80 beginTime=b->m_Log.GetHead()->m_Time;
81 }
82 if((!et) || b->m_Log.GetTail()->m_Time>endTime){
83 et=TRUE;
84 endTime=b->m_Log.GetTail()->m_Time;
85 }
86 }
87 if(!isAny){
88 m_bPainted=FALSE;
89 return;
90 }
91 m_bPainted=TRUE;
92CTimeSpan ts = endTime-beginTime;
93 if(ts<pDoc->m_MaxLogTime)
94 ts = pDoc->m_MaxLogTime;
95 m_BeginTime=beginTime;
96 m_TimeSpan=ts;
97 p = m_Brothers->GetHeadPosition();
98int host = 0;
99 while(p){
100 CBrother *b = m_Brothers->GetNext(p);
101 ASSERT(b);
102 CRect rc(10,20+host*105,10+500,20+host*105+100);
103 pDC->FillSolidRect(rc,m_BoxColor);
104 PaintHost(b,pDC,rc,&beginTime,&ts);
105 host++;
106 }
107}
108
109/////////////////////////////////////////////////////////////////////////////
110// CActivityView diagnostics
111
112#ifdef _DEBUG
113void CActivityView::AssertValid() const
114{
115 CScrollView::AssertValid();
116}
117
118void CActivityView::Dump(CDumpContext& dc) const
119{
120 CScrollView::Dump(dc);
121}
122#endif //_DEBUG
123
124/////////////////////////////////////////////////////////////////////////////
125// CActivityView message handlers
126
127void CActivityView::PaintHost(CBrother *b,CDC *pDC,CRect& rc,CTime *bTime,CTimeSpan *tSpan)
128{
129 ASSERT(b);
130 if(b->m_Log.IsEmpty())
131 return;
132CBigBrotherDoc* pDoc = (CBigBrotherDoc*)GetDocument();
133 ASSERT(pDoc);
134 ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
135 ULONGrttMax = b->m_TimeOut;
136CTime beginTime;
137CTimeSpan ts;
138 if(bTime && tSpan){
139 beginTime= *bTime;
140 ts = *tSpan;
141 }else{
142 beginTime = b->m_Log.GetHead()->m_Time;
143 CTime endTime = b->m_Log.GetTail()->m_Time;
144 ts = endTime-beginTime;
145 if(ts<pDoc->m_MaxLogTime)
146 ts = pDoc->m_MaxLogTime;
147 }
148 POSITIONp = b->m_Log.GetHeadPosition();
149 ASSERT(p);
150CLogEntry *le = b->m_Log.GetNext(p);
151 ASSERT(le);
152 intx = rc.left+(le->m_Time-beginTime).GetTotalSeconds()*rc.Width()/ts.GetTotalSeconds();
153 while(p){
154 le = b->m_Log.GetNext(p);
155 ASSERT(le);
156 int newx=rc.left+(le->m_Time-beginTime).GetTotalSeconds()*rc.Width()/ts.GetTotalSeconds();
157 if(!(le->flags&CLogEntry::flagsSeparator)){
158 UINTsize = le->m_bReached?min(rttMax,le->m_RTT):rttMax;
159 intdrawSize=(rttMax-size)*rc.Height()/rttMax;
160 COLORREF color=le->m_bReached?((size<(rttMax/3))?m_Green:((size<(rttMax*2/3))?m_Yellow:m_Red)):m_Dim;
161 pDC->FillSolidRect(x,rc.bottom-drawSize,newx-x,drawSize,color);
162 }
163 x=newx;
164 }
165}
166
167void CActivityView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
168{
169CBigBrotherDoc* pDoc = (CBigBrotherDoc*)GetDocument();
170 if(!pDoc)
171 return;
172 ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
173 if(pHint){
174 CBrother *b = (CBrother*)pHint;
175 if(m_Brothers->Find(b)){
176 CClientDC dc(this);
177 OnPrepareDC(&dc);
178 CRect rc = b->m_rc;
179 dc.LPtoDP(&rc);
180 InvalidateRect(rc,FALSE);
181 }
182 return;
183 }
184 m_Brothers->RemoveAll();
185CBrother *b = pDoc->GetCurrentBrother();
186 if(b)
187 pDoc->GetFamily(b,m_Brothers);
188 SetScaleToFitSize(CSize(10+500+10,20+m_Brothers->GetCount()*105+20));
189POSITION p = m_Brothers->GetHeadPosition();
190int host = 0;
191 while(p){
192 CBrother *b = m_Brothers->GetNext(p);
193 b->m_rc.SetRect(10,20+host*105,10+500,20+host*105+100);
194 host++;
195 }
196 CScrollView::OnUpdate(pSender,lHint,pHint);
197}
198
199BOOL CActivityView::OnEraseBkgnd(CDC* pDC)
200{
201CRect rc;
202 GetClientRect(rc);
203 pDC->FillSolidRect(rc,m_Background);
204 return TRUE;
205}
206
207int CActivityView::OnCreate(LPCREATESTRUCT lpCreateStruct)
208{
209 if (CScrollView::OnCreate(lpCreateStruct) == -1)
210 return -1;
211
212 m_ToolTip.Create(this);
213 m_ToolTip.Activate(TRUE);
214 m_ToolTip.AddTool(this,IDS_AVIEW_NOTIP);
215
216 return 0;
217}
218
219BOOL CActivityView::PreTranslateMessage(MSG* pMsg)
220{
221 m_ToolTip.RelayEvent(pMsg);
222 return CScrollView::PreTranslateMessage(pMsg);
223}
224
225void CActivityView::OnMouseMove(UINT nFlags, CPoint point)
226{
227 UpdateTip(nFlags,point);
228 CScrollView::OnMouseMove(nFlags, point);
229}
230
231void CActivityView::UpdateTip(UINT nFlags,CPoint point)
232{
233CClientDC dc(this);
234 OnPrepareDC(&dc);
235 dc.DPtoLP(&point);
236POSITION p = m_Brothers->GetHeadPosition();
237 while(p){
238 CBrother *b = m_Brothers->GetNext(p);
239 if(b->m_rc.PtInRect(point)){
240 CString tmp;
241 tmp.Format(IDS_AVIEW_SHORTTIP,(LPCTSTR)b->m_Desc,(LPCTSTR)b->m_Host);
242 if(m_bPainted && (nFlags&(MK_LBUTTON|MK_CONTROL|MK_SHIFT))){
243 CTime theTime = m_BeginTime + CTimeSpan((point.x-b->m_rc.left)*m_TimeSpan.GetTotalSeconds()/b->m_rc.Width());
244 if(nFlags&(MK_LBUTTON|MK_CONTROL)){
245 // Add Time
246 tmp += ", "+theTime.Format(IDS_AVIEW_TIP_TIMEFORMAT);
247 }
248 if(nFlags&MK_SHIFT){
249 // Add RTT report
250 CLogEntry *le = NULL;
251 POSITION p = b->m_Log.GetTailPosition();
252 while(p){
253 CLogEntry *l = b->m_Log.GetPrev(p);
254 if(theTime<l->m_Time)
255 le = l;
256 else
257 break;
258 }
259 CString ttmp;
260 if(le){
261 if(le->m_bReached)
262 ttmp.Format(IDS_AVIEW_TIP_RTTREPORT, le->m_RTT);
263 else
264 ttmp.LoadString(IDS_AVIEW_TIP_UNREACHABLE);
265 }else
266 ttmp.LoadString(IDS_AVIEW_TIP_UNPINGED);
267 tmp += ", "+ttmp;
268 }
269 }
270 m_ToolTip.Activate(TRUE);
271 m_ToolTip.UpdateTipText(tmp,this);
272 return;
273 }
274 }
275 m_ToolTip.Activate(FALSE);
276 m_ToolTip.UpdateTipText(IDS_AVIEW_NOTIP,this);
277}
278
279void CActivityView::OnLButtonDown(UINT nFlags, CPoint point)
280{
281 UpdateTip(nFlags,point);
282 CScrollView::OnLButtonDown(nFlags, point);
283}
284
285void CActivityView::OnLButtonUp(UINT nFlags, CPoint point)
286{
287 UpdateTip(nFlags,point);
288 CScrollView::OnLButtonUp(nFlags, point);
289}
290
291void CActivityView::OnSize(UINT nType, int cx, int cy)
292{
293 CScrollView::OnSize(nType, cx, cy);
294CDocument *pDoc = GetDocument();
295 ASSERT(pDoc);
296 pDoc->UpdateAllViews(NULL);
297}
diff --git a/ActivityView.h b/ActivityView.h
new file mode 100644
index 0000000..aea3503
--- a/dev/null
+++ b/ActivityView.h
@@ -0,0 +1,65 @@
1// ActivityView.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CActivityView view
6
7class CBrother;
8 typedef CTypedPtrList<CObList,CBrother*>CBrotherList;
9class CActivityView : public CScrollView
10{
11protected:
12 CActivityView(); // protected constructor used by dynamic creation
13 DECLARE_DYNCREATE(CActivityView)
14
15// Attributes
16public:
17 void UpdateTip(UINT nFlags,CPoint point);
18 BOOL m_bPainted;
19 CTimeSpan m_TimeSpan;
20 CTime m_BeginTime;
21 CToolTipCtrl m_ToolTip;
22 COLORREF m_Background;
23 CBrotherList *m_Brothers;
24 void PaintHost(CBrother *b,CDC *pDC,CRect& rc,CTime* bTime=NULL,CTimeSpan* tSpan=NULL);
25 COLORREF m_Dim;
26 COLORREF m_Yellow;
27 COLORREF m_Green;
28 COLORREF m_Red;
29 COLORREF m_BoxColor;
30
31// Operations
32public:
33
34// Overrides
35 // ClassWizard generated virtual function overrides
36 //{{AFX_VIRTUAL(CActivityView)
37 public:
38 virtual BOOL PreTranslateMessage(MSG* pMsg);
39 protected:
40 virtual void OnDraw(CDC* pDC); // overridden to draw this view
41 virtual void OnInitialUpdate(); // first time after construct
42 virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
43 //}}AFX_VIRTUAL
44
45// Implementation
46protected:
47 virtual ~CActivityView();
48#ifdef _DEBUG
49 virtual void AssertValid() const;
50 virtual void Dump(CDumpContext& dc) const;
51#endif
52
53 // Generated message map functions
54 //{{AFX_MSG(CActivityView)
55 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
56 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
57 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
58 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
59 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
60 afx_msg void OnSize(UINT nType, int cx, int cy);
61 //}}AFX_MSG
62 DECLARE_MESSAGE_MAP()
63};
64
65/////////////////////////////////////////////////////////////////////////////
diff --git a/BigBrotherDoc.cpp b/BigBrotherDoc.cpp
new file mode 100644
index 0000000..4a5328e
--- a/dev/null
+++ b/BigBrotherDoc.cpp
@@ -0,0 +1,1039 @@
1// BigBrotherDoc.cpp : implementation of the CBigBrotherDoc class
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6
7#include "BigBrotherDoc.h"
8#include "BigBrotherView.h"
9#include "ActivityView.h"
10#include "HostPropertyPages.h"
11#include "MainFrm.h"
12#include "Preferences.h"
13
14#ifdef _DEBUG
15#define new DEBUG_NEW
16#undef THIS_FILE
17static char THIS_FILE[] = __FILE__;
18#endif
19
20/////////////////////////////////////////////////////////////////////////////
21// CBigBrotherDoc
22
23IMPLEMENT_SERIAL(CBigBrotherDoc, CDocument, VERSIONABLE_SCHEMA | 3 )
24IMPLEMENT_SERIAL(CBrother, CObject, VERSIONABLE_SCHEMA | 2 )
25IMPLEMENT_SERIAL(CAction, CObject, VERSIONABLE_SCHEMA | 1 )
26IMPLEMENT_SERIAL(CLogEntry, CObject, VERSIONABLE_SCHEMA | 2 )
27
28BEGIN_MESSAGE_MAP(CBigBrotherDoc, CDocument)
29 //{{AFX_MSG_MAP(CBigBrotherDoc)
30 ON_COMMAND(ID_BROTHERS_NEW, OnBrothersNew)
31 ON_UPDATE_COMMAND_UI(ID_BROTHERS_ADDBROTHER, OnUpdateBrothersAddbrother)
32 ON_COMMAND(ID_BROTHERS_ADDBROTHER, OnBrothersAddbrother)
33 ON_UPDATE_COMMAND_UI(ID_BROTHERS_DELETE, OnUpdateBrothersDelete)
34 ON_COMMAND(ID_BROTHERS_DELETE, OnBrothersDelete)
35 ON_COMMAND(ID_FILE_PREFERENCES, OnFilePreferences)
36 ON_UPDATE_COMMAND_UI(ID_FILE_PAUSE, OnUpdateFilePause)
37 ON_COMMAND(ID_FILE_PAUSE, OnFilePause)
38 ON_UPDATE_COMMAND_UI(ID_VIEW_HOSTPROPERTIES, OnUpdateViewHostproperties)
39 ON_COMMAND(ID_VIEW_HOSTPROPERTIES, OnViewHostproperties)
40 //}}AFX_MSG_MAP
41END_MESSAGE_MAP()
42
43/////////////////////////////////////////////////////////////////////////////
44// CBigBrotherDoc construction/destruction
45
46CBigBrotherDoc::CBigBrotherDoc()
47 : m_MaxLogTime(0,1,0,0), m_Threads(0), m_MaxThreads(10), m_PingSize(32), m_RootBrother(NULL),
48 m_bSaveOnShutdown(TRUE), m_AutoSave(0,0,30,0), m_bStoreLastActivity(FALSE)
49{
50 m_BBView = NULL;
51 m_AView = NULL;
52}
53
54CBigBrotherDoc::~CBigBrotherDoc()
55{
56 CleanUp();
57}
58
59BOOL CBigBrotherDoc::OnNewDocument()
60{
61 if (!CDocument::OnNewDocument())
62 return FALSE;
63
64 CleanUp();
65 m_RootBrother=new CBrother();
66
67 return TRUE;
68}
69
70/////////////////////////////////////////////////////////////////////////////
71// CBigBrotherDoc serialization
72
73void CBigBrotherDoc::Serialize(CArchive& ar)
74{
75 ASSERT_VALID(this);
76
77 CDocument::Serialize(ar);
78
79 ar.MapObject(this);
80 ar.SerializeClass(RUNTIME_CLASS(CBigBrotherDoc));
81
82 if (ar.IsStoring())
83 {
84 // Store to archive
85 ar << m_PingSize;
86 ar << m_MaxThreads;
87 ar << m_MaxLogTime;
88 ar << m_bSaveOnShutdown;
89 ar << m_AutoSave;
90 ar << m_LogFile;
91 ar << m_bStoreLastActivity;
92 ar << m_RootBrother;
93 m_Brotherhood.Serialize(ar);
94 }
95 else
96 {
97 UINTschema = ar.GetObjectSchema();
98 #ifndefNDEBUG
99 {
100 CString tmp;
101 tmp.Format("Doc-OSchema: %u\n",schema);
102 TRACE0(tmp);
103 }
104#endif
105 CleanUp();
106 m_ThisMap.RemoveAll();
107 // Read from archive
108 ar >> m_PingSize;
109 ar >> m_MaxThreads;
110 ar >> m_MaxLogTime;
111 if(schema>=2){
112 ar >> m_bSaveOnShutdown;
113 ar >> m_AutoSave;
114 }
115 ar >> m_LogFile;
116 if(schema>=3)
117 ar >> m_bStoreLastActivity;
118 ar >> m_RootBrother;
119 m_Brotherhood.Serialize(ar);
120 // Read from archive
121 m_ThisMap.RemoveAll();
122 // Log loading
123 CString logLine;
124 logLine.Format(IDS_LOG_LOADFILE,(LPCTSTR)GetTitle());
125 logLine=CTime::GetCurrentTime().Format(IDS_LOG_DATEFORMAT)+" "+logLine;
126 LogLine(logLine);
127 }
128}
129
130/////////////////////////////////////////////////////////////////////////////
131// CBigBrotherDoc diagnostics
132
133#ifdef _DEBUG
134void CBigBrotherDoc::AssertValid() const
135{
136 CDocument::AssertValid();
137}
138
139void CBigBrotherDoc::Dump(CDumpContext& dc) const
140{
141 CDocument::Dump(dc);
142}
143#endif //_DEBUG
144
145/////////////////////////////////////////////////////////////////////////////
146// CBigBrotherDoc commands
147
148CBrother::CBrother(CBrother *daddy)
149{
150 CleanUp();
151 m_Daddy=daddy;
152 ParentalAdjust(TRUE);
153}
154
155void CBrother::CleanUp()
156{
157 m_Item=NULL;
158 flags=0;
159 m_bLog=TRUE;
160 m_Daddy=NULL;
161 m_Desc.Empty();
162 m_Down.CleanUp();
163 m_Host.Empty();
164 m_IntervalBad=30;
165 m_IntervalGood=30;
166 m_Retries=3;
167 m_TimeOut=5000;
168 m_Up.CleanUp();
169 m_bPinged=FALSE;
170 m_bPending=FALSE;
171 m_bIsUp=TRUE;
172 m_bPinging=FALSE;
173 m_bUp=TRUE;
174 m_bToKill=FALSE;
175 m_Doc=NULL;
176}
177
178CAction::CAction()
179{
180 CleanUp();
181}
182
183void CAction::CleanUp()
184{
185 flags=0;
186 m_Custom.Empty();
187 m_Sound.Empty();
188}
189
190CAction& CAction::operator=(CAction& src)
191{
192 flags=src.flags;
193 m_Custom=src.m_Custom;
194 m_Sound=src.m_Sound;
195 return *this;
196}
197
198void CBrother::ParentalAdjust(BOOL cleanUp)
199{
200 if(!m_Daddy){
201 flags|=flagsOverrideIntervals|flagsOverrideTimeout|flagsOverrideRetries|flagsOverrideActions|flagsOverrideLogging;
202 if(cleanUp){
203 m_Desc.LoadString(IDS_ROOTNODENAME);
204 m_IntervalBad=30, m_IntervalGood=30;
205 m_TimeOut=5000;
206 m_Retries=3;
207 {
208 m_Up.CleanUp();
209 m_Down.CleanUp();
210 m_Up.flags=m_Down.flags=CAction::flagsPlayASound;
211 m_Up.m_Sound.LoadString(IDS_ACTION_HOST_UP);
212 m_Down.m_Sound.LoadString(IDS_ACTION_HOST_DOWN);
213 }
214 m_bLog=TRUE;
215 }
216 }else{
217 if(!(flags&flagsOverrideIntervals)){
218 CBrother *parent = m_Daddy;
219 while(!(parent->flags&flagsOverrideIntervals)){
220 ASSERT(parent->m_Daddy);
221 parent=parent->m_Daddy;
222 }
223 m_IntervalBad=parent->m_IntervalBad;
224 m_IntervalGood=parent->m_IntervalGood;
225 }
226 if(!(flags&flagsOverrideTimeout)){
227 CBrother *parent = m_Daddy;
228 while(!(parent->flags&flagsOverrideTimeout)){
229 ASSERT(parent->m_Daddy);
230 parent=parent->m_Daddy;
231 }
232 m_TimeOut=parent->m_TimeOut;
233 }
234 if(!(flags&flagsOverrideRetries)){
235 CBrother *parent = m_Daddy;
236 while(!(parent->flags&flagsOverrideRetries)){
237 ASSERT(parent->m_Daddy);
238 parent=parent->m_Daddy;
239 }
240 m_Retries=parent->m_Retries;
241 }
242 if(!(flags&flagsOverrideActions)){
243 CBrother *parent = m_Daddy;
244 while(!(parent->flags&flagsOverrideActions)){
245 ASSERT(parent->m_Daddy);
246 parent=parent->m_Daddy;
247 }
248 m_Up=parent->m_Up;
249 m_Down=parent->m_Down;
250 }
251 if(!(flags&flagsOverrideLogging)){
252 CBrother *parent = m_Daddy;
253 while(!(parent->flags&flagsOverrideLogging)){
254 ASSERT(parent->m_Daddy);
255 parent=parent->m_Daddy;
256 }
257 m_bLog=parent->m_bLog;
258 }
259 }
260}
261
262void CBigBrotherDoc::OnChangedViewList()
263{
264 m_BBView=NULL;
265 m_AView=NULL;
266POSITION p = GetFirstViewPosition();
267 while(p){
268 CView* v = GetNextView(p);
269 if(v->IsKindOf(RUNTIME_CLASS(CBigBrotherView))){
270 ASSERT(!m_BBView);
271 m_BBView=(CBigBrotherView*)v;
272 }else if(v->IsKindOf(RUNTIME_CLASS(CActivityView))){
273 ASSERT(!m_AView);
274 m_AView=(CActivityView*)v;
275 }
276 }
277
278 CDocument::OnChangedViewList();
279}
280
281void CBigBrotherDoc::OnBrothersNew()
282{
283 ASSERT(m_BBView);
284CBrother *bro = m_BBView->GetCurrentBrother();
285 ASSERT(bro);
286CBrother *lb = new CBrother(bro);
287 m_Brotherhood.AddTail(lb);
288 SetModifiedFlag();
289 m_BBView->AddBrother(lb);
290 m_BBView->GotoBrother(lb);
291}
292
293void CBigBrotherDoc::CheckPendingQueue()
294{
295 if(flags&flagsSuspended)
296 return;
297CTime currentTime = CTime::GetCurrentTime();
298CTime nearestCheck;
299BOOL nearested = CheckPendingBrother(m_RootBrother,currentTime,nearestCheck,FALSE);
300POSITION p = m_Brotherhood.GetHeadPosition();
301 while(p){
302 CBrother *b = (CBrother*)m_Brotherhood.GetNext(p);
303 ASSERT(b);
304 nearested|=CheckPendingBrother(b,currentTime,nearestCheck,nearested);
305 }
306 if(m_AutoSave.GetTotalMinutes()){
307 CTime nc = m_AutoSaved+m_AutoSave;
308 if(nc<=currentTime){
309 if(IsModified())
310 DoFileSave();
311 m_AutoSaved=currentTime;
312 while(nc<=currentTime)
313 nc=nc+m_AutoSave;
314 }
315 if((!nearested) || nc<nearestCheck){
316 nearestCheck=nc;
317 nearested=TRUE;
318 }
319 }
320 if(!nearested)
321 return;
322 currentTime = CTime::GetCurrentTime();
323CTimeSpan nextto = nearestCheck-currentTime;
324 UINTtimer = 60000;
325 if(nextto.GetTotalSeconds()<60)
326 timer=nextto.GetTotalSeconds()*1000;
327 if(m_BBView)// In case we're destroying..
328 m_BBView->SetTimer(TM_CHECK,timer,NULL);
329}
330
331BOOL CBigBrotherDoc::CheckPendingBrother(CBrother* b,CTime& currentTime,CTime& nearestCheck,BOOL nearested)
332{
333 if(!b)
334 return FALSE;
335 if(b->m_Host.IsEmpty() || b->m_bPinging){
336 b->m_bPending=FALSE;
337 return FALSE;
338 }
339 if(b->m_bPending){
340 TryBrother(b);
341 return FALSE;
342 }
343CTime nextCheck = b->m_Pinged+CTimeSpan(b->m_bIsUp?b->m_IntervalGood:b->m_IntervalBad);
344 if(nextCheck<=currentTime){
345 TryBrother(b);
346 return FALSE;
347 }
348 if((!nearested) || nextCheck<nearestCheck){
349 nearestCheck=nextCheck;
350 return TRUE;
351 }
352 return FALSE;
353}
354
355void CBigBrotherDoc::TryBrother(CBrother *b)
356{
357 ASSERT(!b->m_Host.IsEmpty());
358 if(!(m_Threads<m_MaxThreads)){
359 b->m_bPending=TRUE;
360 return;
361 }
362 if(!m_BBView)
363 return;// In case we're dying
364 m_BBView->SendMessage(WM_ACTIVITYCOUNT,1,0);
365 b->m_Doc=this;
366 b->m_bPinging=TRUE;
367 VERIFY(AfxBeginThread(CBrother::DoCheck,(LPVOID)b));
368}
369
370UINT CBrother::DoCheck(LPVOID pParam)
371{
372CBrother *b = (CBrother*)pParam;
373 ASSERT(b);
374 return b->Check();
375}
376
377UINT CBrother::Check()
378{
379CBigBrotherDoc *m_Doc = (CBigBrotherDoc*)CBrother::m_Doc;
380
381 if(!m_bToKill){
382 ASSERT(m_Doc);
383 ASSERT(m_Doc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
384 ASSERT(m_Doc->m_BBView);
385 m_Doc->m_BBView->PostMessage(WM_UPDATETREEBROTHER,0,(LPARAM)this);
386 }
387
388CICMP *pICMP = NULL;
389UINT dataSize = m_bToKill?32:m_Doc->m_PingSize;
390in_addr ip;
391 ip.s_addr = inet_addr(m_Host);
392CLogEntry le;
393 if(ip.s_addr==INADDR_NONE){
394 hostent *he = gethostbyname(m_Host);
395 if(!he){
396 le.m_Status.LoadString(IDS_PS_FAILEDTORESOLVE);
397 goto goBye;
398 }
399 memmove(&ip.s_addr,he->h_addr,sizeof(ip.s_addr));
400 }
401 pICMP = CICMP::CreateICMP();
402 if(!(pICMP && pICMP->Initialize())) {
403 le.m_Status.LoadString(IDS_PS_UNABLETOICMP);
404 goto goBye;
405 }
406 INT status;
407 LONG rtt;
408 rtt=pICMP->Ping(ip,dataSize,m_TimeOut,&status);
409 switch(status){
410 case CICMP::ipSuccess:
411 le.m_bReached=TRUE;
412 le.m_RTT=rtt;
413 le.m_Status.Empty();
414 break;
415 case CICMP::ipBuffTooSmall:
416 le.m_Status.LoadString(IDS_PS_INTERNALERROR);
417 break;
418 case CICMP::ipDestNetUnreachable:
419 le.m_Status.LoadString(IDS_PS_NETUNREACHABLE);
420 break;
421 case CICMP::ipDestHostUnreachable:
422 le.m_Status.LoadString(IDS_PS_HOSTUNREACHABLE);
423 break;
424 case CICMP::ipDestProtUnreachable:
425 le.m_Status.LoadString(IDS_PS_PROTUNREACHABLE);
426 break;
427 case CICMP::ipDestPortUnreachable:
428 le.m_Status.LoadString(IDS_PS_PORTUNREACHABLE);
429 case CICMP::ipNoResources:
430 le.m_Status.LoadString(IDS_PS_NORESOURCES);
431 break;
432 case CICMP::ipBadOption:
433 le.m_Status.LoadString(IDS_PS_INTERNALERROR);
434 break;
435 case CICMP::ipHWError:
436 le.m_Status.LoadString(IDS_PS_HWERROR);
437 break;
438 case CICMP::ipPacketTooBig:
439 le.m_Status.LoadString(IDS_PS_BIGPACKET);
440 break;
441 case CICMP::ipTimeOut:
442 le.m_Status.LoadString(IDS_PS_TIMEOUT);
443 break;
444 case CICMP::ipBadRequest:
445 le.m_Status.LoadString(IDS_PS_INTERNALERROR);
446 break;
447 case CICMP::ipBadRoute:
448 le.m_Status.LoadString(IDS_PS_BADROUTE);
449 break;
450 case CICMP::ipTTLExpiredInTransit:
451 le.m_Status.LoadString(IDS_PS_TTLEXPTRANSIT);
452 break;
453 case CICMP::ipTTLExpiredInReasm:
454 le.m_Status.LoadString(IDS_PS_TTLEXPREASM);
455 break;
456 case CICMP::ipParamProblem:
457 le.m_Status.LoadString(IDS_PS_IPARAMP);
458 break;
459 case CICMP::ipSourceQuench:
460 le.m_Status.LoadString(IDS_PS_SOURCEQUENCH);
461 break;
462 case CICMP::ipOptionTooBig:
463 le.m_Status.LoadString(IDS_PS_BIGOPTION);
464 break;
465 case CICMP::ipBadDest:
466 le.m_Status.LoadString(IDS_PS_BADDEST);
467 break;
468 default:
469 le.m_Status.Format(IDS_PS_UNKNOWNERROR,status);
470 break;
471 }
472goBye:
473 if(pICMP) {
474 pICMP->Deinitialize();
475 delete pICMP;
476 }
477 if(le.m_bReached)
478 m_bIsUp=TRUE;
479 else{
480 if(m_bIsUp)
481 m_HowDown=0;
482 m_bIsUp=FALSE;
483 m_HowDown++;
484 }
485
486 le.m_Time=CTime::GetCurrentTime();
487
488CLogEntry *newLE = NULL;
489 if(!m_Log.IsEmpty()){
490 CLogEntry *head = m_Log.GetHead();
491 while(head && (m_bToKill?FALSE:(m_Doc->m_MaxLogTime<(le.m_Time-head->m_Time)))){
492 m_Log.RemoveHead();
493 if(newLE)
494 delete head;
495 else
496 newLE=head;
497 if(m_Log.IsEmpty())
498 head=NULL;
499 else
500 head = m_Log.GetHead();
501 }
502 }
503 if(newLE)
504 (*newLE)=le;
505 else
506 newLE=new CLogEntry(le);
507 m_Log.AddTail(newLE);
508
509 if(m_bToKill)
510 delete this;
511 else{
512 m_bPinged=TRUE;
513 m_Pinged = CTime::GetCurrentTime();
514 if(m_Doc)
515 m_Doc->m_BBView->SendMessage(WM_ACTIVITYCOUNT,(WPARAM)-1,0);
516 if(m_Doc)
517 m_Doc->SetModifiedFlag();
518 if(m_Doc)
519 m_Doc->m_BBView->SendMessage(WM_UPDATETREEBROTHER,TRUE,(LPARAM)this);
520 }
521 return 0;
522}
523
524CLogEntry::CLogEntry()
525{
526 flags=0;
527 m_bReached=FALSE;
528 m_Status.Empty();
529 m_Time=CTime::GetCurrentTime();
530}
531
532CBrother::~CBrother()
533{
534POSITION p = m_Log.GetHeadPosition();
535 while(p){
536 CLogEntry *le = m_Log.GetNext(p);
537 delete le;
538 }
539 m_Log.RemoveAll();
540}
541
542void CBigBrotherDoc::CleanUp()
543{
544 if(m_BBView && m_BBView->m_Pages){
545 m_BBView->m_Pages->SetBrother(NULL);
546 }
547 if(m_RootBrother){
548 while(!m_Brotherhood.IsEmpty()){
549 CBrother *b = m_Brotherhood.GetHead();
550 ASSERT(b);
551 b->m_Doc=this;
552 b->Suicide();
553 }
554 m_RootBrother->m_Doc=this;
555 m_RootBrother->Suicide();
556 m_RootBrother=NULL;
557 }
558 m_MaxLogTime = CTimeSpan(0,1,0,0);
559 m_MaxThreads = 5;
560 m_PingSize = 32;
561 m_bSaveOnShutdown = TRUE;
562 m_AutoSave = CTimeSpan(0,0,30,0);
563 m_AutoSaved = CTime::GetCurrentTime();
564 flags=0;
565}
566
567CBrother* CBigBrotherDoc::GetCurrentBrother()
568{
569 if(m_BBView);
570 return m_BBView->GetCurrentBrother();
571 return NULL;
572}
573
574BOOL CBrother::IsValuable()
575{
576 return !m_Host.IsEmpty();
577}
578
579void CBigBrotherDoc::GetFamily(CBrother *b,CBrotherList *bh)
580{
581 ASSERT(b);
582 ASSERT(bh);
583 ASSERT(m_BBView);
584 m_BBView->GetFamily(b,bh);
585}
586
587void CBigBrotherDoc::OnUpdateBrothersAddbrother(CCmdUI* pCmdUI)
588{
589 ASSERT(m_BBView);
590CBrother *bro = m_BBView->GetCurrentBrother();
591 if(bro)
592 pCmdUI->Enable(bro->m_Daddy!=NULL);
593 else
594 pCmdUI->Enable(FALSE);
595}
596
597void CBigBrotherDoc::OnBrothersAddbrother()
598{
599 ASSERT(m_BBView);
600CBrother *bro = m_BBView->GetCurrentBrother();
601 ASSERT(bro);
602 bro = bro->m_Daddy;
603 ASSERT(bro);
604CBrother *lb = new CBrother(bro);
605 m_Brotherhood.AddTail(lb);
606 SetModifiedFlag();
607 m_BBView->AddBrother(lb);
608 m_BBView->GotoBrother(lb);
609}
610
611BOOL CAction::PlayASound(LPCTSTR sound)
612{
613CString str;
614 str.LoadString(IDS_ACTION_HOST_UP);
615 if(!str.CompareNoCase(sound))
616 return ::PlaySound((LPCTSTR)IDW_HOST_UP,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE);
617 str.LoadString(IDS_ACTION_HOST_DOWN);
618 if(!str.CompareNoCase(sound))
619 return ::PlaySound((LPCTSTR)IDW_HOST_DOWN,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE);
620 str.LoadString(IDS_ACTION_SYSTEM_OK);
621 if(!str.CompareNoCase(sound))
622 return MessageBeep(MB_ICONASTERISK);
623 str.LoadString(IDS_ACTION_SYSTEM_CRITICAL);
624 if(!str.CompareNoCase(sound))
625 return MessageBeep(MB_ICONHAND);
626 return ::PlaySound(sound,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_FILENAME);
627}
628
629CLogEntry& CLogEntry::operator=(CLogEntry& src)
630{
631 m_bReached=src.m_bReached;
632 m_RTT=src.m_RTT;
633 m_Status=src.m_Status;
634 m_Time=src.m_Time;
635 flags=src.flags;
636 return *this;
637}
638
639CLogEntry::CLogEntry(CLogEntry& src)
640{
641 (*this)=src;
642}
643
644void CAction::PerformAction(CBrother *b)
645{
646 if(flags&flagsPlayASound)
647 PlayASound(m_Sound);
648 if(flags&flagsRunCustom){
649 CString cmd = FormatLine(m_Custom,b);
650 system(cmd);
651 }
652}
653
654void CBrother::Serialize(CArchive& ar)
655{
656 ASSERT_VALID(this);
657
658 CObject::Serialize(ar);
659
660CBigBrotherDoc *pDoc = (CBigBrotherDoc*)ar.m_pDocument;
661 ASSERT(pDoc);
662 ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
663
664 if (ar.IsStoring())
665 {
666 if(pDoc->m_BBView && (pDoc->m_BBView->GetTreeCtrl().GetItemState(m_Item,TVIS_EXPANDED)&TVIS_EXPANDED))
667 flags|=flagsExpandedTree;
668 else
669 flags&=~flagsExpandedTree;
670 if(pDoc->GetCurrentBrother()==this)
671 flags|=flagsCurrentBrother;
672 else
673 flags&=~flagsCurrentBrother;
674 // Store to archive
675 ar << (DWORD)this;
676 ar << (DWORD)m_Daddy;
677 ar << flags;
678 ar << m_bLog;
679 ar << m_Host;
680 ar << m_Desc;
681 ar << m_IntervalGood;
682 ar << m_IntervalBad;
683 ar << m_TimeOut;
684 ar << m_Retries;
685 ar << &m_Up;
686 ar << &m_Down;
687 if(pDoc->m_bStoreLastActivity)
688 m_Log.Serialize(ar);
689 else{
690 CLogList tmp;
691 tmp.Serialize(ar);
692 }
693 }else{
694 #ifndefNDEBUG
695 {
696 CString tmp;
697 tmp.Format("Bro-OSchema: %u\n",ar.GetObjectSchema());
698 TRACE0(tmp);
699 }
700#endif
701 // Read from archive
702 DWORD dw;
703 ar >> dw;
704 pDoc->m_ThisMap[dw]=this;
705 ar >> dw;
706 if(dw){
707 VERIFY(pDoc->m_ThisMap.Lookup(dw,m_Daddy));
708 }else
709 m_Daddy=NULL;
710 ar >> flags;
711 ar >> m_bLog;
712 ar >> m_Host;
713 ar >> m_Desc;
714 ar >> m_IntervalGood;
715 ar >> m_IntervalBad;
716 ar >> m_TimeOut;
717 ar >> m_Retries;
718 CAction *act = NULL;
719 ar >> act;
720 m_Up = *act;
721 delete act;
722 act = NULL;
723 ar >> act;
724 m_Down = *act;
725 delete act;
726 m_Log.Serialize(ar);
727 ParentalAdjust();
728 }
729}
730
731void CAction::Serialize(CArchive& ar)
732{
733 ASSERT_VALID(this);
734
735 CObject::Serialize(ar);
736
737 if (ar.IsStoring())
738 {
739 // Store to archive
740 ar << flags;
741 ar << m_Sound;
742 ar << m_Custom;
743 }else{
744 #ifndefNDEBUG
745 {
746 CString tmp;
747 tmp.Format("Act-OSchema: %u\n",ar.GetObjectSchema());
748 TRACE0(tmp);
749 }
750#endif
751 // Read from archive
752 ar >> flags;
753 ar >> m_Sound;
754 ar >> m_Custom;
755 }
756}
757
758void CLogEntry::Serialize(CArchive& ar)
759{
760 ASSERT_VALID(this);
761
762 CObject::Serialize(ar);
763
764 if (ar.IsStoring())
765 {
766 // Store to archive
767 ar << flags;
768 ar << m_Time;
769 ar << m_bReached;
770 ar << m_RTT;
771 ar << m_Status;
772 }else{
773 UINT schema = ar.GetObjectSchema();
774 /*
775 #ifndefNDEBUG
776 {
777 CString tmp;
778 tmp.Format("Log-OSchema: %u\n",schema);
779 TRACE0(tmp);
780 }
781#endif
782 */
783 // Read from archive
784 if(schema>=2){
785 ar >> flags;
786 }
787 ar >> m_Time;
788 ar >> m_bReached;
789 ar >> m_RTT;
790 ar >> m_Status;
791 }
792}
793
794CBrother::CBrother()
795{
796 CleanUp();
797 ParentalAdjust(TRUE);
798}
799
800void CBigBrotherDoc::OnUpdateBrothersDelete(CCmdUI* pCmdUI)
801{
802 pCmdUI->Enable(GetCurrentBrother()!=NULL);
803}
804
805void CBigBrotherDoc::OnBrothersDelete()
806{
807 ASSERT(m_BBView);
808CBrother *b = GetCurrentBrother();
809 ASSERT(b);
810 m_BBView->KillBrother(b);
811 SetModifiedFlag();
812}
813
814void CBrother::Suicide()
815{
816 ASSERT(m_Doc);
817 ASSERT(m_Doc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
818CBigBrotherDoc *pDoc = (CBigBrotherDoc*)m_Doc;
819 if(pDoc->m_BBView && pDoc->m_BBView->m_Pages->m_Brother==this)
820 pDoc->m_BBView->m_Pages->m_Brother=NULL;
821POSITION p = pDoc->m_Brotherhood.Find(this);
822 if(p)
823 pDoc->m_Brotherhood.RemoveAt(p);
824 #ifndefNDEBUG
825 else{
826 ASSERT(!m_Daddy);
827 }
828#endif
829 m_Item=NULL;
830 if(m_bPinging){
831 m_bToKill=TRUE;
832 m_Daddy=NULL;
833 m_Doc=NULL;
834 }else
835 delete this;
836}
837
838BOOL CBrother::operator==(CBrother& b)
839{
840 if(flags!=b.flags)
841 return FALSE;
842 if(m_bLog!=b.m_bLog)
843 return FALSE;
844 if(m_Desc.Compare(b.m_Desc))
845 return FALSE;
846 if(m_Down!=b.m_Down)
847 return FALSE;
848 if(m_Host.Compare(b.m_Host))
849 return FALSE;
850 if(m_IntervalGood!=b.m_IntervalGood || m_IntervalBad!=b.m_IntervalBad)
851 return FALSE;
852 if(m_Retries!=b.m_Retries)
853 return FALSE;
854 if(m_TimeOut!=b.m_TimeOut)
855 return FALSE;
856 if(m_Up!=b.m_Up)
857 return FALSE;
858 return TRUE;
859}
860
861BOOL CBrother::operator!=(CBrother& b)
862{
863 return !((*this)==b);
864}
865
866BOOL CAction::operator==(CAction& a)
867{
868 if(flags!=a.flags)
869 return FALSE;
870 if(m_Custom.Compare(a.m_Custom))
871 return FALSE;
872 if(m_Sound.Compare(a.m_Sound))
873 return FALSE;
874 return TRUE;
875}
876
877BOOL CAction::operator!=(CAction& a)
878{
879 return !((*this)==a);
880}
881
882CBrother& CBrother::operator=(CBrother& b)
883{
884 flags=b.flags;
885 m_bLog=b.m_bLog;
886 m_Desc=b.m_Desc;
887 m_Down=b.m_Down;
888 m_Host=b.m_Host;
889 m_IntervalGood=b.m_IntervalGood;
890 m_IntervalBad=b.m_IntervalBad;
891 m_Retries=b.m_Retries;
892 m_TimeOut=b.m_TimeOut;
893 m_Up=b.m_Up;
894 return *this;
895}
896
897BOOL CBigBrotherDoc::SaveModified()
898{
899 if(((CMainFrame*)(AfxGetApp()->m_pMainWnd))->m_bShuttingDown && m_bSaveOnShutdown){
900 DoFileSave();
901 ((CMainFrame*)(AfxGetApp()->m_pMainWnd))->m_bShuttingDown = FALSE;
902 return TRUE;
903 }
904 return CDocument::SaveModified();
905}
906
907void CBrother::AppendSeparator()
908{
909CLogEntry *le = new CLogEntry();
910 le->flags=CLogEntry::flagsSeparator;
911 m_Log.AddTail(le);
912}
913
914void CBigBrotherDoc::OnFilePreferences()
915{
916CPreferences prefs(AfxGetApp()->m_pMainWnd);
917 prefs.m_AutosaveMinutes=m_AutoSave.GetTotalMinutes();
918 prefs.m_LogFile=m_LogFile;
919 prefs.m_MaxThreads=m_MaxThreads;
920 prefs.m_PingSize=m_PingSize;
921 prefs.m_SaveOnShutdown=m_bSaveOnShutdown;
922 prefs.m_LogMins=m_MaxLogTime.GetTotalMinutes();
923 prefs.m_bStoreLastActivity=m_bStoreLastActivity;
924 if(prefs.DoModal()==IDOK){
925 m_AutoSave = CTimeSpan(0,prefs.m_AutosaveMinutes/60,prefs.m_AutosaveMinutes%60,0);
926 m_LogFile=prefs.m_LogFile;
927 m_MaxThreads=prefs.m_MaxThreads;
928 m_PingSize=prefs.m_PingSize;
929 m_bSaveOnShutdown=prefs.m_SaveOnShutdown;
930 m_MaxLogTime = CTimeSpan(0,prefs.m_LogMins/60,prefs.m_LogMins%60,0);
931 m_bStoreLastActivity=prefs.m_bStoreLastActivity;
932 }
933}
934
935void CBigBrotherDoc::LogLine(LPCTSTR str)
936{
937 if(!m_LogFile.IsEmpty()){
938 TRY{
939 CFile file(m_LogFile,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite|CFile::typeBinary);
940 file.SeekToEnd();
941 file.Write(str,strlen(str));
942 file.Write("\r\n",2);
943 file.Close();
944 }CATCH(CFileException, e){
945 #ifndefNDEBUG
946 afxDump << "Logging error: " << e->m_cause << "\n";
947#endif
948 }END_CATCH
949 }
950}
951
952CString CAction::FormatLine(LPCTSTR fmt,CBrother *b)
953{
954 ASSERT(b);
955CString str = fmt;
956CString rv;
957 while(!str.IsEmpty()){
958 int pe = str.Find('%');
959 if(pe<0){
960 rv+=str;
961 str.Empty();
962 }else{
963 rv+=str.Left(pe);
964 str = str.Mid(pe+1);
965 if(!str.IsEmpty()){
966 switch(str[0]){
967 case'%':
968 rv+="%";
969 break;
970 case'h':
971 case'H':
972 rv+=b->m_Host;
973 break;
974 case'd':
975 case'D':
976 rv+=b->m_Desc;
977 break;
978 }
979 str=str.Mid(1);
980 }else{
981 rv+="%"+str;
982 str.Empty();
983 }
984 }
985 }
986 return rv;
987}
988
989void CBigBrotherDoc::OnUpdateFilePause(CCmdUI* pCmdUI)
990{
991 pCmdUI->SetCheck((flags&flagsSuspended)?1:0);
992}
993
994void CBigBrotherDoc::OnFilePause()
995{
996 flags^=flagsSuspended;
997 if(!(flags&flagsSuspended)){
998 ASSERT(m_RootBrother);
999 m_RootBrother->AppendSeparator();
1000 POSITION p = m_Brotherhood.GetHeadPosition();
1001 while(p){
1002 CBrother *b = m_Brotherhood.GetNext(p);
1003 ASSERT(b);
1004 b->AppendSeparator();
1005 }
1006 CheckPendingQueue();
1007 }else{
1008 ASSERT(m_BBView);
1009 m_BBView->KillTimer(TM_CHECK);
1010 }
1011}
1012
1013void CBigBrotherDoc::DeleteContents()
1014{
1015 CleanUp();
1016 CDocument::DeleteContents();
1017}
1018
1019void CBigBrotherDoc::OnCloseDocument()
1020{
1021 CleanUp();
1022 CDocument::OnCloseDocument();
1023}
1024
1025void CBigBrotherDoc::OnUpdateViewHostproperties(CCmdUI* pCmdUI)
1026{
1027 pCmdUI->SetCheck((flags&flagsShowProps)?1:0);
1028}
1029
1030void CBigBrotherDoc::OnViewHostproperties()
1031{
1032 ASSERT(m_BBView);
1033 ASSERT(m_BBView->m_Pages);
1034 flags^=flagsShowProps;
1035 if(flags&flagsShowProps)
1036 m_BBView->m_Pages->ShowWindow(SW_SHOW);
1037 else
1038 m_BBView->m_Pages->ShowWindow(SW_HIDE);
1039}
diff --git a/BigBrotherDoc.h b/BigBrotherDoc.h
new file mode 100644
index 0000000..3343e18
--- a/dev/null
+++ b/BigBrotherDoc.h
@@ -0,0 +1,183 @@
1// BigBrotherDoc.h : interface of the CBigBrotherDoc class
2//
3/////////////////////////////////////////////////////////////////////////////
4
5class CLogEntry : public CObject {
6public:
7 enum{
8 flagsSeparator=1
9 };
10 UINT flags;
11 virtual void Serialize(CArchive& ar);
12 CLogEntry(CLogEntry& src);
13 CLogEntry& operator=(CLogEntry& src);
14 BOOL m_bReached;
15 CString m_Status;
16 ULONG m_RTT;
17 CTime m_Time;
18
19 CLogEntry();
20 DECLARE_SERIAL(CLogEntry)
21};
22
23 typedef CTypedPtrList<CObList,CLogEntry*>CLogList;
24
25class CBrother;
26 class CAction: public CObject {
27public:
28 static CString FormatLine(LPCTSTR fmt,CBrother *b);
29 BOOL operator!=(CAction& a);
30 BOOL operator==(CAction& a);
31 virtual void Serialize(CArchive& ar);
32 void PerformAction(CBrother *b);
33 static BOOL PlayASound(LPCTSTR sound);
34 CAction& operator=(CAction& src);
35 void CleanUp();
36 enum{
37 flagsPlayASound = 1,
38 flagsRunCustom = 2
39 };
40 UINT flags;
41 CString m_Sound;
42 CString m_Custom;
43
44 CAction();
45 DECLARE_SERIAL(CAction)
46};
47
48 class CBrother : public CObject{
49public:
50 void AppendSeparator();
51 CBrother& operator=(CBrother& b);
52 BOOL operator!=(CBrother& b);
53 BOOL operator==(CBrother& b);
54 BOOL m_bToKill;
55 void Suicide();
56 virtual void Serialize(CArchive& ar);
57 BOOL m_bUp;
58 CRect m_rc;
59 BOOL IsValuable();
60 ~CBrother();
61 UINT m_HowDown;
62 BOOL m_bPinging;
63 UINT Check();
64 CDocument* m_Doc;
65 static UINT DoCheck(LPVOID pParam);
66 BOOL m_bIsUp;
67 BOOL m_bPending;
68 CTime m_Pinged;
69 BOOL m_bPinged;
70 CLogList m_Log;
71 HTREEITEM m_Item;
72 void ParentalAdjust(BOOL cleanUp=FALSE);
73 void CleanUp();
74 CBrother(CBrother* daddy);
75 CBrother* m_Daddy;
76 UINT m_Retries;
77 DWORD m_TimeOut;
78 UINT m_IntervalBad;
79 UINT m_IntervalGood;
80 BOOL m_bLog;
81 CAction m_Down;
82 CAction m_Up;
83 enum{
84 flagsOverrideIntervals=1,
85 flagsOverrideTimeout=2,
86 flagsOverrideRetries=4,
87 flagsOverrideActions=8,
88 flagsOverrideLogging=16,
89 flagsExpandedTree=32,
90 flagsCurrentBrother=64
91 };
92 UINT flags;
93 CString m_Desc;
94 CString m_Host;
95
96 CBrother();
97 DECLARE_SERIAL(CBrother)
98};
99
100 typedef CTypedPtrList<CObList,CBrother*>CBrotherList;
101 typedef CMap<DWORD,DWORD,CBrother*,CBrother*>CThisMap;
102
103class CBigBrotherView;
104class CActivityView;
105class CBigBrotherDoc : public CDocument
106{
107protected: // create from serialization only
108 CBigBrotherDoc();
109 DECLARE_SERIAL(CBigBrotherDoc)
110
111// Attributes
112public:
113 BOOL m_bStoreLastActivity;
114 enum{
115 flagsSuspended=1,
116 flagsShowProps=2
117 };
118 UINT flags;
119 CTime m_AutoSaved;
120 void LogLine(LPCTSTR str);
121 CTimeSpan m_AutoSave;
122 BOOL m_bSaveOnShutdown;
123 CThisMap m_ThisMap;
124 CString m_LogFile;
125 void GetFamily(CBrother *b,CBrotherList *bh);
126 CBrother* GetCurrentBrother();
127 void CleanUp();
128 UINT m_PingSize;
129 int m_MaxThreads;
130 int m_Threads;
131 void TryBrother(CBrother *b);
132 BOOL CheckPendingBrother(CBrother* b,CTime& currentTime,CTime& nearestCheck,BOOL nearested);
133 void CheckPendingQueue();
134 CTimeSpan m_MaxLogTime;
135 CActivityView *m_AView;
136 CBigBrotherView* m_BBView;
137 CBrotherList m_Brotherhood;
138 CBrother* m_RootBrother;
139
140// Operations
141public:
142
143// Overrides
144 // ClassWizard generated virtual function overrides
145 //{{AFX_VIRTUAL(CBigBrotherDoc)
146 public:
147 virtual BOOL OnNewDocument();
148 virtual void Serialize(CArchive& ar);
149 virtual void OnChangedViewList();
150 virtual void DeleteContents();
151 virtual void OnCloseDocument();
152 protected:
153 virtual BOOL SaveModified();
154 //}}AFX_VIRTUAL
155
156// Implementation
157public:
158 virtual ~CBigBrotherDoc();
159#ifdef _DEBUG
160 virtual void AssertValid() const;
161 virtual void Dump(CDumpContext& dc) const;
162#endif
163
164protected:
165
166// Generated message map functions
167protected:
168 //{{AFX_MSG(CBigBrotherDoc)
169 afx_msg void OnBrothersNew();
170 afx_msg void OnUpdateBrothersAddbrother(CCmdUI* pCmdUI);
171 afx_msg void OnBrothersAddbrother();
172 afx_msg void OnUpdateBrothersDelete(CCmdUI* pCmdUI);
173 afx_msg void OnBrothersDelete();
174 afx_msg void OnFilePreferences();
175 afx_msg void OnUpdateFilePause(CCmdUI* pCmdUI);
176 afx_msg void OnFilePause();
177 afx_msg void OnUpdateViewHostproperties(CCmdUI* pCmdUI);
178 afx_msg void OnViewHostproperties();
179 //}}AFX_MSG
180 DECLARE_MESSAGE_MAP()
181};
182
183/////////////////////////////////////////////////////////////////////////////
diff --git a/BigBrotherView.cpp b/BigBrotherView.cpp
new file mode 100644
index 0000000..1fb529b
--- a/dev/null
+++ b/BigBrotherView.cpp
@@ -0,0 +1,485 @@
1// BigBrotherView.cpp : implementation of the CBigBrotherView class
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6
7#include "BigBrotherDoc.h"
8#include "BigBrotherView.h"
9#include "HostPropertyPages.h"
10#include "MainFrm.h"
11
12#ifdef _DEBUG
13#define new DEBUG_NEW
14#undef THIS_FILE
15static char THIS_FILE[] = __FILE__;
16#endif
17
18/////////////////////////////////////////////////////////////////////////////
19// CBigBrotherView
20
21IMPLEMENT_DYNCREATE(CBigBrotherView, CTreeView)
22
23BEGIN_MESSAGE_MAP(CBigBrotherView, CTreeView)
24 //{{AFX_MSG_MAP(CBigBrotherView)
25 ON_WM_DESTROY()
26 ON_WM_CREATE()
27 ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelchanged)
28 ON_NOTIFY_REFLECT(NM_RETURN, OnReturn)
29 ON_MESSAGE(WM_ACTIVITYCOUNT, OnActivityCount)
30 ON_MESSAGE(WM_UPDATETREEBROTHER, OnUpdateTreeBrother)
31 ON_MESSAGE(WM_CHECKQUEUE, OnCheckQueue)
32 ON_WM_TIMER()
33 ON_WM_CONTEXTMENU()
34 ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
35 ON_WM_CHAR()
36 ON_MESSAGE(WM_BROTHERUPDOWN, OnUpDown)
37 ON_NOTIFY_REFLECT(TVN_ITEMEXPANDED, OnItemexpanded)
38 ON_WM_SETFOCUS()
39 //}}AFX_MSG_MAP
40 // Standard printing commands
41 ON_COMMAND(ID_FILE_PRINT, CTreeView::OnFilePrint)
42 ON_COMMAND(ID_FILE_PRINT_DIRECT, CTreeView::OnFilePrint)
43 ON_COMMAND(ID_FILE_PRINT_PREVIEW, CTreeView::OnFilePrintPreview)
44END_MESSAGE_MAP()
45
46/////////////////////////////////////////////////////////////////////////////
47// CBigBrotherView construction/destruction
48
49CBigBrotherView::CBigBrotherView()
50 : m_Pages(NULL)
51{
52 // Load Images
53 m_Images.Create(16,16,TRUE,5,2);
54CWinApp *app=AfxGetApp();
55 VERIFY((m_iNoHost=m_Images.Add(app->LoadIcon(IDI_NOHOST)))>=0);
56 VERIFY((m_iHost=m_Images.Add(app->LoadIcon(IDI_HOST)))>=0);
57 VERIFY((m_iGoingDown=m_Images.Add(app->LoadIcon(IDI_GOINGDOWN)))>=0);
58 VERIFY((m_iHostDown=m_Images.Add(app->LoadIcon(IDI_HOSTDOWN)))>=0);
59 VERIFY((m_iPending=m_Images.Add(app->LoadIcon(IDI_PENDING)))>=0);
60 VERIFY((m_iPinging=m_Images.Add(app->LoadIcon(IDI_PINGING)))>=0);
61}
62
63CBigBrotherView::~CBigBrotherView()
64{
65}
66
67BOOL CBigBrotherView::PreCreateWindow(CREATESTRUCT& cs)
68{
69 return CTreeView::PreCreateWindow(cs);
70}
71
72/////////////////////////////////////////////////////////////////////////////
73// CBigBrotherView drawing
74
75void CBigBrotherView::OnDraw(CDC* pDC)
76{
77 CBigBrotherDoc* pDoc = GetDocument();
78 ASSERT(pDoc);
79 ASSERT_VALID(pDoc);
80}
81
82void CBigBrotherView::OnInitialUpdate()
83{
84 CTreeView::OnInitialUpdate();
85
86CWinApp *app=AfxGetApp();
87 ASSERT(app);
88CTreeCtrl& ctl = GetTreeCtrl();
89CBigBrotherDoc* doc = GetDocument();
90 ASSERT(doc);
91 ctl.SetImageList(&m_Images,TVSIL_NORMAL);
92 ctl.ModifyStyle(0,TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS);
93 ctl.DeleteAllItems();
94POSITION p = doc->m_Brotherhood.GetHeadPosition();
95 VERIFY(doc->m_RootBrother);
96 AddBrother(doc->m_RootBrother);
97 while(p){
98 CBrother *b = (CBrother*)doc->m_Brotherhood.GetNext(p);
99 ASSERT(b->m_Daddy);
100 AddBrother(b);
101 }
102 SetupExpansion(doc->m_RootBrother);
103 doc->UpdateAllViews(this);
104CRect rc;
105 GetClientRect(rc);
106 ClientToScreen(rc);
107CRect prc;
108 m_Pages->GetWindowRect(prc);
109CRect nrc;
110 if(m_Pages->m_InitialPosition.x<0 || m_Pages->m_InitialPosition.y<0){
111 nrc.bottom=rc.bottom; nrc.right=rc.right;
112 nrc.top=nrc.bottom-prc.Height(); nrc.left=nrc.right-prc.Width();
113 }else{
114 nrc.left=m_Pages->m_InitialPosition.x;nrc.top=m_Pages->m_InitialPosition.y;
115 nrc.right=nrc.left+prc.Width(); nrc.bottom=nrc.top+prc.Height();
116 }
117 m_Pages->MoveWindow(nrc,FALSE);
118 m_Pages->ShowWindow((doc->flags&CBigBrotherDoc::flagsShowProps)?SW_SHOW:SW_HIDE);
119}
120
121/////////////////////////////////////////////////////////////////////////////
122// CBigBrotherView printing
123
124BOOL CBigBrotherView::OnPreparePrinting(CPrintInfo* pInfo)
125{
126 // default preparation
127 return DoPreparePrinting(pInfo);
128}
129
130void CBigBrotherView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
131{
132}
133
134void CBigBrotherView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
135{
136}
137
138/////////////////////////////////////////////////////////////////////////////
139// CBigBrotherView diagnostics
140
141#ifdef _DEBUG
142void CBigBrotherView::AssertValid() const
143{
144 CTreeView::AssertValid();
145}
146
147void CBigBrotherView::Dump(CDumpContext& dc) const
148{
149 CTreeView::Dump(dc);
150}
151
152CBigBrotherDoc* CBigBrotherView::GetDocument() // non-debug version is inline
153{
154 if(m_pDocument)
155 ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
156 return (CBigBrotherDoc*)m_pDocument;
157}
158#endif //_DEBUG
159
160/////////////////////////////////////////////////////////////////////////////
161// CBigBrotherView message handlers
162
163void CBigBrotherView::OnDestroy()
164{
165 CTreeView::OnDestroy();
166
167 if(m_Pages){
168 m_Pages->DestroyWindow();
169 delete m_Pages;
170 m_Pages=NULL;
171 }
172}
173
174int CBigBrotherView::OnCreate(LPCREATESTRUCT lpCreateStruct)
175{
176 if (CTreeView::OnCreate(lpCreateStruct) == -1)
177 return -1;
178
179 m_Pages = new CHostPropertyPages(IDS_PROPS_TITLE);
180 m_Pages->m_Daddy=this;
181 m_Pages->Create(this,WS_POPUP||WS_CLIPSIBLINGS|WS_BORDER|WS_DLGFRAME,WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE);
182
183 return 0;
184}
185
186HTREEITEM CBigBrotherView::FindItem(CBrother* brother)
187{
188DWORD b = (DWORD)brother;
189CTreeCtrl& ctl = GetTreeCtrl();
190HTREEITEM rv = ctl.GetRootItem();
191 ASSERT(rv);
192 do{
193 if(ctl.GetItemData(rv)==b)
194 return rv;
195 }while((rv=ctl.GetNextItem(rv,TVGN_NEXT)));
196 ASSERT(0);
197 return NULL;
198}
199
200CBrother* CBigBrotherView::GetCurrentBrother()
201{
202 HTREEITEMhItem = GetTreeCtrl().GetSelectedItem();
203 if(!hItem)
204 return NULL;
205CBrother *rv = (CBrother*)GetTreeCtrl().GetItemData(hItem);
206 ASSERT(rv);
207 return rv;
208}
209
210void CBigBrotherView::AddBrother(CBrother *b)
211{
212HTREEITEM hDaddy=TVI_ROOT;
213 if(b->m_Daddy){
214 ASSERT(b->m_Daddy->m_Item);
215 hDaddy=b->m_Daddy->m_Item;
216 }
217CString tmp;
218 tmp=b->m_Desc;
219 if(tmp.IsEmpty())
220 tmp.LoadString(IDS_NODESC);
221 b->AppendSeparator();
222 b->m_Item=GetTreeCtrl().InsertItem(TVIF_PARAM|TVIF_TEXT,tmp,0,0,0,0,(LPARAM)b,hDaddy,TVI_LAST);
223 ASSERT(b->m_Item);
224 UpdateBrother(b);
225}
226
227void CBigBrotherView::GotoBrother(CBrother *b)
228{
229 ASSERT(b->m_Item);
230 GetTreeCtrl().SelectItem(b->m_Item);
231}
232
233void CBigBrotherView::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
234{
235 NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
236 m_Pages->SetBrother(GetCurrentBrother());
237CBigBrotherDoc *pDoc = GetDocument();
238 if(pDoc)
239 pDoc->UpdateAllViews(this);
240 *pResult = 0;
241}
242
243void CBigBrotherView::UpdateBrother(CBrother* b)
244{
245 if(!b->m_Item)
246 return;
247 ASSERT(b->m_Item);
248CString tmp;
249 tmp=b->m_Desc;
250 if(tmp.IsEmpty())
251 tmp.LoadString(IDS_NODESC);
252 GetTreeCtrl().SetItemText(b->m_Item,tmp);
253 intimage = m_iNoHost;
254 if(!b->m_Host.IsEmpty()){
255 if(b->m_bPending)
256 image = m_iPending;
257 else if(b->m_bPinging)
258 image=m_iPinging;
259 else if(b->m_bPinged){
260 if(b->m_bIsUp){
261 image=m_iHost;
262 if(!b->m_bUp){
263 PostMessage(WM_BROTHERUPDOWN,TRUE,(LPARAM)b);
264 b->m_bUp=TRUE;
265 }
266 }else{
267 if(b->m_HowDown>=b->m_Retries){
268 image=m_iHostDown;
269 if(b->m_bUp){
270 PostMessage(WM_BROTHERUPDOWN,FALSE,(LPARAM)b);
271 b->m_bUp=FALSE;
272 }
273 }else
274 image=m_iGoingDown;
275 b->m_HowDown=min(b->m_HowDown,b->m_Retries+1);
276 }
277 }else
278 image=m_iHost;
279 }
280 GetTreeCtrl().SetItemImage(b->m_Item,image,image);
281 PostMessage(WM_CHECKQUEUE);
282}
283
284void CBigBrotherView::OnReturn(NMHDR* pNMHDR, LRESULT* pResult)
285{
286CBigBrotherDoc *pDoc = GetDocument();
287 ASSERT(pDoc);
288 pDoc->flags|=CBigBrotherDoc::flagsShowProps;
289 m_Pages->ShowWindow(SW_SHOW);
290 m_Pages->SetFocus();
291 *pResult = 0;
292}
293
294LRESULT CBigBrotherView::OnActivityCount(WPARAM wP,LPARAM)
295{
296CMainFrame *mf = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
297 ASSERT(mf);
298 ASSERT(mf->IsKindOf(RUNTIME_CLASS(CMainFrame)));
299int crement = (int)wP;
300CBigBrotherDoc *doc = GetDocument();
301 ASSERT(doc);
302 ASSERT(doc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
303 doc->m_Threads+=crement;
304 if(doc->m_Threads<0)
305 doc->m_Threads=0;
306 if(doc->m_Threads){
307 mf->m_PingBar.Play(0,(UINT)-1,(UINT)-1);
308 }else{
309 mf->m_PingBar.Stop();
310 mf->m_PingBar.Seek(0);
311 }
312 if(crement<0)
313 PostMessage(WM_CHECKQUEUE);
314 return doc->m_Threads;
315}
316
317LRESULT CBigBrotherView::OnUpdateTreeBrother(WPARAM wP,LPARAM lP)
318{
319CBrother *b = (CBrother*)lP;
320 ASSERT(b);
321 if(wP)
322 b->m_bPinging=FALSE;
323 UpdateBrother(b);
324CBigBrotherDoc *pDoc = GetDocument();
325 if(pDoc)
326 pDoc->UpdateAllViews(this,0,b);
327 return 0;
328}
329
330LRESULT CBigBrotherView::OnCheckQueue(WPARAM,LPARAM)
331{
332CBigBrotherDoc *doc = GetDocument();
333 if(doc)
334 doc->CheckPendingQueue();
335 return 0;
336}
337
338void CBigBrotherView::OnTimer(UINT nIDEvent)
339{
340 switch(nIDEvent){
341 case TM_CHECK:
342 KillTimer(TM_CHECK);
343 PostMessage(WM_CHECKQUEUE);
344 break;
345 }
346 CTreeView::OnTimer(nIDEvent);
347}
348
349void CBigBrotherView::GetFamily(CBrother* b,CBrotherList* bh)
350{
351 if(b->IsValuable())
352 bh->AddTail(b);
353 ASSERT(b->m_Item);
354CTreeCtrl& ctl = GetTreeCtrl();
355 if(!(ctl.GetItemState(b->m_Item,TVIS_EXPANDED)&TVIS_EXPANDED))
356 return;
357HTREEITEM hItem = ctl.GetNextItem(b->m_Item,TVGN_CHILD);
358 while(hItem){
359 CBrother *bb = (CBrother*)ctl.GetItemData(hItem);
360 ASSERT(bb);
361 GetFamily(bb,bh);
362 hItem = ctl.GetNextItem(hItem,TVGN_NEXT);
363 }
364}
365
366void CBigBrotherView::OnContextMenu(CWnd* pWnd, CPoint point)
367{
368 if(point.x<0 || point.y<0){
369 CBrother *b = GetCurrentBrother();
370 ASSERT(b);
371 CRect rc;
372 GetTreeCtrl().GetItemRect(b->m_Item,&rc,TRUE);
373 point = rc.TopLeft();
374 ClientToScreen(&point);
375 }
376 ContextMenu(point);
377}
378
379void CBigBrotherView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
380{
381CPoint pt;
382 VERIFY(GetCursorPos(&pt));
383 ContextMenu(pt);
384 *pResult = 0;
385}
386
387void CBigBrotherView::ContextMenu(CPoint pt)
388{
389CMenu m;
390 VERIFY(m.LoadMenu(IDR_MAINFRAME));
391 CMenu *popUp = m.GetSubMenu(1);// Brothers
392 ASSERT(popUp);
393 popUp->TrackPopupMenu(TPM_CENTERALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,AfxGetApp()->m_pMainWnd);
394}
395
396void CBigBrotherView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
397{
398}
399
400LRESULT CBigBrotherView::OnUpDown(WPARAM wP,LPARAM lP)
401{
402BOOL isUp = (BOOL)wP;
403CBrother *b = (CBrother*)lP;
404 ASSERT(b);
405 UINTstrResource;
406 b->ParentalAdjust();
407 if(isUp){
408 b->m_Up.PerformAction(b);
409 strResource = IDS_LOG_HOSTUP;
410 }else{
411 b->m_Down.PerformAction(b);
412 strResource = IDS_LOG_HOSTDOWN;
413 }
414CString logLine;
415 logLine.Format(strResource,(LPCTSTR)b->m_Desc,(LPCTSTR)b->m_Host);
416 logLine=b->m_Pinged.Format(IDS_LOG_DATEFORMAT)+" "+logLine;
417CBigBrotherDoc *pDoc = GetDocument();
418 ASSERT(pDoc);
419 pDoc->LogLine(logLine);
420 return 0;
421}
422
423void CBigBrotherView::KillBrother(CBrother *b)
424{
425 ASSERT(b->m_Item);
426CTreeCtrl& ctl = GetTreeCtrl();
427HTREEITEM hItem = ctl.GetNextItem(b->m_Item,TVGN_CHILD);
428 while(hItem){
429 CBrother *bb = (CBrother*)ctl.GetItemData(hItem);
430 ASSERT(bb);
431 KillBrother(bb);
432 hItem = ctl.GetNextItem(b->m_Item,TVGN_CHILD);
433 }
434 if(b->m_Daddy)
435 KillOneBrother(b);
436 // ??? Else - Cleanup?
437}
438
439void CBigBrotherView::KillOneBrother(CBrother *b)
440{
441 ASSERT(b);
442 ASSERT(b->m_Item);
443CTreeCtrl& ctl = GetTreeCtrl();
444 ASSERT(!ctl.ItemHasChildren(b->m_Item));
445 ctl.DeleteItem(b->m_Item);
446 VERIFY(b->m_Doc=GetDocument());
447 b->m_Item=NULL;
448 b->Suicide();
449}
450
451void CBigBrotherView::SetupExpansion(CBrother *b)
452{
453 ASSERT(b->m_Item);
454CTreeCtrl& ctl = GetTreeCtrl();
455 if(b->flags&CBrother::flagsExpandedTree)
456 ctl.Expand(b->m_Item,TVE_EXPAND);
457HTREEITEM hItem = ctl.GetNextItem(b->m_Item,TVGN_CHILD);
458 while(hItem){
459 CBrother *bb = (CBrother*)ctl.GetItemData(hItem);
460 ASSERT(bb);
461 SetupExpansion(bb);
462 hItem = ctl.GetNextItem(bb->m_Item,TVGN_NEXT);
463 }
464 if(b->flags&CBrother::flagsCurrentBrother)
465 GotoBrother(b);
466}
467
468void CBigBrotherView::OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult)
469{
470NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
471CBigBrotherDoc *pDoc = GetDocument();
472 if(pDoc)
473 pDoc->UpdateAllViews(this);
474 *pResult = 0;
475}
476
477void CBigBrotherView::OnSetFocus(CWnd* pOldWnd)
478{
479 CTreeView::OnSetFocus(pOldWnd);
480
481CBigBrotherDoc *pDoc = GetDocument();
482 if(!(pDoc && m_Pages))
483 return;
484 m_Pages->ShowWindow((pDoc->flags&CBigBrotherDoc::flagsShowProps)?SW_SHOW:SW_HIDE);
485}
diff --git a/BigBrotherView.h b/BigBrotherView.h
new file mode 100644
index 0000000..5dda0ac
--- a/dev/null
+++ b/BigBrotherView.h
@@ -0,0 +1,89 @@
1// BigBrotherView.h : interface of the CBigBrotherView class
2//
3/////////////////////////////////////////////////////////////////////////////
4
5class CHostPropertyPages;
6class CBrother;
7class CBigBrotherDoc;
8 typedef CTypedPtrList<CObList,CBrother*>CBrotherList;
9class CBigBrotherView : public CTreeView
10{
11protected: // create from serialization only
12 CBigBrotherView();
13 DECLARE_DYNCREATE(CBigBrotherView)
14
15// Attributes
16public:
17 void SetupExpansion(CBrother *b);
18 void KillOneBrother(CBrother *b);
19 void KillBrother(CBrother *b);
20 void ContextMenu(CPoint pt);
21 void GetFamily(CBrother* b,CBrotherList* bh);
22 int m_iPinging;
23 int m_iPending;
24 int m_iHostDown;
25 int m_iGoingDown;
26 int m_iHost;
27 int m_iNoHost;
28 CImageList m_Images;
29 void UpdateBrother(CBrother* b);
30 void GotoBrother(CBrother *b);
31 void AddBrother(CBrother *b);
32 CBrother* GetCurrentBrother();
33 HTREEITEM FindItem(CBrother* brother);
34 CHostPropertyPages* m_Pages;
35 CBigBrotherDoc* GetDocument();
36
37// Operations
38public:
39
40// Overrides
41 // ClassWizard generated virtual function overrides
42 //{{AFX_VIRTUAL(CBigBrotherView)
43 public:
44 virtual void OnDraw(CDC* pDC); // overridden to draw this view
45 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
46 protected:
47 virtual void OnInitialUpdate(); // called first time after construct
48 virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
49 virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
50 virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
51 //}}AFX_VIRTUAL
52
53// Implementation
54public:
55 virtual ~CBigBrotherView();
56#ifdef _DEBUG
57 virtual void AssertValid() const;
58 virtual void Dump(CDumpContext& dc) const;
59#endif
60
61protected:
62
63// Generated message map functions
64protected:
65 //{{AFX_MSG(CBigBrotherView)
66 afx_msg void OnDestroy();
67 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
68 afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
69 afx_msg void OnReturn(NMHDR* pNMHDR, LRESULT* pResult);
70 afx_msg LRESULT OnActivityCount(WPARAM,LPARAM);
71 afx_msg LRESULT OnUpdateTreeBrother(WPARAM,LPARAM);
72 afx_msg LRESULT OnCheckQueue(WPARAM,LPARAM);
73 afx_msg void OnTimer(UINT nIDEvent);
74 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
75 afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
76 afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
77 afx_msg LRESULT OnUpDown(WPARAM,LPARAM);
78 afx_msg void OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult);
79 afx_msg void OnSetFocus(CWnd* pOldWnd);
80 //}}AFX_MSG
81 DECLARE_MESSAGE_MAP()
82};
83
84#ifndef _DEBUG // debug version in BigBrotherView.cpp
85inline CBigBrotherDoc* CBigBrotherView::GetDocument()
86 { return (CBigBrotherDoc*)m_pDocument; }
87#endif
88
89/////////////////////////////////////////////////////////////////////////////
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d3b2450
--- a/dev/null
+++ b/COPYING
@@ -0,0 +1,19 @@
1Copyright (c) 1996, 2002 Klever Group (http://www.klever.net/)
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of
4this software and associated documentation files (the "Software"), to deal in
5the Software without restriction, including without limitation the rights to
6use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7of the Software, and to permit persons to whom the Software is furnished to do
8so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19SOFTWARE.
diff --git a/GeneralPage.cpp b/GeneralPage.cpp
new file mode 100644
index 0000000..58ebe74
--- a/dev/null
+++ b/GeneralPage.cpp
@@ -0,0 +1,168 @@
1// GeneralPage.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "GeneralPage.h"
7#include "HostPropertyPages.h"
8#include "BigBrotherDoc.h"
9#include "BigBrotherView.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CGeneralPage property page
19
20IMPLEMENT_DYNCREATE(CGeneralPage, CPropertyPage)
21
22CGeneralPage::CGeneralPage() : CPropertyPage(CGeneralPage::IDD)
23{
24 //{{AFX_DATA_INIT(CGeneralPage)
25 m_Desc = _T("");
26 m_Host = _T("");
27 m_LogActivity = FALSE;
28 //}}AFX_DATA_INIT
29}
30
31CGeneralPage::~CGeneralPage()
32{
33}
34
35void CGeneralPage::DoDataExchange(CDataExchange* pDX)
36{
37 CPropertyPage::DoDataExchange(pDX);
38 //{{AFX_DATA_MAP(CGeneralPage)
39 DDX_Control(pDX, IDC_LOG_ACTIVITY, m_LogActivityCtl);
40 DDX_Control(pDX, IDC_HOST, m_HostCtl);
41 DDX_Control(pDX, IDC_DESC, m_DescCtl);
42 DDX_Text(pDX, IDC_DESC, m_Desc);
43 DDX_Text(pDX, IDC_HOST, m_Host);
44 DDX_Check(pDX, IDC_LOG_ACTIVITY, m_LogActivity);
45 //}}AFX_DATA_MAP
46}
47
48
49BEGIN_MESSAGE_MAP(CGeneralPage, CPropertyPage)
50 //{{AFX_MSG_MAP(CGeneralPage)
51 ON_EN_CHANGE(IDC_HOST, OnChangeHost)
52 ON_BN_CLICKED(IDC_LOG_ACTIVITY, OnLogActivity)
53 //}}AFX_MSG_MAP
54END_MESSAGE_MAP()
55
56/////////////////////////////////////////////////////////////////////////////
57// CGeneralPage message handlers
58
59void CGeneralPage::OnChangeHost()
60{
61CString h,d;
62 m_HostCtl.GetWindowText(h);
63 m_DescCtl.GetWindowText(d);
64 if(d==m_Host){
65 m_Desc=h;
66 m_Host=h;
67 m_DescCtl.SetWindowText(m_Desc);
68 }
69}
70
71void CGeneralPage::OnLogActivity()
72{
73 ASSERT(m_dad->m_Brother);
74 if(!m_dad->m_Brother->m_Daddy){
75 int tmp = m_LogActivityCtl.GetCheck();
76 if(tmp==2){
77 if(m_LogActivity)
78 tmp=0;
79 else
80 tmp=1;
81 }
82 m_LogActivity=tmp;
83 }else
84 m_LogActivity=m_LogActivityCtl.GetCheck();
85 m_LogActivityCtl.SetCheck(m_LogActivity);
86 SetupControls();
87}
88
89void CGeneralPage::UpdatePage()
90{
91 if(!m_dad->m_Brother)
92 return;
93 m_Host=m_dad->m_Brother->m_Host;
94 m_Desc=m_dad->m_Brother->m_Desc;
95 m_LogActivity=(m_dad->m_Brother->flags&CBrother::flagsOverrideLogging)?(m_dad->m_Brother->m_bLog?1:0):2;
96 if(::IsWindow(m_hWnd)){
97 UpdateData(FALSE);
98 SetupControls();
99 }
100}
101
102BOOL CGeneralPage::OnSetActive()
103{
104 UpdatePage();
105
106 return CPropertyPage::OnSetActive();
107}
108
109void CGeneralPage::UpdateBrother()
110{
111 if(!m_dad->m_Brother){
112 TRACE0("No brother on update\n");
113 return;
114 }
115 if(::IsWindow(m_hWnd))
116 UpdateData();
117CBrother toCompare;
118 toCompare = *m_dad->m_Brother;
119 m_dad->m_Brother->m_Host=m_Host;
120 m_dad->m_Brother->m_Desc=m_Desc;
121 switch(m_LogActivity){
122 case0:
123 m_dad->m_Brother->m_bLog=FALSE;
124 m_dad->m_Brother->flags|=CBrother::flagsOverrideLogging;
125 break;
126 case1:
127 m_dad->m_Brother->m_bLog=TRUE;
128 m_dad->m_Brother->flags|=CBrother::flagsOverrideLogging;
129 break;
130 default:
131 m_dad->m_Brother->flags&=~CBrother::flagsOverrideLogging;
132 break;
133 }
134 m_dad->m_Brother->ParentalAdjust();
135 if(toCompare!=(*m_dad->m_Brother)){
136 CDocument *pDoc = m_dad->m_Daddy->GetDocument();
137 ASSERT(pDoc);
138 pDoc->SetModifiedFlag();
139 }
140 if(::IsWindow(m_hWnd)){
141 UpdateData(FALSE);
142 SetupControls();
143 }
144 m_dad->m_Daddy->UpdateBrother(m_dad->m_Brother);
145}
146
147void CGeneralPage::SetupControls()
148{
149CString tmp;
150 switch(m_LogActivity){
151 case 0:
152 tmp.LoadString(IDS_LOG_DONTLOG);
153 break;
154 case 1:
155 tmp.LoadString(IDS_LOG_DOLOG);
156 break;
157 default:
158 tmp.LoadString(IDS_LOG_ASKBIGBROTHER);
159 break;
160 }
161 m_LogActivityCtl.SetWindowText(tmp);
162}
163
164BOOL CGeneralPage::OnKillActive()
165{
166 UpdateBrother();
167 return CPropertyPage::OnKillActive();
168}
diff --git a/GeneralPage.h b/GeneralPage.h
new file mode 100644
index 0000000..e0153ee
--- a/dev/null
+++ b/GeneralPage.h
@@ -0,0 +1,52 @@
1// GeneralPage.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CGeneralPage dialog
6
7class CHostPropertyPages;
8class CGeneralPage : public CPropertyPage
9{
10 DECLARE_DYNCREATE(CGeneralPage)
11
12// Construction
13public:
14 void SetupControls();
15 void UpdateBrother();
16 void UpdatePage();
17 CHostPropertyPages* m_dad;
18 CGeneralPage();
19 ~CGeneralPage();
20
21// Dialog Data
22 //{{AFX_DATA(CGeneralPage)
23 enum { IDD = IDD_PROPS_GENERAL };
24 CButtonm_LogActivityCtl;
25 CEditm_HostCtl;
26 CEditm_DescCtl;
27 CStringm_Desc;
28 CStringm_Host;
29 int m_LogActivity;
30 //}}AFX_DATA
31
32
33// Overrides
34 // ClassWizard generate virtual function overrides
35 //{{AFX_VIRTUAL(CGeneralPage)
36 public:
37 virtual BOOL OnSetActive();
38 virtual BOOL OnKillActive();
39 protected:
40 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
41 //}}AFX_VIRTUAL
42
43// Implementation
44protected:
45 // Generated message map functions
46 //{{AFX_MSG(CGeneralPage)
47 afx_msg void OnChangeHost();
48 afx_msg void OnLogActivity();
49 //}}AFX_MSG
50 DECLARE_MESSAGE_MAP()
51
52};
diff --git a/HostPropertyPages.cpp b/HostPropertyPages.cpp
new file mode 100644
index 0000000..8583bf8
--- a/dev/null
+++ b/HostPropertyPages.cpp
@@ -0,0 +1,124 @@
1// HostPropertyPages.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "HostPropertyPages.h"
7#include "GeneralPage.h"
8#include "SettingsPage.h"
9#include "ActionPage.h"
10#include "BigBrotherDoc.h"
11#include "BigBrotherView.h"
12
13#ifdef _DEBUG
14#define new DEBUG_NEW
15#undef THIS_FILE
16static char THIS_FILE[] = __FILE__;
17#endif
18
19/////////////////////////////////////////////////////////////////////////////
20// CHostPropertyPages
21
22IMPLEMENT_DYNAMIC(CHostPropertyPages, CPropertySheet)
23
24CHostPropertyPages::CHostPropertyPages(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
25 :CPropertySheet(nIDCaption, pParentWnd, iSelectPage), m_Brother(NULL)
26{
27 CreatePages();
28}
29
30CHostPropertyPages::CHostPropertyPages(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
31 :CPropertySheet(pszCaption, pParentWnd, iSelectPage), m_Brother(NULL)
32{
33 CreatePages();
34}
35
36CHostPropertyPages::~CHostPropertyPages()
37{
38 delete m_Action;
39 delete m_Settings;
40 delete m_General;
41}
42
43
44BEGIN_MESSAGE_MAP(CHostPropertyPages, CPropertySheet)
45 //{{AFX_MSG_MAP(CHostPropertyPages)
46 ON_WM_CREATE()
47 ON_WM_DESTROY()
48 ON_BN_CLICKED(IDOK, OnOK)
49 //}}AFX_MSG_MAP
50END_MESSAGE_MAP()
51
52/////////////////////////////////////////////////////////////////////////////
53// CHostPropertyPages message handlers
54
55void CHostPropertyPages::CreatePages()
56{
57 m_General = new CGeneralPage();
58 m_Settings = new CSettingsPage();
59 m_Action = new CActionPage();
60 m_General->m_dad=this;
61 m_Settings->m_dad=this;
62 m_Action->m_dad=this;
63 AddPage(m_General);
64 AddPage(m_Settings);
65 AddPage(m_Action);
66 m_InitialPosition.x=AfxGetApp()->GetProfileInt("PropertiesPosition","left",-1);
67 m_InitialPosition.y=AfxGetApp()->GetProfileInt("PropertiesPosition","top",-1);
68}
69
70void CHostPropertyPages::SetBrother(CBrother* b)
71{
72 if(m_Brother)
73 UpdateBrother();
74 m_Brother=b;
75 m_General->UpdatePage();
76 m_Settings->UpdatePage();
77 m_Action->UpdatePage();
78}
79
80void CHostPropertyPages::UpdateBrother()
81{
82 if(!m_Brother)
83 return;
84 m_General->UpdateBrother();
85 m_Settings->UpdateBrother();
86 m_Action->UpdateBrother();
87 ASSERT(m_Daddy);
88CDocument *pDoc = m_Daddy->GetDocument();
89 if(pDoc);
90 pDoc->UpdateAllViews(NULL);
91 //PostMessage(WM_UPDATETREEBROTHER,0,(LPARAM)m_Brother);
92}
93
94int CHostPropertyPages::OnCreate(LPCREATESTRUCT lpCreateStruct)
95{
96 if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
97 return -1;
98 ModifyStyle(m_Daddy->IsWindowVisible()?0:WS_VISIBLE,WS_POPUP||WS_CLIPSIBLINGS|WS_BORDER|WS_DLGFRAME);
99 ModifyStyleEx(0,WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE);
100 return 0;
101}
102
103void CHostPropertyPages::OnDestroy()
104{
105 CPropertySheet::OnDestroy();
106CRect rc;
107 GetWindowRect(rc);
108 AfxGetApp()->WriteProfileInt("PropertiesPosition","left",rc.left);
109 AfxGetApp()->WriteProfileInt("PropertiesPosition","top",rc.top);
110}
111
112BOOL CHostPropertyPages::OnInitDialog()
113{
114BOOL rv = CPropertySheet::OnInitDialog();
115 VERIFY(m_OK.SubclassWindow(GetDlgItem(IDOK)->m_hWnd));
116 m_OK.EnableWindow(TRUE);
117 return rv;
118}
119
120void CHostPropertyPages::OnOK()
121{
122 UpdateBrother();
123 AfxGetApp()->GetMainWnd()->SetFocus();
124}
diff --git a/HostPropertyPages.h b/HostPropertyPages.h
new file mode 100644
index 0000000..4c4218a
--- a/dev/null
+++ b/HostPropertyPages.h
@@ -0,0 +1,58 @@
1// HostPropertyPages.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CHostPropertyPages
6
7class CGeneralPage;
8class CSettingsPage;
9class CActionPage;
10class CBrother;
11class CBigBrotherView;
12class CHostPropertyPages : public CPropertySheet
13{
14 DECLARE_DYNAMIC(CHostPropertyPages)
15
16// Construction
17public:
18 CButton m_OK;
19 CPoint m_InitialPosition;
20 CBigBrotherView* m_Daddy;
21 void UpdateBrother();
22 CBrother* m_Brother;
23 void SetBrother(CBrother* b);
24 void CreatePages();
25 CActionPage* m_Action;
26 CSettingsPage* m_Settings;
27 CGeneralPage* m_General;
28 CHostPropertyPages(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
29 CHostPropertyPages(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
30
31// Attributes
32public:
33
34// Operations
35public:
36
37// Overrides
38 // ClassWizard generated virtual function overrides
39 //{{AFX_VIRTUAL(CHostPropertyPages)
40 public:
41 virtual BOOL OnInitDialog();
42 //}}AFX_VIRTUAL
43
44// Implementation
45public:
46 virtual ~CHostPropertyPages();
47
48 // Generated message map functions
49protected:
50 //{{AFX_MSG(CHostPropertyPages)
51 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
52 afx_msg void OnDestroy();
53 afx_msg void OnOK();
54 //}}AFX_MSG
55 DECLARE_MESSAGE_MAP()
56};
57
58/////////////////////////////////////////////////////////////////////////////
diff --git a/KTAGS b/KTAGS
new file mode 100644
index 0000000..78dd936
--- a/dev/null
+++ b/KTAGS
@@ -0,0 +1,12 @@
1 about-date bigbrother.rc /LTEXT\s\+"Copyright /;"kind:d
2 about-version bigbrother.rc /LTEXT\s\+"Big Brother, Version/;"kind:v
3 help-license-date ./help/bigbrother.xml /<license\s/;"kind:d
4 help-news ./help/bigbrother.xml/<newsfor\s/
5 install-version ./install/install.cpp /^#define\s\+VERSION\s\+"/;"kind:v
6 install-vsinfo-date install/install.rc /^\s\+VALUE\s\+"LegalCopyright",/;"kind:d
7 install-vsinfo-numeric-version install/install.rc /^\s\+FILEVERSION\s\+/;"kind:v
8 install-vsinfo-string-version install/install.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v
9 license-date COPYING :1;"kind:d
10 vsinfo-date bigbrother.rc /VALUE\s\+"LegalCopyright",/;"kind:d
11 vsinfo-numeric-version bigbrother.rc /^\s\+FILEVERSION\s\+/;"kind:v
12 vsinfo-string-version bigbrother.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v
diff --git a/MainFrm.cpp b/MainFrm.cpp
new file mode 100644
index 0000000..97de7b2
--- a/dev/null
+++ b/MainFrm.cpp
@@ -0,0 +1,299 @@
1// MainFrm.cpp : implementation of the CMainFrame class
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6
7#include "MainFrm.h"
8#include "BigBrotherView.h"
9#include "ActivityView.h"
10#include "BigBrotherDoc.h"
11#include "HostPropertyPages.h"
12
13#ifdef _DEBUG
14#define new DEBUG_NEW
15#undef THIS_FILE
16static char THIS_FILE[] = __FILE__;
17#endif
18
19/////////////////////////////////////////////////////////////////////////////
20// CMainFrame
21
22IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
23
24BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
25 //{{AFX_MSG_MAP(CMainFrame)
26 ON_WM_CREATE()
27 ON_WM_DESTROY()
28 ON_UPDATE_COMMAND_UI(ID_VIEW_MAINWINDOW, OnUpdateViewMainwindow)
29 ON_COMMAND(ID_VIEW_MAINWINDOW, OnViewMainwindow)
30 ON_WM_WINDOWPOSCHANGING()
31 ON_UPDATE_COMMAND_UI(ID_INDICATOR_PINGBAR, OnUpdateIndicatorPingbar)
32 ON_WM_CLOSE()
33 ON_MESSAGE(WM_TRAYICONMESSAGE, OnNotifyIcon)
34 ON_WM_QUERYENDSESSION()
35 //}}AFX_MSG_MAP
36 // Global help commands
37 ON_COMMAND(ID_HELP_FINDER, CFrameWnd::OnHelpFinder)
38 ON_COMMAND(ID_HELP, CFrameWnd::OnHelp)
39 ON_COMMAND(ID_CONTEXT_HELP, CFrameWnd::OnContextHelp)
40 ON_COMMAND(ID_DEFAULT_HELP, CFrameWnd::OnHelpFinder)
41END_MESSAGE_MAP()
42
43static UINT indicators[] =
44{
45 ID_INDICATOR_PINGBAR,
46 ID_SEPARATOR // status line indicator
47 /*ID_INDICATOR_CAPS,
48 ID_INDICATOR_NUM,
49 ID_INDICATOR_SCRL*/
50};
51
52/////////////////////////////////////////////////////////////////////////////
53// CMainFrame construction/destruction
54
55CMainFrame::CMainFrame()
56{
57 m_bExiting=FALSE;
58 m_bShuttingDown=FALSE;
59}
60
61CMainFrame::~CMainFrame()
62{
63}
64
65int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
66{
67 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
68 return -1;
69
70 if (!m_wndToolBar.Create(this) ||
71 !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
72 {
73 TRACE0("Failed to create toolbar\n");
74 return -1; // fail to create
75 }
76
77 if (!m_wndStatusBar.Create(this,WS_CHILD | WS_VISIBLE | CBRS_BOTTOM|CBRS_SIZE_DYNAMIC) ||
78 !m_wndStatusBar.SetIndicators(indicators,
79 sizeof(indicators)/sizeof(UINT)))
80 {
81 TRACE0("Failed to create status bar\n");
82 return -1; // fail to create
83 }
84 m_wndStatusBar.SetPaneStyle(1,m_wndStatusBar.GetPaneStyle(1)|SBPS_STRETCH);
85 VERIFY(m_PingBar.Create(WS_CHILD|WS_VISIBLE|ACS_TRANSPARENT,CRect(0,0,0,0),&m_wndStatusBar,ID_INDICATOR_PINGBAR));
86 m_PingBar.Open(IDR_PINGBAR);
87CRect rc;
88 m_PingBar.GetWindowRect(rc);
89int nHorz, nVert, nSpacing;
90 m_wndStatusBar.GetStatusBarCtrl().GetBorders(nHorz,nVert,nSpacing);
91 m_wndStatusBar.GetStatusBarCtrl().SetMinHeight(rc.Height()+nVert*2);
92 m_wndStatusBar.SetTheMinHeight(rc.Height()+nVert*2);
93 m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_PINGBAR),ID_INDICATOR_PINGBAR,SBPS_NORMAL,rc.Width());
94 m_PingBar.SetWindowPos(NULL,nHorz+nSpacing+1,nVert+1,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
95
96 m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
97 CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
98
99 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
100 EnableDocking(CBRS_ALIGN_ANY);
101 DockControlBar(&m_wndToolBar);
102
103NOTIFYICONDATA nid;
104 memset(&nid,0,sizeof(nid));
105 nid.cbSize=sizeof(nid);
106 nid.hWnd=m_hWnd;
107 nid.uID=IDC_TRAYICON;
108 nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
109 nid.uCallbackMessage=WM_TRAYICONMESSAGE;
110 nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
111 // *** Load from resource
112 strcpy(nid.szTip,"Big Brother");
113 VERIFY(Shell_NotifyIcon(NIM_ADD,&nid));
114 return 0;
115}
116
117BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
118 CCreateContext* pContext)
119{
120 if(!m_wndSplitter.CreateStatic(this,2,1)){
121 TRACE0("Failed to create static splitter\n");
122 return FALSE;
123 }
124CRect rc;
125 GetClientRect(rc);
126int cySize = AfxGetApp()->GetProfileInt("SplitterPosition","TreeSize",-1);
127 if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CBigBrotherView),CSize(0,(cySize<0)?(rc.Height()/2):cySize),pContext)){
128 TRACE0("Failed to create Tree View\n");
129 return FALSE;
130 }
131 cySize = AfxGetApp()->GetProfileInt("SplitterPosition","ActivitySize",-1);
132 if(!m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CActivityView),CSize(0,(cySize<0)?(rc.Height()/2):cySize),pContext)){
133 TRACE0("Failed to create Activity View\n");
134 return FALSE;
135 }
136 return TRUE;
137}
138
139BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
140{
141CRect rc;
142CWinApp *app = AfxGetApp();
143 rc.left=app->GetProfileInt("FramePosition","left",-1);
144 rc.top=app->GetProfileInt("FramePosition","top",-1);
145 rc.right=app->GetProfileInt("FramePosition","right",-1);
146 rc.bottom=app->GetProfileInt("FramePosition","bottom",-1);
147 if(rc.left>=0 && rc.top>=0 && rc.right>=0 && rc.bottom>=0){
148 cs.x=rc.left, cs.y=rc.top;
149 cs.cx=rc.Width(), cs.cy=rc.Height();
150 }
151 inttmp = app->GetProfileInt("FramePosition","shown",-1);
152 if(!tmp){
153 cs.style&=~WS_VISIBLE;
154 m_bShown=FALSE;
155 }else
156 m_bShown=TRUE;
157 cs.style&=~WS_MINIMIZEBOX|WS_MAXIMIZEBOX;
158 return CFrameWnd::PreCreateWindow(cs);
159}
160
161/////////////////////////////////////////////////////////////////////////////
162// CMainFrame diagnostics
163
164#ifdef _DEBUG
165void CMainFrame::AssertValid() const
166{
167 CFrameWnd::AssertValid();
168}
169
170void CMainFrame::Dump(CDumpContext& dc) const
171{
172 CFrameWnd::Dump(dc);
173}
174
175#endif //_DEBUG
176
177/////////////////////////////////////////////////////////////////////////////
178// CMainFrame message handlers
179
180void CMainFrame::OnDestroy()
181{
182 CFrameWnd::OnDestroy();
183
184 m_bExiting=TRUE;
185
186 // Save window size and position
187CRect rc;
188 GetWindowRect(rc);
189CWinApp *app = AfxGetApp();
190 app->WriteProfileInt("FramePosition","left",rc.left);
191 app->WriteProfileInt("FramePosition","top",rc.top);
192 app->WriteProfileInt("FramePosition","right",rc.right);
193 app->WriteProfileInt("FramePosition","bottom",rc.bottom);
194int cyCur,cyMin;
195 m_wndSplitter.GetRowInfo(0,cyCur,cyMin);
196 app->WriteProfileInt("SplitterPosition","TreeSize",cyCur);
197 m_wndSplitter.GetRowInfo(1,cyCur,cyMin);
198 app->WriteProfileInt("SplitterPosition","ActivitySize",cyCur);
199 app->WriteProfileInt("FramePosition","shown",m_bShown);
200
201NOTIFYICONDATA nid;
202 memset(&nid,0,sizeof(nid));
203 nid.cbSize=sizeof(nid);
204 nid.hWnd=m_hWnd;
205 nid.uID=IDC_TRAYICON;
206 nid.uFlags=0;
207 VERIFY(Shell_NotifyIcon(NIM_DELETE,&nid));
208}
209
210LRESULT CMainFrame::OnNotifyIcon(WPARAM wP,LPARAM lP)
211{
212 ASSERT(wP==IDC_TRAYICON);
213 switch(lP){
214 case WM_LBUTTONDOWN:
215 OnViewMainwindow();
216 break;
217 case WM_RBUTTONDOWN:
218 {
219 CMenu menu;
220 VERIFY(menu.LoadMenu(IDM_POPUPS));
221 CMenu *popUp = menu.GetSubMenu(0);
222 ASSERT(popUp);
223 CPoint pt;
224 VERIFY(::GetCursorPos(&pt));
225 popUp->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this,NULL);
226 }
227 break;
228 default:
229 /* {
230 CString tmp;
231 tmp.Format("NIMESSAGE: %08lX\n",lP);
232 TRACE0(tmp);
233 }*/
234 break;
235 }
236 return 0;
237}
238
239void CMainFrame::FrameDisplayState(BOOL bShow)
240{
241 m_bShown=bShow;
242 ShowWindow(bShow?SW_SHOW:SW_HIDE);
243CBigBrotherDoc *doc = (CBigBrotherDoc*)GetActiveDocument();
244 if(doc){
245 ASSERT(doc->IsKindOf(RUNTIME_CLASS(CBigBrotherDoc)));
246 ASSERT(doc->m_BBView);
247 ASSERT(doc->m_BBView->m_Pages);
248 ASSERT(::IsWindow(doc->m_BBView->m_Pages->m_hWnd));
249 doc->m_BBView->m_Pages->ShowWindow(bShow?SW_SHOW:SW_HIDE);
250 }
251 if(bShow){
252 SetForegroundWindow();
253 SetFocus();
254 }
255}
256
257void CMainFrame::OnUpdateViewMainwindow(CCmdUI* pCmdUI)
258{
259 pCmdUI->SetCheck(IsWindowVisible()?1:0);
260}
261
262void CMainFrame::OnViewMainwindow()
263{
264 FrameDisplayState(!IsWindowVisible());
265}
266
267void CMainFrame::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
268{
269 if(!m_bExiting){
270 if(m_bShown){
271 lpwndpos->flags&=~SWP_HIDEWINDOW;
272 lpwndpos->flags|=SWP_SHOWWINDOW;
273 }else{
274 lpwndpos->flags&=~SWP_SHOWWINDOW;
275 lpwndpos->flags|=SWP_HIDEWINDOW;
276 }
277 }
278 CFrameWnd::OnWindowPosChanging(lpwndpos);
279}
280
281void CMainFrame::OnUpdateIndicatorPingbar(CCmdUI* pCmdUI)
282{
283 pCmdUI->Enable(TRUE);
284}
285
286void CMainFrame::OnClose()
287{
288 m_bExiting=TRUE;
289 CFrameWnd::OnClose();
290}
291
292BOOL CMainFrame::OnQueryEndSession()
293{
294 m_bShuttingDown=TRUE;
295 if (!CFrameWnd::OnQueryEndSession())
296 return FALSE;
297 ::PostQuitMessage(0);
298 return TRUE;
299}
diff --git a/MainFrm.h b/MainFrm.h
new file mode 100644
index 0000000..25a520c
--- a/dev/null
+++ b/MainFrm.h
@@ -0,0 +1,65 @@
1// MainFrm.h : interface of the CMainFrame class
2//
3/////////////////////////////////////////////////////////////////////////////
4
5 class CGoodStatusBar : public CStatusBar{
6public:
7 void SetTheMinHeight(int nMinHeight){m_nMinHeight=nMinHeight;}
8};
9
10class CMainFrame : public CFrameWnd
11{
12protected: // create from serialization only
13 CMainFrame();
14 DECLARE_DYNCREATE(CMainFrame)
15
16// Attributes
17protected:
18 CSplitterWnd m_wndSplitter;
19public:
20 BOOL m_bShuttingDown;
21 CAnimateCtrl m_PingBar;
22 BOOL m_bExiting;
23 BOOL m_bShown;
24 void FrameDisplayState(BOOL bShow);
25
26// Operations
27public:
28
29// Overrides
30 // ClassWizard generated virtual function overrides
31 //{{AFX_VIRTUAL(CMainFrame)
32 public:
33 virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
34 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
35 //}}AFX_VIRTUAL
36
37// Implementation
38public:
39 virtual ~CMainFrame();
40#ifdef _DEBUG
41 virtual void AssertValid() const;
42 virtual void Dump(CDumpContext& dc) const;
43#endif
44
45protected: // control bar embedded members
46 CGoodStatusBar m_wndStatusBar;
47 CToolBar m_wndToolBar;
48
49// Generated message map functions
50protected:
51 //{{AFX_MSG(CMainFrame)
52 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
53 afx_msg void OnDestroy();
54 afx_msg void OnUpdateViewMainwindow(CCmdUI* pCmdUI);
55 afx_msg void OnViewMainwindow();
56 afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
57 afx_msg void OnUpdateIndicatorPingbar(CCmdUI* pCmdUI);
58 afx_msg void OnClose();
59 afx_msg LRESULT OnNotifyIcon(WPARAM,LPARAM);
60 afx_msg BOOL OnQueryEndSession();
61 //}}AFX_MSG
62 DECLARE_MESSAGE_MAP()
63};
64
65/////////////////////////////////////////////////////////////////////////////
diff --git a/Preferences.cpp b/Preferences.cpp
new file mode 100644
index 0000000..b975d00
--- a/dev/null
+++ b/Preferences.cpp
@@ -0,0 +1,93 @@
1// Preferences.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "Preferences.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// CPreferences dialog
16
17
18CPreferences::CPreferences(CWnd* pParent /*=NULL*/)
19 : CDialog(CPreferences::IDD, pParent)
20{
21 //{{AFX_DATA_INIT(CPreferences)
22 m_AutosaveMinutes = 0;
23 m_LogFile = _T("");
24 m_MaxThreads = 0;
25 m_PingSize = 0;
26 m_SaveOnShutdown = FALSE;
27 m_LogMins = 0;
28 m_bStoreLastActivity = FALSE;
29 //}}AFX_DATA_INIT
30}
31
32
33void CPreferences::DoDataExchange(CDataExchange* pDX)
34{
35 CDialog::DoDataExchange(pDX);
36 //{{AFX_DATA_MAP(CPreferences)
37 DDX_Control(pDX, IDC_LOGMINSPIN, m_LogMinSpinCtl);
38 DDX_Control(pDX, IDC_LOGFILE, m_LogFileCtl);
39 DDX_Control(pDX, IDC_THREADSPIN, m_ThreadsSpinCtl);
40 DDX_Control(pDX, IDC_DATASIZESPIN, m_DatasizeSpinCtl);
41 DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl);
42 DDX_Control(pDX, IDC_AUTOSPIN, m_AutosaveSpinCtl);
43 DDX_Text(pDX, IDC_AUTOSAVEMINS, m_AutosaveMinutes);
44 DDV_MinMaxUInt(pDX, m_AutosaveMinutes, 0, 300);
45 DDX_Text(pDX, IDC_LOGFILE, m_LogFile);
46 DDX_Text(pDX, IDC_MAXTHREADS, m_MaxThreads);
47 DDV_MinMaxUInt(pDX, m_MaxThreads, 1, 50);
48 DDX_Text(pDX, IDC_PINGSIZE, m_PingSize);
49 DDV_MinMaxUInt(pDX, m_PingSize, 0, 32768);
50 DDX_Check(pDX, IDC_SAVEONSHUTDOWN, m_SaveOnShutdown);
51 DDX_Text(pDX, IDC_LOGMINS, m_LogMins);
52 DDV_MinMaxUInt(pDX, m_LogMins, 1, 1440);
53 DDX_Check(pDX, IDC_STOREACTIVITY, m_bStoreLastActivity);
54 //}}AFX_DATA_MAP
55}
56
57
58BEGIN_MESSAGE_MAP(CPreferences, CDialog)
59 //{{AFX_MSG_MAP(CPreferences)
60 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
61 //}}AFX_MSG_MAP
62END_MESSAGE_MAP()
63
64/////////////////////////////////////////////////////////////////////////////
65// CPreferences message handlers
66
67BOOL CPreferences::OnInitDialog()
68{
69 CDialog::OnInitDialog();
70
71 m_BrowseCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_BROWSESOUND));
72 m_AutosaveSpinCtl.SetRange(0,300);
73 m_DatasizeSpinCtl.SetRange(1,32767);
74 m_ThreadsSpinCtl.SetRange(1,50);
75 m_LogMinSpinCtl.SetRange(1,1440);
76
77 return TRUE; // return TRUE unless you set the focus to a control
78 // EXCEPTION: OCX Property Pages should return FALSE
79}
80
81void CPreferences::OnBrowse()
82{
83CString filter;
84 filter.LoadString(IDS_LOGFILTER);
85CString title;
86 title.LoadString(IDS_LOGFILE_SELECT);
87CFileDialog cfd(FALSE,NULL,m_LogFile,OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_NOTESTFILECREATE,filter,this);
88 cfd.m_ofn.lpstrTitle=title;
89 if(cfd.DoModal()==IDOK){
90 m_LogFile=cfd.GetPathName();
91 m_LogFileCtl.SetWindowText(cfd.GetPathName());
92 }
93}
diff --git a/Preferences.h b/Preferences.h
new file mode 100644
index 0000000..04885f2
--- a/dev/null
+++ b/Preferences.h
@@ -0,0 +1,48 @@
1// Preferences.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CPreferences dialog
6
7class CPreferences : public CDialog
8{
9// Construction
10public:
11 CPreferences(CWnd* pParent = NULL); // standard constructor
12
13// Dialog Data
14 //{{AFX_DATA(CPreferences)
15 enum { IDD = IDD_PREFS };
16 CSpinButtonCtrlm_LogMinSpinCtl;
17 CEditm_LogFileCtl;
18 CSpinButtonCtrlm_ThreadsSpinCtl;
19 CSpinButtonCtrlm_DatasizeSpinCtl;
20 CButtonm_BrowseCtl;
21 CSpinButtonCtrlm_AutosaveSpinCtl;
22 UINTm_AutosaveMinutes;
23 CStringm_LogFile;
24 UINTm_MaxThreads;
25 UINTm_PingSize;
26 BOOLm_SaveOnShutdown;
27 UINTm_LogMins;
28 BOOLm_bStoreLastActivity;
29 //}}AFX_DATA
30
31
32// Overrides
33 // ClassWizard generated virtual function overrides
34 //{{AFX_VIRTUAL(CPreferences)
35 protected:
36 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
37 //}}AFX_VIRTUAL
38
39// Implementation
40protected:
41
42 // Generated message map functions
43 //{{AFX_MSG(CPreferences)
44 virtual BOOL OnInitDialog();
45 afx_msg void OnBrowse();
46 //}}AFX_MSG
47 DECLARE_MESSAGE_MAP()
48};
diff --git a/README b/README
new file mode 100644
index 0000000..114afa5
--- a/dev/null
+++ b/README
@@ -0,0 +1,32 @@
1
2Before compiling canned install executable the following files should be placed
3in the build tree:
4
5redist/mfc42.dl_
6
7Release checklist:
8 (These are tags stored in KTAGS file. please, keep in sync. Use vim to
9 jump to these tags. I haven't tried it on windows, though).
10
11 |help-news| - Release notes in help file
12
13Version number in the following places:
14
15 |about-version| - About box
16 |vsinfo-numeric-version| - VERSIONINFO numerical File&Prod V
17 |vsinfo-string-version| - VERSIONINFO string File&Prod V
18 |install-version| - Version used in install
19 |install-vsinfo-numeric-version|- install's VERSIONINFO block
20 |install-vsinfo-string-version| - install's VERSIONINFO block
21
22If the year flips check these:
23
24 |about-date| - About box
25 |help-license-date| - license in help file
26 |license-date| - license in COPYING file
27 |vsinfo-date| - Copyright in VERSIONINFO block
28 |install-vsinfo-date| - Copyright in install's VERSIONINFO
29 block
30
31This is for vim (don't remove):
32 vim:set tags=KTAGS isk=!-~,^*,^\|,^\" ft=help:
diff --git a/SettingsPage.cpp b/SettingsPage.cpp
new file mode 100644
index 0000000..2fa42d0
--- a/dev/null
+++ b/SettingsPage.cpp
@@ -0,0 +1,186 @@
1// SettingsPage.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6#include "SettingsPage.h"
7#include "HostPropertyPages.h"
8#include "BigBrotherDoc.h"
9#include "BigBrotherView.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CSettingsPage property page
19
20IMPLEMENT_DYNCREATE(CSettingsPage, CPropertyPage)
21
22CSettingsPage::CSettingsPage() : CPropertyPage(CSettingsPage::IDD)
23{
24 //{{AFX_DATA_INIT(CSettingsPage)
25 m_OverrideIntervals = FALSE;
26 m_OverrideRetries = FALSE;
27 m_OverrideTimeout = FALSE;
28 m_IntervalBad = 0;
29 m_IntervalGood = 0;
30 m_TimeOut = 0;
31 m_Retries = 0;
32 //}}AFX_DATA_INIT
33}
34
35CSettingsPage::~CSettingsPage()
36{
37}
38
39void CSettingsPage::DoDataExchange(CDataExchange* pDX)
40{
41 CPropertyPage::DoDataExchange(pDX);
42 //{{AFX_DATA_MAP(CSettingsPage)
43 DDX_Control(pDX, IDC_RETRIES, m_RetriesCtl);
44 DDX_Control(pDX, IDC_PINGTIMEOUT, m_TimeOutCtl);
45 DDX_Control(pDX, IDC_PINGINTERVAL_GOOD, m_IntervalGoodCtl);
46 DDX_Control(pDX, IDC_PINGINTERVAL_BAD, m_IntervalBadCtl);
47 DDX_Control(pDX, IDC_OVERRIDE_TIMEOUT, m_OverrideTimeoutCtl);
48 DDX_Control(pDX, IDC_OVERRIDE_RETRIES, m_OverrideRetriesCtl);
49 DDX_Control(pDX, IDC_OVERRIDE_INTERVALS, m_OverrideIntervalsCtl);
50 DDX_Check(pDX, IDC_OVERRIDE_INTERVALS, m_OverrideIntervals);
51 DDX_Check(pDX, IDC_OVERRIDE_RETRIES, m_OverrideRetries);
52 DDX_Check(pDX, IDC_OVERRIDE_TIMEOUT, m_OverrideTimeout);
53 DDX_Text(pDX, IDC_PINGINTERVAL_BAD, m_IntervalBad);
54 DDX_Text(pDX, IDC_PINGINTERVAL_GOOD, m_IntervalGood);
55 DDX_Text(pDX, IDC_PINGTIMEOUT, m_TimeOut);
56 DDX_Text(pDX, IDC_RETRIES, m_Retries);
57 //}}AFX_DATA_MAP
58}
59
60
61BEGIN_MESSAGE_MAP(CSettingsPage, CPropertyPage)
62 //{{AFX_MSG_MAP(CSettingsPage)
63 ON_BN_CLICKED(IDC_OVERRIDE_INTERVALS, OnOverrideIntervals)
64 ON_BN_CLICKED(IDC_OVERRIDE_RETRIES, OnOverrideRetries)
65 ON_BN_CLICKED(IDC_OVERRIDE_TIMEOUT, OnOverrideTimeout)
66 //}}AFX_MSG_MAP
67END_MESSAGE_MAP()
68
69/////////////////////////////////////////////////////////////////////////////
70// CSettingsPage message handlers
71
72void CSettingsPage::SetupControls()
73{
74 m_IntervalBadCtl.EnableWindow(m_OverrideIntervals);
75 m_IntervalGoodCtl.EnableWindow(m_OverrideIntervals);
76 m_RetriesCtl.EnableWindow(m_OverrideRetries);
77 m_TimeOutCtl.EnableWindow(m_OverrideTimeout);
78}
79
80void CSettingsPage::UpdatePage()
81{
82 if(!m_dad->m_Brother)
83 return;
84 if(::IsWindow(m_hWnd)){
85 if(m_dad->m_Brother->m_Daddy){
86 m_OverrideIntervalsCtl.EnableWindow(TRUE);
87 m_OverrideRetriesCtl.EnableWindow(TRUE);
88 m_OverrideTimeoutCtl.EnableWindow(TRUE);
89 }else{
90 m_OverrideIntervalsCtl.EnableWindow(FALSE);
91 m_OverrideRetriesCtl.EnableWindow(FALSE);
92 m_OverrideTimeoutCtl.EnableWindow(FALSE);
93 }
94 }
95 if(m_dad->m_Brother->flags&CBrother::flagsOverrideIntervals)
96 m_OverrideIntervals=TRUE;
97 else
98 m_OverrideIntervals=FALSE;
99 if(m_dad->m_Brother->flags&CBrother::flagsOverrideTimeout)
100 m_OverrideTimeout=TRUE;
101 else
102 m_OverrideTimeout=FALSE;
103 if(m_dad->m_Brother->flags&CBrother::flagsOverrideRetries)
104 m_OverrideRetries=TRUE;
105 else
106 m_OverrideRetries=FALSE;
107 m_IntervalBad=m_dad->m_Brother->m_IntervalBad;
108 m_IntervalGood=m_dad->m_Brother->m_IntervalGood;
109 m_Retries=m_dad->m_Brother->m_Retries;
110 m_TimeOut=m_dad->m_Brother->m_TimeOut;
111 if(::IsWindow(m_hWnd)){
112 UpdateData(FALSE);
113 SetupControls();
114 }
115}
116
117BOOL CSettingsPage::OnSetActive()
118{
119 UpdatePage();
120 return CPropertyPage::OnSetActive();
121}
122
123void CSettingsPage::OnOverrideIntervals()
124{
125 UpdateBrother();
126 if(m_OverrideIntervals)
127 m_IntervalGoodCtl.SetFocus();
128}
129
130void CSettingsPage::OnOverrideRetries()
131{
132 UpdateBrother();
133 if(m_OverrideRetries)
134 m_RetriesCtl.SetFocus();
135}
136
137void CSettingsPage::OnOverrideTimeout()
138{
139 UpdateBrother();
140 if(m_OverrideTimeout)
141 m_TimeOutCtl.SetFocus();
142}
143
144void CSettingsPage::UpdateBrother()
145{
146 if(!m_dad->m_Brother){
147 TRACE0("No brother on update\n");
148 return;
149 }
150 if(::IsWindow(m_hWnd))
151 UpdateData();
152CBrother toCompare;
153 toCompare = *m_dad->m_Brother;
154 m_dad->m_Brother->m_IntervalBad=m_IntervalBad;
155 m_dad->m_Brother->m_IntervalGood=m_IntervalGood;
156 if(m_OverrideIntervals)
157 m_dad->m_Brother->flags|=CBrother::flagsOverrideIntervals;
158 else
159 m_dad->m_Brother->flags&=~CBrother::flagsOverrideIntervals;
160 m_dad->m_Brother->m_Retries=m_Retries;
161 if(m_OverrideRetries)
162 m_dad->m_Brother->flags|=CBrother::flagsOverrideRetries;
163 else
164 m_dad->m_Brother->flags&=~CBrother::flagsOverrideRetries;
165 m_dad->m_Brother->m_TimeOut=m_TimeOut;
166 if(m_OverrideTimeout)
167 m_dad->m_Brother->flags|=CBrother::flagsOverrideTimeout;
168 else
169 m_dad->m_Brother->flags&=~CBrother::flagsOverrideTimeout;
170 m_dad->m_Brother->ParentalAdjust();
171 if(toCompare!=(*m_dad->m_Brother)){
172 CDocument *pDoc = m_dad->m_Daddy->GetDocument();
173 ASSERT(pDoc);
174 pDoc->SetModifiedFlag();
175 }
176 if(::IsWindow(m_hWnd)){
177 UpdateData(FALSE);
178 SetupControls();
179 }
180}
181
182BOOL CSettingsPage::OnKillActive()
183{
184 UpdateBrother();
185 return CPropertyPage::OnKillActive();
186}
diff --git a/SettingsPage.h b/SettingsPage.h
new file mode 100644
index 0000000..c075bde
--- a/dev/null
+++ b/SettingsPage.h
@@ -0,0 +1,61 @@
1// SettingsPage.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CSettingsPage dialog
6
7class CHostPropertyPages;
8class CSettingsPage : public CPropertyPage
9{
10 DECLARE_DYNCREATE(CSettingsPage)
11
12// Construction
13public:
14 void UpdateBrother();
15 void UpdatePage();
16 void SetupControls();
17 CHostPropertyPages* m_dad;
18 CSettingsPage();
19 ~CSettingsPage();
20
21// Dialog Data
22 //{{AFX_DATA(CSettingsPage)
23 enum { IDD = IDD_PROPS_SETTINGS };
24 CEditm_RetriesCtl;
25 CEditm_TimeOutCtl;
26 CEditm_IntervalGoodCtl;
27 CEditm_IntervalBadCtl;
28 CButtonm_OverrideTimeoutCtl;
29 CButtonm_OverrideRetriesCtl;
30 CButtonm_OverrideIntervalsCtl;
31 BOOLm_OverrideIntervals;
32 BOOLm_OverrideRetries;
33 BOOLm_OverrideTimeout;
34 DWORDm_IntervalBad;
35 DWORDm_IntervalGood;
36 DWORDm_TimeOut;
37 UINTm_Retries;
38 //}}AFX_DATA
39
40
41// Overrides
42 // ClassWizard generate virtual function overrides
43 //{{AFX_VIRTUAL(CSettingsPage)
44 public:
45 virtual BOOL OnSetActive();
46 virtual BOOL OnKillActive();
47 protected:
48 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
49 //}}AFX_VIRTUAL
50
51// Implementation
52protected:
53 // Generated message map functions
54 //{{AFX_MSG(CSettingsPage)
55 afx_msg void OnOverrideIntervals();
56 afx_msg void OnOverrideRetries();
57 afx_msg void OnOverrideTimeout();
58 //}}AFX_MSG
59 DECLARE_MESSAGE_MAP()
60
61};
diff --git a/bigbrother.clw b/bigbrother.clw
new file mode 100644
index 0000000..4716ae4
--- a/dev/null
+++ b/bigbrother.clw
@@ -0,0 +1,313 @@
1; CLW file contains information for the MFC ClassWizard
2
3[General Info]
4Version=1
5LastClass=CPreferences
6LastTemplate=CDialog
7NewFileInclude1=#include "stdafx.h"
8NewFileInclude2=#include "BigBrother.h"
9LastPage=0
10
11ClassCount=11
12Class1=CBigBrotherApp
13Class2=CBigBrotherDoc
14Class3=CBigBrotherView
15Class4=CMainFrame
16
17ResourceCount=9
18Resource1=IDD_PREFS
19Resource2=IDD_PROPS_SETTINGS
20Class5=CAboutDlg
21Resource3=IDM_POPUPS
22Class6=CGeneralPage
23Class7=CSettingsPage
24Class8=CHostPropertyPages
25Resource4=IDR_JUNKTOOLBAR
26Class9=CActionPage
27Class10=CActivityView
28Resource5=IDD_PROPS_GENERAL
29Resource6=IDR_JUNKACCELERATOR
30Resource7=IDD_PROPS_ACTION
31Resource8=IDD_ABOUTBOX
32Class11=CPreferences
33Resource9=IDR_MAINFRAME
34
35[CLS:CBigBrotherApp]
36Type=0
37HeaderFile=BigBrother.h
38ImplementationFile=BigBrother.cpp
39Filter=N
40BaseClass=CWinApp
41VirtualFilter=AC
42LastObject=ID_HELP_LEGEND
43
44[CLS:CBigBrotherDoc]
45Type=0
46HeaderFile=BigBrotherDoc.h
47ImplementationFile=BigBrotherDoc.cpp
48Filter=N
49BaseClass=CDocument
50VirtualFilter=DC
51LastObject=ID_VIEW_HOSTPROPERTIES
52
53[CLS:CBigBrotherView]
54Type=0
55HeaderFile=BigBrotherView.h
56ImplementationFile=BigBrotherView.cpp
57Filter=C
58LastObject=CBigBrotherView
59BaseClass=CTreeView
60VirtualFilter=VWC
61
62[CLS:CMainFrame]
63Type=0
64HeaderFile=MainFrm.h
65ImplementationFile=MainFrm.cpp
66Filter=W
67BaseClass=CFrameWnd
68VirtualFilter=fWC
69LastObject=CMainFrame
70
71
72
73[CLS:CAboutDlg]
74Type=0
75HeaderFile=BigBrother.cpp
76ImplementationFile=BigBrother.cpp
77Filter=D
78LastObject=CAboutDlg
79
80[DLG:IDD_ABOUTBOX]
81Type=1
82Class=CAboutDlg
83ControlCount=5
84Control1=IDC_STATIC,static,1342177283
85Control2=IDC_STATIC,static,1342308480
86Control3=IDC_STATIC,static,1342308352
87Control4=IDOK,button,1342373889
88Control5=IDC_KLEVERNET,button,1342242816
89
90[MNU:IDR_MAINFRAME]
91Type=1
92Class=CMainFrame
93Command1=ID_FILE_NEW
94Command2=ID_FILE_OPEN
95Command3=ID_FILE_SAVE
96Command4=ID_FILE_SAVE_AS
97Command5=ID_FILE_AUTOLOAD
98Command6=ID_FILE_PREFERENCES
99Command7=ID_FILE_PAUSE
100Command8=ID_FILE_MRU_FILE1
101Command9=ID_APP_EXIT
102Command10=ID_BROTHERS_NEW
103Command11=ID_BROTHERS_ADDBROTHER
104Command12=ID_BROTHERS_DELETE
105Command13=ID_VIEW_TOOLBAR
106Command14=ID_VIEW_STATUS_BAR
107Command15=ID_WINDOW_SPLIT
108Command16=ID_VIEW_MAINWINDOW
109Command17=ID_VIEW_HOSTPROPERTIES
110Command18=ID_HELP_FINDER
111Command19=ID_HELP_LEGEND
112Command20=ID_APP_ABOUT
113CommandCount=20
114
115[ACL:IDR_MAINFRAME]
116Type=1
117Class=CMainFrame
118Command1=ID_FILE_NEW
119Command2=ID_FILE_OPEN
120Command3=ID_FILE_PREFERENCES
121Command4=ID_FILE_SAVE
122Command5=ID_BROTHERS_DELETE
123Command6=ID_BROTHERS_DELETE
124Command7=ID_HELP
125Command8=ID_CONTEXT_HELP
126Command9=ID_NEXT_PANE
127Command10=ID_PREV_PANE
128Command11=ID_BROTHERS_NEW
129Command12=ID_APP_EXIT
130CommandCount=12
131
132[DLG:IDD_PROPS_SETTINGS]
133Type=1
134Class=CSettingsPage
135ControlCount=10
136Control1=IDC_STATIC,button,1342193671
137Control2=IDC_OVERRIDE_INTERVALS,button,1342242819
138Control3=IDC_STATIC,static,1342308352
139Control4=IDC_PINGINTERVAL_GOOD,edit,1350631552
140Control5=IDC_STATIC,static,1342308352
141Control6=IDC_PINGINTERVAL_BAD,edit,1350631552
142Control7=IDC_OVERRIDE_TIMEOUT,button,1342242819
143Control8=IDC_PINGTIMEOUT,edit,1350631552
144Control9=IDC_OVERRIDE_RETRIES,button,1342242819
145Control10=IDC_RETRIES,edit,1350631552
146
147[TB:IDR_MAINFRAME]
148Type=1
149Command1=ID_FILE_NEW
150Command2=ID_FILE_OPEN
151Command3=ID_FILE_SAVE
152Command4=ID_BROTHERS_NEW
153Command5=ID_BROTHERS_ADDBROTHER
154Command6=ID_BROTHERS_DELETE
155Command7=ID_VIEW_HOSTPROPERTIES
156Command8=ID_FILE_PAUSE
157Command9=ID_APP_ABOUT
158Command10=ID_CONTEXT_HELP
159Command11=ID_HELP_LEGEND
160CommandCount=11
161
162[DLG:IDD_PROPS_GENERAL]
163Type=1
164Class=CGeneralPage
165ControlCount=5
166Control1=IDC_STATIC,static,1342308352
167Control2=IDC_HOST,edit,1350631568
168Control3=IDC_STATIC,static,1342308352
169Control4=IDC_DESC,edit,1350631552
170Control5=IDC_LOG_ACTIVITY,button,1342246918
171
172[CLS:CGeneralPage]
173Type=0
174HeaderFile=GeneralPage.h
175ImplementationFile=GeneralPage.cpp
176BaseClass=CPropertyPage
177Filter=D
178LastObject=CGeneralPage
179VirtualFilter=idWC
180
181[CLS:CSettingsPage]
182Type=0
183HeaderFile=SettingsPage.h
184ImplementationFile=SettingsPage.cpp
185BaseClass=CPropertyPage
186Filter=D
187LastObject=CSettingsPage
188VirtualFilter=idWC
189
190[CLS:CHostPropertyPages]
191Type=0
192HeaderFile=HostPropertyPages.h
193ImplementationFile=HostPropertyPages.cpp
194BaseClass=CPropertySheet
195Filter=W
196LastObject=CHostPropertyPages
197VirtualFilter=hWC
198
199[DLG:IDD_PROPS_ACTION]
200Type=1
201Class=CActionPage
202ControlCount=15
203Control1=IDC_OVERRIDE_ACTION,button,1342246915
204Control2=IDC_STATIC,button,1342177287
205Control3=IDC_PLAYASOUND_DOWN,button,1342242819
206Control4=IDC_SOUND_DOWN,combobox,1344340034
207Control5=IDC_BROWSE_SOUND_DOWN,button,1342263104
208Control6=IDC_PREVIEW_SOUND_DOWN,button,1342263104
209Control7=IDC_CUSTOM_DOWN,button,1342242819
210Control8=IDC_PROGRAM_DOWN,edit,1350631552
211Control9=IDC_STATIC,button,1342177287
212Control10=IDC_PLAYASOUND_UP,button,1342242819
213Control11=IDC_SOUND_UP,combobox,1344340034
214Control12=IDC_BROWSE_SOUND_UP,button,1342263104
215Control13=IDC_PREVIEW_SOUND_UP,button,1342263104
216Control14=IDC_CUSTOM_UP,button,1342242819
217Control15=IDC_PROGRAM_UP,edit,1350631552
218
219[CLS:CActionPage]
220Type=0
221HeaderFile=ActionPage.h
222ImplementationFile=ActionPage.cpp
223BaseClass=CPropertyPage
224Filter=D
225LastObject=CActionPage
226VirtualFilter=idWC
227
228[CLS:CActivityView]
229Type=0
230HeaderFile=ActivityView.h
231ImplementationFile=ActivityView.cpp
232BaseClass=CScrollView
233Filter=C
234LastObject=CActivityView
235VirtualFilter=VWC
236
237[MNU:IDM_POPUPS]
238Type=1
239Command1=ID_VIEW_MAINWINDOW
240Command2=ID_HELP_FINDER
241Command3=ID_APP_ABOUT
242Command4=ID_APP_EXIT
243Command5=ID_INDICATOR_PINGBAR
244Command6=ID_EDIT_UNDO
245Command7=ID_EDIT_CUT
246Command8=ID_EDIT_COPY
247Command9=ID_EDIT_PASTE
248Command10=ID_FILE_PRINT
249Command11=ID_FILE_PRINT_PREVIEW
250Command12=ID_FILE_PRINT_SETUP
251CommandCount=12
252
253[ACL:IDR_JUNKACCELERATOR]
254Type=1
255Command1=ID_EDIT_COPY
256Command2=ID_FILE_PRINT
257Command3=ID_EDIT_PASTE
258Command4=ID_EDIT_UNDO
259Command5=ID_EDIT_CUT
260Command6=ID_EDIT_COPY
261Command7=ID_EDIT_PASTE
262Command8=ID_EDIT_CUT
263Command9=ID_EDIT_UNDO
264CommandCount=9
265
266[TB:IDR_JUNKTOOLBAR]
267Type=1
268Command1=ID_FILE_PRINT
269Command2=ID_EDIT_CUT
270Command3=ID_EDIT_COPY
271Command4=ID_EDIT_PASTE
272CommandCount=4
273
274[DLG:IDD_PREFS]
275Type=1
276Class=CPreferences
277ControlCount=26
278Control1=IDC_STATIC,button,1342177287
279Control2=IDC_SAVEONSHUTDOWN,button,1342268163
280Control3=IDC_STATIC,static,1342308352
281Control4=IDC_AUTOSAVEMINS,edit,1350631552
282Control5=IDC_AUTOSPIN,msctls_updown32,1342177463
283Control6=IDC_STATIC,static,1342308352
284Control7=IDC_STATIC,button,1342177287
285Control8=IDC_STATIC,static,1342308608
286Control9=IDC_PINGSIZE,edit,1350631552
287Control10=IDC_DATASIZESPIN,msctls_updown32,1342177463
288Control11=IDC_STATIC,static,1342308352
289Control12=IDC_STATIC,static,1342308352
290Control13=IDC_MAXTHREADS,edit,1350631552
291Control14=IDC_THREADSPIN,msctls_updown32,1342177463
292Control15=IDC_STATIC,static,1342308352
293Control16=IDC_STATIC,button,1342177287
294Control17=IDC_STATIC,static,1342308352
295Control18=IDC_LOGFILE,edit,1350631552
296Control19=IDC_BROWSE,button,1342263104
297Control20=IDC_STATIC,static,1342308352
298Control21=IDC_LOGMINS,edit,1350631552
299Control22=IDC_LOGMINSPIN,msctls_updown32,1342177463
300Control23=IDC_STATIC,static,1342308608
301Control24=IDOK,button,1342242817
302Control25=IDCANCEL,button,1342242816
303Control26=IDC_STOREACTIVITY,button,1342242819
304
305[CLS:CPreferences]
306Type=0
307HeaderFile=Preferences.h
308ImplementationFile=Preferences.cpp
309BaseClass=CDialog
310Filter=D
311LastObject=CPreferences
312VirtualFilter=dWC
313
diff --git a/bigbrother.cpp b/bigbrother.cpp
new file mode 100644
index 0000000..0036987
--- a/dev/null
+++ b/bigbrother.cpp
@@ -0,0 +1,181 @@
1// BigBrother.cpp : Defines the class behaviors for the application.
2//
3
4#include "stdafx.h"
5#include "BigBrother.h"
6
7#include "MainFrm.h"
8#include "BigBrotherDoc.h"
9#include "BigBrotherView.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CBigBrotherApp
19
20BEGIN_MESSAGE_MAP(CBigBrotherApp, CWinApp)
21 //{{AFX_MSG_MAP(CBigBrotherApp)
22 ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
23 ON_UPDATE_COMMAND_UI(ID_FILE_AUTOLOAD, OnUpdateFileAutoload)
24 ON_COMMAND(ID_FILE_AUTOLOAD, OnFileAutoload)
25 ON_COMMAND(ID_HELP_LEGEND, OnHelpLegend)
26 //}}AFX_MSG_MAP
27 // Standard file based document commands
28 ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
29 ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
30 // Standard print setup command
31 ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
32END_MESSAGE_MAP()
33
34/////////////////////////////////////////////////////////////////////////////
35// CBigBrotherApp construction
36
37CBigBrotherApp::CBigBrotherApp()
38{
39 m_bLoadMRUOnStartup=TRUE;
40}
41
42/////////////////////////////////////////////////////////////////////////////
43// The one and only CBigBrotherApp object
44
45CBigBrotherApp theApp;
46
47/////////////////////////////////////////////////////////////////////////////
48// CBigBrotherApp initialization
49
50BOOL CBigBrotherApp::InitInstance()
51{
52 if (!AfxSocketInit())
53 {
54 AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
55 return FALSE;
56 }
57
58 // Standard initialization
59 // If you are not using these features and wish to reduce the size
60 // of your final executable, you should remove from the following
61 // the specific initialization routines you do not need.
62
63#ifdef _AFXDLL
64 Enable3dControls(); // Call this when using MFC in a shared DLL
65#else
66 Enable3dControlsStatic();// Call this when linking to MFC statically
67#endif
68
69 SetRegistryKey(IDS_REGISTRYKEY);
70 m_pszHelpFilePath="bigbro.hlp>Default";
71
72 LoadStdProfileSettings(); // Load standard INI file options (including MRU)
73 m_bLoadMRUOnStartup=GetProfileInt("Settings","LoadMRUOnStartup",m_bLoadMRUOnStartup);
74
75 // Register the application's document templates. Document templates
76 // serve as the connection between documents, frame windows and views.
77
78 CSingleDocTemplate* pDocTemplate;
79 pDocTemplate = new CSingleDocTemplate(
80 IDR_MAINFRAME,
81 RUNTIME_CLASS(CBigBrotherDoc),
82 RUNTIME_CLASS(CMainFrame), // main SDI frame window
83 RUNTIME_CLASS(CBigBrotherView));
84 AddDocTemplate(pDocTemplate);
85
86 // Enable DDE Execute open
87 EnableShellOpen();
88 RegisterShellFileTypes(TRUE);
89
90 // Parse command line for standard shell commands, DDE, file open
91 CCommandLineInfo cmdInfo;
92 ParseCommandLine(cmdInfo);
93
94 // Dispatch commands specified on the command line
95 if (!ProcessShellCommand(cmdInfo))
96 return FALSE;
97 if(m_bLoadMRUOnStartup && (cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew))
98 m_pMainWnd->SendMessage(WM_COMMAND,ID_FILE_MRU_FILE1,0);
99
100 // Enable drag/drop open
101 m_pMainWnd->DragAcceptFiles();
102
103 return TRUE;
104}
105
106/////////////////////////////////////////////////////////////////////////////
107// CAboutDlg dialog used for App About
108
109class CAboutDlg : public CDialog
110{
111public:
112 CAboutDlg();
113
114// Dialog Data
115 //{{AFX_DATA(CAboutDlg)
116 enum { IDD = IDD_ABOUTBOX };
117 //}}AFX_DATA
118
119 // ClassWizard generated virtual function overrides
120 //{{AFX_VIRTUAL(CAboutDlg)
121 protected:
122 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
123 //}}AFX_VIRTUAL
124
125// Implementation
126protected:
127 //{{AFX_MSG(CAboutDlg)
128 // No message handlers
129 //}}AFX_MSG
130 DECLARE_MESSAGE_MAP()
131};
132
133CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
134{
135 //{{AFX_DATA_INIT(CAboutDlg)
136 //}}AFX_DATA_INIT
137}
138
139void CAboutDlg::DoDataExchange(CDataExchange* pDX)
140{
141 CDialog::DoDataExchange(pDX);
142 //{{AFX_DATA_MAP(CAboutDlg)
143 //}}AFX_DATA_MAP
144}
145
146BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
147 //{{AFX_MSG_MAP(CAboutDlg)
148 // No message handlers
149 //}}AFX_MSG_MAP
150END_MESSAGE_MAP()
151
152// App command to run the dialog
153void CBigBrotherApp::OnAppAbout()
154{
155 CAboutDlg aboutDlg;
156 aboutDlg.DoModal();
157}
158
159/////////////////////////////////////////////////////////////////////////////
160// CBigBrotherApp commands
161
162int CBigBrotherApp::ExitInstance()
163{
164 WriteProfileInt("Settings","LoadMRUOnStartup",m_bLoadMRUOnStartup);
165 return CWinApp::ExitInstance();
166}
167
168void CBigBrotherApp::OnUpdateFileAutoload(CCmdUI* pCmdUI)
169{
170 pCmdUI->SetCheck(m_bLoadMRUOnStartup?1:0);
171}
172
173void CBigBrotherApp::OnFileAutoload()
174{
175 m_bLoadMRUOnStartup=!m_bLoadMRUOnStartup;
176}
177
178void CBigBrotherApp::OnHelpLegend()
179{
180 WinHelp(0x10000lu+ID_HELP_LEGEND,HELP_CONTEXTPOPUP);
181}
diff --git a/bigbrother.h b/bigbrother.h
new file mode 100644
index 0000000..1c348dc
--- a/dev/null
+++ b/bigbrother.h
@@ -0,0 +1,41 @@
1// BigBrother.h : main header file for the BIGBROTHER application
2//
3
4#ifndef __AFXWIN_H__
5 #error include 'stdafx.h' before including this file for PCH
6#endif
7
8#include "resource.h" // main symbols
9
10/////////////////////////////////////////////////////////////////////////////
11// CBigBrotherApp:
12// See BigBrother.cpp for the implementation of this class
13//
14
15class CBigBrotherApp : public CWinApp
16{
17public:
18 BOOL m_bLoadMRUOnStartup;
19 CBigBrotherApp();
20
21// Overrides
22 // ClassWizard generated virtual function overrides
23 //{{AFX_VIRTUAL(CBigBrotherApp)
24 public:
25 virtual BOOL InitInstance();
26 virtual int ExitInstance();
27 //}}AFX_VIRTUAL
28
29// Implementation
30
31 //{{AFX_MSG(CBigBrotherApp)
32 afx_msg void OnAppAbout();
33 afx_msg void OnUpdateFileAutoload(CCmdUI* pCmdUI);
34 afx_msg void OnFileAutoload();
35 afx_msg void OnHelpLegend();
36 //}}AFX_MSG
37 DECLARE_MESSAGE_MAP()
38};
39
40
41/////////////////////////////////////////////////////////////////////////////
diff --git a/bigbrother.mak b/bigbrother.mak
new file mode 100644
index 0000000..a5fc893
--- a/dev/null
+++ b/bigbrother.mak
@@ -0,0 +1,1451 @@
1# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
2# ** DO NOT EDIT **
3
4# TARGTYPE "Win32 (x86) Application" 0x0101
5
6!IF "$(CFG)" == ""
7CFG=install - Win32 Debug
8!MESSAGE No configuration specified. Defaulting to install - Win32 Debug.
9!ENDIF
10
11!IF "$(CFG)" != "Big Brother - Win32 Release" && "$(CFG)" !=\
12 "Big Brother - Win32 Debug" && "$(CFG)" != "Big Brother - Win32 Release Static"\
13 && "$(CFG)" != "install - Win32 Debug" && "$(CFG)" != "install - Win32 Pure" &&\
14 "$(CFG)" != "install - Win32 Canned" && "$(CFG)" != "install - Win32 Static"
15!MESSAGE Invalid configuration "$(CFG)" specified.
16!MESSAGE You can specify a configuration when running NMAKE on this makefile
17!MESSAGE by defining the macro CFG on the command line. For example:
18!MESSAGE
19!MESSAGE NMAKE /f "bigbrother.mak" CFG="install - Win32 Debug"
20!MESSAGE
21!MESSAGE Possible choices for configuration are:
22!MESSAGE
23!MESSAGE "Big Brother - Win32 Release" (based on "Win32 (x86) Application")
24!MESSAGE "Big Brother - Win32 Debug" (based on "Win32 (x86) Application")
25!MESSAGE "Big Brother - Win32 Release Static" (based on\
26 "Win32 (x86) Application")
27!MESSAGE "install - Win32 Debug" (based on "Win32 (x86) Application")
28!MESSAGE "install - Win32 Pure" (based on "Win32 (x86) Application")
29!MESSAGE "install - Win32 Canned" (based on "Win32 (x86) Application")
30!MESSAGE "install - Win32 Static" (based on "Win32 (x86) Application")
31!MESSAGE
32!ERROR An invalid configuration is specified.
33!ENDIF
34
35!IF "$(OS)" == "Windows_NT"
36NULL=
37!ELSE
38NULL=nul
39!ENDIF
40################################################################################
41# Begin Project
42# PROP Target_Last_Scanned "install - Win32 Static"
43RSC=rc.exe
44MTL=mktyplib.exe
45CPP=cl.exe
46
47!IF "$(CFG)" == "Big Brother - Win32 Release"
48
49# PROP BASE Use_MFC 6
50# PROP BASE Use_Debug_Libraries 0
51# PROP BASE Output_Dir "Release"
52# PROP BASE Intermediate_Dir "Release"
53# PROP BASE Target_Dir ""
54# PROP Use_MFC 6
55# PROP Use_Debug_Libraries 0
56# PROP Output_Dir "Release"
57# PROP Intermediate_Dir "Release"
58# PROP Target_Dir ""
59OUTDIR=.\Release
60INTDIR=.\Release
61# Begin Custom Macros
62OutDir=.\Release
63TargetName=BigBro
64# End Custom Macros
65
66ALL : "$(OUTDIR)\BigBro.exe" "$(OUTDIR)\BigBro.ex_" "$(OUTDIR)\BigBro.hlp"\
67 "$(OUTDIR)\BigBro.cnt" "$(OUTDIR)\BigBro.hl_" "$(OUTDIR)\BigBro.cn_"
68
69CLEAN :
70 -@erase "$(INTDIR)\ActionPage.obj"
71 -@erase "$(INTDIR)\ActivityView.obj"
72 -@erase "$(INTDIR)\BigBro.cn_"
73 -@erase "$(INTDIR)\BigBro.cnt"
74 -@erase "$(INTDIR)\BigBro.hl_"
75 -@erase "$(INTDIR)\BigBro.hlp"
76 -@erase "$(INTDIR)\BigBrother.obj"
77 -@erase "$(INTDIR)\bigbrother.pch"
78 -@erase "$(INTDIR)\bigbrother.res"
79 -@erase "$(INTDIR)\BigBrotherDoc.obj"
80 -@erase "$(INTDIR)\BigBrotherView.obj"
81 -@erase "$(INTDIR)\GeneralPage.obj"
82 -@erase "$(INTDIR)\HostPropertyPages.obj"
83 -@erase "$(INTDIR)\kICMP.obj"
84 -@erase "$(INTDIR)\MainFrm.obj"
85 -@erase "$(INTDIR)\Preferences.obj"
86 -@erase "$(INTDIR)\SettingsPage.obj"
87 -@erase "$(INTDIR)\StdAfx.obj"
88 -@erase "$(OUTDIR)\BigBro.ex_"
89 -@erase "$(OUTDIR)\BigBro.exe"
90
91"$(OUTDIR)" :
92 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
93
94# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
95# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
96CPP_PROJ=/nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
97 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/bigbrother.pch" /Yu"stdafx.h"\
98 /Fo"$(INTDIR)/" /c
99CPP_OBJS=.\Release/
100CPP_SBRS=.\.
101# ADD BASE MTL /nologo /D "NDEBUG" /win32
102# ADD MTL /nologo /D "NDEBUG" /win32
103MTL_PROJ=/nologo /D "NDEBUG" /win32
104# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
105# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
106RSC_PROJ=/l 0x409 /fo"$(INTDIR)/bigbrother.res" /d "NDEBUG" /d "_AFXDLL"
107BSC32=bscmake.exe
108# ADD BASE BSC32 /nologo
109# ADD BSC32 /nologo
110BSC32_FLAGS=/nologo /o"$(OUTDIR)/bigbrother.bsc"
111BSC32_SBRS= \
112
113LINK32=link.exe
114# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
115# ADD LINK32 /nologo /subsystem:windows /machine:I386 /out:"Release/BigBro.exe"
116LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\
117 /pdb:"$(OUTDIR)/BigBro.pdb" /machine:I386 /out:"$(OUTDIR)/BigBro.exe"
118LINK32_OBJS= \
119 "$(INTDIR)\ActionPage.obj" \
120 "$(INTDIR)\ActivityView.obj" \
121 "$(INTDIR)\BigBrother.obj" \
122 "$(INTDIR)\bigbrother.res" \
123 "$(INTDIR)\BigBrotherDoc.obj" \
124 "$(INTDIR)\BigBrotherView.obj" \
125 "$(INTDIR)\GeneralPage.obj" \
126 "$(INTDIR)\HostPropertyPages.obj" \
127 "$(INTDIR)\kICMP.obj" \
128 "$(INTDIR)\MainFrm.obj" \
129 "$(INTDIR)\Preferences.obj" \
130 "$(INTDIR)\SettingsPage.obj" \
131 "$(INTDIR)\StdAfx.obj"
132
133"$(OUTDIR)\BigBro.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
134 $(LINK32) @<<
135 $(LINK32_FLAGS) $(LINK32_OBJS)
136<<
137
138# Begin Custom Build
139OutDir=.\Release
140TargetName=BigBro
141InputPath=.\Release\BigBro.exe
142SOURCE=$(InputPath)
143
144"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
145 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
146
147# End Custom Build
148
149!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
150
151# PROP BASE Use_MFC 6
152# PROP BASE Use_Debug_Libraries 1
153# PROP BASE Output_Dir "Debug"
154# PROP BASE Intermediate_Dir "Debug"
155# PROP BASE Target_Dir ""
156# PROP Use_MFC 6
157# PROP Use_Debug_Libraries 1
158# PROP Output_Dir "Debug"
159# PROP Intermediate_Dir "Debug"
160# PROP Target_Dir ""
161OUTDIR=.\Debug
162INTDIR=.\Debug
163# Begin Custom Macros
164OutDir=.\Debug
165TargetName=BigBro
166# End Custom Macros
167
168ALL : "$(OUTDIR)\BigBro.exe" "$(OUTDIR)\bigbrother.bsc" "$(OUTDIR)\BigBro.hlp"\
169 "$(OUTDIR)\BigBro.cnt" "$(OUTDIR)\BigBro.hl_" "$(OUTDIR)\BigBro.cn_"\
170 "$(OUTDIR)\bigbro.ex_"
171
172CLEAN :
173 -@erase "$(INTDIR)\ActionPage.obj"
174 -@erase "$(INTDIR)\ActionPage.sbr"
175 -@erase "$(INTDIR)\ActivityView.obj"
176 -@erase "$(INTDIR)\ActivityView.sbr"
177 -@erase "$(INTDIR)\BigBro.cn_"
178 -@erase "$(INTDIR)\BigBro.cnt"
179 -@erase "$(INTDIR)\BigBro.hl_"
180 -@erase "$(INTDIR)\BigBro.hlp"
181 -@erase "$(INTDIR)\BigBrother.obj"
182 -@erase "$(INTDIR)\bigbrother.pch"
183 -@erase "$(INTDIR)\bigbrother.res"
184 -@erase "$(INTDIR)\BigBrother.sbr"
185 -@erase "$(INTDIR)\BigBrotherDoc.obj"
186 -@erase "$(INTDIR)\BigBrotherDoc.sbr"
187 -@erase "$(INTDIR)\BigBrotherView.obj"
188 -@erase "$(INTDIR)\BigBrotherView.sbr"
189 -@erase "$(INTDIR)\GeneralPage.obj"
190 -@erase "$(INTDIR)\GeneralPage.sbr"
191 -@erase "$(INTDIR)\HostPropertyPages.obj"
192 -@erase "$(INTDIR)\HostPropertyPages.sbr"
193 -@erase "$(INTDIR)\kICMP.obj"
194 -@erase "$(INTDIR)\kICMP.sbr"
195 -@erase "$(INTDIR)\MainFrm.obj"
196 -@erase "$(INTDIR)\MainFrm.sbr"
197 -@erase "$(INTDIR)\Preferences.obj"
198 -@erase "$(INTDIR)\Preferences.sbr"
199 -@erase "$(INTDIR)\SettingsPage.obj"
200 -@erase "$(INTDIR)\SettingsPage.sbr"
201 -@erase "$(INTDIR)\StdAfx.obj"
202 -@erase "$(INTDIR)\StdAfx.sbr"
203 -@erase "$(INTDIR)\vc40.idb"
204 -@erase "$(INTDIR)\vc40.pdb"
205 -@erase "$(OUTDIR)\bigbro.ex_"
206 -@erase "$(OUTDIR)\BigBro.exe"
207 -@erase "$(OUTDIR)\BigBro.ilk"
208 -@erase "$(OUTDIR)\BigBro.pdb"
209 -@erase "$(OUTDIR)\bigbrother.bsc"
210
211"$(OUTDIR)" :
212 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
213
214# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
215# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /c
216CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
217 /D "_AFXDLL" /D "_MBCS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/bigbrother.pch"\
218 /Yu"stdafx.h" /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
219CPP_OBJS=.\Debug/
220CPP_SBRS=.\Debug/
221# ADD BASE MTL /nologo /D "_DEBUG" /win32
222# ADD MTL /nologo /D "_DEBUG" /win32
223MTL_PROJ=/nologo /D "_DEBUG" /win32
224# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
225# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
226RSC_PROJ=/l 0x409 /fo"$(INTDIR)/bigbrother.res" /d "_DEBUG" /d "_AFXDLL"
227BSC32=bscmake.exe
228# ADD BASE BSC32 /nologo
229# ADD BSC32 /nologo
230BSC32_FLAGS=/nologo /o"$(OUTDIR)/bigbrother.bsc"
231BSC32_SBRS= \
232 "$(INTDIR)\ActionPage.sbr" \
233 "$(INTDIR)\ActivityView.sbr" \
234 "$(INTDIR)\BigBrother.sbr" \
235 "$(INTDIR)\BigBrotherDoc.sbr" \
236 "$(INTDIR)\BigBrotherView.sbr" \
237 "$(INTDIR)\GeneralPage.sbr" \
238 "$(INTDIR)\HostPropertyPages.sbr" \
239 "$(INTDIR)\kICMP.sbr" \
240 "$(INTDIR)\MainFrm.sbr" \
241 "$(INTDIR)\Preferences.sbr" \
242 "$(INTDIR)\SettingsPage.sbr" \
243 "$(INTDIR)\StdAfx.sbr"
244
245"$(OUTDIR)\bigbrother.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
246 $(BSC32) @<<
247 $(BSC32_FLAGS) $(BSC32_SBRS)
248<<
249
250LINK32=link.exe
251# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
252# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/BigBro.exe"
253LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes\
254 /pdb:"$(OUTDIR)/BigBro.pdb" /debug /machine:I386 /out:"$(OUTDIR)/BigBro.exe"
255LINK32_OBJS= \
256 "$(INTDIR)\ActionPage.obj" \
257 "$(INTDIR)\ActivityView.obj" \
258 "$(INTDIR)\BigBrother.obj" \
259 "$(INTDIR)\bigbrother.res" \
260 "$(INTDIR)\BigBrotherDoc.obj" \
261 "$(INTDIR)\BigBrotherView.obj" \
262 "$(INTDIR)\GeneralPage.obj" \
263 "$(INTDIR)\HostPropertyPages.obj" \
264 "$(INTDIR)\kICMP.obj" \
265 "$(INTDIR)\MainFrm.obj" \
266 "$(INTDIR)\Preferences.obj" \
267 "$(INTDIR)\SettingsPage.obj" \
268 "$(INTDIR)\StdAfx.obj"
269
270"$(OUTDIR)\BigBro.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
271 $(LINK32) @<<
272 $(LINK32_FLAGS) $(LINK32_OBJS)
273<<
274
275# Begin Custom Build
276OutDir=.\Debug
277TargetName=BigBro
278InputPath=.\Debug\BigBro.exe
279SOURCE=$(InputPath)
280
281"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
282 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
283
284# End Custom Build
285
286!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
287
288# PROP BASE Use_MFC 6
289# PROP BASE Use_Debug_Libraries 0
290# PROP BASE Output_Dir "BigBroth"
291# PROP BASE Intermediate_Dir "BigBroth"
292# PROP BASE Target_Dir ""
293# PROP Use_MFC 5
294# PROP Use_Debug_Libraries 0
295# PROP Output_Dir "Releast"
296# PROP Intermediate_Dir "Releast"
297# PROP Target_Dir ""
298OUTDIR=.\Releast
299INTDIR=.\Releast
300# Begin Custom Macros
301OutDir=.\Releast
302TargetName=BigBro
303# End Custom Macros
304
305ALL : "$(OUTDIR)\BigBro.exe" "$(OUTDIR)\BigBro.hlp" "$(OUTDIR)\BigBro.cnt"\
306 "$(OUTDIR)\BigBro.hl_" "$(OUTDIR)\BigBro.cn_" "$(OUTDIR)\bigbro.ex_"
307
308CLEAN :
309 -@erase "$(INTDIR)\ActionPage.obj"
310 -@erase "$(INTDIR)\ActivityView.obj"
311 -@erase "$(INTDIR)\BigBro.cn_"
312 -@erase "$(INTDIR)\BigBro.cnt"
313 -@erase "$(INTDIR)\BigBro.hl_"
314 -@erase "$(INTDIR)\BigBro.hlp"
315 -@erase "$(INTDIR)\BigBrother.obj"
316 -@erase "$(INTDIR)\bigbrother.pch"
317 -@erase "$(INTDIR)\bigbrother.res"
318 -@erase "$(INTDIR)\BigBrotherDoc.obj"
319 -@erase "$(INTDIR)\BigBrotherView.obj"
320 -@erase "$(INTDIR)\GeneralPage.obj"
321 -@erase "$(INTDIR)\HostPropertyPages.obj"
322 -@erase "$(INTDIR)\kICMP.obj"
323 -@erase "$(INTDIR)\MainFrm.obj"
324 -@erase "$(INTDIR)\Preferences.obj"
325 -@erase "$(INTDIR)\SettingsPage.obj"
326 -@erase "$(INTDIR)\StdAfx.obj"
327 -@erase "$(OUTDIR)\bigbro.ex_"
328 -@erase "$(OUTDIR)\BigBro.exe"
329
330"$(OUTDIR)" :
331 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
332
333# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
334# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
335CPP_PROJ=/nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
336 "_MBCS" /Fp"$(INTDIR)/bigbrother.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
337CPP_OBJS=.\Releast/
338CPP_SBRS=.\.
339# ADD BASE MTL /nologo /D "NDEBUG" /win32
340# ADD MTL /nologo /D "NDEBUG" /win32
341MTL_PROJ=/nologo /D "NDEBUG" /win32
342# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
343# ADD RSC /l 0x409 /d "NDEBUG"
344RSC_PROJ=/l 0x409 /fo"$(INTDIR)/bigbrother.res" /d "NDEBUG"
345BSC32=bscmake.exe
346# ADD BASE BSC32 /nologo
347# ADD BSC32 /nologo
348BSC32_FLAGS=/nologo /o"$(OUTDIR)/bigbrother.bsc"
349BSC32_SBRS= \
350
351LINK32=link.exe
352# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
353# ADD LINK32 /nologo /subsystem:windows /machine:I386 /out:"Releast/BigBro.exe"
354LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\
355 /pdb:"$(OUTDIR)/BigBro.pdb" /machine:I386 /out:"$(OUTDIR)/BigBro.exe"
356LINK32_OBJS= \
357 "$(INTDIR)\ActionPage.obj" \
358 "$(INTDIR)\ActivityView.obj" \
359 "$(INTDIR)\BigBrother.obj" \
360 "$(INTDIR)\bigbrother.res" \
361 "$(INTDIR)\BigBrotherDoc.obj" \
362 "$(INTDIR)\BigBrotherView.obj" \
363 "$(INTDIR)\GeneralPage.obj" \
364 "$(INTDIR)\HostPropertyPages.obj" \
365 "$(INTDIR)\kICMP.obj" \
366 "$(INTDIR)\MainFrm.obj" \
367 "$(INTDIR)\Preferences.obj" \
368 "$(INTDIR)\SettingsPage.obj" \
369 "$(INTDIR)\StdAfx.obj"
370
371"$(OUTDIR)\BigBro.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
372 $(LINK32) @<<
373 $(LINK32_FLAGS) $(LINK32_OBJS)
374<<
375
376# Begin Custom Build
377OutDir=.\Releast
378TargetName=BigBro
379InputPath=.\Releast\BigBro.exe
380SOURCE=$(InputPath)
381
382"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
383 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
384
385# End Custom Build
386
387!ELSEIF "$(CFG)" == "install - Win32 Debug"
388
389# PROP BASE Use_MFC 0
390# PROP BASE Use_Debug_Libraries 1
391# PROP BASE Output_Dir "install\Debug"
392# PROP BASE Intermediate_Dir "install\Debug"
393# PROP BASE Target_Dir "install"
394# PROP Use_MFC 0
395# PROP Use_Debug_Libraries 1
396# PROP Output_Dir "install\Debug"
397# PROP Intermediate_Dir "install\Debug"
398# PROP Target_Dir "install"
399OUTDIR=.\install\Debug
400INTDIR=.\install\Debug
401
402ALL : "$(OUTDIR)\install.exe"
403
404CLEAN :
405 -@erase "$(INTDIR)\install.obj"
406 -@erase "$(INTDIR)\install.res"
407 -@erase "$(INTDIR)\vc40.idb"
408 -@erase "$(INTDIR)\vc40.pdb"
409 -@erase "$(OUTDIR)\install.exe"
410 -@erase "$(OUTDIR)\install.ilk"
411 -@erase "$(OUTDIR)\install.pdb"
412
413"$(OUTDIR)" :
414 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
415
416# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
417# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
418CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
419 /Fp"$(INTDIR)/install.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
420CPP_OBJS=.\install\Debug/
421CPP_SBRS=.\.
422# ADD BASE MTL /nologo /D "_DEBUG" /win32
423# ADD MTL /nologo /D "_DEBUG" /win32
424MTL_PROJ=/nologo /D "_DEBUG" /win32
425# ADD BASE RSC /l 0x409 /d "_DEBUG"
426# ADD RSC /l 0x409 /d "_DEBUG"
427RSC_PROJ=/l 0x409 /fo"$(INTDIR)/install.res" /d "_DEBUG"
428BSC32=bscmake.exe
429# ADD BASE BSC32 /nologo
430# ADD BSC32 /nologo
431BSC32_FLAGS=/nologo /o"$(OUTDIR)/install.bsc"
432BSC32_SBRS= \
433
434LINK32=link.exe
435# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
436# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /debug /machine:I386
437LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
438 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
439 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:yes\
440 /pdb:"$(OUTDIR)/install.pdb" /debug /machine:I386 /out:"$(OUTDIR)/install.exe"
441LINK32_OBJS= \
442 "$(INTDIR)\install.obj" \
443 "$(INTDIR)\install.res"
444
445"$(OUTDIR)\install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
446 $(LINK32) @<<
447 $(LINK32_FLAGS) $(LINK32_OBJS)
448<<
449
450!ELSEIF "$(CFG)" == "install - Win32 Pure"
451
452# PROP BASE Use_MFC 0
453# PROP BASE Use_Debug_Libraries 0
454# PROP BASE Output_Dir "install\Pure"
455# PROP BASE Intermediate_Dir "install\Pure"
456# PROP BASE Target_Dir "install"
457# PROP Use_MFC 0
458# PROP Use_Debug_Libraries 0
459# PROP Output_Dir "install\Pure"
460# PROP Intermediate_Dir "install\Pure"
461# PROP Target_Dir "install"
462OUTDIR=.\install\Pure
463INTDIR=.\install\Pure
464
465ALL : "$(OUTDIR)\install.exe"
466
467CLEAN :
468 -@erase "$(INTDIR)\install.obj"
469 -@erase "$(INTDIR)\install.res"
470 -@erase "$(OUTDIR)\install.exe"
471
472"$(OUTDIR)" :
473 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
474
475# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
476# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
477CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
478 /Fp"$(INTDIR)/install.pch" /YX /Fo"$(INTDIR)/" /c
479CPP_OBJS=.\install\Pure/
480CPP_SBRS=.\.
481# ADD BASE MTL /nologo /D "NDEBUG" /win32
482# ADD MTL /nologo /D "NDEBUG" /win32
483MTL_PROJ=/nologo /D "NDEBUG" /win32
484# ADD BASE RSC /l 0x409 /d "NDEBUG"
485# ADD RSC /l 0x409 /d "NDEBUG"
486RSC_PROJ=/l 0x409 /fo"$(INTDIR)/install.res" /d "NDEBUG"
487BSC32=bscmake.exe
488# ADD BASE BSC32 /nologo
489# ADD BSC32 /nologo
490BSC32_FLAGS=/nologo /o"$(OUTDIR)/install.bsc"
491BSC32_SBRS= \
492
493LINK32=link.exe
494# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /machine:I386
495# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /machine:I386
496LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
497 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
498 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
499 /pdb:"$(OUTDIR)/install.pdb" /machine:I386 /out:"$(OUTDIR)/install.exe"
500LINK32_OBJS= \
501 "$(INTDIR)\install.obj" \
502 "$(INTDIR)\install.res"
503
504"$(OUTDIR)\install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
505 $(LINK32) @<<
506 $(LINK32_FLAGS) $(LINK32_OBJS)
507<<
508
509!ELSEIF "$(CFG)" == "install - Win32 Canned"
510
511# PROP BASE Use_MFC 0
512# PROP BASE Use_Debug_Libraries 0
513# PROP BASE Output_Dir "install\Canned"
514# PROP BASE Intermediate_Dir "install\Canned"
515# PROP BASE Target_Dir "install"
516# PROP Use_MFC 0
517# PROP Use_Debug_Libraries 0
518# PROP Output_Dir "install\Canned"
519# PROP Intermediate_Dir "install\Canned"
520# PROP Target_Dir "install"
521OUTDIR=.\install\Canned
522INTDIR=.\install\Canned
523
524ALL : "$(OUTDIR)\install.exe"
525
526CLEAN :
527 -@erase "$(INTDIR)\install.obj"
528 -@erase "$(INTDIR)\install.res"
529 -@erase "$(OUTDIR)\install.exe"
530
531"$(OUTDIR)" :
532 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
533
534# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
535# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "K_ANNED" /YX /c
536CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
537 "K_ANNED" /Fp"$(INTDIR)/install.pch" /YX /Fo"$(INTDIR)/" /c
538CPP_OBJS=.\install\Canned/
539CPP_SBRS=.\.
540# ADD BASE MTL /nologo /D "NDEBUG" /win32
541# ADD MTL /nologo /D "NDEBUG" /win32
542MTL_PROJ=/nologo /D "NDEBUG" /win32
543# ADD BASE RSC /l 0x409 /d "NDEBUG"
544# ADD RSC /l 0x409 /d "NDEBUG" /d "K_ANNED"
545RSC_PROJ=/l 0x409 /fo"$(INTDIR)/install.res" /d "NDEBUG" /d "K_ANNED"
546BSC32=bscmake.exe
547# ADD BASE BSC32 /nologo
548# ADD BSC32 /nologo
549BSC32_FLAGS=/nologo /o"$(OUTDIR)/install.bsc"
550BSC32_SBRS= \
551
552LINK32=link.exe
553# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /machine:I386
554# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /machine:I386
555LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
556 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
557 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
558 /pdb:"$(OUTDIR)/install.pdb" /machine:I386 /out:"$(OUTDIR)/install.exe"
559LINK32_OBJS= \
560 "$(INTDIR)\install.obj" \
561 "$(INTDIR)\install.res"
562
563"$(OUTDIR)\install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
564 $(LINK32) @<<
565 $(LINK32_FLAGS) $(LINK32_OBJS)
566<<
567
568!ELSEIF "$(CFG)" == "install - Win32 Static"
569
570# PROP BASE Use_MFC 0
571# PROP BASE Use_Debug_Libraries 0
572# PROP BASE Output_Dir "install\Static"
573# PROP BASE Intermediate_Dir "install\Static"
574# PROP BASE Target_Dir "install"
575# PROP Use_MFC 0
576# PROP Use_Debug_Libraries 0
577# PROP Output_Dir "install\Static"
578# PROP Intermediate_Dir "install\Static"
579# PROP Target_Dir "install"
580OUTDIR=.\install\Static
581INTDIR=.\install\Static
582
583ALL : "$(OUTDIR)\install.exe"
584
585CLEAN :
586 -@erase "$(INTDIR)\install.obj"
587 -@erase "$(INTDIR)\install.res"
588 -@erase "$(OUTDIR)\install.exe"
589
590"$(OUTDIR)" :
591 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
592
593# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
594# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATI_K" /YX /c
595CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
596 "STATI_K" /Fp"$(INTDIR)/install.pch" /YX /Fo"$(INTDIR)/" /c
597CPP_OBJS=.\install\Static/
598CPP_SBRS=.\.
599# ADD BASE MTL /nologo /D "NDEBUG" /win32
600# ADD MTL /nologo /D "NDEBUG" /win32
601MTL_PROJ=/nologo /D "NDEBUG" /win32
602# ADD BASE RSC /l 0x409 /d "NDEBUG"
603# ADD RSC /l 0x409 /d "NDEBUG" /d "STATI_K"
604RSC_PROJ=/l 0x409 /fo"$(INTDIR)/install.res" /d "NDEBUG" /d "STATI_K"
605BSC32=bscmake.exe
606# ADD BASE BSC32 /nologo
607# ADD BSC32 /nologo
608BSC32_FLAGS=/nologo /o"$(OUTDIR)/install.bsc"
609BSC32_SBRS= \
610
611LINK32=link.exe
612# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /machine:I386
613# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /machine:I386
614LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
615 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
616 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
617 /pdb:"$(OUTDIR)/install.pdb" /machine:I386 /out:"$(OUTDIR)/install.exe"
618LINK32_OBJS= \
619 "$(INTDIR)\install.obj" \
620 "$(INTDIR)\install.res"
621
622"$(OUTDIR)\install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
623 $(LINK32) @<<
624 $(LINK32_FLAGS) $(LINK32_OBJS)
625<<
626
627!ENDIF
628
629.c{$(CPP_OBJS)}.obj:
630 $(CPP) $(CPP_PROJ) $<
631
632.cpp{$(CPP_OBJS)}.obj:
633 $(CPP) $(CPP_PROJ) $<
634
635.cxx{$(CPP_OBJS)}.obj:
636 $(CPP) $(CPP_PROJ) $<
637
638.c{$(CPP_SBRS)}.sbr:
639 $(CPP) $(CPP_PROJ) $<
640
641.cpp{$(CPP_SBRS)}.sbr:
642 $(CPP) $(CPP_PROJ) $<
643
644.cxx{$(CPP_SBRS)}.sbr:
645 $(CPP) $(CPP_PROJ) $<
646
647################################################################################
648# Begin Target
649
650# Name "Big Brother - Win32 Release"
651# Name "Big Brother - Win32 Debug"
652# Name "Big Brother - Win32 Release Static"
653
654!IF "$(CFG)" == "Big Brother - Win32 Release"
655
656!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
657
658!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
659
660!ENDIF
661
662################################################################################
663# Begin Source File
664
665SOURCE=.\BigBrother.cpp
666DEP_CPP_BIGBR=\
667 ".\bigbrother.h"\
668 ".\BigBrotherDoc.h"\
669 ".\BigBrotherView.h"\
670 ".\MainFrm.h"\
671 ".\shared-code\ip_icmp.h"\
672 ".\shared-code\kICMP.h"\
673 ".\shared-code\ms_icmp.h"\
674 ".\stdafx.h"\
675
676
677!IF "$(CFG)" == "Big Brother - Win32 Release"
678
679
680"$(INTDIR)\BigBrother.obj" : $(SOURCE) $(DEP_CPP_BIGBR) "$(INTDIR)"\
681 "$(INTDIR)\bigbrother.pch"
682
683
684!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
685
686
687"$(INTDIR)\BigBrother.obj" : $(SOURCE) $(DEP_CPP_BIGBR) "$(INTDIR)"\
688 "$(INTDIR)\bigbrother.pch"
689
690"$(INTDIR)\BigBrother.sbr" : $(SOURCE) $(DEP_CPP_BIGBR) "$(INTDIR)"\
691 "$(INTDIR)\bigbrother.pch"
692
693
694!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
695
696
697"$(INTDIR)\BigBrother.obj" : $(SOURCE) $(DEP_CPP_BIGBR) "$(INTDIR)"\
698 "$(INTDIR)\bigbrother.pch"
699
700
701!ENDIF
702
703# End Source File
704################################################################################
705# Begin Source File
706
707SOURCE=.\StdAfx.cpp
708DEP_CPP_STDAF=\
709 ".\shared-code\ip_icmp.h"\
710 ".\shared-code\kICMP.h"\
711 ".\shared-code\ms_icmp.h"\
712 ".\stdafx.h"\
713
714
715!IF "$(CFG)" == "Big Brother - Win32 Release"
716
717# ADD CPP /Yc"stdafx.h"
718
719BuildCmds= \
720 $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
721 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/bigbrother.pch" /Yc"stdafx.h"\
722 /Fo"$(INTDIR)/" /c $(SOURCE) \
723
724
725"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
726 $(BuildCmds)
727
728"$(INTDIR)\bigbrother.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
729 $(BuildCmds)
730
731!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
732
733# ADD CPP /Yc"stdafx.h"
734
735BuildCmds= \
736 $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
737 /D "_AFXDLL" /D "_MBCS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/bigbrother.pch"\
738 /Yc"stdafx.h" /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) \
739
740
741"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
742 $(BuildCmds)
743
744"$(INTDIR)\StdAfx.sbr" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
745 $(BuildCmds)
746
747"$(INTDIR)\bigbrother.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
748 $(BuildCmds)
749
750!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
751
752# ADD BASE CPP /Yc"stdafx.h"
753# ADD CPP /Yc"stdafx.h"
754
755BuildCmds= \
756 $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS"\
757 /Fp"$(INTDIR)/bigbrother.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
758
759
760"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
761 $(BuildCmds)
762
763"$(INTDIR)\bigbrother.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
764 $(BuildCmds)
765
766!ENDIF
767
768# End Source File
769################################################################################
770# Begin Source File
771
772SOURCE=.\MainFrm.cpp
773DEP_CPP_MAINF=\
774 ".\ActivityView.h"\
775 ".\bigbrother.h"\
776 ".\BigBrotherDoc.h"\
777 ".\BigBrotherView.h"\
778 ".\HostPropertyPages.h"\
779 ".\MainFrm.h"\
780 ".\shared-code\ip_icmp.h"\
781 ".\shared-code\kICMP.h"\
782 ".\shared-code\ms_icmp.h"\
783 ".\stdafx.h"\
784
785
786!IF "$(CFG)" == "Big Brother - Win32 Release"
787
788
789"$(INTDIR)\MainFrm.obj" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
790 "$(INTDIR)\bigbrother.pch"
791
792
793!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
794
795
796"$(INTDIR)\MainFrm.obj" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
797 "$(INTDIR)\bigbrother.pch"
798
799"$(INTDIR)\MainFrm.sbr" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
800 "$(INTDIR)\bigbrother.pch"
801
802
803!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
804
805
806"$(INTDIR)\MainFrm.obj" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
807 "$(INTDIR)\bigbrother.pch"
808
809
810!ENDIF
811
812# End Source File
813################################################################################
814# Begin Source File
815
816SOURCE=.\BigBrotherDoc.cpp
817DEP_CPP_BIGBRO=\
818 ".\ActivityView.h"\
819 ".\bigbrother.h"\
820 ".\BigBrotherDoc.h"\
821 ".\BigBrotherView.h"\
822 ".\HostPropertyPages.h"\
823 ".\MainFrm.h"\
824 ".\Preferences.h"\
825 ".\shared-code\ip_icmp.h"\
826 ".\shared-code\kICMP.h"\
827 ".\shared-code\ms_icmp.h"\
828 ".\stdafx.h"\
829
830
831!IF "$(CFG)" == "Big Brother - Win32 Release"
832
833
834"$(INTDIR)\BigBrotherDoc.obj" : $(SOURCE) $(DEP_CPP_BIGBRO) "$(INTDIR)"\
835 "$(INTDIR)\bigbrother.pch"
836
837
838!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
839
840
841"$(INTDIR)\BigBrotherDoc.obj" : $(SOURCE) $(DEP_CPP_BIGBRO) "$(INTDIR)"\
842 "$(INTDIR)\bigbrother.pch"
843
844"$(INTDIR)\BigBrotherDoc.sbr" : $(SOURCE) $(DEP_CPP_BIGBRO) "$(INTDIR)"\
845 "$(INTDIR)\bigbrother.pch"
846
847
848!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
849
850
851"$(INTDIR)\BigBrotherDoc.obj" : $(SOURCE) $(DEP_CPP_BIGBRO) "$(INTDIR)"\
852 "$(INTDIR)\bigbrother.pch"
853
854
855!ENDIF
856
857# End Source File
858################################################################################
859# Begin Source File
860
861SOURCE=.\BigBrotherView.cpp
862DEP_CPP_BIGBROT=\
863 ".\bigbrother.h"\
864 ".\BigBrotherDoc.h"\
865 ".\BigBrotherView.h"\
866 ".\HostPropertyPages.h"\
867 ".\MainFrm.h"\
868 ".\shared-code\ip_icmp.h"\
869 ".\shared-code\kICMP.h"\
870 ".\shared-code\ms_icmp.h"\
871 ".\stdafx.h"\
872
873
874!IF "$(CFG)" == "Big Brother - Win32 Release"
875
876
877"$(INTDIR)\BigBrotherView.obj" : $(SOURCE) $(DEP_CPP_BIGBROT) "$(INTDIR)"\
878 "$(INTDIR)\bigbrother.pch"
879
880
881!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
882
883
884"$(INTDIR)\BigBrotherView.obj" : $(SOURCE) $(DEP_CPP_BIGBROT) "$(INTDIR)"\
885 "$(INTDIR)\bigbrother.pch"
886
887"$(INTDIR)\BigBrotherView.sbr" : $(SOURCE) $(DEP_CPP_BIGBROT) "$(INTDIR)"\
888 "$(INTDIR)\bigbrother.pch"
889
890
891!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
892
893
894"$(INTDIR)\BigBrotherView.obj" : $(SOURCE) $(DEP_CPP_BIGBROT) "$(INTDIR)"\
895 "$(INTDIR)\bigbrother.pch"
896
897
898!ENDIF
899
900# End Source File
901################################################################################
902# Begin Source File
903
904SOURCE=.\bigbrother.rc
905DEP_RSC_BIGBROTH=\
906 ".\res\3angle.avi"\
907 ".\res\bigbrother.ico"\
908 ".\res\bigbrother.rc2"\
909 ".\res\BigBrotherDoc.ico"\
910 ".\res\goingdown.ico"\
911 ".\res\host-down.wav"\
912 ".\res\host-up.wav"\
913 ".\res\host.ico"\
914 ".\res\hostdown.ico"\
915 ".\res\junktoolbar.bmp"\
916 ".\res\maintoolbar.bmp"\
917 ".\res\nohost.ico"\
918 ".\res\pending.ico"\
919 ".\res\pinging.ico"\
920 ".\shared-data\browse-icon.ico"\
921 ".\shared-data\play-icon.ico"\
922
923
924!IF "$(CFG)" == "Big Brother - Win32 Release"
925
926
927"$(INTDIR)\bigbrother.res" : $(SOURCE) $(DEP_RSC_BIGBROTH) "$(INTDIR)"
928 $(RSC) $(RSC_PROJ) $(SOURCE)
929
930
931!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
932
933
934"$(INTDIR)\bigbrother.res" : $(SOURCE) $(DEP_RSC_BIGBROTH) "$(INTDIR)"
935 $(RSC) $(RSC_PROJ) $(SOURCE)
936
937
938!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
939
940
941"$(INTDIR)\bigbrother.res" : $(SOURCE) $(DEP_RSC_BIGBROTH) "$(INTDIR)"
942 $(RSC) $(RSC_PROJ) $(SOURCE)
943
944
945!ENDIF
946
947# End Source File
948################################################################################
949# Begin Source File
950
951SOURCE=.\GeneralPage.cpp
952DEP_CPP_GENER=\
953 ".\bigbrother.h"\
954 ".\BigBrotherDoc.h"\
955 ".\BigBrotherView.h"\
956 ".\GeneralPage.h"\
957 ".\HostPropertyPages.h"\
958 ".\shared-code\ip_icmp.h"\
959 ".\shared-code\kICMP.h"\
960 ".\shared-code\ms_icmp.h"\
961 ".\stdafx.h"\
962
963
964!IF "$(CFG)" == "Big Brother - Win32 Release"
965
966
967"$(INTDIR)\GeneralPage.obj" : $(SOURCE) $(DEP_CPP_GENER) "$(INTDIR)"\
968 "$(INTDIR)\bigbrother.pch"
969
970
971!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
972
973
974"$(INTDIR)\GeneralPage.obj" : $(SOURCE) $(DEP_CPP_GENER) "$(INTDIR)"\
975 "$(INTDIR)\bigbrother.pch"
976
977"$(INTDIR)\GeneralPage.sbr" : $(SOURCE) $(DEP_CPP_GENER) "$(INTDIR)"\
978 "$(INTDIR)\bigbrother.pch"
979
980
981!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
982
983
984"$(INTDIR)\GeneralPage.obj" : $(SOURCE) $(DEP_CPP_GENER) "$(INTDIR)"\
985 "$(INTDIR)\bigbrother.pch"
986
987
988!ENDIF
989
990# End Source File
991################################################################################
992# Begin Source File
993
994SOURCE=.\SettingsPage.cpp
995DEP_CPP_SETTI=\
996 ".\bigbrother.h"\
997 ".\BigBrotherDoc.h"\
998 ".\BigBrotherView.h"\
999 ".\HostPropertyPages.h"\
1000 ".\SettingsPage.h"\
1001 ".\shared-code\ip_icmp.h"\
1002 ".\shared-code\kICMP.h"\
1003 ".\shared-code\ms_icmp.h"\
1004 ".\stdafx.h"\
1005
1006
1007!IF "$(CFG)" == "Big Brother - Win32 Release"
1008
1009
1010"$(INTDIR)\SettingsPage.obj" : $(SOURCE) $(DEP_CPP_SETTI) "$(INTDIR)"\
1011 "$(INTDIR)\bigbrother.pch"
1012
1013
1014!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
1015
1016
1017"$(INTDIR)\SettingsPage.obj" : $(SOURCE) $(DEP_CPP_SETTI) "$(INTDIR)"\
1018 "$(INTDIR)\bigbrother.pch"
1019
1020"$(INTDIR)\SettingsPage.sbr" : $(SOURCE) $(DEP_CPP_SETTI) "$(INTDIR)"\
1021 "$(INTDIR)\bigbrother.pch"
1022
1023
1024!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
1025
1026
1027"$(INTDIR)\SettingsPage.obj" : $(SOURCE) $(DEP_CPP_SETTI) "$(INTDIR)"\
1028 "$(INTDIR)\bigbrother.pch"
1029
1030
1031!ENDIF
1032
1033# End Source File
1034################################################################################
1035# Begin Source File
1036
1037SOURCE=.\HostPropertyPages.cpp
1038DEP_CPP_HOSTP=\
1039 ".\ActionPage.h"\
1040 ".\bigbrother.h"\
1041 ".\BigBrotherDoc.h"\
1042 ".\BigBrotherView.h"\
1043 ".\GeneralPage.h"\
1044 ".\HostPropertyPages.h"\
1045 ".\SettingsPage.h"\
1046 ".\shared-code\ip_icmp.h"\
1047 ".\shared-code\kICMP.h"\
1048 ".\shared-code\ms_icmp.h"\
1049 ".\stdafx.h"\
1050
1051
1052!IF "$(CFG)" == "Big Brother - Win32 Release"
1053
1054
1055"$(INTDIR)\HostPropertyPages.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
1056 "$(INTDIR)\bigbrother.pch"
1057
1058
1059!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
1060
1061
1062"$(INTDIR)\HostPropertyPages.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
1063 "$(INTDIR)\bigbrother.pch"
1064
1065"$(INTDIR)\HostPropertyPages.sbr" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
1066 "$(INTDIR)\bigbrother.pch"
1067
1068
1069!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
1070
1071
1072"$(INTDIR)\HostPropertyPages.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
1073 "$(INTDIR)\bigbrother.pch"
1074
1075
1076!ENDIF
1077
1078# End Source File
1079################################################################################
1080# Begin Source File
1081
1082SOURCE=.\ActionPage.cpp
1083DEP_CPP_ACTIO=\
1084 ".\ActionPage.h"\
1085 ".\bigbrother.h"\
1086 ".\BigBrotherDoc.h"\
1087 ".\BigBrotherView.h"\
1088 ".\HostPropertyPages.h"\
1089 ".\shared-code\ip_icmp.h"\
1090 ".\shared-code\kICMP.h"\
1091 ".\shared-code\ms_icmp.h"\
1092 ".\stdafx.h"\
1093
1094
1095!IF "$(CFG)" == "Big Brother - Win32 Release"
1096
1097
1098"$(INTDIR)\ActionPage.obj" : $(SOURCE) $(DEP_CPP_ACTIO) "$(INTDIR)"\
1099 "$(INTDIR)\bigbrother.pch"
1100
1101
1102!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
1103
1104
1105"$(INTDIR)\ActionPage.obj" : $(SOURCE) $(DEP_CPP_ACTIO) "$(INTDIR)"\
1106 "$(INTDIR)\bigbrother.pch"
1107
1108"$(INTDIR)\ActionPage.sbr" : $(SOURCE) $(DEP_CPP_ACTIO) "$(INTDIR)"\
1109 "$(INTDIR)\bigbrother.pch"
1110
1111
1112!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
1113
1114
1115"$(INTDIR)\ActionPage.obj" : $(SOURCE) $(DEP_CPP_ACTIO) "$(INTDIR)"\
1116 "$(INTDIR)\bigbrother.pch"
1117
1118
1119!ENDIF
1120
1121# End Source File
1122################################################################################
1123# Begin Source File
1124
1125SOURCE=.\ActivityView.cpp
1126DEP_CPP_ACTIV=\
1127 ".\ActivityView.h"\
1128 ".\bigbrother.h"\
1129 ".\BigBrotherDoc.h"\
1130 ".\shared-code\ip_icmp.h"\
1131 ".\shared-code\kICMP.h"\
1132 ".\shared-code\ms_icmp.h"\
1133 ".\stdafx.h"\
1134
1135
1136!IF "$(CFG)" == "Big Brother - Win32 Release"
1137
1138
1139"$(INTDIR)\ActivityView.obj" : $(SOURCE) $(DEP_CPP_ACTIV) "$(INTDIR)"\
1140 "$(INTDIR)\bigbrother.pch"
1141
1142
1143!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
1144
1145
1146"$(INTDIR)\ActivityView.obj" : $(SOURCE) $(DEP_CPP_ACTIV) "$(INTDIR)"\
1147 "$(INTDIR)\bigbrother.pch"
1148
1149"$(INTDIR)\ActivityView.sbr" : $(SOURCE) $(DEP_CPP_ACTIV) "$(INTDIR)"\
1150 "$(INTDIR)\bigbrother.pch"
1151
1152
1153!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
1154
1155
1156"$(INTDIR)\ActivityView.obj" : $(SOURCE) $(DEP_CPP_ACTIV) "$(INTDIR)"\
1157 "$(INTDIR)\bigbrother.pch"
1158
1159
1160!ENDIF
1161
1162# End Source File
1163################################################################################
1164# Begin Source File
1165
1166SOURCE=.\Preferences.cpp
1167DEP_CPP_PREFE=\
1168 ".\bigbrother.h"\
1169 ".\Preferences.h"\
1170 ".\shared-code\ip_icmp.h"\
1171 ".\shared-code\kICMP.h"\
1172 ".\shared-code\ms_icmp.h"\
1173 ".\stdafx.h"\
1174
1175
1176!IF "$(CFG)" == "Big Brother - Win32 Release"
1177
1178
1179"$(INTDIR)\Preferences.obj" : $(SOURCE) $(DEP_CPP_PREFE) "$(INTDIR)"\
1180 "$(INTDIR)\bigbrother.pch"
1181
1182
1183!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
1184
1185
1186"$(INTDIR)\Preferences.obj" : $(SOURCE) $(DEP_CPP_PREFE) "$(INTDIR)"\
1187 "$(INTDIR)\bigbrother.pch"
1188
1189"$(INTDIR)\Preferences.sbr" : $(SOURCE) $(DEP_CPP_PREFE) "$(INTDIR)"\
1190 "$(INTDIR)\bigbrother.pch"
1191
1192
1193!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
1194
1195
1196"$(INTDIR)\Preferences.obj" : $(SOURCE) $(DEP_CPP_PREFE) "$(INTDIR)"\
1197 "$(INTDIR)\bigbrother.pch"
1198
1199
1200!ENDIF
1201
1202# End Source File
1203################################################################################
1204# Begin Source File
1205
1206SOURCE=.\help\bigbrother.hpj
1207
1208!IF "$(CFG)" == "Big Brother - Win32 Release"
1209
1210# Begin Custom Build - Making help file..
1211OutDir=.\Release
1212ProjDir=.
1213TargetName=BigBro
1214InputPath=.\help\bigbrother.hpj
1215
1216BuildCmds= \
1217 "$(ProjDir)\makehelp.bat" \
1218 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
1219 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
1220
1221
1222"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1223 $(BuildCmds)
1224
1225"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1226 $(BuildCmds)
1227
1228"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1229 $(BuildCmds)
1230
1231"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1232 $(BuildCmds)
1233# End Custom Build
1234
1235!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
1236
1237# Begin Custom Build - Making help file..
1238OutDir=.\Debug
1239ProjDir=.
1240TargetName=BigBro
1241InputPath=.\help\bigbrother.hpj
1242
1243BuildCmds= \
1244 "$(ProjDir)\makehelp.bat" \
1245 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
1246 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
1247
1248
1249"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1250 $(BuildCmds)
1251
1252"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1253 $(BuildCmds)
1254
1255"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1256 $(BuildCmds)
1257
1258"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1259 $(BuildCmds)
1260# End Custom Build
1261
1262!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
1263
1264# Begin Custom Build - Making help file..
1265OutDir=.\Releast
1266ProjDir=.
1267TargetName=BigBro
1268InputPath=.\help\bigbrother.hpj
1269
1270BuildCmds= \
1271 "$(ProjDir)\makehelp.bat" \
1272 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
1273 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
1274
1275
1276"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1277 $(BuildCmds)
1278
1279"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1280 $(BuildCmds)
1281
1282"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1283 $(BuildCmds)
1284
1285"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1286 $(BuildCmds)
1287# End Custom Build
1288
1289!ENDIF
1290
1291# End Source File
1292################################################################################
1293# Begin Source File
1294
1295SOURCE=".\shared-code\kICMP.cpp"
1296DEP_CPP_KICMP=\
1297 ".\shared-code\ip_icmp.h"\
1298 ".\shared-code\kICMP.h"\
1299 ".\shared-code\ms_icmp.h"\
1300 ".\stdafx.h"\
1301
1302
1303!IF "$(CFG)" == "Big Brother - Win32 Release"
1304
1305# ADD CPP /Yu"../stdafx.h"
1306
1307"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
1308 "$(INTDIR)\bigbrother.pch"
1309 $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
1310 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/bigbrother.pch" /Yu"../stdafx.h"\
1311 /Fo"$(INTDIR)/" /c $(SOURCE)
1312
1313
1314!ELSEIF "$(CFG)" == "Big Brother - Win32 Debug"
1315
1316# ADD CPP /Yu"../stdafx.h"
1317
1318BuildCmds= \
1319 $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
1320 /D "_AFXDLL" /D "_MBCS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/bigbrother.pch"\
1321 /Yu"../stdafx.h" /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) \
1322
1323
1324"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
1325 "$(INTDIR)\bigbrother.pch"
1326 $(BuildCmds)
1327
1328"$(INTDIR)\kICMP.sbr" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
1329 "$(INTDIR)\bigbrother.pch"
1330 $(BuildCmds)
1331
1332!ELSEIF "$(CFG)" == "Big Brother - Win32 Release Static"
1333
1334# ADD BASE CPP /Yu"../stdafx.h"
1335# ADD CPP /Yu"../stdafx.h"
1336
1337"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
1338 "$(INTDIR)\bigbrother.pch"
1339 $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
1340 "_MBCS" /Fp"$(INTDIR)/bigbrother.pch" /Yu"../stdafx.h" /Fo"$(INTDIR)/" /c\
1341 $(SOURCE)
1342
1343
1344!ENDIF
1345
1346# End Source File
1347# End Target
1348################################################################################
1349# Begin Target
1350
1351# Name "install - Win32 Debug"
1352# Name "install - Win32 Pure"
1353# Name "install - Win32 Canned"
1354# Name "install - Win32 Static"
1355
1356!IF "$(CFG)" == "install - Win32 Debug"
1357
1358!ELSEIF "$(CFG)" == "install - Win32 Pure"
1359
1360!ELSEIF "$(CFG)" == "install - Win32 Canned"
1361
1362!ELSEIF "$(CFG)" == "install - Win32 Static"
1363
1364!ENDIF
1365
1366################################################################################
1367# Begin Source File
1368
1369SOURCE=.\install\install.cpp
1370DEP_CPP_INSTA=\
1371 ".\shared-code\install.h"\
1372
1373
1374!IF "$(CFG)" == "install - Win32 Debug"
1375
1376
1377"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTA) "$(INTDIR)"
1378 $(CPP) $(CPP_PROJ) $(SOURCE)
1379
1380
1381!ELSEIF "$(CFG)" == "install - Win32 Pure"
1382
1383
1384"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTA) "$(INTDIR)"
1385 $(CPP) $(CPP_PROJ) $(SOURCE)
1386
1387
1388!ELSEIF "$(CFG)" == "install - Win32 Canned"
1389
1390
1391"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTA) "$(INTDIR)"
1392 $(CPP) $(CPP_PROJ) $(SOURCE)
1393
1394
1395!ELSEIF "$(CFG)" == "install - Win32 Static"
1396
1397
1398"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTA) "$(INTDIR)"
1399 $(CPP) $(CPP_PROJ) $(SOURCE)
1400
1401
1402!ENDIF
1403
1404# End Source File
1405################################################################################
1406# Begin Source File
1407
1408SOURCE=.\install\install.rc
1409DEP_RSC_INSTAL=\
1410 ".\install\custom.rch"\
1411 ".\shared-data\install-icon.ico"\
1412
1413
1414!IF "$(CFG)" == "install - Win32 Debug"
1415
1416
1417"$(INTDIR)\install.res" : $(SOURCE) $(DEP_RSC_INSTAL) "$(INTDIR)"
1418 $(RSC) /l 0x409 /fo"$(INTDIR)/install.res" /i "install" /d "_DEBUG"\
1419 $(SOURCE)
1420
1421
1422!ELSEIF "$(CFG)" == "install - Win32 Pure"
1423
1424
1425"$(INTDIR)\install.res" : $(SOURCE) $(DEP_RSC_INSTAL) "$(INTDIR)"
1426 $(RSC) /l 0x409 /fo"$(INTDIR)/install.res" /i "install" /d "NDEBUG"\
1427 $(SOURCE)
1428
1429
1430!ELSEIF "$(CFG)" == "install - Win32 Canned"
1431
1432
1433"$(INTDIR)\install.res" : $(SOURCE) $(DEP_RSC_INSTAL) "$(INTDIR)"
1434 $(RSC) /l 0x409 /fo"$(INTDIR)/install.res" /i "install" /d "NDEBUG" /d\
1435 "K_ANNED" $(SOURCE)
1436
1437
1438!ELSEIF "$(CFG)" == "install - Win32 Static"
1439
1440
1441"$(INTDIR)\install.res" : $(SOURCE) $(DEP_RSC_INSTAL) "$(INTDIR)"
1442 $(RSC) /l 0x409 /fo"$(INTDIR)/install.res" /i "install" /d "NDEBUG" /d\
1443 "STATI_K" $(SOURCE)
1444
1445
1446!ENDIF
1447
1448# End Source File
1449# End Target
1450# End Project
1451################################################################################
diff --git a/bigbrother.rc b/bigbrother.rc
new file mode 100644
index 0000000..787af72
--- a/dev/null
+++ b/bigbrother.rc
@@ -0,0 +1,729 @@
1//Microsoft Developer Studio generated resource script.
2//
3#include "resource.h"
4
5#define APSTUDIO_READONLY_SYMBOLS
6/////////////////////////////////////////////////////////////////////////////
7//
8// Generated from the TEXTINCLUDE 2 resource.
9//
10#include "afxres.h"
11
12/////////////////////////////////////////////////////////////////////////////
13#undef APSTUDIO_READONLY_SYMBOLS
14
15/////////////////////////////////////////////////////////////////////////////
16// English (U.S.) resources
17
18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19#ifdef _WIN32
20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21#pragma code_page(1252)
22#endif //_WIN32
23
24#ifdef APSTUDIO_INVOKED
25/////////////////////////////////////////////////////////////////////////////
26//
27// TEXTINCLUDE
28//
29
301 TEXTINCLUDE DISCARDABLE
31BEGIN
32 "resource.h\0"
33END
34
352 TEXTINCLUDE DISCARDABLE
36BEGIN
37 "#include ""afxres.h""\r\n"
38 "\0"
39END
40
413 TEXTINCLUDE DISCARDABLE
42BEGIN
43 "#define _AFX_NO_OLE_RESOURCES\r\n"
44 "#define _AFX_NO_TRACKER_RESOURCES\r\n"
45 "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
46 "\r\n"
47 "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
48 "#ifdef _WIN32\r\n"
49 "LANGUAGE 9, 1\r\n"
50 "#pragma code_page(1252)\r\n"
51 "#endif\r\n"
52 "#include ""res\\BigBrother.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
53 "#include ""afxres.rc"" // Standard components\r\n"
54 "#include ""afxprint.rc"" // printing/print preview resources\r\n"
55 "#endif\0"
56END
57
58#endif // APSTUDIO_INVOKED
59
60
61/////////////////////////////////////////////////////////////////////////////
62//
63// Icon
64//
65
66// Icon with lowest ID value placed first to ensure application icon
67// remains consistent on all systems.
68IDR_MAINFRAME ICON DISCARDABLE "res\\bigbrother.ico"
69IDR_BIGBROTYPE ICON DISCARDABLE "res\\BigBrotherDoc.ico"
70IDI_NOHOST ICON DISCARDABLE "res\\nohost.ico"
71IDI_PENDING ICON DISCARDABLE "res\\pending.ico"
72IDI_HOST ICON DISCARDABLE "res\\host.ico"
73IDI_PINGING ICON DISCARDABLE "res\\pinging.ico"
74IDI_GOINGDOWN ICON DISCARDABLE "res\\goingdown.ico"
75IDI_HOSTDOWN ICON DISCARDABLE "res\\hostdown.ico"
76IDI_PREPLAY ICON DISCARDABLE "shared-data/play-icon.ico"
77IDI_BROWSESOUND ICON DISCARDABLE "shared-data/browse-icon.ico"
78
79/////////////////////////////////////////////////////////////////////////////
80//
81// Bitmap
82//
83
84IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\maintoolbar.bmp"
85IDR_JUNKTOOLBAR BITMAP DISCARDABLE "res\\junktoolbar.bmp"
86
87/////////////////////////////////////////////////////////////////////////////
88//
89// Toolbar
90//
91
92IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
93BEGIN
94 BUTTON ID_FILE_NEW
95 BUTTON ID_FILE_OPEN
96 BUTTON ID_FILE_SAVE
97 SEPARATOR
98 BUTTON ID_BROTHERS_NEW
99 BUTTON ID_BROTHERS_ADDBROTHER
100 BUTTON ID_BROTHERS_DELETE
101 SEPARATOR
102 BUTTON ID_VIEW_HOSTPROPERTIES
103 BUTTON ID_FILE_PAUSE
104 SEPARATOR
105 BUTTON ID_APP_ABOUT
106 BUTTON ID_CONTEXT_HELP
107 BUTTON ID_HELP_LEGEND
108END
109
110IDR_JUNKTOOLBAR TOOLBAR DISCARDABLE 16, 15
111BEGIN
112 BUTTON ID_FILE_PRINT
113 BUTTON ID_EDIT_CUT
114 BUTTON ID_EDIT_COPY
115 BUTTON ID_EDIT_PASTE
116END
117
118
119/////////////////////////////////////////////////////////////////////////////
120//
121// Menu
122//
123
124IDR_MAINFRAME MENU PRELOAD DISCARDABLE
125BEGIN
126 POPUP "&File"
127 BEGIN
128 MENUITEM "&New\tCtrl+N", ID_FILE_NEW
129 MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
130 MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
131 MENUITEM "Save &As...", ID_FILE_SAVE_AS
132 MENUITEM SEPARATOR
133 MENUITEM "&Autoload", ID_FILE_AUTOLOAD
134 MENUITEM "Preferences\tCtrl+P", ID_FILE_PREFERENCES
135 MENUITEM "&Pause", ID_FILE_PAUSE
136 MENUITEM SEPARATOR
137 MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
138 MENUITEM SEPARATOR
139 MENUITEM "E&xit", ID_APP_EXIT
140 END
141 POPUP "&Brother"
142 BEGIN
143 MENUITEM "Add &child", ID_BROTHERS_NEW
144 MENUITEM "Add &brother", ID_BROTHERS_ADDBROTHER
145 MENUITEM "&Delete", ID_BROTHERS_DELETE
146 END
147 POPUP "&View"
148 BEGIN
149 MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
150 MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
151 MENUITEM "Adjust s&plitter", ID_WINDOW_SPLIT
152 MENUITEM SEPARATOR
153 MENUITEM "&Main Window", ID_VIEW_MAINWINDOW
154 MENUITEM "&Host Properties", ID_VIEW_HOSTPROPERTIES
155 END
156 POPUP "&Help"
157 BEGIN
158 MENUITEM "&Help Topics", ID_HELP_FINDER
159 MENUITEM "&Legend", ID_HELP_LEGEND
160 MENUITEM SEPARATOR
161 MENUITEM "&About BigBrother...", ID_APP_ABOUT
162 END
163END
164
165IDM_POPUPS MENU DISCARDABLE
166BEGIN
167 POPUP "Tray"
168 BEGIN
169 MENUITEM "&Show main window", ID_VIEW_MAINWINDOW
170 MENUITEM SEPARATOR
171 MENUITEM "&Help Topics", ID_HELP_FINDER
172 MENUITEM "&About Big Brother", ID_APP_ABOUT
173 MENUITEM "E&xit", ID_APP_EXIT
174 END
175 POPUP "Junk"
176 BEGIN
177 MENUITEM "PingBar", ID_INDICATOR_PINGBAR
178 POPUP "&Edit"
179 BEGIN
180 MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
181 MENUITEM SEPARATOR
182 MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
183 MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
184 MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
185 END
186 MENUITEM SEPARATOR
187 MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
188 MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW
189 MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
190 END
191END
192
193
194/////////////////////////////////////////////////////////////////////////////
195//
196// Accelerator
197//
198
199IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
200BEGIN
201 "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
202 "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
203 "P", ID_FILE_PREFERENCES, VIRTKEY, CONTROL, NOINVERT
204 "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
205 VK_DELETE, ID_BROTHERS_DELETE, VIRTKEY, NOINVERT
206 VK_DELETE, ID_BROTHERS_DELETE, VIRTKEY, NOINVERT
207 VK_F1, ID_HELP, VIRTKEY, NOINVERT
208 VK_F1, ID_CONTEXT_HELP, VIRTKEY, SHIFT, NOINVERT
209 VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
210 VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
211 VK_INSERT, ID_BROTHERS_NEW, VIRTKEY, NOINVERT
212 "X", ID_APP_EXIT, VIRTKEY, ALT, NOINVERT
213END
214
215IDR_JUNKACCELERATOR ACCELERATORS DISCARDABLE
216BEGIN
217 "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
218 "P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
219 "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
220 VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
221 VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
222 VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
223 VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
224 "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
225 "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
226END
227
228
229/////////////////////////////////////////////////////////////////////////////
230//
231// Dialog
232//
233
234IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 74
235STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
236CAPTION "About Big Brother"
237FONT 8, "MS Sans Serif"
238BEGIN
239 ICON IDR_MAINFRAME,IDC_STATIC,13,16,18,20
240 LTEXT "Big Brother, Version 1.5",IDC_STATIC,48,16,119,8,
241 SS_NOPREFIX
242 LTEXT "Copyright © 1996,2002 Klever Group",IDC_STATIC,48,31,119,8
243 DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP
244 PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,65,53,86,14
245END
246
247IDD_PROPS_SETTINGS DIALOG DISCARDABLE 0, 0, 220, 90
248STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION
249CAPTION "Settings"
250FONT 8, "MS Sans Serif"
251BEGIN
252 GROUPBOX "",IDC_STATIC,7,7,206,45,BS_NOTIFY
253 CONTROL "Ping &Intervals",IDC_OVERRIDE_INTERVALS,"Button",
254 BS_AUTOCHECKBOX | WS_TABSTOP,14,7,55,10
255 LTEXT "When the host is known as reach&able:",IDC_STATIC,14,18,
256 122,8
257 EDITTEXT IDC_PINGINTERVAL_GOOD,165,16,40,13,ES_AUTOHSCROLL
258 LTEXT "When the host is known as &unreachable:",IDC_STATIC,14,
259 32,130,8
260 EDITTEXT IDC_PINGINTERVAL_BAD,165,30,40,13,ES_AUTOHSCROLL
261 CONTROL "Maximum ping reply &timeout:",IDC_OVERRIDE_TIMEOUT,
262 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,56,104,10
263 EDITTEXT IDC_PINGTIMEOUT,165,55,40,13,ES_AUTOHSCROLL
264 CONTROL "Maimum &retries count:",IDC_OVERRIDE_RETRIES,"Button",
265 BS_AUTOCHECKBOX | WS_TABSTOP,14,70,85,10
266 EDITTEXT IDC_RETRIES,165,70,40,13,ES_AUTOHSCROLL
267END
268
269IDD_PROPS_GENERAL DIALOG DISCARDABLE 0, 0, 221, 90
270STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION
271CAPTION "General"
272FONT 8, "MS Sans Serif"
273BEGIN
274 LTEXT "&Host:",IDC_STATIC,7,7,18,8
275 EDITTEXT IDC_HOST,7,17,205,13,ES_LOWERCASE | ES_AUTOHSCROLL
276 LTEXT "&Description:",IDC_STATIC,7,33,38,8
277 EDITTEXT IDC_DESC,7,44,205,13,ES_AUTOHSCROLL
278 CONTROL "&Log host's activity",IDC_LOG_ACTIVITY,"Button",
279 BS_AUTO3STATE | BS_PUSHLIKE | WS_TABSTOP,7,63,205,14
280END
281
282IDD_PROPS_ACTION DIALOG DISCARDABLE 0, 0, 220, 90
283STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION
284CAPTION "Action"
285FONT 8, "MS Sans Serif"
286BEGIN
287 CONTROL "&Override Action",IDC_OVERRIDE_ACTION,"Button",
288 BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,7,7,208,11
289 GROUPBOX "Going down",IDC_STATIC,7,20,102,63
290 CONTROL "&Play a sound:",IDC_PLAYASOUND_DOWN,"Button",
291 BS_AUTOCHECKBOX | WS_TABSTOP,13,29,59,10
292 COMBOBOX IDC_SOUND_DOWN,13,40,91,43,CBS_DROPDOWN |
293 CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
294 PUSHBUTTON "",IDC_BROWSE_SOUND_DOWN,78,29,12,10,BS_ICON | BS_CENTER |
295 BS_VCENTER | BS_NOTIFY
296 PUSHBUTTON "",IDC_PREVIEW_SOUND_DOWN,92,29,12,10,BS_ICON |
297 BS_CENTER | BS_VCENTER | BS_NOTIFY
298 CONTROL "&Run custom program:",IDC_CUSTOM_DOWN,"Button",
299 BS_AUTOCHECKBOX | WS_TABSTOP,13,55,83,10
300 EDITTEXT IDC_PROGRAM_DOWN,13,66,91,12,ES_AUTOHSCROLL
301 GROUPBOX "Going up",IDC_STATIC,111,20,102,63
302 CONTROL "P&lay a sound:",IDC_PLAYASOUND_UP,"Button",
303 BS_AUTOCHECKBOX | WS_TABSTOP,117,29,59,10
304 COMBOBOX IDC_SOUND_UP,117,40,91,43,CBS_DROPDOWN | CBS_AUTOHSCROLL |
305 WS_VSCROLL | WS_TABSTOP
306 PUSHBUTTON "",IDC_BROWSE_SOUND_UP,182,29,12,10,BS_ICON | BS_CENTER |
307 BS_VCENTER | BS_NOTIFY
308 PUSHBUTTON "",IDC_PREVIEW_SOUND_UP,196,29,12,10,BS_ICON | BS_CENTER |
309 BS_VCENTER | BS_NOTIFY
310 CONTROL "R&un custom program:",IDC_CUSTOM_UP,"Button",
311 BS_AUTOCHECKBOX | WS_TABSTOP,117,55,83,10
312 EDITTEXT IDC_PROGRAM_UP,117,66,91,12,ES_AUTOHSCROLL
313END
314
315IDD_PREFS DIALOGEX 0, 0, 191, 156
316STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
317EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
318CAPTION "Preferences"
319FONT 8, "MS Sans Serif", 0, 0, 0x1
320BEGIN
321 GROUPBOX "Save options",IDC_STATIC,7,7,121,41
322 CONTROL "On windows shut&down save without confirmation.",
323 IDC_SAVEONSHUTDOWN,"Button",BS_AUTOCHECKBOX | BS_CENTER |
324 BS_MULTILINE | BS_NOTIFY | WS_TABSTOP,13,15,110,16
325 LTEXT "&Autosave every",IDC_STATIC,13,35,50,8
326 EDITTEXT IDC_AUTOSAVEMINS,67,33,27,12,ES_AUTOHSCROLL
327 CONTROL "Spin1",IDC_AUTOSPIN,"msctls_updown32",UDS_WRAP |
328 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
329 UDS_ARROWKEYS | UDS_NOTHOUSANDS,82,33,11,12
330 LTEXT "minutes",IDC_STATIC,99,35,25,8
331 GROUPBOX "ICMP options",IDC_STATIC,7,49,177,37
332 LTEXT "&Ping data packet size:",IDC_STATIC,13,59,71,8,
333 SS_NOTIFY
334 EDITTEXT IDC_PINGSIZE,87,57,35,12,ES_AUTOHSCROLL
335 CONTROL "Spin2",IDC_DATASIZESPIN,"msctls_updown32",UDS_WRAP |
336 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
337 UDS_ARROWKEYS | UDS_NOTHOUSANDS,106,57,11,12
338 LTEXT "bytes",IDC_STATIC,125,59,18,8
339 LTEXT "&hosts simultaneously",IDC_STATIC,63,72,65,8
340 EDITTEXT IDC_MAXTHREADS,33,70,27,12,ES_AUTOHSCROLL
341 CONTROL "Spin3",IDC_THREADSPIN,"msctls_updown32",UDS_WRAP |
342 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
343 UDS_ARROWKEYS | UDS_NOTHOUSANDS,50,70,10,12
344 LTEXT "Ping ",IDC_STATIC,13,72,17,8
345 GROUPBOX "Watch options",IDC_STATIC,7,88,177,61
346 LTEXT "Log to &file:",IDC_STATIC,13,96,34,8
347 EDITTEXT IDC_LOGFILE,13,106,150,13,ES_AUTOHSCROLL
348 PUSHBUTTON "",IDC_BROWSE,166,106,14,13,BS_ICON | BS_CENTER |
349 BS_VCENTER | BS_NOTIFY
350 LTEXT "Show &last ",IDC_STATIC,13,122,34,8
351 EDITTEXT IDC_LOGMINS,47,120,27,12,ES_AUTOHSCROLL
352 CONTROL "Spin1",IDC_LOGMINSPIN,"msctls_updown32",UDS_WRAP |
353 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
354 UDS_ARROWKEYS | UDS_NOTHOUSANDS,64,120,10,12
355 LTEXT "minutes in activity pane",IDC_STATIC,79,122,74,8,
356 SS_NOTIFY
357 DEFPUSHBUTTON "OK",IDOK,134,14,50,14
358 PUSHBUTTON "Cancel",IDCANCEL,134,31,50,14
359 CONTROL "&Store recent activity pane data",IDC_STOREACTIVITY,
360 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,31,134,113,10
361END
362
363
364#ifndef _MAC
365/////////////////////////////////////////////////////////////////////////////
366//
367// Version
368//
369
370VS_VERSION_INFO VERSIONINFO
371 FILEVERSION 1,5,0,0
372 PRODUCTVERSION 1,5,0,0
373 FILEFLAGSMASK 0x3fL
374#ifdef _DEBUG
375 FILEFLAGS 0x1L
376#else
377 FILEFLAGS 0x0L
378#endif
379 FILEOS 0x4L
380 FILETYPE 0x1L
381 FILESUBTYPE 0x0L
382BEGIN
383 BLOCK "StringFileInfo"
384 BEGIN
385 BLOCK "040904b0"
386 BEGIN
387 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
388 VALUE "FileDescription", "Big Brother, network monitoring tool\0"
389 VALUE "FileVersion", "1, 5, 0, 0\0"
390 VALUE "InternalName", "BIGBROTHER\0"
391 VALUE "LegalCopyright", "Copyright © 1996, 2002 Klever Group (http://www.klever.net/)\0"
392 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
393 VALUE "OriginalFilename", "BIGBRO.EXE\0"
394 VALUE "ProductName", "Big Brother\0"
395 VALUE "ProductVersion", "1, 5, 0, 0\0"
396 END
397 END
398 BLOCK "VarFileInfo"
399 BEGIN
400 VALUE "Translation", 0x409, 1200
401 END
402END
403
404#endif // !_MAC
405
406
407/////////////////////////////////////////////////////////////////////////////
408//
409// DESIGNINFO
410//
411
412#ifdef APSTUDIO_INVOKED
413GUIDELINES DESIGNINFO DISCARDABLE
414BEGIN
415 IDD_ABOUTBOX, DIALOG
416 BEGIN
417 LEFTMARGIN, 7
418 RIGHTMARGIN, 210
419 TOPMARGIN, 7
420 BOTTOMMARGIN, 67
421 END
422
423 IDD_PROPS_SETTINGS, DIALOG
424 BEGIN
425 LEFTMARGIN, 7
426 RIGHTMARGIN, 213
427 TOPMARGIN, 7
428 BOTTOMMARGIN, 83
429 END
430
431 IDD_PROPS_GENERAL, DIALOG
432 BEGIN
433 LEFTMARGIN, 7
434 RIGHTMARGIN, 214
435 TOPMARGIN, 7
436 BOTTOMMARGIN, 83
437 END
438
439 IDD_PROPS_ACTION, DIALOG
440 BEGIN
441 LEFTMARGIN, 7
442 RIGHTMARGIN, 213
443 VERTGUIDE, 110
444 TOPMARGIN, 7
445 BOTTOMMARGIN, 83
446 HORZGUIDE, 20
447 END
448
449 IDD_PREFS, DIALOG
450 BEGIN
451 LEFTMARGIN, 7
452 RIGHTMARGIN, 184
453 TOPMARGIN, 7
454 BOTTOMMARGIN, 149
455 END
456END
457#endif // APSTUDIO_INVOKED
458
459
460/////////////////////////////////////////////////////////////////////////////
461//
462// Dialog Info
463//
464
465IDD_PROPS_ACTION DLGINIT
466BEGIN
467 IDC_SOUND_DOWN, 0x403, 10, 0
4680x6828, 0x736f, 0x2d74, 0x7075, 0x0029,
469 IDC_SOUND_DOWN, 0x403, 12, 0
4700x6828, 0x736f, 0x2d74, 0x6f64, 0x6e77, 0x0029,
471 IDC_SOUND_DOWN, 0x403, 12, 0
4720x7328, 0x7379, 0x6574, 0x2d6d, 0x6b6f, 0x0029,
473 IDC_SOUND_DOWN, 0x403, 18, 0
4740x7328, 0x7379, 0x6574, 0x2d6d, 0x7263, 0x7469, 0x6369, 0x6c61, 0x0029,
475
476 IDC_SOUND_UP, 0x403, 10, 0
4770x6828, 0x736f, 0x2d74, 0x7075, 0x0029,
478 IDC_SOUND_UP, 0x403, 12, 0
4790x6828, 0x736f, 0x2d74, 0x6f64, 0x6e77, 0x0029,
480 IDC_SOUND_UP, 0x403, 12, 0
4810x7328, 0x7379, 0x6574, 0x2d6d, 0x6b6f, 0x0029,
482 IDC_SOUND_UP, 0x403, 18, 0
4830x7328, 0x7379, 0x6574, 0x2d6d, 0x7263, 0x7469, 0x6369, 0x6c61, 0x0029,
484
485 0
486END
487
488
489/////////////////////////////////////////////////////////////////////////////
490//
491// AVI
492//
493
494IDR_PINGBAR AVI DISCARDABLE "res\\3angle.avi"
495
496/////////////////////////////////////////////////////////////////////////////
497//
498// WAVE
499//
500
501IDW_HOST_UP WAVE DISCARDABLE "res\\host-up.wav"
502IDW_HOST_DOWN WAVE DISCARDABLE "res\\host-down.wav"
503
504/////////////////////////////////////////////////////////////////////////////
505//
506// String Table
507//
508
509STRINGTABLE DISCARDABLE
510BEGIN
511 IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed."
512 IDS_PROPS_TITLE "Properties"
513 IDS_LOG_DOLOG "&Log host activity"
514 IDS_LOG_DONTLOG "Don't &Log host activity"
515 IDS_LOG_ASKBIGBROTHER "&Log if parent does"
516 IDS_NODESC "..no description.."
517 IDS_PS_FAILEDTORESOLVE "Failed to resolve host"
518 IDS_PS_UNABLETOICMP "Failed to request ICMP service"
519END
520
521STRINGTABLE PRELOAD DISCARDABLE
522BEGIN
523 IDR_MAINFRAME "Big Brother\n\nBigBro\nBig Brother Files (*.bro)\n.BRO\nBigBrother.Document\nBigBro Document"
524 IDS_PS_UNKNOWNERROR "Unkown error %lu"
525 IDS_REGISTRYKEY "Klever Group, Inc."
526 IDS_AVIEW_NOTIP "Host(s) activity"
527 IDS_AVIEW_SHORTTIP "%s (%s)"
528 IDS_AVIEW_TIP_TIMEFORMAT "%c"
529 IDS_AVIEW_TIP_UNPINGED "no timing information"
530 IDS_AVIEW_TIP_UNREACHABLE "not reached"
531 IDS_AVIEW_TIP_RTTREPORT "RTT = %lu"
532 IDS_ROOTNODENAME "Global Settings"
533 IDS_WAVFILTER "Wave files (*.wav)|*.wav|All files (*.*)|*.*|"
534 IDS_ACTION_HOST_UP "(host-up)"
535 IDS_ACTION_HOST_DOWN "(host-down)"
536 IDS_LOGFILTER "Log files (*.log)|*.log|All files (*.*)|*.*|"
537 IDS_LOG_HOSTUP "%s (%s) has changed state to up"
538 IDS_LOG_HOSTDOWN "%s (%s) has changed state to down"
539END
540
541STRINGTABLE PRELOAD DISCARDABLE
542BEGIN
543 AFX_IDS_APP_TITLE "BigBrother"
544 AFX_IDS_IDLEMESSAGE "For Help, press F1"
545 AFX_IDS_HELPMODEMESSAGE "Select an object on which to get Help"
546END
547
548STRINGTABLE DISCARDABLE
549BEGIN
550 ID_INDICATOR_EXT "EXT"
551 ID_INDICATOR_CAPS "CAP"
552 ID_INDICATOR_NUM "NUM"
553 ID_INDICATOR_SCRL "SCRL"
554 ID_INDICATOR_OVR "OVR"
555 ID_INDICATOR_REC "REC"
556END
557
558STRINGTABLE DISCARDABLE
559BEGIN
560 ID_FILE_NEW "Create a new document\nNew"
561 ID_FILE_OPEN "Open an existing document\nOpen"
562 ID_FILE_CLOSE "Close the active document\nClose"
563 ID_FILE_SAVE "Save the active document\nSave"
564 ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
565 ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup"
566 ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup"
567 ID_FILE_PRINT "Print the active document\nPrint"
568 ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
569END
570
571STRINGTABLE DISCARDABLE
572BEGIN
573 ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
574 ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
575 ID_HELP_INDEX "Opens Help\nHelp Topics"
576 ID_HELP_FINDER "List Help topics\nHelp Topics"
577 ID_HELP_USING "Display instructions about how to use help\nHelp"
578 ID_CONTEXT_HELP "Display help for clicked on buttons, menus and windows\nHelp"
579 ID_HELP "Display help for current task or command\nHelp"
580END
581
582STRINGTABLE DISCARDABLE
583BEGIN
584 ID_FILE_MRU_FILE1 "Open this document"
585 ID_FILE_MRU_FILE2 "Open this document"
586 ID_FILE_MRU_FILE3 "Open this document"
587 ID_FILE_MRU_FILE4 "Open this document"
588 ID_FILE_MRU_FILE5 "Open this document"
589 ID_FILE_MRU_FILE6 "Open this document"
590 ID_FILE_MRU_FILE7 "Open this document"
591 ID_FILE_MRU_FILE8 "Open this document"
592 ID_FILE_MRU_FILE9 "Open this document"
593 ID_FILE_MRU_FILE10 "Open this document"
594 ID_FILE_MRU_FILE11 "Open this document"
595 ID_FILE_MRU_FILE12 "Open this document"
596 ID_FILE_MRU_FILE13 "Open this document"
597 ID_FILE_MRU_FILE14 "Open this document"
598 ID_FILE_MRU_FILE15 "Open this document"
599 ID_FILE_MRU_FILE16 "Open this document"
600END
601
602STRINGTABLE DISCARDABLE
603BEGIN
604 ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
605 ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
606END
607
608STRINGTABLE DISCARDABLE
609BEGIN
610 ID_WINDOW_SPLIT "Adjust splitter position\nSplitter"
611END
612
613STRINGTABLE DISCARDABLE
614BEGIN
615 ID_EDIT_CLEAR "Erase the selection\nErase"
616 ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
617 ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
618 ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
619 ID_EDIT_FIND "Find the specified text\nFind"
620 ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
621 ID_EDIT_REPEAT "Repeat the last action\nRepeat"
622 ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
623 ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
624 ID_EDIT_UNDO "Undo the last action\nUndo"
625 ID_EDIT_REDO "Redo the previously undone action\nRedo"
626END
627
628STRINGTABLE DISCARDABLE
629BEGIN
630 ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
631 ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
632END
633
634STRINGTABLE DISCARDABLE
635BEGIN
636 AFX_IDS_SCSIZE "Change the window size"
637 AFX_IDS_SCMOVE "Change the window position"
638 AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
639 AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
640 AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
641 AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
642 AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
643END
644
645STRINGTABLE DISCARDABLE
646BEGIN
647 AFX_IDS_SCRESTORE "Restore the window to normal size"
648 AFX_IDS_SCTASKLIST "Activate Task List"
649END
650
651STRINGTABLE DISCARDABLE
652BEGIN
653 AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview"
654END
655
656STRINGTABLE DISCARDABLE
657BEGIN
658 ID_BROTHERS_NEW "Add new host to monitor. Child to current\nNew Child"
659 ID_VIEW_MAINWINDOW "Show/hide main window\nHide/Show window"
660 ID_INDICATOR_PINGBAR " "
661 ID_BROTHERS_ADDBROTHER "Add new host to monitor. Brother to current\nNew brother"
662 ID_BROTHERS_DELETE "Remove current host and subtree\nDelete"
663 ID_FILE_AUTOLOAD "Automatically load most recently used file on startup\nAutoload"
664 ID_FILE_PREFERENCES "Monitoring options\nPreferences"
665END
666
667STRINGTABLE DISCARDABLE
668BEGIN
669 IDS_PS_INTERNALERROR "Internal error. Please report to Klever"
670 IDS_PS_NETUNREACHABLE "Destination network is unreachable"
671 IDS_PS_HOSTUNREACHABLE "Destination host is unreachable"
672 IDS_PS_PROTUNREACHABLE "Destination protocol is unreachable"
673 IDS_PS_PORTUNREACHABLE "Destination port is unreachable"
674 IDS_PS_NORESOURCES "No resources"
675 IDS_PS_HWERROR "Hardware error"
676 IDS_PS_BIGPACKET "Packet size is too big"
677 IDS_PS_TIMEOUT "Request timed out"
678 IDS_PS_BADROUTE "Bad route"
679 IDS_PS_TTLEXPTRANSIT "TTL expired in transition"
680 IDS_PS_TTLEXPREASM "TTL Expired during reassembling"
681 IDS_PS_IPARAMP "IP parameter problem"
682 IDS_PS_SOURCEQUENCH "Source quench received"
683 IDS_PS_BIGOPTION "Option is too big"
684 IDS_PS_BADDEST "Bad destination"
685END
686
687STRINGTABLE DISCARDABLE
688BEGIN
689 IDS_LOG_DATEFORMAT "%a, %d %b %Y %H:%M:%S %z"
690 IDS_LOGFILE_SELECT "Log To"
691 IDS_SOUND_SELECT "Select Sound"
692 IDS_LOG_LOADFILE "'%s' file loaded"
693 IDS_ACTION_SYSTEM_OK "(system-ok)"
694 IDS_ACTION_SYSTEM_CRITICAL "(system-critical)"
695END
696
697STRINGTABLE DISCARDABLE
698BEGIN
699 ID_FILE_PAUSE "Temporarily suspend monitoring\nPause"
700 ID_VIEW_HOSTPROPERTIES "Show/hide host properties window\nHost Properties"
701 ID_HELP_LEGEND "Shows The Legend\nLegend"
702END
703
704#endif // English (U.S.) resources
705/////////////////////////////////////////////////////////////////////////////
706
707
708
709#ifndef APSTUDIO_INVOKED
710/////////////////////////////////////////////////////////////////////////////
711//
712// Generated from the TEXTINCLUDE 3 resource.
713//
714#define _AFX_NO_OLE_RESOURCES
715#define _AFX_NO_TRACKER_RESOURCES
716#define _AFX_NO_PROPERTY_RESOURCES
717
718#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
719#ifdef _WIN32
720LANGUAGE 9, 1
721#pragma code_page(1252)
722#endif
723#include "res\bigbrother.rc2" // non-Microsoft Visual C++ edited resources
724#include "afxres.rc" // Standard components
725#include "afxprint.rc" // printing/print preview resources
726#endif
727/////////////////////////////////////////////////////////////////////////////
728#endif // not APSTUDIO_INVOKED
729
diff --git a/help/IDI_GOINGDOWN.bmp b/help/IDI_GOINGDOWN.bmp
new file mode 100644
index 0000000..9179dd5
--- a/dev/null
+++ b/help/IDI_GOINGDOWN.bmp
Binary files differ
diff --git a/help/IDI_HOST.bmp b/help/IDI_HOST.bmp
new file mode 100644
index 0000000..dc7a2cb
--- a/dev/null
+++ b/help/IDI_HOST.bmp
Binary files differ
diff --git a/help/IDI_HOSTDOWN.bmp b/help/IDI_HOSTDOWN.bmp
new file mode 100644
index 0000000..5864007
--- a/dev/null
+++ b/help/IDI_HOSTDOWN.bmp
Binary files differ
diff --git a/help/IDI_NOHOST.bmp b/help/IDI_NOHOST.bmp
new file mode 100644
index 0000000..e21bb4f
--- a/dev/null
+++ b/help/IDI_NOHOST.bmp
Binary files differ
diff --git a/help/IDI_PINGING.bmp b/help/IDI_PINGING.bmp
new file mode 100644
index 0000000..bd90963
--- a/dev/null
+++ b/help/IDI_PINGING.bmp
Binary files differ
diff --git a/help/bbullet.bmp b/help/bbullet.bmp
new file mode 100644
index 0000000..772fe15
--- a/dev/null
+++ b/help/bbullet.bmp
Binary files differ
diff --git a/help/bigbro.cnt b/help/bigbro.cnt
new file mode 100644
index 0000000..423b538
--- a/dev/null
+++ b/help/bigbro.cnt
@@ -0,0 +1,29 @@
1:Base BigBro.hlp>Standard
2:Title Big Brother
31 Big Brother
42 About Big Brother=About
52 What's New=News
62 Using Big Brother=Using
71 Menus
82 File
93 New=HID_FILE_NEW
103 Open=HID_FILE_OPEN
113 Save=HID_FILE_SAVE
123 Save as=HID_FILE_SAVE_AS
133 Autoload=HID_FILE_AUTOLOAD
143 Preferences=HID_FILE_PREFERENCES
153 Pause=HID_FILE_PAUSE
163 Exit=HID_APP_EXIT
172 Brothers
183 Add child=HID_BROTHERS_NEW
193 Add brother=HID_BROTHERS_ADDBROTHER
203 Delete=HID_BROTHERS_DELETE
212 View
223 Toolbar=HID_VIEW_TOOLBAR
233 Status bar=HID_VIEW_STATUS_BAR
243 Adjust splitter=HID_WINDOW_SPLIT
253 Main Window=HID_VIEW_MAINWINDOW
263 Host Properties=HID_VIEW_HOSTPROPERTIES
272 Help
283 Help Topics=HID_HELP_FINDER
293 About BigBrother=HID_APP_ABOUT
diff --git a/help/bigbrother.hpj b/help/bigbrother.hpj
new file mode 100644
index 0000000..afb4543
--- a/dev/null
+++ b/help/bigbrother.hpj
@@ -0,0 +1,33 @@
1; This file is maintained by HCW. Do not modify this file directly.
2
3[OPTIONS]
4COMPRESS=12 Hall Zeck
5LCID=0x409 0x0 0x0 ; English (United States)
6REPORT=Yes
7CONTENTS=About
8TITLE=Big Brother
9CNT=bigbro.cnt
10HLP=BIGBRO.HLP
11
12[FILES]
13bigbrother.rtf
14
15[ALIAS]
16AFX_HIDW_DOCKBAR_TOP=Using
17HID_APP_ABOUT=About
18HID_FILE_MRU_FILE1=MRUFile
19HID_FILE_MRU_FILE2=MRUFile
20HID_FILE_MRU_FILE3=MRUFile
21HID_FILE_MRU_FILE4=MRUFile
22HID_FILE_PREFERENCES=HIDD_PREFS
23HID_HT_CAPTION=Using
24HID_HT_MAXBUTTON=HID_SC_MAXIMIZE
25HID_HT_MINBUTTON=Using
26HIDD_ABOUTBOX=About
27HIDR_MAINFRAME=Using
28
29[MAP]
30#include bigbro.hm
31
32[WINDOWS]
33Standard="",(208,13,513,954),20740,(r14876671),(r12632256),f2
diff --git a/help/bigbrother.rtf b/help/bigbrother.rtf
new file mode 100644
index 0000000..eb128ac
--- a/dev/null
+++ b/help/bigbrother.rtf
@@ -0,0 +1,295 @@
1{\rtf1\ansi
2@{\footnote
3THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.
4DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD
5}
6{\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl;
7 \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
8 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
9 \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
10 \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
11
12\pard\plain\keepn
13#{\footnote About}
14${\footnote About Big Brother}
15K{\footnote about}
16{ \f1\fs18\b\sb120 About {\b Big Brother}}
17\par\sa120\sb120\qr\f1\fs16 dedicated to Kundel
18\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b Big Brother} is a program designed to monitor your IP-network activities. it gives you a comprehensive picture of what happened to any point on the Net that you put in. Just {\uldb add}{\v Add} this point by specifying it's IP address or hostname and optional short description (for your information only).
19\par\sa120\sb120\qj\pard \f1\fs18\sb120 The hosts are organized into a hierarchical tree so that you may configure your network picture according to your needs and imagination. Most of the father host properties are inherited by his children unless you wish to specify child's settings explicitly.
20\par\sa120\sb120\qj\pard \f1\fs18\sb120 Every specified period of time {\b Big Brother} will send echo request to every host. And wait for response for at most specified {\uldb timeout}{\v timeOutHIDD_PROPS_SETTINGS}.
21\par\sa120\sb120\qj\pard \f1\fs18\sb120 Results are presented in a graphical form in the lower pane. Each line of the lower window is related to specific host which is shown on the tooltip when you move your mouse over the graphics. Host activities are also {\uldb logged into file}{\v fileHIDD_PREFS}.
22\par\sa120\sb120\qj\pard \f1\fs18\sb120 Your current {\uldb preferences}{\v HIDD_PREFS} and network tree are automatically saved on Windows shutdown (unless specified otherwise) and may be {\uldb autosaved}{\v autosaveHIDD_PREFS} every specified amount of minutes. Most recently used {\uldb file}{\v MRUFile} is {\uldb automatically loaded}{\v HID_FILE_AUTOLOAD} at {\b Big Brother}'s startup unless you don't want it.
23\par\sa120\sb120\qj\pard \f1\fs18\sb120 You can also hide {\b Big Brother} into your notify tray so that it won't occupy more than 16x16 square of your precious windows' desktop. Just click \{bmct bbullet.bmp\} in your notify tray or select {\uldb View/Main Window}{\v HID_VIEW_MAINWINDOW} from menu. Click \{bmct bbullet.bmp\} again to restore {\b Big Brother} to its full size.
24\par\sa120\sb120\qj\pard \f1\fs18\sb120
25\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}}
26{
27\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) 1996, 2002 {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}
28\par\qj\sb120\sa120Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
29\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
30\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31}
32\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}
33\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}
34\page
35
36\pard\plain
37#{\footnote News}
38${\footnote What's New}
39\par\pard\plain\f1\fs24\qc\cf2\b 1.5 - August 19th, 2002
40\par\pard\plain\fi0\li0\f1\fs18 \bullet License change and opening the source code
41\par\pard\plain\fi0\li0\f1\fs18 \bullet Made it work with Win2k and friends
42\par\pard\plain\fi0\li0\f1\fs18 \bullet Added kinwide installer
43\page
44
45\pard\plain\keepn
46#{\footnote Using}
47${\footnote Using Big Brother}
48{ \f1\fs18\b\sb120 Using {\b Big Brother}}
49\par\sa120\sb120\qj\pard \f1\fs18\sb120 Using {\b Big Brother} consists of two parts - designing your network tree and monitoring it's activity. The latter takes no effort of yours.
50\par\sa120\sb120\qj\pard \f1\fs18\sb120 To design the network layout is to put your hosts into Network Tree pane. To {\uldb add a child host}{\v HID_BROTHERS_NEW} to the current just press insert or Select Brothers/Add child from menu. To {\uldb add a brother}{\v HID_BROTHERS_ADDBROTHER} of the current host select Brothers/Add brother from menu. (note: You can't add brother to the root node)
51\par\sa120\sb120\qj\pard \f1\fs18\sb120 You may also show {\uldb properties}{\v HostProps} dialog box by selecting View/Host Properties menu. {\uldb Properties}{\v HostProps} dialog box also pops up automatically whenever you press {\b Enter} in the tree view pane.
52\par\sa120\sb120\qj\pard \f1\fs18\sb120 Monitoring your network activities is even easier. You just relax and watch the screen (or listen to your speakers if you have ones). Network activities are reflected using the lower host activity pane and icons in the tree view. The possible states of the host are:\pard
53\par \fi0\li0 \bullet \{bmct IDI_NOHOST.bmp\}{\b Network} - you haven't specified host name or ip address for this host. The only reason that makes sense is that you probably want to use this node as a father for family of hosts.
54\par \fi0\li0 \bullet \{bmct IDI_PINGING.bmp\}{\b In progress} - checking of this host is in progress.
55\par \fi0\li0 \bullet \{bmct IDI_HOST.bmp\}{\b Reachable host} - this host is reachable and you have no reason to worry about it.
56\par \fi0\li0 \bullet \{bmct IDI_GOINGDOWN.bmp\}{\b Worrisome host} - this host was reported as unreachable, but less than for specified {\uldb retries}{\v HIDD_PROPS_SETTINGS} times.
57\par \fi0\li0 \bullet \{bmct IDI_HOSTDOWN.bmp\}{\b Unreachable host} - this host is known as unreachable for a long time. Whenever the host enters or leaves this state specified {\uldb actions}{\v HIDD_PROPS_ACTION} are taken.\pard
58\par\sa120\sb120\qj\pard \f1\fs18\sb120 Lower pane shows a histogram of response times for a {\uldb specified}{\v logLengthHIDD_PREFS} amount of time. Histograms are shown for current host and it's descendants. Hidden (collapsed) children are not shown in activity pane. When you move your mouse over histogram tooltip shows the host name and host address for the corresponding host. If you also hold left mouse button or Ctrl key it will also show you the time corresponding to the point you point at. If you hold Shift key it will also show the Round Trip Time.
59\par\sa120\sb120\qj\pard \f1\fs18\sb120 Histogram shows the Round Trip Time in the following colours:\pard
60\par \fi0\li0 \bullet \{bmct green.bmp\} Host's response time is less than 1/3 of the {\uldb specified}{\v timeOutHIDD_PROPS_SETTINGS} timeout.
61\par \fi0\li0 \bullet \{bmct yellow.bmp\} Host's response time is more than 1/3, but less then 2/3 of the {\uldb specified}{\v timeOutHIDD_PROPS_SETTINGS} timeout.
62\par \fi0\li0 \bullet \{bmct red.bmp\} Host's response time is more than 2/3 of the {\uldb specified}{\v timeOutHIDD_PROPS_SETTINGS} timeout.\pard
63\page
64
65\pard\plain\keepn
66#{\footnote HIDD_PREFS}
67${\footnote Preferences}
68{ \f1\fs18\b\sb120 Preferences}
69\par\sa120\sb120\qj\pard \f1\fs18\sb120 The Preferences dialog box allows you to change global system preferences which are:\pard
70\par \fi0\li0 \bullet {\b On windows shutdown save without confirmation} - you may specify how does {\b Big Brother} act on windows shutdown, whether to save current tree without a confirmation or not.
71\par \fi0\li0 \bullet {#{\footnote autosaveHIDD_PREFS}}Autosave - the interval at wich {\b Big Brother} will save current tree automatically. Specify 0 if you don't want to use this feature.
72\par \fi0\li0 \bullet Ping data packet size - the size of echo request packet in bytes.
73\par \fi0\li0 \bullet Ping .. hosts simultaneously - number of hosts to ping at a time. If you have a big network to monitor and have a slow computer or connection, you may want to limit number of hosts to ping simultaneously.
74\par \fi0\li0 \bullet {#{\footnote fileHIDD_PREFS}}Log to file - Here is where you specify the name of the file to log hosts activities to.
75\par \fi0\li0 \bullet {#{\footnote logLengthHIDD_PREFS}}Show last .. minutes in activity pane - This is the time length of your graphical pane window.
76\par \fi0\li0 \bullet {#{\footnote storeActivityHIDD_PREFS}}Store activity pane data - This lets you specify where to store activity pane data when saving file or not.\pard
77\page
78
79\pard\plain\keepn
80#{\footnote HID_VIEW_HOSTPROPERTIES}
81{ \f1\fs18\b\sb120 Host Properties}
82\par\sa120\sb120\qj\pard \f1\fs18\sb120 You may show/hide Host Properties dialog box using this menu command
83\par\sa120\sb120\qj\pard \f1\fs18\sb120 {#{\footnote HostProps}}Host Properties dialog box consists of three tabs. See {\uldb General tab}{\v HIDD_PROPS_GENERAL}, {\uldb Settings tab}{\v HIDD_PROPS_SETTINGS} and {\uldb Action tab}{\v HIDD_PROPS_ACTION} for further details.
84\page
85
86\pard\plain\keepn
87#{\footnote HID_BROTHERS_NEW}
88{ \f1\fs18\b\sb120 Add new host (child to current)}
89\par\sa120\sb120\qj\pard \f1\fs18\sb120 You can add new host into your network using this menu command. New host will be the child to current.
90\page
91
92\pard\plain\keepn
93#{\footnote HID_FILE_AUTOLOAD}
94{ \f1\fs18\b\sb120 Autoload}
95\par\sa120\sb120\qj\pard \f1\fs18\sb120 You may specify whether you want Big Brother to load most recently used file at the startup or not.
96\page
97
98\pard\plain\keepn
99#{\footnote HIDD_PROPS_ACTION}
100${\footnote Action tab}
101{ \f1\fs18\b\sb120 Action}
102\par\sa120\sb120\qj\pard \f1\fs18\sb120 Using action tab of {\uldb host properties}{\v HostProps} dialog box you may specify the actions to be taken whenever host changes its state from up to down and vice versa.\pard
103\par \fi0\li0 \bullet Override action - You may specify if you want this host to specify some specific actions to take or if you want it to act as it's parent does.
104\par \fi0\li0 \bullet Going down - Actions to take whenever host goes down (is known as unreachable for {\uldb retries}{\v retriesHIDD_PROPS_SETTINGS} times in a row). See {\uldb below}{\v Action} for details.
105\par \fi0\li0 \bullet Going up - Actions to take whenever host becomes reachable after it is considered to be down.\pard
106\par\sa120\sb120\qj\pard \f1\fs18\sb120 {#{\footnote Action}}Possible actions are:\pard
107\par \fi0\li0 \bullet Play a sound - Plays a sound. You may specify a .wav file or use one of the predefined sounds which are
108 \pard
109\par \fi0\li0 \bullet (host-up) - Default sound indicating host recovering from crash
110\par \fi0\li0 \bullet (host-down) - Default sound indicating crashing host
111\par \fi0\li0 \bullet (system-ok) - System sound as defined in Control Panel/Sounds 'Asterisk'
112\par \fi0\li0 \bullet (system-critical) - System sound as defined in Control Panel/Sounds 'Critical Stop'\pard
113\par \fi0\li0 \bullet Run custom program - Run custom program. The following special sequences are defined:
114 \pard
115\par \fi0\li0 \bullet %h - Host name
116\par \fi0\li0 \bullet %d - Host description
117\par \fi0\li0 \bullet %% - % sign\pard\pard
118\page
119
120\pard\plain\keepn
121#{\footnote HID_VIEW_MAINWINDOW}
122{ \f1\fs18\b\sb120 Main Window}
123\par\sa120\sb120\qj\pard \f1\fs18\sb120 You may hide {\b Big Brother}'s main window using this command. You may get the window back by clicking the \{bmct bbullet.bmp\} in your notification tray area.
124\page
125
126\pard\plain\keepn
127#{\footnote HIDD_PROPS_GENERAL}
128${\footnote General tab}
129{ \f1\fs18\b\sb120 General tab}
130\par\sa120\sb120\qj\pard \f1\fs18\sb120 General tab of {\uldb Host Properties}{\v HostProps} dialog box lets you specify the following:\pard
131\par \fi0\li0 \bullet Host - either host name or ip address of host you want to monitor.
132\par \fi0\li0 \bullet Description - a short description of the host. The name you want to refer to this host by in the future.
133\par \fi0\li0 \bullet Log Activity - You may specify if you do or don't want to log changes of this host's state into {\uldb file}{\v fileHIDD_PREFS}.\pard
134\page
135
136\pard\plain\keepn
137#{\footnote HID_FILE_PAUSE}
138{ \f1\fs18\b\sb120 Pause}
139\par\sa120\sb120\qj\pard \f1\fs18\sb120 This command lets you temporarily disable monitoring of hosts. {\b Big Brother} will just sit and wait until you let him do his work.
140\page
141
142\pard\plain\keepn
143#{\footnote HIDD_PROPS_SETTINGS}
144${\footnote Settings tab}
145{ \f1\fs18\b\sb120 Settings tab}
146\par\sa120\sb120\qj\pard \f1\fs18\sb120 Settings tab of {\uldb Host Properties}{\v HostProps} dialog box lets you specify the following:\pard
147\par \fi0\li0 \bullet Ping intervals - check this if you want to specify intervals for this host explicitly. If you don't - this host will use parent's settings. You can't uncheck this for root node.
148 \pard
149\par \fi0\li0 \bullet When the host is known as reachable - time to wait until next ping if the last ping succeeded.
150\par \fi0\li0 \bullet When the host is known as unreachable - time to wait until next ping If the last ping failed.\pard
151\par \fi0\li0 \bullet {#{\footnote timeOutHIDD_PROPS_SETTINGS}}Maximum ping reply timeout - amount of milliseconds to wait for echo reply.
152\par \fi0\li0 \bullet {#{\footnote retriesHIDD_PROPS_SETTINGS}}Maximum retries count - number of failed pings before Big Brother considers the host is down.\pard
153\page
154
155\pard\plain\keepn
156#{\footnote HID_BROTHERS_DELETE}
157{ \f1\fs18\b\sb120 Delete}
158\par\sa120\sb120\qj\pard \f1\fs18\sb120 Use this feature to remove current host and all of its children. You can't remove the root node, although you may remove all hosts but root using this command.
159\page
160
161\pard\plain\keepn
162#{\footnote HID_BROTHERS_ADDBROTHER}
163{ \f1\fs18\b\sb120 Add new host (brother to current)}
164\par\sa120\sb120\qj\pard \f1\fs18\sb120 You can add new host into your network using this menu command. New host will be a brother to current. (note: You can't add brother to the root node)
165\page
166
167\pard\plain\keepn
168#{\footnote HID_FILE_NEW}
169{ \f1\fs18\b\sb120 New}
170\par\sa120\sb120\qj\pard \f1\fs18\sb120 Create the whole new network tree. This command will remove all hosts you currently have.
171\page
172
173\pard\plain\keepn
174#{\footnote HID_FILE_OPEN}
175{ \f1\fs18\b\sb120 Open}
176\par\sa120\sb120\qj\pard \f1\fs18\sb120 Open previously {\uldb saved}{\v HID_FILE_SAVE} network file.
177\page
178
179\pard\plain\keepn
180#{\footnote HID_FILE_SAVE}
181{ \f1\fs18\b\sb120 Save}
182\par\sa120\sb120\qj\pard \f1\fs18\sb120 Save your current network layout to disk file for future {\uldb retrieval}{\v HID_FILE_OPEN}
183\page
184
185\pard\plain\keepn
186#{\footnote HID_FILE_SAVE_AS}
187{ \f1\fs18\b\sb120 Save as}
188\par\sa120\sb120\qj\pard \f1\fs18\sb120 Save your current network layout under different name.
189\page
190
191\pard\plain\keepn
192#{\footnote HID_APP_EXIT}
193{ \f1\fs18\b\sb120 Exit}
194\par\sa120\sb120\qj\pard \f1\fs18\sb120 Leave {\b Big Brother}. you will be prompted if you have unsaved information.
195\page
196
197\pard\plain\keepn
198#{\footnote HID_VIEW_TOOLBAR}
199{ \f1\fs18\b\sb120 Toolbar}
200\par\sa120\sb120\qj\pard \f1\fs18\sb120 Use this command to hide or show toolbar.
201\page
202
203\pard\plain\keepn
204#{\footnote HID_VIEW_STATUS_BAR}
205{ \f1\fs18\b\sb120 Status bar}
206\par\sa120\sb120\qj\pard \f1\fs18\sb120 Use this command to hide or show status bar.
207\page
208
209\pard\plain\keepn
210#{\footnote HID_WINDOW_SPLIT}
211{ \f1\fs18\b\sb120 Adjust Splitter}
212\par\sa120\sb120\qj\pard \f1\fs18\sb120 Adjust position of splitter between tree view pane and host activity pane
213\page
214
215\pard\plain\keepn
216#{\footnote HID_HELP_FINDER}
217{ \f1\fs18\b\sb120 Help Topics}
218\par\sa120\sb120\qj\pard \f1\fs18\sb120 Show help topics.
219\page
220
221\pard\plain\keepn
222#{\footnote MRUFile}
223{ \f1\fs18\b\sb120 Most Recently Used Files}
224\par\sa120\sb120\qj\pard \f1\fs18\sb120 The menu commands right before the Exit allows you to quickly retrieve one of the most recently used files.
225\page
226
227\pard\plain\keepn
228#{\footnote HID_INDICATOR_PINGBAR}
229{ \f1\fs18\b\sb120 {\b Big Brother} Activity indicator}
230\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b Big Brother} activity indicator is a small red triangle spinning and turning to black whenever Big Brother is busy pinging hosts.
231\page
232
233\pard\plain\keepn
234#{\footnote AFX_HIDW_STATUS_BAR}
235{ \f1\fs18\b\sb120 Status bar}
236\par\sa120\sb120\qj\pard \f1\fs18\sb120 Sometimes you may see some useful messages in there. For instance, long descriptions of menu items whenever you are exploring the menu.
237\page
238
239\pard\plain\keepn
240#{\footnote HID_CONTEXT_HELP}
241{ \f1\fs18\b\sb120 Context help}
242\par\sa120\sb120\qj\pard \f1\fs18\sb120 Move mouse cursor with question mark wherever you want and get help for something you click on.
243\page
244
245\pard\plain\keepn
246#{\footnote HID_SC_MAXIMIZE}
247{ \f1\fs18\b\sb120 Maximize}
248\par\sa120\sb120\qj\pard \f1\fs18\sb120 This option will maximize {\b Big Brother} window to full screen.
249\page
250
251\pard\plain\keepn
252#{\footnote HID_SC_MOVE}
253{ \f1\fs18\b\sb120 Move}
254\par\sa120\sb120\qj\pard \f1\fs18\sb120 This option will let you move {\b Big Brother} window around the screen.
255\page
256
257\pard\plain\keepn
258#{\footnote HID_SC_SIZE}
259{ \f1\fs18\b\sb120 Size}
260\par\sa120\sb120\qj\pard \f1\fs18\sb120 This option will let you resize {\b Big Brother}'s window
261\page
262
263\pard\plain\keepn
264#{\footnote HID_SC_RESTORE}
265{ \f1\fs18\b\sb120 Restore}
266\par\sa120\sb120\qj\pard \f1\fs18\sb120 You option may use this to restore {\b Big Brother}'s window to its original size after you've maximized it.
267\page
268
269\pard\plain\keepn
270#{\footnote HID_SC_CLOSE}
271{ \f1\fs18\b\sb120 Close}
272\par\sa120\sb120\qj\pard \f1\fs18\sb120 This option does about the same as the {\uldb Exit}{\v HID_APP_EXIT} menu command does.
273\page
274
275\pard\plain\keepn
276#{\footnote Add}
277${\footnote Add new host}
278{ \f1\fs18\b\sb120 Add new host}
279\par\sa120\sb120\qj\pard \f1\fs18\sb120 You may add new hosts for monitoring in two ways - by adding it {\uldb as a child}{\v HID_BROTHERS_NEW} or {\uldb as a brother}{\v HID_BROTHERS_ADDBROTHER} to current one.
280\page
281
282\pard\plain
283#{\footnote HID_HELP_LEGEND}
284\par\sa120\sb120\qj\pard \f1\fs18\sb120 Tree view pane:\pard
285\par \fi0\li0 \bullet \{bmct IDI_NOHOST.bmp\} Network - no particular host specified.
286\par \fi0\li0 \bullet \{bmct IDI_PINGING.bmp\} In progress - host is being checked.
287\par \fi0\li0 \bullet \{bmct IDI_HOST.bmp\} Reachable host - host is reachable.
288\par \fi0\li0 \bullet \{bmct IDI_GOINGDOWN.bmp\} Worrisome host - host is dying.
289\par \fi0\li0 \bullet \{bmct IDI_HOSTDOWN.bmp\} Unreachable host - host is unreachable.\pard
290\par\sa120\sb120\qj\pard \f1\fs18\sb120 Activity pane:\pard
291\par \fi0\li0 \bullet \{bmct green.bmp\} Good response time
292\par \fi0\li0 \bullet \{bmct yellow.bmp\} Average response time
293\par \fi0\li0 \bullet \{bmct red.bmp\} Critical response time\pard
294\page
295} \ No newline at end of file
diff --git a/help/bigbrother.xml b/help/bigbrother.xml
new file mode 100644
index 0000000..d83ae43
--- a/dev/null
+++ b/help/bigbrother.xml
@@ -0,0 +1,229 @@
1<?xml version="1.0"?>
2<winhelp>
3 <topic id="About" title="About Big Brother" keywords="about">
4 <heading scroll="no">About <kin>Big Brother</kin></heading>
5 <dedication>dedicated to Kundel</dedication>
6 <p><kin>Big Brother</kin> is a program designed to monitor your IP-network activities. it gives you a comprehensive picture of what happened to any point on the Net that you put in. Just <a href="#Add">add</a> this point by specifying it's IP address or hostname and optional short description (for your information only).</p>
7 <p>The hosts are organized into a hierarchical tree so that you may configure your network picture according to your needs and imagination. Most of the father host properties are inherited by his children unless you wish to specify child's settings explicitly.</p>
8 <p>Every specified period of time <kin>Big Brother</kin> will send echo request to every host. And wait for response for at most specified <a href="#timeOutHIDD_PROPS_SETTINGS">timeout</a>.</p>
9 <p>Results are presented in a graphical form in the lower pane. Each line of the lower window is related to specific host which is shown on the tooltip when you move your mouse over the graphics. Host activities are also <a href="#fileHIDD_PREFS">logged into file</a>.</p>
10 <p>Your current <a href="#HIDD_PREFS">preferences</a> and network tree are automatically saved on Windows shutdown (unless specified otherwise) and may be <a href="#autosaveHIDD_PREFS">autosaved</a> every specified amount of minutes. Most recently used <a href="#MRUFile">file</a> is <a href="#HID_FILE_AUTOLOAD">automatically loaded</a> at <kin>Big Brother</kin>'s startup unless you don't want it.</p>
11 <p>You can also hide <kin>Big Brother</kin> into your notify tray so that it won't occupy more than 16x16 square of your precious windows' desktop. Just click <image source="bbullet.bmp"/> in your notify tray or select <a href="#HID_VIEW_MAINWINDOW">View/Main Window</a> from menu. Click <image source="bbullet.bmp"/> again to restore <kin>Big Brother</kin> to its full size.</p>
12 <p/>
13 <p><b><i>Enjoy!</i></b></p>
14 <license years="1996, 2002"/>
15 <credits/>
16 </topic>
17 <topic id="News" title="What's New">
18 <newsfor version="1.5" date="August 19th, 2002">
19 <ni>License change and opening the source code</ni>
20 <ni>Made it work with Win2k and friends</ni>
21 <ni>Added kinwide installer</ni>
22 </newsfor>
23 </topic>
24 <topic id="Using" title="Using Big Brother">
25 <heading scroll="no">Using <kin>Big Brother</kin></heading>
26 <p>Using <kin>Big Brother</kin> consists of two parts - designing your network tree and monitoring it's activity. The latter takes no effort of yours.</p>
27 <p>To design the network layout is to put your hosts into Network Tree pane. To <a href="#HID_BROTHERS_NEW">add a child host</a> to the current just press insert or Select Brothers/Add child from menu. To <a href="#HID_BROTHERS_ADDBROTHER">add a brother</a> of the current host select Brothers/Add brother from menu. (note: You can't add brother to the root node)</p>
28 <p>You may also show <a href="#HostProps">properties</a> dialog box by selecting View/Host Properties menu. <a href="#HostProps">Properties</a> dialog box also pops up automatically whenever you press <b>Enter</b> in the tree view pane.</p>
29 <p>Monitoring your network activities is even easier. You just relax and watch the screen (or listen to your speakers if you have ones). Network activities are reflected using the lower host activity pane and icons in the tree view. The possible states of the host are:</p>
30 <ul>
31 <li><image source="IDI_NOHOST.bmp"/> <b>Network</b> - you haven't specified host name or ip address for this host. The only reason that makes sense is that you probably want to use this node as a father for family of hosts.</li>
32 <li><image source="IDI_PINGING.bmp"/> <b>In progress</b> - checking of this host is in progress.</li>
33 <li><image source="IDI_HOST.bmp"/> <b>Reachable host</b> - this host is reachable and you have no reason to worry about it.</li>
34 <li><image source="IDI_GOINGDOWN.bmp"/> <b>Worrisome host</b> - this host was reported as unreachable, but less than for specified <a href="#HIDD_PROPS_SETTINGS">retries</a> times.</li>
35 <li><image source="IDI_HOSTDOWN.bmp"/> <b>Unreachable host</b> - this host is known as unreachable for a long time. Whenever the host enters or leaves this state specified <a href="#HIDD_PROPS_ACTION">actions</a> are taken.</li>
36 </ul>
37 <p>Lower pane shows a histogram of response times for a <a href="#logLengthHIDD_PREFS">specified</a> amount of time. Histograms are shown for current host and it's descendants. Hidden (collapsed) children are not shown in activity pane. When you move your mouse over histogram tooltip shows the host name and host address for the corresponding host. If you also hold left mouse button or Ctrl key it will also show you the time corresponding to the point you point at. If you hold Shift key it will also show the Round Trip Time.</p>
38 <p>Histogram shows the Round Trip Time in the following colours:</p>
39 <ul>
40 <li><image source="green.bmp"/> Host's response time is less than 1/3 of the <a href="#timeOutHIDD_PROPS_SETTINGS">specified</a> timeout.</li>
41 <li><image source="yellow.bmp"/> Host's response time is more than 1/3, but less then 2/3 of the <a href="#timeOutHIDD_PROPS_SETTINGS">specified</a> timeout.</li>
42 <li><image source="red.bmp"/> Host's response time is more than 2/3 of the <a href="#timeOutHIDD_PROPS_SETTINGS">specified</a> timeout.</li>
43 </ul>
44 </topic>
45 <topic id="HIDD_PREFS" title="Preferences">
46 <heading scroll="no">Preferences</heading>
47 <p>The Preferences dialog box allows you to change global system preferences which are:</p>
48 <ul>
49 <li><b>On windows shutdown save without confirmation</b> - you may specify how does <kin>Big Brother</kin> act on windows shutdown, whether to save current tree without a confirmation or not.</li>
50 <li><a name="autosaveHIDD_PREFS"/>Autosave - the interval at wich <kin>Big Brother</kin> will save current tree automatically. Specify 0 if you don't want to use this feature.</li>
51 <li>Ping data packet size - the size of echo request packet in bytes.</li>
52 <li>Ping .. hosts simultaneously - number of hosts to ping at a time. If you have a big network to monitor and have a slow computer or connection, you may want to limit number of hosts to ping simultaneously.</li>
53 <li><a name="fileHIDD_PREFS"/>Log to file - Here is where you specify the name of the file to log hosts activities to.</li>
54 <li><a name="logLengthHIDD_PREFS"/>Show last .. minutes in activity pane - This is the time length of your graphical pane window.</li>
55 <li><a name="storeActivityHIDD_PREFS"/>Store activity pane data - This lets you specify where to store activity pane data when saving file or not.</li>
56 </ul>
57 </topic>
58 <topic id="HID_VIEW_HOSTPROPERTIES">
59 <heading scroll="no">Host Properties</heading>
60 <p>You may show/hide Host Properties dialog box using this menu command</p>
61 <p><a name="HostProps"/>Host Properties dialog box consists of three tabs. See <a href="#HIDD_PROPS_GENERAL">General tab</a>, <a href="#HIDD_PROPS_SETTINGS">Settings tab</a> and <a href="#HIDD_PROPS_ACTION">Action tab</a> for further details.</p>
62 </topic>
63 <topic id="HID_BROTHERS_NEW">
64 <heading scroll="no">Add new host (child to current)</heading>
65 <p>You can add new host into your network using this menu command. New host will be the child to current.</p>
66 </topic>
67 <topic id="HID_FILE_AUTOLOAD">
68 <heading scroll="no">Autoload</heading>
69 <p>You may specify whether you want Big Brother to load most recently used file at the startup or not.</p>
70 </topic>
71 <topic id="HIDD_PROPS_ACTION" title="Action tab">
72 <heading scroll="no">Action</heading>
73 <p>Using action tab of <a href="#HostProps">host properties</a> dialog box you may specify the actions to be taken whenever host changes its state from up to down and vice versa.</p>
74 <ul>
75 <li>Override action - You may specify if you want this host to specify some specific actions to take or if you want it to act as it's parent does.</li>
76 <li>Going down - Actions to take whenever host goes down (is known as unreachable for <a href="#retriesHIDD_PROPS_SETTINGS">retries</a> times in a row). See <a href="#Action">below</a> for details.</li>
77 <li>Going up - Actions to take whenever host becomes reachable after it is considered to be down.</li>
78 </ul>
79 <p><a name="Action"/>Possible actions are:</p>
80 <ul>
81 <li>Play a sound - Plays a sound. You may specify a .wav file or use one of the predefined sounds which are
82 <ul>
83 <li>(host-up) - Default sound indicating host recovering from crash</li>
84 <li>(host-down) - Default sound indicating crashing host</li>
85 <li>(system-ok) - System sound as defined in Control Panel/Sounds 'Asterisk'</li>
86 <li>(system-critical) - System sound as defined in Control Panel/Sounds 'Critical Stop'</li>
87 </ul>
88 </li>
89 <li>Run custom program - Run custom program. The following special sequences are defined:
90 <ul>
91 <li>%h - Host name</li>
92 <li>%d - Host description</li>
93 <li>%% - % sign</li>
94 </ul>
95 </li>
96 </ul>
97 </topic>
98 <topic id="HID_VIEW_MAINWINDOW">
99 <heading scroll="no">Main Window</heading>
100 <p>You may hide <kin>Big Brother</kin>'s main window using this command. You may get the window back by clicking the <image source="bbullet.bmp"/> in your notification tray area.</p>
101 </topic>
102 <topic id="HIDD_PROPS_GENERAL" title="General tab">
103 <heading scroll="no">General tab</heading>
104 <p>General tab of <a href="#HostProps">Host Properties</a> dialog box lets you specify the following:</p>
105 <ul>
106 <li>Host - either host name or ip address of host you want to monitor.</li>
107 <li>Description - a short description of the host. The name you want to refer to this host by in the future.</li>
108 <li>Log Activity - You may specify if you do or don't want to log changes of this host's state into <a href="#fileHIDD_PREFS">file</a>.</li>
109 </ul>
110 </topic>
111 <topic id="HID_FILE_PAUSE">
112 <heading scroll="no">Pause</heading>
113 <p>This command lets you temporarily disable monitoring of hosts. <kin>Big Brother</kin> will just sit and wait until you let him do his work.</p>
114 </topic>
115 <topic id="HIDD_PROPS_SETTINGS" title="Settings tab">
116 <heading scroll="no">Settings tab</heading>
117 <p>Settings tab of <a href="#HostProps">Host Properties</a> dialog box lets you specify the following:</p>
118 <ul>
119 <li>Ping intervals - check this if you want to specify intervals for this host explicitly. If you don't - this host will use parent's settings. You can't uncheck this for root node.
120 <ul>
121 <li>When the host is known as reachable - time to wait until next ping if the last ping succeeded.</li>
122 <li>When the host is known as unreachable - time to wait until next ping If the last ping failed.</li>
123 </ul>
124 </li>
125 <li><a name="timeOutHIDD_PROPS_SETTINGS"/>Maximum ping reply timeout - amount of milliseconds to wait for echo reply.</li>
126 <li><a name="retriesHIDD_PROPS_SETTINGS"/>Maximum retries count - number of failed pings before Big Brother considers the host is down.</li>
127 </ul>
128 </topic>
129 <topic id="HID_BROTHERS_DELETE">
130 <heading scroll="no">Delete</heading>
131 <p>Use this feature to remove current host and all of its children. You can't remove the root node, although you may remove all hosts but root using this command.</p>
132 </topic>
133 <topic id="HID_BROTHERS_ADDBROTHER">
134 <heading scroll="no">Add new host (brother to current)</heading>
135 <p>You can add new host into your network using this menu command. New host will be a brother to current. (note: You can't add brother to the root node)</p>
136 </topic>
137 <topic id="HID_FILE_NEW">
138 <heading scroll="no">New</heading>
139 <p>Create the whole new network tree. This command will remove all hosts you currently have.</p>
140 </topic>
141 <topic id="HID_FILE_OPEN">
142 <heading scroll="no">Open</heading>
143 <p>Open previously <a href="#HID_FILE_SAVE">saved</a> network file.</p>
144 </topic>
145 <topic id="HID_FILE_SAVE">
146 <heading scroll="no">Save</heading>
147 <p>Save your current network layout to disk file for future <a href="#HID_FILE_OPEN">retrieval</a></p>
148 </topic>
149 <topic id="HID_FILE_SAVE_AS">
150 <heading scroll="no">Save as</heading>
151 <p>Save your current network layout under different name.</p>
152 </topic>
153 <topic id="HID_APP_EXIT">
154 <heading scroll="no">Exit</heading>
155 <p>Leave <kin>Big Brother</kin>. you will be prompted if you have unsaved information.</p>
156 </topic>
157 <topic id="HID_VIEW_TOOLBAR">
158 <heading scroll="no">Toolbar</heading>
159 <p>Use this command to hide or show toolbar.</p>
160 </topic>
161 <topic id="HID_VIEW_STATUS_BAR">
162 <heading scroll="no">Status bar</heading>
163 <p>Use this command to hide or show status bar.</p>
164 </topic>
165 <topic id="HID_WINDOW_SPLIT">
166 <heading scroll="no">Adjust Splitter</heading>
167 <p>Adjust position of splitter between tree view pane and host activity pane</p>
168 </topic>
169 <topic id="HID_HELP_FINDER">
170 <heading scroll="no">Help Topics</heading>
171 <p>Show help topics.</p>
172 </topic>
173 <topic id="MRUFile">
174 <heading scroll="no">Most Recently Used Files</heading>
175 <p>The menu commands right before the Exit allows you to quickly retrieve one of the most recently used files.</p>
176 </topic>
177 <topic id="HID_INDICATOR_PINGBAR">
178 <heading scroll="no"><kin>Big Brother</kin> Activity indicator</heading>
179 <p><kin>Big Brother</kin> activity indicator is a small red triangle spinning and turning to black whenever Big Brother is busy pinging hosts.</p>
180 </topic>
181 <topic id="AFX_HIDW_STATUS_BAR">
182 <heading scroll="no">Status bar</heading>
183 <p>Sometimes you may see some useful messages in there. For instance, long descriptions of menu items whenever you are exploring the menu.</p>
184 </topic>
185 <topic id="HID_CONTEXT_HELP">
186 <heading scroll="no">Context help</heading>
187 <p>Move mouse cursor with question mark wherever you want and get help for something you click on.</p>
188 </topic>
189 <topic id="HID_SC_MAXIMIZE">
190 <heading scroll="no">Maximize</heading>
191 <p>This option will maximize <kin>Big Brother</kin> window to full screen.</p>
192 </topic>
193 <topic id="HID_SC_MOVE">
194 <heading scroll="no">Move</heading>
195 <p>This option will let you move <kin>Big Brother</kin> window around the screen.</p>
196 </topic>
197 <topic id="HID_SC_SIZE">
198 <heading scroll="no">Size</heading>
199 <p>This option will let you resize <kin>Big Brother</kin>'s window</p>
200 </topic>
201 <topic id="HID_SC_RESTORE">
202 <heading scroll="no">Restore</heading>
203 <p>You option may use this to restore <kin>Big Brother</kin>'s window to its original size after you've maximized it.</p>
204 </topic>
205 <topic id="HID_SC_CLOSE">
206 <heading scroll="no">Close</heading>
207 <p>This option does about the same as the <a href="#HID_APP_EXIT">Exit</a> menu command does.</p>
208 </topic>
209 <topic id="Add" title="Add new host">
210 <heading scroll="no">Add new host</heading>
211 <p>You may add new hosts for monitoring in two ways - by adding it <a href="#HID_BROTHERS_NEW">as a child</a> or <a href="#HID_BROTHERS_ADDBROTHER">as a brother</a> to current one.</p>
212 </topic>
213 <topic id="HID_HELP_LEGEND">
214 <p>Tree view pane:</p>
215 <ul>
216 <li><image source="IDI_NOHOST.bmp"/> Network - no particular host specified.</li>
217 <li><image source="IDI_PINGING.bmp"/> In progress - host is being checked.</li>
218 <li><image source="IDI_HOST.bmp"/> Reachable host - host is reachable.</li>
219 <li><image source="IDI_GOINGDOWN.bmp"/> Worrisome host - host is dying.</li>
220 <li><image source="IDI_HOSTDOWN.bmp"/> Unreachable host - host is unreachable.</li>
221 </ul>
222 <p>Activity pane:</p>
223 <ul>
224 <li><image source="green.bmp"/> Good response time</li>
225 <li><image source="yellow.bmp"/> Average response time</li>
226 <li><image source="red.bmp"/> Critical response time</li>
227 </ul>
228 </topic>
229</winhelp>
diff --git a/help/green.bmp b/help/green.bmp
new file mode 100644
index 0000000..1e6dcde
--- a/dev/null
+++ b/help/green.bmp
Binary files differ
diff --git a/help/red.bmp b/help/red.bmp
new file mode 100644
index 0000000..0625b12
--- a/dev/null
+++ b/help/red.bmp
Binary files differ
diff --git a/help/yellow.bmp b/help/yellow.bmp
new file mode 100644
index 0000000..76410b6
--- a/dev/null
+++ b/help/yellow.bmp
Binary files differ
diff --git a/install/custom.rch b/install/custom.rch
new file mode 100644
index 0000000..f28380c
--- a/dev/null
+++ b/install/custom.rch
@@ -0,0 +1,10 @@
1 #ifdefSTATI_K
2bigbro.ex_ rcdata discardable "../releast/bigbro.ex_"
3#else
4bigbro.ex_ rcdata discardable "../release/bigbro.ex_"
5#endif
6bigbro.cn_ rcdata discardable "../release/bigbro.cn_"
7bigbro.hl_ rcdata discardable "../release/bigbro.hl_"
8#ifdef K_ANNED
9mfc42.dl_ rcdata discardable "../redist/mfc42.dl_"
10#endif
diff --git a/install/install.cpp b/install/install.cpp
new file mode 100644
index 0000000..0ab8fa9
--- a/dev/null
+++ b/install/install.cpp
@@ -0,0 +1,68 @@
1#include "resource.h"
2#include "../shared-code/install.h"
3
4#define KINSHORT "BigBro"
5#define KINNAME "Big Brother"
6#define VERSION "1.5"
7
8BOOL Install(void)
9{
10STRING dPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path");
11STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath");
12LPCSTR qPath = ((LPCSTR)dPath)?(LPCSTR)dPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings");
13STRING path = REQUESTPATH(" " KINNAME " " VERSION,"\nEnter destination path:",qPath);
14 if(!path)
15 return NULL;
16
17 #ifdefK_ANNED
18STRING sysDir(_MAX_PATH);
19 GetSystemDirectory(sysDir,_MAX_PATH);
20 INSTALLFILE("mfc42.dl_",sysDir,"mfc42.dll");
21#endif
22
23 MAKE_PATH(path);
24STRING shortPath = GET_SHORT_PATH(path);
25 if(!shortPath){
26 MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK);
27 return FALSE;
28 }
29
30 if(!(
31 INSTALLFILE("bigbro.ex_",path,"bigbro.exe") &&
32 INSTALLFILE("bigbro.hl_",path,"bigbro.hlp") &&
33 INSTALLFILE("bigbro.cn_",path,"bigbro.cnt")
34 )){
35 MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK);
36 return FALSE;
37 }
38 ADDMENU("Accessories\\Klever Co.",KINNAME,path,"bigbro.exe");
39
40 strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path",path);
41 strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath",path);
42
43FILE* inf=CREATE_INF_FILE(path,KINSHORT ".INF");
44 if(!inf){
45 MessageBox(NULL,"Failed to install " KINNAME " " VERSION,NULL,MB_ICONERROR|MB_OK);
46 return FALSE;
47 }
48 INF_FILE_HEADER(inf);
49 INF_FILE_SECTION(inf,"Uninstall");
50 fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n");
51 INF_FILE_SECTION(inf,"kFiles");
52 INF_REMOVE_ROOT(inf,KINSHORT "Files",path);
53 INF_REMOVE_FILE(inf,KINSHORT "Files","bigbro.exe");
54 INF_REMOVE_HELP_FILE(inf,KINSHORT "Files","bigbro");
55 INF_REMOVE_FILE(inf,KINSHORT "Files","bigbro.inf");
56 INF_FILE_SECTION(inf,"kReg");
57 INF_UNINSTALL_REG(inf,KINSHORT);
58 INF_FILE_SECTION(inf,"kMenu");
59 INF_MENU_GROUP(inf,1,"Accessories\\Klever Co.");
60 INF_MENU_ITEM(inf,1,KINNAME);
61 fclose(inf);
62
63 REG_UNINSTALL_COMMAND(KINSHORT,"Klever " KINNAME " " VERSION,shortPath,KINSHORT".INF","Uninstall");
64
65 MessageBox(NULL,KINNAME" " VERSION " installed successfully, you may now run it from Programs/Accessories/Klever Co. menu or remove it using Control Panel Add/Remove Programs applet."," Rejoice!",MB_ICONINFORMATION|MB_OK);
66
67 return TRUE;
68}
diff --git a/install/install.rc b/install/install.rc
new file mode 100644
index 0000000..12740e5
--- a/dev/null
+++ b/install/install.rc
@@ -0,0 +1,182 @@
1//Microsoft Developer Studio generated resource script.
2//
3#include "resource.h"
4
5#define APSTUDIO_READONLY_SYMBOLS
6/////////////////////////////////////////////////////////////////////////////
7//
8// Generated from the TEXTINCLUDE 2 resource.
9//
10#include "afxres.h"
11
12/////////////////////////////////////////////////////////////////////////////
13#undef APSTUDIO_READONLY_SYMBOLS
14
15/////////////////////////////////////////////////////////////////////////////
16// English (U.S.) resources
17
18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19#ifdef _WIN32
20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21#pragma code_page(1252)
22#endif //_WIN32
23
24/////////////////////////////////////////////////////////////////////////////
25//
26// Dialog
27//
28
29#if defined(APSTUDIO_INVOKED) || defined(FALSE)
30#if defined(APSTUDIO_INVOKED)
31IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74
32#else
33IDD_INSTALLING DIALOGEX 0, 0, 200, 74
34#endif
35STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP
36FONT 8, "MS Sans Serif", 0, 0, 0x1
37BEGIN
38 PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER |
39 BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME
40 CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT |
41 ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32
42 LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY
43 CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45,
44 186,7,WS_EX_DLGMODALFRAME
45END
46#endif
47
48IDD_PATH DIALOGEX 0, 0, 255, 73
49STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
50 WS_VISIBLE | WS_CAPTION
51EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
52FONT 8, "MS Sans Serif", 0, 0, 0x1
53BEGIN
54 LTEXT "",IDC_PROMPT,7,7,241,30
55 EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL
56 PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12
57 DEFPUSHBUTTON "OK",IDOK,69,52,50,14
58 PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14
59END
60
61
62/////////////////////////////////////////////////////////////////////////////
63//
64// DESIGNINFO
65//
66
67#ifdef APSTUDIO_INVOKED
68GUIDELINES DESIGNINFO DISCARDABLE
69BEGIN
70 "IDD_INSTALLING$(FALSE)", DIALOG
71 BEGIN
72 LEFTMARGIN, 7
73 RIGHTMARGIN, 193
74 TOPMARGIN, 7
75 BOTTOMMARGIN, 67
76 HORZGUIDE, 39
77 END
78
79 IDD_PATH, DIALOG
80 BEGIN
81 LEFTMARGIN, 7
82 RIGHTMARGIN, 248
83 VERTGUIDE, 202
84 VERTGUIDE, 208
85 TOPMARGIN, 7
86 BOTTOMMARGIN, 66
87 HORZGUIDE, 37
88 END
89END
90#endif // APSTUDIO_INVOKED
91
92
93#ifdef APSTUDIO_INVOKED
94/////////////////////////////////////////////////////////////////////////////
95//
96// TEXTINCLUDE
97//
98
991 TEXTINCLUDE DISCARDABLE
100BEGIN
101 "resource.h\0"
102END
103
1042 TEXTINCLUDE DISCARDABLE
105BEGIN
106 "#include ""afxres.h""\r\n"
107 "\0"
108END
109
1103 TEXTINCLUDE DISCARDABLE
111BEGIN
112 "#include ""custom.rch""\0"
113END
114
115#endif // APSTUDIO_INVOKED
116
117
118/////////////////////////////////////////////////////////////////////////////
119//
120// Icon
121//
122
123// Icon with lowest ID value placed first to ensure application icon
124// remains consistent on all systems.
125IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico"
126
127#ifndef _MAC
128/////////////////////////////////////////////////////////////////////////////
129//
130// Version
131//
132
133VS_VERSION_INFO VERSIONINFO
134 FILEVERSION 1,5,0,0
135 PRODUCTVERSION 1,5,0,0
136 FILEFLAGSMASK 0x3fL
137#ifdef _DEBUG
138 FILEFLAGS 0x1L
139#else
140 FILEFLAGS 0x0L
141#endif
142 FILEOS 0x40004L
143 FILETYPE 0x1L
144 FILESUBTYPE 0x0L
145BEGIN
146 BLOCK "StringFileInfo"
147 BEGIN
148 BLOCK "040904b0"
149 BEGIN
150 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
151 VALUE "FileDescription", "INSTALL: Big Brother, network monitoring tool\0"
152 VALUE "FileVersion", "1, 5, 0, 0\0"
153 VALUE "InternalName", "INSTALL\0"
154 VALUE "LegalCopyright", "Copyright © 1996, 2002 Klever Group (http://www.klever.net/)\0"
155 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
156 VALUE "OriginalFilename", "INSTALL.EXE\0"
157 VALUE "ProductName", "Big Brother\0"
158 VALUE "ProductVersion", "1, 5, 0, 0\0"
159 END
160 END
161 BLOCK "VarFileInfo"
162 BEGIN
163 VALUE "Translation", 0x409, 1200
164 END
165END
166
167#endif // !_MAC
168
169#endif // English (U.S.) resources
170/////////////////////////////////////////////////////////////////////////////
171
172
173
174#ifndef APSTUDIO_INVOKED
175/////////////////////////////////////////////////////////////////////////////
176//
177// Generated from the TEXTINCLUDE 3 resource.
178//
179#include "custom.rch"
180/////////////////////////////////////////////////////////////////////////////
181#endif // not APSTUDIO_INVOKED
182
diff --git a/install/resource.h b/install/resource.h
new file mode 100644
index 0000000..ebf7991
--- a/dev/null
+++ b/install/resource.h
@@ -0,0 +1,24 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Developer Studio generated include file.
3// Used by Install.rc
4//
5#define IDD_INSTALLING 101
6#define IDD_PATH 102
7#define IDI_ICON 105
8#define IDC_DISKS 1000
9#define IDC_STATE 1001
10#define IDC_PROGRESS 1002
11#define IDC_PROMPT 1003
12#define IDC_PATH 1004
13#define IDC_BROWSE 1005
14
15// Next default values for new objects
16//
17#ifdef APSTUDIO_INVOKED
18#ifndef APSTUDIO_READONLY_SYMBOLS
19#define _APS_NEXT_RESOURCE_VALUE 107
20#define _APS_NEXT_COMMAND_VALUE 40001
21#define _APS_NEXT_CONTROL_VALUE 1006
22#define _APS_NEXT_SYMED_VALUE 101
23#endif
24#endif
diff --git a/makehelp.bat b/makehelp.bat
new file mode 100644
index 0000000..e78c2d6
--- a/dev/null
+++ b/makehelp.bat
@@ -0,0 +1,35 @@
1@echo off
2REM -- First make map file from Microsoft Visual C++ generated resource.h
3echo // MAKEHELP.BAT generated Help Map file. Used by BIGBRO.HPJ. >"help\bigbro.hm"
4echo. >>"help\bigbro.hm"
5echo // Commands (ID_* and IDM_*) >>"help\bigbro.hm"
6makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"help\bigbro.hm"
7echo. >>"help\bigbro.hm"
8echo // Prompts (IDP_*) >>"help\bigbro.hm"
9makehm IDP_,HIDP_,0x30000 resource.h >>"help\bigbro.hm"
10echo. >>"help\bigbro.hm"
11echo // Resources (IDR_*) >>"help\bigbro.hm"
12makehm IDR_,HIDR_,0x20000 resource.h >>"help\bigbro.hm"
13echo. >>"help\bigbro.hm"
14echo // Dialogs (IDD_*) >>"help\bigbro.hm"
15makehm IDD_,HIDD_,0x20000 resource.h >>"help\bigbro.hm"
16echo. >>"help\bigbro.hm"
17echo // Frame Controls (IDW_*) >>"help\bigbro.hm"
18makehm IDW_,HIDW_,0x50000 resource.h >>"help\bigbro.hm"
19REM -- Make help for Project BIGBROTHER
20
21
22echo Building RTF file
23xsltproc -o help/bigbrother.rtf shared-code/kinhelp.xsl help/bigbrother.xml
24echo Building Win32 Help files
25start /wait hcrtf -x "help\bigbrother.hpj"
26echo.
27if exist Debug\nul copy "help\bigbro.hlp" Debug
28if exist Debug\nul copy "help\bigbro.cnt" Debug
29if exist Release\nul copy "help\bigbro.hlp" Release
30if exist Release\nul copy "help\bigbro.cnt" Release
31if exist Releast\nul copy "help\bigbro.hlp" Releast
32if exist Releast\nul copy "help\bigbro.cnt" Releast
33echo.
34
35
diff --git a/res/3angle.avi b/res/3angle.avi
new file mode 100644
index 0000000..5dcd036
--- a/dev/null
+++ b/res/3angle.avi
Binary files differ
diff --git a/res/BigBrotherDoc.ico b/res/BigBrotherDoc.ico
new file mode 100644
index 0000000..3fba5b7
--- a/dev/null
+++ b/res/BigBrotherDoc.ico
Binary files differ
diff --git a/res/bigbrother.ico b/res/bigbrother.ico
new file mode 100644
index 0000000..cfca70d
--- a/dev/null
+++ b/res/bigbrother.ico
Binary files differ
diff --git a/res/bigbrother.rc2 b/res/bigbrother.rc2
new file mode 100644
index 0000000..4d9fb32
--- a/dev/null
+++ b/res/bigbrother.rc2
@@ -0,0 +1,13 @@
1//
2// BIGBROTHER.RC2 - resources Microsoft Visual C++ does not edit directly
3//
4
5#ifdef APSTUDIO_INVOKED
6 #error this file is not editable by Microsoft Visual C++
7#endif //APSTUDIO_INVOKED
8
9
10/////////////////////////////////////////////////////////////////////////////
11// Add manually edited resources here...
12
13/////////////////////////////////////////////////////////////////////////////
diff --git a/res/goingdown.ico b/res/goingdown.ico
new file mode 100644
index 0000000..ca31de6
--- a/dev/null
+++ b/res/goingdown.ico
Binary files differ
diff --git a/res/host-down.wav b/res/host-down.wav
new file mode 100644
index 0000000..9f074db
--- a/dev/null
+++ b/res/host-down.wav
Binary files differ
diff --git a/res/host-up.wav b/res/host-up.wav
new file mode 100644
index 0000000..73aecfd
--- a/dev/null
+++ b/res/host-up.wav
Binary files differ
diff --git a/res/host.ico b/res/host.ico
new file mode 100644
index 0000000..494ba76
--- a/dev/null
+++ b/res/host.ico
Binary files differ
diff --git a/res/hostdown.ico b/res/hostdown.ico
new file mode 100644
index 0000000..68912d2
--- a/dev/null
+++ b/res/hostdown.ico
Binary files differ
diff --git a/res/junktoolbar.bmp b/res/junktoolbar.bmp
new file mode 100644
index 0000000..001fca2
--- a/dev/null
+++ b/res/junktoolbar.bmp
Binary files differ
diff --git a/res/maintoolbar.bmp b/res/maintoolbar.bmp
new file mode 100644
index 0000000..e2e21ad
--- a/dev/null
+++ b/res/maintoolbar.bmp
Binary files differ
diff --git a/res/nohost.ico b/res/nohost.ico
new file mode 100644
index 0000000..58267ed
--- a/dev/null
+++ b/res/nohost.ico
Binary files differ
diff --git a/res/pending.ico b/res/pending.ico
new file mode 100644
index 0000000..4c4a71c
--- a/dev/null
+++ b/res/pending.ico
Binary files differ
diff --git a/res/pinging.ico b/res/pinging.ico
new file mode 100644
index 0000000..0e0d835
--- a/dev/null
+++ b/res/pinging.ico
Binary files differ
diff --git a/resource.h b/resource.h
new file mode 100644
index 0000000..06de53b
--- a/dev/null
+++ b/resource.h
@@ -0,0 +1,131 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Developer Studio generated include file.
3// Used by BigBrother.rc
4//
5#define IDD_ABOUTBOX 100
6#define IDC_TRAYICON 101
7#define IDD_PROPS_SETTINGS 102
8#define ID_PINGBAR 102
9#define IDD_PROPS_GENERAL 103
10#define TM_CHECK 103
11#define IDP_SOCKETS_INIT_FAILED 104
12#define IDD_PROPS_ACTION 104
13#define IDS_PROPS_TITLE 105
14#define IDS_LOG_DOLOG 106
15#define IDS_LOG_DONTLOG 107
16#define IDS_LOG_ASKBIGBROTHER 108
17#define IDS_NODESC 109
18#define IDS_PS_FAILEDTORESOLVE 110
19#define IDS_PS_UNABLETOICMP 111
20#define IDS_PS_INTERNALERROR 112
21#define IDS_PS_NETUNREACHABLE 113
22#define IDS_PS_HOSTUNREACHABLE 114
23#define IDS_PS_PROTUNREACHABLE 115
24#define IDS_PS_PORTUNREACHABLE 116
25#define IDS_PS_NORESOURCES 117
26#define IDS_PS_HWERROR 118
27#define IDS_PS_BIGPACKET 119
28#define IDS_PS_TIMEOUT 120
29#define IDS_PS_BADROUTE 121
30#define IDS_PS_TTLEXPTRANSIT 122
31#define IDS_PS_TTLEXPREASM 123
32#define IDS_PS_IPARAMP 124
33#define IDS_PS_SOURCEQUENCH 125
34#define IDS_PS_BIGOPTION 126
35#define IDS_PS_BADDEST 127
36#define IDR_MAINFRAME 128
37#define IDR_BIGBROTYPE 129
38#define IDS_PS_UNKNOWNERROR 129
39#define IDS_REGISTRYKEY 130
40#define IDI_NOHOST 131
41#define IDS_AVIEW_NOTIP 131
42#define IDI_PENDING 132
43#define IDS_AVIEW_SHORTTIP 132
44#define IDI_HOST 133
45#define IDM_POPUPS 133
46#define IDS_AVIEW_TIP_TIMEFORMAT 133
47#define IDI_PINGING 134
48#define IDR_PINGBAR 134
49#define IDS_AVIEW_TIP_UNPINGED 134
50#define IDI_GOINGDOWN 135
51#define IDR_JUNKACCELERATOR 135
52#define IDS_AVIEW_TIP_UNREACHABLE 135
53#define IDI_HOSTDOWN 136
54#define IDR_JUNKTOOLBAR 136
55#define IDS_AVIEW_TIP_RTTREPORT 136
56#define IDS_ROOTNODENAME 137
57#define IDS_WAVFILTER 138
58#define IDW_HOST_UP 138
59#define IDW_HOST_DOWN 139
60#define IDS_ACTION_HOST_UP 139
61#define IDS_ACTION_HOST_DOWN 140
62#define IDI_PREPLAY 140
63#define IDI_BROWSESOUND 141
64#define IDD_PREFS 141
65#define IDS_LOGFILTER 141
66#define IDS_LOG_HOSTUP 142
67#define IDS_LOG_HOSTDOWN 143
68#define IDS_LOG_DATEFORMAT 144
69#define IDS_LOGFILE_SELECT 145
70#define IDS_SOUND_SELECT 146
71#define IDS_LOG_LOADFILE 147
72#define IDS_ACTION_SYSTEM_OK 148
73#define IDS_ACTION_SYSTEM_CRITICAL 149
74#define IDC_OVERRIDE_INTERVALS 1000
75#define IDC_PINGINTERVAL_GOOD 1001
76#define IDC_PINGINTERVAL_BAD 1002
77#define IDC_OVERRIDE_TIMEOUT 1003
78#define IDC_PINGTIMEOUT 1004
79#define IDC_HOST 1004
80#define IDC_OVERRIDE_RETRIES 1005
81#define IDC_DESC 1005
82#define IDC_RETRIES 1006
83#define IDC_LOG_ACTIVITY 1006
84#define IDC_OVERRIDE_ACTION 1010
85#define IDC_PLAYASOUND_DOWN 1011
86#define IDC_SOUND_DOWN 1012
87#define IDC_PLAYASOUND_UP 1013
88#define IDC_CUSTOM_DOWN 1014
89#define IDC_PROGRAM_DOWN 1015
90#define IDC_SOUND_UP 1016
91#define IDC_CUSTOM_UP 1017
92#define IDC_PROGRAM_UP 1018
93#define IDC_KLEVERNET 1018
94#define IDC_PREVIEW_SOUND_UP 1020
95#define IDC_PREVIEW_SOUND_DOWN 1021
96#define IDC_SAVEONSHUTDOWN 1021
97#define IDC_BROWSE_SOUND_UP 1022
98#define IDC_AUTOSAVEMINS 1022
99#define IDC_BROWSE_SOUND_DOWN 1023
100#define IDC_AUTOSPIN 1023
101#define IDC_PINGSIZE 1024
102#define IDC_DATASIZESPIN 1025
103#define IDC_MAXTHREADS 1026
104#define IDC_THREADSPIN 1027
105#define IDC_LOGFILE 1028
106#define IDC_BROWSE 1029
107#define IDC_LOGMINS 1030
108#define IDC_LOGMINSPIN 1032
109#define IDC_STOREACTIVITY 1033
110#define ID_BROTHERS_NEW 32771
111#define ID_VIEW_MAINWINDOW 32773
112#define ID_INDICATOR_PINGBAR 32775
113#define ID_BROTHERS_ADDBROTHER 32776
114#define ID_BROTHERS_DELETE 32777
115#define ID_FILE_AUTOLOAD 32782
116#define ID_FILE_PREFERENCES 32783
117#define ID_FILE_PAUSE 32784
118#define ID_VIEW_HOSTPROPERTIES 32789
119#define ID_HELP_LEGEND 32791
120
121// Next default values for new objects
122//
123#ifdef APSTUDIO_INVOKED
124#ifndef APSTUDIO_READONLY_SYMBOLS
125#define _APS_3D_CONTROLS 1
126#define _APS_NEXT_RESOURCE_VALUE 142
127#define _APS_NEXT_COMMAND_VALUE 32795
128#define _APS_NEXT_CONTROL_VALUE 1034
129#define _APS_NEXT_SYMED_VALUE 104
130#endif
131#endif
diff --git a/shared-code/BTreendex.h b/shared-code/BTreendex.h
new file mode 100644
index 0000000..88109ab
--- a/dev/null
+++ b/shared-code/BTreendex.h
@@ -0,0 +1,595 @@
1 #ifndef__BTREENDEX_H
2 #define__BTREENDEX_H
3
4#include "Dynamide.h"
5
6namespace Klever {
7
8template<class key,class value,int treeOrder,int cluster>
9 class CBTreendex : public CObject{
10public:
11 typedef LONG CBTPageRef;
12 struct CBTRecordRef {
13 CBTPageRef m_Page;
14 INT m_Offset;
15 CBTRecordRef(CBTPageRef page=-1,INT offset=-1) : m_Page(page), m_Offset(offset) {}
16 };
17 class CBTRecord : public CObject {
18 public:
19 CBTPageRef m_ptrLeft;
20 CBTPageRef m_ptrRight;
21 key m_Key;
22 value m_Value;
23 CBTRecord() : m_ptrLeft(-1), m_ptrRight(-1) {}
24 CBTRecord(key& _key,value& _value,CBTPageRef left=-1,CBTPageRef right=-1) : m_Key(_key), m_Value(_value), m_ptrLeft(left), m_ptrRight(right) {}
25 CBTRecord(CBTRecord& r) : m_Key(r.m_Key), m_Value(r.m_Value), m_ptrLeft(r.m_ptrLeft), m_ptrRight(r.m_ptrRight) {}
26
27 CBTRecord& operator=(CBTRecord& r) {m_Key=r.m_Key, m_Value=r.m_Value, m_ptrLeft=r.m_ptrLeft, m_ptrRight=r.m_ptrRight;return *this;}
28
29 void Serialize(CArchive& ar) {
30 if(ar.IsStoring()){
31 ar << m_ptrLeft;
32 ar << m_ptrRight;
33 }else{
34 ar >> m_ptrLeft;
35 ar >> m_ptrRight;
36 }
37 SerializeElements(ar,&m_Key,1);
38 SerializeElements(ar,&m_Value,1);
39 }
40 };
41 class CBTPage : public CArray<CBTRecord,CBTRecord&> {
42 public:
43 void Serialize(CArchive& ar) {
44 int nCount = -1;
45 if(ar.IsStoring()){
46 nCount = GetSize();
47 ar << nCount;
48 }else{
49 nCount = 0;
50 ar >> nCount;
51 RemoveAll();
52 SetSize(nCount);
53 }
54 for(int tmp=0;tmp<nCount;tmp++)
55 ElementAt(tmp).Serialize(ar);
56 }
57 };
58 typedef CDynamide<256,cluster> CBTDyna;
59 typedef CBTDyna::CDynaFile CBTDynaFile;
60 typedef CArray<CBTRecordRef,CBTRecordRef&> CBTRStack;
61
62 CBTDyna m_BT;
63 struct_btCrap {
64 BOOL m_bRootSet;
65 CBTPageRef m_Root;
66 } *m_BTCrap;
67 BOOL m_bRO;
68 CBTRStack m_btStack;
69 CBTPage m_stackTop;
70
71 CBTreendex() {}
72 ~CBTreendex() { Close(); }
73 BOOL Attach(CFile* file,BOOL bAutodelete) {
74 m_bRO = FALSE;
75 if(!m_BT.Attach(file,bAutodelete))
76 return FALSE;
77 return Attach();
78 }
79 BOOL Open(LPCTSTR file,BOOL bReadOnly) {
80 if(!m_BT.Open(file,bReadOnly))
81 return FALSE;
82 m_bRO = bReadOnly;
83 return Attach();
84 }
85 BOOL Create(LPCTSTR file) {
86 try{
87 CFile* f = new CFile(file,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead|CFile::shareDenyWrite|CFile::typeBinary);
88 ASSERT(f);
89 return Attach(f,TRUE);
90 }catch(CException* e){
91 e->Delete();
92 return FALSE;
93 }
94 }
95 BOOL Attach() {
96 ASSERT(m_BT.IsOpened());
97 m_BTCrap = (_btCrap*)m_BT.m_FB.crap;
98 if(!m_BTCrap->m_bRootSet){
99 m_BTCrap->m_Root = AllocatePage();
100 if(m_BTCrap->m_Root<0)
101 return FALSE;
102 m_BTCrap->m_bRootSet = TRUE;
103 m_BT.Write1stBlock();
104 }
105 return TRUE;
106 }
107 BOOL Close() {
108 m_BT.Close();
109 return TRUE;
110 }
111 BOOL IsOpened() {
112 return m_BT.IsOpened();
113 }
114
115 BOOL Lookup(key& _key,value& value) {
116 if(!IsOpened())
117 return FALSE;
118 ASSERT(m_BTCrap->m_bRootSet);
119 if(!SeekToPage(_key))
120 return FALSE;
121 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
122 if(rr.m_Offset<0)
123 return FALSE;
124 ASSERT(rr.m_Offset<m_stackTop.GetSize());
125 if(_key != m_stackTop[rr.m_Offset].m_Key)
126 return FALSE;
127 value = m_stackTop[rr.m_Offset].m_Value;
128 return TRUE;
129 }
130 BOOL Add(key& _key,value& _value) {
131 if(!IsOpened())
132 return FALSE;
133 ASSERT(m_BTCrap->m_bRootSet);
134 if(!SeekToPage(_key))
135 return FALSE;
136 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
137 CBTRecord nuRecord(_key,_value);
138 if(rr.m_Offset<0){
139 if(m_stackTop.GetSize())
140 nuRecord.m_ptrLeft = m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight;
141 }else if(rr.m_Offset==0){
142 nuRecord.m_ptrRight = m_stackTop[0].m_ptrLeft;
143 }else{
144 nuRecord.m_ptrLeft = m_stackTop[rr.m_Offset-1].m_ptrRight;
145 nuRecord.m_ptrRight = m_stackTop[rr.m_Offset].m_ptrLeft;
146 }
147 // ASSERT(rr.m_Offset==0 || (m_stackTop[rr.m_Offset-1].m_Key<_key && m_stackTop[rr.m_Offset-1].m_ptrRight<0));
148 // ASSERT(rr.m_Offset<0 || m_stackTop[rr.m_Offset].m_Key>=_key && m_stackTop[rr.m_Offset].m_ptrLeft<0);
149 if(rr.m_Offset>=0 && m_stackTop[rr.m_Offset].m_Key==_key){
150 // Exact match found - just replace.
151 m_stackTop[rr.m_Offset].m_Value = _value;
152 if(!SavePage(rr.m_Page,m_stackTop))
153 return FALSE;
154 return TRUE;
155 }
156 // Split the page and propagate the split if needed..
157 // Insert new element at rr.m_Offset..
158 BOOL nuisnew = TRUE;
159 for(int sp=m_btStack.GetUpperBound();sp>=0;sp--){
160 CBTPageRef opr = m_btStack[sp].m_Page;
161 int iAt = m_btStack[sp].m_Offset;
162 CBTPage op;
163 VERIFY(LoadPage(opr,op));
164 if(iAt<0)
165 iAt = op.GetSize();
166 else{
167 if(op[iAt].m_Key<nuRecord.m_Key)
168 iAt++;
169 ASSERT(iAt==op.GetSize() || op[iAt].m_Key > nuRecord.m_Key);
170 }
171 op.InsertAt(iAt,nuRecord);
172 if(iAt>0)
173 op[iAt-1].m_ptrRight=nuRecord.m_ptrLeft;
174 if(iAt<op.GetUpperBound())
175 op[iAt+1].m_ptrLeft=nuRecord.m_ptrRight;
176 if(op.GetSize()<=treeOrder*2){
177 // This isn't causing overflow
178 VERIFY(SavePage(opr,op));
179 return TRUE;
180 }
181 TRACE0("Split\n");
182 ASSERT(op.GetSize()==(treeOrder*2+1));
183 CBTPageRef npr = AllocatePage();
184 ASSERT(npr>=0);
185 CBTPage np;
186 ASSERT(LoadPage(npr,np));
187 ASSERT(!np.GetSize());
188 nuRecord = op[treeOrder];
189 if(iAt==treeOrder){
190 // We're inserting central element! - drop out the stack top if this is still new one
191 for(int tmp=0;tmp<treeOrder;tmp++)
192 np.InsertAt(tmp,op[tmp]);
193 op.RemoveAt(0,treeOrder+1);
194 nuRecord.m_ptrLeft = npr;
195 nuRecord.m_ptrRight = opr;
196 if(nuisnew)
197 m_btStack.RemoveAt(m_btStack.GetUpperBound());
198 }else{
199 if(iAt<treeOrder){
200 // We're inserting in the left subtree.
201 // Make newpage the right one and forget it.
202 for(int tmp=0;tmp<treeOrder;tmp++)
203 np.InsertAt(tmp,op[tmp+treeOrder+1]);
204 op.RemoveAt(treeOrder,treeOrder+1);
205 nuRecord.m_ptrLeft = opr;
206 nuRecord.m_ptrRight = npr;
207 }else{
208 // We're inserting in the right subtree.
209 // Make newpage the left one, forget it, but also adjust offset in the stack
210 for(int tmp=0;tmp<treeOrder;tmp++)
211 np.InsertAt(tmp,op[tmp]);
212 op.RemoveAt(0,treeOrder+1);
213 nuRecord.m_ptrLeft = npr;
214 nuRecord.m_ptrRight = opr;
215 m_btStack[sp].m_Offset-=treeOrder+1;
216 }
217 // Note that we're not inserting new element anymore.
218 nuisnew = FALSE;
219 }
220 // Do, excessive sanity checks and save pages
221 ASSERT(op.GetSize());
222 ASSERT(np.GetSize());
223 VERIFY(SavePage(opr,op));
224 VERIFY(SavePage(npr,np));
225 }
226 // Here we have root page overflow, which means that we're simply putting new
227 // record in this brand new root page and also inserting this page on the bottom of the stack
228 CBTPageRef nuroot = AllocatePage();
229 ASSERT(nuroot>=0);
230 CBTPage nurpa;
231 ASSERT(LoadPage(nuroot,nurpa));
232 ASSERT(!nurpa.GetSize());
233 nurpa.Add(nuRecord);
234 VERIFY(SavePage(nuroot,nurpa));
235 m_btStack.InsertAt(0,CBTRecordRef(nuroot,0));
236 m_BTCrap->m_Root = nuroot;
237 m_BT.Write1stBlock();
238 return TRUE;
239 }
240 BOOL Delete(key& _key) {
241 if(!IsOpened())
242 return FALSE;
243 ASSERT(m_BTCrap->m_bRootSet);
244 value _value;
245 if(!Lookup(_key,_value))
246 return FALSE;
247 // Found key, check if it's a leaf
248 {
249 CBTRecordRef* rr = &m_btStack[m_btStack.GetUpperBound()];
250 int rrIdx = m_btStack.GetUpperBound();
251 if(m_stackTop[rr->m_Offset].m_ptrLeft>=0){
252 ASSERT(m_stackTop[rr->m_Offset].m_ptrRight>=0);
253 // It isn't - scan for the _next_ key and do dirty deeds
254 m_btStack.Add(CBTRecordRef(m_stackTop[rr->m_Offset].m_ptrRight,0));
255 for(;;){
256 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
257 if(!LoadPage(rr.m_Page,m_stackTop))
258 return FALSE;
259 if(m_stackTop[0].m_ptrLeft<0)
260 break;
261 m_btStack.Add(CBTRecordRef(m_stackTop[0].m_ptrLeft,0));
262 }
263 // We have a leaf node here, replace victim with the first element and kill it.
264 CBTPage uppage;
265 rr = &m_btStack[rrIdx];
266 if(!LoadPage(rr->m_Page,uppage))
267 return FALSE;
268 uppage[rr->m_Offset].m_Key=m_stackTop[0].m_Key; uppage[rr->m_Offset].m_Value=m_stackTop[0].m_Value;
269 m_stackTop.RemoveAt(0);
270 if(!(SavePage(rr->m_Page,uppage) && SavePage(m_btStack[m_btStack.GetUpperBound()].m_Page,m_stackTop)))
271 return FALSE;
272 }else{
273 ASSERT(m_stackTop[rr->m_Offset].m_ptrRight<0);
274 m_stackTop.RemoveAt(rr->m_Offset);
275 if(!SavePage(rr->m_Page,m_stackTop))
276 return FALSE;
277 }
278 }
279 // We have a page to check for underflow at the top of the stack now.
280 for(;;){
281 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
282 if(!LoadPage(rr.m_Page,m_stackTop))
283 return FALSE;
284 if(m_stackTop.GetSize()>=treeOrder || m_btStack.GetSize()==1)
285 return TRUE;
286 CBTRecordRef& rr1 = m_btStack[m_btStack.GetUpperBound()-1];
287 CBTPage daddy;
288 if(!LoadPage(rr1.m_Page,daddy))
289 return FALSE;
290 CBTPageRef nPage = daddy[rr1.m_Offset].m_ptrRight;
291 BOOL bRight=TRUE;
292 if(nPage<0 || nPage==rr.m_Page){
293 nPage = daddy[rr1.m_Offset].m_ptrLeft;
294 bRight = FALSE;
295 }
296 ASSERT(nPage>=0 && nPage!=rr.m_Page);
297 CBTPage neighbor;
298 if(!LoadPage(nPage,neighbor))
299 return FALSE;
300 // Here we have possibly two cases:
301 // 1. Neighboring page can share some data with use, then do share and leave
302 // 2. Neighboring page is of treeorder in size, then merge and propagate
303 if(neighbor.GetSize()>treeOrder){
304 TRACE0("Redistributing..\n");
305 // Borrow some data from there.
306 int toBorrow = neighbor.GetSize()-treeOrder;
307 toBorrow=toBorrow/2+1;
308 ASSERT(toBorrow);
309 if(bRight)
310 m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft));
311 else
312 m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft));
313 for(toBorrow--;toBorrow;toBorrow--){
314 if(bRight){
315 m_stackTop.Add(neighbor[0]);
316 neighbor.RemoveAt(0);
317 }else{
318 m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
319 neighbor.RemoveAt(neighbor.GetUpperBound());
320 }
321 }
322 daddy[rr1.m_Offset].m_Key = neighbor[bRight?0:neighbor.GetUpperBound()].m_Key; daddy[rr1.m_Offset].m_Value = neighbor[bRight?0:neighbor.GetUpperBound()].m_Value;
323 neighbor.RemoveAt(bRight?0:neighbor.GetUpperBound());
324 if(!(SavePage(rr1.m_Page,daddy) && SavePage(nPage,neighbor) && SavePage(rr.m_Page,m_stackTop)))
325 return FALSE;
326 rr.m_Offset = -1;// *** Point to the next??
327 return TRUE;
328 }
329 TRACE0("Merging..\n");
330 // We need to merge pages here..
331 // We will merge them at stacktop, then we'll discard neighbor guy..
332 if(bRight)
333 m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft));
334 else
335 m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft));
336 if(bRight){
337 while(neighbor.GetSize()){
338 m_stackTop.Add(neighbor[0]);
339 neighbor.RemoveAt(0);
340 }
341 }else{
342 while(neighbor.GetSize()){
343 m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
344 neighbor.RemoveAt(neighbor.GetUpperBound());
345 }
346 }
347 if(rr1.m_Offset>0)
348 daddy[rr1.m_Offset-1].m_ptrRight=rr.m_Page;
349 if(rr1.m_Offset<daddy.GetUpperBound())
350 daddy[rr1.m_Offset+1].m_ptrLeft=rr.m_Page;
351 daddy.RemoveAt(rr1.m_Offset);
352 if(!(SavePage(rr1.m_Page,daddy) && SavePage(rr.m_Page,m_stackTop)))
353 return FALSE;
354 VERIFY(DeallocatePage(nPage));
355 m_btStack.RemoveAt(m_btStack.GetUpperBound());
356 }
357 return FALSE;
358 }
359 BOOL GoFirst() {
360 if(!IsOpened())
361 return FALSE;
362 ASSERT(m_BTCrap->m_bRootSet);
363 m_btStack.RemoveAll();
364 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
365 for(;;){
366 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
367 if(!LoadPage(rr.m_Page,m_stackTop))
368 return FALSE;
369 if(!m_stackTop.GetSize()){
370 ASSERT(m_btStack.GetSize()==1);
371 return FALSE;
372 }
373 rr.m_Offset = 0;
374 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
375 return TRUE;
376 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
377 }
378 }
379 BOOL GoLast() {
380 if(!IsOpened())
381 return FALSE;
382 ASSERT(m_BTCrap->m_bRootSet);
383 m_btStack.RemoveAll();
384 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
385 for(;;){
386 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
387 if(!LoadPage(rr.m_Page,m_stackTop))
388 return FALSE;
389 if(!m_stackTop.GetSize()){
390 ASSERT(m_btStack.GetSize()==1);
391 return FALSE;
392 }
393 rr.m_Offset = m_stackTop.GetUpperBound();
394 if(m_stackTop[rr.m_Offset].m_ptrRight<0)
395 return TRUE;
396 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
397 }
398 }
399 BOOL GoNext() {
400 if(!IsOpened())
401 return FALSE;
402 if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
403 return FALSE;
404 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
405 if(!LoadPage(rr.m_Page,m_stackTop))
406 return FALSE;
407 ASSERT(rr.m_Offset<m_stackTop.GetSize());
408 if(m_stackTop[rr.m_Offset].m_ptrRight>=0){
409 // Advance pointer in this page and dive into subtree
410 // going left and left until we have nowhere to go.
411 // TRACE1("Dive into page %lu",m_stackTop[rr.m_Offset].m_ptrRight);
412 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,0));
413 for(;;){
414 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
415 ASSERT(rr.m_Offset==0);
416 if(!LoadPage(rr.m_Page,m_stackTop))
417 return FALSE;
418 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
419 break;
420 // TRACE1(", %lu",m_stackTop[rr.m_Offset].m_ptrLeft);
421 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,0));
422 }
423 // TRACE0("\n");
424 return TRUE;
425 }else if(rr.m_Offset<m_stackTop.GetUpperBound()){
426 rr.m_Offset++;
427 return TRUE;
428 }
429 // We're at the end of page go up until we're done or we have data.
430 m_btStack.RemoveAt(m_btStack.GetUpperBound());
431 // TRACE0("Go up");
432 while(m_btStack.GetSize()){
433 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
434 if(!LoadPage(rr.m_Page,m_stackTop))
435 return FALSE;
436 if(rr.m_Offset<m_stackTop.GetSize()){
437 // TRACE0("\n");
438 return TRUE;
439 }
440 // TRACE0(", up");
441 m_btStack.RemoveAt(m_btStack.GetUpperBound());
442 }
443 // TRACE0("\nBtree is done\n");
444 return FALSE;
445 }
446 BOOL GoPrev() {
447 if(!IsOpened())
448 return FALSE;
449 if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
450 return FALSE;
451 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
452 if(!LoadPage(rr.m_Page,m_stackTop))
453 return FALSE;
454 ASSERT(rr.m_Offset<m_stackTop.GetSize());
455 if(m_stackTop[rr.m_Offset].m_ptrLeft>=0){
456 // Dive in and go right and right from the rightmost until
457 // we have nowhere to go.
458 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
459 for(;;){
460 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
461 if(!LoadPage(rr.m_Page,m_stackTop))
462 return FALSE;
463 rr.m_Offset = m_stackTop.GetUpperBound();
464 if(m_stackTop[rr.m_Offset].m_ptrRight<0)
465 return TRUE;
466 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
467 }
468 return TRUE;
469 }else if(rr.m_Offset>0){
470 rr.m_Offset--;
471 return TRUE;
472 }
473 // We're at the leftmost element in page - go up and left until we're
474 // done or we have data.
475 m_btStack.RemoveAt(m_btStack.GetUpperBound());
476 while(m_btStack.GetSize()){
477 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
478 if(!LoadPage(rr.m_Page,m_stackTop))
479 return FALSE;
480 rr.m_Offset--;
481 if(rr.m_Offset>=0)
482 return TRUE;
483 m_btStack.RemoveAt(m_btStack.GetUpperBound());
484 }
485 // No more data - we were at the first element in tree.
486 return FALSE;
487 }
488 BOOL GetThis(key& _key,value& _value) {
489 if(!IsOpened())
490 return FALSE;
491 // *** MORE CHECKING
492 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
493 if(!LoadPage(rr.m_Page,m_stackTop))
494 return FALSE;
495 _key = m_stackTop[rr.m_Offset].m_Key;
496 _value = m_stackTop[rr.m_Offset].m_Value;
497 return TRUE;
498 }
499
500 BOOL SeekToPage(const key& _key) {
501 ASSERT(IsOpened());
502 ASSERT(m_BTCrap->m_bRootSet);
503 m_btStack.RemoveAll();
504 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
505 for(;;){
506 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
507 if(!LoadPage(rr.m_Page,m_stackTop))
508 return FALSE;
509 ASSERT(m_stackTop.GetSize() || !m_btStack.GetUpperBound());
510 if(!m_stackTop.GetSize()){
511 rr.m_Offset=-1;
512 return TRUE;
513 }
514 for(rr.m_Offset=0;rr.m_Offset<m_stackTop.GetSize();rr.m_Offset++){
515 if(_key == m_stackTop[rr.m_Offset].m_Key)
516 return TRUE;
517 if(_key < m_stackTop[rr.m_Offset].m_Key){
518 ASSERT(rr.m_Offset==0 || m_stackTop[rr.m_Offset].m_ptrLeft==m_stackTop[rr.m_Offset-1].m_ptrRight);
519 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
520 return TRUE;
521 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
522 break;
523 }
524 if(rr.m_Offset==m_stackTop.GetUpperBound()){
525 if(m_stackTop[rr.m_Offset].m_ptrRight<0){
526 rr.m_Offset=-1;
527 return TRUE;
528 }
529 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrRight,-1));
530 break;
531 }
532 }
533 }
534 }
535
536 BOOL LoadPage(CBTPageRef ref,CBTPage& page) {
537 CFile* pageFile = m_BT.OpenFile(ref);
538 if(!pageFile)
539 return FALSE;
540 BOOL rv = TRUE;
541 try{
542 CArchive ar(pageFile,CArchive::load);
543 page.Serialize(ar);
544 if(m_bRO)
545 page.FreeExtra();// ** ???
546 ar.Close();
547 }catch(CException* e){
548 e->Delete();
549 rv = FALSE;
550 }
551 delete pageFile;
552 return rv;
553 }
554 BOOL SavePage(CBTPageRef ref,CBTPage& page) {
555 CFile* pageFile = m_BT.OpenFile(ref);
556 if(!pageFile)
557 return FALSE;
558 BOOL rv = TRUE;
559 try{
560 CArchive ar(pageFile,CArchive::store);
561 page.Serialize(ar);
562 ar.Close();
563 }catch(CException* e){
564 e->Delete();
565 rv = FALSE;
566 }
567 delete pageFile;
568 return rv;
569 }
570 CBTPageRef AllocatePage() {
571 CBTDynaFile* pageFile = m_BT.CreateFile();
572 if(!pageFile)
573 return -1;
574 CBTPage nothing;
575 CBTPageRef rv = pageFile->GetFile();
576 try{
577 CArchive ar(pageFile,CArchive::store);
578 nothing.Serialize(ar);
579 ar.Close();
580 }catch(CException* e){
581 e->Delete();
582 rv = -1;
583 }
584 delete pageFile;
585 return rv;
586 }
587 BOOL DeallocatePage(CBTPageRef ref) {
588 return m_BT.DeleteFile(ref);
589 }
590
591};
592
593};
594
595 #endif// __BTREENDEX_H
diff --git a/shared-code/BellsNWhistles.h b/shared-code/BellsNWhistles.h
new file mode 100644
index 0000000..1de77ae
--- a/dev/null
+++ b/shared-code/BellsNWhistles.h
@@ -0,0 +1,146 @@
1 #ifndef__BELLSNWHISTLES_H
2#define __BELLSNWHISTLES_H
3
4 class CBellsNWhistles{
5public:
6 class CBang {
7 public:
8 CString m_codeName;
9 enum_bangType {
10 bangNone, bangSpeaker, bangSystem, bangResource,
11 bangWaveform
12 }m_type;
13 BOOL m_bLoop;
14 union{
15 UINT system;
16 LPCTSTR resource;
17 LPCTSTR wave;
18
19 LPCTSTR str;
20 UINT id;
21 };
22 CString m_strWave;
23 CBang() : m_type(bangNone), m_bLoop(FALSE) {}
24 };
25 typedef CTypedPtrMap<CMapStringToPtr,CString,CBang*> CBangs;
26 structCBelling {
27 LPCSTR snd;
28 HMODULE hm;
29 DWORD flags;
30 CBelling(LPCSTR snd,HMODULE hm,DWORD flags) : snd(snd), hm(hm),
31 flags(flags) {}
32 CBelling(CBelling& s) : snd(s.snd), hm(s.hm), flags(s.flags) {}
33 CBelling& operator=(CBelling& s) {
34 snd=s.snd; hm=s.hm; flags=s.flags;
35 return *this;
36 }
37 };
38 typedef CBelling* Whistling;
39
40 CBangs m_bangs;
41
42 ~CBellsNWhistles() {
43 POSITION p = m_bangs.GetStartPosition();
44 while(p){
45 CString s; CBang* b;
46 m_bangs.GetNextAssoc(p,s,b);
47 delete b;
48 }
49 m_bangs.RemoveAll();
50 }
51
52 BOOL AssignSound(LPCTSTR codeName,LPCTSTR id,CBang::_bangType type=CBang::bangWaveform) {
53 CString cn = codeName;
54 cn.MakeLower();
55 CBang* b;
56 if(!m_bangs.Lookup(cn,b)) {
57 b = new CBang;
58 b->m_codeName=cn;
59 m_bangs[cn]=b;
60 }
61 b->m_type=type;
62 b->str = id;
63 if(type==CBang::bangWaveform){
64 b->m_strWave=id; b->str = b->m_strWave;
65 }
66 return TRUE;
67 }
68 BOOL AssignSound(LPCTSTR codeName,UINT nID,CBang::_bangType type=CBang::bangResource) {
69 CString cn = codeName;
70 cn.MakeLower();
71 CBang* b;
72 if(!m_bangs.Lookup(cn,b)) {
73 b = new CBang;
74 b->m_codeName=cn;
75 m_bangs[cn]=b;
76 }
77 b->m_type=type;
78 b->id = nID;
79 ASSERT(type!=CBang::bangWaveform);
80 return TRUE;
81 }
82 BOOL UnassignSound(LPCTSTR codeName) {
83 CString cn = codeName;
84 cn.MakeLower();
85 CBang* b;
86 if(m_bangs.Lookup(cn,b)) {
87 m_bangs.RemoveKey(cn);
88 delete b;
89 return TRUE;
90 }
91 return FALSE;
92 }
93
94 Whistling StartSound(LPCTSTR codeName) {
95 Whistling* rv = NULL;
96 CString cn = codeName;
97 CBang* b;
98 if(!m_bangs.Lookup(cn,b)){
99 ::PlaySound(cn,AfxGetInstanceHandle(),SND_ASYNC|SND_NODEFAULT|SND_NOWAIT|SND_FILENAME);
100 return NULL;
101 }
102 UINT flags = SND_ASYNC|SND_NODEFAULT|SND_NOWAIT;
103 LPCSTR snd = NULL;
104 switch(b->m_type){
105 case CBang::bangNone: return NULL;
106 case CBang::bangSpeaker: MessageBeep(0xFFFFFFFF); return NULL;
107 case CBang::bangSystem: MessageBeep(b->system); return NULL;
108 case CBang::bangResource:
109 snd = b->resource;
110 flags|=SND_RESOURCE; break;
111 case CBang::bangWaveform:
112 snd = b->wave;
113 flags|=SND_FILENAME; break;
114#ifdef _DEBUG
115 default:
116 ASSERT(FALSE); return NULL;
117#endif
118 }
119 if(b->m_bLoop)
120 flags|=SND_LOOP;
121 HMODULE hm = AfxGetInstanceHandle();
122 if(!::PlaySound(snd,hm,flags))
123 return NULL;
124 return b->m_bLoop?new CBelling(snd,hm,flags):NULL;
125 }
126 BOOL StopSound(Whistling whistle) {
127 if(!whistle)
128 return FALSE;
129 ::PlaySound(whistle->snd,whistle->hm,whistle->flags|SND_PURGE);
130 delete whistle;
131 return TRUE;
132 }
133 UINT FillInCombo(CComboBox* combo) {
134 POSITION p = m_bangs.GetStartPosition();
135 UINT rv = 0;
136 while(p) {
137 CString s;
138 CBang* b;
139 m_bangs.GetNextAssoc(p,s,b);
140 combo->AddString(s);
141 }
142 return rv;
143 }
144};
145
146 #endif// _BELLSNWHISTLES_H \ No newline at end of file
diff --git a/shared-code/BitSet.h b/shared-code/BitSet.h
new file mode 100644
index 0000000..cf36e3b
--- a/dev/null
+++ b/shared-code/BitSet.h
@@ -0,0 +1,105 @@
1 #ifndef__BITSET_H
2#define __BITSET_H
3
4namespace Klever {
5
6 class CBitSet: public CObject {
7public:
8 CWordArray m_Bits;
9 ULONG m_BitsInSet;
10 enum{
11 bitsPerWord = sizeof(WORD)*8
12 };
13
14 CBitSet(ULONG size = 0) : m_BitsInSet(0) { SetSize(size); }
15 CBitSet(CBitSet& o) : m_BitsInSet(0) { CopyFrom(o); }
16
17 void SetSize(ULONG size,BOOL bFillOnes=FALSE) {
18 UINT os = m_Bits.GetSize();
19 UINT ns = (size+bitsPerWord-1)/bitsPerWord;
20 if(os==ns){
21 if(os){
22 if(bFillOnes)
23 m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
24 else
25 m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
26 }
27 m_BitsInSet=size;
28 }else{
29 // *?* ASSERT((!os) || (((os-1)*bitsPerWord)<=m_BitsInSet && m_BitsInSet<(os*bitsPerWord)));
30 if(os<ns){
31 m_Bits.SetSize(ns);
32 if(bFillOnes)
33 m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
34 else
35 m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
36 WORD* ws = m_Bits.GetData();
37 ASSERT(ws);
38 memset(&ws[os],bFillOnes?0xFF:0,(ns-os)*sizeof(WORD));
39 m_BitsInSet=size;
40 }else{
41 m_Bits.SetSize(ns);
42 m_BitsInSet=size;
43 }
44 }
45 }
46 BOOL BitSet(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,TRUE,bGrow); }
47 BOOL BitClear(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,FALSE,bGrow); }
48 BOOL SetBit(UINT bit,BOOL state,BOOL bGrow=TRUE) {
49 if(m_BitsInSet<=bit){
50 if(!bGrow)
51 return FALSE;
52 SetSize(bit+1);
53 }
54 WORD mask = ((WORD)1)<<(bit%bitsPerWord);
55 if(state)
56 m_Bits[bit/bitsPerWord]|=mask;
57 else
58 m_Bits[bit/bitsPerWord]&=~mask;
59 return TRUE;
60 }
61 BOOL IsSet(UINT bit) {
62 if(m_BitsInSet<=bit)
63 return FALSE;
64 return (m_Bits[bit/bitsPerWord]&(((WORD)1)<<(bit%bitsPerWord)))!=0;
65 }
66 void Invert() {
67 for(int i=m_Bits.GetUpperBound();i>=0;i--)
68 m_Bits[i]=~m_Bits[i];
69 }
70 CBitSet& operator&=(CBitSet& o) {
71 if(o.m_BitsInSet<m_BitsInSet)
72 SetSize(o.m_BitsInSet);
73 for(int i=m_Bits.GetUpperBound();i>=0;i--)
74 m_Bits[i]&=o.m_Bits[i];
75 return *this;
76 }
77 CBitSet& operator|=(CBitSet& o) {
78 if(o.m_BitsInSet>m_BitsInSet)
79 SetSize(o.m_BitsInSet);
80 for(int i=o.m_Bits.GetUpperBound();i>=0;i--)
81 m_Bits[i]|=o.m_Bits[i];
82 return *this;
83 }
84 CBitSet& operator=(CBitSet& o) {
85 CopyFrom(o);
86 return *this;
87 }
88 void CopyFrom(CBitSet& o) {
89 m_BitsInSet=o.m_BitsInSet;
90 m_Bits.Copy(o.m_Bits);
91 }
92 void Serialize(CArchive& ar) {
93 if(ar.IsStoring()){
94 ar << m_BitsInSet;
95 m_Bits.Serialize(ar);
96 }else{
97 ar >> m_BitsInSet;
98 m_Bits.Serialize(ar);
99 }
100 }
101};
102
103};
104
105#endif // __BITSET_H
diff --git a/shared-code/Dynamide.h b/shared-code/Dynamide.h
new file mode 100644
index 0000000..32c93f7
--- a/dev/null
+++ b/shared-code/Dynamide.h
@@ -0,0 +1,443 @@
1#ifndef __DYNAMIDE_H
2#define __DYNAMIDE_H
3
4#include "LRUCache.h"
5
6namespace Klever {
7
8template<int fbSize,int bSize>
9class CDynamide : public CObject {
10 structfirstBlock {
11 LONGfreeFile;
12 BYTEcrap[fbSize-sizeof(LONG)];
13 };
14 structtheBlock {
15 LONGnext;
16 BYTEdata[bSize-sizeof(LONG)];
17 };
18public:
19 static firstBlock FirstBlock;
20 static theBlock TheBlock;
21private:
22 classCDynaCache : public CLRUCache<DWORD,DWORD,theBlock> {
23 public:
24 CFile* m_File;
25 BOOL m_bAutodelete;
26 CDynaCache(CFile* file,BOOL bAutodelete=TRUE) : CLRUCache<DWORD,DWORD,theBlock>(64) {
27 m_File=file;
28 m_bAutodelete=bAutodelete;
29 }
30 virtual ~CDynaCache() {
31 Flush();
32 if(m_bAutodelete){
33 m_File->Close();
34 delete m_File;
35 }
36 }
37 virtual BOOL _ReadIn(DWORD idx,theBlock* data) {
38 LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
39 LONG s = m_File->Seek(p,CFile::begin);
40 if(p==s){
41 UINT rb = m_File->Read(data,sizeof(*data));
42 if(rb==sizeof(*data))
43 return TRUE;
44 if(rb)
45 return FALSE;
46 memset(data,0,sizeof(*data));
47 data->next=-1;
48 try{
49 m_File->Write(data,sizeof(*data));
50 }catch(CException* e){
51 e->Delete();
52 return FALSE;
53 }
54 }else{
55 LONG togo = p-s;
56 ASSERT(togo>0);
57 ASSERT(!(togo%sizeof(theBlock)));
58 memset(data,0,sizeof(*data));
59 data->next=-1;
60 while(togo>=0){
61 try{
62 m_File->Write(data,sizeof(*data));
63 }catch(CException* e){
64 e->Delete();
65 return FALSE;
66 }
67 }
68 }
69 return TRUE;
70 }
71 virtual BOOL _WriteOut(DWORD idx,theBlock* data) {
72 LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
73 LONG s = m_File->Seek(p,CFile::begin);
74 if(p!=s)
75 return FALSE;
76 try{
77 m_File->Write(data,sizeof(*data));
78 }catch(CException* e){
79 e->Delete();
80 return FALSE;
81 }
82 return TRUE;
83 }
84 DWORD AllocateNode() {
85 LONG l = m_File->GetLength();
86 ASSERT(!((l-sizeof(firstBlock))%sizeof(theBlock)));
87 m_File->SetLength(l+sizeof(theBlock));
88 return (l-sizeof(firstBlock))/sizeof(theBlock);
89 }
90 BOOL Read1stBlock(firstBlock* fb) {
91 m_File->SeekToBegin();
92 UINT rb = m_File->Read(fb,sizeof(*fb));
93 if(rb==sizeof(*fb))
94 return TRUE;
95 if(rb)
96 return FALSE;
97 memset(fb,0,sizeof(*fb));
98 fb->freeFile = -1;
99 try{
100 m_File->Write(fb,sizeof(*fb));
101 }catch(CException* e){
102 e->Delete();
103 return FALSE;
104 }
105 return TRUE;
106 }
107 BOOL Write1stBlock(firstBlock* fb) {
108 m_File->SeekToBegin();
109 try{
110 m_File->Write(fb,sizeof(*fb));
111 }catch(CException* e){
112 e->Delete();
113 return FALSE;
114 }
115 return TRUE;
116 }
117 };
118public:
119 class CDynaFile : public CFile{
120 public:
121 CDynamide<fbSize,bSize>* m_Daddy;
122 CArray<LONG,LONG> m_Blocks;
123 LONG m_Position;
124
125 CDynaFile(CDynamide<fbSize,bSize>* daddy) : m_Daddy(NULL) { AttachToDaddy(daddy); }
126 virtual ~CDynaFile() { Close(); DetachFromDaddy(); }
127
128 void AttachToDaddy(CDynamide<fbSize,bSize>* daddy) {
129 ASSERT(!m_Daddy);
130 ASSERT(daddy);
131 m_Daddy=daddy;
132 m_Daddy->AttachDynaFile(this);
133 }
134 void DetachFromDaddy() {
135 ASSERT(m_Daddy);
136 ASSERT(!IsOpened());
137 m_Daddy->DetachDynaFile(this);
138 m_Daddy=NULL;
139 }
140
141 BOOL Create() {
142 if(IsOpened())
143 return FALSE;
144 m_Blocks.SetAtGrow(0,m_Daddy->Allocate());
145 ASSERT(m_Blocks[0]>=0);
146 m_Position=0;
147 return TRUE;
148 }
149 BOOL Open(LONG fb) {
150 if(IsOpened())
151 return FALSE;
152 ASSERT(fb>=0);
153 theBlock* b;
154 do{
155 m_Blocks.Add(fb);
156 b = m_Daddy->m_File->GetCached(fb);
157 ASSERT(b);
158 fb=b->next;
159 if(m_Blocks[m_Blocks.GetUpperBound()]==fb)
160 return FALSE;
161 }while(fb>=0);
162 m_Position=0;
163 return TRUE;
164 }
165
166 LONG GetFile() {
167 if(!IsOpened())
168 return -1;
169 return m_Blocks[0];
170 }
171 virtual DWORD GetPosition() const {
172 if(!IsOpened())
173 return 0;
174 if(m_Position<0)
175 return 0;
176 if(m_Position>GetLength())
177 return GetLength();
178 return m_Position;
179 }
180 virtual CString GetFileName() {
181 CString rv;
182 if(IsOpened())
183 rv.Format("0x%08lX",m_Blocks[0]);
184 else
185 rv.Format("None");
186 return rv;
187 }
188 virtual CString GetFileTitle() { return GetFileName(); }
189 virtual CString GetFilePath() { return GetFileName(); }
190 virtual void SetFilePath(LPCTSTR lpszNewName) { ASSERT(FALSE); }
191
192 virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL) { ASSERT(FALSE); return FALSE; }
193 virtual CFile* Duplicate() { ASSERT(FALSE); return NULL; }
194
195 virtual LONG Seek(LONG lOff, UINT nFrom) {
196 if(!IsOpened())
197 return -1;
198 switch(nFrom){
199 case CFile::begin:
200 m_Position=lOff;
201 break;
202 case CFile::current:
203 m_Position+=lOff;
204 break;
205 case CFile::end:
206 m_Position=GetLength()+lOff;
207 break;
208 default:
209 ASSERT(FALSE);
210 return -1;
211 }
212 if(m_Position<0)
213 m_Position=0;
214 if(m_Position>GetLength())
215 m_Position=GetLength();
216 return m_Position;
217 }
218 virtual void SetLength(DWORD dwNewLen) {
219 if(!IsOpened())
220 return;
221 if(dwNewLen<GetLength()){
222 dwNewLen=dwNewLen+sizeof(TheBlock.data);
223 dwNewLen-=dwNewLen%sizeof(TheBlock.data);
224 while(dwNewLen<GetLength() && m_Blocks.GetSize()>1){
225 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
226 LONG mb1 = m_Blocks[m_Blocks.GetUpperBound()-1];
227 theBlock* b = m_Daddy->m_File->GetCached(mb1);
228 ASSERT(b);
229 ASSERT(b->next==mb);
230 b->next=-1;
231 m_Daddy->m_File->MakeDirty(mb1);
232 m_Daddy->Deallocate(mb);
233 m_Blocks.SetSize(m_Blocks.GetSize()-1);
234 }
235 }else{
236 while(dwNewLen>GetLength()){
237 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
238 LONG newBlock = m_Daddy->Allocate();
239 ASSERT(newBlock>=0);
240 theBlock* b = m_Daddy->m_File->GetCached(mb);
241 ASSERT(b);
242 ASSERT(b->next<0);
243 b->next=newBlock;
244 m_Daddy->m_File->MakeDirty(mb);
245 m_Blocks.Add(newBlock);
246 }
247 }
248 }
249 virtual DWORD GetLength() const {
250 return ((long)m_Blocks.GetSize())*((long)sizeof(TheBlock.data));
251 }
252
253 virtual UINT Read(void* lpBuf, UINT nCount) {
254 UINT rv = 0;
255 ASSERT(m_Position>=0 && m_Position<=GetLength());
256 LPBYTE data = (LPBYTE)lpBuf;
257 while(nCount && m_Position<GetLength()){
258 UINT bn = m_Position/sizeof(TheBlock.data);
259 UINT bo = m_Position%sizeof(TheBlock.data);
260 theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
261 ASSERT(b);
262 UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
263 memmove(data,&b->data[bo],bc);
264 nCount-=bc;
265 data=&data[bc];
266 rv+=bc;
267 m_Position+=bc;
268 }
269 return rv;
270 }
271 virtual void Write(const void* lpBuf, UINT nCount) {
272 ASSERT(m_Position>=0 && m_Position<=GetLength());
273 LPBYTE data = (LPBYTE)lpBuf;
274 while(nCount){
275 UINT bn = m_Position/sizeof(TheBlock.data);
276 UINT bo = m_Position%sizeof(TheBlock.data);
277 while(bn>=m_Blocks.GetSize()){
278 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
279 LONG newBlock = m_Daddy->Allocate();
280 ASSERT(newBlock>=0);
281 theBlock* b = m_Daddy->m_File->GetCached(mb);
282 ASSERT(b);
283 ASSERT(b->next<0);
284 b->next=newBlock;
285 m_Daddy->m_File->MakeDirty(mb);
286 m_Blocks.Add(newBlock);
287 }
288 theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
289 ASSERT(b);
290 UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
291 memmove(&b->data[bo],data,bc);
292 m_Daddy->m_File->MakeDirty(m_Blocks[bn]);
293 nCount-=bc;
294 data=&data[bc];
295 m_Position+=bc;
296 }
297 }
298
299 virtual void LockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
300 virtual void UnlockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
301
302 virtual void Abort() { ASSERT(FALSE); }
303 virtual void Flush() {
304 m_Daddy->m_File->Flush();
305 }
306 virtual void Close() {
307 m_Blocks.RemoveAll();
308 }
309
310 BOOL IsOpened() const { return m_Blocks.GetSize()!=0; }
311 };
312
313 CDynaCache* m_File;
314 firstBlock m_FB;
315
316 CDynamide() : m_File(NULL) {}
317 ~CDynamide() { Close(); }
318
319 BOOL AttachDynaFile(CDynaFile* f) {
320 //ASSERT(!m_Files.Find(f));
321 //m_Files.AddHead(f);
322 return TRUE;
323 }
324 BOOL DetachDynaFile(CDynaFile* f) {
325 //POSITION p = m_Files.Find(f);
326 //ASSERT(p);
327 //m_Files.RemoveAt(p);
328 return TRUE;
329 }
330
331 BOOL Open(LPCTSTR file,BOOL bRO=FALSE) {
332 Close();
333 try{
334 CFile* f = new CFile(file,CFile::typeBinary|(bRO?CFile::modeRead|CFile::shareDenyWrite:CFile::modeReadWrite|CFile::shareDenyRead));
335 return Attach(f,TRUE);
336 }catch(CException* e){
337 e->Delete();
338 return FALSE;
339 }
340 }
341 BOOL Create(LPCTSTR file) {
342 Close();
343 try{
344 CFile* f = new CFile(file,CFile::typeBinary|CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead);
345 return Attach(f,TRUE);
346 }catch(CException* e){
347 e->Delete();
348 return FALSE;
349 }
350 }
351 BOOL Attach(CFile* file,BOOL bAutodelete=TRUE) {
352 if(IsOpened())
353 return FALSE;
354 m_File = new CDynaCache(file,bAutodelete);
355 if(!m_File->Read1stBlock(&m_FB)){
356 memset(&m_FB,0,sizeof(m_FB));
357 m_FB.freeFile=-1;
358 VERIFY(m_File->Write1stBlock(&m_FB));
359 }
360 return IsOpened();
361 }
362 // CFile* Detach();
363 BOOL Close() {
364 if(!IsOpened())
365 return FALSE;
366 m_File->Write1stBlock(&m_FB);
367 delete m_File;
368 m_File=NULL;
369 return TRUE;
370 }
371 BOOL IsOpened() {
372 return m_File != NULL;
373 }
374 BOOL Write1stBlock(void) {
375 if(!IsOpened())
376 return FALSE;
377 VERIFY(m_File->Write1stBlock(&m_FB));
378 return TRUE;
379 }
380
381 CDynaFile* CreateFile() {
382 CDynaFile* rv = new CDynaFile(this);
383 if(rv->Create())
384 return rv;
385 delete rv;
386 return NULL;
387 }
388 CDynaFile* OpenFile(LONG fb) {
389 CDynaFile* rv = new CDynaFile(this);
390 if(rv->Open(fb))
391 return rv;
392 delete rv;
393 return NULL;
394 }
395 BOOL DeleteFile(LONG fb) {
396 while(fb>=0){
397 theBlock* b = m_File->GetCached(fb);
398 LONG nb = b->next;
399 Deallocate(fb);
400 fb=nb;
401 }
402 return TRUE;
403 }
404
405 LONG Allocate() {
406 if(!IsOpened())
407 return -1;
408 if(m_FB.freeFile<0){
409 LONG rv = m_File->AllocateNode();
410 theBlock *b = m_File->GetCached(rv);
411 b->next=-1;
412 m_File->MakeDirty(rv);
413 return rv;
414 }
415 LONG rv = m_FB.freeFile;
416 theBlock *b = m_File->GetCached(rv);
417 m_FB.freeFile=b->next;
418 b->next=-1;
419 m_File->MakeDirty(rv);
420 m_File->Write1stBlock(&m_FB);
421 return rv;
422 }
423 BOOL Deallocate(LONG bk) {
424 if(!IsOpened())
425 return FALSE;
426 theBlock* b = m_File->GetCached(bk);
427 ASSERT(b);
428 if(m_FB.freeFile<0){
429 b->next=-1;
430 m_FB.freeFile=bk;
431 }else{
432 b->next=m_FB.freeFile;
433 m_FB.freeFile=bk;
434 }
435 m_File->MakeDirty(bk);
436 m_File->Write1stBlock(&m_FB);
437 return TRUE;
438 }
439};
440
441};
442
443#endif // __DYNAMIDE_H
diff --git a/shared-code/FindIFace.h b/shared-code/FindIFace.h
new file mode 100644
index 0000000..8dec8c4
--- a/dev/null
+++ b/shared-code/FindIFace.h
@@ -0,0 +1,125 @@
1 #ifndef__FINDIFACE_H
2 #define__FINDIFACE_H
3
4#include "SNMPeer.h"
5#include "SNMPExtDLL.h"
6#include "SNMPOIDs.h"
7
8namespace Klever {
9
10inline BOOL FindIFace(in_addr& target,in_addr& source)
11{
12 DEFINE_OID(ipRouteDest, OIDipRouteDest);
13 DEFINE_OID(ipRouteMask, OIDipRouteMask);
14 DEFINE_OID(ipRouteIfIndex,OIDipRouteIfIndex);
15 DEFINE_OID(ipRouteMetric1,OIDipRouteMetric1);
16 DEFINE_OID(ipAdEntIfIndex,OIDipAdEntIfIndex);
17 DEFINE_OID(ipAdEntAddr, OIDipAdEntAddr);
18 struct _route{
19 int iface;
20 int metric;
21 DWORD nm;
22 }routes[16];
23int nRoutes = 0;
24CSNMPVarBindList vbl;
25 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteDest,sizeof(ipRouteDest))));
26 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMask,sizeof(ipRouteMask))));
27 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteIfIndex,sizeof(ipRouteIfIndex))));
28 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMetric1,sizeof(ipRouteMetric1))));
29CSNMPExtDLL snmp("INETMIB1");
30 while(nRoutes<(sizeof(routes)/sizeof(routes[0]))){
31 if(
32 snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
33 && vbl.GetCount() == 4
34 ){
35 POSITION p = vbl.GetHeadPosition();
36 _route r = {-1,-1};
37 in_addr d, m;
38 BOOL bD = FALSE, bM = FALSE;
39 while(p){
40 CSNMPVarBind& vb = vbl.GetNext(p);
41 if(
42 vb.IsName(ipRouteDest,sizeof(ipRouteDest))
43 && vb.value.type==CASNAny::typeASNIP
44 ){
45 d.s_addr=vb.value.value.ip.s_addr; bD = TRUE;
46 }else if(
47 vb.IsName(ipRouteMask,sizeof(ipRouteMask))
48 && vb.value.type==CASNAny::typeASNIP
49 ){
50 m.s_addr=vb.value.value.ip.s_addr; bM = TRUE;
51 }else if(
52 vb.IsName(ipRouteIfIndex,sizeof(ipRouteIfIndex))
53 && vb.value.type==CASNAny::typeASNInteger
54 ){
55 r.iface=vb.value.value.number;
56 }else if(
57 vb.IsName(ipRouteMetric1,sizeof(ipRouteMetric1))
58 && vb.value.type==CASNAny::typeASNInteger
59 ){
60 r.metric=vb.value.value.number;
61 }else
62 break;
63 }
64 if(r.iface<0 || r.metric<0 || (!bD) || (!bM))
65 break;
66 if((target.s_addr&m.s_addr)==(d.s_addr&m.s_addr)){
67 r.nm=htonl(m.s_addr);
68 memmove(&routes[nRoutes++],&r,sizeof(routes[0]));
69 }
70 }else
71 break;
72 }
73 if(!nRoutes)
74 return FALSE;
75int rn = 0;
76 if(nRoutes>1){
77 for(int tmp=1;tmp<nRoutes;tmp++)
78 if(
79 routes[tmp].metric<routes[rn].metric
80 || routes[tmp].nm>routes[rn].nm
81 )
82 rn = tmp;
83 }
84int iface = routes[rn].iface;
85 vbl.RemoveAll();
86 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntAddr,sizeof(ipAdEntAddr))));
87 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntIfIndex,sizeof(ipAdEntIfIndex))));
88 for(;;){
89 if(
90 snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
91 && vbl.GetCount()==2
92 ){
93 in_addr a; a.s_addr = INADDR_NONE;
94 int ifn = -1;
95 POSITION p = vbl.GetHeadPosition();
96 while(p){
97 CSNMPVarBind& vb = vbl.GetNext(p);
98 if(
99 vb.IsName(ipAdEntAddr,sizeof(ipAdEntAddr))
100 && vb.value.type==CASNAny::typeASNIP
101 ){
102 a.s_addr=vb.value.value.ip.s_addr;
103 }else if(
104 vb.IsName(ipAdEntIfIndex,sizeof(ipAdEntIfIndex))
105 && vb.value.type==CASNAny::typeASNInteger
106 ){
107 ifn = vb.value.value.number;
108 }else
109 break;
110 }
111 if(ifn<0)
112 break;
113 if(ifn==iface){
114 source.s_addr=a.s_addr;
115 return TRUE;
116 }
117 }else
118 break;
119 }
120 return FALSE;
121}
122
123};
124
125 #endif// __FINDIFACE_H
diff --git a/shared-code/LRUCache.h b/shared-code/LRUCache.h
new file mode 100644
index 0000000..569e829
--- a/dev/null
+++ b/shared-code/LRUCache.h
@@ -0,0 +1,113 @@
1 #ifndef__LRUCACHE_H
2 #define__LRUCACHE_H
3
4namespace Klever {
5
6template<class IDX,class ARGIDX,class DATA>
7class CLRUCache : public CObject {
8public:
9 struct CacheEntry{
10 enum cacheState{
11 cacheClean, cacheDirty, cacheEmpty
12 };
13 cacheStatem_State;
14 UINT m_hits;
15
16 IDX m_idx;
17 DATA* m_pData;
18
19 CacheEntry() { m_State=cacheEmpty; VERIFY(m_pData=new DATA); m_hits=0; }
20 virtual ~CacheEntry() { delete m_pData; }
21 };
22 typedef CMap<IDX,ARGIDX,CacheEntry*,CacheEntry*> CCacheMap;
23 typedef CList<CacheEntry*,CacheEntry*> CCacheList;
24
25 CCacheList m_Cache;
26 CCacheMap m_Map;
27
28 CLRUCache(UINT cacheSize){
29 for(int tmp=0;tmp<cacheSize;tmp++){
30 CacheEntry* p = new CacheEntry;
31 m_Cache.AddTail(p);
32 }
33 }
34 virtual ~CLRUCache(){
35 Flush();
36 POSITION p = m_Cache.GetHeadPosition();
37 while(p){
38 CacheEntry* c = m_Cache.GetNext(p);
39 delete c;
40 }
41 }
42
43 DATA* GetCached(ARGIDX idx,BOOL bLoad=TRUE) {
44 CacheEntry* rv;
45 if(m_Map.Lookup(idx,rv)){
46 rv->m_hits++;
47 PopUp(rv);
48 return rv->m_pData;
49 }
50 if(!bLoad)
51 return NULL;
52 rv = m_Cache.GetTail();
53 ASSERT(rv);
54 switch(rv->m_State){
55 case CacheEntry::cacheDirty:
56 FlushEntry(rv);
57 case CacheEntry::cacheClean:
58 m_Map.RemoveKey(rv->m_idx);
59 rv->m_State=CacheEntry::cacheEmpty;
60 case CacheEntry::cacheEmpty:
61 break;
62 default:
63 ASSERT(FALSE);
64 }
65 if(!_ReadIn(idx,rv->m_pData))
66 return NULL;
67 rv->m_hits=1;
68 rv->m_State=CacheEntry::cacheClean;
69 rv->m_idx=idx;
70 m_Map[idx]=rv;
71 PopUp(rv);
72 return rv->m_pData;
73 }
74 BOOL MakeDirty(ARGIDX idx) {
75 CacheEntry* pEntry;
76 if(m_Map.Lookup(idx,pEntry)){
77 ASSERT(pEntry->m_State==CacheEntry::cacheClean || pEntry->m_State==CacheEntry::cacheDirty);
78 pEntry->m_State=CacheEntry::cacheDirty;
79 return TRUE;
80 }
81 return FALSE;
82 }
83 BOOL Flush() {
84 POSITION p = m_Cache.GetHeadPosition();
85 while(p){
86 CacheEntry* pEntry = m_Cache.GetNext(p);
87 ASSERT(pEntry);
88 FlushEntry(pEntry);
89 }
90 return TRUE;
91 }
92 BOOL FlushEntry(CacheEntry* pEntry) {
93 if(pEntry->m_State==CacheEntry::cacheDirty){
94 BOOL rv = _WriteOut(pEntry->m_idx,pEntry->m_pData);
95 if(rv)
96 pEntry->m_State=CacheEntry::cacheClean;
97 }
98 return FALSE;
99 }
100 void PopUp(CacheEntry* pEntry) {
101 POSITION p = m_Cache.Find(pEntry);
102 ASSERT(p);
103 m_Cache.RemoveAt(p);
104 VERIFY(m_Cache.AddHead(pEntry));
105 }
106
107 virtualBOOL _ReadIn(ARGIDX idx,DATA* data) = 0;
108 virtual BOOL _WriteOut(ARGIDX idx,DATA* data) = 0;
109};
110
111};
112
113 #endif// __LRUCACHE_H
diff --git a/shared-code/RegEx.cpp b/shared-code/RegEx.cpp
new file mode 100644
index 0000000..b7bab62
--- a/dev/null
+++ b/shared-code/RegEx.cpp
@@ -0,0 +1,1697 @@
1#include "../stdafx.h"
2#include "RegEx.h"
3
4 #defineisWordableChar(c) (isalnum(c) || (c)=='_')
5
6BOOL CRegEx::Compile(LPCTSTR regex,int flags)
7{
8 ASSERT(!((flags&regExtended) && (flags&regLiteral)));
9 m_Matches.RemoveAll();
10 m_Strip.RemoveAll();
11 m_Strip.SetSize(0,15);
12 m_Pattern=regex;
13 m_ParsePointer=0;
14 m_Error=0;
15 m_Sets.RemoveAll();
16 m_Flags=flags;
17 m_iFlags=0;
18 m_BOLs=m_EOLs=0;
19 m_Subexps = 0;
20 m_Categories=1;// 0 is 'everything else'
21 m_bBackRefs=FALSE;
22 memset(m_Category,0,sizeof(m_Category));
23
24 // Go ahead.
25 m_Error || m_Strip.Add(CSop(CSop::opEnd));
26 if(flags&regExtended){
27 ParseERE();
28 }else if(flags&regLiteral){
29 ParseLiteral();
30 }else{
31 ParseBRE();
32 }
33 m_Error || m_Strip.Add(CSop(CSop::opEnd));
34 Categorize();
35 m_Strip.FreeExtra();
36 FigureMust();
37 m_Pluses=CountPluses();
38 if(m_iFlags&iflagsBad){
39 m_Error || (m_Error=regeAssert);
40 // ??? point to nuls? ;-)
41 }
42 // We may wish to free some memory here if we're erroneous (ie. m_Error..)
43 m_ParseParens.RemoveAll();
44#ifdef _DEBUG
45 if(m_Error){
46 CString tmp;
47 tmp.Format("RE: ParseError: %d\n",m_Error);
48 TRACE0(tmp);
49 }
50 //DumpStrip(afxDump);
51#endif
52 return (m_bCompiled=(!m_Error));
53}
54
55BOOL CRegEx::Match(LPCTSTR src,int flags)
56{
57 if(!m_bCompiled)
58 return FALSE;
59 if(m_iFlags&iflagsBad)
60 return FALSE;
61 m_Input=src;
62 m_mFlags=flags;
63 m_mPointer=m_Input;
64 m_mBegin=m_Input;
65 m_mEnd=&m_mBegin[m_Input.GetLength()];
66 ASSERT(m_mPointer<=m_mEnd);
67 m_Matches.RemoveAll();
68 if(!m_Must.IsEmpty()){
69 if(m_Input.Find(m_Must)<0)
70 return FALSE;
71 }
72 // Go ahead..
73int stripLen = m_Strip.GetSize();
74 m_mLastPos.SetSize(0);
75 for(int tmp=0;tmp<stripLen;tmp++)
76 m_Strip[tmp].m_MatchData=0;
77LPCTSTR beginp = m_mBegin;
78LPCTSTR endp;
79 for(;;){
80 endp = MatchFast(beginp);
81 if(!endp)
82 return FALSE;
83 if((m_mFlags&regNoSubExpressions) && !m_bBackRefs)
84 break;
85 ASSERT(m_cOldP);
86 for(;;){
87 endp = MatchSlow(m_cOldP,m_mEnd,1,stripLen-1);
88 if(endp)
89 break;
90 ASSERT(m_cOldP<m_mEnd);
91 m_cOldP++;
92 }
93 if((m_mFlags&regOneMatch) && !m_bBackRefs)
94 break;
95 // Oh, his, we want the subexpression..
96 m_Matches.SetSize(m_Subexps+1);
97 LPCTSTR dp;
98 if(!m_bBackRefs && !(m_mFlags&regBackRefs)){
99 dp = MatchDissect(m_cOldP,endp,1,stripLen-1);
100 }else{
101 if(m_Pluses>0 && !m_mLastPos.GetSize())
102 m_mLastPos.SetSize(m_Pluses);
103 dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
104 }
105 if(dp)
106 break;
107 // Uh.. oh.. we couldn't find a subexpression-level match
108 ASSERT(m_bBackRefs);
109 ASSERT(m_Pluses==0 || m_mLastPos.GetSize());
110 for(;;){
111 if(dp || endp <= m_cOldP)
112 break;// defeat.. ?
113 endp = MatchSlow(m_cOldP,endp-1,1,stripLen-1);
114 if(!endp)
115 break;// defeat.. ?
116 // Try it on a shorter possibility..
117#ifdef _DEBUG
118 for(tmp=1;tmp<=m_Subexps;tmp++)
119 ASSERT(m_Matches[tmp].m_Begin<0 && m_Matches[tmp].m_End<0);
120#endif
121 dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
122 }
123 ASSERT((!dp) || dp==endp);
124 if(dp)// Found a shorter one..
125 break;
126 // Despite initial appearances, there is no match here
127 beginp = m_cOldP+1;
128 ASSERT(beginp<=m_mEnd);
129 }
130 // Fill in the detail if so requested..
131 if(!(m_mFlags&regNoSubExpressions)){
132 if(!m_Matches.GetSize())
133 m_Matches.SetSize(1);
134 m_Matches[0].m_Begin=m_cOldP-m_mBegin;
135 m_Matches[0].m_End=endp-m_mBegin;
136 }
137 m_mLastPos.RemoveAll();
138 return TRUE;
139}
140
141CString CRegEx::Replace(LPCTSTR src,LPCTSTR rep,int flags)
142{
143 // ***
144 return CString();
145}
146
147void CRegEx::ParseERE(int stop)
148{
149UCHAR c;
150BOOL first=TRUE;
151int prevF, prevB;
152 for(;;){
153 int co = m_Strip.GetSize();
154 while(m_ParsePointer < m_Pattern.GetLength() && ((c=m_Pattern[m_ParsePointer])!='|') && c!=stop)
155 ParseEREexp();
156 if(m_Strip.GetSize()==co){
157 m_Error || (m_Error=regeEmpty);
158 // ??? point to nuls?
159 }
160 if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='|')
161 break;
162 else
163 m_ParsePointer++;
164 if(first){
165 StripInsert(co,CSop(CSop::opChoice0,m_Strip.GetSize()-co+1));
166 prevF = prevB = co;
167 first=FALSE;
168 }
169 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-prevB));
170 prevB = m_Strip.GetSize()-1;
171 m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
172 prevF = m_Strip.GetSize();
173 m_Error || m_Strip.Add(CSop(CSop::opOr1,0));// offset isn't really right.. very so..
174 }
175 if(!first){
176 m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
177 m_Error || m_Strip.Add(CSop(CSop::opChoice1,m_Strip.GetSize()-prevB));
178 }
179 ASSERT(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]==stop);
180}
181
182void CRegEx::ParseEREexp()
183{
184 ASSERT(m_ParsePointer < m_Pattern.GetLength());
185UCHAR c = m_Pattern[m_ParsePointer++];
186int pos = m_Strip.GetSize();
187int subno;
188int count, count2;
189BOOL wascaret=FALSE;
190 switch(c){
191 case '(':
192 if(!(m_ParsePointer<m_Pattern.GetLength())){
193 TRACE0("RE: '(' at the end of the pattern\n");
194 if(!m_Error)
195 m_Error = regeParen;
196 // ??? point to nuls?
197 }
198 m_Subexps++;
199 subno=m_Subexps;
200 m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
201 m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
202 if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!=')')
203 ParseERE(')');
204 VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
205 m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
206 if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer++]!=')'){
207 TRACE0("RE: No matching ')'\n");
208 if(!m_Error)
209 m_Error = regeParen;
210 // ??? point to nuls?
211 }
212 break;
213 case '^':
214 m_Error || m_Strip.Add(CSop(CSop::opBOL));
215 m_iFlags|=iflagsUseBOL;
216 m_BOLs++;
217 wascaret=TRUE;
218 break;
219 case '$':
220 m_Error || m_Strip.Add(CSop(CSop::opEOL));
221 m_iFlags|=iflagsUseEOL;
222 m_EOLs++;
223 break;
224 case '|':
225 TRACE0("RE: '|' outside of expression\n");
226 if(!m_Error)
227 m_Error = regeEmpty;
228 // ??? point to nuls?
229 break;
230 case '*':
231 case '+':
232 case '?':
233 TRACE0("RE: '*'/'+'/'?' with no previous expression\n");
234 if(!m_Error)
235 m_Error = regeBadRepeat;
236 // ??? point to nuls?
237 break;
238 case '.':
239 if(m_Flags&regNewLine)
240 EmitNonNewLineAny();
241 else
242 m_Error || m_Strip.Add(CSop(CSop::opAny));
243 break;
244 case '[':
245 ParseBracket();
246 break;
247 case '\\':
248 if(m_ParsePointer >= m_Pattern.GetLength()){
249 TRACE0("RE: '\\' at the end of the pattern\n");
250 if(!m_Error)
251 m_Error = regeEscape;
252 // ??? point to nuls?
253 }else{
254 c = m_Pattern[m_ParsePointer++];
255 EmitOrdinary(c);
256 }
257 break;
258 case '{':
259 if(m_ParsePointer >= m_Pattern.GetLength() || !isdigit(m_Pattern[m_ParsePointer])){
260 TRACE0("RE: '{' with no repeat count\n");
261 if(!m_Error)
262 m_Error = regeBadRepeat;
263 // ??? point to nuls?
264 }
265 // Fallthrough..
266 default:
267 EmitOrdinary(c);
268 break;
269 }
270 if(m_ParsePointer >= m_Pattern.GetLength())
271 return;
272 c = m_Pattern[m_ParsePointer];
273 // Call a '{' repetition if followed by a digit
274 if (!(c=='*' || c=='+' || c=='?' || ( c=='{' && (m_ParsePointer+1) < m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1])) ))
275 return; // No repetitor - done.
276 m_ParsePointer++;
277 if(wascaret){
278 TRACE0("RE: repetitive '^' detected\n");
279 if(!m_Error)
280 m_Error = regeBadRepeat;
281 // ??? point to nuls?
282 }
283 switch(c){
284 case '*':// Implemeted as +?
285 // + expression
286 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
287 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
288 // ? expression
289 StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
290 m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
291 break;
292 case '+':
293 // + expression
294 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
295 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
296 break;
297 case '?':
298 // Kludge - emit y? as (y|) until subtle bug gets fixed :-)
299 StripInsert(pos,CSop(CSop::opChoice0,m_Strip.GetSize()-pos+1));
300 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
301 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
302 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
303 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
304 break;
305 case '{':
306 count = ParseCount();
307 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
308 m_ParsePointer++;
309 if(isdigit(m_Pattern[m_ParsePointer])){ // HHH Personally, I doubt it is always available
310 count2=ParseCount();
311 if(!(count<=count2)){
312 TRACE0("RE: Disbalanced counts in '{}' repeater\n");
313 m_Error || (m_Error=regeBadBrace);
314 // ??? point to nuls?
315 }
316 }else // Single number with comma
317 count2=256; // Infinity
318 }else // Single number
319 count2=count;
320 EmitRepeat(pos,count,count2);
321 if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='}'){
322 // No '}'..
323 TRACE0("RE: No immediately following '}' of '{' expression\n");
324 while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!='}')
325 m_ParsePointer++;
326 if(m_ParsePointer >= m_Pattern.GetLength()){
327 TRACE0("RE: No closing '}' found\n");
328 m_Error || (m_Error=regeBrace);
329 }else
330 m_Error || (m_Error=regeBadBrace);
331 // ??? point to nuls?
332 }else
333 m_ParsePointer++;
334 break;
335 }
336 if(m_ParsePointer >= m_Pattern.GetLength())
337 return;
338 c = m_Pattern[m_ParsePointer];
339 if(!(c=='*' || c=='+' || c=='?' || (c=='{' && (m_ParsePointer+1)<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1]))))
340 return;
341 TRACE0("RE: Double repeater\n");
342 m_Error || (m_Error=regeBadRepeat);
343 // ??? point to nuls?
344}
345
346void CRegEx::StripInsert(int pos,CSop& sop)
347{
348 if(m_Error)
349 return;
350int sn = m_Strip.GetSize();
351 m_Strip.InsertAt(pos,sop);
352 for(int tmp=1;tmp<m_ParseParens.GetSize();tmp++){
353 if(m_ParseParens[tmp].m_Begin>=pos)
354 m_ParseParens[tmp].m_Begin++;
355 if(m_ParseParens[tmp].m_End>=pos)
356 m_ParseParens[tmp].m_End++;
357 }
358}
359
360void CRegEx::EmitOrdinary(UCHAR c)
361{
362 if(m_Flags&regIgnoreCase && isalpha(c) && (tolower(c) !=toupper(c))){
363 // Emit both cases
364 CString savePattern = m_Pattern;
365 int savePointer = m_ParsePointer;
366 m_Pattern=c;
367 m_Pattern+=']';
368 m_ParsePointer=0;
369 ParseBracket();
370 m_Pattern=savePattern;
371 m_ParsePointer=savePointer;
372 }else{
373 m_Error || m_Strip.Add(CSop(CSop::opChar,c));
374 if(!m_Category[(BYTE)c])
375 m_Category[(BYTE)c]=m_Categories++;
376 }
377}
378
379void CRegEx::EmitNonNewLineAny()
380{
381 // Kludges're going on and on..
382CString savePattern = m_Pattern;
383int savePointer = m_ParsePointer;
384 m_Pattern="^\n]";
385 m_ParsePointer=0;
386 ParseBracket();
387 m_Pattern=savePattern;
388 m_ParsePointer=savePointer;
389}
390
391int CRegEx::ParseCount()
392{
393BOOL nonEmpty=FALSE;
394int rv = 0;
395UCHAR c;
396 while(m_ParsePointer < m_Pattern.GetLength() && isdigit(c=m_Pattern[m_ParsePointer]) && rv <=255){
397 rv = rv*10 + c-'0';
398 nonEmpty=TRUE;
399 m_ParsePointer++;
400 }
401 if(rv>255 || !nonEmpty){
402 m_Error || (m_Error=regeBadBrace);
403 // ??? point to nuls?
404 }
405 return rv;
406}
407
408void CRegEx::ParseBracket()
409{
410 // Dept. of truly sickening special case kludges
411 if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:<]]")){
412 m_Error || m_Strip.Add(CSop(CSop::opBOW));
413 m_ParsePointer+=6;
414 return;
415 }
416 if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:>]]")){
417 m_Error || m_Strip.Add(CSop(CSop::opEOW));
418 m_ParsePointer+=6;
419 return;
420 }
421BOOL invert=TRUE;
422 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^')
423 m_ParsePointer++;
424 else
425 invert=FALSE;
426CSet cset;
427 if(m_ParsePointer < m_Pattern.GetLength()){
428 switch(m_Pattern[m_ParsePointer]){
429 case ']':
430 case '-':
431 cset.Add(m_Pattern[m_ParsePointer]);
432 m_ParsePointer++;
433 break;
434 }
435 }
436 while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!=']' && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("-]")))
437 ParseBracketTerm(cset);
438 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
439 m_ParsePointer++;
440 cset.Add('-');
441 }
442 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==']')
443 m_ParsePointer++;
444 else{
445 m_Error || (m_Error=regeBracket);
446 // ??? point to nuls?
447 return;
448 }
449 if(m_Flags&regIgnoreCase){
450 for(int tmp=CSet::size-1;tmp>=0;tmp--){
451 if(cset.IsIn(tmp) && isalpha(tmp) && (toupper(tmp)!=tolower(tmp)))
452 cset.Add(isupper(tmp)?tolower(tmp):toupper(tmp));
453 }
454 /*
455 if(!cset->m_Multis.IsEmpty())
456 cset.CollatingCase();
457 */
458 }
459 if(invert){
460 for(int tmp=CSet::size-1;tmp>=0;tmp--)
461 if(cset.IsIn(tmp))
462 cset.Sub(tmp);
463 else
464 cset.Add(tmp);
465 if(m_Flags&regNewLine)
466 cset.Sub('\n');
467 /*
468 if(!cset.m_Multis.IsEmpty())
469 cset.CollatingInvert();
470 */
471 }
472UCHAR c = cset.GetOnly();
473 if(c){
474 EmitOrdinary(c);
475 }else
476 m_Error || m_Strip.Add(CSop(CSop::opAnyOf,StoreSet(cset)));
477}
478
479void CRegEx::CSet::Add(UCHAR c)
480{
481 m_Set[(BYTE)c]=TRUE;
482 m_Hash+=c;
483}
484
485BOOL CRegEx::CSet::IsIn(UCHAR c)
486{
487 return m_Set[(BYTE)c];
488}
489
490void CRegEx::CSet::Sub(UCHAR c)
491{
492 m_Set[(BYTE)c]=FALSE;
493 m_Hash-=c;
494}
495
496UCHAR CRegEx::CSet::GetOnly()
497{
498int rv = 0;
499UCHAR only = 0;
500 for(int tmp=0;tmp<size;tmp++){
501 rv+=m_Set[tmp]?(only=tmp,1):0;
502 }
503 return (rv==1)?only:0;
504}
505
506int CRegEx::StoreSet(CSet& cset)
507{
508 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
509 if(m_Sets[tmp]==cset)
510 return tmp;
511 return m_Sets.Add(cset);
512}
513
514void CRegEx::ParseBracketTerm(CSet& cset)
515{
516UCHAR c;
517 switch((m_ParsePointer<m_Pattern.GetLength())?m_Pattern[m_ParsePointer]:0){
518 case '[':
519 c = ((m_ParsePointer+1)<m_Pattern.GetLength())?m_Pattern[m_ParsePointer+1]:0;
520 break;
521 case '-':
522 m_Error || (m_Error=regeRange);
523 // ??? point to nuls?
524 return;
525 default:
526 c = 0;
527 break;
528 }
529 switch(c){
530 case ':':// Character class
531 m_ParsePointer+=2;
532 if(m_ParsePointer>=m_Pattern.GetLength()){
533 m_Error || (m_Error=regeBracket);
534 // ??? point to nuls?
535 }
536 c = m_Pattern[m_ParsePointer];
537 if(c== '-' || c==']'){
538 m_Error || (m_Error=regeCType);
539 // ??? point to nuls?
540 }
541 ParseBracketCClass(cset);
542 if(m_ParsePointer>=m_Pattern.GetLength()){
543 m_Error || (m_Error=regeBracket);
544 // ??? point to nuls?
545 }
546 if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare(":]"))){
547 m_Error || (m_Error=regeCType);
548 // ??? point to nuls?
549 }else
550 m_ParsePointer+=2;
551 break;
552 case '=':// Equivalence class
553 m_ParsePointer+=2;
554 if(m_ParsePointer >= m_Pattern.GetLength()){
555 m_Error || (m_Error=regeBracket);
556 // ??? point to nuls?
557 }
558 c = m_Pattern[m_ParsePointer];
559 if(c== '-' || c==']'){
560 m_Error || (m_Error=regeCollate);
561 // ??? point to nuls?
562 }
563 ParseBracketEClass(cset);
564 if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare("=]"))){
565 m_Error || (m_Error=regeCollate);
566 // ??? point to nuls?
567 }else
568 m_ParsePointer+=2;
569 break;
570 default:// Symbol, character or range
571 {
572 UCHAR start, finish;
573 start = ParseBracketSymbol();
574 if((m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-') /*&& (m_ParsePointer+1)<m_Pattern.GetLength() && m_Pattern[m_ParsePointer+1]==']'*/){
575 // I believe the expression above is seetwo..
576 // range.
577 m_ParsePointer++;
578 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
579 m_ParsePointer++;
580 finish='-';
581 }else
582 finish=ParseBracketSymbol();
583 }else
584 finish=start;
585 if(((BYTE)start)>((BYTE)finish)){
586 m_Error || (m_Error=regeRange);
587 // ??? point to nuls?
588 }
589 for(int tmp=start;tmp<=(BYTE)finish;tmp++)
590 cset.Add(tmp);
591 }
592 break;
593 }
594}
595
596void CRegEx::ParseBracketCClass(CSet& cset)
597{
598 static struct{
599 char *className;
600 char *classChars;
601 }cc[] = {
602 {"alnum","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
603 {"alpha","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},
604 {"blank"," \t"},
605 {"cntrl","\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177"},
606 {"digit","0123456789"},
607 {"graph","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
608 {"lower","abcdefghijklmnopqrstuvwxyz"},
609 {"print","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ "},
610 {"punct","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
611 {"space","\t\n\v\f\r "},
612 {"upper","ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
613 {"xdigit","0123456789ABCDEFabcdef"}
614};
615CString cclass;
616UCHAR c;
617 while(m_ParsePointer < m_Pattern.GetLength() && isalpha(c=m_Pattern[m_ParsePointer])){
618 cclass+=c;
619 m_ParsePointer++;
620 }
621char *classChars = NULL;
622 for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++){
623 if(!cclass.CompareNoCase(cc[tmp].className)){
624 classChars=cc[tmp].classChars;
625 break;
626 }
627 }
628 if(!classChars){
629 m_Error || (m_Error=regeCType);
630 // ??? point to nuls?
631 return;
632 }
633 while(*classChars)
634 cset.Add(*(classChars++));
635 // --- multis
636}
637
638void CRegEx::ParseBracketEClass(CSet& cset)
639{
640 cset.Add(ParseBracketCollatingElement('='));;
641}
642
643UCHAR CRegEx::ParseBracketCollatingElement(UCHAR term)
644{
645 static struct{
646 char *entityName;
647 char entity;
648 }cc[] = { {"NUL",'\0'},{"SOH",'\001'},{"STX",'\002'},{"ETX",'\003'},{"EOT",'\004'},{"ENQ",'\005'},{"ACK",'\006'},{"BEL",'\007'},{"alert",'\007'},{"BS",'\010'},{"backspace",'\b'},{"HT",'\011'},{"tab",'\t'},{"LF",'\012'},{"newline",'\n'},{"VT",'\013'},{"vertical-tab",'\v'},{"FF",'\014'},{"form-feed",'\f'},{"CR",'\015'},{"carriage-return",'\r'},{"SO",'\016'},{"SI",'\017'},{"DLE",'\020'},{"DC1",'\021'},{"DC2",'\022'},{"DC3",'\023'},{"DC4",'\024'},{"NAK",'\025'},{"SYN",'\026'},{"ETB",'\027'},{"CAN",'\030'},{"EM",'\031'},{"SUB",'\032'},{"ESC",'\033'},{"IS4",'\034'},{"FS",'\034'},{"IS3",'\035'},{"GS",'\035'},{"IS2",'\036'},{"RS",'\036'},{"IS1",'\037'},{"US",'\037'},{"space",' '},{"exclamation-mark",'!'},{"quotation-mark",'"'},{"number-sign",'#'},{"dollar-sign",'$'},{"percent-sign",'%'},{"ampersand",'&'},{"apostrophe",'\''},{"left-parenthesis",'('},{"right-parenthesis",')'},{"asterisk",'*'},{"plus-sign",'+'},{"comma",','},{"hyphen",'-'},{"hyphen-minus",'-'},{"period",'.'},{"full-stop",'.'},{"slash",'/'},{"solidus",'/'},{"zero",'0'},{"one",'1'},{"two",'2'},{"three",'3'},{"four",'4'},{"five",'5'},{"six",'6'},{"seven",'7'},{"eight",'8'},{"nine",'9'},{"colon",':'},{"semicolon",';'},{"less-than-sign",'<'},{"equals-sign",'='},{"greater-than-sign",'>'},{"question-mark",'?'},{"commercial-at",'@'},{"left-square-bracket",'['},{"backslash",'\\'},{"reverse-solidus",'\\'},{"right-square-bracket",']'},{"circumflex",'^'},{"circumflex-accent",'^'},{"underscore",'_'},{"low-line",'_'},{"grave-accent",'`'},{"left-brace",'{'},{"left-curly-bracket",'{'},{"vertical-line",'|'},{"right-brace",'}'},{"right-curly-bracket",'}'},{"tilde",'~'},{"DEL",'\177'} };
649CString seeTwo;
650 seeTwo=term;
651 seeTwo+=']';
652CString entityName;
653 while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(seeTwo)))
654 entityName+=m_Pattern[m_ParsePointer++];
655 if(m_ParsePointer>=m_Pattern.GetLength()){
656 m_Error || (m_Error=regeBracket);
657 // ??? point to nuls?
658 return 0;
659 }
660 for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++)
661 if(!entityName.CompareNoCase(cc[tmp].entityName))
662 return cc[tmp].entity;
663 if(entityName.GetLength()==1)
664 return entityName[0];
665 m_Error || (m_Error=regeCollate);
666 // ??? point to nuls?
667 return 0;
668}
669
670UCHAR CRegEx::ParseBracketSymbol()
671{
672 if(m_ParsePointer>=m_Pattern.GetLength()){
673 m_Error || (m_Error=regeBracket);
674 // ??? point to nuls?
675 }
676 if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
677 m_ParsePointer+=2;
678 else
679 return m_Pattern[m_ParsePointer++];
680 // Collating symbol
681UCHAR rv = ParseBracketCollatingElement('.');
682 if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
683 m_ParsePointer+=2;
684 else{
685 m_Error || (m_Error=regeCollate);
686 // ??? point to nuls?
687 }
688 return rv;
689}
690
691void CRegEx::EmitRepeat(int pos,int from,int to)
692{
693 if(m_Error)
694 return;
695 ASSERT(from<=to);
696int finish = m_Strip.GetSize();
697int copy;
698 #defineN 2
699#define INF 3
700#define REP(f,t) ((f)*8+(t))
701#define MAP(n) (((n)<=1)?(n):((n)==256)?INF:N)
702 switch(REP(MAP(from),MAP(to))){
703 case REP(0,0):// must be user doing ths??
704 m_Strip.SetSize(pos);
705 break;
706 case REP(0,1):// as in '?'
707 case REP(0,N):// as in '{1,n}?'
708 case REP(0,INF):// as in '{1,}?'
709 // Kludge - emit y? as (y|) until something gets fixed..
710 StripInsert(pos,CSop(CSop::opChoice0,pos));
711 EmitRepeat(pos+1,1,to);
712 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
713 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
714 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
715 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
716 break;
717 case REP(1,1):
718 break;
719 case REP(1,N):// as in 'x?x{1,n-1}'
720 // Kludge again..
721 StripInsert(pos,CSop(CSop::opChoice0,pos));
722 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
723 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
724 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
725 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
726 copy = StripDuplicate(pos+1,finish+1);
727 ASSERT(copy==(finish+4));
728 EmitRepeat(copy,1,to-1);
729 break;
730 case REP(1,INF): // as in '+'
731 StripInsert(pos,CSop(CSop::opPlus0,pos));
732 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
733 break;
734 case REP(N,N):// as in 'xx{from-1,to-1}'
735 copy = StripDuplicate(pos,finish);
736 EmitRepeat(copy,from-1,to-1);
737 break;
738 case REP(N,INF): // as in 'xx{n-1,}'
739 copy = StripDuplicate(pos,finish);
740 EmitRepeat(copy,from-1,to);
741 break;
742#ifndef NDEBUG
743 default:
744 ASSERT(FALSE);
745 break;
746#endif
747 }
748#undef MAP
749#undef REP
750#undef INF
751#undef N
752}
753
754int CRegEx::StripDuplicate(int from,int to)
755{
756int rv = m_Strip.GetSize();
757 ASSERT(from<=to);
758 if(from==to)
759 return rv;
760 // Maybe should be optimized for copying the whole thing.
761 for(int tmp=from;tmp<to;tmp++)
762 m_Strip.Add(m_Strip[tmp]);
763 return rv;
764}
765
766void CRegEx::Categorize()
767{
768 if(m_Error)
769 return;
770 for(int tmp=0;tmp<(sizeof(m_Category)/sizeof(m_Category[0]));tmp++)
771 if((!m_Category[tmp]) && IsInSets(tmp)){
772 int cat = m_Categories++;
773 m_Category[tmp]=cat;
774 for(int c=tmp+1;c<(sizeof(m_Category)/sizeof(m_Category[0]));c++)
775 if((!m_Category[c]) && IsInSameSets(tmp,c))
776 m_Category[c]=cat;
777 }
778}
779
780BOOL CRegEx::IsInSets(UCHAR c)
781{
782 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
783 if(m_Sets[tmp].IsIn(c))
784 return TRUE;
785 return FALSE;
786}
787
788BOOL CRegEx::IsInSameSets(UCHAR c1,UCHAR c2)
789{
790 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
791 if(m_Sets[tmp].IsIn(c1)!=m_Sets[tmp].IsIn(c2))
792 return FALSE;
793 return TRUE;
794}
795
796void CRegEx::FigureMust()
797{
798 if(m_Error)
799 return;
800 m_Must.Empty();
801int stripLen = m_Strip.GetSize();
802int seqStart, seqLength = 0;
803int mustStart, mustLength = 0;
804 for(int tmp=1;tmp<stripLen;tmp++){
805 switch(m_Strip[tmp].m_Operator){
806 case CSop::opChar:
807 if(!seqLength)
808 seqStart=tmp;
809 seqLength++;
810 break;
811 case CSop::opPlus0:
812 case CSop::opLeftParen:
813 case CSop::opRightParen:
814 break;// Break, since they don't break the sequence
815 case CSop::opQuest0:
816 case CSop::opChoice0:
817 // These ones we skip.
818 do{
819 tmp+=m_Strip[tmp].m_Operand;
820 // I still think it could be ASSERTed..
821 if(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1 && m_Strip[tmp].m_Operator!=CSop::opOr1){
822 m_iFlags|=iflagsBad;
823 return;
824 }
825 }while(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1);
826 // Fallthrough..
827 default:
828 // End of sequence
829 if(seqLength>mustLength){
830 mustStart=seqStart;
831 mustLength=seqLength;
832 }
833 seqLength=0;
834 break;
835 }
836 }// Hmm.. originally it's meant to be do while not opEnd..
837 if(!mustLength)
838 return;
839 // Turn into string, but, wait, personally I'm sure it could be put in the main loop.. or maybe not..
840 for(tmp=0;tmp<seqLength;tmp++){
841 while(m_Strip[seqStart+tmp].m_Operator!=CSop::opChar)
842 ASSERT(tmp<seqLength);
843 m_Must+=m_Strip[tmp].m_Operand;
844 }
845}
846
847int CRegEx::CountPluses()
848{
849 if(m_Error)
850 return 0;
851int stripLen = m_Strip.GetSize();
852int rv = 0;
853int nest = 0;
854 for(int tmp=0;tmp<stripLen;tmp++){
855 switch(m_Strip[tmp].m_Operator){
856 case CSop::opPlus0:
857 nest++;
858 break;
859 case CSop::opPlus1:
860 if(nest>rv)
861 rv = nest;
862 nest--;
863 break;
864 }
865 }// Again, originally we were supposed to scan till opEnd..
866 if(nest)
867 m_iFlags|=iflagsBad;// Could this be an ASSERTion?
868 return rv;
869}
870
871void CRegEx::ParseLiteral()
872{
873 if(!m_Pattern.GetLength()){
874 m_Error || (m_Error=regeEmpty);
875 // ??? point to nuls?
876 }
877 while(m_ParsePointer < m_Pattern.GetLength())
878 EmitOrdinary(m_Pattern[m_ParsePointer++]);
879}
880
881void CRegEx::ParseBRE(int stopa,int stopb)
882{
883int start = m_Strip.GetSize();
884BOOL first=TRUE;
885BOOL wasDollar=FALSE;
886 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^'){
887 m_ParsePointer++;
888 m_Error || m_Strip.Add(CSop(CSop::opBOL,0));
889 m_iFlags|=iflagsUseBOL;
890 m_BOLs++;
891 }
892CString stopstr;
893 if(stopa){
894 stopstr+=stopa;
895 if(stopb)
896 stopstr+=stopb;
897 }
898 while(m_ParsePointer < m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(stopstr))){
899 wasDollar = ParseBREexp(first);
900 first=FALSE;
901 }
902 if(wasDollar){// Trailing anchor that was..
903 m_Strip.SetSize(m_Strip.GetSize()-1);
904 m_Error || m_Strip.Add(CSop(CSop::opEOL,0));
905 m_iFlags|=iflagsUseEOL;
906 m_EOLs++;
907 }
908 if(m_Strip.GetSize()==start){
909 m_Error || (m_Error=regeEmpty);
910 // ??? point to nuls?
911 }
912}
913
914BOOL CRegEx::ParseBREexp(BOOL ordinaryStar)
915{
916int subno;
917int pos = m_Strip.GetSize();
918 ASSERT(m_ParsePointer<m_Pattern.GetLength());
919int c = m_Pattern[m_ParsePointer++];
920 if(c=='\\'){
921 if(m_ParsePointer>=m_Pattern.GetLength()){
922 m_Error || (m_Error=regeEscape);
923 // ??? point to nuls
924 }else
925 c = 0x100|m_Pattern[m_ParsePointer++];
926 }
927 switch(c){
928 case '.':
929 if(m_Flags&regNewLine)
930 EmitNonNewLineAny();
931 else
932 m_Error || m_Strip.Add(CSop(CSop::opAny,0));
933 break;
934 case '[':
935 ParseBracket();
936 break;
937 case 0x100|'{':
938 m_Error || (m_Error=regeBadRepeat);
939 // ??? point to nuls?
940 break;
941 case 0x100|'(':
942 m_Subexps++;
943 subno=m_Subexps;
944 m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
945 m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
946 if(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)")))
947 ParseBRE('\\',')');
948 VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
949 m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
950 if((m_ParsePointer+1) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)"))
951 m_ParsePointer+=2;
952 else{
953 m_Error || (m_Error=regeParen);
954 // ??? point to nuls?
955 }
956 break;
957 case 0x100|')':
958 case 0x100|'}':
959 // Can this possibly happen?!
960 m_Error || (m_Error=regeParen);
961 // ??? point to nuls?
962 break;
963 case 0x100|'1':
964 case 0x100|'2':
965 case 0x100|'3':
966 case 0x100|'4':
967 case 0x100|'5':
968 case 0x100|'6':
969 case 0x100|'7':
970 case 0x100|'8':
971 case 0x100|'9':
972 {
973 int i = (c&0xFF)-'0';
974 if(i < m_ParseParens.GetSize() && m_ParseParens[i].m_End){
975 m_Error || m_Strip.Add(CSop(CSop::opBackRef0,i));
976 ASSERT(m_ParseParens[i].m_Begin);
977 ASSERT(m_Strip[m_ParseParens[i].m_Begin].m_Operator==CSop::opLeftParen);
978 ASSERT(m_Strip[m_ParseParens[i].m_End].m_Operator==CSop::opRightParen);
979 StripDuplicate(m_ParseParens[i].m_Begin+1,m_ParseParens[i].m_End);
980 m_Error || m_Strip.Add(CSop(CSop::opBackRef1,i));
981 }else{
982 m_Error || (m_Error=regeSubReg);
983 // ??? point to nuls?
984 }
985 m_bBackRefs=TRUE;
986 }
987 break;
988 case '*':
989 if(!ordinaryStar){
990 m_Error || (m_Error=regeBadRepeat);
991 // ??? point to nuls?
992 }
993 // Fallthrough..
994 default:
995 EmitOrdinary(c&0xFF);
996 break;
997 }
998 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='*'){
999 m_ParsePointer++;
1000 // as in '+?'
1001 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
1002 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
1003 StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
1004 m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
1005 }else if ((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\{")){
1006 m_ParsePointer+=2;
1007 int count = ParseCount();
1008 int count2;
1009 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
1010 m_ParsePointer++;
1011 if(m_ParsePointer<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer])){
1012 count2=ParseCount();
1013 if(count>count2){
1014 m_Error || (m_Error=regeBadBrace);
1015 // ??? poin to nuls?
1016 }
1017 }else // Single number with comma
1018 count2=256;
1019 }else // Single number
1020 count2=count;
1021 EmitRepeat(pos,count,count2);
1022 if((m_ParsePointer+1)>=m_Pattern.GetLength() || m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")){
1023 while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")))
1024 m_ParsePointer++;
1025 if(m_ParsePointer>=m_Pattern.GetLength()){
1026 m_Error || (m_Error=regeBrace);
1027 // ??? point to nuls?
1028 }
1029 m_Error || (m_Error=regeBadBrace);
1030 }else
1031 m_ParsePointer+=2;
1032 }else if(c=='$')
1033 return TRUE;
1034 return FALSE;
1035}
1036
1037CRegEx::CRegEx()
1038{
1039 m_bCompiled=FALSE;
1040}
1041
1042LPCTSTR CRegEx::MatchFast(LPCTSTR begin)
1043{
1044 MatchStatesClear(CSop::stCurrent);
1045 m_Strip[1].m_MatchData|=CSop::stCurrent;
1046int stripLen = m_Strip.GetSize();
1047 MatchStep(1,stripLen-1,CSop::stCurrent,charNothing,CSop::stCurrent);
1048 MatchStatesCopy(CSop::stFresh,CSop::stCurrent);
1049LPCTSTR coldp = NULL;
1050LPCTSTR p = begin;
1051int c = (begin==m_mBegin)?charOut:((int)(BYTE)m_mPointer[-1]);
1052 for(;;){
1053 // next character..
1054 int lastc = c;
1055 c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
1056 if(MatchStatesEqual(CSop::stCurrent,CSop::stFresh))
1057 coldp=p;
1058 // Is there an EOL and/or BOL between lastc and c? - they ask..
1059 intflagc=0;
1060 inti = 0;
1061 if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
1062 flagc=charBOL;
1063 i=m_BOLs;
1064 }
1065 if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
1066 flagc=(flagc==charBOL)?charBOLEOL:charEOL;
1067 i+=m_EOLs;
1068 }
1069 if(i){
1070 for(;i>0;i--)
1071 MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
1072 }
1073 // What about a word boundary? - they wonder..
1074 if((flagc==charBOL || (lastc!=charOut && !isWordableChar(c))) && (c!=charOut && isWordableChar(c)))
1075 flagc = charBOW;
1076 if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
1077 flagc = charEOW;
1078 if(flagc==charBOW || flagc==charEOW){
1079 MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
1080 }
1081 // Are we done? Now WE wonder..
1082 if((m_Strip[stripLen-1].m_MatchData&CSop::stCurrent) || p==m_mEnd)
1083 break;// They insist I need to note break out.. Okay, I do..
1084 // Nope, we're not done. We have to face this character..
1085 MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
1086 MatchStatesCopy(CSop::stCurrent,CSop::stFresh);
1087 ASSERT(c!=charOut);
1088 MatchStep(1,stripLen-1,CSop::stTemp,c,CSop::stCurrent);
1089 p++;
1090 }
1091 ASSERT(coldp);
1092 m_cOldP=coldp;// *** I believe this variable can be changed 'in-place'
1093 if(m_Strip[stripLen-1].m_MatchData&CSop::stCurrent)
1094 return &p[1];
1095 else
1096 return NULL;
1097}
1098
1099void CRegEx::MatchStatesClear(BYTE mask)
1100{
1101int stripLen = m_Strip.GetSize();
1102 for(int tmp=0;tmp<stripLen;tmp++)
1103 m_Strip[tmp].m_MatchData&=~mask;
1104}
1105
1106void CRegEx::MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter)
1107{
1108BOOL i;
1109int look;
1110int here = from;
1111 for(int pc=from;pc!=to;pc++,here++){
1112 CSop s=m_Strip[pc];
1113 switch(s.m_Operator){
1114 case CSop::opEnd:
1115 ASSERT(pc==(to-1));
1116 break;
1117 case CSop::opChar:
1118 // Only characters can match..
1119 ASSERT((charCode<charOut) || charCode!=s.m_Operand);
1120 if(charCode==s.m_Operand)
1121 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1122 break;
1123 case CSop::opBOL:
1124 if(charCode==charBOL || charCode==charBOLEOL)
1125 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1126 break;
1127 case CSop::opEOL:
1128 if(charCode==charEOL || charCode==charBOLEOL)
1129 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1130 break;
1131 case CSop::opBOW:
1132 if(charCode==charBOW)
1133 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1134 break;
1135 case CSop::opEOW:
1136 if(charCode==charEOW)
1137 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1138 break;
1139 case CSop::opAny:
1140 if(charCode<charOut)
1141 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1142 break;
1143 case CSop::opAnyOf:
1144 if(charCode<charOut && m_Sets[s.m_Operand].m_Set[charCode])
1145 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1146 break;
1147 case CSop::opBackRef0:// Ignored here..
1148 case CSop::opBackRef1:
1149 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1150 break;
1151 case CSop::opPlus0:
1152 // Forward, this is just an empty, comment says..
1153 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1154 break;
1155 case CSop::opPlus1:
1156 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1157 i =(m_Strip[here-s.m_Operand].m_MatchData&maskAfter)!=0;
1158 m_Strip[here-s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1159 if(!i && (m_Strip[here-s.m_Operand].m_MatchData&maskAfter)){
1160 // oho, must reconsider loop body, comment says.. what's so 'oho' about it?
1161 pc-=s.m_Operand+1;
1162 here=pc;
1163 }
1164 break;
1165 case CSop::opQuest0:
1166 // two branches, both forward..
1167 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1168 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1169 break;
1170 case CSop::opQuest1:
1171 // just an empty.. aren't we tired of justanempties?
1172 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1173 break;
1174 case CSop::opLeftParen: // they say it's not significan there..
1175 case CSop::opRightParen:
1176 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1177 break;
1178 case CSop::opChoice0:// mark the first two branches..
1179 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1180 ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
1181 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1182 break;
1183 case CSop::opOr0:// done a branch, find the end of choice..
1184 if(m_Strip[here].m_MatchData&maskAfter){
1185 for(look=1;(s=m_Strip[pc+look]).m_Operator!=CSop::opChoice1;look+=s.m_Operand)
1186 ASSERT(s.m_Operator==CSop::opOr1);
1187 m_Strip[here+look].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1188 }
1189 break;
1190 case CSop::opOr1: // Propagate Choice's marking..
1191 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1192 if(m_Strip[pc+s.m_Operand].m_Operator!=CSop::opChoice1){
1193 ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
1194 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1195 }
1196 break;
1197 case CSop::opChoice1: // Just empty.. :-)..
1198 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1199 break;
1200#ifdef _DEBUG
1201 default:
1202 ASSERT(FALSE);
1203 break;
1204#endif
1205 }
1206 }
1207}
1208
1209void CRegEx::MatchStatesCopy(BYTE dst,BYTE src)
1210{
1211int stripLen = m_Strip.GetSize();
1212 for(int tmp=0;tmp<stripLen;tmp++){
1213 // I believe this can be optimized, easily..
1214 m_Strip[tmp].m_MatchData&=~dst;
1215 m_Strip[tmp].m_MatchData|=(m_Strip[tmp].m_MatchData&src)?dst:0;
1216 }
1217}
1218
1219BOOL CRegEx::MatchStatesEqual(BYTE m1,BYTE m2)
1220{
1221int stripLen = m_Strip.GetSize();
1222 for(int tmp=0;tmp<stripLen;tmp++){
1223 BYTE mm = m_Strip[tmp].m_MatchData;
1224 if(((mm&m1) && (mm&m2)) || !(mm&(m1|m2)))
1225 continue;
1226 return FALSE;
1227 }
1228 return TRUE;
1229}
1230
1231LPCTSTR CRegEx::MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to)
1232{
1233 MatchStatesClear(CSop::stCurrent);
1234 m_Strip[from].m_MatchData|=CSop::stCurrent;
1235 MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
1236LPCTSTR mp = NULL;
1237int c = (m_mBegin==m_mPointer)?charOut:(int)(BYTE)begin[-1];
1238LPCTSTR p = begin;
1239 for(;;){
1240 // next character..
1241 int lastc = c;
1242 c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
1243 // Now we start to wonder if there is an EOL and/or BOL between lastc and c
1244 int flagc = 0;
1245 int i = 0;
1246 if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
1247 flagc = charBOL;
1248 i = m_BOLs;
1249 }
1250 if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
1251 flagc = (flagc==charBOL)?charBOLEOL:charEOL;
1252 i+=m_EOLs;
1253 }
1254 if(i){
1255 for(;i>0;i--)
1256 MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
1257 }
1258 // Now we wonder about word boundaries..
1259 if((flagc==charBOL || (lastc!=charOut && !isWordableChar(lastc))) && (c!=charOut && isWordableChar(c)))
1260 flagc=charBOW;
1261 if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
1262 flagc=charEOW;
1263 if(flagc==charBOW || flagc==charEOW){
1264 MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
1265 }
1266 // Are we done we all wonder??
1267 if(m_Strip[to].m_MatchData&CSop::stCurrent)
1268 mp=p;
1269 if(MatchStatesEqual(CSop::stCurrent,CSop::stEmpty) || p==end)
1270 break;// Again, we're obliged to note break out. We do.
1271 // Sucks.. we have to face this character..
1272 MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
1273 MatchStatesCopy(CSop::stCurrent,CSop::stEmpty);
1274 ASSERT(c!=charOut);
1275 MatchStep(from,to,CSop::stTemp,c,CSop::stCurrent);
1276 MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
1277 p++;
1278 }
1279 return mp;
1280}
1281
1282LPCTSTR CRegEx::MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to)
1283{
1284LPCTSTR sp = begin, dp;
1285LPCTSTR stp, rest, tail, ssp, oldssp, sep;
1286int ssub, esub;
1287int es;
1288int i;
1289 for(int ss=from;ss<to;ss = es){
1290 // Identify end of SubRE
1291 es = ss;
1292 switch(m_Strip[es].m_Operator){
1293 case CSop::opPlus0:
1294 case CSop::opQuest0:
1295 es+=m_Strip[es].m_Operand;
1296 break;
1297 case CSop::opChoice0:
1298 while(m_Strip[es].m_Operator!=CSop::opChoice1)
1299 es+=m_Strip[es].m_Operand;
1300 break;
1301 }
1302 es++;
1303 // Figure out what it matched
1304 switch(m_Strip[ss].m_Operator){
1305 case CSop::opEnd:
1306 ASSERT(FALSE);
1307 break;
1308 case CSop::opChar:
1309 sp++;
1310 break;
1311 case CSop::opBOL:
1312 case CSop::opEOL:
1313 case CSop::opBOW:
1314 case CSop::opEOW:
1315 break;
1316 case CSop::opAny:
1317 case CSop::opAnyOf:
1318 sp++;
1319 break;
1320 case CSop::opBackRef0:
1321 case CSop::opBackRef1:
1322 ASSERT(FALSE);
1323 break;
1324 // Cases where lenght of match is hard to find..
1325 case CSop::opQuest0:
1326 stp=end;
1327 for(;;){
1328 // How long could this one be??
1329 rest = MatchSlow(sp,stp,ss,es);
1330 ASSERT(rest);// It did match.. It should've..
1331 // Could the rest match the rest? (good question)
1332 tail = MatchSlow(rest,end,es,to);
1333 if(tail==end)
1334 break;// yup.
1335 // nope, try a shorter match for this one..
1336 stp=rest-1;
1337 ASSERT(stp>=sp);// It did work.. It should've..
1338 }
1339 ssub=ss+1;
1340 esub=es-1;
1341 // Did innards match?
1342 if(MatchSlow(sp,rest,ssub,esub)){
1343 dp = MatchDissect(sp,rest,ssub,esub);
1344 ASSERT(dp==rest);
1345 }else// nope..
1346 ASSERT(sp==rest);
1347 sp = rest;
1348 break;
1349 case CSop::opPlus0:
1350 stp=end;
1351 for(;;){
1352 // How long could this one be??
1353 rest = MatchSlow(sp,stp,ss,es);
1354 ASSERT(rest);// It did.. It should've..
1355 // Could the rest match the rest?
1356 tail = MatchSlow(rest,end,es,to);
1357 if(tail==end)
1358 break;// yup.
1359 // nope..
1360 stp=rest-1;
1361 ASSERT(stp>=sp);// It should've worked, we believe..
1362 }
1363 ssub=ss+1;
1364 esub=es-1;
1365 ssp=sp;
1366 oldssp=ssp;
1367 for(;;){// Find last match of innards..
1368 sep = MatchSlow(ssp,rest,ssub,esub);
1369 if((!sep) || sep==ssp)
1370 break; // Failed or matched nothin'
1371 oldssp=ssp;
1372 ssp=sep;
1373 }
1374 if(!sep){
1375 // Last successfull..
1376 sep=ssp;
1377 ssp=oldssp;
1378 }
1379 ASSERT(sep=rest);// Must exhaust substring they say..
1380 VERIFY(MatchSlow(ssp,sep,ssub,esub)==rest);// Assert or verify - that is the question..
1381 dp = MatchDissect(ssp,sep,ssub,esub);
1382 ASSERT(dp==sep);
1383 sp=rest;
1384 break;
1385 case CSop::opChoice0:
1386 stp = end;
1387 for(;;){
1388 // how long..
1389 rest = MatchSlow(sp,stp,ss,es);
1390 ASSERT(rest);
1391 // Could it..
1392 tail = MatchSlow(rest,end,es,to);
1393 if(tail==end)
1394 break;// y
1395 // n
1396 stp = rest-1;
1397 ASSERT(stp>=sp);
1398 }
1399 ssub=ss+1;
1400 esub=ss+m_Strip[ss].m_Operand-1;
1401 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1402 for(;;){// Find first matching branch..
1403 if(MatchSlow(sp,rest,ssub,esub)==rest)
1404 break;
1405 // this one missed, try next..
1406 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1407 esub++;
1408 ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
1409 ssub=esub+1;
1410 esub+=m_Strip[esub].m_Operand;
1411 if(m_Strip[esub].m_Operator==CSop::opOr1)
1412 esub--;
1413 else
1414 ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
1415 }
1416 dp = MatchDissect(sp,rest,ssub,esub);
1417 ASSERT(dp==rest);
1418 sp=rest;
1419 break;
1420 case CSop::opPlus1:
1421 case CSop::opQuest1:
1422 case CSop::opOr0:
1423 case CSop::opOr1:
1424 case CSop::opChoice1:
1425 ASSERT(FALSE);
1426 break;
1427 case CSop::opLeftParen:
1428 i = m_Strip[ss].m_Operand;
1429 ASSERT(0<i && i<=m_Subexps);
1430 m_Matches[i].m_Begin=sp-m_mBegin;
1431 break;
1432 case CSop::opRightParen:
1433 i = m_Strip[ss].m_Operand;
1434 ASSERT(0<i && i<=m_Subexps);
1435 m_Matches[i].m_End=sp-m_mBegin;
1436 break;
1437#ifdef _DEBUG
1438 default:// Uh.. oh..
1439 ASSERT(FALSE);
1440 break;
1441#endif
1442 }
1443 }
1444 ASSERT(sp==end);
1445 return sp;
1446}
1447
1448LPCTSTR CRegEx::MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level)
1449{
1450LPCTSTR sp = begin;
1451BOOL hard = FALSE;
1452 // Get as far as we can as long as it's easy
1453 for(int ss=from;!hard && ss<to;ss++){
1454 CSop s = m_Strip[ss];
1455 switch(s.m_Operator){
1456 case CSop::opChar:
1457 if(sp==end || *sp++ != s.m_Operand)
1458 return NULL;
1459 break;
1460 case CSop::opAny:
1461 if(sp==end)
1462 return NULL;
1463 sp++;// I'm sure this ++ could be embedded in previous expression..
1464 break;
1465 case CSop::opAnyOf:
1466 if(sp==end || !m_Sets[s.m_Operand].IsIn(*sp++))
1467 return NULL;
1468 break;
1469 case CSop::opBOL:
1470 if(!((sp==m_mBegin && !(m_mFlags&regNotBOL)) || (sp<m_mEnd && *(sp-1)=='\n' && (m_Flags&regNewLine))))
1471 return NULL;
1472 break;
1473 case CSop::opEOL:
1474 if(!((sp==m_mEnd && !(m_mFlags&regNotEOL)) || (sp<m_mEnd && *sp=='\n' && (m_Flags&regNewLine))))
1475 return NULL;
1476 break;
1477 case CSop::opBOW:
1478 if(!(((sp==m_mBegin && !(m_mFlags&regNotBOL)) || (sp<m_mEnd && *(sp-1)=='\n' && (m_Flags&regNewLine)) || (sp>m_mBegin && !isWordableChar(*(sp-1)))) && (sp<m_mEnd && isWordableChar(*sp))))
1479 return NULL;
1480 break;
1481 case CSop::opEOW:
1482 if(!(((sp==m_mEnd && !(m_mFlags&regNotEOL)) || (sp<m_mEnd && *sp=='\n' && (m_Flags&regNewLine)) || (sp<m_mEnd && !isWordableChar(*sp))) && (sp>m_mBegin && isWordableChar(*(sp-1)))))
1483 return NULL;
1484 break;
1485 case CSop::opQuest1:
1486 break;
1487 case CSop::opOr0:// Matches null, but needs to skip
1488 ss++;
1489 s = m_Strip[ss];
1490 do{
1491 ASSERT(s.m_Operator==CSop::opOr1);
1492 ss+=s.m_Operand;
1493 }while((s=m_Strip[ss]).m_Operator!=CSop::opChoice1);
1494 // Now we should note that ss++ gets us past the Choice1..
1495 break;
1496 default:
1497 // Have to make a choice..
1498 hard=TRUE;
1499 break;
1500 }
1501 }
1502 if(!hard){// That was it..
1503 if(sp!=end)
1504 return NULL;
1505 return sp;
1506 }
1507 ss--;// Adjust for ther for's final increment..
1508 // Hard stuff.. is going on and on..
1509CSop s = m_Strip[ss];
1510int i, len, offsave;
1511int ssub,esub;
1512LPCTSTR ssp, dp;
1513 switch(s.m_Operator){
1514 case CSop::opBackRef0:// The vilest depths they say.. If I only knew what the 'viles' stands for..
1515 i = s.m_Operand;
1516 ASSERT(0<i && i<=m_Subexps);
1517 if(m_Matches[i].m_End<0)
1518 return NULL;
1519 ASSERT(m_Matches[i].m_Begin>=0);
1520 len = m_Matches[i].GetLength();
1521 ASSERT((end-m_mBegin)>=len);
1522 if(sp>end-len)
1523 return NULL;// Not enough left to match..
1524 ssp = m_mBegin+m_Matches[i].m_Begin;
1525 if(memcmp(sp,ssp,len))
1526 return NULL;
1527 while(m_Strip[ss]!=CSop(CSop::opBackRef1,i))
1528 ss++;
1529 return MatchBackRef(sp+len,end,ss+1,to,level-1);
1530 break;
1531 case CSop::opQuest0:// to null or not they wonder..
1532 dp = MatchBackRef(sp,end,ss+1,to,level);
1533 if(dp)
1534 return dp;// not..
1535 return MatchBackRef(sp,end,ss+s.m_Operand+1,to,level-1);
1536 break;
1537 case CSop::opPlus0:
1538 ASSERT(m_mLastPos.GetSize());
1539 ASSERT(level+1 <= m_Pluses);
1540 m_mLastPos[level+1]=sp;
1541 return MatchBackRef(sp,end,ss+1,to,level+1);
1542 break;
1543 case CSop::opPlus1:
1544 if(sp == m_mLastPos[level])// Last pass matched null
1545 return MatchBackRef(sp,end,ss+1,to,level-1);
1546 // Try another pass..
1547 m_mLastPos[level]=sp;
1548 dp = MatchBackRef(sp,end,ss-s.m_Operand+1,to,level);
1549 if(dp)
1550 return dp;
1551 return MatchBackRef(sp,end,ss+1,to,level-1);
1552 break;
1553 case CSop::opChoice0:// find the right one, ifany
1554 ssub = ss+1;
1555 esub = ss+s.m_Operand-1;
1556 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1557 for(;;){// Find first matching branch.
1558 dp = MatchBackRef(sp,end,ssub,esub,level);
1559 if(dp)
1560 return dp;
1561 // This one missed, try next one..
1562 if(m_Strip[esub].m_Operator==CSop::opChoice1)
1563 return NULL;// There is none..
1564 esub++;
1565 ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
1566 ssub=esub+1;
1567 esub+=m_Strip[esub].m_Operand;
1568 if(m_Strip[esub].m_Operator==CSop::opOr1)
1569 esub--;
1570 else
1571 ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
1572 }
1573 break;
1574 case CSop::opLeftParen:// Must undo assignment if rest fails..
1575 i = s.m_Operand;
1576 ASSERT(0<i && i<=m_Subexps);
1577 offsave = m_Matches[i].m_Begin;
1578 m_Matches[i].m_Begin = sp-m_mBegin;
1579 dp = MatchBackRef(sp,end,ss+1,to,level);
1580 if(dp)
1581 return dp;
1582 m_Matches[i].m_Begin=offsave;
1583 return NULL;
1584 break;
1585 case CSop::opRightParen: // Must undo assignment if rest fails..
1586 i = s.m_Operand;
1587 ASSERT(0<i && i<=m_Subexps);
1588 offsave = m_Matches[i].m_End;
1589 m_Matches[i].m_End = sp-m_mBegin;
1590 dp = MatchBackRef(sp,end,ss+1,to,level);
1591 if(dp)
1592 return dp;
1593 m_Matches[i].m_End = offsave;
1594 return NULL;
1595 break;
1596 #ifdef_DEBUG
1597 default:
1598 ASSERT(FALSE);
1599 break;
1600#endif
1601 }
1602 ASSERT(FALSE);
1603 return NULL;// Anyway - we can never get here..
1604}
1605
1606 #ifdef_DEBUG
1607void CRegEx::CSop::Dump(CDumpContext& dc)
1608{
1609 switch(m_Operator){
1610 case opEnd:
1611 dc << "end";
1612 break;
1613 case opChar:
1614 dc << "char('" << (char)m_Operand << "')";
1615 break;
1616 case opBOL:
1617 dc << "BOL";
1618 break;
1619 case opEOL:
1620 dc << "EOL";
1621 break;
1622 case opAny:
1623 dc << "any";
1624 break;
1625 case opAnyOf:
1626 dc << "anyOf(" << m_Operand << ")";
1627 break;
1628 case opBackRef0:
1629 dc << "[ backref(" << m_Operand << ")";
1630 break;
1631 case opBackRef1:
1632 dc << "] backref(" << m_Operand << ")";
1633 break;
1634 case opPlus0:
1635 dc << "[ + (" << m_Operand << ")";
1636 break;
1637 case opPlus1:
1638 dc << "] + (" << m_Operand << ")";
1639 break;
1640 case opQuest0:
1641 dc << "[ ? (" << m_Operand << ")";
1642 break;
1643 case opQuest1:
1644 dc << "] ? (" << m_Operand << ")";
1645 break;
1646 case opLeftParen:
1647 dc << "[ ( (" << m_Operand << ")";
1648 break;
1649 case opRightParen:
1650 dc << "] ) (" << m_Operand << ")";
1651 break;
1652 case opChoice0:
1653 dc << "[ choice (" << m_Operand << ")";
1654 break;
1655 case opOr0:
1656 dc << "[ | (" << m_Operand << ")";
1657 break;
1658 case opOr1:
1659 dc << "] | (" << m_Operand << ")";
1660 break;
1661 case opChoice1:
1662 dc << "] choice (" << m_Operand << ")";
1663 break;
1664 case opBOW:
1665 dc << "BOW";
1666 break;
1667 case opEOW:
1668 dc << "EOW";
1669 break;
1670 }
1671}
1672void CRegEx::DumpStrip(CDumpContext& dc)
1673{
1674 for(int tmp=0;tmp<m_Strip.GetSize();tmp++)
1675 dc << tmp << ": " << m_Strip[tmp] << ";\n";
1676}
1677#endif
1678
1679
1680CString CRegEx::GetMatch(int match)
1681{
1682CString rv;
1683 if(!m_Matches.GetSize())
1684 return rv;
1685 ASSERT(m_Matches[0].m_Begin<m_Input.GetLength() && m_Matches[0].m_End<=m_Input.GetLength());
1686 if(match==matchPreMatch)
1687 return m_Input.Left(m_Matches[0].m_Begin);
1688 if(match==matchPostMatch)
1689 return m_Input.Mid(m_Matches[0].m_End);
1690 if(match<0 || match >= m_Matches.GetSize())
1691 return rv;
1692 if(m_Matches[match].m_Begin<0 || m_Matches[match].m_End<0)
1693 return rv;
1694 ASSERT(m_Matches[match].m_Begin<m_Input.GetLength() && m_Matches[match].m_End<=m_Input.GetLength());
1695 rv = m_Input.Mid(m_Matches[match].m_Begin,m_Matches[match].m_End-m_Matches[match].m_Begin);
1696 return rv;
1697}
diff --git a/shared-code/RegEx.h b/shared-code/RegEx.h
new file mode 100644
index 0000000..2534768
--- a/dev/null
+++ b/shared-code/RegEx.h
@@ -0,0 +1,158 @@
1#ifndef __REGEX_H
2#define __REGEX_H
3
4 class CRegEx{
5public:
6 CString GetMatch(int match=0);
7 CString m_Input;
8 struct CMatch{
9 CMatch() : m_Begin(-1), m_End(-1) {}
10 int GetLength() { return m_End-m_Begin; }
11 int m_Begin;
12 int m_End;
13 };
14 typedefCArray<CMatch,CMatch&> CMatchBox;
15 enum{
16 matchMatch = 0,
17 matchPreMatch = -1,
18 matchPostMatch = -2
19 };
20 CMatchBox m_Matches;
21 enum{
22 charOut = 256,
23 charBOL, charEOL, charBOLEOL, charNothing, charBOW, charEOW,
24 charMaxCode = charEOW,
25 charNNChars = (charMaxCode-255)
26 };
27 int m_mFlags;
28 enum{
29 regeSuccess = 0,
30 regeNoMatch = 1, regeBadPattern, regeCollate, regeCType, regeEscape, regeSubReg, regeBracket,
31 regeParen, regeBrace, regeBadBrace, regeRange, regeSpace, regeBadRepeat, regeEmpty, regeAssert,
32 regeInvArg
33 };
34 int m_Error;
35 CRegEx();
36 BOOL m_bCompiled;
37 CString m_Pattern;
38 BOOL m_bBackRefs;
39 int m_Pluses;
40 CString m_Must;
41 BYTE m_Category[CHAR_MAX-CHAR_MIN+1];
42 int m_Categories;
43 int m_EOLs;
44 int m_BOLs;
45 int m_iFlags;
46 int m_Subexps;
47 struct CSop {
48 void Dump(CDumpContext& dc);
49 CSop(){}
50 CSop(BYTE op,DWORD opnd=0) : m_Operator(op), m_Operand(opnd) {}
51 BOOL operator==(CSop& other) {return m_Operator==other.m_Operator && m_Operand==other.m_Operand;}
52 BOOL operator!=(CSop& other) { return !((*this)==other);}
53 enum{
54 opEnd = 1, opChar, opBOL, opEOL, opAny, opAnyOf, opBackRef0, opBackRef1,
55 opPlus0, opPlus1, opQuest0, opQuest1, opLeftParen, opRightParen, opChoice0,
56 opOr0, opOr1, opChoice1, opBOW, opEOW
57 };
58 BYTE m_Operator;
59 DWORD m_Operand;
60 enum{
61 stCurrent = 1, stFresh = 2, stTemp = 4, stEmpty = 8
62 };
63 BYTE m_MatchData;
64 };
65 typedef CArray<CSop,CSop&> CStrip;
66 CStrip m_Strip;
67 int m_Flags;
68 struct CSet{
69 CSet() : m_Hash(0) { memset(m_Set,0,sizeof(m_Set)); }
70 CSet(CSet& src) { (*this)=src; }
71 CSet& operator=(CSet& src) { memmove(this,&src,sizeof(*this)); return *this; }
72 BOOL operator==(CSet& other) { if(m_Hash!=other.m_Hash)return FALSE;return !memcmp(m_Set,other.m_Set,sizeof(m_Set)); }
73 enum{
74 size = (CHAR_MAX-CHAR_MIN+1)
75 };
76 BOOL m_Set[size];
77 BYTE m_Hash;
78 public:
79 UCHAR GetOnly();
80 void Sub(UCHAR c);
81 BOOL IsIn(UCHAR c);
82 void Add(UCHAR c);
83 };
84 typedef CArray<CSet,CSet&> CSets;
85 CSets m_Sets;
86 enum{
87 // Compile flags
88 regBasic = 0, regExtended = 1,
89 regIgnoreCase = 2,
90 regNoSubExpressions = 4,// Also works for matching.
91 regNewLine = 16,
92 regLiteral = 32,
93 // Match Flags
94 regNotBOL = 1,
95 regNotEOL = 2,
96 regOneMatch=64,
97 regBackRefs=128,
98 // iFlags
99 iflagsUseBOL=1, iflagsUseEOL=2, iflagsBad=4
100 };
101 CString Replace(LPCTSTR src,LPCTSTR rep,int flags=0);
102 BOOL Match(LPCTSTR src,int flags=0);
103 BOOL Compile(LPCTSTR regex,int flags=0);
104private:
105 #ifdef_DEBUG
106 void DumpStrip(CDumpContext& dc);
107#endif
108 LPCTSTR MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level);
109 typedef CArray<LPCTSTR,LPCTSTR> CStrPtrArray;
110 CStrPtrArray m_mLastPos;
111 LPCTSTR MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to);
112 LPCTSTR MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to);
113 LPCTSTR m_cOldP;
114 BOOL MatchStatesEqual(BYTE m1,BYTE m2);
115 LPCTSTR m_mBegin;
116 void MatchStatesCopy(BYTE dst,BYTE src);
117 void MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter);
118 void MatchStatesClear(BYTE mask);
119 LPCTSTR MatchFast(LPCTSTR begin);
120 LPCTSTR m_mEnd;
121 LPCTSTR m_mPointer;
122 BOOL ParseBREexp(BOOL ordinaryStar);
123 void ParseBRE(int stopa=0,int stopb=0);
124 void ParseLiteral();
125 int CountPluses();
126 void FigureMust();
127 BOOL IsInSameSets(UCHAR c1,UCHAR c2);
128 BOOL IsInSets(UCHAR c);
129 void Categorize();
130 int StripDuplicate(int from,int to);
131 void EmitRepeat(int pos,int from,int to);
132 UCHAR ParseBracketSymbol();
133 UCHAR ParseBracketCollatingElement(UCHAR term);
134 void ParseBracketEClass(CSet& cset);
135 void ParseBracketCClass(CSet& cset);
136 void ParseBracketTerm(CSet& cset);
137 int StoreSet(CSet& cset);
138 void ParseBracket();
139 int ParseCount();
140 void EmitNonNewLineAny();
141 void EmitOrdinary(UCHAR c);
142 void StripInsert(int pos,CSop& sop);
143 void ParseEREexp();
144 void ParseERE(int stop=0);
145 struct CParenthesis{
146 long m_Begin;
147 long m_End;
148 CParenthesis(long b=0,long e=0) : m_Begin(b), m_End(e) {}
149 };
150 typedef CArray<CParenthesis,CParenthesis&> CParens;
151 CParens m_ParseParens;
152 int m_ParsePointer;
153};
154 #ifdef_DEBUG
155inline CDumpContext& operator<<(CDumpContext& dc, CRegEx::CSop& sop) { sop.Dump(dc); return dc; }
156#endif
157
158#endif // __REGEX_H \ No newline at end of file
diff --git a/shared-code/SNMPExtDll.h b/shared-code/SNMPExtDll.h
new file mode 100644
index 0000000..14c920d
--- a/dev/null
+++ b/shared-code/SNMPExtDll.h
@@ -0,0 +1,252 @@
1 #ifndef__SNMPEXTDLL_H
2#define __SNMPEXTDLL_H
3
4#include "snmpeer.h"
5
6#include <snmp.h>
7
8namespace Klever {
9
10 class CSNMPExtDLL : public CSNMPeer{
11public:
12 HINSTANCE m_hInstance;
13 HANDLE m_hEvent;
14 AsnObjectIdentifier m_OID;
15 BOOL (SNMP_FUNC_TYPE *m_extInit)(DWORD dw,HANDLE h,AsnObjectIdentifier* aoid);
16 BOOL (SNMP_FUNC_TYPE *m_extQuery)(BYTE b,RFC1157VarBindList* rvbl,AsnInteger* ai1,AsnInteger* ai2);
17 BOOL (SNMP_FUNC_TYPE *m_extTrap)(AsnObjectIdentifier*,AsnNetworkAddress*,AsnInteger*,AsnInteger*,AsnTimeticks*,RFC1157VarBindList*);
18
19 HINSTANCE m_hSNMPAPI;
20 void (SNMP_FUNC_TYPE *m_snmpOIDFree)(AsnObjectIdentifier*);
21 LPVOID (SNMP_FUNC_TYPE *m_snmpAlloc)(UINT);
22 void (SNMP_FUNC_TYPE *m_snmpFree)(LPVOID);
23 void (SNMP_FUNC_TYPE *m_snmpVBLFree)(RFC1157VarBindList* vbl);
24 void InitSNMP() {
25 m_hSNMPAPI = ::LoadLibraryEx("SNMPAPI",NULL,0);
26 if(!m_hSNMPAPI)
27 return;
28 *(FARPROC*)&m_snmpOIDFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilOidFree");
29 *(FARPROC*)&m_snmpAlloc = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemAlloc");
30 *(FARPROC*)&m_snmpFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemFree");
31 *(FARPROC*)&m_snmpVBLFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilVarBindListFree");
32 if(
33 (m_snmpFree && !m_snmpAlloc) ||
34 (m_snmpAlloc && !m_snmpFree)
35 )
36 DeinitSNMP();
37 }
38 void DeinitSNMP() {
39 if(!m_hSNMPAPI)
40 return;
41 ::FreeLibrary(m_hSNMPAPI);
42 m_hSNMPAPI=NULL;
43 }
44 void SNMPFreeOID(AsnObjectIdentifier* oid) {
45 if(m_hSNMPAPI && m_snmpOIDFree)
46 (*m_snmpOIDFree)(oid);
47 else
48 ::GlobalFree((HGLOBAL)oid->ids);
49 }
50 LPVOID SNMPAlloc(UINT size) {
51 if(m_hSNMPAPI && m_snmpAlloc)
52 return (*m_snmpAlloc)(size);
53 else
54 return ::GlobalAlloc(GMEM_FIXED,size);
55 }
56 void SNMPFree(LPVOID addr) {
57 if(m_hSNMPAPI && m_snmpFree)
58 (*m_snmpFree)(addr);
59 else
60 :: GlobalFree((HGLOBAL)addr);
61 }
62 void SNMPFreeVBL(RFC1157VarBindList& vbl) {
63 if(m_hSNMPAPI && m_snmpVBLFree)
64 (*m_snmpVBLFree)(&vbl);
65 else{
66 for(UINT tmp=0;tmp<vbl.len;tmp++) {
67 SNMPFree(vbl.list[tmp].name.ids);
68 switch(vbl.list[tmp].value.asnType){
69 case ASN_OCTETSTRING:
70 case ASN_SEQUENCE:
71 case ASN_RFC1155_IPADDRESS:
72 case ASN_RFC1155_OPAQUE:
73 // case ASN_RFC1213_DISPSTRING:
74 if(vbl.list[tmp].value.asnValue.arbitrary.dynamic)
75 SNMPFree(vbl.list[tmp].value.asnValue.arbitrary.stream);
76 break;
77 case ASN_OBJECTIDENTIFIER:
78 SNMPFree(vbl.list[tmp].value.asnValue.object.ids);
79 break;
80 default:
81 break;
82 }
83 }
84 SNMPFree(vbl.list);
85 }
86 }
87
88 BOOL SNMPBuildVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& in) {
89 vbl.len = in.GetCount();
90 vbl.list = (RFC1157VarBind*)SNMPAlloc(sizeof(RFC1157VarBind)*vbl.len);
91 POSITION p = in.GetHeadPosition();
92 UINT ptr = 0;
93 while(p){
94 CSNMPVarBind& vb = in.GetNext(p);
95 ASSERT(ptr<vbl.len);
96 SNMPBuildVB(vbl.list[ptr++],vb);
97 }
98 return TRUE;
99 }
100 BOOL SNMPBuildVB(RFC1157VarBind& vb,CSNMPVarBind& in) {
101 ASSERT(in.name.type==CASNAny::typeASNOID);
102 return SNMPBuildOID(vb.name,in.name.value.oid) && SNMPBuildAA(vb.value,in.value);
103 }
104 BOOL SNMPBuildAA(AsnAny& aa,CASNAny& in) {
105 aa.asnType=in.type;
106 switch(in.type) {
107 case CASNAny::typeASNInteger:
108 aa.asnValue.number=in.value.number; break;
109 case CASNAny::typeASNOctetString:
110 // case CASNAny::typeASNDispString:
111 SNMPBuildOS(aa.asnValue.string,in.value.string); break;
112 case CASNAny::typeASNNull:
113 break;
114 case CASNAny::typeASNOID:
115 SNMPBuildOID(aa.asnValue.object,in.value.oid); break;
116 case CASNAny::typeASNSequence:
117 // case CASNAny::typeASNSequenceOf:
118 SNMPBuildOS(aa.asnValue.sequence,in.value.sequence); break;
119 case CASNAny::typeASNIP:
120 SNMPBuildFLOS(aa.asnValue.address,(LPBYTE)&in.value.ip,sizeof(in.value.ip)); break;
121 case CASNAny::typeASNCounter:
122 aa.asnValue.counter = in.value.counter; break;
123 case CASNAny::typeASNGauge:
124 aa.asnValue.gauge = in.value.gauge; break;
125 case CASNAny::typeASNTicks:
126 aa.asnValue.ticks = in.value.ticks; break;
127 case CASNAny::typeASNOpaque:
128 ASSERT(in.storeType==CASNAny::storeDynamic);
129 SNMPBuildOS(aa.asnValue.arbitrary,in.value.data); break;
130 break;
131 default:
132 ASSERT(FALSE);
133 return FALSE;
134 }
135 return TRUE;
136 }
137 BOOL SNMPBuildOS(AsnOctetString& os,CASNAny::asnOctetString& in) {
138 return SNMPBuildFLOS(os,in.data,in.size);
139 }
140 BOOL SNMPBuildOID(AsnObjectIdentifier& oid,CASNAny::asnOID& in) {
141 oid.idLength = in.size/sizeof(UINT);
142 ASSERT(!(in.size%sizeof(UINT)));
143 VERIFY(oid.ids = (UINT*)SNMPAlloc(in.size));
144 memmove(oid.ids,in.data,in.size);
145 return TRUE;
146 }
147 BOOL SNMPBuildFLOS(AsnOctetString& os,LPBYTE data,UINT size) {
148 os.length = size;
149 VERIFY(os.stream = (BYTE*)SNMPAlloc(os.length));
150 os.dynamic=TRUE;
151 memmove(os.stream,data,size);
152 return TRUE;
153 }
154 BOOL SNMPParseVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& ou) {
155 for(UINT tmp=0;tmp<vbl.len;tmp++){
156 CSNMPVarBind vb;
157 SNMPParseVB(vbl.list[tmp],vb);
158 ou.AddTail(vb);
159 }
160 return TRUE;
161 }
162 BOOL SNMPParseVB(RFC1157VarBind& vb,CSNMPVarBind& ou) {
163 ou.name.Set(CASNAny::typeASNOID,(LPBYTE)vb.name.ids,vb.name.idLength*sizeof(UINT));
164 return SNMPParseAA(vb.value,ou.value);
165 }
166 BOOL SNMPParseAA(AsnAny& aa,CASNAny& ou) {
167 switch(aa.asnType){
168 case ASN_INTEGER:
169 ou.Set(CASNAny::typeASNInteger,aa.asnValue.number); break;
170 case ASN_OCTETSTRING:
171 // case ASN_RFC1213_DISPSTRING:
172 ou.Set(CASNAny::typeASNOctetString,aa.asnValue.string.stream,aa.asnValue.string.length); break;
173 case ASN_OBJECTIDENTIFIER:
174 ou.Set(CASNAny::typeASNOID,(LPBYTE)aa.asnValue.object.ids,aa.asnValue.object.idLength);
175 SNMPParseOID(aa.asnValue.object,ou.value.oid); break;
176 case ASN_SEQUENCE:
177 ou.Set(CASNAny::typeASNSequence,aa.asnValue.sequence.stream,aa.asnValue.sequence.length); break;
178 case ASN_RFC1155_IPADDRESS:
179 SNMPParseIP(aa.asnValue.address,ou); break;
180 case ASN_RFC1155_COUNTER:
181 ou.Set(CASNAny::typeASNCounter,(LONG)aa.asnValue.counter); break;
182 case ASN_RFC1155_GAUGE:
183 ou.Set(CASNAny::typeASNGauge,(LONG)aa.asnValue.gauge); break;
184 case ASN_RFC1155_TIMETICKS:
185 ou.Set(CASNAny::typeASNTicks,(LONG)aa.asnValue.ticks); break;
186 case ASN_RFC1155_OPAQUE:
187 ou.Set(CASNAny::typeASNOpaque,aa.asnValue.arbitrary.stream,aa.asnValue.arbitrary.length); break;
188 case ASN_NULL:
189 ou.Free(); break;
190 default:
191 ASSERT(FALSE);
192 return FALSE;
193 }
194 return TRUE;
195 }
196 BOOL SNMPParseOID(AsnObjectIdentifier& oid,CASNAny::asnOID& ou) {
197 ASSERT(ou.size==(oid.idLength*sizeof(UINT)));
198 memmove(ou.data,oid.ids,ou.size);
199 return TRUE;
200 }
201 BOOL SNMPParseIP(AsnIPAddress& ip,CASNAny& ou) {
202 in_addr i;
203 if(ip.length>sizeof(i))
204 return FALSE;
205 i.s_addr=0;
206 memmove(&i,ip.stream,ip.length);
207 ou.Set(i);
208 return TRUE;
209 }
210
211
212 CSNMPExtDLL(LPCTSTR dllName) : m_hInstance(NULL) { InitSNMP(); Init(dllName); }
213 ~CSNMPExtDLL() { Deinit(); DeinitSNMP(); }
214
215 BOOL Init(LPCTSTR dllName) {
216 Deinit();
217 m_hInstance = ::LoadLibraryEx(dllName,NULL,0);
218 if(!m_hInstance)
219 return FALSE;
220 *(FARPROC*)&m_extInit = ::GetProcAddress(m_hInstance,"SnmpExtensionInit");
221 *(FARPROC*)&m_extQuery = ::GetProcAddress(m_hInstance,"SnmpExtensionQuery");
222 *(FARPROC*)&m_extTrap = ::GetProcAddress(m_hInstance,"SnmpExtensionTrap");
223 if(!(m_extInit && m_extQuery && m_extTrap)){
224 Deinit();
225 return FALSE;
226 }
227 if(!((*m_extInit)(GetCurrentTime(),&m_hEvent,&m_OID))){
228 Deinit();
229 return FALSE;
230 }
231 return TRUE;
232 }
233 void Deinit() {
234 if(!m_hInstance)
235 return;
236 ::FreeLibrary(m_hInstance);
237 }
238 virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) {
239 RFC1157VarBindList vbl;
240 SNMPBuildVBL(vbl,in);
241 AsnInteger errorStatus, errorIndex;
242 (*m_extQuery)(type,&vbl,&errorStatus,&errorIndex);
243 ou.RemoveAll();
244 SNMPParseVBL(vbl,ou);
245 SNMPFreeVBL(vbl);
246 return TRUE;
247 }
248};
249
250};
251
252 #endif// __SNMPEXTDLL_H
diff --git a/shared-code/SNMPOIDs.h b/shared-code/SNMPOIDs.h
new file mode 100644
index 0000000..68ee659
--- a/dev/null
+++ b/shared-code/SNMPOIDs.h
@@ -0,0 +1,221 @@
1 #ifndef__SNMPOIDS_H
2 #define__SNMPOIDS_H
3
4 #define DEFINE_OID(name,oid)static UINT name[] = oid
5
6 // MIB-II OIDs
7
8#define OIDccitt {0}
9#define OIDnull {0,0}
10#define OIDiso {1}
11#define OIDorg {1,3}
12#define OIDdod {1,3,6}
13#define OIDinternet {1,3,6,1}
14#define OIDdirectory {1,3,6,1,1}
15#define OIDmgmt {1,3,6,1,2}
16#define OIDmib_2 {1,3,6,1,2,1}
17#define OIDsystem {1,3,6,1,2,1,1}
18#define OIDsysDescr {1,3,6,1,2,1,1,1}
19#define OIDsysObjectID {1,3,6,1,2,1,1,2}
20#define OIDsysUpTime {1,3,6,1,2,1,1,3}
21#define OIDsysContact {1,3,6,1,2,1,1,4}
22#define OIDsysName {1,3,6,1,2,1,1,5}
23#define OIDsysLocation {1,3,6,1,2,1,1,6}
24#define OIDsysServices {1,3,6,1,2,1,1,7}
25#define OIDtransmission {1,3,6,1,2,1,10}
26#define OIDsnmp {1,3,6,1,2,1,11}
27#define OIDsnmpInPkts {1,3,6,1,2,1,11,1}
28#define OIDsnmpInBadValues {1,3,6,1,2,1,11,10}
29#define OIDsnmpInReadOnlys {1,3,6,1,2,1,11,11}
30#define OIDsnmpInGenErrs {1,3,6,1,2,1,11,12}
31#define OIDsnmpInTotalReqVars {1,3,6,1,2,1,11,13}
32#define OIDsnmpInTotalSetVars {1,3,6,1,2,1,11,14}
33#define OIDsnmpInGetRequests {1,3,6,1,2,1,11,15}
34#define OIDsnmpInGetNexts {1,3,6,1,2,1,11,16}
35#define OIDsnmpInSetRequests {1,3,6,1,2,1,11,17}
36#define OIDsnmpInGetResponses {1,3,6,1,2,1,11,18}
37#define OIDsnmpInTraps {1,3,6,1,2,1,11,19}
38#define OIDsnmpOutPkts {1,3,6,1,2,1,11,2}
39#define OIDsnmpOutTooBigs {1,3,6,1,2,1,11,20}
40#define OIDsnmpOutNoSuchNames {1,3,6,1,2,1,11,21}
41#define OIDsnmpOutBadValues {1,3,6,1,2,1,11,22}
42#define OIDsnmpOutGenErrs {1,3,6,1,2,1,11,24}
43#define OIDsnmpOutGetRequests {1,3,6,1,2,1,11,25}
44#define OIDsnmpOutGetNexts {1,3,6,1,2,1,11,26}
45#define OIDsnmpOutSetRequests {1,3,6,1,2,1,11,27}
46#define OIDsnmpOutGetResponses {1,3,6,1,2,1,11,28}
47#define OIDsnmpOutTraps {1,3,6,1,2,1,11,29}
48#define OIDsnmpInBadVersions {1,3,6,1,2,1,11,3}
49#define OIDsnmpEnableAuthenTraps {1,3,6,1,2,1,11,30}
50#define OIDsnmpInBadCommunityNames {1,3,6,1,2,1,11,4}
51#define OIDsnmpInBadCommunityUses {1,3,6,1,2,1,11,5}
52#define OIDsnmpInASNParseErrs {1,3,6,1,2,1,11,6}
53#define OIDsnmpInTooBigs {1,3,6,1,2,1,11,8}
54#define OIDsnmpInNoSuchNames {1,3,6,1,2,1,11,9}
55#define OIDinterfaces {1,3,6,1,2,1,2}
56#define OIDifNumber {1,3,6,1,2,1,2,1}
57#define OIDifTable {1,3,6,1,2,1,2,2}
58#define OIDifEntry {1,3,6,1,2,1,2,2,1}
59#define OIDifIndex {1,3,6,1,2,1,2,2,1,1}
60#define OIDifInOctets {1,3,6,1,2,1,2,2,1,10}
61#define OIDifInUcastPkts {1,3,6,1,2,1,2,2,1,11}
62#define OIDifInNUcastPkts {1,3,6,1,2,1,2,2,1,12}
63#define OIDifInDiscards {1,3,6,1,2,1,2,2,1,13}
64#define OIDifInErrors {1,3,6,1,2,1,2,2,1,14}
65#define OIDifInUnknownProtos {1,3,6,1,2,1,2,2,1,15}
66#define OIDifOutOctets {1,3,6,1,2,1,2,2,1,16}
67#define OIDifOutUcastPkts {1,3,6,1,2,1,2,2,1,17}
68#define OIDifOutNUcastPkts {1,3,6,1,2,1,2,2,1,18}
69#define OIDifOutDiscards {1,3,6,1,2,1,2,2,1,19}
70#define OIDifDescr {1,3,6,1,2,1,2,2,1,2}
71#define OIDifOutErrors {1,3,6,1,2,1,2,2,1,20}
72#define OIDifOutQLen {1,3,6,1,2,1,2,2,1,21}
73#define OIDifSpecific {1,3,6,1,2,1,2,2,1,22}
74#define OIDifType {1,3,6,1,2,1,2,2,1,3}
75#define OIDifMtu {1,3,6,1,2,1,2,2,1,4}
76#define OIDifSpeed {1,3,6,1,2,1,2,2,1,5}
77#define OIDifPhysAddress {1,3,6,1,2,1,2,2,1,6}
78#define OIDifAdminStatus {1,3,6,1,2,1,2,2,1,7}
79#define OIDifOperStatus {1,3,6,1,2,1,2,2,1,8}
80#define OIDifLastChange {1,3,6,1,2,1,2,2,1,9}
81#define OIDat {1,3,6,1,2,1,3}
82#define OIDatTable {1,3,6,1,2,1,3,1}
83#define OIDatEntry {1,3,6,1,2,1,3,1,1}
84#define OIDatIfIndex {1,3,6,1,2,1,3,1,1,1}
85#define OIDatPhysAddress {1,3,6,1,2,1,3,1,1,2}
86#define OIDatNetAddress {1,3,6,1,2,1,3,1,1,3}
87#define OIDip {1,3,6,1,2,1,4}
88#define OIDipForwarding {1,3,6,1,2,1,4,1}
89#define OIDipOutRequests {1,3,6,1,2,1,4,10}
90#define OIDipOutDiscards {1,3,6,1,2,1,4,11}
91#define OIDipOutNoRoutes {1,3,6,1,2,1,4,12}
92#define OIDipReasmTimeout {1,3,6,1,2,1,4,13}
93#define OIDipReasmReqds {1,3,6,1,2,1,4,14}
94#define OIDipReasmOKs {1,3,6,1,2,1,4,15}
95#define OIDipReasmFails {1,3,6,1,2,1,4,16}
96#define OIDipFragOKs {1,3,6,1,2,1,4,17}
97#define OIDipFragFails {1,3,6,1,2,1,4,18}
98#define OIDipFragCreates {1,3,6,1,2,1,4,19}
99#define OIDipDefaultTTL {1,3,6,1,2,1,4,2}
100#define OIDipAddrTable {1,3,6,1,2,1,4,20}
101#define OIDipAddrEntry {1,3,6,1,2,1,4,20,1}
102#define OIDipAdEntAddr {1,3,6,1,2,1,4,20,1,1}
103#define OIDipAdEntIfIndex {1,3,6,1,2,1,4,20,1,2}
104#define OIDipAdEntNetMask {1,3,6,1,2,1,4,20,1,3}
105#define OIDipAdEntBcastAddr {1,3,6,1,2,1,4,20,1,4}
106#define OIDipAdEntReasmMaxSize {1,3,6,1,2,1,4,20,1,5}
107#define OIDipRouteTable {1,3,6,1,2,1,4,21}
108#define OIDipRouteEntry {1,3,6,1,2,1,4,21,1}
109#define OIDipRouteDest {1,3,6,1,2,1,4,21,1,1}
110#define OIDipRouteAge {1,3,6,1,2,1,4,21,1,10}
111#define OIDipRouteMask {1,3,6,1,2,1,4,21,1,11}
112#define OIDipRouteMetric5 {1,3,6,1,2,1,4,21,1,12}
113#define OIDipRouteInfo {1,3,6,1,2,1,4,21,1,13}
114#define OIDipRouteIfIndex {1,3,6,1,2,1,4,21,1,2}
115#define OIDipRouteMetric1 {1,3,6,1,2,1,4,21,1,3}
116#define OIDipRouteMetric2 {1,3,6,1,2,1,4,21,1,4}
117#define OIDipRouteMetric3 {1,3,6,1,2,1,4,21,1,5}
118#define OIDipRouteMetric4 {1,3,6,1,2,1,4,21,1,6}
119#define OIDipRouteNextHop {1,3,6,1,2,1,4,21,1,7}
120#define OIDipRouteType {1,3,6,1,2,1,4,21,1,8}
121#define OIDipRouteProto {1,3,6,1,2,1,4,21,1,9}
122#define OIDipNetToMediaTable {1,3,6,1,2,1,4,22}
123#define OIDipNetToMediaEntry {1,3,6,1,2,1,4,22,1}
124#define OIDipNetToMediaIfIndex {1,3,6,1,2,1,4,22,1,1}
125#define OIDipNetToMediaPhysAddress {1,3,6,1,2,1,4,22,1,2}
126#define OIDipNetToMediaNetAddress {1,3,6,1,2,1,4,22,1,3}
127#define OIDipNetToMediaType {1,3,6,1,2,1,4,22,1,4}
128#define OIDipRoutingDiscards {1,3,6,1,2,1,4,23}
129#define OIDipInReceives {1,3,6,1,2,1,4,3}
130#define OIDipInHdrErrors {1,3,6,1,2,1,4,4}
131#define OIDipInAddrErrors {1,3,6,1,2,1,4,5}
132#define OIDipForwDatagrams {1,3,6,1,2,1,4,6}
133#define OIDipInUnknownProtos {1,3,6,1,2,1,4,7}
134#define OIDipInDiscards {1,3,6,1,2,1,4,8}
135#define OIDipInDelivers {1,3,6,1,2,1,4,9}
136#define OIDicmp {1,3,6,1,2,1,5}
137#define OIDicmpInMsgs {1,3,6,1,2,1,5,1}
138#define OIDicmpInTimestamps {1,3,6,1,2,1,5,10}
139#define OIDicmpInTimestampReps {1,3,6,1,2,1,5,11}
140#define OIDicmpInAddrMasks {1,3,6,1,2,1,5,12}
141#define OIDicmpInAddrMaskReps {1,3,6,1,2,1,5,13}
142#define OIDicmpOutMsgs {1,3,6,1,2,1,5,14}
143#define OIDicmpOutErrors {1,3,6,1,2,1,5,15}
144#define OIDicmpOutDestUnreachs {1,3,6,1,2,1,5,16}
145#define OIDicmpOutTimeExcds {1,3,6,1,2,1,5,17}
146#define OIDicmpOutParmProbs {1,3,6,1,2,1,5,18}
147#define OIDicmpOutSrcQuenchs {1,3,6,1,2,1,5,19}
148#define OIDicmpInErrors {1,3,6,1,2,1,5,2}
149#define OIDicmpOutRedirects {1,3,6,1,2,1,5,20}
150#define OIDicmpOutEchos {1,3,6,1,2,1,5,21}
151#define OIDicmpOutEchoReps {1,3,6,1,2,1,5,22}
152#define OIDicmpOutTimestamps {1,3,6,1,2,1,5,23}
153#define OIDicmpOutTimestampReps {1,3,6,1,2,1,5,24}
154#define OIDicmpOutAddrMasks {1,3,6,1,2,1,5,25}
155#define OIDicmpOutAddrMaskReps {1,3,6,1,2,1,5,26}
156#define OIDicmpInDestUnreachs {1,3,6,1,2,1,5,3}
157#define OIDicmpInTimeExcds {1,3,6,1,2,1,5,4}
158#define OIDicmpInParmProbs {1,3,6,1,2,1,5,5}
159#define OIDicmpInSrcQuenchs {1,3,6,1,2,1,5,6}
160#define OIDicmpInRedirects {1,3,6,1,2,1,5,7}
161#define OIDicmpInEchos {1,3,6,1,2,1,5,8}
162#define OIDicmpInEchoReps {1,3,6,1,2,1,5,9}
163#define OIDtcp {1,3,6,1,2,1,6}
164#define OIDtcpRtoAlgorithm {1,3,6,1,2,1,6,1}
165#define OIDtcpInSegs {1,3,6,1,2,1,6,10}
166#define OIDtcpOutSegs {1,3,6,1,2,1,6,11}
167#define OIDtcpRetransSegs {1,3,6,1,2,1,6,12}
168#define OIDtcpConnTable {1,3,6,1,2,1,6,13}
169#define OIDtcpConnEntry {1,3,6,1,2,1,6,13,1}
170#define OIDtcpConnState {1,3,6,1,2,1,6,13,1,1}
171#define OIDtcpConnLocalAddress {1,3,6,1,2,1,6,13,1,2}
172#define OIDtcpConnLocalPort {1,3,6,1,2,1,6,13,1,3}
173#define OIDtcpConnRemAddress {1,3,6,1,2,1,6,13,1,4}
174#define OIDtcpConnRemPort {1,3,6,1,2,1,6,13,1,5}
175#define OIDtcpInErrs {1,3,6,1,2,1,6,14}
176#define OIDtcpOutRsts {1,3,6,1,2,1,6,15}
177#define OIDtcpRtoMin {1,3,6,1,2,1,6,2}
178#define OIDtcpRtoMax {1,3,6,1,2,1,6,3}
179#define OIDtcpMaxConn {1,3,6,1,2,1,6,4}
180#define OIDtcpActiveOpens {1,3,6,1,2,1,6,5}
181#define OIDtcpPassiveOpens {1,3,6,1,2,1,6,6}
182#define OIDtcpAttemptFails {1,3,6,1,2,1,6,7}
183#define OIDtcpEstabResets {1,3,6,1,2,1,6,8}
184#define OIDtcpCurrEstab {1,3,6,1,2,1,6,9}
185#define OIDudp {1,3,6,1,2,1,7}
186#define OIDudpInDatagrams {1,3,6,1,2,1,7,1}
187#define OIDudpNoPorts {1,3,6,1,2,1,7,2}
188#define OIDudpInErrors {1,3,6,1,2,1,7,3}
189#define OIDudpOutDatagrams {1,3,6,1,2,1,7,4}
190#define OIDudpTable {1,3,6,1,2,1,7,5}
191#define OIDudpEntry {1,3,6,1,2,1,7,5,1}
192#define OIDudpLocalAddress {1,3,6,1,2,1,7,5,1,1}
193#define OIDudpLocalPort {1,3,6,1,2,1,7,5,1,2}
194#define OIDegp {1,3,6,1,2,1,8}
195#define OIDegpInMsgs {1,3,6,1,2,1,8,1}
196#define OIDegpInErrors {1,3,6,1,2,1,8,2}
197#define OIDegpOutMsgs {1,3,6,1,2,1,8,3}
198#define OIDegpOutErrors {1,3,6,1,2,1,8,4}
199#define OIDegpNeighTable {1,3,6,1,2,1,8,5}
200#define OIDegpNeighEntry {1,3,6,1,2,1,8,5,1}
201#define OIDegpNeighState {1,3,6,1,2,1,8,5,1,1}
202#define OIDegpNeighStateUps {1,3,6,1,2,1,8,5,1,10}
203#define OIDegpNeighStateDowns {1,3,6,1,2,1,8,5,1,11}
204#define OIDegpNeighIntervalHello {1,3,6,1,2,1,8,5,1,12}
205#define OIDegpNeighIntervalPoll {1,3,6,1,2,1,8,5,1,13}
206#define OIDegpNeighMode {1,3,6,1,2,1,8,5,1,14}
207#define OIDegpNeighEventTrigger {1,3,6,1,2,1,8,5,1,15}
208#define OIDegpNeighAddr {1,3,6,1,2,1,8,5,1,2}
209#define OIDegpNeighAs {1,3,6,1,2,1,8,5,1,3}
210#define OIDegpNeighInMsgs {1,3,6,1,2,1,8,5,1,4}
211#define OIDegpNeighInErrs {1,3,6,1,2,1,8,5,1,5}
212#define OIDegpNeighOutMsgs {1,3,6,1,2,1,8,5,1,6}
213#define OIDegpNeighOutErrs {1,3,6,1,2,1,8,5,1,7}
214#define OIDegpNeighInErrMsgs {1,3,6,1,2,1,8,5,1,8}
215#define OIDegpNeighOutErrMsgs {1,3,6,1,2,1,8,5,1,9}
216#define OIDegpAs {1,3,6,1,2,1,8,6}
217#define OIDexperimental {1,3,6,1,3}
218#define OIDprivate {1,3,6,1,4}
219#define OIDenterprises {1,3,6,1,4,1}
220
221 #endif// __SNMPOIDS_H \ No newline at end of file
diff --git a/shared-code/SNMPeer.h b/shared-code/SNMPeer.h
new file mode 100644
index 0000000..68f2efe
--- a/dev/null
+++ b/shared-code/SNMPeer.h
@@ -0,0 +1,286 @@
1 #ifndef__SNMPEER_H
2#define __SNMPEER_H
3
4namespace Klever {
5
6 class CASNAny{
7public:
8 enum{
9 asnCls = 0xC0,
10 asnClsUniversal = 0x00,
11 asnClsApplication = 0x40,
12 asnClsContextSpecific = 0x80,
13 asnClsPrivate = 0xC0,
14 asnConstructed = 0x20,
15 asnPrimitive = 0x00,
16 asnTag = 0x1F,
17 // ASN.1 Primitive Tags
18 asnTagInteger = 0x02,
19 asnTagOctetString = 0x04,
20 asnTagNull = 0x05,
21 asnTagOID = 0x06,
22 // ASN.1 Constructed Tags
23 asnTagSequence = 0x10,
24 // RFC1155 Primitive Tags
25 asnTagIP = 0x00,
26 asnTagCounter = 0x01,
27 asnTagGauge = 0x02,
28 asnTagTicks = 0x03,
29 asnTagOpaque = 0x04,
30 // RFC1213 alias
31 asnTagDispString = 0x04,// (ASN.1 Octet string)
32 // RFC1157 Constructed Tags
33 asnTagGetRequest = 0x00,
34 asnTagGetNextRequest = 0x01,
35 asnTagGetResponse = 0x02,
36 asnTagSetRequest = 0x03,
37 asnTagTrap = 0x04
38 };
39 enum{
40 typeASNInteger = (asnClsUniversal|asnPrimitive|asnTagInteger),
41 typeASNOctetString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
42 typeASNNull = (asnClsUniversal|asnPrimitive|asnTagNull),
43 typeASNOID = (asnClsUniversal|asnPrimitive|asnTagOID),
44
45 typeASNSequence = (asnClsUniversal|asnConstructed|asnTagSequence),
46 typeASNSequenceOf = (asnClsUniversal|asnConstructed|asnTagSequence),
47
48 typeASNIP = (asnClsApplication|asnPrimitive|asnTagIP),
49 typeASNCounter = (asnClsApplication|asnPrimitive|asnTagCounter),
50 typeASNGauge = (asnClsApplication|asnPrimitive|asnTagGauge),
51 typeASNTicks = (asnClsApplication|asnPrimitive|asnTagTicks),
52 typeASNOpaque = (asnClsApplication|asnPrimitive|asnTagOpaque),
53 typeASNDispString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
54
55 typeASNGetRequest = (asnClsContextSpecific|asnConstructed|asnTagGetRequest),
56 typeASNGetNextRequest = (asnClsContextSpecific|asnConstructed|asnTagGetNextRequest),
57 typeASNGetResponse = (asnClsContextSpecific|asnConstructed|asnTagGetResponse),
58 typeASNSetRequest = (asnClsContextSpecific|asnConstructed|asnTagSetRequest),
59 typeASNTrap = (asnClsContextSpecific|asnConstructed|asnTagTrap)
60 };
61
62 typedefLONG asnInteger;
63 typedef LARGE_INTEGER asnInteger64;
64 typedefDWORD asnCounter;
65 typedef ULARGE_INTEGER asnCounter64;
66 typedef DWORD asnGauge;
67 typedef ULARGE_INTEGER asnGauge64;
68 typedefDWORD asnTicks;
69 typedef ULARGE_INTEGER asnTicks64;
70 struct asnDynamic{
71 UINT size;
72 LPBYTE data;
73 BOOL Allocate(UINT size) {
74 BOOL rv = Free();
75 if(size)
76 rv=rv&&(data=new BYTE[size]);
77 if(rv)
78 asnDynamic::size=size;
79 return rv;
80 }
81 BOOL Set(LPBYTE data,UINT size) {
82 BOOL rv = Allocate(size);
83 if(rv && size)
84 memmove(asnDynamic::data,data,size);
85 return rv;
86 }
87 BOOL Free() {
88 if(!size)
89 return TRUE;
90 delete data;
91 size=0;
92 data=0;
93 return TRUE;
94 }
95 void Clean() {
96 size=0;
97 data=0;
98 }
99 BOOL Copy(asnDynamic& src) {
100 BOOL rv = Free();
101 if(rv){
102 if(src.size)
103 rv=rv&&(data = new BYTE[src.size]);
104 if(rv){
105 if(size=src.size)
106 memmove(data,src.data,size);
107 }
108 }
109 return rv;
110 }
111 };
112 typedefasnDynamic asnOctetString;
113 typedef asnDynamic asnOID;
114 typedef in_addr asnIP;
115 typedef asnDynamic asnSequence;
116
117 BYTE type;
118 enum _storeType{
119 storeDynamic,
120 storeStatic
121 }storeType;
122 union{
123 asnInteger number;
124 asnInteger64 number64;
125 asnOctetString string;
126 asnOID oid;
127 asnSequence sequence;
128 asnIP ip;
129 asnCounter counter;
130 asnCounter64 counter64;
131 asnGauge gauge;
132 asnGauge64 gauge64;
133 asnTicks ticks;
134 asnTicks64 ticks64;
135 asnDynamic data;
136 } value;
137
138 CASNAny() : type(typeASNNull), storeType(storeStatic) { value.data.Clean(); }
139 CASNAny(CASNAny& src) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Copy(src); }
140 CASNAny(BYTE type) : type(type), storeType(storeStatic) { value.data.Clean(); }
141 CASNAny(BYTE type,LONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
142 CASNAny(BYTE type,LONGLONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
143 CASNAny(BYTE type,LPCTSTR string) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,string); }
144 CASNAny(BYTE type,LPBYTE data,UINT length) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,data,length); }
145 CASNAny(BYTE type,UINT* data,UINT size) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,(LPBYTE)data,size); }
146 CASNAny(in_addr& ip) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(ip); }
147 ~CASNAny() { Free(); }
148
149 BOOL Set(BYTE type) {
150 BOOL rv = Free();
151 CASNAny::type=type;
152 return rv;
153 }
154 BOOL Set(BYTE type,LONG number) {
155 BOOL rv = Free();
156 CASNAny::type=type;
157 value.number=number;
158 storeType=storeStatic;
159 return rv;
160 }
161 BOOL Set(BYTE type,LONGLONG number) {
162 BOOL rv = Free();
163 CASNAny::type=type;
164 value.number64.QuadPart = number;
165 storeType=storeStatic;
166 return rv;
167 }
168 BOOL Set(BYTE type,LPCTSTR string) {
169 BOOL rv = Free();
170 CASNAny::type=type;
171 rv=rv&&value.string.Set((LPBYTE)string,strlen(string)+1);
172 if(rv){
173 value.string.size--;
174 storeType=storeDynamic;
175 }
176 return rv;
177 }
178 BOOL Set(BYTE type,LPBYTE data,UINT length) {
179 BOOL rv = Free();
180 CASNAny::type=type;
181 rv=rv&&value.data.Set(data,length);
182 if(rv)
183 storeType=storeDynamic;
184 return rv;
185 }
186 BOOL Set(in_addr& ip) {
187 BOOL rv = Free();
188 memmove(&value.ip,&ip,sizeof(value.ip));
189 type=typeASNIP;
190 storeType=storeStatic;
191 return rv;
192 }
193 BOOL Free() {
194 if(storeType==storeDynamic)
195 value.data.Free();
196 else{
197 memset(&value,0,sizeof(value));
198 value.data.Clean();
199 }
200 storeType=storeStatic;
201 type=typeASNNull;
202 return TRUE;
203 }
204 BOOL Copy(CASNAny& src) {
205 BOOL rv = Free();
206 if(src.storeType==storeDynamic){
207 rv=rv&&value.data.Copy(src.value.data);
208 if(rv){
209 type=src.type;
210 storeType=src.storeType;
211 }
212 }else{
213 memmove(this,&src,sizeof(*this));
214 }
215 return rv;
216 }
217 CASNAny& operator=(CASNAny& src) {
218 VERIFY(Copy(src));
219 return *this;
220 }
221
222 // High Level
223 CString GetString() {
224 ASSERT(storeType==storeDynamic);
225 CString rv;
226 LPTSTR b = rv.GetBuffer(value.data.size+1);
227 ASSERT(b);
228 b[value.data.size]=0;
229 memmove(b,value.data.data,value.data.size);
230 rv.ReleaseBuffer();
231 return rv;
232 }
233};
234
235
236 class CSNMPVarBind{
237public:
238 CASNAny name;
239 CASNAny value;
240
241 CSNMPVarBind() {}
242 CSNMPVarBind(CASNAny& name,CASNAny& value) : name(name), value(value) {}
243 CSNMPVarBind(CASNAny& name) : name(name) {}
244 CSNMPVarBind(CSNMPVarBind& src) { Copy(src); }
245 BOOL Copy(CSNMPVarBind& src) {
246 name.Copy(src.name);
247 value.Copy(src.value);
248 return TRUE;
249 }
250 CSNMPVarBind& operator=(CSNMPVarBind& src) {
251 Copy(src);
252 return *this;
253 }
254 // High level
255 BOOL IsName(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
256 if(name.type!=CASNAny::typeASNOID)
257 return FALSE;
258 if(name.value.oid.size<prefixSize)
259 return FALSE;
260 if(bExact && (name.value.oid.size!=prefixSize))
261 return FALSE;
262 return !memcmp(prefix,name.value.oid.data,prefixSize);
263 }
264};
265
266 class CSNMPVarBindList: public CList<CSNMPVarBind,CSNMPVarBind&> {
267public:
268 CSNMPVarBind* GetVarBind(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
269 POSITION p = GetHeadPosition();
270 while(p){
271 CSNMPVarBind& vb = GetNext(p);
272 if(vb.IsName(prefix,prefixSize,bExact))
273 return &vb;
274 }
275 return NULL;
276 }
277};
278
279 class CSNMPeer{
280public:
281 virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) = 0;
282};
283
284};
285
286 #endif// __SNMPEER_H
diff --git a/shared-code/install.h b/shared-code/install.h
new file mode 100644
index 0000000..8c55ca9
--- a/dev/null
+++ b/shared-code/install.h
@@ -0,0 +1,370 @@
1 #defineWIN32_LEAN_AND_MEAN
2#define VC_EXTRALEAN
3#define WIN32_EXTRALEAN
4#include <windows.h>
5#include <shlobj.h>
6#include <winver.h>
7#include <crtdbg.h>
8#include <string.h>
9#include <stdio.h>
10
11extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
12
13 template<class T> class Smart{
14public:
15 T *pT;
16
17 Smart() : pT(NULL) {}
18 Smart(int cb) : pT(new T[cb]) {}
19 Smart(T* p) : pT(p) {}
20 ~Smart() { if(pT)delete pT; }
21
22 Smart& operator=(T* p) { if(pT)delete pT; pT=p; return *this; }
23 operator T* () { return pT; }
24
25 //T& operator[](int ndx) { return pT[ndx]; }
26
27 T* Detach() { T* rv = pT; pT=NULL; return rv; }
28};
29 typedefSmart<char> STRING;
30
31 #define APPEND_SLASH(str) if((str)[strlen(str)-1]!='\\')strcat(str,"\\")
32
33HINSTANCE theInstance;
34
35LPSTR strFETCH_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR val)
36{
37HKEY hkey;
38 if(RegOpenKeyEx(hRoot,subKey,0,KEY_QUERY_VALUE,&hkey)!=ERROR_SUCCESS)
39 return NULL;
40DWORD kType,cb=0;
41STRING rv;
42 if(RegQueryValueEx(hkey,val,NULL,&kType,NULL,&cb)==ERROR_SUCCESS && kType==REG_SZ){
43 rv= new char[cb];
44 _ASSERT(rv!=NULL);
45 if(RegQueryValueEx(hkey,val,NULL,&kType,(LPBYTE)(LPSTR)rv,&cb)!=ERROR_SUCCESS)
46 rv=NULL;
47 }
48 RegCloseKey(hkey);
49 return rv.Detach();
50}
51
52BOOL strSET_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR valName,LPCSTR val)
53{
54HKEY hkey;
55DWORD dw;
56 if(RegCreateKeyEx(hRoot,subKey,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&hkey,&dw)!=ERROR_SUCCESS)
57 return FALSE;
58BOOL rv = (RegSetValueEx(hkey,valName,0,REG_SZ,(LPBYTE)val,strlen(val)+1)==ERROR_SUCCESS);
59 RegCloseKey(hkey);
60 return rv;
61}
62
63void MAKE_PATH(LPCSTR path)
64{
65STRING tmp(strlen(path)+1);
66LPCSTR t0=path;
67LPSTR t1=tmp;
68 while(*t0){
69 if((*t0)=='\\'){
70 *t1=0;
71 CreateDirectory(tmp,NULL);
72 }
73 *(t1++)=*(t0++);
74 }
75 *t1=0;
76 CreateDirectory(tmp,NULL);
77}
78
79BOOL ADDMENU(LPCSTR menu,LPCSTR item,LPCSTR path,LPCSTR program)
80{
81STRING stm = strFETCH_REG_KEY(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders","Programs");
82 if(!stm)
83 return FALSE;
84int pil = 1+strlen(path)+1+strlen(program)+1+1;
85STRING pi(pil);
86 strcpy(pi,path);
87 APPEND_SLASH(pi);
88 strcat(pi,program);
89int ipl = strlen(stm)+1+strlen(menu)+1+strlen(item)+4+1;
90STRING ip(ipl);
91 memmove(ip,stm,strlen(stm)+1);
92 APPEND_SLASH(ip);
93 strcat(ip,menu);
94 MAKE_PATH(ip);
95 APPEND_SLASH(ip);
96 strcat(ip,item);
97 strcat(ip,".lnk");
98IShellLink* sl = NULL;
99IPersistFile* pf = NULL;
100BOOL rv = FALSE;
101 do{
102 HRESULT hrv = CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&sl);
103 if(!SUCCEEDED(hrv))
104 break;
105 sl->SetDescription(item);
106 sl->SetPath(pi);
107 hrv = sl->QueryInterface(IID_IPersistFile,(LPVOID*)&pf);
108 if(!SUCCEEDED(hrv))
109 break;
110 WORD wsz[MAX_PATH];
111 MultiByteToWideChar(CP_ACP,0,ip,-1,wsz,MAX_PATH);
112 hrv = pf->Save(wsz,TRUE);
113 if(SUCCEEDED(hrv))
114 rv=TRUE;
115 }while(FALSE);
116 if(pf)
117 pf->Release();
118 if(sl)
119 sl->Release();
120 return rv;
121}
122
123FILE* CREATE_INF_FILE(LPCSTR path,LPCSTR file)
124{
125STRING fn(strlen(path)+1+strlen(file)+1);
126 strcpy(fn,path);
127 APPEND_SLASH(fn);
128 strcat(fn,file);
129 return fopen(fn,"wt");
130}
131
132BOOL INSTALLFILE(LPCSTR res,LPCSTR path,LPCSTR file)
133{
134STRING temp(MAX_PATH);
135 if(!GetTempPath(MAX_PATH,temp)) return FALSE;
136STRING tf(MAX_PATH);
137 if(!GetTempFileName(temp,"KGI",0,tf)) return FALSE;
138HRSRC hrsrc = FindResource(NULL,res,MAKEINTRESOURCE(RT_RCDATA));
139 if(!hrsrc) return FALSE;
140DWORD sor = SizeofResource(NULL,hrsrc);
141 if(!sor) return FALSE;
142HGLOBAL hglobal = LoadResource(NULL,hrsrc);
143 if(!hglobal) return FALSE;
144LPVOID lpv = LockResource(hglobal);
145 if(!lpv) return FALSE;
146HANDLE hf = CreateFile(tf,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
147 if(!hf) return FALSE;
148DWORD written = 0;
149 if(!WriteFile(hf,lpv,sor,&written,NULL) || written!=sor){
150 CloseHandle(hf);
151 return FALSE;
152 }
153 CloseHandle(hf);
154STRING toKill(strlen(tf)+1);
155 strcpy(toKill,tf);
156 for(int tmp=strlen(tf)-1;tmp>0 && ((tf[tmp])!='\\');tmp--);
157 if(tf[tmp]=='\\')
158 tf[tmp++]=0;
159STRING nothing(_MAX_PATH);
160UINT nothingLength=_MAX_PATH;
161 if(VerInstallFile(0,&tf[tmp],(LPSTR)file,tf,(LPSTR)path,NULL,nothing,&nothingLength)){
162 DeleteFile(toKill);
163 return FALSE;
164 }
165 DeleteFile(toKill);
166 return TRUE;
167}
168
169LPCSTR pdTitle, pdPrompt;
170char pdPath[_MAX_PATH];
171BOOL CALLBACK pathDlgProc(HWND hwnd,UINT uMsg,WPARAM wP,LPARAM lP)
172{
173 switch(uMsg){
174 case WM_INITDIALOG:
175 SetWindowText(hwnd,pdTitle);
176 SetDlgItemText(hwnd,IDC_PROMPT,pdPrompt);
177 SetDlgItemText(hwnd,IDC_PATH,pdPath);
178 SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
179 return 1;
180 case WM_COMMAND:
181 switch(LOWORD(wP)){ // ID
182 case IDC_BROWSE:
183 switch(HIWORD(wP)){
184 case BN_CLICKED:
185 {
186 BROWSEINFO bi;
187 memset(&bi,0,sizeof(bi));
188 bi.hwndOwner=hwnd;
189 bi.pszDisplayName=pdPath;
190 bi.lpszTitle="Select Folder..";
191 bi.ulFlags=BIF_RETURNONLYFSDIRS;
192 LPITEMIDLIST lpidl=SHBrowseForFolder(&bi);
193 if(lpidl){
194 SHGetPathFromIDList(lpidl,pdPath);
195 SHFree(lpidl);
196 SetDlgItemText(hwnd,IDC_PATH,pdPath);
197 }
198 }
199 return 1;
200 }
201 break;
202 case IDOK:
203 switch(HIWORD(wP)){
204 case BN_CLICKED:
205 if(GetDlgItemText(hwnd,IDC_PATH,pdPath,sizeof(pdPath)))
206 EndDialog(hwnd,IDOK);
207 else
208 // *** Error message
209 EndDialog(hwnd,IDCANCEL);
210 return 1;
211 }
212 break;
213 case IDCANCEL:
214 switch(HIWORD(wP)){
215 case BN_CLICKED:
216 EndDialog(hwnd,IDCANCEL);
217 return 1;
218 }
219 break;
220 };
221 break;
222 }
223 return 0;
224}
225
226LPSTR REQUESTPATH(LPCSTR title,LPCSTR prompt,LPCSTR defPath)
227{
228 pdTitle=title;pdPrompt=prompt;
229 strcpy(pdPath,defPath);
230 if(DialogBox(NULL,MAKEINTRESOURCE(IDD_PATH),NULL/*Parent*/,(DLGPROC)&pathDlgProc)!=IDOK)
231 return NULL;
232STRING rv(strlen(pdPath)+1);
233 strcpy(rv,pdPath);
234 return rv.Detach();
235}
236
237HKEY uninstallKey(LPCSTR regKey) {
238 STRING rk(100+strlen(regKey)+1);
239 sprintf(rk,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s",regKey);
240 HKEY rv = NULL;
241 DWORD dw;
242 if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,rk,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&rv,&dw)!=ERROR_SUCCESS)
243 return NULL;
244 return rv;
245}
246
247BOOL REG_UNINSTALL_COMMAND(LPCSTR regKey,LPCSTR dName,LPCSTR iPath,LPCSTR iFile,LPCSTR iSection)
248{
249 HKEY hKey = uninstallKey(regKey);
250 if(!hKey)
251 return FALSE;
252 BOOL rv=FALSE;
253 do{
254 if(RegSetValueEx(hKey,"DisplayName",0,REG_SZ,(LPBYTE)dName,strlen(dName)+1)!=ERROR_SUCCESS)
255 break;
256 STRING us(50+strlen(iPath)+1+strlen(iFile)+strlen(iSection)+1);
257 strcpy(us,"RunDll32 setupapi.dll,InstallHinfSection ");
258 strcat(us,iSection);
259 strcat(us," 132 ");
260 strcat(us,iPath);
261 APPEND_SLASH(us);
262 strcat(us,iFile);
263 if(RegSetValueEx(hKey,"UninstallString",0,REG_SZ,(LPBYTE)(LPCSTR)us,strlen(us)+1)!=ERROR_SUCCESS)
264 break;
265 rv=TRUE;
266 }while(FALSE);
267 RegCloseKey(hKey);
268 return rv;
269}
270BOOL REG_UNINSTALL_ICON(LPCSTR regKey,LPCSTR path,LPCSTR file,int n) {
271 HKEY hKey = uninstallKey(regKey);
272 if(!hKey)
273 return FALSE;
274 STRING uis(strlen(path)+1+strlen(file)+7);
275 strcpy(uis,path);
276 APPEND_SLASH(uis);
277 strcat(uis,file);
278 char tmp[8];
279 sprintf(tmp,";%d",n);
280 strcat(uis,tmp);
281 BOOL rv = TRUE;
282 if(RegSetValueEx(hKey,"DisplayIcon",0,REG_SZ,(LPBYTE)(LPCSTR)uis,strlen(uis)+1)!=ERROR_SUCCESS)
283 rv = FALSE;
284 RegCloseKey(hKey);
285 return rv;
286}
287BOOL REG_UNINSTALL_COMMENT(LPCSTR regKey,LPCSTR comment) {
288 HKEY hKey = uninstallKey(regKey);
289 if(!hKey)
290 return FALSE;
291 BOOL rv = TRUE;
292 if(RegSetValueEx(hKey,"lComment",0,REG_SZ,(LPBYTE)comment,strlen(comment)+1)!=ERROR_SUCCESS)
293 rv = FALSE;
294 RegCloseKey(hKey);
295 return rv;
296}
297BOOL REG_UNINSTALL_VERSION(LPCSTR regKey,LPCSTR version) {
298 HKEY hKey = uninstallKey(regKey);
299 if(!hKey)
300 return FALSE;
301 BOOL rv = TRUE;
302 if(RegSetValueEx(hKey,"DisplayVersion",0,REG_SZ,(LPBYTE)version,strlen(version)+1)!=ERROR_SUCCESS)
303 rv = FALSE;
304 RegCloseKey(hKey);
305 return rv;
306}
307BOOL REG_UNINSTALL_LOCATION(LPCSTR regKey,LPCSTR location) {
308 HKEY hKey = uninstallKey(regKey);
309 if(!hKey)
310 return FALSE;
311 BOOL rv = TRUE;
312 if(RegSetValueEx(hKey,"InstallLocation",0,REG_SZ,(LPBYTE)location,strlen(location)+1)!=ERROR_SUCCESS)
313 rv = FALSE;
314 RegCloseKey(hKey);
315 return rv;
316}
317BOOL REG_UNINSTALL_PUBLISHER(LPCSTR regKey,LPCSTR publisher) {
318 HKEY hKey = uninstallKey(regKey);
319 if(!hKey)
320 return FALSE;
321 BOOL rv = TRUE;
322 if(RegSetValueEx(hKey,"Publisher",0,REG_SZ,(LPBYTE)publisher,strlen(publisher)+1)!=ERROR_SUCCESS)
323 rv = FALSE;
324 RegCloseKey(hKey);
325 return rv;
326}
327BOOL REG_UNINSTALL_URLS(LPCSTR regKey,LPCSTR about,LPCSTR update) {
328 HKEY hKey = uninstallKey(regKey);
329 if(!hKey)
330 return FALSE;
331 BOOL rv = TRUE;
332 if(RegSetValueEx(hKey,"URLInfoAbout",0,REG_SZ,(LPBYTE)about,strlen(about)+1)!=ERROR_SUCCESS)
333 rv = FALSE;
334 if(RegSetValueEx(hKey,"URLUpdateInfo",0,REG_SZ,(LPBYTE)update,strlen(update)+1)!=ERROR_SUCCESS)
335 rv = FALSE;
336 RegCloseKey(hKey);
337 return rv;
338}
339
340 #defineINF_FILE_HEADER(i) fprintf(i,"[Version]\nSignature=\"$CHICAGO$\"\n\n")
341#define INF_FILE_SECTION(i,s) fprintf(i,"\n[%s]\n",s)
342 #defineINF_UNINSTALL_REG(i,p) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,DisplayName\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,UninstallString\n",p,p,p)
343#define INF_MENU_GROUP(i,n,m) fprintf(i,"setup.ini, progman.groups,,\"group%d=%s\"\n",n,m)
344#define INF_MENU_ITEM(i,n,m) fprintf(i,"setup.ini, group%d,, \"\"\"%s\"\"\"\n",n,m);
345#define INF_REMOVE_ROOT(i,g,r) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,,,\"%s\"\n",g,r)
346#define INF_REMOVE_FILE(i,g,f) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,%s,,\"%s\"\n",g,f,f)
347#define INF_REMOVE_HELP_FILE(i,g,f) {INF_REMOVE_FILE(i,g,f".hlp");INF_REMOVE_FILE(i,g,f".cnt");INF_REMOVE_FILE(i,g,f".GID");INF_REMOVE_FILE(i,g,f".FTS");}
348
349LPSTR GET_SHORT_PATH(LPCSTR path)
350{
351char tmp;
352DWORD len = GetShortPathName(path,&tmp,1);
353 if(!len)
354 return NULL;
355STRING rv(len+1);
356 if(!GetShortPathName(path,rv,len+1))
357 return NULL;
358 return rv.Detach();
359}
360
361BOOL Install(void);
362
363int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR,int)
364{
365 theInstance=hInstance;
366 CoInitialize(NULL);
367 Install();
368 CoUninitialize();
369 return 0;
370}
diff --git a/shared-code/ip_icmp.h b/shared-code/ip_icmp.h
new file mode 100644
index 0000000..acaf7e9
--- a/dev/null
+++ b/shared-code/ip_icmp.h
@@ -0,0 +1,91 @@
1#ifndef IP_ICMPHEADER
2
3#define IP_ICMPHEADER
4
5struct icmp {
6 BYTE icmp_type;
7 BYTE icmp_code;
8 WORD icmp_cksum;
9 WORD icmp_id;
10 WORD icmp_seq;
11 char icmp_data[1];
12};
13
14#define SIZE_ICMP_HDR 8
15#define SIZE_TIME_DATA 8
16
17struct ip {
18 BYTE ip_hl:4, /* header length */
19 ip_v:4; /* version */
20 BYTE ip_tos; /* type of service */
21 short ip_len; /* total length */
22 u_short ip_id; /* identification */
23 short ip_off; /* fragment offset field */
24 BYTE ip_ttl; /* time to live */
25 BYTE ip_p; /* protocol */
26 u_short ip_sum; /* checksum */
27 struct in_addr ip_src,ip_dst; /* source and dest address */
28};
29
30#define ICMP_ECHOREPLY 0 /* echo reply */
31#define ICMP_UNREACH 3 /* dest unreachable, codes: */
32#define ICMP_UNREACH_NET 0 /* bad net */
33#define ICMP_UNREACH_HOST 1 /* bad host */
34#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
35#define ICMP_UNREACH_PORT 3 /* bad port */
36#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
37#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
38#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
39#define ICMP_REDIRECT 5 /* shorter route, codes: */
40#define ICMP_REDIRECT_NET 0 /* for network */
41#define ICMP_REDIRECT_HOST 1 /* for host */
42#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
43#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
44#define ICMP_ECHO 8 /* echo service */
45#define ICMP_TIMXCEED 11 /* time exceeded, code: */
46#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
47#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
48#define ICMP_PARAMPROB 12 /* ip header bad */
49#define ICMP_TSTAMP 13 /* timestamp request */
50#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
51#define ICMP_IREQ 15 /* information request */
52#define ICMP_IREQREPLY 16 /* information reply */
53#define ICMP_MASKREQ 17 /* address mask request */
54#define ICMP_MASKREPLY 18 /* address mask reply */
55
56#define ICMP_MAXTYPE 18
57
58#define ICMP_MINLEN 8 /* abs minimum */
59#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
60#define ICMP_MASKLEN 12 /* address mask */
61#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
62#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
63
64#define STNORM 0
65
66/* Definition of the lowest telnet byte following an IAC byte */
67#define LOW_TEL_OPT 236
68
69#define TEL_EOF 236
70#define SUSP 237
71#define ABORT 238
72
73#define SE 240
74#define NOP 241
75#define DM 242
76#define BREAK 243
77#define IP 244
78#define AO 245
79#define AYT 246
80#define EC 247
81#define EL 248
82#define GOAHEAD 249
83#define SB 250
84#define WILL 251
85#define WONT 252
86#define DO 253
87#define DONT 254
88#define IAC 255
89
90#endif
91
diff --git a/shared-code/kHelpers.h b/shared-code/kHelpers.h
new file mode 100644
index 0000000..209c6b0
--- a/dev/null
+++ b/shared-code/kHelpers.h
@@ -0,0 +1,159 @@
1 #ifndef__KHELPERS_H
2#define __KHELPERS_H
3
4#include <shlobj.h>
5
6extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
7
8namespace Klever {
9
10 inline BOOL BrowseForFolder(CString& folder,LPCTSTR title=NULL,CWnd* pParent=NULL) {
11 BROWSEINFO bi;
12 memset(&bi,0,sizeof(bi));
13 if(pParent)
14 bi.hwndOwner=pParent->GetSafeHwnd();
15 CString rv;
16 bi.pszDisplayName=rv.GetBuffer(MAX_PATH);
17 bi.lpszTitle=title;
18 bi.ulFlags=BIF_RETURNONLYFSDIRS;
19 LPITEMIDLIST lpidl = SHBrowseForFolder(&bi);
20 if(lpidl){
21 SHGetPathFromIDList(lpidl,bi.pszDisplayName);
22 SHFree(lpidl);
23 rv.ReleaseBuffer();
24 folder=rv;
25 return TRUE;
26 }
27 rv.ReleaseBuffer();
28 return FALSE;
29 }
30 inline BOOL BrowseForFolder(CString& folder,UINT idTitle,CWnd* pParent=NULL) {
31 CString title;
32 VERIFY(title.LoadString(idTitle));
33 return BrowseForFolder(folder,title,pParent);
34 }
35 inline CString GluePathAndFile(LPCTSTR path,LPCTSTR file) {
36 CString rv = path;
37 while((!rv.IsEmpty()) && rv[rv.GetLength()-1]=='\\')
38 rv=rv.Left(rv.GetLength()-1);
39 rv+='\\';
40 while(*file && *file=='\\')
41 file++;
42 rv+=file;
43 return rv;
44 }
45 inline UINT TokenizeString(CStringList& rv,LPCTSTR string,LPCTSTR delimiter) {
46 CString s = string;
47 int found;
48 int delength = strlen(delimiter);
49 int rvc = 0;
50 while((found=s.Find(delimiter))>=0){
51 rv.AddTail(s.Left(found));
52 rvc++;
53 s=s.Mid(found+delength);
54 }
55 if(!s.IsEmpty()){
56 rv.AddTail(s);
57 rvc++;
58 }
59 return rvc;
60 }
61 inline BOOL LogRecord(LPCTSTR logFile,LPCTSTR logRecord) {
62 try{
63 CFile f(logFile,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite|CFile::shareDenyWrite);
64 f.SeekToEnd();
65 CString s = CTime::GetCurrentTime().Format("[%c] ")+logRecord+"\r\n";
66 f.Write((LPCTSTR)s,s.GetLength());
67 }catch(CException* e){
68 e->Delete();
69 return FALSE;
70 }
71 return TRUE;
72 }
73 inline BOOL ReadString(CFile* file,CString& rv) {
74 rv.Empty();
75 int nBuffer = 256;
76 TCHAR* ch = rv.GetBuffer(nBuffer);
77 int nPos = 0;
78 BOOL bRV = FALSE;
79 for(;;){
80 TCHAR c;
81 try{
82 if(file->Read(&c,sizeof(c))!=sizeof(c))
83 break;
84 bRV=TRUE;
85 }catch(CException* e){
86 e->Delete();
87 TRACE0("Exception in ReadString\n");
88 return FALSE;
89 }
90 if(nPos>=(nBuffer-1)){
91 rv.ReleaseBuffer();
92 ch = rv.GetBuffer(nBuffer=nBuffer+256);
93 ASSERT(ch);
94 }
95 if(c=='\n')
96 break;
97 ch[nPos++]=c;
98 }
99 ch[nPos]=0;
100 for(;;){
101 nPos--;
102 if(nPos<0)
103 break;
104 if(ch[nPos]!='\r')
105 break;
106 ch[nPos]=0;
107 }
108 rv.ReleaseBuffer();
109 rv.FreeExtra();
110 return bRV;
111 }
112
113 inline int LoadStringList(CStringList& list,LPCTSTR section) {
114 CString n;
115 list.RemoveAll();
116 CWinApp* app = AfxGetApp();
117 ASSERT(app);
118 for(int tmp=0;;tmp++){
119 n.Format("%d",tmp);
120 CString str = app->GetProfileString(section,n,NULL);
121 if(str.IsEmpty())
122 break;
123 list.AddTail(str);
124 }
125 return tmp;
126 }
127 inline int SaveStringList(CStringList& list,LPCTSTR section) {
128 CString n;
129 CWinApp* app = AfxGetApp();
130 ASSERT(app);
131 POSITION p = list.GetHeadPosition();
132 for(int tmp=0;p;tmp++){
133 n.Format("%d",tmp);
134 app->WriteProfileString(section,n,list.GetNext(p));
135 }
136 n.Format("%d",tmp);
137 app->WriteProfileString(section,n,NULL);
138 return tmp;
139 }
140
141 inline BOOL WriteProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR str) {
142 CWinApp* app = AfxGetApp();
143 return app->WriteProfileBinary(section,entry,(LPBYTE)str,strlen(str)+1);
144 }
145 inline CString GetProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR defval) {
146 CWinApp* app = AfxGetApp();
147 LPBYTE pData;
148 UINT nCount;
149 CString rv = defval;
150 if(app->GetProfileBinary(section,entry,&pData,&nCount)){
151 rv = (LPCTSTR)pData;
152 delete pData;
153 }
154 return rv;
155 }
156
157};
158
159#endif // __KHELPERS_H
diff --git a/shared-code/kICMP.cpp b/shared-code/kICMP.cpp
new file mode 100644
index 0000000..09a8f94
--- a/dev/null
+++ b/shared-code/kICMP.cpp
@@ -0,0 +1,300 @@
1#include "../stdafx.h"
2#include "kICMP.h"
3
4CICMP::_mechanismus CICMP::m_mechanismus = CICMP::_icmpUndetermined;
5
6BOOL CICMPDll::Initialize()
7{
8 if(m_hICMP!=INVALID_HANDLE_VALUE || m_hICMPDLL)
9 Deinitialize();
10 m_hICMPDLL = ::LoadLibraryEx("ICMP",NULL,0);
11 if(!m_hICMPDLL)
12 return FALSE;
13 *(FARPROC*)&m_icmpCF = ::GetProcAddress(m_hICMPDLL,"IcmpCreateFile");
14 *(FARPROC*)&m_icmpSE = ::GetProcAddress(m_hICMPDLL,"IcmpSendEcho");
15 *(FARPROC*)&m_icmpCH = ::GetProcAddress(m_hICMPDLL,"IcmpCloseHandle");
16 if(!(m_icmpCF && m_icmpSE && m_icmpCH)){
17 Deinitialize(); return FALSE;
18 }
19 m_hICMP = (*m_icmpCF)();
20 if(m_hICMP==INVALID_HANDLE_VALUE){
21 Deinitialize(); return FALSE;
22 }
23 TRACE0("ICMP-DLL Initialized\n");
24 return TRUE;
25}
26void CICMPDll::Deinitialize()
27{
28 if(m_hICMPDLL){
29 if(m_hICMP!=INVALID_HANDLE_VALUE && m_icmpCH)
30 (*m_icmpCH)(m_hICMP);
31 ::FreeLibrary(m_hICMPDLL); m_hICMPDLL = NULL;
32 m_icmpCF = NULL;
33 m_icmpSE = NULL;
34 m_icmpCH = NULL;
35 }
36 m_hICMP=INVALID_HANDLE_VALUE;
37 if(m_sizeOut && m_bsOut){
38 delete m_bsOut;
39 m_bsOut = NULL; m_sizeOut = 0;
40 }
41 if(m_sizeIn && m_bsIn){
42 delete m_bsIn;
43 m_bsIn = NULL; m_sizeIn = 0;
44 }
45}
46
47LONG CICMPDll::Ping(const in_addr host,const UINT packetSize,
48 const UINT timeOut,LPINT pStatus)
49{
50 if(!(m_hICMP && m_hICMPDLL && m_icmpSE)){
51 if(pStatus)
52 (*pStatus) = icmpNotInitialized;
53 return -1;
54 }
55 VERIFY(AdjustBuffers(packetSize));
56IPINFO ipi;
57 memset(&ipi,0,sizeof(ipi));
58 ipi.Ttl = 30;
59 for(UINT tmp=0;tmp<packetSize;tmp++)
60 m_bsOut[tmp]=tmp&0xFF;
61LPICMPECHO pRep = (LPICMPECHO)m_bsIn;
62 pRep->Status = 0xFFFFFFFFl;
63 if((*m_icmpSE)(m_hICMP,host.s_addr,m_bsOut,packetSize,
64 &ipi,pRep,m_sizeIn,timeOut))
65 TRACE0("ICMP-SendEcho succeeded\n");
66 else
67 TRACE0("ICMP-SendEcho failed\n");
68LONG lrv = -1;
69INT rv = ipUnknown;
70 switch(pRep->Status){
71 case IP_SUCCESS:
72 lrv = pRep->RTTime; rv = ipSuccess;
73 break;
74 case IP_BUF_TOO_SMALL: rv = ipBuffTooSmall; break;
75 case IP_DEST_NET_UNREACHABLE: rv = ipDestNetUnreachable; break;
76 case IP_DEST_HOST_UNREACHABLE: rv = ipDestHostUnreachable; break;
77 case IP_DEST_PROT_UNREACHABLE: rv = ipDestProtUnreachable; break;
78 case IP_DEST_PORT_UNREACHABLE: rv = ipDestPortUnreachable; break;
79 case IP_NO_RESOURCES: rv = ipNoResources; break;
80 case IP_BAD_OPTION: rv = ipBadOption; break;
81 case IP_HW_ERROR: rv = ipHWError; break;
82 case IP_PACKET_TOO_BIG: rv = ipPacketTooBig; break;
83 case IP_REQ_TIMED_OUT: rv = ipTimeOut; break;
84 case IP_BAD_REQ: rv = ipBadRequest; break;
85 case IP_BAD_ROUTE: rv = ipBadRoute; break;
86 case IP_TTL_EXPIRED_TRANSIT: rv = ipTTLExpiredInTransit; break;
87 case IP_TTL_EXPIRED_REASSEM: rv = ipTTLExpiredInReasm; break;
88 case IP_PARAM_PROBLEM: rv = ipParamProblem; break;
89 case IP_SOURCE_QUENCH: rv = ipSourceQuench; break;
90 case IP_OPTION_TOO_BIG: rv = ipOptionTooBig; break;
91 case IP_BAD_DESTINATION: rv = ipBadDest; break;
92 }
93 if(pStatus)
94 (*pStatus)=rv;
95 return lrv;
96}
97
98BOOL CICMPDll::AdjustBuffers(UINT packetSize)
99{
100 if(!packetSize)
101 packetSize=1;
102 if(packetSize>m_sizeOut){
103 if(m_sizeOut && m_bsOut)
104 delete m_bsOut;
105 m_bsOut = new BYTE[m_sizeOut=packetSize];
106 if(!m_bsOut)
107 return FALSE;
108 }
109UINT sin = sizeof(ICMPECHO)+SIZE_ICMP_HDR+packetSize;
110 if(sin>m_sizeIn){
111 if(m_sizeIn && m_bsIn)
112 delete m_bsIn;
113 m_bsIn = new BYTE[m_sizeIn=sin];
114 if(!m_bsIn)
115 return FALSE;
116 }
117 return TRUE;
118}
119
120
121WORD CICMPWS::m_icmpSeq = 0;
122
123BOOL CICMPWS::Initialize()
124{
125 if(m_socket!=INVALID_SOCKET)
126 Deinitialize();
127 m_socket = socket(AF_INET,SOCK_RAW,1/*ICMP*/);
128 if(m_socket==INVALID_SOCKET)
129 return FALSE;
130 TRACE0("ICMP-WS Initialized\n");
131 return TRUE;
132}
133void CICMPWS::Deinitialize()
134{
135 if(m_socket!=INVALID_SOCKET){
136 closesocket(m_socket);
137 m_socket=INVALID_SOCKET;
138 }
139 if(m_sizeOut && m_bsOut){
140 delete m_bsOut;
141 m_bsOut = NULL; m_sizeOut = 0;
142 }
143 if(m_sizeIn && m_bsIn){
144 delete m_bsIn;
145 m_bsIn = NULL; m_sizeIn = 0;
146 }
147}
148LONG CICMPWS::Ping(const in_addr host,const UINT packetSize,
149 const UINT timeOut,LPINT pStatus)
150{
151 if(m_socket==INVALID_SOCKET){
152 if(pStatus)
153 (*pStatus)=icmpNotInitialized;
154 }
155 VERIFY(AdjustBuffers(packetSize));
156icmp* pPacket = (icmp*)m_bsOut;
157 memset(pPacket,0,m_sizeOut);
158 pPacket->icmp_type = ICMP_ECHO;
159 pPacket->icmp_seq = m_icmpSeq++;
160 pPacket->icmp_id = (WORD)(::GetCurrentThreadId()&0xFFFF);
161 for(UINT tmp=0;tmp<packetSize;tmp++)
162 pPacket->icmp_data[tmp]=tmp&0xFF;
163 pPacket->icmp_cksum = cksum(pPacket,SIZE_ICMP_HDR+packetSize);
164sockaddr_in to;
165 memset(&to,0,sizeof(to));
166 to.sin_addr.s_addr = host.s_addr;
167 to.sin_family = AF_INET;
168 if(sendto(m_socket,(char*)pPacket,SIZE_ICMP_HDR+packetSize,0,
169 (SOCKADDR*)&to,sizeof(to)) != (int)(SIZE_ICMP_HDR+packetSize)){
170 TRACE1("sendto: %lu\n",WSAGetLastError());
171 if(pStatus)
172 (*pStatus)=icmpSocketError;
173 return -1;
174 }
175DWORD sentTime = ::GetTickCount();
176sockaddr_in from;
177 memset(&from,0,sizeof(from));
178 from.sin_family=AF_INET;
179 from.sin_addr.s_addr=INADDR_ANY;
180fd_set fds;
181 FD_ZERO(&fds);
182 FD_SET(m_socket,&fds);
183long lrv = -1;
184INT rv = ipTimeOut;
185 for(;;){
186 DWORD ct = ::GetTickCount();
187 if((ct-sentTime)>=timeOut){
188 TRACE0("Timeout\n");
189 break;
190 }
191 timeval tv = {
192 (timeOut-ct+sentTime)/1000,
193 (timeOut-ct+sentTime)%1000
194 };// tv_sec, tv_usec (secs,microsecs)
195 if(!select(m_socket,&fds,NULL,NULL,&tv)){
196 TRACE1("select: %d\n",WSAGetLastError());
197 break;
198 }
199 DWORD rtime = ::GetTickCount();
200 ASSERT(FD_ISSET(m_socket,&fds));
201 int fl = sizeof(from);
202 int rb = recvfrom(m_socket,(char*)m_bsIn,m_sizeIn,0,(SOCKADDR*)&from,&fl);
203 ip* pIP = (ip*)m_bsIn;
204 icmp* pICMP = (icmp*)&m_bsIn[sizeof(ip)];
205 if(pICMP->icmp_id!=pPacket->icmp_id)
206 continue;
207 if(pICMP->icmp_seq!=pPacket->icmp_seq)
208 continue;
209 if(from.sin_addr.s_addr!=host.s_addr)
210 continue;
211 if(pICMP->icmp_type==ICMP_ECHOREPLY){
212 lrv=rtime-sentTime;
213 rv=ipSuccess;
214 break;
215 }
216 rv = ipUnknown;// ***
217 break;
218 }
219 if(pStatus)
220 (*pStatus)=rv;
221 return lrv;
222}
223
224BOOL CICMPWS::AdjustBuffers(UINT packetSize)
225{
226 if(!packetSize)
227 packetSize=0;
228UINT osize = packetSize+SIZE_ICMP_HDR;
229 if(m_sizeOut<osize){
230 if(m_sizeOut && m_bsOut)
231 delete m_bsOut;
232 m_bsOut = new BYTE[m_sizeOut=osize];
233 if(!m_bsOut)
234 return FALSE;
235 }
236UINT isize = osize+sizeof(ip);
237 if(m_sizeIn<isize){
238 if(m_sizeIn && m_bsIn)
239 delete m_bsIn;
240 m_bsIn = new BYTE[m_sizeIn=isize];
241 if(!m_bsIn)
242 return FALSE;
243 }
244 return TRUE;
245}
246
247WORD CICMPWS::cksum(LPVOID data,int count)
248{
249long lSum = 0;
250WORD *pData = (WORD*)data;
251 while(count>0){
252 if(count>1){
253 lSum+=*(pData++);
254 count-=2;
255 }else{
256 lSum+=((WORD)*(BYTE*)pData)&0xFF;
257 count--;
258 }
259 }
260 lSum = (lSum&0xFFFF)+(lSum>>16);
261 lSum += (lSum>>16);
262 return (~lSum)&0xFFFF;
263}
264
265CICMP* CICMP::CreateICMP()
266{
267 if(m_mechanismus==_icmpUndetermined)
268 GuessMechanismus();
269 switch(m_mechanismus){
270 case _icmpWinsock:
271 return new CICMPWS;
272 break;
273 case _icmpDLL:
274 return new CICMPDll;
275 break;
276 }
277 return NULL;
278}
279
280void CICMP::GuessMechanismus()
281{
282 m_mechanismus=_icmpUndetermined;
283SOCKET testSocket = socket(AF_INET,SOCK_RAW,1);
284 if(testSocket!=INVALID_SOCKET){
285 closesocket(testSocket);
286 m_mechanismus=_icmpWinsock;
287 }else{
288 HINSTANCE hICMP = ::LoadLibraryEx("ICMP",NULL,0);
289 if(!hICMP)
290 return;
291 BOOL isThere = (
292 ::GetProcAddress(hICMP,"IcmpCreateFile")
293 && ::GetProcAddress(hICMP,"IcmpSendEcho")
294 && ::GetProcAddress(hICMP,"IcmpCloseHandle")
295 );
296 ::FreeLibrary(hICMP);
297 if(isThere)
298 m_mechanismus=_icmpDLL;
299 }
300} \ No newline at end of file
diff --git a/shared-code/kICMP.h b/shared-code/kICMP.h
new file mode 100644
index 0000000..7a5ceaa
--- a/dev/null
+++ b/shared-code/kICMP.h
@@ -0,0 +1,80 @@
1 #ifndef__KICMP_H
2#define __KICMP_H
3
4class CICMP {
5 enum _mechanismus {
6 _icmpUndetermined = -1,
7 _icmpWinsock = 0, _icmpDLL
8 };
9static _mechanismus m_mechanismus;
10static void GuessMechanismus();
11public:
12static
13 CICMP* CreateICMP();
14
15 enum {
16 ipSuccess = 0,
17 ipBuffTooSmall, ipDestNetUnreachable, ipDestHostUnreachable,
18 ipDestProtUnreachable, ipDestPortUnreachable, ipNoResources,
19 ipBadOption, ipHWError, ipPacketTooBig, ipTimeOut, ipBadRequest,
20 ipBadRoute, ipTTLExpiredInTransit, ipTTLExpiredInReasm,
21 ipParamProblem, ipSourceQuench, ipOptionTooBig, ipBadDest,
22 ipUnknown = -1,
23 icmpNotInitialized = -2,
24 icmpSocketError = -3
25 };
26
27 virtual BOOL Initialize() = 0;
28 virtual void Deinitialize() = 0;
29
30 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
31 const UINT timeOut=10000,LPINT pStatus=NULL) = 0;
32};
33
34class CICMPDll : public CICMP {
35 HANDLE(WINAPI *m_icmpCF)(VOID);
36 BOOL(WINAPI *m_icmpSE)(HANDLE,ULONG,LPVOID,WORD,
37 PIPINFO,LPVOID,DWORD,DWORD);
38 BOOL(WINAPI *m_icmpCH)(HANDLE);
39public:
40 HINSTANCE m_hICMPDLL;
41 HANDLE m_hICMP;
42 LPBYTE m_bsIn, m_bsOut;
43 UINT m_sizeIn, m_sizeOut;
44
45 CICMPDll() : m_hICMP(INVALID_HANDLE_VALUE), m_hICMPDLL(NULL),
46 m_bsIn(NULL), m_bsOut(NULL), m_sizeIn(0), m_sizeOut(0) {}
47 virtual ~CICMPDll() { Deinitialize(); }
48
49 virtual BOOL Initialize();
50 virtual void Deinitialize();
51
52 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
53 const UINT timeOut=10000,LPINT pStatus=NULL);
54
55 BOOL AdjustBuffers(UINT packetSize=0);
56};
57
58class CICMPWS : public CICMP {
59static
60 WORD m_icmpSeq;
61public:
62 SOCKET m_socket;
63 LPBYTE m_bsIn, m_bsOut;
64 UINT m_sizeIn, m_sizeOut;
65
66 CICMPWS() : m_socket(INVALID_SOCKET), m_bsIn(NULL), m_bsOut(NULL),
67 m_sizeIn(0), m_sizeOut(0) {}
68 virtual ~CICMPWS() { Deinitialize(); }
69
70 virtual BOOL Initialize();
71 virtual void Deinitialize();
72
73 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
74 const UINT timeOut=10000,LPINT pStatus=NULL);
75
76 BOOL AdjustBuffers(UINT packetSize=0);
77 WORD cksum(LPVOID data,int count);
78};
79
80#endif // __KICMP_H \ No newline at end of file
diff --git a/shared-code/kinhelp.xsl b/shared-code/kinhelp.xsl
new file mode 100644
index 0000000..0bb384a
--- a/dev/null
+++ b/shared-code/kinhelp.xsl
@@ -0,0 +1,250 @@
1<?xml version="1.0"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 >
5 <xsl:output
6 method="text"
7 encoding="us-ascii"/>
8 <xsl:strip-space elements="*"/>
9
10 <xsl:template match="winhelp">
11 <xsl:text>{\rtf1\ansi</xsl:text>
12 <xsl:text>&#xA;@{\footnote</xsl:text>
13 <xsl:text>&#xA;THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.</xsl:text>
14 <xsl:text>&#xA;DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD</xsl:text>
15 <xsl:text>&#xA;}&#xA;</xsl:text>
16 <xsl:call-template name="fonttbl"/>
17 <xsl:call-template name="colortbl"/>
18 <xsl:apply-templates/>
19 <xsl:text>}</xsl:text>
20 </xsl:template>
21
22 <xsl:template match="topic">
23 <xsl:text>&#xA;\pard\plain</xsl:text>
24 <xsl:if test="descendant::*[ (@scroll='no') and
25 count(preceding-sibling::*[not(@scroll='no') and (name()!='a' and @name)])=0] ">
26 <xsl:text>\keepn</xsl:text>
27 </xsl:if>
28 <xsl:if test="@id">
29 <xsl:text>&#xA;#{\footnote </xsl:text>
30 <xsl:value-of select="@id"/>
31 <xsl:text>}</xsl:text>
32 </xsl:if>
33 <xsl:if test="@title">
34 <xsl:text>&#xA;${\footnote </xsl:text>
35 <xsl:value-of select="@title"/>
36 <xsl:text>}</xsl:text>
37 </xsl:if>
38 <xsl:if test="@keywords">
39 <xsl:text>&#xA;K{\footnote </xsl:text>
40 <xsl:value-of select="@keywords"/>
41 <xsl:text>}</xsl:text>
42 </xsl:if>
43 <xsl:apply-templates/>
44 <xsl:text>&#xA;\page&#xA;</xsl:text>
45 </xsl:template>
46
47 <xsl:template match="a[@name]">
48 <xsl:text>{#{\footnote </xsl:text>
49 <xsl:value-of select="@name"/>
50 <xsl:text>}}</xsl:text>
51 </xsl:template>
52 <xsl:template match="a[@href]">
53 <xsl:call-template name="hyperref">
54 <xsl:with-param name="href" select="@href"/>
55 <xsl:with-param name="inset"><xsl:apply-templates/></xsl:with-param>
56 </xsl:call-template>
57 </xsl:template>
58 <xsl:template name="hyperref">
59 <xsl:param name="href"/>
60 <xsl:param name="inset"/>
61 <xsl:choose>
62 <xsl:when test="starts-with($href,'http:') or starts-with($href,'mailto:') or
63 starts-with($href,'ftp:')">
64 <xsl:text>{\uldb </xsl:text>
65 <xsl:value-of select="$inset"/>
66 <xsl:text>}{\v %!ExecFile("</xsl:text>
67 <xsl:value-of select="$href"/>
68 <xsl:text>")}</xsl:text>
69 </xsl:when>
70 <xsl:when test="starts-with($href,'#')">
71 <xsl:text>{\uldb </xsl:text>
72 <xsl:value-of select="$inset"/>
73 <xsl:text>}{\v </xsl:text>
74 <xsl:value-of select="substring($href,2)"/>
75 <xsl:text>}</xsl:text>
76 </xsl:when>
77 <xsl:otherwise>
78 <xsl:message>Warining: Unqualified hyper-reference. Using as help-internal</xsl:message>
79 <xsl:text>{\uldb </xsl:text>
80 <xsl:value-of select="$inset"/>
81 <xsl:text>}{\v </xsl:text>
82 <xsl:value-of select="$href"/>
83 <xsl:text>}</xsl:text>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:template>
87
88 <xsl:template match="heading">
89 <xsl:text>&#xA;</xsl:text>
90 <xsl:if test="@scroll!='no'">
91 <xsl:text>\pard </xsl:text>
92 </xsl:if>
93 <xsl:text>{ \f1\fs18\b\sb120 </xsl:text>
94 <xsl:apply-templates/>
95 <xsl:text>}</xsl:text>
96 </xsl:template>
97
98 <xsl:template match="p">
99 <xsl:text>&#xA;\par\sa120\sb120\qj</xsl:text>
100 <xsl:if test="@scroll!='no'">
101 <xsl:text>\pard</xsl:text>
102 </xsl:if>
103 <xsl:text> \f1\fs18\sb120 </xsl:text>
104 <xsl:apply-templates/>
105 </xsl:template>
106
107 <xsl:template match="note">
108 <xsl:text>&#xA;\par\sa120\sb120\qj\f1\fs16 </xsl:text>
109 <xsl:apply-templates/>
110 </xsl:template>
111
112 <xsl:template match="dedication">
113 <xsl:text>&#xA;\par\sa120\sb120\qr\f1\fs16 </xsl:text>
114 <xsl:apply-templates/>
115 </xsl:template>
116
117 <xsl:template match="image">
118 <xsl:text>\{bmct </xsl:text>
119 <xsl:value-of select="@source"/>
120 <xsl:text>\}</xsl:text>
121 </xsl:template>
122
123 <xsl:template match="newsfor">
124 <xsl:text>&#xA;\par\pard\plain\f1\fs24\qc\cf2\b </xsl:text>
125 <xsl:value-of select="@version"/>
126 <xsl:text> - </xsl:text>
127 <xsl:value-of select="@date"/>
128 <xsl:apply-templates/>
129 </xsl:template>
130 <xsl:template match="ni">
131 <xsl:text>&#xA;\par\pard\plain\fi0\li0\f1\fs18 \bullet </xsl:text>
132 <xsl:apply-templates/>
133 </xsl:template>
134
135 <xsl:template match="b">
136 <xsl:text>{\b </xsl:text>
137 <xsl:apply-templates/>
138 <xsl:text>}</xsl:text>
139 </xsl:template>
140 <xsl:template match="i">
141 <xsl:text>{\i </xsl:text>
142 <xsl:apply-templates/>
143 <xsl:text>}</xsl:text>
144 </xsl:template>
145 <xsl:template match="u">
146 <xsl:text>{\ul </xsl:text>
147 <xsl:apply-templates/>
148 <xsl:text>}</xsl:text>
149 </xsl:template>
150 <xsl:template match="strike">
151 <xsl:text>{\strike </xsl:text>
152 <xsl:apply-templates/>
153 <xsl:text>}</xsl:text>
154 </xsl:template>
155
156 <xsl:template match="kin">
157 <xsl:choose>
158 <xsl:when test="@href">
159 <xsl:call-template name="hyperref">
160 <xsl:with-param name="href" select="@href"/>
161 <xsl:with-param name="inset"><xsl:text>{\b </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
162 </xsl:call-template>
163 </xsl:when>
164 <xsl:otherwise>
165 <xsl:text>{\b </xsl:text>
166 <xsl:apply-templates/>
167 <xsl:text>}</xsl:text>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:template>
171 <xsl:template match="product">
172 <xsl:choose>
173 <xsl:when test="@href">
174 <xsl:call-template name="hyperref">
175 <xsl:with-param name="href" select="@href"/>
176 <xsl:with-param name="inset"><xsl:text>{\b\cf6 </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
177 </xsl:call-template>
178 </xsl:when>
179 <xsl:otherwise>
180 <xsl:text>{\b\cf6 </xsl:text>
181 <xsl:apply-templates/>
182 <xsl:text>}</xsl:text>
183 </xsl:otherwise>
184 </xsl:choose>
185 </xsl:template>
186 <xsl:template match="term">
187 <xsl:text>{\i </xsl:text>
188 <xsl:apply-templates/>
189 <xsl:text>}</xsl:text>
190 </xsl:template>
191
192 <xsl:template match="rfc">
193 <xsl:call-template name="hyperref">
194 <xsl:with-param name="href" select="concat('http://www.rfc-editor.org/rfc/rfc',@num,'.txt')"/>
195 <xsl:with-param name="inset" select="concat('{\b RFC',@num,'}')"/>
196 </xsl:call-template>
197 </xsl:template>
198
199 <xsl:template match="license">
200 <xsl:text>&#xA;{</xsl:text>
201 <xsl:text>&#xA;\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) </xsl:text>
202 <xsl:value-of select="@years"/>
203 <xsl:text> {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}</xsl:text>
204 <xsl:text>&#xA;\par\qj\sb120\sa120</xsl:text>
205 <xsl:text>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</xsl:text>
206 <xsl:text>&#xA;\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</xsl:text>
207 <xsl:text>&#xA;\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</xsl:text>
208 <xsl:text>&#xA;}</xsl:text>
209 </xsl:template>
210 <xsl:template match="credits">
211 <xsl:text>&#xA;\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}</xsl:text>
212 <xsl:text>&#xA;\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}</xsl:text>
213 </xsl:template>
214
215 <xsl:template match="ul">
216 <xsl:text>\pard</xsl:text>
217 <xsl:apply-templates/>
218 <xsl:text>\pard</xsl:text>
219 </xsl:template>
220 <xsl:template match="li">
221 <!-- TODO: could be done better, but you never know with winhelp.. -->
222 <xsl:variable name="li" select=" count(ancestor::ul) "/>
223 <xsl:text>&#xA;\par \fi0\li</xsl:text><xsl:value-of
224 select="0"/><xsl:text> \bullet </xsl:text>
225 <xsl:apply-templates/>
226 </xsl:template>
227
228 <xsl:template match="topic/text()">
229 <!-- maybe only omit spaces? -->
230 </xsl:template>
231 <xsl:template match="ul/text()">
232 </xsl:template>
233
234 <xsl:template name="colortbl">
235 <xsl:text>{\colortbl;
236 \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
237 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
238 \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
239 \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
240 </xsl:text>
241 </xsl:template>
242 <xsl:template name="fonttbl">
243 <xsl:text>{\fonttbl</xsl:text>
244 <xsl:text>{\f0\froman Times New Roman;}</xsl:text>
245 <xsl:text>{\f1\fswiss Arial;}</xsl:text>
246 <xsl:text>{\f3\froman Symbol;}</xsl:text>
247 <xsl:text>}</xsl:text>
248 </xsl:template>
249
250</xsl:stylesheet>
diff --git a/shared-code/ms_icmp.h b/shared-code/ms_icmp.h
new file mode 100644
index 0000000..32d97f5
--- a/dev/null
+++ b/shared-code/ms_icmp.h
@@ -0,0 +1,77 @@
1/*------------------------------------------------------------------
2* Filename: MS_ICMP.H
3*
4* Description: Prototypes of Microsoft's ICMP.DLL functions for
5* access to Internet Control Message Protocol (their stacks do
6* not support the standard Berkeley Sockets raw socket API).
7* Use this to do "ping" or "traceroute," although beware that
8* Microsoft discourages its use.
9*/
10
11
12/* Note 2: For the most part, you can refer to RFC 791 for detials on
13* how to fill in values for the IP option information structure. */
14typedef struct ip_option_information {
15 u_char Ttl; /* Time To Live (used for traceroute) */
16 u_char Tos; /* Type Of Service (usually 0) */
17 u_char Flags; /* IP header flags (usually 0) */
18 u_char OptionsSize; /* Size of options data (usually 0, max 40) */
19 u_char FAR *OptionsData;/* Options data buffer */
20 }IPINFO, *PIPINFO, FAR *LPIPINFO;
21
22/* Note 1: The Reply Buffer will have an array of ICMP_ECHO_REPLY
23* structures, followed by options and the data in ICMP echo reply
24* datagram received. You must have room for at least one ICMP
25* echo reply structure, plus 8 bytes for an ICMP header. */
26typedef struct icmp_echo_reply {
27 u_long Address; /* source address */
28 u_long Status; /* IP status value (see below) */
29 u_long RTTime; /* Round Trip Time in milliseconds */
30 u_short DataSize; /* reply data size */
31 u_short Reserved; /* */
32 void FAR *Data; /* reply data buffer */
33 typedef struct ip_option_information Options; /* reply options */
34 }ICMPECHO, *PICMPECHO, FAR *LPICMPECHO;
35
36#define IP_STATUS_BASE 11000
37#define IP_SUCCESS 0
38#define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
39#define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
40#define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3)
41#define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4)
42#define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
43#define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
44#define IP_BAD_OPTION (IP_STATUS_BASE + 7)
45#define IP_HW_ERROR (IP_STATUS_BASE + 8)
46#define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
47#define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
48#define IP_BAD_REQ (IP_STATUS_BASE + 11)
49#define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
50#define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13)
51#define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14)
52#define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15)
53#define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16)
54#define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
55#define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
56#define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
57#define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20)
58#define IP_MTU_CHANGE (IP_STATUS_BASE + 21)
59#define IP_UNLOAD (IP_STATUS_BASE + 22)
60#define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
61#define MAX_IP_STATUS IP_GENERAL_FAILURE
62#define IP_PENDING (IP_STATUS_BASE + 255)
63
64
65HANDLE WINAPI PASCAL IcmpCreateFile(VOID); /* INVALID_HANDLE_VALUE on error */
66BOOL WINAPI PASCAL IcmpCloseHandle(HANDLE IcmpHandle); /* FALSE on error */
67DWORD WINAPI PASCAL IcmpSendEcho(
68 HANDLE IcmpHandle, /* handle returned from IcmpCreateFile() */
69 u_long DestAddress, /* destination IP address (in network order) */
70 LPVOID RequestData, /* pointer to buffer to send */
71 WORD RequestSize, /* length of data in buffer */
72 LPIPINFO RequestOptns, /* see Note 2 below */
73 LPVOID ReplyBuffer, /* see Note 1 below */
74 DWORD ReplySize, /* length of reply (must allow at least 1 reply) */
75 DWORD Timeout /* time in milliseconds to wait for reply */
76);
77
diff --git a/shared-data/browse-icon.ico b/shared-data/browse-icon.ico
new file mode 100644
index 0000000..d2d1b3c
--- a/dev/null
+++ b/shared-data/browse-icon.ico
Binary files differ
diff --git a/shared-data/install-icon.ico b/shared-data/install-icon.ico
new file mode 100644
index 0000000..23e86a6
--- a/dev/null
+++ b/shared-data/install-icon.ico
Binary files differ
diff --git a/shared-data/klever-background.bmp b/shared-data/klever-background.bmp
new file mode 100644
index 0000000..e4d87ec
--- a/dev/null
+++ b/shared-data/klever-background.bmp
Binary files differ
diff --git a/shared-data/play-icon.ico b/shared-data/play-icon.ico
new file mode 100644
index 0000000..3d2a11e
--- a/dev/null
+++ b/shared-data/play-icon.ico
Binary files differ
diff --git a/stdafx.cpp b/stdafx.cpp
new file mode 100644
index 0000000..a9dae61
--- a/dev/null
+++ b/stdafx.cpp
@@ -0,0 +1,6 @@
1// stdafx.cpp : source file that includes just the standard includes
2 //BigBrother.pch will be the pre-compiled header
3 //stdafx.obj will contain the pre-compiled type information
4
5#include "stdafx.h"
6
diff --git a/stdafx.h b/stdafx.h
new file mode 100644
index 0000000..37403c2
--- a/dev/null
+++ b/stdafx.h
@@ -0,0 +1,33 @@
1// stdafx.h : include file for standard system include files,
2// or project specific include files that are used frequently, but
3// are changed infrequently
4//
5
6 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
7
8#include <afxwin.h> // MFC core and standard components
9#include <afxext.h> // MFC extensions
10#include <afxcview.h>
11#ifndef _AFX_NO_AFXCMN_SUPPORT
12 #include <afxcmn.h> // MFC support for Windows 95 Common Controls
13#endif // _AFX_NO_AFXCMN_SUPPORT
14
15 #include <afxsock.h> // MFC socket extensions
16
17#include <afxtempl.h>
18
19#include <winsock.h>
20#include "shared-code/ms_icmp.h"
21#include "shared-code/ip_icmp.h"
22#include "shared-code/kICMP.h"
23
24 enum{
25 WM_TRAYICONMESSAGE = WM_USER,
26 WM_ACTIVITYCOUNT,
27 WM_UPDATETREEBROTHER,
28 WM_CHECKQUEUE,
29 WM_BROTHERUPDOWN
30};
31#include <MMSystem.h>
32// CG: The following line was added by the Windows Multimedia component.
33#pragma comment(lib, "winmm.lib")