Initial import
authorAndreas Tonnesen <andreto@olsr.org>
Mon, 13 Sep 2004 16:43:41 +0000 (16:43 +0000)
committerAndreas Tonnesen <andreto@olsr.org>
Mon, 13 Sep 2004 16:43:41 +0000 (16:43 +0000)
37 files changed:
gui/win32/Frontend.dsw [new file with mode: 0644]
gui/win32/Frontend.ncb [new file with mode: 0644]
gui/win32/Frontend.opt [new file with mode: 0644]
gui/win32/Main/Frontend.aps [new file with mode: 0644]
gui/win32/Main/Frontend.clw [new file with mode: 0644]
gui/win32/Main/Frontend.cpp [new file with mode: 0644]
gui/win32/Main/Frontend.dsp [new file with mode: 0644]
gui/win32/Main/Frontend.h [new file with mode: 0644]
gui/win32/Main/Frontend.plg [new file with mode: 0644]
gui/win32/Main/Frontend.rc [new file with mode: 0644]
gui/win32/Main/FrontendDlg.cpp [new file with mode: 0644]
gui/win32/Main/FrontendDlg.h [new file with mode: 0644]
gui/win32/Main/HnaEntry.cpp [new file with mode: 0644]
gui/win32/Main/HnaEntry.h [new file with mode: 0644]
gui/win32/Main/Ipc.h [new file with mode: 0644]
gui/win32/Main/MidEntry.cpp [new file with mode: 0644]
gui/win32/Main/MidEntry.h [new file with mode: 0644]
gui/win32/Main/MprEntry.cpp [new file with mode: 0644]
gui/win32/Main/MprEntry.h [new file with mode: 0644]
gui/win32/Main/MyDialog1.cpp [new file with mode: 0644]
gui/win32/Main/MyDialog1.h [new file with mode: 0644]
gui/win32/Main/MyDialog2.cpp [new file with mode: 0644]
gui/win32/Main/MyDialog2.h [new file with mode: 0644]
gui/win32/Main/MyDialog3.cpp [new file with mode: 0644]
gui/win32/Main/MyDialog3.h [new file with mode: 0644]
gui/win32/Main/MyDialog4.cpp [new file with mode: 0644]
gui/win32/Main/MyDialog4.h [new file with mode: 0644]
gui/win32/Main/MyEdit.cpp [new file with mode: 0644]
gui/win32/Main/MyEdit.h [new file with mode: 0644]
gui/win32/Main/MyTabCtrl.cpp [new file with mode: 0644]
gui/win32/Main/MyTabCtrl.h [new file with mode: 0644]
gui/win32/Main/NodeEntry.cpp [new file with mode: 0644]
gui/win32/Main/NodeEntry.h [new file with mode: 0644]
gui/win32/Main/StdAfx.cpp [new file with mode: 0644]
gui/win32/Main/StdAfx.h [new file with mode: 0644]
gui/win32/Main/gnome-shutdown.png [new file with mode: 0644]
gui/win32/Main/resource.h [new file with mode: 0644]

diff --git a/gui/win32/Frontend.dsw b/gui/win32/Frontend.dsw
new file mode 100644 (file)
index 0000000..5078a71
--- /dev/null
@@ -0,0 +1,41 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r
+\r
+###############################################################################\r
+\r
+Project: "Frontend"=.\Main\Frontend.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "Shim"=.\Shim\Shim.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
diff --git a/gui/win32/Frontend.ncb b/gui/win32/Frontend.ncb
new file mode 100644 (file)
index 0000000..ef9b7f9
Binary files /dev/null and b/gui/win32/Frontend.ncb differ
diff --git a/gui/win32/Frontend.opt b/gui/win32/Frontend.opt
new file mode 100644 (file)
index 0000000..0005955
Binary files /dev/null and b/gui/win32/Frontend.opt differ
diff --git a/gui/win32/Main/Frontend.aps b/gui/win32/Main/Frontend.aps
new file mode 100644 (file)
index 0000000..c58b2ea
Binary files /dev/null and b/gui/win32/Main/Frontend.aps differ
diff --git a/gui/win32/Main/Frontend.clw b/gui/win32/Main/Frontend.clw
new file mode 100644 (file)
index 0000000..a63dea3
--- /dev/null
@@ -0,0 +1,171 @@
+; CLW file contains information for the MFC ClassWizard\r
+\r
+[General Info]\r
+Version=1\r
+LastClass=CFrontendDlg\r
+LastTemplate=CDialog\r
+NewFileInclude1=#include "stdafx.h"\r
+NewFileInclude2=#include "frontend.h"\r
+LastPage=0\r
+\r
+ClassCount=8\r
+Class1=CFrontendApp\r
+Class2=CFrontendDlg\r
+Class3=MyDialog1\r
+Class4=MyDialog2\r
+Class5=MyDialog3\r
+Class6=MyDialog4\r
+Class7=MyEdit\r
+Class8=MyTabCtrl\r
+\r
+ResourceCount=5\r
+Resource1=IDD_DIALOG3\r
+Resource2=IDD_DIALOG4\r
+Resource3=IDD_DIALOG1\r
+Resource4=IDD_DIALOG2\r
+Resource5=IDD_FRONTEND_DIALOG\r
+\r
+[CLS:CFrontendApp]\r
+Type=0\r
+BaseClass=CWinApp\r
+HeaderFile=Frontend.h\r
+ImplementationFile=Frontend.cpp\r
+LastObject=CFrontendApp\r
+\r
+[CLS:CFrontendDlg]\r
+Type=0\r
+BaseClass=CDialog\r
+HeaderFile=FrontendDlg.h\r
+ImplementationFile=FrontendDlg.cpp\r
+LastObject=CFrontendDlg\r
+\r
+[CLS:MyDialog1]\r
+Type=0\r
+BaseClass=CDialog\r
+HeaderFile=MyDialog1.h\r
+ImplementationFile=MyDialog1.cpp\r
+Filter=D\r
+LastObject=IDC_BUTTON1\r
+\r
+[CLS:MyDialog2]\r
+Type=0\r
+BaseClass=CDialog\r
+HeaderFile=MyDialog2.h\r
+ImplementationFile=MyDialog2.cpp\r
+\r
+[CLS:MyDialog3]\r
+Type=0\r
+BaseClass=CDialog\r
+HeaderFile=MyDialog3.h\r
+ImplementationFile=MyDialog3.cpp\r
+Filter=D\r
+VirtualFilter=dWC\r
+LastObject=IDC_LIST1\r
+\r
+[CLS:MyDialog4]\r
+Type=0\r
+BaseClass=CDialog\r
+HeaderFile=MyDialog4.h\r
+ImplementationFile=MyDialog4.cpp\r
+\r
+[CLS:MyEdit]\r
+Type=0\r
+BaseClass=CEdit\r
+HeaderFile=MyEdit.h\r
+ImplementationFile=MyEdit.cpp\r
+\r
+[CLS:MyTabCtrl]\r
+Type=0\r
+BaseClass=CTabCtrl\r
+HeaderFile=MyTabCtrl.h\r
+ImplementationFile=MyTabCtrl.cpp\r
+\r
+[DLG:IDD_FRONTEND_DIALOG]\r
+Type=1\r
+Class=CFrontendDlg\r
+ControlCount=4\r
+Control1=IDC_TAB1,SysTabControl32,1342177280\r
+Control2=IDC_BUTTON1,button,1342242816\r
+Control3=IDC_BUTTON2,button,1342242816\r
+Control4=IDC_BUTTON3,button,1342242816\r
+\r
+[DLG:IDD_DIALOG1]\r
+Type=1\r
+Class=MyDialog1\r
+ControlCount=5\r
+Control1=IDC_EDIT1,edit,1353783300\r
+Control2=IDC_BUTTON3,button,1342242816\r
+Control3=IDC_BUTTON2,button,1342242816\r
+Control4=IDC_BUTTON4,button,1342242816\r
+Control5=IDC_BUTTON1,button,1342242816\r
+\r
+[DLG:IDD_DIALOG2]\r
+Type=1\r
+Class=MyDialog2\r
+ControlCount=47\r
+Control1=IDC_LIST1,SysListView32,1350631427\r
+Control2=IDC_SLIDER2,msctls_trackbar32,1342242825\r
+Control3=IDC_EDIT1,edit,1350631426\r
+Control4=IDC_EDIT2,edit,1350631426\r
+Control5=IDC_EDIT3,edit,1350631426\r
+Control6=IDC_EDIT9,edit,1350631426\r
+Control7=IDC_EDIT4,edit,1350631426\r
+Control8=IDC_EDIT10,edit,1350631426\r
+Control9=IDC_EDIT5,edit,1350631426\r
+Control10=IDC_EDIT6,edit,1350631426\r
+Control11=IDC_EDIT7,edit,1350631426\r
+Control12=IDC_CHECK1,button,1342242819\r
+Control13=IDC_EDIT11,edit,1350631426\r
+Control14=IDC_EDIT12,edit,1350631426\r
+Control15=IDC_EDIT13,edit,1350631426\r
+Control16=IDC_CHECK2,button,1342242819\r
+Control17=IDC_CHECK3,button,1476460547\r
+Control18=IDC_CHECK4,button,1476460547\r
+Control19=IDC_EDIT8,edit,1352732804\r
+Control20=IDC_BUTTON4,button,1342242816\r
+Control21=IDC_BUTTON5,button,1342242816\r
+Control22=IDC_BUTTON1,button,1342242816\r
+Control23=IDC_STATIC,static,1342308352\r
+Control24=IDC_STATIC,static,1342308352\r
+Control25=IDC_STATIC,static,1342308352\r
+Control26=IDC_STATIC,static,1342308354\r
+Control27=IDC_STATIC,static,1342308354\r
+Control28=IDC_STATIC,static,1342308354\r
+Control29=IDC_STATIC,static,1342308354\r
+Control30=IDC_STATIC,static,1342308354\r
+Control31=IDC_STATIC,static,1342308354\r
+Control32=IDC_STATIC,static,1342308354\r
+Control33=IDC_STATIC,static,1342308354\r
+Control34=IDC_STATIC,static,1342308354\r
+Control35=IDC_STATIC,static,1342308352\r
+Control36=IDC_STATIC,static,1342308352\r
+Control37=IDC_STATIC,static,1342308352\r
+Control38=IDC_STATIC,static,1342308352\r
+Control39=IDC_STATIC,static,1342308352\r
+Control40=IDC_STATIC,static,1342308352\r
+Control41=IDC_STATIC,static,1342308352\r
+Control42=IDC_STATIC,static,1342308352\r
+Control43=IDC_STATIC,static,1342308352\r
+Control44=IDC_TEXT1,static,1342308353\r
+Control45=IDC_STATIC,static,1342308354\r
+Control46=IDC_STATIC,static,1342308354\r
+Control47=IDC_STATIC,static,1342308354\r
+\r
+[DLG:IDD_DIALOG3]\r
+Type=1\r
+Class=MyDialog3\r
+ControlCount=6\r
+Control1=IDC_LIST1,SysListView32,1350631429\r
+Control2=IDC_LIST4,SysListView32,1350631429\r
+Control3=IDC_LIST5,SysListView32,1350631429\r
+Control4=IDC_LIST6,SysListView32,1350631429\r
+Control5=IDC_STATIC,static,1342308352\r
+Control6=IDC_STATIC,static,1342308352\r
+\r
+[DLG:IDD_DIALOG4]\r
+Type=1\r
+Class=MyDialog4\r
+ControlCount=2\r
+Control1=IDC_LIST1,SysListView32,1350631425\r
+Control2=IDC_STATIC,static,1342308352\r
+\r
diff --git a/gui/win32/Main/Frontend.cpp b/gui/win32/Main/Frontend.cpp
new file mode 100644 (file)
index 0000000..919941f
--- /dev/null
@@ -0,0 +1,65 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "Frontend.h"\r
+#include "FrontendDlg.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+BEGIN_MESSAGE_MAP(CFrontendApp, CWinApp)\r
+       //{{AFX_MSG_MAP(CFrontendApp)\r
+       //}}AFX_MSG\r
+       ON_COMMAND(ID_HELP, CWinApp::OnHelp)\r
+END_MESSAGE_MAP()\r
+\r
+CFrontendApp::CFrontendApp()\r
+{\r
+}\r
+\r
+CFrontendApp theApp;\r
+\r
+BOOL CFrontendApp::InitInstance()\r
+{\r
+#ifdef _AFXDLL\r
+       Enable3dControls();\r
+#else\r
+       Enable3dControlsStatic();\r
+#endif\r
+\r
+       CCommandLineInfo CmdLineInfo;\r
+       ParseCommandLine(CmdLineInfo);\r
+\r
+       CFrontendDlg dlg;\r
+\r
+       dlg.ConfigFile = CmdLineInfo.m_strFileName;\r
+\r
+       m_pMainWnd = &dlg;\r
+\r
+       dlg.DoModal();\r
+\r
+       return FALSE;\r
+}\r
diff --git a/gui/win32/Main/Frontend.dsp b/gui/win32/Main/Frontend.dsp
new file mode 100644 (file)
index 0000000..3ae9003
--- /dev/null
@@ -0,0 +1,233 @@
+# Microsoft Developer Studio Project File - Name="Frontend" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Application" 0x0101\r
+\r
+CFG=Frontend - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "Frontend.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "Frontend.mak" CFG="Frontend - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "Frontend - Win32 Release" (based on "Win32 (x86) Application")\r
+!MESSAGE "Frontend - Win32 Debug" (based on "Win32 (x86) Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+MTL=midl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "Frontend - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 5\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 5\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "Release"\r
+# PROP Intermediate_Dir "Release"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c\r
+# ADD CPP /nologo /MT /W4 /GX /O1 /I "C:\Program Files\Microsoft SDK\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386\r
+# ADD LINK32 ws2_32.lib iphlpapi.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Release/Switch.exe" /libpath:"C:\Program Files\Microsoft SDK\lib"\r
+# SUBTRACT LINK32 /pdbtype:<none>\r
+\r
+!ELSEIF  "$(CFG)" == "Frontend - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 5\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 5\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "Debug"\r
+# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /GZ /c\r
+# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "C:\Program Files\Microsoft SDK\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 ws2_32.lib iphlpapi.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/Switch.exe" /pdbtype:sept /libpath:"C:\Program Files\Microsoft SDK\lib"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "Frontend - Win32 Release"\r
+# Name "Frontend - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=.\Frontend.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\Frontend.rc\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\FrontendDlg.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\HnaEntry.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MidEntry.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MprEntry.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog1.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog2.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog3.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog4.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyEdit.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyTabCtrl.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\NodeEntry.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\StdAfx.cpp\r
+# ADD CPP /Yc"stdafx.h"\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=.\Frontend.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\FrontendDlg.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\HnaEntry.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\Ipc.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MidEntry.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MprEntry.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog1.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog2.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog3.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyDialog4.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyEdit.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\MyTabCtrl.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\NodeEntry.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\Resource.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\StdAfx.h\r
+# End Source File\r
+# End Group\r
+# Begin Group "Resource Files"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# Begin Source File\r
+\r
+SOURCE=.\res\Frontend.bmp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\res\Frontend.ico\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\res\Frontend.rc2\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r
diff --git a/gui/win32/Main/Frontend.h b/gui/win32/Main/Frontend.h
new file mode 100644 (file)
index 0000000..43341ae
--- /dev/null
@@ -0,0 +1,54 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_FRONTEND_H__8033A41F_6FDC_4054_A582_AB7B6AC5EEAE__INCLUDED_)\r
+#define AFX_FRONTEND_H__8033A41F_6FDC_4054_A582_AB7B6AC5EEAE__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+#ifndef __AFXWIN_H__\r
+       #error include 'stdafx.h' before including this file for PCH\r
+#endif\r
+\r
+#include "resource.h"\r
+\r
+class CFrontendApp : public CWinApp\r
+{\r
+public:\r
+       CFrontendApp();\r
+\r
+       //{{AFX_VIRTUAL(CFrontendApp)\r
+       public:\r
+       virtual BOOL InitInstance();\r
+       //}}AFX_VIRTUAL\r
+\r
+       //{{AFX_MSG(CFrontendApp)\r
+       //}}AFX_MSG\r
+       DECLARE_MESSAGE_MAP()\r
+};\r
+\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/Frontend.plg b/gui/win32/Main/Frontend.plg
new file mode 100644 (file)
index 0000000..51e5978
--- /dev/null
@@ -0,0 +1,107 @@
+<html>\r
+<body>\r
+<pre>\r
+<h1>Build Log</h1>\r
+<h3>\r
+--------------------Configuration: Frontend - Win32 Release--------------------\r
+</h3>\r
+<h3>Command Lines</h3>\r
+Creating command line "rc.exe /l 0x409 /fo"Release/Frontend.res" /d "NDEBUG" "C:\Home\Frontend\Main\Frontend.rc"" \r
+Creating temporary file "C:\Temp\RSP120.tmp" with contents\r
+[\r
+/nologo /MT /W4 /GX /O1 /I "C:\Program Files\Microsoft SDK\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Release/Frontend.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c \r
+"C:\Home\Frontend\Main\Frontend.cpp"\r
+"C:\Home\Frontend\Main\FrontendDlg.cpp"\r
+"C:\Home\Frontend\Main\HnaEntry.cpp"\r
+"C:\Home\Frontend\Main\MidEntry.cpp"\r
+"C:\Home\Frontend\Main\MprEntry.cpp"\r
+"C:\Home\Frontend\Main\MyDialog1.cpp"\r
+"C:\Home\Frontend\Main\MyDialog2.cpp"\r
+"C:\Home\Frontend\Main\MyDialog3.cpp"\r
+"C:\Home\Frontend\Main\MyDialog4.cpp"\r
+"C:\Home\Frontend\Main\MyEdit.cpp"\r
+"C:\Home\Frontend\Main\MyTabCtrl.cpp"\r
+"C:\Home\Frontend\Main\NodeEntry.cpp"\r
+]\r
+Creating command line "cl.exe @C:\Temp\RSP120.tmp" \r
+Creating temporary file "C:\Temp\RSP121.tmp" with contents\r
+[\r
+/nologo /MT /W4 /GX /O1 /I "C:\Program Files\Microsoft SDK\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Release/Frontend.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c \r
+"C:\Home\Frontend\Main\StdAfx.cpp"\r
+]\r
+Creating command line "cl.exe @C:\Temp\RSP121.tmp" \r
+Creating temporary file "C:\Temp\RSP122.tmp" with contents\r
+[\r
+ws2_32.lib iphlpapi.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/Switch.pdb" /debug /machine:I386 /out:"Release/Switch.exe" /libpath:"C:\Program Files\Microsoft SDK\lib" \r
+.\Release\Frontend.obj\r
+.\Release\FrontendDlg.obj\r
+.\Release\HnaEntry.obj\r
+.\Release\MidEntry.obj\r
+.\Release\MprEntry.obj\r
+.\Release\MyDialog1.obj\r
+.\Release\MyDialog2.obj\r
+.\Release\MyDialog3.obj\r
+.\Release\MyDialog4.obj\r
+.\Release\MyEdit.obj\r
+.\Release\MyTabCtrl.obj\r
+.\Release\NodeEntry.obj\r
+.\Release\StdAfx.obj\r
+.\Release\Frontend.res\r
+]\r
+Creating command line "link.exe @C:\Temp\RSP122.tmp"\r
+<h3>Output Window</h3>\r
+Compiling resources...\r
+Compiling...\r
+StdAfx.cpp\r
+Compiling...\r
+Frontend.cpp\r
+FrontendDlg.cpp\r
+C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxtempl.h(1566) : warning C4505: 'HexDump' : unreferenced local function has been removed\r
+        C:\Home\Frontend\Main\FrontendDlg.cpp(64) : see declaration of 'HexDump'\r
+HnaEntry.cpp\r
+MidEntry.cpp\r
+MprEntry.cpp\r
+MyDialog1.cpp\r
+MyDialog2.cpp\r
+MyDialog3.cpp\r
+C:\Home\Frontend\Main\MyDialog3.cpp(254) : warning C4100: 'pNMHDR' : unreferenced formal parameter\r
+MyDialog4.cpp\r
+MyEdit.cpp\r
+MyTabCtrl.cpp\r
+NodeEntry.cpp\r
+Generating Code...\r
+Linking...\r
+\r
+\r
+\r
+<h3>Results</h3>\r
+Switch.exe - 0 error(s), 2 warning(s)\r
+<h3>\r
+--------------------Configuration: Shim - Win32 Release--------------------\r
+</h3>\r
+<h3>Command Lines</h3>\r
+Creating temporary file "C:\Temp\RSP124.tmp" with contents\r
+[\r
+/nologo /MT /W4 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/Shim.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c \r
+"C:\Home\Frontend\Shim\shim.c"\r
+]\r
+Creating command line "cl.exe @C:\Temp\RSP124.tmp" \r
+Creating temporary file "C:\Temp\RSP125.tmp" with contents\r
+[\r
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 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 /entry:"EntryPoint" /subsystem:console /incremental:no /pdb:"Release/Shim.pdb" /debug /machine:I386 /nodefaultlib /out:"Release/Shim.exe" \r
+.\Release\shim.obj\r
+]\r
+Creating command line "link.exe @C:\Temp\RSP125.tmp"\r
+<h3>Output Window</h3>\r
+Compiling...\r
+shim.c\r
+C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\rpcasync.h(45) : warning C4115: '_RPC_ASYNC_STATE' : named type definition in parentheses\r
+Linking...\r
+\r
+\r
+\r
+<h3>Results</h3>\r
+Shim.exe - 0 error(s), 1 warning(s)\r
+</pre>\r
+</body>\r
+</html>\r
diff --git a/gui/win32/Main/Frontend.rc b/gui/win32/Main/Frontend.rc
new file mode 100644 (file)
index 0000000..1fe7792
--- /dev/null
@@ -0,0 +1,262 @@
+//Microsoft Developer Studio generated resource script.\r
+//\r
+#include "resource.h"\r
+\r
+#define APSTUDIO_READONLY_SYMBOLS\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Generated from the TEXTINCLUDE 2 resource.\r
+//\r
+#include "afxres.h"\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+#undef APSTUDIO_READONLY_SYMBOLS\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+// English (U.S.) resources\r
+\r
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
+#ifdef _WIN32\r
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r
+#pragma code_page(1252)\r
+#endif //_WIN32\r
+\r
+#ifdef APSTUDIO_INVOKED\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// TEXTINCLUDE\r
+//\r
+\r
+1 TEXTINCLUDE DISCARDABLE \r
+BEGIN\r
+    "resource.h\0"\r
+END\r
+\r
+2 TEXTINCLUDE DISCARDABLE \r
+BEGIN\r
+    "#include ""afxres.h""\r\n"\r
+    "\0"\r
+END\r
+\r
+3 TEXTINCLUDE DISCARDABLE \r
+BEGIN\r
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"\r
+    "#define _AFX_NO_OLE_RESOURCES\r\n"\r
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"\r
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"\r
+    "\r\n"\r
+    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"\r
+    "#ifdef _WIN32\r\n"\r
+    "LANGUAGE 9, 1\r\n"\r
+    "#pragma code_page(1252)\r\n"\r
+    "#endif //_WIN32\r\n"\r
+    "#include ""res\\Frontend.rc2""  // non-Microsoft Visual C++ edited resources\r\n"\r
+    "#include ""afxres.rc""         // Standard components\r\n"\r
+    "#endif\r\n"\r
+    "\0"\r
+END\r
+\r
+#endif    // APSTUDIO_INVOKED\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Dialog\r
+//\r
+\r
+IDD_FRONTEND_DIALOG DIALOGEX 0, 0, 399, 289\r
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
+EXSTYLE WS_EX_APPWINDOW\r
+CAPTION "olsr.org Switch 0.4.6"\r
+FONT 8, "MS Sans Serif"\r
+BEGIN\r
+    CONTROL         "Tab1",IDC_TAB1,"SysTabControl32",0x0,7,7,383,256\r
+    PUSHBUTTON      "Start",IDC_BUTTON1,228,268,50,14\r
+    PUSHBUTTON      "Stop",IDC_BUTTON2,284,268,50,14\r
+    PUSHBUTTON      "Exit",IDC_BUTTON3,340,268,50,14\r
+END\r
+\r
+IDD_DIALOG1 DIALOG DISCARDABLE  0, 0, 377, 240\r
+STYLE WS_CHILD | WS_VISIBLE\r
+FONT 8, "MS Sans Serif"\r
+BEGIN\r
+    EDITTEXT        IDC_EDIT1,7,25,363,208,ES_MULTILINE | ES_READONLY | \r
+                    ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL\r
+    PUSHBUTTON      "Freeze",IDC_BUTTON3,152,7,50,14\r
+    PUSHBUTTON      "Continue",IDC_BUTTON2,208,7,50,14\r
+    PUSHBUTTON      "Save",IDC_BUTTON4,264,7,50,14\r
+    PUSHBUTTON      "Clear",IDC_BUTTON1,320,7,50,14\r
+END\r
+\r
+IDD_DIALOG2 DIALOG DISCARDABLE  0, 0, 377, 240\r
+STYLE WS_CHILD | WS_VISIBLE\r
+FONT 8, "MS Sans Serif"\r
+BEGIN\r
+    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_LIST | WS_BORDER | \r
+                    WS_TABSTOP,7,19,103,76\r
+    CONTROL         "Slider2",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | \r
+                    TBS_BOTH | WS_TABSTOP,8,116,87,26\r
+    EDITTEXT        IDC_EDIT1,189,7,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT2,299,7,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT3,189,23,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT9,299,23,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT4,189,39,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT10,299,39,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT5,189,55,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT6,299,55,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT7,189,71,26,12,ES_RIGHT\r
+    CONTROL         "Use hysteresis",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | \r
+                    WS_TABSTOP,134,89,60,10\r
+    EDITTEXT        IDC_EDIT11,189,102,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT12,189,119,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT13,189,135,26,12,ES_RIGHT\r
+    CONTROL         "Offer Internet connection",IDC_CHECK2,"Button",\r
+                    BS_AUTOCHECKBOX | WS_TABSTOP,253,89,93,10\r
+    CONTROL         "Enable IP version 6",IDC_CHECK3,"Button",\r
+                    BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,253,105,93,10\r
+    CONTROL         "Allow gateway tunneling",IDC_CHECK4,"Button",\r
+                    BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,253,121,93,10\r
+    EDITTEXT        IDC_EDIT8,7,164,363,47,ES_MULTILINE | ES_AUTOHSCROLL | \r
+                    ES_WANTRETURN | WS_VSCROLL\r
+    PUSHBUTTON      "Open",IDC_BUTTON4,210,219,50,14\r
+    PUSHBUTTON      "Save",IDC_BUTTON5,265,219,50,14\r
+    PUSHBUTTON      "Reset",IDC_BUTTON1,320,219,50,14\r
+    LTEXT           "Interface list",IDC_STATIC,7,8,39,8\r
+    LTEXT           "Debug level",IDC_STATIC,7,105,39,8\r
+    LTEXT           "Manual additions",IDC_STATIC,7,153,54,8\r
+    RTEXT           "HELLO interval:",IDC_STATIC,132,9,51,8\r
+    RTEXT           "HELLO hold:",IDC_STATIC,251,9,42,8\r
+    RTEXT           "MID interval:",IDC_STATIC,132,25,41,8\r
+    RTEXT           "MID hold:",IDC_STATIC,251,25,32,8\r
+    RTEXT           "HNA interval:",IDC_STATIC,132,41,43,8\r
+    RTEXT           "HNA hold:",IDC_STATIC,251,41,34,8\r
+    RTEXT           "TC interval:",IDC_STATIC,132,57,37,8\r
+    RTEXT           "TC hold:",IDC_STATIC,251,57,28,8\r
+    RTEXT           "Poll interval:",IDC_STATIC,132,73,39,8\r
+    LTEXT           "sec",IDC_STATIC,219,9,12,8\r
+    LTEXT           "x",IDC_STATIC,329,9,8,8\r
+    LTEXT           "sec",IDC_STATIC,219,25,12,8\r
+    LTEXT           "x",IDC_STATIC,329,25,8,8\r
+    LTEXT           "sec",IDC_STATIC,219,41,12,8\r
+    LTEXT           "x",IDC_STATIC,329,41,8,8\r
+    LTEXT           "sec",IDC_STATIC,219,57,12,8\r
+    LTEXT           "x",IDC_STATIC,329,57,8,8\r
+    LTEXT           "sec",IDC_STATIC,219,73,12,8\r
+    CTEXT           "0",IDC_TEXT1,96,123,11,8\r
+    RTEXT           "Scaling:",IDC_STATIC,132,105,26,8\r
+    RTEXT           "Low threshold:",IDC_STATIC,131,121,47,8\r
+    RTEXT           "High threshold:",IDC_STATIC,131,137,48,8\r
+END\r
+\r
+IDD_DIALOG3 DIALOG DISCARDABLE  0, 0, 377, 240\r
+STYLE WS_CHILD | WS_VISIBLE\r
+FONT 8, "MS Sans Serif"\r
+BEGIN\r
+    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_REPORT | \r
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,18,239,215\r
+    CONTROL         "List4",IDC_LIST4,"SysListView32",LVS_REPORT | \r
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,18,115,66\r
+    CONTROL         "List4",IDC_LIST5,"SysListView32",LVS_REPORT | \r
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,92,115,66\r
+    CONTROL         "List4",IDC_LIST6,"SysListView32",LVS_REPORT | \r
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,167,115,66\r
+    LTEXT           "Node list",IDC_STATIC,7,7,32,8\r
+    LTEXT           "Node information",IDC_STATIC,257,7,59,8\r
+END\r
+\r
+IDD_DIALOG4 DIALOG DISCARDABLE  0, 0, 377, 240\r
+STYLE WS_CHILD | WS_VISIBLE\r
+FONT 8, "MS Sans Serif"\r
+BEGIN\r
+    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER | \r
+                    WS_TABSTOP,7,18,363,215\r
+    LTEXT           "Routing table",IDC_STATIC,7,7,48,8\r
+END\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// DESIGNINFO\r
+//\r
+\r
+#ifdef APSTUDIO_INVOKED\r
+GUIDELINES DESIGNINFO DISCARDABLE \r
+BEGIN\r
+    IDD_FRONTEND_DIALOG, DIALOG\r
+    BEGIN\r
+        LEFTMARGIN, 7\r
+        RIGHTMARGIN, 390\r
+        TOPMARGIN, 7\r
+        BOTTOMMARGIN, 282\r
+    END\r
+\r
+    IDD_DIALOG1, DIALOG\r
+    BEGIN\r
+        LEFTMARGIN, 7\r
+        RIGHTMARGIN, 370\r
+        TOPMARGIN, 7\r
+        BOTTOMMARGIN, 233\r
+    END\r
+\r
+    IDD_DIALOG2, DIALOG\r
+    BEGIN\r
+        LEFTMARGIN, 7\r
+        RIGHTMARGIN, 370\r
+        TOPMARGIN, 6\r
+        BOTTOMMARGIN, 233\r
+    END\r
+\r
+    IDD_DIALOG3, DIALOG\r
+    BEGIN\r
+        LEFTMARGIN, 7\r
+        RIGHTMARGIN, 370\r
+        TOPMARGIN, 7\r
+        BOTTOMMARGIN, 233\r
+    END\r
+\r
+    IDD_DIALOG4, DIALOG\r
+    BEGIN\r
+        LEFTMARGIN, 7\r
+        RIGHTMARGIN, 370\r
+        TOPMARGIN, 7\r
+        BOTTOMMARGIN, 233\r
+    END\r
+END\r
+#endif    // APSTUDIO_INVOKED\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Icon\r
+//\r
+\r
+// Icon with lowest ID value placed first to ensure application icon\r
+// remains consistent on all systems.\r
+IDI_ICON1               ICON    DISCARDABLE     "res\\Frontend.ico"\r
+#endif    // English (U.S.) resources\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+\r
+\r
+#ifndef APSTUDIO_INVOKED\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Generated from the TEXTINCLUDE 3 resource.\r
+//\r
+#define _AFX_NO_SPLITTER_RESOURCES\r
+#define _AFX_NO_OLE_RESOURCES\r
+#define _AFX_NO_TRACKER_RESOURCES\r
+#define _AFX_NO_PROPERTY_RESOURCES\r
+\r
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
+#ifdef _WIN32\r
+LANGUAGE 9, 1\r
+#pragma code_page(1252)\r
+#endif //_WIN32\r
+#include "res\Frontend.rc2"  // non-Microsoft Visual C++ edited resources\r
+#include "afxres.rc"         // Standard components\r
+#endif\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+#endif    // not APSTUDIO_INVOKED\r
+\r
diff --git a/gui/win32/Main/FrontendDlg.cpp b/gui/win32/Main/FrontendDlg.cpp
new file mode 100644 (file)
index 0000000..5af9f10
--- /dev/null
@@ -0,0 +1,938 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "Frontend.h"\r
+#include "FrontendDlg.h"\r
+\r
+#include "Ipc.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+CFrontendDlg::CFrontendDlg(CWnd* pParent)\r
+       : CDialog(CFrontendDlg::IDD, pParent)\r
+{\r
+       //{{AFX_DATA_INIT(CFrontendDlg)\r
+       //}}AFX_DATA_INIT\r
+\r
+       Event = CreateEvent(NULL, FALSE, FALSE, "TheOlsrdShimEvent");\r
+}\r
+\r
+void CFrontendDlg::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       //{{AFX_DATA_MAP(CFrontendDlg)\r
+       DDX_Control(pDX, IDC_BUTTON2, m_StopButton);\r
+       DDX_Control(pDX, IDC_BUTTON1, m_StartButton);\r
+       DDX_Control(pDX, IDC_TAB1, m_TabCtrl);\r
+       //}}AFX_DATA_MAP\r
+}\r
+\r
+BEGIN_MESSAGE_MAP(CFrontendDlg, CDialog)\r
+       //{{AFX_MSG_MAP(CFrontendDlg)\r
+       ON_BN_CLICKED(IDC_BUTTON1, OnStartButton)\r
+       ON_BN_CLICKED(IDC_BUTTON2, OnStopButton)\r
+       ON_BN_CLICKED(IDC_BUTTON3, OnExitButton)\r
+       ON_BN_CLICKED(IDOK, OnOK)\r
+       ON_BN_CLICKED(IDCANCEL, OnCancel)\r
+       //}}AFX_MSG_MAP\r
+END_MESSAGE_MAP()\r
+\r
+static void HexDump(unsigned char *Mem, int Len)\r
+{\r
+       char Buff[10000];\r
+       int i, k;\r
+       char *Walker = Buff;\r
+\r
+       for (i = 0; i < Len; i += k)\r
+       {\r
+               Walker += sprintf(Walker, "%08x:", i);\r
+\r
+               for (k = 0; i + k < Len && k < 16; k++)\r
+                       Walker += sprintf(Walker, " %02x", Mem[i + k]);\r
+\r
+               while (k < 16)\r
+               {\r
+                       Walker += sprintf(Walker, "   ");\r
+                       k++;\r
+               }\r
+\r
+               Walker += sprintf(Walker, " ");\r
+\r
+               for (k = 0; i + k < Len && k < 16; k++)\r
+                       if (Mem[i + k] < 32 || Mem[i + k] > 126)\r
+                               Walker += sprintf(Walker, ".");\r
+\r
+                       else\r
+                               Walker += sprintf(Walker, "%c", Mem[i + k]);\r
+\r
+               Walker += sprintf(Walker, "\r\n");\r
+       }\r
+\r
+       ::MessageBox(NULL, Buff, "HEXDUMP", MB_OK);\r
+}\r
+\r
+// XXX - pretty inefficient\r
+\r
+void CFrontendDlg::Timeout(void)\r
+{\r
+       POSITION Pos, Pos2;\r
+       class NodeEntry Entry;\r
+       class MprEntry MprEntry;\r
+       class MidEntry MidEntry;\r
+       class HnaEntry HnaEntry;\r
+\r
+Restart0:\r
+       Pos = NodeList.GetHeadPosition();\r
+\r
+       while (Pos != NULL)\r
+       {\r
+               Entry = NodeList.GetAt(Pos);\r
+\r
+               if (Entry.Timeout < Now)\r
+               {\r
+                       NodeList.RemoveAt(Pos);\r
+                       goto Restart0;\r
+               }\r
+\r
+Restart1:\r
+               Pos2 = Entry.MprList.GetHeadPosition();\r
+\r
+               while (Pos2 != NULL)\r
+               {\r
+                       MprEntry = Entry.MprList.GetAt(Pos2);\r
+\r
+                       if (MprEntry.Timeout < Now)\r
+                       {\r
+                               Entry.MprList.RemoveAt(Pos2);\r
+                               goto Restart1;\r
+                       }\r
+\r
+                       Entry.MprList.GetNext(Pos2);\r
+               }\r
+\r
+Restart2:\r
+               Pos2 = Entry.MidList.GetHeadPosition();\r
+\r
+               while (Pos2 != NULL)\r
+               {\r
+                       MidEntry = Entry.MidList.GetAt(Pos2);\r
+\r
+                       if (MidEntry.Timeout < Now)\r
+                       {\r
+                               Entry.MidList.RemoveAt(Pos2);\r
+                               goto Restart2;\r
+                       }\r
+\r
+                       Entry.MidList.GetNext(Pos2);\r
+               }\r
+\r
+Restart3:\r
+               Pos2 = Entry.HnaList.GetHeadPosition();\r
+\r
+               while (Pos2 != NULL)\r
+               {\r
+                       HnaEntry = Entry.HnaList.GetNext(Pos2);\r
+\r
+                       if (HnaEntry.Timeout < Now)\r
+                       {\r
+                               Entry.HnaList.RemoveAt(Pos2);\r
+                               goto Restart3;\r
+                       }\r
+\r
+                       Entry.HnaList.GetNext(Pos2);\r
+               }\r
+\r
+               NodeList.GetNext(Pos);\r
+       }\r
+\r
+       m_TabCtrl.m_Dialog3.UpdateNodeInfo(NodeList);\r
+}\r
+\r
+unsigned int VTimeToInt(unsigned int VTime)\r
+{\r
+       return ((0x10 | ((VTime & 0xf0) >> 4)) << (VTime & 0x0f)) >> 8;\r
+}\r
+\r
+void CFrontendDlg::AddMpr(unsigned int MprAddr, unsigned int NodeAddr,\r
+                                                 unsigned int VTime)\r
+{\r
+       class NodeEntry NewEntry;\r
+       POSITION Pos;\r
+       unsigned __int64 Timeout;\r
+\r
+       Timeout = Now +\r
+               (unsigned __int64)VTimeToInt(VTime) * (unsigned __int64)10000000;\r
+\r
+       AddNode(NodeAddr, VTime);\r
+       AddNode(MprAddr, VTime);\r
+\r
+       NewEntry.Addr = NodeAddr;\r
+\r
+       Pos = NodeList.Find(NewEntry);\r
+\r
+       if (Pos == NULL)\r
+               return;\r
+\r
+       class NodeEntry &OldEntry = NodeList.GetAt(Pos);\r
+\r
+       OldEntry.AddMpr(MprAddr, Timeout);\r
+\r
+       m_TabCtrl.m_Dialog3.UpdateNodeInfo(NodeList);\r
+}\r
+\r
+void CFrontendDlg::AddMid(unsigned int IntAddr, unsigned int NodeAddr,\r
+                                                 unsigned int VTime)\r
+{\r
+       class NodeEntry NewEntry;\r
+       POSITION Pos;\r
+       unsigned __int64 Timeout;\r
+\r
+       Timeout = Now +\r
+               (unsigned __int64)VTimeToInt(VTime) * (unsigned __int64)10000000;\r
+\r
+       AddNode(NodeAddr, VTime);\r
+\r
+       NewEntry.Addr = NodeAddr;\r
+\r
+       Pos = NodeList.Find(NewEntry);\r
+\r
+       if (Pos == NULL)\r
+               return;\r
+\r
+       class NodeEntry &OldEntry = NodeList.GetAt(Pos);\r
+\r
+       OldEntry.AddMid(IntAddr, Timeout);\r
+\r
+       m_TabCtrl.m_Dialog3.UpdateNodeInfo(NodeList);\r
+}\r
+\r
+void CFrontendDlg::AddHna(unsigned int NetAddr, unsigned int NetMask,\r
+                                                 unsigned int NodeAddr, unsigned int VTime)\r
+{\r
+       class NodeEntry NewEntry;\r
+       POSITION Pos;\r
+       unsigned __int64 Timeout;\r
+\r
+       Timeout = Now +\r
+               (unsigned __int64)VTimeToInt(VTime) * (unsigned __int64)10000000;\r
+\r
+       AddNode(NodeAddr, VTime);\r
+\r
+       NewEntry.Addr = NodeAddr;\r
+\r
+       Pos = NodeList.Find(NewEntry);\r
+\r
+       if (Pos == NULL)\r
+               return;\r
+\r
+       class NodeEntry &OldEntry = NodeList.GetAt(Pos);\r
+\r
+       OldEntry.AddHna(NetAddr, NetMask, Timeout);\r
+\r
+       m_TabCtrl.m_Dialog3.UpdateNodeInfo(NodeList);\r
+}\r
+\r
+void CFrontendDlg::AddNode(unsigned int NodeAddr, unsigned int VTime)\r
+{\r
+       class NodeEntry NewEntry;\r
+       POSITION Pos;\r
+       unsigned __int64 Timeout;\r
+\r
+       if (NodeAddr == LocalHost)\r
+               return;\r
+\r
+       Timeout = Now +\r
+               (unsigned __int64)VTimeToInt(VTime) * (unsigned __int64)10000000;\r
+\r
+       NewEntry.Addr = NodeAddr;\r
+\r
+       Pos = NodeList.Find(NewEntry);\r
+\r
+       if (Pos != NULL)\r
+       {\r
+               class NodeEntry &OldEntry = NodeList.GetAt(Pos);\r
+               OldEntry.Timeout = Timeout;\r
+       }\r
+\r
+       else\r
+       {\r
+               NewEntry.Timeout = Timeout;\r
+               NodeList.AddTail(NewEntry);\r
+       }\r
+\r
+       m_TabCtrl.m_Dialog3.UpdateNodeInfo(NodeList);\r
+}\r
+\r
+void CFrontendDlg::HandleOlsrTc(struct OlsrTc *Msg)\r
+{\r
+       int Size;\r
+       unsigned int *Addr;\r
+\r
+       Msg->Header.SeqNo = ::ntohs(Msg->Header.SeqNo);\r
+       Msg->Ansn = ::ntohs(Msg->Ansn);\r
+\r
+       AddNode(Msg->Header.Orig, Msg->Header.VTime);\r
+\r
+       Size = Msg->Header.Size;\r
+\r
+       Size -= sizeof (struct OlsrTc);\r
+\r
+       Addr = (unsigned int *)(Msg + 1);\r
+\r
+       while (Size > 0)\r
+       {\r
+               Size -= 4;\r
+\r
+               AddMpr(*Addr, Msg->Header.Orig, Msg->Header.VTime);\r
+\r
+               Addr++;\r
+       }\r
+}\r
+\r
+void CFrontendDlg::HandleOlsrMid(struct OlsrHeader *Msg)\r
+{\r
+       int Size;\r
+       unsigned int *Addr;\r
+\r
+       Msg->SeqNo = ::ntohs(Msg->SeqNo);\r
+\r
+       AddNode(Msg->Orig, Msg->VTime);\r
+\r
+       Size = Msg->Size;\r
+\r
+       Size -= sizeof (struct OlsrHeader);\r
+\r
+       Addr = (unsigned int *)(Msg + 1);\r
+\r
+       while (Size > 0)\r
+       {\r
+               Size -= 4;\r
+\r
+               AddMid(*Addr, Msg->Orig, Msg->VTime);\r
+\r
+               Addr++;\r
+       }\r
+}\r
+\r
+void CFrontendDlg::HandleOlsrHna(struct OlsrHeader *Msg)\r
+{\r
+       int Size;\r
+       unsigned int *Addr;\r
+\r
+       Msg->SeqNo = ::ntohs(Msg->SeqNo);\r
+\r
+       AddNode(Msg->Orig, Msg->VTime);\r
+\r
+       Size = Msg->Size;\r
+\r
+       Size -= sizeof (struct OlsrHeader);\r
+\r
+       Addr = (unsigned int *)(Msg + 1);\r
+\r
+       while (Size > 0)\r
+       {\r
+               Size -= 8;\r
+\r
+               AddHna(Addr[0], Addr[1], Msg->Orig, Msg->VTime);\r
+\r
+               Addr += 2;\r
+       }\r
+}\r
+\r
+void CFrontendDlg::HandleOlsrHello(struct OlsrHello *Msg)\r
+{\r
+       int Size, LinkSize;\r
+       struct OlsrHelloLink *Link;\r
+       unsigned int *Addr;\r
+\r
+       Msg->Header.SeqNo = ::ntohs(Msg->Header.SeqNo);\r
+\r
+       AddNode(Msg->Header.Orig, Msg->Header.VTime);\r
+\r
+       Size = Msg->Header.Size;\r
+\r
+       Size -= sizeof (struct OlsrHello);\r
+\r
+       Link = (struct OlsrHelloLink *)(Msg + 1);\r
+\r
+       while (Size > 0)\r
+       {\r
+               Link->Size = ::ntohs(Link->Size);\r
+\r
+               LinkSize = Link->Size;\r
+\r
+               Size -= LinkSize;\r
+\r
+               LinkSize -= sizeof (struct OlsrHelloLink);\r
+\r
+               Addr = (unsigned int *)(Link + 1);\r
+\r
+               while (LinkSize > 0)\r
+               {\r
+                       LinkSize -= 4;\r
+\r
+                       AddNode(*Addr, Msg->Header.VTime);\r
+\r
+                       if ((Link->LinkCode & 0x0c) == 0x08)\r
+                               AddMpr(*Addr, Msg->Header.Orig, Msg->Header.VTime);\r
+\r
+                       Addr++;\r
+               }\r
+\r
+               Link = (struct OlsrHelloLink *)Addr;\r
+       }\r
+}\r
+\r
+void CFrontendDlg::HandleIpcRoute(struct IpcRoute *Msg)\r
+{\r
+       if (Msg->Header.Size != sizeof (struct IpcRoute))\r
+               return;\r
+\r
+       if (Msg->Add == 0)\r
+               m_TabCtrl.m_Dialog4.DeleteRoute(Msg->Dest.v4);\r
+\r
+       else\r
+               m_TabCtrl.m_Dialog4.AddRoute(Msg->Dest.v4, Msg->Gate.v4, Msg->Metric,\r
+               Msg->Int);\r
+}\r
+\r
+void CFrontendDlg::HandleIpcConfig(struct IpcConfig *Msg)\r
+{\r
+       if (Msg->Header.Size != sizeof (struct IpcConfig))\r
+               return;\r
+\r
+       Msg->HelloInt = ::ntohs(Msg->HelloInt);\r
+       Msg->WiredHelloInt = ::ntohs(Msg->WiredHelloInt);\r
+       Msg->TcInt = ::ntohs(Msg->TcInt);\r
+\r
+       Msg->HelloHold = ::ntohs(Msg->HelloHold);\r
+       Msg->TcHold = ::ntohs(Msg->TcHold);\r
+\r
+       LocalHost = Msg->MainAddr.v4;\r
+}\r
+\r
+static int FullRead(SOCKET SockHand, char *Buff, int Len)\r
+{\r
+       int Res;\r
+\r
+       do\r
+       {\r
+               Res = ::recv(SockHand, Buff, Len, 0);\r
+\r
+               if (Res <= 0)\r
+                       return -1;\r
+\r
+               Len -= Res;\r
+               Buff += Res;\r
+       }\r
+       while (Len > 0);\r
+\r
+       return 0;\r
+}\r
+\r
+// XXX - we should have access to olsrd's internal data structures instead\r
+\r
+unsigned int CFrontendDlg::NetThreadFunc(void)\r
+{\r
+       struct IpcHeader Header;\r
+       int Res;\r
+       char *Msg;\r
+\r
+       for (;;)\r
+       {\r
+               Res = FullRead(SockHand, (char *)&Header, sizeof (struct IpcHeader));\r
+\r
+               if (Res < 0)\r
+                       break;\r
+\r
+               Header.Size = ntohs(Header.Size);\r
+\r
+               Msg = new char [Header.Size];\r
+\r
+               ::memcpy(Msg, &Header, sizeof (struct IpcHeader));\r
+\r
+               Res = FullRead(SockHand, Msg + sizeof (struct IpcHeader),\r
+                       Header.Size - sizeof (struct IpcHeader));\r
+\r
+               if (Res < 0)\r
+                       break;\r
+\r
+               SYSTEMTIME SysTime;\r
+               FILETIME FileTime;\r
+\r
+               ::GetSystemTime(&SysTime);\r
+               ::SystemTimeToFileTime(&SysTime, &FileTime);\r
+\r
+               Now = *(unsigned __int64 *)&FileTime;\r
+\r
+               switch (Header.Type)\r
+               {\r
+               case MSG_TYPE_IPC_ROUTE:\r
+                       HandleIpcRoute((struct IpcRoute *)Msg);\r
+                       break;\r
+\r
+               case MSG_TYPE_IPC_CONFIG:\r
+                       HandleIpcConfig((struct IpcConfig *)Msg);\r
+                       break;\r
+\r
+               case MSG_TYPE_OLSR_HELLO:\r
+                       HandleOlsrHello((struct OlsrHello *)Msg);\r
+                       break;\r
+\r
+               case MSG_TYPE_OLSR_TC:\r
+                       HandleOlsrTc((struct OlsrTc *)Msg);\r
+                       break;\r
+\r
+               case MSG_TYPE_OLSR_MID:\r
+                       HandleOlsrMid((struct OlsrHeader *)Msg);\r
+                       break;\r
+\r
+               case MSG_TYPE_OLSR_HNA:\r
+                       HandleOlsrHna((struct OlsrHeader *)Msg);\r
+                       break;\r
+               }\r
+\r
+               delete[] Msg;\r
+\r
+               // XXX - nodes are only timed out while messages keep coming in\r
+\r
+               Timeout();\r
+       }\r
+\r
+       AfxEndThread(0);\r
+       return 0;\r
+}\r
+\r
+unsigned int CFrontendDlg::LogThreadFunc(void)\r
+{\r
+       char Buff[1000];\r
+       int Len;\r
+       int Left, Right;\r
+       CString Line;\r
+       CString Int;\r
+\r
+       while (::ReadFile(OutRead, Buff, sizeof (Buff) - 1, (unsigned long *)&Len, NULL))\r
+       {\r
+               if (Len == 0)\r
+                       break;\r
+\r
+               Left = 0;\r
+\r
+               for (Right = 0; Right < Len; Right++)\r
+               {\r
+                       if (Buff[Right] != 13)\r
+                               Buff[Left++] = Buff[Right];\r
+               }\r
+\r
+               Len = Left;\r
+\r
+               Left = 0;\r
+\r
+               for (Right = 0; Right < Len; Right++)\r
+               {\r
+                       if (Buff[Right] == 10)\r
+                       {\r
+                               Buff[Right] = 0;\r
+                               Line += (Buff + Left);\r
+\r
+                               if (PipeMode == PIPE_MODE_RUN)\r
+                                       m_TabCtrl.m_Dialog1.AddOutputLine(Line);\r
+\r
+                               else if (Line.GetLength() > 6 && Line[0] == 'i' && Line[1] == 'f')\r
+                               {\r
+                                       Int = Line.Mid(0, 4);\r
+                                       Int.MakeUpper();\r
+\r
+                                       Interfaces.Add(Int);\r
+                                       Addresses.Add(Line.Mid(6));\r
+                               }\r
+\r
+                               Line.Empty();\r
+\r
+                               Left = Right + 1;\r
+                       }\r
+               }\r
+\r
+               Buff[Right] = 0;\r
+               Line += (Buff + Left);\r
+       }\r
+\r
+       if (PipeMode == PIPE_MODE_RUN)\r
+       {\r
+               m_StopButton.EnableWindow(FALSE);\r
+               m_StartButton.EnableWindow(TRUE);\r
+       }\r
+\r
+       AfxEndThread(0);\r
+       return 0;\r
+}\r
+\r
+static unsigned int LogThreadStub(void *Arg)\r
+{\r
+       class CFrontendDlg *This;\r
+\r
+       This = (class CFrontendDlg *)Arg;\r
+\r
+       return This->LogThreadFunc();\r
+}\r
+\r
+static unsigned int NetThreadStub(void *Arg)\r
+{\r
+       class CFrontendDlg *This;\r
+\r
+       This = (class CFrontendDlg *)Arg;\r
+\r
+       return This->NetThreadFunc();\r
+}\r
+\r
+int CFrontendDlg::ExecutePipe(const char *CmdLine, HANDLE *InWrite,\r
+                                                         HANDLE *OutRead, HANDLE *ShimProc)\r
+{\r
+       SECURITY_ATTRIBUTES SecAttr;\r
+       HANDLE OutWrite, OutReadTmp;\r
+       HANDLE ErrWrite;\r
+       HANDLE InRead, InWriteTmp;\r
+       HANDLE Proc;\r
+       STARTUPINFO StartupInfo;\r
+       PROCESS_INFORMATION ProcessInfo;\r
+\r
+       SecAttr.nLength = sizeof (SECURITY_ATTRIBUTES);\r
+       SecAttr.lpSecurityDescriptor = NULL;\r
+       SecAttr.bInheritHandle = TRUE;\r
+\r
+       Proc = ::GetCurrentProcess();\r
+\r
+       if (!::CreatePipe(&OutReadTmp, &OutWrite, &SecAttr, 0))\r
+       {\r
+               AfxMessageBox("Cannot create stdout pipe.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::DuplicateHandle(Proc, OutReadTmp, Proc, OutRead,\r
+               0, FALSE, DUPLICATE_SAME_ACCESS))\r
+       {\r
+               AfxMessageBox("Cannot duplicate temporary stdout read handle.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::CloseHandle(OutReadTmp))\r
+       {\r
+               AfxMessageBox("Cannot close temporary stdout read handle.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::CreatePipe(&InRead, &InWriteTmp, &SecAttr, 0))\r
+       {\r
+               AfxMessageBox("Cannot create stdin pipe.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::DuplicateHandle(Proc, InWriteTmp, Proc, InWrite,\r
+               0, FALSE, DUPLICATE_SAME_ACCESS))\r
+       {\r
+               AfxMessageBox("Cannot duplicate temporary stdin write handle.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::CloseHandle(InWriteTmp))\r
+       {\r
+               AfxMessageBox("Cannot close temporary stdin write handle.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::DuplicateHandle(Proc, OutWrite, Proc, &ErrWrite,\r
+               0, TRUE, DUPLICATE_SAME_ACCESS))\r
+       {\r
+               AfxMessageBox("Cannot duplicate stdout write handle for stderr.");\r
+               return -1;\r
+       }\r
+\r
+       ::memset(&StartupInfo, 0, sizeof (STARTUPINFO));\r
+\r
+       StartupInfo.cb = sizeof (STARTUPINFO);\r
+\r
+       StartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;\r
+\r
+       StartupInfo.hStdInput = InRead;\r
+       StartupInfo.hStdOutput = OutWrite;\r
+       StartupInfo.hStdError = ErrWrite;\r
+\r
+       StartupInfo.wShowWindow = SW_HIDE;\r
+\r
+       if (!::CreateProcess(NULL, (char *)CmdLine, NULL, NULL, TRUE,\r
+               0, NULL, NULL, &StartupInfo, &ProcessInfo))\r
+       {\r
+               AfxMessageBox("Cannot create OLSR server process.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::CloseHandle(InRead))\r
+       {\r
+               AfxMessageBox("Cannot close stdin read handle.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::CloseHandle(OutWrite))\r
+       {\r
+               AfxMessageBox("Cannot close stdout write handle.");\r
+               return -1;\r
+       }\r
+\r
+       if (!::CloseHandle(ErrWrite))\r
+       {\r
+               AfxMessageBox("Cannot close stderr write handle.");\r
+               return -1;\r
+       }\r
+\r
+       *ShimProc = ProcessInfo.hProcess;\r
+\r
+       return 0;\r
+}\r
+\r
+int CFrontendDlg::GetInterfaces()\r
+{\r
+       char GuiPath[MAX_PATH];\r
+       CString CmdLine;\r
+       CWinThread *IntThread;\r
+\r
+       ::GetModuleFileName(NULL, GuiPath, MAX_PATH);\r
+\r
+       CmdLine = GuiPath;\r
+       CmdLine = CmdLine.Mid(0, CmdLine.ReverseFind('\\')) + "\\olsrd.exe -int";\r
+\r
+       if (ExecutePipe((const char *)CmdLine, &InWrite, &OutRead, &ShimProc) < 0)\r
+       {\r
+               AfxMessageBox("Cannot execute '" + CmdLine + "'.");\r
+               return -1;\r
+       }\r
+\r
+       PipeMode = PIPE_MODE_INT;\r
+\r
+       IntThread = AfxBeginThread(LogThreadStub, (void *)this);\r
+\r
+       ::WaitForSingleObject((HANDLE)(*IntThread), INFINITE);\r
+\r
+       return 0;\r
+}\r
+\r
+int CFrontendDlg::StartOlsrd()\r
+{\r
+       WSADATA WsaData;\r
+       CString CmdLine;\r
+       char Path[MAX_PATH];\r
+       char TempPath[MAX_PATH];\r
+       int Try;\r
+\r
+       m_TabCtrl.m_Dialog3.ClearNodeInfo();\r
+       m_TabCtrl.m_Dialog4.ClearRoutes();\r
+\r
+       if (WSAStartup(0x0202, &WsaData))\r
+       {\r
+               AfxMessageBox("Cannot initialize WinSock library.");\r
+               return -1;\r
+       }\r
+\r
+       ::GetModuleFileName(NULL, Path, MAX_PATH);\r
+\r
+       CmdLine = Path;\r
+       CmdLine = CmdLine.Mid(0, CmdLine.ReverseFind('\\')) + "\\Shim.exe";\r
+\r
+       ::GetTempPath(MAX_PATH - 16, Path);\r
+       ::GetTempFileName(Path, "GNU", 0, TempPath);\r
+\r
+       StoredTempFile = TempPath;\r
+\r
+       if (m_TabCtrl.m_Dialog2.SaveConfigFile(StoredTempFile) < 0)\r
+       {\r
+               AfxMessageBox("Cannot save temporary configuration file '" + \r
+                       StoredTempFile + "'.");\r
+               return -1;\r
+       }\r
+\r
+       CmdLine += " -f " + StoredTempFile + " -ipc";\r
+\r
+       if (ExecutePipe((const char *)CmdLine, &InWrite, &OutRead, &ShimProc) < 0)\r
+       {\r
+               AfxMessageBox("Cannot execute '" + CmdLine + "'.");\r
+               return -1;\r
+       }\r
+\r
+       PipeMode = PIPE_MODE_RUN;\r
+\r
+       LogThread = AfxBeginThread(LogThreadStub, (void *)this);\r
+\r
+       struct sockaddr_in Addr;\r
+\r
+       Addr.sin_family = AF_INET;\r
+       Addr.sin_port = ::htons(1212);\r
+       Addr.sin_addr.s_addr = ::inet_addr("127.0.0.1");\r
+\r
+       SockHand = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);\r
+\r
+       if (SockHand < 0)\r
+       {\r
+               AfxMessageBox("Cannot create IPC socket.");\r
+\r
+               ::SetEvent(Event);\r
+               ::WaitForSingleObject((HANDLE)LogThread, INFINITE);\r
+\r
+               return -1;\r
+       }\r
+\r
+       for (Try = 0; Try < 10; Try++)\r
+       {\r
+               if (::connect(SockHand, (struct sockaddr *)&Addr,\r
+                       sizeof (struct sockaddr_in)) >= 0)\r
+                       break;\r
+\r
+               ::Sleep(500);\r
+       }\r
+\r
+       if (Try == 10)\r
+       {\r
+               AfxMessageBox("Cannot connect to IPC port.");\r
+\r
+               ::SetEvent(Event);\r
+               ::WaitForSingleObject((HANDLE)LogThread, INFINITE);\r
+\r
+               ::closesocket(SockHand);\r
+\r
+               return -1;\r
+       }\r
+\r
+       NetThread = AfxBeginThread(NetThreadStub, (void *)this);\r
+\r
+       return 0;\r
+}\r
+\r
+int CFrontendDlg::StopOlsrd()\r
+{\r
+       ::SetEvent(Event);\r
+\r
+       ::WaitForSingleObject((HANDLE)LogThread, INFINITE);\r
+       ::WaitForSingleObject((HANDLE)NetThread, INFINITE);\r
+\r
+       ::DeleteFile(StoredTempFile);\r
+\r
+       return 0;\r
+}\r
+\r
+BOOL CFrontendDlg::OnInitDialog()\r
+{\r
+       HICON Small, Large;\r
+\r
+       CDialog::OnInitDialog();\r
+\r
+       Small = (HICON)::LoadImage(AfxGetApp()->m_hInstance,\r
+               MAKEINTRESOURCE(IDI_ICON1),\r
+               IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),\r
+               GetSystemMetrics(SM_CYSMICON), 0);\r
+\r
+       Large = (HICON)::LoadImage(AfxGetApp()->m_hInstance,\r
+               MAKEINTRESOURCE(IDI_ICON1),\r
+               IMAGE_ICON, GetSystemMetrics(SM_CXICON),\r
+               GetSystemMetrics(SM_CYICON), 0);\r
+\r
+       SetIcon(Small, FALSE);\r
+       SetIcon(Large, TRUE);\r
+\r
+       GetInterfaces();\r
+\r
+       m_TabCtrl.InsertItem(0, "Settings");\r
+       m_TabCtrl.InsertItem(1, "Output");\r
+       m_TabCtrl.InsertItem(2, "Nodes");\r
+       m_TabCtrl.InsertItem(3, "Routes");\r
+\r
+       m_TabCtrl.InitTabDialogs(&Interfaces, &Addresses);\r
+\r
+       m_StopButton.EnableWindow(FALSE);\r
+\r
+       if (!ConfigFile.IsEmpty())\r
+       {\r
+               if (m_TabCtrl.m_Dialog2.OpenConfigFile(ConfigFile) < 0)\r
+                       AfxMessageBox("Cannot open configuration file '" + ConfigFile + "'.");\r
+\r
+               else\r
+               {\r
+                       OnStartButton();\r
+\r
+                       m_TabCtrl.SetCurSel(1);\r
+                       m_TabCtrl.DisplayTabDialog();\r
+               }\r
+       }\r
+\r
+       return TRUE;\r
+}\r
+\r
+void CFrontendDlg::OnOK()\r
+{\r
+}\r
+\r
+void CFrontendDlg::OnCancel()\r
+{\r
+       OnExitButton();\r
+}\r
+\r
+void CFrontendDlg::OnStartButton() \r
+{\r
+       m_StartButton.EnableWindow(FALSE);\r
+\r
+       if (StartOlsrd() < 0)\r
+       {\r
+               AfxMessageBox("Cannot start OLSR server.");\r
+\r
+               m_StartButton.EnableWindow(TRUE);\r
+\r
+               return;\r
+       }\r
+\r
+       m_TabCtrl.m_Dialog1.HandleStart();\r
+\r
+       m_StopButton.EnableWindow(TRUE);\r
+}\r
+\r
+void CFrontendDlg::OnStopButton() \r
+{\r
+       if (StopOlsrd() < 0)\r
+               return;\r
+\r
+       m_TabCtrl.m_Dialog1.HandleStop();\r
+\r
+       m_StopButton.EnableWindow(FALSE);\r
+       m_StartButton.EnableWindow(TRUE);\r
+}\r
+\r
+void CFrontendDlg::OnExitButton()\r
+{\r
+       if (StopOlsrd() < 0)\r
+               return;\r
+\r
+       m_TabCtrl.m_Dialog3.ClearNodeInfo();\r
+       m_TabCtrl.m_Dialog4.ClearRoutes();\r
+\r
+       DestroyWindow();\r
+}\r
diff --git a/gui/win32/Main/FrontendDlg.h b/gui/win32/Main/FrontendDlg.h
new file mode 100644 (file)
index 0000000..3fae975
--- /dev/null
@@ -0,0 +1,117 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_FRONTENDDLG_H__7D68FBC0_7448_479B_81F0_3FBBDE291395__INCLUDED_)\r
+#define AFX_FRONTENDDLG_H__7D68FBC0_7448_479B_81F0_3FBBDE291395__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+#include "MyTabCtrl.h"\r
+#include "NodeEntry.h"\r
+\r
+#define PIPE_MODE_RUN 0\r
+#define PIPE_MODE_INT 1\r
+\r
+class CFrontendDlg : public CDialog\r
+{\r
+public:\r
+       CFrontendDlg(CWnd* pParent = NULL);\r
+\r
+       //{{AFX_DATA(CFrontendDlg)\r
+       enum { IDD = IDD_FRONTEND_DIALOG };\r
+       CButton m_StopButton;\r
+       CButton m_StartButton;\r
+       MyTabCtrl m_TabCtrl;\r
+       //}}AFX_DATA\r
+\r
+       unsigned int LogThreadFunc(void);\r
+       unsigned int NetThreadFunc(void);\r
+\r
+       CString ConfigFile;\r
+\r
+       //{{AFX_VIRTUAL(CFrontendDlg)\r
+       protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);\r
+       //}}AFX_VIRTUAL\r
+\r
+protected:\r
+       //{{AFX_MSG(CFrontendDlg)\r
+       virtual BOOL OnInitDialog();\r
+       afx_msg void OnOK();\r
+       afx_msg void OnCancel();\r
+       afx_msg void OnStartButton();\r
+       afx_msg void OnStopButton();\r
+       afx_msg void OnExitButton();\r
+       //}}AFX_MSG\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+\r
+       int GetInterfaces(void);\r
+\r
+       HANDLE Event;\r
+\r
+       CString StoredTempFile;\r
+\r
+       SOCKET SockHand;\r
+\r
+       int StartOlsrd(void);\r
+       int StopOlsrd(void);\r
+\r
+       int PipeMode;\r
+       int ExecutePipe(const char *, HANDLE *, HANDLE *, HANDLE *);\r
+\r
+       CWinThread *LogThread;\r
+       CWinThread *NetThread;\r
+\r
+       CStringArray Interfaces;\r
+       CStringArray Addresses;\r
+\r
+       HANDLE OutRead, InWrite;\r
+       HANDLE ShimProc;\r
+\r
+       void HandleIpcRoute(struct IpcRoute *);\r
+       void HandleIpcConfig(struct IpcConfig *);\r
+       void HandleOlsrHello(struct OlsrHello *);\r
+       void HandleOlsrTc(struct OlsrTc *);\r
+       void HandleOlsrMid(struct OlsrHeader *);\r
+       void HandleOlsrHna(struct OlsrHeader *);\r
+\r
+       void AddNode(unsigned int, unsigned int);\r
+       void AddMpr(unsigned int, unsigned int, unsigned int);\r
+       void AddMid(unsigned int, unsigned int, unsigned int);\r
+       void AddHna(unsigned int, unsigned int, unsigned int, unsigned int);\r
+\r
+       CList<class NodeEntry, class NodeEntry &> NodeList;\r
+\r
+       void Timeout(void);\r
+\r
+       unsigned __int64 Now;\r
+\r
+       unsigned int LocalHost;\r
+};\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
+\r
diff --git a/gui/win32/Main/HnaEntry.cpp b/gui/win32/Main/HnaEntry.cpp
new file mode 100644 (file)
index 0000000..25c92e1
--- /dev/null
@@ -0,0 +1,38 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "HnaEntry.h"\r
+\r
+class HnaEntry &HnaEntry::operator=(class HnaEntry &Src)\r
+{\r
+       Addr = Src.Addr;\r
+       Mask = Src.Mask;\r
+       Timeout = Src.Timeout;\r
+\r
+       return *this;\r
+}\r
+\r
+BOOL HnaEntry::operator==(const class HnaEntry &Comp) const\r
+{\r
+       return Addr == Comp.Addr && Mask == Comp.Mask;\r
+}\r
diff --git a/gui/win32/Main/HnaEntry.h b/gui/win32/Main/HnaEntry.h
new file mode 100644 (file)
index 0000000..b9f6867
--- /dev/null
@@ -0,0 +1,37 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined TL_HNAENTRY_H\r
+#define TL_HNAENTRY_H\r
+\r
+class HnaEntry\r
+{\r
+public:\r
+       unsigned int Addr;\r
+       unsigned int Mask;\r
+       unsigned __int64 Timeout;\r
+\r
+       class HnaEntry &HnaEntry::operator=(class HnaEntry &);\r
+       BOOL HnaEntry::operator==(const class HnaEntry &) const;\r
+};\r
+\r
+#endif\r
diff --git a/gui/win32/Main/Ipc.h b/gui/win32/Main/Ipc.h
new file mode 100644 (file)
index 0000000..4c923f0
--- /dev/null
@@ -0,0 +1,115 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined TL_IPC_H\r
+#define TL_IPC_H\r
+\r
+#define MSG_TYPE_OLSR_HELLO 1\r
+#define MSG_TYPE_OLSR_TC 2\r
+#define MSG_TYPE_OLSR_MID 3\r
+#define MSG_TYPE_OLSR_HNA 4\r
+\r
+#define MSG_TYPE_IPC_ROUTE 11\r
+#define MSG_TYPE_IPC_CONFIG 12\r
+\r
+#pragma pack(push, BeforeIpcMessages, 1)\r
+\r
+struct OlsrHeader\r
+{\r
+       unsigned char Type;\r
+       unsigned char VTime;\r
+       unsigned short Size;\r
+       unsigned int Orig;\r
+       unsigned char Ttl;\r
+       unsigned char Hops;\r
+       unsigned short SeqNo;\r
+};\r
+\r
+struct OlsrHello\r
+{\r
+       struct OlsrHeader Header;\r
+\r
+       unsigned short Reserved;\r
+       unsigned char HTime;\r
+       unsigned char Will;\r
+};\r
+\r
+struct OlsrHelloLink\r
+{\r
+       unsigned char LinkCode;\r
+       unsigned char Reserved;\r
+       unsigned short Size;\r
+};\r
+\r
+struct OlsrTc\r
+{\r
+       struct OlsrHeader Header;\r
+\r
+       unsigned short Ansn;\r
+       unsigned short Reserved;\r
+};\r
+\r
+union IpcIpAddr\r
+{\r
+       unsigned int v4;\r
+       unsigned char v6[16];\r
+};\r
+\r
+struct IpcHeader\r
+{\r
+       unsigned char Type;\r
+       unsigned char Reserved;\r
+       unsigned short Size;\r
+};\r
+\r
+struct IpcRoute\r
+{\r
+       struct IpcHeader Header;\r
+       \r
+       unsigned char Metric;\r
+       unsigned char Add;\r
+       unsigned char Reserved[2];\r
+       union IpcIpAddr Dest;\r
+       union IpcIpAddr Gate;\r
+       char Int[4];\r
+};\r
+\r
+struct IpcConfig\r
+{\r
+       struct IpcHeader Header;\r
+\r
+       unsigned char NumMid;\r
+       unsigned char NumHna;\r
+       unsigned char Reserved1[2];\r
+       unsigned short HelloInt;\r
+       unsigned short WiredHelloInt;\r
+       unsigned short TcInt;\r
+       unsigned short HelloHold;\r
+       unsigned short TcHold;\r
+       unsigned char Ipv6;\r
+       unsigned char Reserved2;\r
+       IpcIpAddr MainAddr;\r
+};\r
+\r
+#pragma pack (pop, BeforeIpcMessages)\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MidEntry.cpp b/gui/win32/Main/MidEntry.cpp
new file mode 100644 (file)
index 0000000..07abed9
--- /dev/null
@@ -0,0 +1,37 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "MidEntry.h"\r
+\r
+class MidEntry &MidEntry::operator=(class MidEntry &Src)\r
+{\r
+       Addr = Src.Addr;\r
+       Timeout = Src.Timeout;\r
+\r
+       return *this;\r
+}\r
+\r
+BOOL MidEntry::operator==(const class MidEntry &Comp) const\r
+{\r
+       return Addr == Comp.Addr;\r
+}\r
diff --git a/gui/win32/Main/MidEntry.h b/gui/win32/Main/MidEntry.h
new file mode 100644 (file)
index 0000000..f04d806
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined TL_MIDENTRY_H\r
+#define TL_MIDENTRY_H\r
+\r
+class MidEntry\r
+{\r
+public:\r
+       unsigned int Addr;\r
+       unsigned __int64 Timeout;\r
+\r
+       class MidEntry &MidEntry::operator=(class MidEntry &);\r
+       BOOL MidEntry::operator==(const class MidEntry &) const;\r
+};\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MprEntry.cpp b/gui/win32/Main/MprEntry.cpp
new file mode 100644 (file)
index 0000000..f7e7d23
--- /dev/null
@@ -0,0 +1,37 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "MprEntry.h"\r
+\r
+class MprEntry &MprEntry::operator=(class MprEntry &Src)\r
+{\r
+       Addr = Src.Addr;\r
+       Timeout = Src.Timeout;\r
+\r
+       return *this;\r
+}\r
+\r
+BOOL MprEntry::operator==(const class MprEntry &Comp) const\r
+{\r
+       return Addr == Comp.Addr;\r
+}\r
diff --git a/gui/win32/Main/MprEntry.h b/gui/win32/Main/MprEntry.h
new file mode 100644 (file)
index 0000000..effa584
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined TL_MPRENTRY_H\r
+#define TL_MPRENTRY_H\r
+\r
+class MprEntry\r
+{\r
+public:\r
+       unsigned int Addr;\r
+       unsigned __int64 Timeout;\r
+\r
+       class MprEntry &MprEntry::operator=(class MprEntry &);\r
+       BOOL MprEntry::operator==(const class MprEntry &) const;\r
+};\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MyDialog1.cpp b/gui/win32/Main/MyDialog1.cpp
new file mode 100644 (file)
index 0000000..7a6ebe5
--- /dev/null
@@ -0,0 +1,234 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "Frontend.h"\r
+#include "MyDialog1.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+MyDialog1::MyDialog1(CWnd* pParent)\r
+       : CDialog(MyDialog1::IDD, pParent)\r
+{\r
+       //{{AFX_DATA_INIT(MyDialog1)\r
+       //}}AFX_DATA_INIT\r
+}\r
+\r
+BOOL MyDialog1::Create(CWnd *Parent)\r
+{\r
+       return CDialog::Create(MyDialog1::IDD, Parent);\r
+}\r
+\r
+void MyDialog1::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       //{{AFX_DATA_MAP(MyDialog1)\r
+       DDX_Control(pDX, IDC_BUTTON4, m_SaveButton);\r
+       DDX_Control(pDX, IDC_BUTTON3, m_FreezeButton);\r
+       DDX_Control(pDX, IDC_BUTTON2, m_ContinueButton);\r
+       DDX_Control(pDX, IDC_BUTTON1, m_ClearButton);\r
+       DDX_Control(pDX, IDC_EDIT1, m_OutputWindow);\r
+       //}}AFX_DATA_MAP\r
+}\r
+\r
+\r
+BEGIN_MESSAGE_MAP(MyDialog1, CDialog)\r
+       //{{AFX_MSG_MAP(MyDialog1)\r
+       ON_BN_CLICKED(IDC_BUTTON1, OnClearButton)\r
+       ON_BN_CLICKED(IDC_BUTTON2, OnContinueButton)\r
+       ON_BN_CLICKED(IDC_BUTTON3, OnFreezeButton)\r
+       ON_WM_CTLCOLOR()\r
+       ON_BN_CLICKED(IDOK, OnOK)\r
+       ON_BN_CLICKED(IDCANCEL, OnCancel)\r
+       ON_BN_CLICKED(IDC_BUTTON4, OnSaveButton)\r
+       //}}AFX_MSG_MAP\r
+END_MESSAGE_MAP()\r
+\r
+void MyDialog1::OnOK()\r
+{\r
+}\r
+\r
+void MyDialog1::OnCancel()\r
+{\r
+}\r
+\r
+void MyDialog1::AddOutputLine(CString Line)\r
+{\r
+       CritSect.Lock();\r
+       Output += Line + "\r\n";\r
+       CritSect.Unlock();\r
+\r
+       if (Frozen == 0)\r
+       {\r
+               m_OutputWindow.SetWindowText(Output);\r
+               m_OutputWindow.SetSel(Output.GetLength(), Output.GetLength());\r
+       }\r
+}\r
+\r
+BOOL MyDialog1::OnInitDialog() \r
+{\r
+       CDialog::OnInitDialog();\r
+       \r
+       CClientDC DevCont(&m_OutputWindow);\r
+\r
+       EditFont.CreatePointFont(100, "Courier", NULL);\r
+       m_OutputWindow.SetFont(&EditFont);\r
+\r
+       m_FreezeButton.EnableWindow(FALSE);\r
+       m_ContinueButton.EnableWindow(FALSE);\r
+\r
+       Frozen = 0;\r
+\r
+       WhiteBrush.CreateSolidBrush(RGB(255, 255, 255));\r
+\r
+       return TRUE;\r
+}\r
+\r
+void MyDialog1::OnClearButton() \r
+{\r
+       CritSect.Lock();\r
+       Output.Empty();\r
+       CritSect.Unlock();\r
+\r
+       m_OutputWindow.SetWindowText(Output);\r
+       m_OutputWindow.SetSel(0, 0);\r
+}\r
+\r
+void MyDialog1::OnContinueButton()\r
+{\r
+       CString Copy;\r
+       int Len;\r
+\r
+       m_FreezeButton.EnableWindow(TRUE);\r
+       m_ContinueButton.EnableWindow(FALSE);\r
+\r
+       Frozen = 0;\r
+\r
+       CritSect.Lock();\r
+       Copy = Output;\r
+       Len = Output.GetLength();\r
+       CritSect.Unlock();\r
+\r
+       m_OutputWindow.SetWindowText(Copy);\r
+       m_OutputWindow.SetSel(Len, Len);\r
+}\r
+\r
+void MyDialog1::OnFreezeButton() \r
+{\r
+       m_FreezeButton.EnableWindow(FALSE);\r
+       m_ContinueButton.EnableWindow(TRUE);\r
+\r
+       Frozen = 1;\r
+}\r
+\r
+void MyDialog1::HandleStart(void)\r
+{\r
+       CString Copy;\r
+       int Len;\r
+\r
+       m_FreezeButton.EnableWindow(TRUE);\r
+       m_ContinueButton.EnableWindow(FALSE);\r
+\r
+       Frozen = 0;\r
+\r
+       CritSect.Lock();\r
+       Copy = Output;\r
+       Len = Output.GetLength();\r
+       CritSect.Unlock();\r
+\r
+       m_OutputWindow.SetWindowText(Copy);\r
+       m_OutputWindow.SetSel(Len, Len);\r
+}\r
+\r
+void MyDialog1::HandleStop(void)\r
+{\r
+       CString Copy;\r
+       int Len;\r
+\r
+       m_FreezeButton.EnableWindow(FALSE);\r
+       m_ContinueButton.EnableWindow(FALSE);\r
+\r
+       Frozen = 0;\r
+\r
+       CritSect.Lock();\r
+       Copy = Output;\r
+       Len = Output.GetLength();\r
+       CritSect.Unlock();\r
+\r
+       m_OutputWindow.SetWindowText(Copy);\r
+       m_OutputWindow.SetSel(Len, Len);\r
+}\r
+\r
+HBRUSH MyDialog1::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) \r
+{\r
+       HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);\r
+\r
+       if (pWnd == &m_OutputWindow)\r
+       {\r
+               pDC->SetBkColor(RGB(255, 255, 255));\r
+               hbr = WhiteBrush;\r
+       }\r
+       \r
+       return hbr;\r
+}\r
+\r
+void MyDialog1::OnSaveButton()\r
+{\r
+       CString Copy;\r
+       int Len;\r
+       CFileDialog FileDialog(FALSE);\r
+       CString FileName = "OLSR log.txt";\r
+       CString PathName;\r
+       CFile File;\r
+\r
+       CritSect.Lock();\r
+       Copy = Output;\r
+       Len = Output.GetLength();\r
+       CritSect.Unlock();\r
+\r
+       FileDialog.m_ofn.lpstrFilter = "Text file (*.txt)\0*.txt\0";\r
+       FileDialog.m_ofn.nFilterIndex = 1;\r
+\r
+       FileDialog.m_ofn.lpstrFile = FileName.GetBuffer(500);\r
+       FileDialog.m_ofn.nMaxFile = 500;\r
+\r
+       if (FileDialog.DoModal() == IDOK)\r
+       {\r
+               PathName = FileDialog.GetPathName();\r
+\r
+               if (File.Open(PathName, CFile::modeCreate | CFile::modeWrite |\r
+                       CFile::shareExclusive) == 0)\r
+                       AfxMessageBox("Cannot open logfile '" + PathName + "'.");\r
+\r
+               else\r
+               {\r
+                       File.Write((const char *)Copy, Len);\r
+                       File.Close();\r
+               }\r
+       }\r
+\r
+       FileName.ReleaseBuffer();\r
+}\r
diff --git a/gui/win32/Main/MyDialog1.h b/gui/win32/Main/MyDialog1.h
new file mode 100644 (file)
index 0000000..8a4ec40
--- /dev/null
@@ -0,0 +1,81 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_MYDIALOG1_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_)\r
+#define AFX_MYDIALOG1_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+class MyDialog1 : public CDialog\r
+{\r
+public:\r
+       MyDialog1(CWnd* pParent = NULL);\r
+\r
+       BOOL Create(CWnd *Parent);\r
+\r
+       void AddOutputLine(CString);\r
+       void HandleStart(void);\r
+       void HandleStop(void);\r
+\r
+       //{{AFX_DATA(MyDialog1)\r
+       enum { IDD = IDD_DIALOG1 };\r
+       CButton m_SaveButton;\r
+       CButton m_FreezeButton;\r
+       CButton m_ContinueButton;\r
+       CButton m_ClearButton;\r
+       CEdit   m_OutputWindow;\r
+       //}}AFX_DATA\r
+\r
+\r
+       //{{AFX_VIRTUAL(MyDialog1)\r
+       protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);\r
+       //}}AFX_VIRTUAL\r
+\r
+protected:\r
+\r
+       //{{AFX_MSG(MyDialog1)\r
+       afx_msg void OnOK();\r
+       afx_msg void OnCancel();\r
+       virtual BOOL OnInitDialog();\r
+       afx_msg void OnClearButton();\r
+       afx_msg void OnContinueButton();\r
+       afx_msg void OnFreezeButton();\r
+       afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);\r
+       afx_msg void OnSaveButton();\r
+       //}}AFX_MSG\r
+       DECLARE_MESSAGE_MAP()\r
+\r
+       CCriticalSection CritSect;\r
+       CString Output;\r
+\r
+       int Frozen;\r
+\r
+       CFont EditFont;\r
+       CBrush WhiteBrush;\r
+};\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MyDialog2.cpp b/gui/win32/Main/MyDialog2.cpp
new file mode 100644 (file)
index 0000000..741fc30
--- /dev/null
@@ -0,0 +1,486 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "Frontend.h"\r
+#include "MyDialog2.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+#define MAXIF 100\r
+\r
+MyDialog2::MyDialog2(CWnd* pParent)\r
+       : CDialog(MyDialog2::IDD, pParent)\r
+{\r
+       //{{AFX_DATA_INIT(MyDialog2)\r
+       //}}AFX_DATA_INIT\r
+}\r
+\r
+void MyDialog2::SetDebugLevel(int Level)\r
+{\r
+       char LevelText[2];\r
+\r
+       LevelText[0] = (char)(Level + '0');\r
+       LevelText[1] = 0;\r
+\r
+       DebugLevel = Level;\r
+       m_DebugLevel.SetPos(Level);\r
+       m_DebugLevelText.SetWindowText(LevelText);\r
+}\r
+\r
+void MyDialog2::GetInterfaceList(CString &Res)\r
+{\r
+       int Num = m_InterfaceList.GetItemCount();\r
+       int i;\r
+       int AddSpace = 0;\r
+\r
+       for (i = 0; i < Num; i++)\r
+               if (m_InterfaceList.GetCheck(i))\r
+               {\r
+                       if (AddSpace != 0)\r
+                               Res += " ";\r
+\r
+                       else\r
+                               AddSpace = 1;\r
+\r
+                       Res += m_InterfaceList.GetItemText(i, 0).Mid(0, 4);\r
+               }\r
+\r
+       Res.MakeLower();\r
+}\r
+\r
+BOOL MyDialog2::Create(CWnd *Parent)\r
+{\r
+       return CDialog::Create(MyDialog2::IDD, Parent);\r
+}\r
+\r
+void MyDialog2::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       //{{AFX_DATA_MAP(MyDialog2)\r
+       DDX_Control(pDX, IDC_CHECK4, m_TunnelCheck);\r
+       DDX_Control(pDX, IDC_CHECK3, m_Ipv6Check);\r
+       DDX_Control(pDX, IDC_CHECK2, m_InternetCheck);\r
+       DDX_Control(pDX, IDC_CHECK1, m_HystCheck);\r
+       DDX_Control(pDX, IDC_EDIT13, m_HystThresholdHigh);\r
+       DDX_Control(pDX, IDC_EDIT12, m_HystThresholdLow);\r
+       DDX_Control(pDX, IDC_EDIT11, m_HystScaling);\r
+       DDX_Control(pDX, IDC_EDIT10, m_HnaMult);\r
+       DDX_Control(pDX, IDC_EDIT9, m_MidMult);\r
+       DDX_Control(pDX, IDC_EDIT7, m_PollInt);\r
+       DDX_Control(pDX, IDC_EDIT6, m_TcMult);\r
+       DDX_Control(pDX, IDC_EDIT5, m_TcInt);\r
+       DDX_Control(pDX, IDC_EDIT4, m_HnaInt);\r
+       DDX_Control(pDX, IDC_EDIT3, m_MidInt);\r
+       DDX_Control(pDX, IDC_EDIT2, m_HelloMult);\r
+       DDX_Control(pDX, IDC_EDIT1, m_HelloInt);\r
+       DDX_Control(pDX, IDC_EDIT8, m_ManualWindow);\r
+       DDX_Control(pDX, IDC_LIST1, m_InterfaceList);\r
+       DDX_Control(pDX, IDC_TEXT1, m_DebugLevelText);\r
+       DDX_Control(pDX, IDC_SLIDER2, m_DebugLevel);\r
+       //}}AFX_DATA_MAP\r
+}\r
+\r
+BEGIN_MESSAGE_MAP(MyDialog2, CDialog)\r
+       //{{AFX_MSG_MAP(MyDialog2)\r
+       ON_WM_HSCROLL()\r
+       ON_BN_CLICKED(IDC_CHECK1, OnHystCheck)\r
+       ON_BN_CLICKED(IDC_BUTTON4, OnOpenButton)\r
+       ON_BN_CLICKED(IDC_BUTTON5, OnSaveButton)\r
+       ON_BN_CLICKED(IDOK, OnOK)\r
+       ON_BN_CLICKED(IDCANCEL, OnCancel)\r
+       ON_BN_CLICKED(IDC_BUTTON1, OnResetButton)\r
+       //}}AFX_MSG_MAP\r
+END_MESSAGE_MAP()\r
+\r
+void MyDialog2::OnOK()\r
+{\r
+}\r
+\r
+void MyDialog2::OnCancel()\r
+{\r
+}\r
+\r
+void MyDialog2::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) \r
+{\r
+       if (pScrollBar == (CScrollBar *)&m_DebugLevel)\r
+               SetDebugLevel(m_DebugLevel.GetPos());\r
+       \r
+       CDialog::OnHScroll(nSBCode, nPos, pScrollBar);\r
+}\r
+\r
+void MyDialog2::Reset(void)\r
+{\r
+       int i;\r
+\r
+       SetDebugLevel(1);\r
+\r
+       m_HelloInt.SetWindowText("2.0");\r
+       m_HelloMult.SetWindowText("3.0");\r
+\r
+       m_TcInt.SetWindowText("5.0");\r
+       m_TcMult.SetWindowText("3.0");\r
+\r
+       m_MidInt.SetWindowText("5.0");\r
+       m_MidMult.SetWindowText("3.0");\r
+\r
+       m_HnaInt.SetWindowText("10.0");\r
+       m_HnaMult.SetWindowText("3.0");\r
+\r
+       m_PollInt.SetWindowText("0.1");\r
+\r
+       m_HystThresholdLow.SetWindowText("0.3");\r
+       m_HystThresholdHigh.SetWindowText("0.8");\r
+       m_HystScaling.SetWindowText("0.5");\r
+\r
+       m_HystCheck.SetCheck(TRUE);\r
+\r
+       OnHystCheck();\r
+\r
+       m_InternetCheck.SetCheck(FALSE);\r
+       m_Ipv6Check.SetCheck(FALSE);\r
+       m_TunnelCheck.SetCheck(FALSE);\r
+\r
+       for (i = 0; i < Interfaces->GetSize(); i++)\r
+               m_InterfaceList.SetCheck(i, TRUE);\r
+\r
+       m_ManualWindow.SetWindowText("");\r
+}\r
+\r
+BOOL MyDialog2::OnInitDialog() \r
+{\r
+       int i;\r
+\r
+       CDialog::OnInitDialog();\r
+       \r
+       CClientDC DevCont(&m_ManualWindow);\r
+\r
+       EditFont.CreatePointFont(100, "Courier", NULL);\r
+       m_ManualWindow.SetFont(&EditFont);\r
+\r
+       m_DebugLevel.SetRange(0, 9, TRUE);\r
+\r
+       m_InterfaceList.SetExtendedStyle(m_InterfaceList.GetExtendedStyle() |\r
+                       LVS_EX_CHECKBOXES);\r
+\r
+       for (i = 0; i < Interfaces->GetSize(); i++)\r
+       {\r
+               m_InterfaceList.InsertItem(i,\r
+               (*Interfaces)[i] + " - " + (*Addresses)[i]);\r
+       }\r
+\r
+       MIB_IPFORWARDROW IpFwdRow;\r
+\r
+       if (::GetBestRoute(0, 0, &IpFwdRow) != NO_ERROR)\r
+               m_InternetCheck.EnableWindow(FALSE);\r
+\r
+       Reset();\r
+\r
+       return TRUE;\r
+}\r
+\r
+void MyDialog2::OnHystCheck() \r
+{\r
+       BOOL EnaDis = m_HystCheck.GetCheck();\r
+\r
+       m_HystThresholdLow.EnableWindow(EnaDis);\r
+       m_HystThresholdHigh.EnableWindow(EnaDis);\r
+       m_HystScaling.EnableWindow(EnaDis);\r
+}\r
+\r
+\r
+void MyDialog2::WriteParameter(CFile *File, CString Name, CString Value)\r
+{\r
+       CString Line;\r
+\r
+       Line = Name + " " + Value + "\r\n";\r
+\r
+       File->Write(Line.GetBuffer(0), Line.GetLength());\r
+\r
+       Line.ReleaseBuffer();\r
+}\r
+\r
+int MyDialog2::OpenConfigFile(CString PathName)\r
+{\r
+       CStdioFile File;\r
+       CString Line;\r
+       int Len;\r
+       CString Manual;\r
+       int NumInt = m_InterfaceList.GetItemCount();\r
+       int i;\r
+       CString Int;\r
+\r
+       if (File.Open(PathName, CFile::modeRead | CFile::typeText |\r
+               CFile::shareExclusive) == 0)\r
+               return -1;\r
+\r
+       m_InternetCheck.SetCheck(FALSE);\r
+\r
+       for (i = 0; i < NumInt; i++)\r
+               m_InterfaceList.SetCheck(i, FALSE);\r
+\r
+       m_HystScaling.SetWindowText("0.5");\r
+       m_HystThresholdLow.SetWindowText("0.3");\r
+       m_HystThresholdHigh.SetWindowText("0.8");\r
+\r
+       while (File.ReadString(Line))\r
+       {\r
+               Len = Line.Find('#');\r
+\r
+               if (Len >= 0)\r
+               {\r
+                       Line = Line.Mid(0, Len);\r
+                       Line.TrimRight();\r
+               }\r
+\r
+               Len = Line.GetLength();\r
+\r
+               if (Len == 0)\r
+                       continue;\r
+\r
+               if (Len > 10 && Line.Mid(0, 10) == "IPVERSION " && Line.Mid(10) == "4")\r
+                       ;\r
+\r
+               else if (Len > 6 && Line.Mid(0, 6) == "DEBUG ")\r
+                       SetDebugLevel(Line.GetAt(6) - '0');\r
+\r
+               else if (Len > 9 && Line.Mid(0, 9) == "POLLRATE ")\r
+                       m_PollInt.SetWindowText(Line.Mid(9));\r
+               \r
+               else if (Len > 9 && Line.Mid(0, 9) == "HELLOINT ")\r
+                       m_HelloInt.SetWindowText(Line.Mid(9));\r
+               \r
+               else if (Len > 11 && Line.Mid(0, 11) == "HELLOMULTI ")\r
+                       m_HelloMult.SetWindowText(Line.Mid(11));\r
+               \r
+               else if (Len > 6 && Line.Mid(0, 6) == "TCINT ")\r
+                       m_TcInt.SetWindowText(Line.Mid(6));\r
+               \r
+               else if (Len > 8 && Line.Mid(0, 8) == "TCMULTI ")\r
+                       m_TcMult.SetWindowText(Line.Mid(8));\r
+               \r
+               else if (Len > 7 && Line.Mid(0, 7) == "MIDINT ")\r
+                       m_MidInt.SetWindowText(Line.Mid(7));\r
+               \r
+               else if (Len > 9 && Line.Mid(0, 9) == "MIDMULTI ")\r
+                       m_MidMult.SetWindowText(Line.Mid(9));\r
+               \r
+               else if (Len > 7 && Line.Mid(0, 7) == "HNAINT ")\r
+                       m_HnaInt.SetWindowText(Line.Mid(7));\r
+               \r
+               else if (Len > 9 && Line.Mid(0, 9) == "HNAMULTI ")\r
+                       m_HnaMult.SetWindowText(Line.Mid(9));\r
+\r
+               else if (Len > 15 && Line.Mid(0, 15) == "USE_HYSTERESIS " &&\r
+                       Line.Mid(15) == "yes")\r
+                       m_HystCheck.SetCheck(TRUE);\r
+\r
+               else if (Len > 15 && Line.Mid(0, 15) == "USE_HYSTERESIS " &&\r
+                       Line.Mid(15) == "no")\r
+                       m_HystCheck.SetCheck(FALSE);\r
+\r
+               else if (Len > 13 && Line.Mid(0, 13) == "HYST_SCALING ")\r
+                       m_HystScaling.SetWindowText(Line.Mid(13));\r
+\r
+               else if (Len > 13 && Line.Mid(0, 13) == "HYST_THR_LOW ")\r
+                       m_HystThresholdLow.SetWindowText(Line.Mid(13));\r
+               \r
+               else if (Len > 14 && Line.Mid(0, 14) == "HYST_THR_HIGH ")\r
+                       m_HystThresholdHigh.SetWindowText(Line.Mid(14));\r
+\r
+               else if (Len > 5 && Line.Mid(0, 5) == "HNA4 " &&\r
+                       Line.Mid(5) == "0.0.0.0 0.0.0.0")\r
+               {\r
+                       if (m_InternetCheck.IsWindowEnabled())\r
+                               m_InternetCheck.SetCheck(TRUE);\r
+               }\r
+\r
+               else if (Len > 11 && Line.Mid(0, 11) == "INTERFACES ")\r
+               {\r
+                       Line = Line.Mid(11);\r
+                       Line.MakeUpper();\r
+\r
+                       for (;;)\r
+                       {\r
+                               Int = Line.Mid(0, 4);\r
+\r
+                               for (i = 0; i < NumInt; i++)\r
+                               {\r
+                                       if (m_InterfaceList.GetItemText(i, 0).Mid(0, 4) == Int)\r
+                                               m_InterfaceList.SetCheck(i, TRUE);\r
+                               }\r
+\r
+                               if (Line.GetLength() < 5)\r
+                                       break;\r
+\r
+                               Line = Line.Mid(5);\r
+                       }\r
+               }\r
+               \r
+               else\r
+               {\r
+                       Manual += Line + "\r\n";\r
+                       m_ManualWindow.SetWindowText(Manual);\r
+               }\r
+       }\r
+\r
+       File.Close();\r
+\r
+       OnHystCheck();\r
+\r
+       return 0;\r
+}\r
+\r
+int MyDialog2::SaveConfigFile(CString PathName)\r
+{\r
+       CFile File;\r
+       char *Prolog;\r
+       CString Para;\r
+       CString IntList;\r
+\r
+       if (File.Open(PathName, CFile::modeCreate | CFile::modeWrite |\r
+               CFile::shareExclusive) == 0)\r
+               return -1;\r
+\r
+       Prolog = "#\r\n# AUTOMATICALLY GENERATED FILE - DO NOT TOUCH!\r\n#\r\n\r\n";\r
+\r
+       File.Write(Prolog, strlen(Prolog));\r
+\r
+       WriteParameter(&File, "IPVERSION", "4");\r
+\r
+       m_DebugLevelText.GetWindowText(Para);\r
+       WriteParameter(&File, "DEBUG", Para);\r
+\r
+       GetInterfaceList(IntList);\r
+\r
+       if (!IntList.IsEmpty())\r
+               WriteParameter(&File, "INTERFACES", IntList);\r
+\r
+       m_PollInt.GetWindowText(Para);\r
+       WriteParameter(&File, "POLLRATE", Para);\r
+\r
+       m_HelloInt.GetWindowText(Para);\r
+       WriteParameter(&File, "HELLOINT", Para);\r
+\r
+       m_HelloMult.GetWindowText(Para);\r
+       WriteParameter(&File, "HELLOMULTI", Para);\r
+\r
+       m_TcInt.GetWindowText(Para);\r
+       WriteParameter(&File, "TCINT", Para);\r
+\r
+       m_TcMult.GetWindowText(Para);\r
+       WriteParameter(&File, "TCMULTI", Para);\r
+\r
+       m_MidInt.GetWindowText(Para);\r
+       WriteParameter(&File, "MIDINT", Para);\r
+\r
+       m_MidMult.GetWindowText(Para);\r
+       WriteParameter(&File, "MIDMULTI", Para);\r
+\r
+       m_HnaInt.GetWindowText(Para);\r
+       WriteParameter(&File, "HNAINT", Para);\r
+\r
+       m_HnaMult.GetWindowText(Para);\r
+       WriteParameter(&File, "HNAMULTI", Para);\r
+\r
+       if (m_HystCheck.GetCheck())\r
+       {\r
+               WriteParameter(&File, "USE_HYSTERESIS", "yes");\r
+\r
+               m_HystScaling.GetWindowText(Para);\r
+               WriteParameter(&File, "HYST_SCALING", Para);\r
+\r
+               m_HystThresholdLow.GetWindowText(Para);\r
+               WriteParameter(&File, "HYST_THR_LOW", Para);\r
+\r
+               m_HystThresholdHigh.GetWindowText(Para);\r
+               WriteParameter(&File, "HYST_THR_HIGH", Para);\r
+       }\r
+\r
+       else\r
+               WriteParameter(&File, "USE_HYSTERESIS", "no");\r
+\r
+       if (m_InternetCheck.GetCheck())\r
+               WriteParameter(&File, "HNA4", "0.0.0.0 0.0.0.0");\r
+\r
+       m_ManualWindow.GetWindowText(Para);\r
+       File.Write(Para.GetBuffer(0), Para.GetLength());\r
+       Para.ReleaseBuffer();\r
+\r
+       File.Close();\r
+       return 0;\r
+}\r
+\r
+void MyDialog2::OnSaveButton()\r
+{\r
+       CFileDialog FileDialog(FALSE);\r
+       CString FileName = "Default.olsr";\r
+       CString PathName;\r
+\r
+       FileDialog.m_ofn.lpstrFilter = "Configuration file (*.olsr)\0*.olsr\0";\r
+       FileDialog.m_ofn.nFilterIndex = 1;\r
+\r
+       FileDialog.m_ofn.lpstrFile = FileName.GetBuffer(500);\r
+       FileDialog.m_ofn.nMaxFile = 500;\r
+\r
+       if (FileDialog.DoModal() == IDOK)\r
+       {\r
+               PathName = FileDialog.GetPathName();\r
+\r
+               if (SaveConfigFile(PathName) < 0)\r
+                       AfxMessageBox("Cannot save configuration file '" + PathName + "'.");\r
+       }\r
+\r
+       FileName.ReleaseBuffer();\r
+}\r
+\r
+void MyDialog2::OnOpenButton() \r
+{\r
+       CFileDialog FileDialog(TRUE);\r
+       CString FileName = "Default.olsr";\r
+       CString PathName;\r
+\r
+       FileDialog.m_ofn.lpstrFilter = "Configuration file (*.olsr)\0*.olsr\0";\r
+       FileDialog.m_ofn.nFilterIndex = 1;\r
+\r
+       FileDialog.m_ofn.lpstrFile = FileName.GetBuffer(500);\r
+       FileDialog.m_ofn.nMaxFile = 500;\r
+\r
+       if (FileDialog.DoModal() == IDOK)\r
+       {\r
+               PathName = FileDialog.GetPathName();\r
+\r
+               if (OpenConfigFile(PathName) < 0)\r
+                       AfxMessageBox("Cannot open configuration file '" + PathName + "'.");\r
+       }\r
+\r
+       FileName.ReleaseBuffer();\r
+}\r
+\r
+void MyDialog2::OnResetButton() \r
+{\r
+       Reset();\r
+}\r
diff --git a/gui/win32/Main/MyDialog2.h b/gui/win32/Main/MyDialog2.h
new file mode 100644 (file)
index 0000000..eb6aff1
--- /dev/null
@@ -0,0 +1,102 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_MYDIALOG2_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_)\r
+#define AFX_MYDIALOG2_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+#include "MyEdit.h"\r
+\r
+class MyDialog2 : public CDialog\r
+{\r
+public:\r
+       MyDialog2(CWnd* pParent = NULL);\r
+\r
+       BOOL Create(CWnd *Parent);\r
+\r
+       int OpenConfigFile(CString);\r
+       int SaveConfigFile(CString);\r
+\r
+       CStringArray *Interfaces;\r
+       CStringArray *Addresses;\r
+\r
+       //{{AFX_DATA(MyDialog2)\r
+       enum { IDD = IDD_DIALOG2 };\r
+       CButton m_TunnelCheck;\r
+       CButton m_Ipv6Check;\r
+       CButton m_InternetCheck;\r
+       CButton m_HystCheck;\r
+       MyEdit  m_HystThresholdHigh;\r
+       MyEdit  m_HystThresholdLow;\r
+       MyEdit  m_HystScaling;\r
+       MyEdit  m_HnaMult;\r
+       MyEdit  m_MidMult;\r
+       MyEdit  m_PollInt;\r
+       MyEdit  m_TcMult;\r
+       MyEdit  m_TcInt;\r
+       MyEdit  m_HnaInt;\r
+       MyEdit  m_MidInt;\r
+       MyEdit  m_HelloMult;\r
+       MyEdit  m_HelloInt;\r
+       CEdit   m_ManualWindow;\r
+       CListCtrl       m_InterfaceList;\r
+       CStatic m_DebugLevelText;\r
+       CSliderCtrl     m_DebugLevel;\r
+       //}}AFX_DATA\r
+\r
+       //{{AFX_VIRTUAL(MyDialog2)\r
+       protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);\r
+       //}}AFX_VIRTUAL\r
+\r
+protected:\r
+\r
+       //{{AFX_MSG(MyDialog2)\r
+       afx_msg void OnOK();\r
+       afx_msg void OnCancel();\r
+       afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);\r
+       virtual BOOL OnInitDialog();\r
+       afx_msg void OnHystCheck();\r
+       afx_msg void OnOpenButton();\r
+       afx_msg void OnSaveButton();\r
+       afx_msg void OnResetButton();\r
+       //}}AFX_MSG\r
+       DECLARE_MESSAGE_MAP()\r
+\r
+       CFont EditFont;\r
+\r
+       int DebugLevel;\r
+       void SetDebugLevel(int);\r
+\r
+       void GetInterfaceList(CString &);\r
+\r
+       void WriteParameter(CFile *, CString, CString);\r
+\r
+       void Reset(void);\r
+};\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MyDialog3.cpp b/gui/win32/Main/MyDialog3.cpp
new file mode 100644 (file)
index 0000000..0ed47cd
--- /dev/null
@@ -0,0 +1,287 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "Frontend.h"\r
+#include "MyDialog3.h"\r
+\r
+#include "MprEntry.h"\r
+#include "MidEntry.h"\r
+#include "HnaEntry.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+MyDialog3::MyDialog3(CWnd* pParent)\r
+       : CDialog(MyDialog3::IDD, pParent)\r
+{\r
+       LastUpdate = 0;\r
+       Info = NULL;\r
+\r
+       //{{AFX_DATA_INIT(MyDialog3)\r
+       //}}AFX_DATA_INIT\r
+}\r
+\r
+BOOL MyDialog3::Create(CWnd *Parent)\r
+{\r
+       return CDialog::Create(MyDialog3::IDD, Parent);\r
+}\r
+\r
+void MyDialog3::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       //{{AFX_DATA_MAP(MyDialog3)\r
+       DDX_Control(pDX, IDC_LIST6, m_HnaList);\r
+       DDX_Control(pDX, IDC_LIST5, m_MidList);\r
+       DDX_Control(pDX, IDC_LIST4, m_MprList);\r
+       DDX_Control(pDX, IDC_LIST1, m_NodeList);\r
+       //}}AFX_DATA_MAP\r
+}\r
+\r
+BEGIN_MESSAGE_MAP(MyDialog3, CDialog)\r
+       //{{AFX_MSG_MAP(MyDialog3)\r
+       ON_BN_CLICKED(IDOK, OnOK)\r
+       ON_BN_CLICKED(IDCANCEL, OnCancel)\r
+       ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, OnItemchangedNodeList)\r
+       //}}AFX_MSG_MAP\r
+END_MESSAGE_MAP()\r
+\r
+void MyDialog3::OnOK()\r
+{\r
+}\r
+\r
+void MyDialog3::OnCancel()\r
+{\r
+}\r
+\r
+BOOL MyDialog3::OnInitDialog() \r
+{\r
+       CDialog::OnInitDialog();\r
+       \r
+       m_NodeList.InsertColumn(0, "Address", LVCFMT_LEFT, 110, 0);\r
+       m_NodeList.InsertColumn(1, "Timeout", LVCFMT_LEFT, 110, 1);\r
+       m_NodeList.InsertColumn(2, "MID", LVCFMT_LEFT, 68, 2);\r
+       m_NodeList.InsertColumn(3, "HNA", LVCFMT_LEFT, 67, 3);\r
+\r
+       m_MprList.InsertColumn(0, "MPR", LVCFMT_LEFT, 169, 0);\r
+\r
+       m_MidList.InsertColumn(0, "MID", LVCFMT_LEFT, 169, 0);\r
+\r
+       m_HnaList.InsertColumn(0, "HNA", LVCFMT_LEFT, 169, 0);\r
+\r
+       return TRUE;\r
+}\r
+\r
+void MyDialog3::ClearNodeInfo(void)\r
+{\r
+       m_NodeList.DeleteAllItems();\r
+\r
+       m_MprList.DeleteAllItems();\r
+       m_MidList.DeleteAllItems();\r
+       m_HnaList.DeleteAllItems();\r
+\r
+       if (Info != NULL)\r
+       {\r
+               delete[] Info;\r
+               Info = NULL;\r
+       }\r
+}\r
+\r
+void MyDialog3::UpdateNodeInfo(CList<class NodeEntry, class NodeEntry &> &NodeList)\r
+{\r
+       SYSTEMTIME SysTime;\r
+       FILETIME FileTime;\r
+       unsigned __int64 Now;\r
+       class NodeEntry Entry;\r
+       POSITION Pos;\r
+       CString AddrStr;\r
+       CString TimeoutStr;\r
+       int Idx, Num;\r
+       POSITION Pos2;\r
+       class MprEntry MprEntry;\r
+       class MidEntry MidEntry;\r
+       class HnaEntry HnaEntry;\r
+       CString CurrNode;\r
+\r
+       ::GetSystemTime(&SysTime);\r
+       ::SystemTimeToFileTime(&SysTime, &FileTime);\r
+\r
+       Now = *(unsigned __int64 *)&FileTime;\r
+\r
+       if (Now < LastUpdate + (__int64)3 * (__int64)10000000)\r
+               return;\r
+\r
+       LastUpdate = Now;\r
+\r
+       int CurrItem = m_NodeList.GetNextItem(-1, LVNI_SELECTED);\r
+\r
+       if (CurrItem >= 0)\r
+               CurrNode = m_NodeList.GetItemText(CurrItem, 0);\r
+\r
+       m_NodeList.DeleteAllItems();\r
+\r
+       if (Info != NULL)\r
+       {\r
+               delete[] Info;\r
+               Info = NULL;\r
+       }\r
+\r
+       Num = NodeList.GetCount();\r
+\r
+       if (Num == 0)\r
+               return;\r
+\r
+       Info = new class NodeInfo[Num];\r
+\r
+       Pos = NodeList.GetHeadPosition();\r
+\r
+       Idx = 0;\r
+\r
+       while (Pos != NULL)\r
+       {\r
+               Entry = NodeList.GetNext(Pos);\r
+\r
+               Pos2 = Entry.MprList.GetHeadPosition();\r
+\r
+               while (Pos2 != NULL)\r
+               {\r
+                       MprEntry = Entry.MprList.GetNext(Pos2);\r
+\r
+                       AddrStr.Format("%d.%d.%d.%d",\r
+                               ((unsigned char *)&MprEntry.Addr)[0], ((unsigned char *)&MprEntry.Addr)[1],\r
+                               ((unsigned char *)&MprEntry.Addr)[2], ((unsigned char *)&MprEntry.Addr)[3]);\r
+\r
+                       Info[Idx].MprList.Add(AddrStr);\r
+               }\r
+\r
+               Pos2 = Entry.MidList.GetHeadPosition();\r
+\r
+               while (Pos2 != NULL)\r
+               {\r
+                       MidEntry = Entry.MidList.GetNext(Pos2);\r
+\r
+                       AddrStr.Format("%d.%d.%d.%d",\r
+                               ((unsigned char *)&MidEntry.Addr)[0], ((unsigned char *)&MidEntry.Addr)[1],\r
+                               ((unsigned char *)&MidEntry.Addr)[2], ((unsigned char *)&MidEntry.Addr)[3]);\r
+\r
+                       Info[Idx].MidList.Add(AddrStr);\r
+               }\r
+\r
+               Pos2 = Entry.HnaList.GetHeadPosition();\r
+\r
+               while (Pos2 != NULL)\r
+               {\r
+                       HnaEntry = Entry.HnaList.GetNext(Pos2);\r
+\r
+                       unsigned int Mask = 0x80000000;\r
+                       unsigned int Val = ::ntohl(HnaEntry.Mask);\r
+                       int Bits;\r
+\r
+                       for (Bits = 0; Bits < 32; Bits++)\r
+                       {\r
+                               if ((Val & Mask) == 0)\r
+                                       break;\r
+\r
+                               Mask >>= 1;\r
+                       }\r
+\r
+                       AddrStr.Format("%d.%d.%d.%d/%d",\r
+                               ((unsigned char *)&HnaEntry.Addr)[0], ((unsigned char *)&HnaEntry.Addr)[1],\r
+                               ((unsigned char *)&HnaEntry.Addr)[2], ((unsigned char *)&HnaEntry.Addr)[3],\r
+                               Bits);\r
+\r
+                       Info[Idx].HnaList.Add(AddrStr);\r
+               }\r
+\r
+               AddrStr.Format("%d.%d.%d.%d",\r
+                       ((unsigned char *)&Entry.Addr)[0], ((unsigned char *)&Entry.Addr)[1],\r
+                       ((unsigned char *)&Entry.Addr)[2], ((unsigned char *)&Entry.Addr)[3]);\r
+\r
+               m_NodeList.InsertItem(Idx, AddrStr);\r
+\r
+               if (AddrStr == CurrNode)\r
+                       m_NodeList.SetItemState(Idx, LVIS_SELECTED, LVIS_SELECTED);\r
+\r
+               SYSTEMTIME SysTime;\r
+               FILETIME LocalFileTime;\r
+\r
+               ::FileTimeToLocalFileTime((FILETIME *)&Entry.Timeout, &LocalFileTime);\r
+               ::FileTimeToSystemTime(&LocalFileTime, &SysTime);\r
+\r
+               TimeoutStr.Format("%02d:%02d:%02d", SysTime.wHour, SysTime.wMinute,\r
+                       SysTime.wSecond);\r
+\r
+               m_NodeList.SetItemText(Idx, 1, TimeoutStr);\r
+\r
+               if (Entry.MidList.IsEmpty())\r
+                       m_NodeList.SetItemText(Idx, 2, "no");\r
+\r
+               else\r
+                       m_NodeList.SetItemText(Idx, 2, "yes");\r
+\r
+               if (Entry.HnaList.IsEmpty())\r
+                       m_NodeList.SetItemText(Idx, 3, "no");\r
+\r
+               else\r
+                       m_NodeList.SetItemText(Idx, 3, "yes");\r
+\r
+               Idx++;\r
+       }\r
+}\r
+\r
+void MyDialog3::OnItemchangedNodeList(NMHDR* pNMHDR, LRESULT* pResult) \r
+{\r
+       int Item;\r
+       int Idx;\r
+       int Num;\r
+\r
+       *pResult = 0;\r
+\r
+       Item = m_NodeList.GetNextItem(-1, LVNI_SELECTED);\r
+\r
+       if (Item < 0)\r
+               return;\r
+\r
+       m_MprList.DeleteAllItems();\r
+\r
+       Num = Info[Item].MprList.GetSize();\r
+       \r
+       for (Idx = 0; Idx < Num; Idx++)\r
+               m_MprList.InsertItem(Idx, Info[Item].MprList.GetAt(Idx));\r
+\r
+       m_MidList.DeleteAllItems();\r
+\r
+       Num = Info[Item].MidList.GetSize();\r
+       \r
+       for (Idx = 0; Idx < Num; Idx++)\r
+               m_MidList.InsertItem(Idx, Info[Item].MidList.GetAt(Idx));\r
+\r
+       m_HnaList.DeleteAllItems();\r
+\r
+       Num = Info[Item].HnaList.GetSize();\r
+       \r
+       for (Idx = 0; Idx < Num; Idx++)\r
+               m_HnaList.InsertItem(Idx, Info[Item].HnaList.GetAt(Idx));\r
+}\r
diff --git a/gui/win32/Main/MyDialog3.h b/gui/win32/Main/MyDialog3.h
new file mode 100644 (file)
index 0000000..ad52474
--- /dev/null
@@ -0,0 +1,79 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_MYDIALOG3_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_)\r
+#define AFX_MYDIALOG3_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+#include "NodeEntry.h"\r
+\r
+class NodeInfo\r
+{\r
+public:\r
+       CStringArray MprList;\r
+       CStringArray MidList;\r
+       CStringArray HnaList;\r
+};\r
+\r
+class MyDialog3 : public CDialog\r
+{\r
+public:\r
+       MyDialog3(CWnd* pParent = NULL);\r
+\r
+       BOOL Create(CWnd *Parent);\r
+\r
+       void UpdateNodeInfo(CList<class NodeEntry, class NodeEntry &> &);\r
+       void ClearNodeInfo(void);\r
+\r
+       //{{AFX_DATA(MyDialog3)\r
+       enum { IDD = IDD_DIALOG3 };\r
+       CListCtrl       m_HnaList;\r
+       CListCtrl       m_MidList;\r
+       CListCtrl       m_MprList;\r
+       CListCtrl       m_NodeList;\r
+       //}}AFX_DATA\r
+\r
+\r
+       //{{AFX_VIRTUAL(MyDialog3)\r
+       protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);\r
+       //}}AFX_VIRTUAL\r
+\r
+protected:\r
+       unsigned __int64 LastUpdate;\r
+       class NodeInfo *Info;\r
+\r
+       //{{AFX_MSG(MyDialog3)\r
+       afx_msg void OnOK();\r
+       afx_msg void OnCancel();\r
+       virtual BOOL OnInitDialog();\r
+       afx_msg void OnItemchangedNodeList(NMHDR* pNMHDR, LRESULT* pResult);\r
+       //}}AFX_MSG\r
+       DECLARE_MESSAGE_MAP()\r
+};\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MyDialog4.cpp b/gui/win32/Main/MyDialog4.cpp
new file mode 100644 (file)
index 0000000..926029c
--- /dev/null
@@ -0,0 +1,136 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "Frontend.h"\r
+#include "MyDialog4.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+MyDialog4::MyDialog4(CWnd* pParent)\r
+       : CDialog(MyDialog4::IDD, pParent)\r
+{\r
+       //{{AFX_DATA_INIT(MyDialog4)\r
+       //}}AFX_DATA_INIT\r
+}\r
+\r
+BOOL MyDialog4::Create(CWnd *Parent)\r
+{\r
+       return CDialog::Create(MyDialog4::IDD, Parent);\r
+}\r
+\r
+void MyDialog4::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       //{{AFX_DATA_MAP(MyDialog4)\r
+       DDX_Control(pDX, IDC_LIST1, m_RoutingTable);\r
+       //}}AFX_DATA_MAP\r
+}\r
+\r
+\r
+BEGIN_MESSAGE_MAP(MyDialog4, CDialog)\r
+       //{{AFX_MSG_MAP(MyDialog4)\r
+       ON_BN_CLICKED(IDOK, OnOK)\r
+       ON_BN_CLICKED(IDCANCEL, OnCancel)\r
+       //}}AFX_MSG_MAP\r
+END_MESSAGE_MAP()\r
+\r
+void MyDialog4::OnOK()\r
+{\r
+}\r
+\r
+void MyDialog4::OnCancel()\r
+{\r
+}\r
+\r
+BOOL MyDialog4::OnInitDialog() \r
+{\r
+       CDialog::OnInitDialog();\r
+\r
+       m_RoutingTable.InsertColumn(0, "Destination", LVCFMT_LEFT, 110, 0);\r
+       m_RoutingTable.InsertColumn(1, "Gateway", LVCFMT_LEFT, 110, 1);\r
+       m_RoutingTable.InsertColumn(2, "Metric", LVCFMT_LEFT, 68, 2);\r
+       m_RoutingTable.InsertColumn(3, "Interface", LVCFMT_LEFT, 67, 3);\r
+\r
+       return TRUE;\r
+}\r
+\r
+void MyDialog4::AddRoute(unsigned int Dest, unsigned int Gate, int Metric,\r
+                                                char *Int)\r
+{\r
+       CString DestStr;\r
+       CString GateStr;\r
+       CString MetricStr;\r
+       CString IntStr;\r
+       int Idx;\r
+\r
+       DestStr.Format("%d.%d.%d.%d",\r
+               ((unsigned char *)&Dest)[0], ((unsigned char *)&Dest)[1],\r
+               ((unsigned char *)&Dest)[2], ((unsigned char *)&Dest)[3]);\r
+\r
+       GateStr.Format("%d.%d.%d.%d",\r
+               ((unsigned char *)&Gate)[0], ((unsigned char *)&Gate)[1],\r
+               ((unsigned char *)&Gate)[2], ((unsigned char *)&Gate)[3]);\r
+\r
+       MetricStr.Format("%d", Metric);\r
+\r
+       IntStr.Format("%c%c%c%c", Int[0], Int[1], Int[2], Int[3]);\r
+       IntStr.MakeUpper();\r
+\r
+       Idx = m_RoutingTable.GetItemCount();\r
+\r
+       m_RoutingTable.InsertItem(Idx, DestStr);\r
+\r
+       m_RoutingTable.SetItemText(Idx, 1, GateStr);\r
+       m_RoutingTable.SetItemText(Idx, 2, MetricStr);\r
+       m_RoutingTable.SetItemText(Idx, 3, IntStr);\r
+}\r
+\r
+void MyDialog4::DeleteRoute(unsigned int Dest)\r
+{\r
+       CString DestStr;\r
+       int Idx, Num;\r
+\r
+       DestStr.Format("%d.%d.%d.%d",\r
+               ((unsigned char *)&Dest)[0], ((unsigned char *)&Dest)[1],\r
+               ((unsigned char *)&Dest)[2], ((unsigned char *)&Dest)[3]);\r
+\r
+       Num = m_RoutingTable.GetItemCount();\r
+\r
+       for (Idx = 0; Idx < Num; Idx++)\r
+       {\r
+               if (m_RoutingTable.GetItemText(Idx, 0) == DestStr)\r
+               {\r
+                       m_RoutingTable.DeleteItem(Idx);\r
+                       break;\r
+               }\r
+       }\r
+}\r
+\r
+void MyDialog4::ClearRoutes(void)\r
+{\r
+       m_RoutingTable.DeleteAllItems();\r
+}\r
diff --git a/gui/win32/Main/MyDialog4.h b/gui/win32/Main/MyDialog4.h
new file mode 100644 (file)
index 0000000..1830ffe
--- /dev/null
@@ -0,0 +1,64 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_MYDIALOG4_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_)\r
+#define AFX_MYDIALOG4_H__1A381668_A36B_4C51_9B79_643BC2A59D88__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+class MyDialog4 : public CDialog\r
+{\r
+public:\r
+       MyDialog4(CWnd* pParent = NULL);\r
+\r
+       BOOL Create(CWnd *Parent);\r
+\r
+       void AddRoute(unsigned int, unsigned int, int, char *);\r
+       void DeleteRoute(unsigned int);\r
+       void ClearRoutes(void);\r
+\r
+       //{{AFX_DATA(MyDialog4)\r
+       enum { IDD = IDD_DIALOG4 };\r
+       CListCtrl       m_RoutingTable;\r
+       //}}AFX_DATA\r
+\r
+\r
+       //{{AFX_VIRTUAL(MyDialog4)\r
+       protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);\r
+       //}}AFX_VIRTUAL\r
+\r
+protected:\r
+\r
+       //{{AFX_MSG(MyDialog4)\r
+       afx_msg void OnOK();\r
+       afx_msg void OnCancel();\r
+       virtual BOOL OnInitDialog();\r
+       //}}AFX_MSG\r
+       DECLARE_MESSAGE_MAP()\r
+};\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MyEdit.cpp b/gui/win32/Main/MyEdit.cpp
new file mode 100644 (file)
index 0000000..f287a7a
--- /dev/null
@@ -0,0 +1,98 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "frontend.h"\r
+#include "MyEdit.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+MyEdit::MyEdit()\r
+{\r
+}\r
+\r
+MyEdit::~MyEdit()\r
+{\r
+}\r
+\r
+\r
+BEGIN_MESSAGE_MAP(MyEdit, CEdit)\r
+       //{{AFX_MSG_MAP(MyEdit)\r
+       ON_WM_CHAR()\r
+       ON_WM_KILLFOCUS()\r
+       //}}AFX_MSG_MAP\r
+END_MESSAGE_MAP()\r
+\r
+void MyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) \r
+{\r
+       static unsigned char *Allowed = (unsigned char *)"0123456789.";\r
+       int i;\r
+       CString Text;\r
+\r
+       if (nChar >= 32)\r
+       {\r
+               for (i = 0; Allowed[i] != 0; i++)\r
+                       if (nChar == Allowed[i])\r
+                               break;\r
+\r
+               if (Allowed[i] == 0)\r
+                       return;\r
+\r
+               GetWindowText(Text);\r
+\r
+               if (nChar == '.' && Text.Find('.') >= 0)\r
+                       return;\r
+\r
+               if (Text.GetLength() > 2 && Text.Find('.') < 0 && nChar != '.')\r
+                       return;\r
+       }\r
+       \r
+       CEdit::OnChar(nChar, nRepCnt, nFlags);\r
+}\r
+\r
+void MyEdit::OnKillFocus(CWnd* pNewWnd) \r
+{\r
+       CString Text;\r
+       int Index;\r
+       int Len;\r
+\r
+       GetWindowText(Text);\r
+\r
+       Index = Text.Find('.');\r
+\r
+       Len = Text.GetLength();\r
+\r
+       if (Len == 0)\r
+               SetWindowText("0.0");\r
+\r
+       else if (Index < 0)\r
+               SetWindowText(Text + ".0");\r
+\r
+       else if (Index == Len - 1)\r
+               SetWindowText(Text + "0");\r
+\r
+       CEdit::OnKillFocus(pNewWnd);\r
+}\r
diff --git a/gui/win32/Main/MyEdit.h b/gui/win32/Main/MyEdit.h
new file mode 100644 (file)
index 0000000..d6a3a79
--- /dev/null
@@ -0,0 +1,52 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_MYEDIT_H__951EC391_AFE3_428F_865D_24CA55C68C7C__INCLUDED_)\r
+#define AFX_MYEDIT_H__951EC391_AFE3_428F_865D_24CA55C68C7C__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+class MyEdit : public CEdit\r
+{\r
+public:\r
+\r
+       MyEdit();\r
+\r
+       //{{AFX_VIRTUAL(MyEdit)\r
+       //}}AFX_VIRTUAL\r
+\r
+       virtual ~MyEdit();\r
+\r
+protected:\r
+       //{{AFX_MSG(MyEdit)\r
+       afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);\r
+       afx_msg void OnKillFocus(CWnd* pNewWnd);\r
+       //}}AFX_MSG\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+};\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/MyTabCtrl.cpp b/gui/win32/Main/MyTabCtrl.cpp
new file mode 100644 (file)
index 0000000..01aa2ab
--- /dev/null
@@ -0,0 +1,103 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "Frontend.h"\r
+#include "MyTabCtrl.h"\r
+\r
+#ifdef _DEBUG\r
+#define new DEBUG_NEW\r
+#undef THIS_FILE\r
+static char THIS_FILE[] = __FILE__;\r
+#endif\r
+\r
+MyTabCtrl::MyTabCtrl()\r
+{\r
+}\r
+\r
+MyTabCtrl::~MyTabCtrl()\r
+{\r
+}\r
+\r
+BEGIN_MESSAGE_MAP(MyTabCtrl, CTabCtrl)\r
+       //{{AFX_MSG_MAP(MyTabCtrl)\r
+       ON_NOTIFY_REFLECT(TCN_SELCHANGE, OnSelchange)\r
+       //}}AFX_MSG_MAP\r
+END_MESSAGE_MAP()\r
+\r
+void MyTabCtrl::InitTabDialogs(CStringArray *Interfaces,\r
+                                                          CStringArray *Addresses)\r
+{\r
+       int i;\r
+       CRect Client;\r
+       CRect Win;\r
+\r
+       m_Dialog2.Interfaces = Interfaces;\r
+       m_Dialog2.Addresses = Addresses;\r
+\r
+       m_Dialog1.Create(GetParent());\r
+       m_Dialog2.Create(GetParent());\r
+       m_Dialog3.Create(GetParent());\r
+       m_Dialog4.Create(GetParent());\r
+\r
+       Dialogs[0] = &m_Dialog2;\r
+       Dialogs[1] = &m_Dialog1;\r
+       Dialogs[2] = &m_Dialog3;\r
+       Dialogs[3] = &m_Dialog4;\r
+\r
+       Sel = -1;\r
+\r
+       for (i = 0; i < 4; i++)\r
+       {\r
+               GetClientRect(Client);\r
+               AdjustRect(FALSE, Client);\r
+\r
+               GetWindowRect(Win);\r
+               GetParent()->ScreenToClient(Win);\r
+\r
+               Client.OffsetRect(Win.left, Win.top);\r
+\r
+               Dialogs[i]->SetWindowPos(&wndTop, Client.left, Client.top,\r
+                       Client.Width(), Client.Height(), SWP_HIDEWINDOW);\r
+       }\r
+\r
+       DisplayTabDialog();\r
+}\r
+\r
+void MyTabCtrl::DisplayTabDialog()\r
+{\r
+       if (Sel != -1)\r
+               Dialogs[Sel]->ShowWindow(SW_HIDE);\r
+\r
+       Sel = GetCurSel();\r
+\r
+       Dialogs[Sel]->ShowWindow(SW_SHOW);\r
+}\r
+\r
+void MyTabCtrl::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) \r
+{\r
+       pNMHDR = pNMHDR;\r
+\r
+       DisplayTabDialog();\r
+\r
+       *pResult = 0;\r
+}\r
diff --git a/gui/win32/Main/MyTabCtrl.h b/gui/win32/Main/MyTabCtrl.h
new file mode 100644 (file)
index 0000000..8586d64
--- /dev/null
@@ -0,0 +1,66 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_MYTABCTRL_H__D443FF52_C52D_4C89_AB4B_19B09687EBAE__INCLUDED_)\r
+#define AFX_MYTABCTRL_H__D443FF52_C52D_4C89_AB4B_19B09687EBAE__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+#include "MyDialog1.h"\r
+#include "MyDialog2.h"\r
+#include "MyDialog3.h"\r
+#include "MyDialog4.h"\r
+\r
+class MyTabCtrl : public CTabCtrl\r
+{\r
+public:\r
+       MyTabCtrl();\r
+\r
+       class MyDialog1 m_Dialog1;\r
+       class MyDialog2 m_Dialog2;\r
+       class MyDialog3 m_Dialog3;\r
+       class MyDialog4 m_Dialog4;\r
+\r
+       void InitTabDialogs(CStringArray *, CStringArray *);\r
+       void DisplayTabDialog(void);\r
+\r
+       //{{AFX_VIRTUAL(MyTabCtrl)\r
+       //}}AFX_VIRTUAL\r
+\r
+       virtual ~MyTabCtrl();\r
+\r
+protected:\r
+       CDialog *Dialogs[4];\r
+       int Sel;\r
+\r
+       //{{AFX_MSG(MyTabCtrl)\r
+       afx_msg void OnSelchange(NMHDR* pNMHDR, LRESULT* pResult);\r
+       //}}AFX_MSG\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+};\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/NodeEntry.cpp b/gui/win32/Main/NodeEntry.cpp
new file mode 100644 (file)
index 0000000..8de0ebb
--- /dev/null
@@ -0,0 +1,114 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+#include "NodeEntry.h"\r
+\r
+class NodeEntry &NodeEntry::operator=(class NodeEntry &Src)\r
+{\r
+       Addr = Src.Addr;\r
+       Timeout = Src.Timeout;\r
+\r
+       MprList.RemoveAll();\r
+       MprList.AddHead(&Src.MprList);\r
+\r
+       HnaList.RemoveAll();\r
+       HnaList.AddHead(&Src.HnaList);\r
+\r
+       MidList.RemoveAll();\r
+       MidList.AddHead(&Src.MidList);\r
+\r
+       return *this;\r
+}\r
+\r
+BOOL NodeEntry::operator==(const class NodeEntry &Comp) const\r
+{\r
+       return Addr == Comp.Addr;\r
+}\r
+\r
+void NodeEntry::AddMpr(unsigned int MprAddr, unsigned __int64 Timeout)\r
+{\r
+       class MprEntry NewEntry;\r
+       POSITION Pos;\r
+\r
+       NewEntry.Addr = MprAddr;\r
+\r
+       Pos = MprList.Find(NewEntry);\r
+\r
+       if (Pos != NULL)\r
+       {\r
+               class MprEntry &OldEntry = MprList.GetAt(Pos);\r
+               OldEntry.Timeout = Timeout;\r
+       }\r
+\r
+       else\r
+       {\r
+               NewEntry.Timeout = Timeout;\r
+               MprList.AddTail(NewEntry);\r
+       }\r
+}\r
+\r
+void NodeEntry::AddMid(unsigned int IntAddr, unsigned __int64 Timeout)\r
+{\r
+       class MidEntry NewEntry;\r
+       POSITION Pos;\r
+\r
+       NewEntry.Addr = IntAddr;\r
+\r
+       Pos = MidList.Find(NewEntry);\r
+\r
+       if (Pos != NULL)\r
+       {\r
+               class MidEntry &OldEntry = MidList.GetAt(Pos);\r
+               OldEntry.Timeout = Timeout;\r
+       }\r
+\r
+       else\r
+       {\r
+               NewEntry.Timeout = Timeout;\r
+               MidList.AddTail(NewEntry);\r
+       }\r
+}\r
+\r
+void NodeEntry::AddHna(unsigned int NetAddr, unsigned int NetMask,\r
+                                          unsigned __int64 Timeout)\r
+{\r
+       class HnaEntry NewEntry;\r
+       POSITION Pos;\r
+\r
+       NewEntry.Addr = NetAddr;\r
+       NewEntry.Mask = NetMask;\r
+\r
+       Pos = HnaList.Find(NewEntry);\r
+\r
+       if (Pos != NULL)\r
+       {\r
+               class HnaEntry &OldEntry = HnaList.GetAt(Pos);\r
+               OldEntry.Timeout = Timeout;\r
+       }\r
+\r
+       else\r
+       {\r
+               NewEntry.Timeout = Timeout;\r
+               HnaList.AddTail(NewEntry);\r
+       }\r
+}\r
diff --git a/gui/win32/Main/NodeEntry.h b/gui/win32/Main/NodeEntry.h
new file mode 100644 (file)
index 0000000..dea7bd6
--- /dev/null
@@ -0,0 +1,48 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined TL_NODEENTRY_H\r
+#define TL_NODEENTRY_H\r
+\r
+#include "MprEntry.h"\r
+#include "MidEntry.h"\r
+#include "HnaEntry.h"\r
+\r
+class NodeEntry\r
+{\r
+public:\r
+       unsigned int Addr;\r
+       unsigned __int64 Timeout;\r
+\r
+       CList<class MprEntry, class MprEntry &> MprList;\r
+       CList<class MidEntry, class MidEntry &> MidList;\r
+       CList<class HnaEntry, class HnaEntry &> HnaList;\r
+\r
+       void AddMpr(unsigned int, unsigned __int64);\r
+       void AddMid(unsigned int, unsigned __int64);\r
+       void AddHna(unsigned int, unsigned int, unsigned __int64);\r
+\r
+       class NodeEntry &NodeEntry::operator=(class NodeEntry &);\r
+       BOOL NodeEntry::operator==(const class NodeEntry &) const;\r
+};\r
+\r
+#endif\r
diff --git a/gui/win32/Main/StdAfx.cpp b/gui/win32/Main/StdAfx.cpp
new file mode 100644 (file)
index 0000000..6886346
--- /dev/null
@@ -0,0 +1,26 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#include "stdafx.h"\r
+\r
+\r
+\r
diff --git a/gui/win32/Main/StdAfx.h b/gui/win32/Main/StdAfx.h
new file mode 100644 (file)
index 0000000..f535047
--- /dev/null
@@ -0,0 +1,44 @@
+/*\r
+ * Windows GUI for olsr.org\r
+ * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
+ *\r
+ * This file is part of olsr.org.\r
+ *\r
+ * olsr.org is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * olsr.org is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with olsr.org; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ */\r
+\r
+#if !defined(AFX_STDAFX_H__6D907246_27D7_4991_B71E_C1105DD65FBC__INCLUDED_)\r
+#define AFX_STDAFX_H__6D907246_27D7_4991_B71E_C1105DD65FBC__INCLUDED_\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif\r
+\r
+#define VC_EXTRALEAN\r
+\r
+#include <afxwin.h>\r
+#include <afxext.h>\r
+#include <afxdtctl.h>\r
+#include <afxcmn.h>\r
+#include <afxmt.h>\r
+#include <afxtempl.h>\r
+\r
+#include <winsock2.h>\r
+#include <iphlpapi.h>\r
+\r
+//{{AFX_INSERT_LOCATION}}\r
+\r
+#endif\r
diff --git a/gui/win32/Main/gnome-shutdown.png b/gui/win32/Main/gnome-shutdown.png
new file mode 100644 (file)
index 0000000..244330e
Binary files /dev/null and b/gui/win32/Main/gnome-shutdown.png differ
diff --git a/gui/win32/Main/resource.h b/gui/win32/Main/resource.h
new file mode 100644 (file)
index 0000000..a911b46
--- /dev/null
@@ -0,0 +1,52 @@
+//{{NO_DEPENDENCIES}}\r
+// Microsoft Developer Studio generated include file.\r
+// Used by Frontend.rc\r
+//\r
+#define IDD_FRONTEND_DIALOG             102\r
+#define IDP_SOCKETS_INIT_FAILED         103\r
+#define IDR_MAINFRAME                   128\r
+#define IDD_DIALOG1                     129\r
+#define IDD_DIALOG2                     130\r
+#define IDD_DIALOG3                     131\r
+#define IDD_DIALOG4                     132\r
+#define IDI_ICON1                       132\r
+#define IDC_TAB1                        1000\r
+#define IDC_BUTTON1                     1001\r
+#define IDC_EDIT1                       1003\r
+#define IDC_BUTTON2                     1004\r
+#define IDC_EDIT2                       1004\r
+#define IDC_EDIT3                       1005\r
+#define IDC_BUTTON3                     1006\r
+#define IDC_EDIT4                       1006\r
+#define IDC_EDIT5                       1007\r
+#define IDC_LIST1                       1008\r
+#define IDC_SLIDER2                     1009\r
+#define IDC_TEXT1                       1010\r
+#define IDC_EDIT6                       1011\r
+#define IDC_EDIT7                       1012\r
+#define IDC_CHECK1                      1013\r
+#define IDC_CHECK2                      1014\r
+#define IDC_EDIT9                       1015\r
+#define IDC_CHECK3                      1016\r
+#define IDC_BUTTON4                     1017\r
+#define IDC_BUTTON5                     1018\r
+#define IDC_CHECK4                      1019\r
+#define IDC_EDIT10                      1020\r
+#define IDC_EDIT11                      1021\r
+#define IDC_EDIT8                       1022\r
+#define IDC_EDIT12                      1023\r
+#define IDC_EDIT13                      1024\r
+#define IDC_LIST4                       1025\r
+#define IDC_LIST5                       1026\r
+#define IDC_LIST6                       1027\r
+\r
+// Next default values for new objects\r
+// \r
+#ifdef APSTUDIO_INVOKED\r
+#ifndef APSTUDIO_READONLY_SYMBOLS\r
+#define _APS_NEXT_RESOURCE_VALUE        137\r
+#define _APS_NEXT_COMMAND_VALUE         32771\r
+#define _APS_NEXT_CONTROL_VALUE         1027\r
+#define _APS_NEXT_SYMED_VALUE           101\r
+#endif\r
+#endif\r