diff --git a/PUP/Authentication.cs b/PUP/Authentication.cs
index 4c33e94..4e279eb 100644
--- a/PUP/Authentication.cs
+++ b/PUP/Authentication.cs
@@ -1,4 +1,21 @@
-using IFS.Logging;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -25,7 +42,7 @@ namespace IFS
/// Administrators can read/write files in any directory.
///
/// The concept of a "guest" account is provided -- this user has no home directory and has read-only
- /// access only to specifically marked public directories.
+ /// access only.
///
public static class Authentication
{
diff --git a/PUP/BCPLString.cs b/PUP/BCPLString.cs
index f0540d5..acaa715 100644
--- a/PUP/BCPLString.cs
+++ b/PUP/BCPLString.cs
@@ -1,4 +1,21 @@
-using IFS.BSP;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.BSP;
using System;
using System.Collections.Generic;
diff --git a/PUP/BSP/BSPChannel.cs b/PUP/BSP/BSPChannel.cs
index b0be368..4943763 100644
--- a/PUP/BSP/BSPChannel.cs
+++ b/PUP/BSP/BSPChannel.cs
@@ -1,4 +1,21 @@
-using IFS.Gateway;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Gateway;
using IFS.Logging;
using System;
@@ -168,8 +185,8 @@ namespace IFS.BSP
{
_inputLock.EnterWriteLock();
- // We have some data right now, read it in.
- // TODO: this code is ugly and it wants to die.
+ // We have some data right now, read it in, one
+ // byte at a time...
while (_inputQueue.Count > 0 && read < count)
{
ushort word = _inputQueue.Dequeue();
@@ -224,8 +241,7 @@ namespace IFS.BSP
///
///
public byte ReadByte()
- {
- // TODO: optimize this
+ {
byte[] data = new byte[1];
Read(ref data, 1);
@@ -238,8 +254,7 @@ namespace IFS.BSP
///
///
public ushort ReadUShort()
- {
- // TODO: optimize this
+ {
byte[] data = new byte[2];
Read(ref data, 2);
diff --git a/PUP/BSP/BSPManager.cs b/PUP/BSP/BSPManager.cs
index b63a7bc..3bf5db9 100644
--- a/PUP/BSP/BSPManager.cs
+++ b/PUP/BSP/BSPManager.cs
@@ -1,4 +1,21 @@
-using IFS.Gateway;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Gateway;
using IFS.Logging;
using System;
using System.Collections.Generic;
diff --git a/PUP/Boot/BootServer.cs b/PUP/Boot/BootServer.cs
index e51d0a5..444e7fc 100644
--- a/PUP/Boot/BootServer.cs
+++ b/PUP/Boot/BootServer.cs
@@ -1,4 +1,21 @@
-using IFS.Logging;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -27,10 +44,9 @@ namespace IFS.Boot
private static void LoadBootFileTables()
{
- _numberToNameTable = new Dictionary();
+ _numberToNameTable = new Dictionary();
- // TODO: fix hardcoded path
- using (StreamReader sr = new StreamReader("Conf\\bootdirectory.txt"))
+ using (StreamReader sr = new StreamReader(Path.Combine("Conf", "bootdirectory.txt")))
{
int lineNumber = 0;
while (!sr.EndOfStream)
diff --git a/PUP/Boot/BreathOfLife.cs b/PUP/Boot/BreathOfLife.cs
index 9d7e034..255dff3 100644
--- a/PUP/Boot/BreathOfLife.cs
+++ b/PUP/Boot/BreathOfLife.cs
@@ -1,4 +1,21 @@
-using IFS.Gateway;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Gateway;
using IFS.Logging;
using System;
diff --git a/PUP/Conf/accounts.txt b/PUP/Conf/accounts.txt
index 8f27008..daf8cbc 100644
--- a/PUP/Conf/accounts.txt
+++ b/PUP/Conf/accounts.txt
@@ -5,6 +5,4 @@
# ::[Admin|User]::
#
-jdersch::Admin:Josh Dersch:jdersch
-luser::User:Joe Luser:luser
-
+sample::User:This is a Sample:sample
diff --git a/PUP/Conf/hosts.txt b/PUP/Conf/hosts.txt
index 9bfc63f..527b301 100644
--- a/PUP/Conf/hosts.txt
+++ b/PUP/Conf/hosts.txt
@@ -14,10 +14,5 @@
1# ifs
42# Muffin
43# Pumpkin
-
-43# Duplicate
-45# Pumpkin
-
-# to test
-5#177# NotHere
-
+44# Frunobulax
+45# Phydeaux
diff --git a/PUP/Conf/ifs.cfg b/PUP/Conf/ifs.cfg
index aa72bc1..45fc047 100644
--- a/PUP/Conf/ifs.cfg
+++ b/PUP/Conf/ifs.cfg
@@ -4,17 +4,17 @@
# All numbers are in decimal.
#
-# Debug settings
-
-LogTypes = Verbose
-LogComponents = All
-
# Normal configuration
FTPRoot = c:\ifs\ftp
CopyDiskRoot = c:\ifs\copydisk
BootRoot = c:\ifs\boot
MailRoot = c:\ifs\mail
-InterfaceType = RAW
+InterfaceType = raw
InterfaceName = Ethernet
+UDPPort = 42424
ServerNetwork = 1
ServerHost = 1
+
+# Debug settings
+LogTypes = None
+LogComponents = None
diff --git a/PUP/Configuration.cs b/PUP/Configuration.cs
index 8c4c4c5..c1ae41e 100644
--- a/PUP/Configuration.cs
+++ b/PUP/Configuration.cs
@@ -1,4 +1,21 @@
-using IFS.Logging;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -56,6 +73,12 @@ namespace IFS
{
throw new InvalidConfigurationException("MaxWorkers must be >= 1.");
}
+
+ if (UDPPort == 0)
+ {
+ // Set to default.
+ UDPPort = 42424;
+ }
}
///
@@ -68,6 +91,11 @@ namespace IFS
///
public static readonly string InterfaceName;
+ ///
+ /// The UDP port to use when using a UDP interface.
+ ///
+ public static readonly int UDPPort;
+
///
/// The network that this server lives on
///
diff --git a/PUP/Console/Console.cs b/PUP/Console/Console.cs
index 19e6a6e..9c5965f 100644
--- a/PUP/Console/Console.cs
+++ b/PUP/Console/Console.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
@@ -217,8 +234,7 @@ namespace IFS.IfsConsole
if (method == null)
{
- // invalid argument count.
- // todo: display usage?
+ // invalid argument count.
throw new ArgumentException(String.Format("Invalid argument count to command."));
}
@@ -560,8 +576,8 @@ namespace IFS.IfsConsole
}
}
- [ConsoleFunction("show commands", "Shows debugger commands and their descriptions.")]
- private void ShowCommands()
+ [ConsoleFunction("show commands", "Shows console commands and their descriptions.")]
+ private bool ShowCommands()
{
foreach (ConsoleCommand cmd in _commandList)
{
@@ -574,6 +590,8 @@ namespace IFS.IfsConsole
Console.WriteLine("{0} - {1}", cmd.Name, cmd.Description);
}
}
+
+ return false;
}
private ConsolePrompt _consolePrompt;
diff --git a/PUP/Console/ConsoleAttributes.cs b/PUP/Console/ConsoleAttributes.cs
index ca8393c..df9c7a8 100644
--- a/PUP/Console/ConsoleAttributes.cs
+++ b/PUP/Console/ConsoleAttributes.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/PUP/Console/ConsoleCommands.cs b/PUP/Console/ConsoleCommands.cs
index 86329eb..5f06f57 100644
--- a/PUP/Console/ConsoleCommands.cs
+++ b/PUP/Console/ConsoleCommands.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -37,7 +54,7 @@ namespace IFS.IfsConsole
return false;
}
- [ConsoleFunction("show user", "Displays information for the specified user")]
+ [ConsoleFunction("show user", "Displays information for the specified user", "")]
private bool ShowUser(string username)
{
UserToken user = Authentication.GetUser(username);
@@ -54,7 +71,7 @@ namespace IFS.IfsConsole
return false;
}
- [ConsoleFunction("set password", "Sets the password for the specified user")]
+ [ConsoleFunction("set password", "Sets the password for the specified user", "")]
private bool SetPassword(string username)
{
UserToken user = Authentication.GetUser(username);
@@ -127,7 +144,7 @@ namespace IFS.IfsConsole
return false;
}
- [ConsoleFunction("show active servers", "Displays active server statistics.", "")]
+ [ConsoleFunction("show active servers", "Displays active server statistics.")]
private bool ShowServers()
{
List workers = BSP.BSPManager.EnumerateActiveWorkers();
@@ -149,7 +166,7 @@ namespace IFS.IfsConsole
return false;
}
- [ConsoleFunction("quit", "Terminates the IFS process", "")]
+ [ConsoleFunction("quit", "Terminates the IFS process")]
private bool Quit()
{
return true;
diff --git a/PUP/Console/ConsolePrompt.cs b/PUP/Console/ConsolePrompt.cs
index e8e7286..eda0244 100644
--- a/PUP/Console/ConsolePrompt.cs
+++ b/PUP/Console/ConsolePrompt.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using System;
using System.Collections.Generic;
using System.Text;
diff --git a/PUP/CopyDisk/CopyDiskServer.cs b/PUP/CopyDisk/CopyDiskServer.cs
index 9332d2d..ffd4d11 100644
--- a/PUP/CopyDisk/CopyDiskServer.cs
+++ b/PUP/CopyDisk/CopyDiskServer.cs
@@ -1,4 +1,21 @@
-using IFS.BSP;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.BSP;
using IFS.Logging;
using System;
@@ -253,7 +270,7 @@ namespace IFS.CopyDisk
// Sanity check that length is a reasonable value.
if (length > 2048)
{
- // TODO: shut down channel
+ Channel.SendAbort("Block length is invalid.");
throw new InvalidOperationException(String.Format("Insane block length ({0})", length));
}
@@ -275,7 +292,7 @@ namespace IFS.CopyDisk
Log.Write(LogType.Verbose, LogComponent.CopyDisk, "Copydisk client is version {0}, '{1}'", vbIn.Code, vbIn.Herald.ToString());
// Send the response:
- VersionYesNoBlock vbOut = new VersionYesNoBlock(CopyDiskBlock.Version, vbIn.Code, "LCM IFS CopyDisk of 26-Jan-2016");
+ VersionYesNoBlock vbOut = new VersionYesNoBlock(CopyDiskBlock.Version, vbIn.Code, "LCM+L IFS CopyDisk of 26-Jan-2016");
Channel.Send(Serializer.Serialize(vbOut));
}
break;
diff --git a/PUP/CopyDisk/DiabloPack.cs b/PUP/CopyDisk/DiabloPack.cs
index 5e96dad..6bda727 100644
--- a/PUP/CopyDisk/DiabloPack.cs
+++ b/PUP/CopyDisk/DiabloPack.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -199,8 +216,7 @@ namespace IFS.CopyDisk
{
throw new InvalidOperationException("Disk address is out of range.");
}
-
- // TODO: factor this logic out
+
int sector = address % _geometry.Sectors;
int track = (address / _geometry.Sectors) % _geometry.Tracks;
int cylinder = (address / (_geometry.Sectors * _geometry.Tracks));
diff --git a/PUP/DirectoryServices.cs b/PUP/DirectoryServices.cs
index c56ad34..ccb6ab6 100644
--- a/PUP/DirectoryServices.cs
+++ b/PUP/DirectoryServices.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
@@ -120,9 +137,8 @@ namespace IFS
{
_hostAddressTable = new Dictionary>();
_hostNameTable = new Dictionary();
-
- // TODO: do not hardcode path like this.
- using (StreamReader sr = new StreamReader("Conf\\hosts.txt"))
+
+ using (StreamReader sr = new StreamReader(Path.Combine("Conf", "hosts.txt")))
{
int lineNumber = 0;
while (!sr.EndOfStream)
@@ -219,7 +235,7 @@ namespace IFS
}
// Hash the host by one or more names
- for (int i=1;i.
+*/
+
+using IFS.Gateway;
using IFS.Logging;
using System;
diff --git a/PUP/EFTP/EFTPManager.cs b/PUP/EFTP/EFTPManager.cs
index 1942545..296386e 100644
--- a/PUP/EFTP/EFTPManager.cs
+++ b/PUP/EFTP/EFTPManager.cs
@@ -1,4 +1,21 @@
-using IFS.BSP;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.BSP;
using IFS.Logging;
using System;
diff --git a/PUP/EFTP/EFTPSend.cs b/PUP/EFTP/EFTPSend.cs
index 0d6645f..6a28b54 100644
--- a/PUP/EFTP/EFTPSend.cs
+++ b/PUP/EFTP/EFTPSend.cs
@@ -1,4 +1,21 @@
-using IFS.Logging;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Logging;
using System;
using System.Collections.Generic;
diff --git a/PUP/EchoProtocol.cs b/PUP/EchoProtocol.cs
index 2ca5fd0..4094168 100644
--- a/PUP/EchoProtocol.cs
+++ b/PUP/EchoProtocol.cs
@@ -1,4 +1,21 @@
-using IFS.Gateway;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/PUP/Entrypoint.cs b/PUP/Entrypoint.cs
index 95d78fb..3691b79 100644
--- a/PUP/Entrypoint.cs
+++ b/PUP/Entrypoint.cs
@@ -1,4 +1,21 @@
-using IFS.Boot;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Boot;
using IFS.CopyDisk;
using IFS.FTP;
using IFS.Gateway;
@@ -34,7 +51,10 @@ namespace IFS
private static void PrintHerald()
{
- Console.WriteLine("LCM IFS v0.1, 4/19/2016.");
+ Console.WriteLine("LCM+L IFS v0.1, 12/14/2016.");
+ Console.WriteLine("(c) 2015, 2016 Living Computers: Museum+Labs.");
+ Console.WriteLine("Bug reports to joshd@livingcomputers.org");
+ Console.WriteLine();
Console.WriteLine();
}
@@ -74,12 +94,17 @@ namespace IFS
}
}
break;
+
+ default:
+ throw new InvalidConfigurationException(
+ String.Format("The specified interface type ({0}) is invalid.", Configuration.InterfaceType));
}
// Not found.
if (!bFound)
{
- throw new InvalidConfigurationException("The specified network interface is invalid.");
+ throw new InvalidConfigurationException(
+ String.Format("The specified network interface ({0}) is invalid or unusable by IFS.", Configuration.InterfaceName));
}
}
diff --git a/PUP/FTP/FTPServer.cs b/PUP/FTP/FTPServer.cs
index 0e9a60b..8d09368 100644
--- a/PUP/FTP/FTPServer.cs
+++ b/PUP/FTP/FTPServer.cs
@@ -1,4 +1,21 @@
-using IFS.BSP;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.BSP;
using IFS.Logging;
using System;
@@ -160,7 +177,7 @@ namespace IFS.FTP
//
// Return our Version.
- FTPYesNoVersion serverVersion = new FTPYesNoVersion(1, "LCM IFS FTP of 4 Feb 2016.");
+ FTPYesNoVersion serverVersion = new FTPYesNoVersion(1, "LCM+L IFS FTP of 4 Feb 2016.");
SendFTPResponse(FTPCommand.Version, serverVersion);
}
break;
@@ -563,9 +580,10 @@ namespace IFS.FTP
Log.Write(LogType.Verbose, LogComponent.FTP, "Receiving file {0}.", fullFileName);
using (FileStream inFile = new FileStream(fullFileName, FileMode.Create, FileAccess.Write))
{
- // TODO: move to constant. Possibly make max size configurable.
- // For now, it seems very unlikely that any Alto is going to have a single file larger than 4mb.
- lastMark = ReadUntilNextMark(out buffer, 4096 * 1024);
+ //
+ // For now, it seems very unlikely that any Alto is going to have a single file larger than 4mb, so
+ // reading the entire file into memory is somewhat reasonable...
+ lastMark = ReadUntilNextMark(out buffer, _maxFileSize);
// Write out to file
inFile.Write(buffer, 0, buffer.Length);
@@ -577,7 +595,7 @@ namespace IFS.FTP
{
// We failed while writing the file, send a No response to the client.
// Per the spec, we need to drain the client data first.
- lastMark = ReadUntilNextMark(out buffer, 4096 * 1024); // TODO: move to constant
+ lastMark = ReadUntilNextMark(out buffer, _maxFileSize);
success = false;
Log.Write(LogType.Warning, LogComponent.FTP, "Failed to write {0}. Error '{1}'", fullFileName, e.Message);
@@ -596,8 +614,7 @@ namespace IFS.FTP
Log.Write(LogType.Verbose, LogComponent.FTP, "Client success code is {0}, {1}, '{2}'", lastMark, clientYesNo.Code, clientYesNo.Code);
if (!success)
- {
- // TODO: provide actual No codes.
+ {
SendFTPNoResponse(NoCode.FileBusy, "File transfer failed.");
}
else
@@ -643,7 +660,7 @@ namespace IFS.FTP
//
// Check the privileges of the user. If the user has write permissions
- // then we are OK to delete. Otherwise, we must be deleteing files in the user's directory.
+ // then we are OK to delete. Otherwise, we must be deleting files in the user's directory.
//
string fullFileName = Path.Combine(Configuration.FTPRoot, fullPath);
if (userToken.Privileges != IFSPrivileges.ReadWrite &&
@@ -688,8 +705,7 @@ namespace IFS.FTP
Channel.Send(Serializer.Serialize(new FTPYesNoVersion(0, "File deleted successfully.")));
}
catch(Exception e)
- {
- // TODO: calculate real NO codes
+ {
Channel.SendMark((byte)FTPCommand.No, false);
Channel.Send(Serializer.Serialize(new FTPYesNoVersion((byte)NoCode.AccessDenied, e.Message)));
}
@@ -886,10 +902,9 @@ namespace IFS.FTP
try
{
Log.Write(LogType.Verbose, LogComponent.Mail, "Receiving mail file to memory...");
-
- // TODO: move to constant. Possibly make max size configurable.
+
// For now, it seems very unlikely that any Alto is going to have a single file larger than 4mb.
- lastMark = ReadUntilNextMark(out buffer, 4096 * 1024);
+ lastMark = ReadUntilNextMark(out buffer, _maxFileSize);
Log.Write(LogType.Verbose, LogComponent.Mail, "Received {0} bytes.", buffer.Length);
@@ -908,7 +923,7 @@ namespace IFS.FTP
{
// We failed while writing the mail file, send a No response to the client.
// Per the spec, we need to drain the client data first.
- lastMark = ReadUntilNextMark(out buffer, 4096 * 1024); // TODO: move to constant
+ lastMark = ReadUntilNextMark(out buffer, _maxFileSize);
success = false;
Log.Write(LogType.Warning, LogComponent.Mail, "Failed to write mail file. Error '{1}'. Aborting.", e.Message);
@@ -927,8 +942,7 @@ namespace IFS.FTP
Log.Write(LogType.Verbose, LogComponent.Mail, "Client success code is {0}, {1}, '{2}'", lastMark, clientYesNo.Code, clientYesNo.Code);
if (!success)
- {
- // TODO: provide actual No codes.
+ {
SendFTPNoResponse(NoCode.TransientServerFailure, "Mail transfer failed.");
}
else
@@ -1238,6 +1252,9 @@ namespace IFS.FTP
private Thread _workerThread;
private bool _running;
+ // 4 megabytes as the maximum file size to accept.
+ private const int _maxFileSize = 4096 * 1024;
+
///
/// The last set of mail files retrieved via a Retrieve-Mail operation.
/// Saved so that Flush-Mailbox can use it to delete only those mails that
diff --git a/PUP/FTP/PropertyList.cs b/PUP/FTP/PropertyList.cs
index 7491bff..9bcfc5e 100644
--- a/PUP/FTP/PropertyList.cs
+++ b/PUP/FTP/PropertyList.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/PUP/Gateway/GatewayInformationProtocol.cs b/PUP/Gateway/GatewayInformationProtocol.cs
index a5836d3..9d0056d 100644
--- a/PUP/Gateway/GatewayInformationProtocol.cs
+++ b/PUP/Gateway/GatewayInformationProtocol.cs
@@ -1,4 +1,21 @@
-using IFS.Gateway;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Gateway;
using IFS.Logging;
using System;
using System.Collections.Generic;
@@ -23,9 +40,11 @@ namespace IFS.Gateway
{
public GatewayInformationProtocol()
{
- // TODO:
+ //
+ // TODO (once routing is implemented):
// load host tables, etc.
// spin up thread that spits out a GatewayInformation PUP periodically.
+ //
}
///
diff --git a/PUP/Gateway/Router.cs b/PUP/Gateway/Router.cs
index 28b4d5b..d5b328c 100644
--- a/PUP/Gateway/Router.cs
+++ b/PUP/Gateway/Router.cs
@@ -1,4 +1,21 @@
-using IFS.Logging;
+/*
+ This file is part of IFS.
+
+ IFS is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ IFS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with IFS. If not, see .
+*/
+
+using IFS.Logging;
using IFS.Transport;
using PcapDotNet.Core;
using System.Net.NetworkInformation;
diff --git a/PUP/IFS.csproj b/PUP/IFS.csproj
index ce7fc21..2d7951a 100644
--- a/PUP/IFS.csproj
+++ b/PUP/IFS.csproj
@@ -136,6 +136,7 @@
PreserveNewest
+
PreserveNewest
@@ -147,14 +148,6 @@
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-