-rwxr-xr-x | PumpKINDlg.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp index 3ff1500..0c5c19b 100755 --- a/PumpKINDlg.cpp +++ b/PumpKINDlg.cpp @@ -1219,47 +1219,49 @@ CPropsServer server; CPropsNetwork network;
CPropsSounds sounds;
CPropsACL acl;
server.m_RRQMode=m_RRQMode;
server.m_TFTPRoot=m_TFTPRoot;
server.m_TFTPSubdirs=m_bTFTPSubdirs;
server.m_WRQMode=m_WRQMode;
server.m_PromptTimeOut=m_PromptTimeOut;
server.m_LogFile=m_LogFile;
network.m_ListenPort=m_ListenPort;
+ network.m_ListenAddress=m_ListenAddress;
network.m_SpeakPort=m_SpeakPort;
network.m_TimeOut=m_TFTPTimeOut.GetTotalSeconds();
network.m_BlockSize=m_BlockSize;
sounds.m_Request = m_bnwRequest;
sounds.m_Success = m_bnwSuccess;
sounds.m_Abort = m_bnwAbort;
acl.m_rulist = m_aclRules;
cps.AddPage(&server);
cps.AddPage(&network);
cps.AddPage(&sounds);
cps.AddPage(&acl);
if(cps.DoModal()==IDOK){
m_RRQMode=server.m_RRQMode;
m_TFTPRoot=server.m_TFTPRoot;
m_bTFTPSubdirs=server.m_TFTPSubdirs;
m_WRQMode=server.m_WRQMode;
m_PromptTimeOut=server.m_PromptTimeOut;
m_LogFile=server.m_LogFile;
m_ListenPort=network.m_ListenPort;
+ m_ListenAddress=network.m_ListenAddress;
m_SpeakPort=network.m_SpeakPort;
m_TFTPTimeOut=CTimeSpan(network.m_TimeOut);
m_BlockSize=network.m_BlockSize;
m_bnwRequest = sounds.m_Request;
m_bnwSuccess = sounds.m_Success;
m_bnwAbort = sounds.m_Abort;
m_aclRules = acl.m_rulist;
m_lastlogerr.Empty();
}
@@ -1866,24 +1868,25 @@ void CPumpKINDlg::OnTraySendfile() }
void CPumpKINDlg::LoadSettings()
{
CWinApp *app = AfxGetApp();
ASSERT(app);
m_bListen=app->GetProfileInt("TFTPSettings","Listen",m_bListen);
m_bnwRequest=app->GetProfileString("BellsNWhistles","Request",m_bnwRequest);
m_bnwSuccess=app->GetProfileString("BellsNWhistles","Success",m_bnwSuccess);
m_bnwAbort=app->GetProfileString("BellsNWhistles","Abort",m_bnwAbort);
m_bTFTPSubdirs=app->GetProfileInt("TFTPSettings","Subdirs",m_bTFTPSubdirs);
m_ListenPort=app->GetProfileInt("TFTPSettings","ListenPort",m_ListenPort);
+ m_ListenAddress=app->GetProfileString("TFTPSettings","ListenAddress",m_ListenAddress);
m_LogLength=app->GetProfileInt("UISettings","LogLength",m_LogLength);
m_PromptTimeOut=app->GetProfileInt("UISettings","PromptTimeout",m_PromptTimeOut);
m_RRQMode=app->GetProfileInt("TFTPSettings","RRQMode",m_RRQMode);
m_SpeakPort=app->GetProfileInt("TFTPSettings","SpeakPort",m_SpeakPort);
m_TFTPRoot=app->GetProfileString("TFTPSettings","TFTPRoot",m_TFTPRoot);
m_LogFile=app->GetProfileString("General","LogFile",m_LogFile);
m_TFTPTimeOut=CTimeSpan(app->GetProfileInt("TFTPSettings","TFTPTimeout",m_TFTPTimeOut.GetTotalSeconds()));
m_BlockSize=app->GetProfileInt("TFTPSettings","TFTPBlockSize",m_BlockSize);
m_RetryTimeOut=CTimeSpan(app->GetProfileInt("TFTPSettings","RetryTimeout",m_RetryTimeOut.GetTotalSeconds()));
m_WRQMode=app->GetProfileInt("TFTPSettings","WRQMode",m_WRQMode);
m_bShown=app->GetProfileInt("UISettings","Visble",m_bShown);
if(m_TFTPRoot.IsEmpty()){
@@ -1896,24 +1899,25 @@ CWinApp *app = AfxGetApp(); }
void CPumpKINDlg::SaveSettings()
{
CWinApp *app = AfxGetApp();
ASSERT(app);
app->WriteProfileInt("TFTPSettings","Listen",m_bListen);
app->WriteProfileString("BellsNWhistles","Request",m_bnwRequest);
app->WriteProfileString("BellsNWhistles","Success",m_bnwSuccess);
app->WriteProfileString("BellsNWhistles","Abort",m_bnwAbort);
app->WriteProfileInt("TFTPSettings","Subdirs",m_bTFTPSubdirs);
app->WriteProfileInt("TFTPSettings","ListenPort",m_ListenPort);
+ app->WriteProfileString("TFTPSettings","ListenAddress",m_ListenAddress);
app->WriteProfileInt("UISettings","LogLength",m_LogLength);
app->WriteProfileInt("UISettings","PromptTimeout",m_PromptTimeOut);
app->WriteProfileInt("TFTPSettings","RRQMode",m_RRQMode);
app->WriteProfileInt("TFTPSettings","SpeakPort",m_SpeakPort);
app->WriteProfileString("TFTPSettings","TFTPRoot",m_TFTPRoot);
app->WriteProfileString("General","LogFile",m_LogFile);
app->WriteProfileInt("TFTPSettings","TFTPTimeout",m_TFTPTimeOut.GetTotalSeconds());
app->WriteProfileInt("TFTPSettings","TFTPBlockSize",m_BlockSize);
app->WriteProfileInt("TFTPSettings","RetryTimeout",m_RetryTimeOut.GetTotalSeconds());
app->WriteProfileInt("TFTPSettings","WRQMode",m_WRQMode);
app->WriteProfileInt("UISettings","Visble",m_bShown);
m_aclRules.SaveProfile(app);
@@ -2058,34 +2062,32 @@ void CXferSocket::SetTry(tftp *p) if(m_Retry)
delete m_Retry;
m_Retry=p?tftp::Copy(p):NULL;
}
void CPumpKINDlg::OnHelp()
{
AfxGetApp()->WinHelp(0,HELP_FINDER);
}
BOOL CListenSocket::SetListen(BOOL b) {
ASSERT(m_Daddy);
- if(b==m_bListen)
- return TRUE;
- if(b) {
- if(!Create(m_Daddy->m_ListenPort,SOCK_DGRAM))
- return FALSE;
- return m_bListen=TRUE;
- }else{
+ if(b==m_bListen) return TRUE;
+ if(!b) {
Close(); m_bListen=FALSE;
return TRUE;
}
+ return m_bListen=Create(m_Daddy->m_ListenPort,SOCK_DGRAM,
+ FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE,
+ m_Daddy->m_ListenAddress.IsEmpty()?NULL:(LPCTSTR)m_Daddy->m_ListenAddress);
}
void CPumpKINDlg::OnListening()
{
if(!m_Listener.SetListen(m_ListenCtl.GetCheck()==1)) {
TRACE0("Failed to create socket\n");
AfxMessageBox(IDS_BOX_CANTBIND,MB_OK|MB_ICONEXCLAMATION);
}
m_ListenCtl.SetCheck(m_Listener.m_bListen?1:0);
m_bListen=m_Listener.m_bListen;
}
|