Support for the new configuration file format and for link quality.
authorThomas Lopatic <thomas@lopatic.de>
Sat, 20 Nov 2004 22:52:49 +0000 (22:52 +0000)
committerThomas Lopatic <thomas@lopatic.de>
Sat, 20 Nov 2004 22:52:49 +0000 (22:52 +0000)
gui/win32/Frontend.ncb
gui/win32/Frontend.opt
gui/win32/Main/Frontend.clw
gui/win32/Main/Frontend.dsp
gui/win32/Main/Frontend.rc
gui/win32/Main/FrontendDlg.cpp
gui/win32/Main/MyDialog2.cpp
gui/win32/Main/MyDialog2.h
gui/win32/Main/resource.h

index 5dfb8b4..b9756f3 100644 (file)
Binary files a/gui/win32/Frontend.ncb and b/gui/win32/Frontend.ncb differ
index 34366f5..f65322d 100644 (file)
Binary files a/gui/win32/Frontend.opt and b/gui/win32/Frontend.opt differ
index 511d8c7..0e8fec3 100644 (file)
@@ -2,7 +2,7 @@
 \r
 [General Info]\r
 Version=1\r
-LastClass=MyDialog1\r
+LastClass=MyDialog2\r
 LastTemplate=CDialog\r
 NewFileInclude1=#include "stdafx.h"\r
 NewFileInclude2=#include "frontend.h"\r
@@ -52,6 +52,9 @@ Type=0
 BaseClass=CDialog\r
 HeaderFile=MyDialog2.h\r
 ImplementationFile=MyDialog2.cpp\r
+Filter=D\r
+VirtualFilter=dWC\r
+LastObject=IDC_EDIT14\r
 \r
 [CLS:MyDialog3]\r
 Type=0\r
@@ -102,33 +105,33 @@ Control5=IDC_BUTTON1,button,1342242816
 [DLG:IDD_DIALOG2]\r
 Type=1\r
 Class=MyDialog2\r
-ControlCount=47\r
+ControlCount=49\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
+Control3=IDC_CHECK3,button,1476460547\r
+Control4=IDC_CHECK2,button,1342242819\r
+Control5=IDC_EDIT1,edit,1350631426\r
+Control6=IDC_EDIT2,edit,1350631426\r
+Control7=IDC_EDIT3,edit,1350631426\r
+Control8=IDC_EDIT9,edit,1350631426\r
+Control9=IDC_EDIT4,edit,1350631426\r
+Control10=IDC_EDIT10,edit,1350631426\r
+Control11=IDC_EDIT5,edit,1350631426\r
+Control12=IDC_EDIT6,edit,1350631426\r
+Control13=IDC_EDIT7,edit,1350631426\r
+Control14=IDC_CHECK1,button,1342242819\r
+Control15=IDC_EDIT12,edit,1350631426\r
+Control16=IDC_EDIT13,edit,1350631426\r
+Control17=IDC_EDIT11,edit,1350631426\r
+Control18=IDC_CHECK4,button,1342242819\r
+Control19=IDC_RADIO1,button,1342373897\r
+Control20=IDC_RADIO2,button,1342373897\r
+Control21=IDC_EDIT14,edit,1350639618\r
+Control22=IDC_BUTTON4,button,1342242816\r
+Control23=IDC_BUTTON5,button,1342242816\r
+Control24=IDC_BUTTON1,button,1342242816\r
 Control25=IDC_STATIC,static,1342308352\r
-Control26=IDC_STATIC,static,1342308354\r
+Control26=IDC_STATIC,static,1342308352\r
 Control27=IDC_STATIC,static,1342308354\r
 Control28=IDC_STATIC,static,1342308354\r
 Control29=IDC_STATIC,static,1342308354\r
@@ -137,7 +140,7 @@ Control31=IDC_STATIC,static,1342308354
 Control32=IDC_STATIC,static,1342308354\r
 Control33=IDC_STATIC,static,1342308354\r
 Control34=IDC_STATIC,static,1342308354\r
-Control35=IDC_STATIC,static,1342308352\r
+Control35=IDC_STATIC,static,1342308354\r
 Control36=IDC_STATIC,static,1342308352\r
 Control37=IDC_STATIC,static,1342308352\r
 Control38=IDC_STATIC,static,1342308352\r
@@ -146,10 +149,12 @@ Control40=IDC_STATIC,static,1342308352
 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
+Control44=IDC_STATIC,static,1342308352\r
+Control45=IDC_TEXT1,static,1342308353\r
 Control46=IDC_STATIC,static,1342308354\r
 Control47=IDC_STATIC,static,1342308354\r
+Control48=IDC_STATIC,static,1342308354\r
+Control49=IDC_STATIC,static,1342308354\r
 \r
 [DLG:IDD_DIALOG3]\r
 Type=1\r
index 33b7210..9766774 100644 (file)
@@ -43,7 +43,7 @@ RSC=rc.exe
 # 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 CPP /nologo /MT /W4 /GX /O1 /I "..\..\..\src" /I "..\..\..\src\win32" /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
@@ -53,7 +53,7 @@ BSC32=bscmake.exe
 # 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
+# ADD LINK32 ws2_32.lib iphlpapi.lib olsrd_cfgparser.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Release/Switch.exe" /libpath:"C:\Program Files\Microsoft SDK\lib"\r
 \r
 !ELSEIF  "$(CFG)" == "Frontend - Win32 Debug"\r
 \r
@@ -69,7 +69,7 @@ LINK32=link.exe
 # 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 CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\..\..\src" /I "..\..\..\src\win32" /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
@@ -79,7 +79,7 @@ BSC32=bscmake.exe
 # 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
+# ADD LINK32 ws2_32.lib iphlpapi.lib olsrd_cfgparser.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
index fa4cf56..4e19767 100644 (file)
@@ -68,7 +68,7 @@ IDD_FRONTEND_DIALOG DIALOGEX 0, 0, 399, 289
 STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | \r
     WS_SYSMENU\r
 EXSTYLE WS_EX_APPWINDOW\r
-CAPTION "olsr.org Switch 0.4.7"\r
+CAPTION "olsr.org Switch 0.4.8"\r
 FONT 8, "MS Sans Serif"\r
 BEGIN\r
     CONTROL         "Tab1",IDC_TAB1,"SysTabControl32",0x0,7,7,383,256\r
@@ -97,6 +97,10 @@ BEGIN
                     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
+    CONTROL         "Enable IP version 6",IDC_CHECK3,"Button",\r
+                    BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,155,93,10\r
+    CONTROL         "Offer Internet connection",IDC_CHECK2,"Button",\r
+                    BS_AUTOCHECKBOX | WS_TABSTOP,7,171,93,10\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
@@ -105,26 +109,25 @@ BEGIN
     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
+    EDITTEXT        IDC_EDIT7,189,77,26,12,ES_RIGHT\r
+    CONTROL         "Enable hysteresis",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | \r
+                    WS_TABSTOP,134,101,74,10\r
+    EDITTEXT        IDC_EDIT12,189,115,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT13,299,115,26,12,ES_RIGHT\r
+    EDITTEXT        IDC_EDIT11,189,131,26,12,ES_RIGHT\r
+    CONTROL         "Enable ETX link quality",IDC_CHECK4,"Button",\r
+                    BS_AUTOCHECKBOX | WS_TABSTOP,132,155,92,10\r
+    CONTROL         "for MPR selection only",IDC_RADIO1,"Button",\r
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,132,171,87,10\r
+    CONTROL         "for MPR selection and routing",IDC_RADIO2,"Button",\r
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,132,187,109,\r
+                    10\r
+    EDITTEXT        IDC_EDIT14,299,169,26,12,ES_RIGHT | ES_NUMBER\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
@@ -133,20 +136,21 @@ BEGIN
     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
+    RTEXT           "Poll interval:",IDC_STATIC,132,79,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,329,9,12,8\r
     LTEXT           "sec",IDC_STATIC,219,25,12,8\r
-    LTEXT           "x",IDC_STATIC,329,25,8,8\r
+    LTEXT           "sec",IDC_STATIC,329,25,12,8\r
     LTEXT           "sec",IDC_STATIC,219,41,12,8\r
-    LTEXT           "x",IDC_STATIC,329,41,8,8\r
+    LTEXT           "sec",IDC_STATIC,329,41,12,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
+    LTEXT           "sec",IDC_STATIC,329,57,12,8\r
+    LTEXT           "sec",IDC_STATIC,219,79,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
+    RTEXT           "Scaling:",IDC_STATIC,132,133,26,8\r
+    RTEXT           "Low mark:",IDC_STATIC,132,117,34,8\r
+    RTEXT           "High mark:",IDC_STATIC,251,117,35,8\r
+    RTEXT           "Window size:",IDC_STATIC,251,171,43,8\r
 END\r
 \r
 IDD_DIALOG3 DIALOG DISCARDABLE  0, 0, 377, 240\r
index 49cca12..d85b04d 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * $Id: FrontendDlg.cpp,v 1.5 2004/11/18 18:02:36 tlopatic Exp $\r
+ * $Id: FrontendDlg.cpp,v 1.6 2004/11/20 22:52:49 tlopatic Exp $\r
  * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
  *\r
  * This file is part of olsr.org.\r
@@ -769,14 +769,14 @@ int CFrontendDlg::StartOlsrd()
 \r
        StoredTempFile = TempPath;\r
 \r
-       if (m_TabCtrl.m_Dialog2.SaveConfigFile(StoredTempFile) < 0)\r
+       if (m_TabCtrl.m_Dialog2.SaveConfigFile(StoredTempFile, 0) < 0)\r
        {\r
                AfxMessageBox("Cannot save temporary configuration file '" + \r
                        StoredTempFile + "'.");\r
                return -1;\r
        }\r
 \r
-       CmdLine += " -f " + StoredTempFile + " -ipc";\r
+       CmdLine += " -f " + StoredTempFile;\r
 \r
        if (ExecutePipe((const char *)CmdLine, &InWrite, &OutRead, &ShimProc) < 0)\r
        {\r
@@ -806,7 +806,7 @@ int CFrontendDlg::StartOlsrd()
                return -1;\r
        }\r
 \r
-       for (Try = 0; Try < 10; Try++)\r
+       for (Try = 0; Try < 5; Try++)\r
        {\r
                if (::connect(SockHand, (struct sockaddr *)&Addr,\r
                        sizeof (struct sockaddr_in)) >= 0)\r
@@ -908,6 +908,9 @@ void CFrontendDlg::OnStartButton()
 \r
        if (StartOlsrd() < 0)\r
        {\r
+               m_TabCtrl.m_Dialog1.SetFrozen(0);\r
+               m_TabCtrl.m_Dialog1.AddOutputLine("");\r
+\r
                AfxMessageBox("Cannot start OLSR server.");\r
 \r
                m_StartButton.EnableWindow(TRUE);\r
index 3fcebe0..b2a6ce3 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * $Id: MyDialog2.cpp,v 1.3 2004/09/15 11:18:41 tlopatic Exp $\r
+ * $Id: MyDialog2.cpp,v 1.4 2004/11/20 22:52:49 tlopatic Exp $\r
  * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
  *\r
  * This file is part of olsr.org.\r
@@ -35,6 +35,8 @@ static char THIS_FILE[] = __FILE__;
 MyDialog2::MyDialog2(CWnd* pParent)\r
        : CDialog(MyDialog2::IDD, pParent)\r
 {\r
+       Conf = NULL;\r
+\r
        //{{AFX_DATA_INIT(MyDialog2)\r
        //}}AFX_DATA_INIT\r
 }\r
@@ -51,27 +53,6 @@ void MyDialog2::SetDebugLevel(int Level)
        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
@@ -81,23 +62,25 @@ void MyDialog2::DoDataExchange(CDataExchange* pDX)
 {\r
        CDialog::DoDataExchange(pDX);\r
        //{{AFX_DATA_MAP(MyDialog2)\r
-       DDX_Control(pDX, IDC_CHECK4, m_TunnelCheck);\r
+       DDX_Control(pDX, IDC_RADIO2, m_EtxRadio2);\r
+       DDX_Control(pDX, IDC_RADIO1, m_EtxRadio1);\r
+       DDX_Control(pDX, IDC_EDIT14, m_EtxWindowSize);\r
+       DDX_Control(pDX, IDC_CHECK4, m_EtxCheck);\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_EDIT10, m_HnaHold);\r
+       DDX_Control(pDX, IDC_EDIT9, m_MidHold);\r
        DDX_Control(pDX, IDC_EDIT7, m_PollInt);\r
-       DDX_Control(pDX, IDC_EDIT6, m_TcMult);\r
+       DDX_Control(pDX, IDC_EDIT6, m_TcHold);\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_EDIT2, m_HelloHold);\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
@@ -110,9 +93,13 @@ BEGIN_MESSAGE_MAP(MyDialog2, CDialog)
        ON_BN_CLICKED(IDC_CHECK1, OnHystCheck)\r
        ON_BN_CLICKED(IDC_BUTTON4, OnOpenButton)\r
        ON_BN_CLICKED(IDC_BUTTON5, OnSaveButton)\r
+       ON_BN_CLICKED(IDC_BUTTON1, OnResetButton)\r
+       ON_BN_CLICKED(IDC_CHECK4, OnEtxCheck)\r
+       ON_BN_CLICKED(IDC_RADIO1, OnEtxRadio1)\r
+       ON_BN_CLICKED(IDC_RADIO2, OnEtxRadio2)\r
        ON_BN_CLICKED(IDOK, OnOK)\r
        ON_BN_CLICKED(IDCANCEL, OnCancel)\r
-       ON_BN_CLICKED(IDC_BUTTON1, OnResetButton)\r
+       ON_EN_KILLFOCUS(IDC_EDIT14, OnKillfocusEtxWinSize)\r
        //}}AFX_MSG_MAP\r
 END_MESSAGE_MAP()\r
 \r
@@ -134,46 +121,35 @@ void MyDialog2::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
 \r
 void MyDialog2::Reset(void)\r
 {\r
+       char PathName[MAX_PATH + 50];\r
+       char *Walker;\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
+       ::GetModuleFileName(NULL, PathName, MAX_PATH);\r
 \r
-       m_HnaInt.SetWindowText("10.0");\r
-       m_HnaMult.SetWindowText("3.0");\r
-\r
-       m_PollInt.SetWindowText("0.1");\r
+       for (Walker = PathName; *Walker != 0; Walker++);\r
+       \r
+       while (*Walker != '\\')\r
+               Walker--;\r
 \r
-       m_HystThresholdLow.SetWindowText("0.3");\r
-       m_HystThresholdHigh.SetWindowText("0.8");\r
-       m_HystScaling.SetWindowText("0.5");\r
+       lstrcpy(Walker + 1, "Default.olsr");\r
 \r
-       m_HystCheck.SetCheck(TRUE);\r
+       if (OpenConfigFile(PathName) < 0)\r
+               return;\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
+       if (Conf->interfaces == NULL)\r
        {\r
-               if ((*IsWlan)[i] == "-")\r
-                       m_InterfaceList.SetCheck(i, FALSE);\r
+               for (i = 0; i < Interfaces->GetSize(); i++)\r
+               {\r
+                       if ((*IsWlan)[i] == "-")\r
+                               m_InterfaceList.SetCheck(i, FALSE);\r
 \r
-               else\r
-                       m_InterfaceList.SetCheck(i, TRUE);\r
+                       else\r
+                               m_InterfaceList.SetCheck(i, TRUE);\r
+               }\r
        }\r
-\r
-       m_ManualWindow.SetWindowText("");\r
 }\r
 \r
 BOOL MyDialog2::OnInitDialog() \r
@@ -182,11 +158,6 @@ BOOL MyDialog2::OnInitDialog()
 \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
@@ -217,226 +188,383 @@ void MyDialog2::OnHystCheck()
        m_HystScaling.EnableWindow(EnaDis);\r
 }\r
 \r
-\r
-void MyDialog2::WriteParameter(CFile *File, CString Name, CString Value)\r
+void MyDialog2::OnEtxCheck() \r
 {\r
-       CString Line;\r
-\r
-       Line = Name + " " + Value + "\r\n";\r
-\r
-       File->Write(Line.GetBuffer(0), Line.GetLength());\r
+       BOOL EnaDis = m_EtxCheck.GetCheck();\r
 \r
-       Line.ReleaseBuffer();\r
+       m_EtxWindowSize.EnableWindow(EnaDis);\r
+       m_EtxRadio1.EnableWindow(EnaDis);\r
+       m_EtxRadio2.EnableWindow(EnaDis);\r
 }\r
 \r
 int MyDialog2::OpenConfigFile(CString PathName)\r
 {\r
-       CStdioFile File;\r
-       CString Line;\r
-       int Len;\r
-       CString Manual;\r
+       struct hna4_entry *Hna4;\r
+       struct olsr_if *Int, *PrevInt;\r
+       struct olsr_msg_params *MsgPar;\r
        int NumInt = m_InterfaceList.GetItemCount();\r
        int i;\r
-       CString Int;\r
+       CString IntName;\r
+       CString Conv;\r
 \r
-       if (File.Open(PathName, CFile::modeRead | CFile::typeText |\r
-               CFile::shareExclusive) == 0)\r
-               return -1;\r
+       if (Conf != NULL)\r
+               olsrd_free_cnf(Conf);\r
 \r
-       m_InternetCheck.SetCheck(FALSE);\r
+       Conf = olsrd_parse_cnf(PathName);\r
+\r
+       if (Conf == NULL)\r
+               return -1;\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
+       for (Int = Conf->interfaces; Int != NULL; Int = Int->next)\r
        {\r
-               Len = Line.Find('#');\r
+               IntName = Int->name;\r
+               IntName.MakeUpper();\r
 \r
-               if (Len >= 0)\r
+               for (i = 0; i < NumInt; i++)\r
                {\r
-                       Line = Line.Mid(0, Len);\r
-                       Line.TrimRight();\r
+                       if (m_InterfaceList.GetItemText(i, 0).Mid(0, 4) == IntName)\r
+                               m_InterfaceList.SetCheck(i, TRUE);\r
                }\r
+       }\r
 \r
-               Len = Line.GetLength();\r
+       Int = Conf->interfaces;\r
 \r
-               if (Len == 0)\r
-                       continue;\r
+       MsgPar = &Int->cnf->hello_params;\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
+       Conv.Format("%.2f", MsgPar->emission_interval);\r
+       m_HelloInt.SetWindowText(Conv);\r
 \r
-               else if (Len > 11 && Line.Mid(0, 11) == "INTERFACES ")\r
-               {\r
-                       Line = Line.Mid(11);\r
-                       Line.MakeUpper();\r
+       Conv.Format("%.2f", MsgPar->validity_time);\r
+       m_HelloHold.SetWindowText(Conv);\r
 \r
-                       for (;;)\r
-                       {\r
-                               Int = Line.Mid(0, 4);\r
+       MsgPar = &Int->cnf->tc_params;\r
+       \r
+       Conv.Format("%.2f", MsgPar->emission_interval);\r
+       m_TcInt.SetWindowText(Conv);\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
+       Conv.Format("%.2f", MsgPar->validity_time);\r
+       m_TcHold.SetWindowText(Conv);\r
 \r
-                               if (Line.GetLength() < 5)\r
-                                       break;\r
+       MsgPar = &Int->cnf->mid_params;\r
+       \r
+       Conv.Format("%.2f", MsgPar->emission_interval);\r
+       m_MidInt.SetWindowText(Conv);\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
+       Conv.Format("%.2f", MsgPar->validity_time);\r
+       m_MidHold.SetWindowText(Conv);\r
+\r
+       MsgPar = &Int->cnf->hna_params;\r
+       \r
+       Conv.Format("%.2f", MsgPar->emission_interval);\r
+       m_HnaInt.SetWindowText(Conv);\r
+\r
+       Conv.Format("%.2f", MsgPar->validity_time);\r
+       m_HnaHold.SetWindowText(Conv);\r
+\r
+       SetDebugLevel(Conf->debug_level);\r
 \r
-       File.Close();\r
+       Conv.Format("%.2f", Conf->pollrate);\r
+       m_PollInt.SetWindowText(Conv);\r
+\r
+       m_HystCheck.SetCheck(Conf->use_hysteresis);\r
+\r
+       Conv.Format("%.2f", Conf->hysteresis_param.scaling);\r
+       m_HystScaling.SetWindowText(Conv);\r
+\r
+       Conv.Format("%.2f", Conf->hysteresis_param.thr_high);\r
+       m_HystThresholdHigh.SetWindowText(Conv);\r
+\r
+       Conv.Format("%.2f", Conf->hysteresis_param.thr_low);\r
+       m_HystThresholdLow.SetWindowText(Conv);\r
 \r
        OnHystCheck();\r
 \r
+       m_EtxCheck.SetCheck(Conf->lq_level > 0);\r
+\r
+       Conv.Format("%d", Conf->lq_wsize);\r
+       m_EtxWindowSize.SetWindowText(Conv);\r
+\r
+       m_EtxRadio1.SetCheck(Conf->lq_level == 1);\r
+       m_EtxRadio2.SetCheck(Conf->lq_level == 2);\r
+\r
+       m_InternetCheck.SetCheck(FALSE);\r
+\r
+       for (Hna4 = Conf->hna4_entries; Hna4 != NULL; Hna4 = Hna4->next)\r
+               if (Hna4->net.v4 == 0 && Hna4->netmask.v4 == 0 &&\r
+                       m_InternetCheck.IsWindowEnabled())\r
+               m_InternetCheck.SetCheck(TRUE);\r
+\r
+       PrevInt = NULL;\r
+\r
+       for (Int = Conf->interfaces; Int != NULL; Int = Int->next)\r
+       {\r
+               IntName = Int->name;\r
+\r
+               if (IntName.CompareNoCase("GUI") == 0)\r
+                       break;\r
+\r
+               PrevInt = Int;\r
+       }\r
+\r
+       if (Int != NULL)\r
+       {\r
+               if (PrevInt == NULL)\r
+                       Conf->interfaces = Int->next;\r
+\r
+               else\r
+                       PrevInt->next = Int->next;\r
+\r
+               olsrd_cnf_free(Int);\r
+       }\r
+\r
        return 0;\r
 }\r
 \r
-int MyDialog2::SaveConfigFile(CString PathName)\r
+static struct olsr_if *AddInterface(struct olsrd_config **Conf, CString Name)\r
 {\r
-       CFile File;\r
-       char *Prolog;\r
-       CString Para;\r
-       CString IntList;\r
+       struct olsr_if *Int;\r
 \r
-       if (File.Open(PathName, CFile::modeCreate | CFile::modeWrite |\r
-               CFile::shareExclusive) == 0)\r
-               return -1;\r
+       Int = (struct olsr_if *)olsrd_cnf_malloc(sizeof (struct olsr_if));\r
 \r
-       Prolog = "#\r\n# AUTOMATICALLY GENERATED FILE - DO NOT TOUCH!\r\n#\r\n\r\n";\r
+       if (Int == NULL)\r
+       {\r
+               AfxMessageBox("Cannot allocate memory.");\r
+               return NULL;\r
+       }\r
 \r
-       File.Write(Prolog, strlen(Prolog));\r
+       Int->name = (char *)olsrd_cnf_malloc(Name.GetLength() + 1);\r
 \r
-       WriteParameter(&File, "IPVERSION", "4");\r
+       if (Int->name == NULL)\r
+       {\r
+               olsrd_cnf_free(Int);\r
 \r
-       m_DebugLevelText.GetWindowText(Para);\r
-       WriteParameter(&File, "DEBUG", Para);\r
+               AfxMessageBox("Cannot allocate memory.");\r
+               return NULL;\r
+       }\r
 \r
-       GetInterfaceList(IntList);\r
+       ::lstrcpy(Int->name, Name);\r
 \r
-       if (!IntList.IsEmpty())\r
-               WriteParameter(&File, "INTERFACES", IntList);\r
+       Int->config = NULL;\r
+       Int->index = 0;\r
+       Int->configured = OLSR_FALSE;\r
+       Int->interf = NULL;\r
 \r
-       m_PollInt.GetWindowText(Para);\r
-       WriteParameter(&File, "POLLRATE", Para);\r
+       Int->cnf = get_default_if_config();\r
 \r
-       m_HelloInt.GetWindowText(Para);\r
-       WriteParameter(&File, "HELLOINT", Para);\r
+       Int->next = (*Conf)->interfaces;\r
+       (*Conf)->interfaces = Int;\r
 \r
-       m_HelloMult.GetWindowText(Para);\r
-       WriteParameter(&File, "HELLOMULTI", Para);\r
+       return Int;\r
+}\r
 \r
-       m_TcInt.GetWindowText(Para);\r
-       WriteParameter(&File, "TCINT", Para);\r
+int MyDialog2::SaveConfigFile(CString PathName, int Real)\r
+{\r
+       struct olsr_if *Int, *PrevInt;\r
+       struct olsr_msg_params *MsgPar;\r
+       CString Conv;\r
+       struct hna4_entry *Hna4, *NewHna4, *PrevHna4;\r
+       int NumInt = m_InterfaceList.GetItemCount();\r
+       int i;\r
+       CString IntName, IntName2;\r
+       struct ipc_host *IpcHost;\r
+       unsigned int Local;\r
 \r
-       m_TcMult.GetWindowText(Para);\r
-       WriteParameter(&File, "TCMULTI", Para);\r
+       PrevInt = NULL;\r
 \r
-       m_MidInt.GetWindowText(Para);\r
-       WriteParameter(&File, "MIDINT", Para);\r
+       // remove interfaces that we do not want\r
+       \r
+       for (Int = Conf->interfaces; Int != NULL; Int = Int->next)\r
+       {\r
+               IntName = Int->name;\r
+               IntName.MakeUpper();\r
+\r
+               for (i = 0; i < NumInt; i++)\r
+                       if (m_InterfaceList.GetItemText(i, 0).Mid(0, 4) == IntName)\r
+                               break;\r
+\r
+               if (i == NumInt || !m_InterfaceList.GetCheck(i))\r
+               {\r
+                       if (PrevInt != NULL)\r
+                               PrevInt->next = Int->next;\r
+\r
+                       else\r
+                               Conf->interfaces = Int->next;\r
+               }\r
+       }\r
+       \r
+       // add missing interfaces\r
+       \r
+       for (i = 0; i < NumInt; i++)\r
+       {\r
+               if (!m_InterfaceList.GetCheck(i))\r
+                       continue;\r
+\r
+               IntName2 = m_InterfaceList.GetItemText(i, 0).Mid(0, 4);\r
 \r
-       m_MidMult.GetWindowText(Para);\r
-       WriteParameter(&File, "MIDMULTI", Para);\r
+               for (Int = Conf->interfaces; Int != NULL; Int = Int->next)\r
+               {\r
+                       IntName = Int->name;\r
+                       IntName.MakeUpper();\r
 \r
-       m_HnaInt.GetWindowText(Para);\r
-       WriteParameter(&File, "HNAINT", Para);\r
+                       if (IntName2 == IntName)\r
+                               break;\r
+               }\r
 \r
-       m_HnaMult.GetWindowText(Para);\r
-       WriteParameter(&File, "HNAMULTI", Para);\r
+               if (Int == NULL)\r
+                       AddInterface(&Conf, m_InterfaceList.GetItemText(i, 0).Mid(0, 4));\r
+       }\r
 \r
-       if (m_HystCheck.GetCheck())\r
+       // add dummy interface, if there aren't any real interfaces\r
+\r
+       if (Conf->interfaces == NULL && Real != 0)\r
+               AddInterface(&Conf, "GUI");\r
+\r
+       // per-interface settings\r
+\r
+       for (Int = Conf->interfaces; Int != NULL; Int = Int->next)\r
        {\r
-               WriteParameter(&File, "USE_HYSTERESIS", "yes");\r
+               MsgPar = &Int->cnf->hello_params;\r
+\r
+               m_HelloInt.GetWindowText(Conv);\r
+               MsgPar->emission_interval = (float)atof(Conv);\r
+\r
+               m_HelloHold.GetWindowText(Conv);\r
+               MsgPar->validity_time = (float)atof(Conv);\r
 \r
-               m_HystScaling.GetWindowText(Para);\r
-               WriteParameter(&File, "HYST_SCALING", Para);\r
+               MsgPar = &Int->cnf->tc_params;\r
 \r
-               m_HystThresholdLow.GetWindowText(Para);\r
-               WriteParameter(&File, "HYST_THR_LOW", Para);\r
+               m_TcInt.GetWindowText(Conv);\r
+               MsgPar->emission_interval = (float)atof(Conv);\r
 \r
-               m_HystThresholdHigh.GetWindowText(Para);\r
-               WriteParameter(&File, "HYST_THR_HIGH", Para);\r
+               m_TcHold.GetWindowText(Conv);\r
+               MsgPar->validity_time = (float)atof(Conv);\r
+\r
+               MsgPar = &Int->cnf->mid_params;\r
+\r
+               m_MidInt.GetWindowText(Conv);\r
+               MsgPar->emission_interval = (float)atof(Conv);\r
+\r
+               m_MidHold.GetWindowText(Conv);\r
+               MsgPar->validity_time = (float)atof(Conv);\r
+\r
+               MsgPar = &Int->cnf->hna_params;\r
+\r
+               m_HnaInt.GetWindowText(Conv);\r
+               MsgPar->emission_interval = (float)atof(Conv);\r
+\r
+               m_HnaHold.GetWindowText(Conv);\r
+               MsgPar->validity_time = (float)atof(Conv);\r
        }\r
 \r
+       // global settings\r
+\r
+       Conf->debug_level = DebugLevel;\r
+\r
+       m_PollInt.GetWindowText(Conv);\r
+       Conf->pollrate = (float)atof(Conv);\r
+\r
+       Conf->use_hysteresis = m_HystCheck.GetCheck() ? OLSR_TRUE : OLSR_FALSE;\r
+\r
+       m_HystScaling.GetWindowText(Conv);\r
+       Conf->hysteresis_param.scaling = (float)atof(Conv);\r
+\r
+       m_HystThresholdHigh.GetWindowText(Conv);\r
+       Conf->hysteresis_param.thr_high = (float)atof(Conv);\r
+\r
+       m_HystThresholdLow.GetWindowText(Conv);\r
+       Conf->hysteresis_param.thr_low = (float)atof(Conv);\r
+\r
+       if (!m_EtxCheck.GetCheck())\r
+               Conf->lq_level = 0;\r
+\r
+       else if (m_EtxRadio1.GetCheck())\r
+               Conf->lq_level = 1;\r
+\r
        else\r
-               WriteParameter(&File, "USE_HYSTERESIS", "no");\r
+               Conf->lq_level = 2;\r
+\r
+       m_EtxWindowSize.GetWindowText(Conv);\r
+       Conf->lq_wsize = atoi(Conv);\r
 \r
-       if (m_InternetCheck.GetCheck())\r
-               WriteParameter(&File, "HNA4", "0.0.0.0 0.0.0.0");\r
+       PrevHna4 = NULL;\r
+\r
+       // check for a default gateway HNA4 entry\r
+\r
+       for (Hna4 = Conf->hna4_entries; Hna4 != NULL; Hna4 = Hna4->next)\r
+       {\r
+               if (Hna4->net.v4 == 0 && Hna4->netmask.v4 == 0)\r
+                       break;\r
+\r
+               PrevHna4 = Hna4;\r
+       }\r
 \r
-       m_ManualWindow.GetWindowText(Para);\r
-       File.Write(Para.GetBuffer(0), Para.GetLength());\r
-       Para.ReleaseBuffer();\r
+       // add default gateway HNA4 entry\r
+\r
+       if (m_InternetCheck.GetCheck() && Hna4 == NULL)\r
+       {\r
+               NewHna4 = (struct hna4_entry * )\r
+                       olsrd_cnf_malloc(sizeof (struct hna4_entry));\r
+\r
+               if (NewHna4 == NULL)\r
+               {\r
+                       AfxMessageBox("Cannot allocate memory.");\r
+                       return -1;\r
+               }\r
+\r
+               NewHna4->net.v4 = 0;\r
+               NewHna4->netmask.v4 = 0;\r
+\r
+               NewHna4->next = Conf->hna4_entries;\r
+               Conf->hna4_entries = NewHna4;\r
+       }\r
+\r
+       // remove default gateway HNA4 entry\r
+\r
+       if (!m_InternetCheck.GetCheck() && Hna4 != NULL)\r
+       {\r
+               if (PrevHna4 == NULL)\r
+                       Conf->hna4_entries = Hna4->next;\r
+\r
+               else\r
+                       PrevHna4->next = Hna4->next;\r
+\r
+               olsrd_cnf_free(Hna4);\r
+       }\r
+\r
+       Local = inet_addr("127.0.0.1");\r
+\r
+       for (IpcHost = Conf->ipc_hosts; IpcHost != NULL; IpcHost = IpcHost->next)\r
+               if (IpcHost->host.v4 == Local)\r
+                       break;\r
+\r
+       if (IpcHost == NULL && Real == 0)\r
+       {\r
+               IpcHost = (struct ipc_host *)\r
+                       olsrd_cnf_malloc(sizeof (struct ipc_host));\r
+\r
+               if (IpcHost == NULL)\r
+               {\r
+                       AfxMessageBox("Cannot allocate memory.");\r
+                       return -1;\r
+               }\r
+\r
+               IpcHost->host.v4 = Local;\r
+\r
+               IpcHost->next = Conf->ipc_hosts;\r
+               Conf->ipc_hosts = IpcHost;\r
+\r
+               Conf->ipc_connections++;\r
+               Conf->open_ipc = OLSR_TRUE;\r
+       }\r
+\r
+       // write configuration file\r
+\r
+       if (olsrd_write_cnf(Conf, PathName) < 0)\r
+               return -1;\r
 \r
-       File.Close();\r
        return 0;\r
 }\r
 \r
@@ -456,14 +584,14 @@ void MyDialog2::OnSaveButton()
        {\r
                PathName = FileDialog.GetPathName();\r
 \r
-               if (SaveConfigFile(PathName) < 0)\r
+               if (SaveConfigFile(PathName, 1) < 0)\r
                        AfxMessageBox("Cannot save configuration file '" + PathName + "'.");\r
        }\r
 \r
        FileName.ReleaseBuffer();\r
 }\r
 \r
-void MyDialog2::OnOpenButton() \r
+void MyDialog2::OnOpenButton()\r
 {\r
        CFileDialog FileDialog(TRUE);\r
        CString FileName = "Default.olsr";\r
@@ -490,3 +618,31 @@ void MyDialog2::OnResetButton()
 {\r
        Reset();\r
 }\r
+\r
+void MyDialog2::OnEtxRadio1() \r
+{\r
+       m_EtxRadio2.SetCheck(FALSE);\r
+}\r
+\r
+void MyDialog2::OnEtxRadio2() \r
+{\r
+       m_EtxRadio1.SetCheck(FALSE);\r
+}\r
+\r
+void MyDialog2::OnKillfocusEtxWinSize() \r
+{\r
+       CString Conv;\r
+       int WinSize;\r
+\r
+       m_EtxWindowSize.GetWindowText(Conv);\r
+       WinSize = atoi(Conv);\r
+\r
+       if (WinSize < 3)\r
+               WinSize = 3;\r
+\r
+       else if (WinSize > 128)\r
+               WinSize = 128;\r
+\r
+       Conv.Format("%d", WinSize);\r
+       m_EtxWindowSize.SetWindowText(Conv);\r
+}\r
index 921b3d2..43975e7 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * $Id: MyDialog2.h,v 1.3 2004/09/15 11:18:41 tlopatic Exp $\r
+ * $Id: MyDialog2.h,v 1.4 2004/11/20 22:52:49 tlopatic Exp $\r
  * Copyright (C) 2004 Thomas Lopatic (thomas@lopatic.de)\r
  *\r
  * This file is part of olsr.org.\r
@@ -29,6 +29,9 @@
 \r
 #include "MyEdit.h"\r
 \r
+#define MAKELIB\r
+#include <olsr_cfg.h>\r
+\r
 class MyDialog2 : public CDialog\r
 {\r
 public:\r
@@ -37,31 +40,35 @@ public:
        BOOL Create(CWnd *Parent);\r
 \r
        int OpenConfigFile(CString);\r
-       int SaveConfigFile(CString);\r
+       int SaveConfigFile(CString, int);\r
 \r
        CStringArray *Interfaces;\r
        CStringArray *Addresses;\r
        CStringArray *IsWlan;\r
 \r
+       struct olsrd_config *Conf;\r
+\r
        //{{AFX_DATA(MyDialog2)\r
        enum { IDD = IDD_DIALOG2 };\r
-       CButton m_TunnelCheck;\r
+       CButton m_EtxRadio2;\r
+       CButton m_EtxRadio1;\r
+       CEdit   m_EtxWindowSize;\r
+       CButton m_EtxCheck;\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_HnaHold;\r
+       MyEdit  m_MidHold;\r
        MyEdit  m_PollInt;\r
-       MyEdit  m_TcMult;\r
+       MyEdit  m_TcHold;\r
        MyEdit  m_TcInt;\r
        MyEdit  m_HnaInt;\r
        MyEdit  m_MidInt;\r
-       MyEdit  m_HelloMult;\r
+       MyEdit  m_HelloHold;\r
        MyEdit  m_HelloInt;\r
-       CEdit   m_ManualWindow;\r
        CListCtrl       m_InterfaceList;\r
        CStatic m_DebugLevelText;\r
        CSliderCtrl     m_DebugLevel;\r
@@ -83,6 +90,10 @@ protected:
        afx_msg void OnOpenButton();\r
        afx_msg void OnSaveButton();\r
        afx_msg void OnResetButton();\r
+       afx_msg void OnEtxCheck();\r
+       afx_msg void OnEtxRadio1();\r
+       afx_msg void OnEtxRadio2();\r
+       afx_msg void OnKillfocusEtxWinSize();\r
        //}}AFX_MSG\r
        DECLARE_MESSAGE_MAP()\r
 \r
@@ -91,10 +102,6 @@ protected:
        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
index c33fa69..9c0e68a 100644 (file)
 #define IDC_EDIT12                      1023\r
 #define IDC_EDIT13                      1024\r
 #define IDC_LIST4                       1025\r
+#define IDC_EDIT14                      1025\r
 #define IDC_LIST5                       1026\r
 #define IDC_LIST6                       1027\r
+#define IDC_RADIO1                      1029\r
+#define IDC_RADIO2                      1030\r
 \r
 // Next default values for new objects\r
 // \r
 #ifdef APSTUDIO_INVOKED\r
 #ifndef APSTUDIO_READONLY_SYMBOLS\r
-#define _APS_NEXT_RESOURCE_VALUE        139\r
+#define _APS_NEXT_RESOURCE_VALUE        140\r
 #define _APS_NEXT_COMMAND_VALUE         32771\r
-#define _APS_NEXT_CONTROL_VALUE         1027\r
+#define _APS_NEXT_CONTROL_VALUE         1030\r
 #define _APS_NEXT_SYMED_VALUE           101\r
 #endif\r
 #endif\r