[Box Backup-dev] COMMIT r548 - in box/chris/boxi: . bin/bbackupctl bin/bbackupd bin/bbackupquery bin/bbstored distribution distribution/boxbackup distribution/boxbackup/contrib/cygwin distribution/boxbackup/contrib/rpm docs/backup documentation documentation/boxbackup infrastructure infrastructure/m4 infrastructure/msvc infrastructure/msvc/2003 infrastructure/msvc/2005 lib/backupclient lib/common lib/compress lib/crypto lib/raidfile lib/server lib/win32 test/backupdiff test/backupstore test/backupstorefix test/backupstorefix/testfiles test/backupstorepatch test/basicserver test/bbackupd test/bbackupd/testfiles test/raidfile test/win32

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sat Mar 25 09:21:31 GMT 2006


Author: chris
Date: 2006-03-25 09:11:46 +0000 (Sat, 25 Mar 2006)
New Revision: 548

Added:
   box/chris/boxi/bin/bbackupd/bbackupd-config.in
   box/chris/boxi/bin/bbackupquery/makedocumentation.pl.in
   box/chris/boxi/bin/bbstored/bbstored-certs.in
   box/chris/boxi/bin/bbstored/bbstored-config.in
   box/chris/boxi/distribution/boxbackup/contrib/cygwin/install-cygwin-service.pl.in
   box/chris/boxi/documentation/
   box/chris/boxi/documentation/boxbackup/
   box/chris/boxi/documentation/boxbackup/adminguide.xml
   box/chris/boxi/documentation/boxbackup/instguide.xml
   box/chris/boxi/infrastructure/m4/ax_bswap64.m4
   box/chris/boxi/infrastructure/m4/ax_config_scripts.m4
   box/chris/boxi/infrastructure/makebuildenv.pl.in
   box/chris/boxi/infrastructure/makeparcels.pl.in
   box/chris/boxi/infrastructure/msvc/
   box/chris/boxi/infrastructure/msvc/2003/
   box/chris/boxi/infrastructure/msvc/2003/bbackupctl.vcproj
   box/chris/boxi/infrastructure/msvc/2003/bbackupd.vcproj
   box/chris/boxi/infrastructure/msvc/2003/boxbackup.ncb
   box/chris/boxi/infrastructure/msvc/2003/boxbackup.sln
   box/chris/boxi/infrastructure/msvc/2003/boxbackup.suo
   box/chris/boxi/infrastructure/msvc/2003/boxquery.vcproj
   box/chris/boxi/infrastructure/msvc/2003/common.vcproj
   box/chris/boxi/infrastructure/msvc/2003/win32test.vcproj
   box/chris/boxi/infrastructure/msvc/2005/
   box/chris/boxi/infrastructure/msvc/2005/bbackupctl.vcproj
   box/chris/boxi/infrastructure/msvc/2005/bbackupd.vcproj
   box/chris/boxi/infrastructure/msvc/2005/boxbackup.sln
   box/chris/boxi/infrastructure/msvc/2005/boxbackup.suo
   box/chris/boxi/infrastructure/msvc/2005/boxquery.vcproj
   box/chris/boxi/infrastructure/msvc/2005/common.vcproj
   box/chris/boxi/infrastructure/msvc/2005/win32test.vcproj
   box/chris/boxi/lib/common/Archive.h
   box/chris/boxi/lib/common/makeexception.pl.in
   box/chris/boxi/lib/raidfile/raidfile-config.in
   box/chris/boxi/lib/server/makeprotocol.pl.in
   box/chris/boxi/lib/win32/config.h.win32
   box/chris/boxi/runtest.pl.in
   box/chris/boxi/test/backupstorefix/testfiles/testbackupstorefix.pl.in
   box/chris/boxi/test/bbackupd/testfiles/extcheck1.pl.in
   box/chris/boxi/test/bbackupd/testfiles/extcheck2.pl.in
   box/chris/boxi/test/bbackupd/testfiles/notifyscript.pl.in
   box/chris/boxi/test/win32/Makefile
   box/chris/boxi/test/win32/timezone.cpp
Removed:
   box/chris/boxi/bbackupctl.vcproj
   box/chris/boxi/bbackupd.vcproj
   box/chris/boxi/bin/bbackupd/bbackupd-config
   box/chris/boxi/bin/bbackupquery/makedocumentation.pl
   box/chris/boxi/bin/bbstored/bbstored-certs
   box/chris/boxi/bin/bbstored/bbstored-config
   box/chris/boxi/boxbackup.sln
   box/chris/boxi/boxbackup.suo
   box/chris/boxi/boxquery.vcproj
   box/chris/boxi/common.vcproj
   box/chris/boxi/distribution/boxbackup/contrib/cygwin/install-cygwin-service.pl
   box/chris/boxi/documentation/boxbackup/
   box/chris/boxi/documentation/boxbackup/adminguide.xml
   box/chris/boxi/documentation/boxbackup/instguide.xml
   box/chris/boxi/infrastructure/makebuildenv.pl
   box/chris/boxi/infrastructure/makeparcels.pl
   box/chris/boxi/infrastructure/msvc/2003/
   box/chris/boxi/infrastructure/msvc/2003/bbackupctl.vcproj
   box/chris/boxi/infrastructure/msvc/2003/bbackupd.vcproj
   box/chris/boxi/infrastructure/msvc/2003/boxbackup.ncb
   box/chris/boxi/infrastructure/msvc/2003/boxbackup.sln
   box/chris/boxi/infrastructure/msvc/2003/boxbackup.suo
   box/chris/boxi/infrastructure/msvc/2003/boxquery.vcproj
   box/chris/boxi/infrastructure/msvc/2003/common.vcproj
   box/chris/boxi/infrastructure/msvc/2003/win32test.vcproj
   box/chris/boxi/infrastructure/msvc/2005/
   box/chris/boxi/infrastructure/msvc/2005/bbackupctl.vcproj
   box/chris/boxi/infrastructure/msvc/2005/bbackupd.vcproj
   box/chris/boxi/infrastructure/msvc/2005/boxbackup.sln
   box/chris/boxi/infrastructure/msvc/2005/boxbackup.suo
   box/chris/boxi/infrastructure/msvc/2005/boxquery.vcproj
   box/chris/boxi/infrastructure/msvc/2005/common.vcproj
   box/chris/boxi/infrastructure/msvc/2005/win32test.vcproj
   box/chris/boxi/lib/common/makeexception.pl
   box/chris/boxi/lib/raidfile/raidfile-config
   box/chris/boxi/lib/server/makeprotocol.pl
   box/chris/boxi/runtest.pl
   box/chris/boxi/test/backupstorefix/testfiles/testbackupstorefix.pl
   box/chris/boxi/test/bbackupd/testfiles/extcheck1.pl
   box/chris/boxi/test/bbackupd/testfiles/extcheck2.pl
   box/chris/boxi/test/bbackupd/testfiles/notifyscript.pl
   box/chris/boxi/test/raidfile/Darwin-SYS.h
   box/chris/boxi/test/raidfile/Makefile.extra.Darwin
   box/chris/boxi/test/raidfile/make-darwin-intercepts.pl
   box/chris/boxi/win32test.vcproj
Modified:
   box/chris/boxi/
   box/chris/boxi/BUGS.txt
   box/chris/boxi/VERSION.txt
   box/chris/boxi/bin/bbackupctl/bbackupctl.cpp
   box/chris/boxi/bin/bbackupd/
   box/chris/boxi/bin/bbackupd/BackupClientContext.cpp
   box/chris/boxi/bin/bbackupd/BackupClientContext.h
   box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.cpp
   box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.h
   box/chris/boxi/bin/bbackupd/BackupDaemon.cpp
   box/chris/boxi/bin/bbackupd/BackupDaemon.h
   box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp
   box/chris/boxi/bin/bbackupd/CommandSocketManager.h
   box/chris/boxi/bin/bbackupd/Win32ServiceFunctions.cpp
   box/chris/boxi/bin/bbackupd/bbackupd.cpp
   box/chris/boxi/bin/bbackupquery/
   box/chris/boxi/bin/bbackupquery/BackupQueries.cpp
   box/chris/boxi/bin/bbackupquery/Makefile.extra
   box/chris/boxi/bin/bbackupquery/bbackupquery.cpp
   box/chris/boxi/bin/bbstored/
   box/chris/boxi/bin/bbstored/BackupCommands.cpp
   box/chris/boxi/bin/bbstored/BackupStoreDaemon.cpp
   box/chris/boxi/bin/bbstored/BackupStoreDaemon.h
   box/chris/boxi/bin/bbstored/Makefile.extra
   box/chris/boxi/bin/bbstored/backupprotocol.txt
   box/chris/boxi/configure.ac
   box/chris/boxi/distribution/COMMON-MANIFEST.txt
   box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt
   box/chris/boxi/distribution/boxbackup/LICENSE.txt
   box/chris/boxi/distribution/boxbackup/LINUX.txt
   box/chris/boxi/distribution/boxbackup/THANKS.txt
   box/chris/boxi/distribution/boxbackup/VERSION.txt
   box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec
   box/chris/boxi/docs/backup/win32_build_on_cygwin_using_mingw.txt
   box/chris/boxi/infrastructure/
   box/chris/boxi/infrastructure/BoxPlatform.pm.in
   box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4
   box/chris/boxi/infrastructure/m4/ax_check_ssl.m4
   box/chris/boxi/infrastructure/m4/ax_path_bdb.m4
   box/chris/boxi/infrastructure/m4/vl_lib_readline.m4
   box/chris/boxi/infrastructure/makedistribution.pl
   box/chris/boxi/infrastructure/setupexternal.pl
   box/chris/boxi/lib/backupclient/BackupClientFileAttributes.cpp
   box/chris/boxi/lib/backupclient/BackupClientRestore.cpp
   box/chris/boxi/lib/backupclient/BackupDaemonConfigVerify.cpp
   box/chris/boxi/lib/backupclient/BackupStoreDirectory.cpp
   box/chris/boxi/lib/backupclient/BackupStoreFile.cpp
   box/chris/boxi/lib/backupclient/BackupStoreFile.h
   box/chris/boxi/lib/backupclient/BackupStoreFileDiff.cpp
   box/chris/boxi/lib/backupclient/BackupStoreFilenameClear.cpp
   box/chris/boxi/lib/backupclient/BackupStoreObjectDump.cpp
   box/chris/boxi/lib/backupclient/Makefile.extra
   box/chris/boxi/lib/common/
   box/chris/boxi/lib/common/BannerText.h
   box/chris/boxi/lib/common/Box.h
   box/chris/boxi/lib/common/BoxPlatform.h
   box/chris/boxi/lib/common/CommonException.txt
   box/chris/boxi/lib/common/DebugMemLeakFinder.cpp
   box/chris/boxi/lib/common/EventWatchFilesystemObject.cpp
   box/chris/boxi/lib/common/ExcludeList.cpp
   box/chris/boxi/lib/common/ExcludeList.h
   box/chris/boxi/lib/common/FdGetLine.cpp
   box/chris/boxi/lib/common/FileStream.h
   box/chris/boxi/lib/common/Guards.h
   box/chris/boxi/lib/common/Makefile.extra
   box/chris/boxi/lib/common/NamedLock.cpp
   box/chris/boxi/lib/common/Test.h
   box/chris/boxi/lib/common/UnixUser.cpp
   box/chris/boxi/lib/common/WaitForEvent.cpp
   box/chris/boxi/lib/compress/Makefile.extra
   box/chris/boxi/lib/crypto/Makefile.extra
   box/chris/boxi/lib/crypto/Random.cpp
   box/chris/boxi/lib/raidfile/
   box/chris/boxi/lib/raidfile/Makefile.extra
   box/chris/boxi/lib/raidfile/RaidFileWrite.cpp
   box/chris/boxi/lib/server/
   box/chris/boxi/lib/server/Daemon.cpp
   box/chris/boxi/lib/server/Daemon.h
   box/chris/boxi/lib/server/LocalProcessStream.cpp
   box/chris/boxi/lib/server/Makefile.extra
   box/chris/boxi/lib/server/Socket.cpp
   box/chris/boxi/lib/server/SocketListen.h
   box/chris/boxi/lib/server/SocketStream.cpp
   box/chris/boxi/lib/server/SocketStream.h
   box/chris/boxi/lib/server/SocketStreamTLS.cpp
   box/chris/boxi/lib/win32/WinNamedPipeStream.cpp
   box/chris/boxi/lib/win32/emu.cpp
   box/chris/boxi/lib/win32/emu.h
   box/chris/boxi/parcels.txt
   box/chris/boxi/test/backupdiff/testbackupdiff.cpp
   box/chris/boxi/test/backupstore/testbackupstore.cpp
   box/chris/boxi/test/backupstorefix/testbackupstorefix.cpp
   box/chris/boxi/test/backupstorefix/testfiles/
   box/chris/boxi/test/backupstorepatch/testbackupstorepatch.cpp
   box/chris/boxi/test/basicserver/Makefile.extra
   box/chris/boxi/test/bbackupd/testbbackupd.cpp
   box/chris/boxi/test/bbackupd/testfiles/
   box/chris/boxi/test/bbackupd/testfiles/bbackupd.conf
   box/chris/boxi/test/raidfile/intercept.cpp
   box/chris/boxi/test/win32/testlibwin32.cpp
   box/chris/boxi/win32.bat
Log:
Merged trunk fixes from revisions 295-547 into Boxi tree



Property changes on: box/chris/boxi
___________________________________________________________________
Name: svn:ignore
   - aclocal.m4
autom4te.cache
config.log
config.status
configure
debug
ExceptionCodes.txt
local
Makefile
parcels
release

   + aclocal.m4
autom4te.cache
config.log
config.status
configure
debug
ExceptionCodes.txt
local
Makefile
parcels
release
runtest.pl


Modified: box/chris/boxi/BUGS.txt
===================================================================
--- box/chris/boxi/BUGS.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/BUGS.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -8,3 +8,8 @@
 * if bbackupd gets an error then a signal, it may not wait it's full 100 seconds before retrying. And then won't stop the cycle...
 * bbackupquery restore, if not root, then won't do file ownership properly, but won't alert the user to this fact
 * empty (real) directories in the store aren't deleted when they're empty (and will never be used again) -- uses up disc space unnecessarily
+* need unit tests for SSL keepalives and state saving (serialisation)
+* make Archive derive from Protocol
+* more automated tests for win32
+* change off_t to box_off_t in preparation for win32 large file support
+* support large files on win32 by using native *i64 functions instead of posix

Modified: box/chris/boxi/VERSION.txt
===================================================================
--- box/chris/boxi/VERSION.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/VERSION.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,2 +1,2 @@
-0.09_boxi
+USE_SVN_VERSION
 boxbackup

Deleted: box/chris/boxi/bbackupctl.vcproj
===================================================================
--- box/chris/boxi/bbackupctl.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bbackupctl.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="bbackupctl"
-	ProjectGUID="{9FD51412-E945-4457-A17A-CA3C505CF431}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\db-4.2.52.NC\build_win32";"$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)Debug\common.lib $(ProjectDir)..\db-4.2.52.NC\build_win32\Debug\libdb42d.lib"
-				OutputFile="$(OutDir)/bbackupctl.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/bbackupctl.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)Release\common.lib"
-				OutputFile="$(OutDir)/bbackupctl.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="bbackupctl"
-					Filter="">
-					<File
-						RelativePath=".\bin\bbackupctl\bbackupctl.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Deleted: box/chris/boxi/bbackupd.vcproj
===================================================================
--- box/chris/boxi/bbackupd.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bbackupd.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,204 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="bbackupd"
-	ProjectGUID="{22D325FB-9131-4BD6-B390-968F0491D687}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(SolutionDir)..\db-4.2.52.NC\build_win32";"$(SolutionDir)..\boost_1_31_0";"$(SolutionDir)..\openssl\include";"$(SolutionDir)..\zlib\include";"$(SolutionDir)lib\backupclient";"$(SolutionDir)lib\server";"$(SolutionDir)lib\crypto";"$(SolutionDir)lib\compress";"$(SolutionDir)lib\win32";"$(SolutionDir)lib\common\""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)Debug\common.lib $(ProjectDir)lib\win32\Debug\boost_regex.lib $(ProjectDir)..\db-4.2.52.NC\build_win32\Debug\libdb42d.lib"
-				OutputFile="$(OutDir)/bbackupd.exe"
-				LinkIncremental="2"
-				IgnoreAllDefaultLibraries="FALSE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/bbackupd.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\";"$(SolutionDir)..\boost_1_31_0""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)Release\common.lib $(ProjectDir)lib\win32\Release\boost_regex.lib"
-				OutputFile="$(OutDir)/bbackupd.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="bbackupd"
-					Filter="">
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientContext.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientDeleteList.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientDirectoryRecord.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientInodeToIDMap.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupDaemon.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\bbackupd.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\bbwinservice.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\ServiceBackupDaemon.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="bbackupd"
-					Filter="">
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientContext.h">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientDeleteList.h">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientDirectoryRecord.h">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupClientInodeToIDMap.h">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\BackupDaemon.h">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\bbwinservice.h">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupd\ServiceBackupDaemon.h">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Modified: box/chris/boxi/bin/bbackupctl/bbackupctl.cpp
===================================================================
--- box/chris/boxi/bin/bbackupctl/bbackupctl.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupctl/bbackupctl.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -10,8 +10,11 @@
 #include "Box.h"
 
 #include <stdio.h>
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include "MainHelper.h"
 #include "BoxPortsAndFiles.h"
 #include "BackupDaemonConfigVerify.h"
@@ -219,7 +222,7 @@
 		// No? Just send the command given plus a quit command.
 		std::string cmd(argv[0]);
 		cmd += "\nquit\n";
-		connection.Write(cmd.c_str(), cmd.size());		
+		connection.Write(cmd.c_str(), cmd.size());
 	}
 	
 	// Read the response


Property changes on: box/chris/boxi/bin/bbackupd
___________________________________________________________________
Name: svn:ignore
   - Makefile

   + Makefile
bbackupd-config


Modified: box/chris/boxi/bin/bbackupd/BackupClientContext.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupClientContext.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/BackupClientContext.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,9 +9,15 @@
 
 #include "Box.h"
 
-#ifndef WIN32
-#include <syslog.h>
+#ifdef HAVE_SYSLOG_H
+	#include <syslog.h>
 #endif
+#ifdef HAVE_SIGNAL_H
+	#include <signal.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+	#include <sys/time.h>
+#endif
 
 #include "BoxPortsAndFiles.h"
 #include "BoxTime.h"
@@ -22,6 +28,7 @@
 #include "BackupStoreException.h"
 #include "BackupDaemon.h"
 #include "autogen_BackupProtocolClient.h"
+#include "BackupStoreFile.h"
 
 #include "MemLeakFindOn.h"
 
@@ -49,7 +56,9 @@
 	  mpNewIDMap(0),
 	  mStorageLimitExceeded(false),
 	  mpExcludeFiles(0),
-	  mpExcludeDirs(0)
+	  mpExcludeDirs(0),
+	  mbIsManaged(false),
+	  mTimeMgmtEpoch(0)
 {
 }
 
@@ -455,3 +464,172 @@
 }
 
 
+// maximum time to spend diffing
+static int sMaximumDiffTime = 600;
+// maximum time of SSL inactivity (keep-alive interval)
+static int sKeepAliveTime = 0;
+
+void BackupClientContext::SetMaximumDiffingTime(int iSeconds)
+{
+	sMaximumDiffTime = iSeconds < 0 ? 0 : iSeconds;
+	TRACE1("Set maximum diffing time to %d seconds\n", sMaximumDiffTime);
+}
+
+void BackupClientContext::SetKeepAliveTime(int iSeconds)
+{
+	sKeepAliveTime = iSeconds < 0 ? 0 : iSeconds;
+	TRACE1("Set keep-alive time to %d seconds\n", sKeepAliveTime);
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    static TimerSigHandler(int)
+//		Purpose: Signal handler
+//		Created: 19/3/04
+//
+// --------------------------------------------------------------------------
+static void TimerSigHandler(int iUnused)
+{
+	BackupStoreFile::DiffTimerExpired();	
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupClientContext::ManageDiffProcess()
+//		Purpose: Initiates a file diff control timer
+//		Created: 04/19/2005
+//
+// --------------------------------------------------------------------------
+void BackupClientContext::ManageDiffProcess()
+{
+	if (mbIsManaged || !mpConnection)
+		return;
+
+	ASSERT(mTimeMgmtEpoch == 0);
+
+#ifdef PLATFORM_CYGWIN
+	::signal(SIGALRM, TimerSigHandler);
+#elif defined WIN32
+	// no support for SIGVTALRM
+	SetTimerHandler(TimerSigHandler);
+#else
+	::signal(SIGVTALRM, TimerSigHandler);
+#endif // PLATFORM_CYGWIN
+
+	struct itimerval timeout;
+	memset(&timeout, 0, sizeof(timeout));
+
+	//
+	//
+	//
+	if (sMaximumDiffTime <= 0 && sKeepAliveTime <= 0)
+	{
+		TRACE0("Diff control not requested - letting things run wild\n");
+		return;
+	}
+	else if (sMaximumDiffTime > 0 && sKeepAliveTime > 0)
+	{
+		timeout.it_value.tv_sec = sKeepAliveTime < sMaximumDiffTime ? sKeepAliveTime : sMaximumDiffTime;
+		timeout.it_interval.tv_sec = sKeepAliveTime < sMaximumDiffTime ? sKeepAliveTime : sMaximumDiffTime;
+	}
+	else
+	{
+		timeout.it_value.tv_sec = sKeepAliveTime > 0 ? sKeepAliveTime : sMaximumDiffTime;
+		timeout.it_interval.tv_sec = sKeepAliveTime > 0 ? sKeepAliveTime : sMaximumDiffTime;
+	}
+
+	// avoid race
+	mTimeMgmtEpoch = time(NULL);
+
+#ifdef PLATFORM_CYGWIN
+	if(::setitimer(ITIMER_REAL, &timeout, NULL) != 0)
+#else
+	if(::setitimer(ITIMER_VIRTUAL, &timeout, NULL) != 0)
+#endif // PLATFORM_CYGWIN
+	{
+		mTimeMgmtEpoch = 0;
+
+		TRACE0("WARNING: couldn't set file diff control timeout\n");
+		THROW_EXCEPTION(BackupStoreException, Internal)
+	}
+
+	mbIsManaged = true;
+	TRACE0("Initiated timer for file diff control\n");
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupClientContext::UnManageDiffProcess()
+//		Purpose: suspends file diff control timer
+//		Created: 04/19/2005
+//
+// --------------------------------------------------------------------------
+void BackupClientContext::UnManageDiffProcess()
+{
+	if (!mbIsManaged /* don't test for active connection, just do it */)
+		return;
+
+	struct itimerval timeout;
+	memset(&timeout, 0, sizeof(timeout));
+
+#ifdef PLATFORM_CYGWIN
+	if(::setitimer(ITIMER_REAL, &timeout, NULL) != 0)
+#else
+	if(::setitimer(ITIMER_VIRTUAL, &timeout, NULL) != 0)
+#endif // PLATFORM_CYGWIN
+	{
+		TRACE0("WARNING: couldn't clear file diff control timeout\n");
+		THROW_EXCEPTION(BackupStoreException, Internal)
+	}
+
+	mbIsManaged = false;
+	mTimeMgmtEpoch = 0;
+
+	TRACE0("Suspended timer for file diff control\n");
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupClientContext::DoKeepAlive()
+//		Purpose: Does something inconsequential over the SSL link to keep it up
+//		Created: 04/19/2005
+//
+// --------------------------------------------------------------------------
+void BackupClientContext::DoKeepAlive()
+{
+	if (!mpConnection)
+	{
+		::syslog(LOG_ERR, "DoKeepAlive() called with no connection!");
+		return;
+	}
+
+	mpConnection->QueryGetIsAlive();
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupClientContext::GetTimeMgmtEpoch()
+//		Purpose: Returns the unix time when the diff was started, or zero
+//				 if the diff process is unmanaged.
+//		Created: 04/19/2005
+//
+// --------------------------------------------------------------------------
+time_t BackupClientContext::GetTimeMgmtEpoch() 
+{
+	return mTimeMgmtEpoch;
+}
+
+int BackupClientContext::GetMaximumDiffingTime() 
+{
+	return sMaximumDiffTime;
+}
+
+int BackupClientContext::GetKeepaliveTime() 
+{
+	return sKeepAliveTime;
+}

Modified: box/chris/boxi/bin/bbackupd/BackupClientContext.h
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupClientContext.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/BackupClientContext.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -12,6 +12,7 @@
 
 #include "BoxTime.h"
 #include "BackupClientDeleteList.h"
+#include "BackupStoreFile.h"
 #include "ExcludeList.h"
 
 class TLSContext;
@@ -48,13 +49,13 @@
 //		Created: 2003/10/08
 //
 // --------------------------------------------------------------------------
-class BackupClientContext
+class BackupClientContext : public DiffTimer
 {
 public:
 	BackupClientContext(LocationResolver &rResolver, TLSContext &rTLSContext, 
 		const std::string &rHostname, int32_t AccountNumber, 
 		bool ExtendedLogging);
-	~BackupClientContext();
+	virtual ~BackupClientContext();
 private:
 	BackupClientContext(const BackupClientContext &);
 public:
@@ -152,6 +153,60 @@
 		bool &rIsCurrentVersionOut, box_time_t *pModTimeOnServer = 0, box_time_t *pAttributesHashOnServer = 0,
 		BackupStoreFilenameClear *pLeafname = 0); // not const as may connect to server
 
+	// --------------------------------------------------------------------------
+	//
+	// Function
+	//		Name:    BackupClientContext::SetMaximumDiffingTime()
+	//		Purpose: Sets the maximum time that will be spent diffing a file
+	//		Created: 04/19/2005
+	//
+	// --------------------------------------------------------------------------
+	static void SetMaximumDiffingTime(int iSeconds);
+
+	// --------------------------------------------------------------------------
+	//
+	// Function
+	//		Name:    BackupClientContext::SetKeepAliveTime()
+	//		Purpose: Sets the time interval for repetitive keep-alive operation
+	//		Created: 04/19/2005
+	//
+	// --------------------------------------------------------------------------
+	static void SetKeepAliveTime(int iSeconds);
+
+	// --------------------------------------------------------------------------
+	//
+	// Function
+	//		Name:    BackupClientContext::ManageDiffProcess()
+	//		Purpose: Initiates an SSL connection/session keep-alive process
+	//		Created: 04/19/2005
+	//
+	// --------------------------------------------------------------------------
+	void ManageDiffProcess();
+
+	// --------------------------------------------------------------------------
+	//
+	// Function
+	//		Name:    BackupClientContext::UnManageDiffProcess()
+	//		Purpose: Suspends an SSL connection/session keep-alive process
+	//		Created: 04/19/2005
+	//
+	// --------------------------------------------------------------------------
+	void UnManageDiffProcess();
+
+	// --------------------------------------------------------------------------
+	//
+	// Function
+	//		Name:    BackupClientContext::DoKeepAlive()
+	//		Purpose: Does something inconsequential over the SSL link to 
+	//				 keep it up, implements DiffTimer interface
+	//		Created: 04/19/2005
+	//
+	// --------------------------------------------------------------------------
+	virtual void   DoKeepAlive();
+	virtual time_t GetTimeMgmtEpoch();
+	virtual int    GetMaximumDiffingTime();
+	virtual int    GetKeepaliveTime();
+	
 private:
 	LocationResolver &mrResolver;
 	TLSContext &mrTLSContext;
@@ -167,6 +222,10 @@
 	bool mStorageLimitExceeded;
 	ExcludeList *mpExcludeFiles;
 	ExcludeList *mpExcludeDirs;
+
+	bool mbIsManaged;
+	// unix time when diff was started
+	time_t mTimeMgmtEpoch;
 };
 
 

Modified: box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <dirent.h>
+#ifdef HAVE_DIRENT_H
+	#include <dirent.h>
+#endif
+
 #include <errno.h>
 #include <string.h>
 
@@ -25,6 +28,7 @@
 #include "FileModificationTime.h"
 #include "BackupDaemon.h"
 #include "BackupStoreException.h"
+#include "Archive.h"
 
 #include "MemLeakFindOn.h"
 
@@ -1123,14 +1127,28 @@
 				// Get the index
 				std::auto_ptr<IOStream> blockIndexStream(connection.ReceiveStream());
 			
+				//
 				// Diff the file
+				//
+
+				rParams.mrContext.ManageDiffProcess();
+
 				bool isCompletelyDifferent = false;
-				std::auto_ptr<IOStream> patchStream(BackupStoreFile::EncodeFileDiff(rFilename.c_str(),
+				std::auto_ptr<IOStream> patchStream(
+					BackupStoreFile::EncodeFileDiff(
+						rFilename.c_str(),
 						mObjectID,	/* containing directory */
 						rStoreFilename, diffFromID, *blockIndexStream,
-						connection.GetTimeout(), 0 /* not interested in the modification time */, &isCompletelyDifferent));
+						connection.GetTimeout(), 
+						&rParams.mrContext, // DiffTimer implementation
+						0 /* not interested in the modification time */, 
+						&isCompletelyDifferent));
 	
+				rParams.mrContext.UnManageDiffProcess();
+
+				//
 				// Upload the patch to the store
+				//
 				std::auto_ptr<BackupProtocolClientSuccess> stored(connection.QueryStoreFile(mObjectID, ModificationTime,
 						AttributesHash, isCompletelyDifferent?(0):(diffFromID), rStoreFilename, *patchStream));
 				
@@ -1160,6 +1178,8 @@
 	}
 	catch(BoxException &e)
 	{
+		rParams.mrContext.UnManageDiffProcess();
+
 		if(e.GetType() == ConnectionException::ExceptionType && e.GetSubType() == ConnectionException::Protocol_UnexpectedReply)
 		{
 			// Check and see what error the protocol has -- as it might be an error...
@@ -1249,3 +1269,178 @@
 BackupClientDirectoryRecord::SyncParams::~SyncParams()
 {
 }
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupClientDirectoryRecord::Deserialize(Archive & rArchive)
+//		Purpose: Deserializes this object instance from a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+void BackupClientDirectoryRecord::Deserialize(Archive & rArchive)
+{
+	// Make deletion recursive
+	DeleteSubDirectories();
+
+	// Delete maps
+	if(mpPendingEntries != 0)
+	{
+		delete mpPendingEntries;
+		mpPendingEntries = 0;
+	}
+
+	//
+	//
+	//
+	rArchive.Read(mObjectID);
+	rArchive.Read(mSubDirName);
+	rArchive.Read(mInitialSyncDone);
+	rArchive.Read(mSyncDone);
+
+	//
+	//
+	//
+	int64_t iCount = 0;
+	rArchive.Read(iCount);
+
+	if (iCount != sizeof(mStateChecksum)/sizeof(mStateChecksum[0]))
+	{
+		// we have some kind of internal system representation change: throw for now
+		THROW_EXCEPTION(CommonException, Internal)
+	}
+
+	for (int v = 0; v < iCount; v++)
+	{
+		// Load each checksum entry
+		rArchive.Read(mStateChecksum[v]);
+	}
+
+	//
+	//
+	//
+	iCount = 0;
+	rArchive.Read(iCount);
+
+	if (iCount > 0)
+	{
+		// load each pending entry
+		mpPendingEntries = new std::map<std::string, box_time_t>;
+		if (!mpPendingEntries)
+		{
+			throw std::bad_alloc();
+		}
+
+		for (int v = 0; v < iCount; v++)
+		{
+			std::string strItem;
+			box_time_t btItem;
+
+			rArchive.Read(strItem);
+			rArchive.Read(btItem);
+			(*mpPendingEntries)[strItem] = btItem;
+		}
+	}
+
+	//
+	//
+	//
+	iCount = 0;
+	rArchive.Read(iCount);
+
+	if (iCount > 0)
+	{
+		for (int v = 0; v < iCount; v++)
+		{
+			std::string strItem;
+			rArchive.Read(strItem);
+
+			BackupClientDirectoryRecord* pSubDirRecord = 
+				new BackupClientDirectoryRecord(0, ""); 
+			// will be deserialized anyway, give it id 0 for now
+
+			if (!pSubDirRecord)
+			{
+				throw std::bad_alloc();
+			}
+
+			/***** RECURSE *****/
+			pSubDirRecord->Deserialize(rArchive);
+			mSubDirectories[strItem] = pSubDirRecord;
+		}
+	}
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupClientDirectoryRecord::Serialize(Archive & rArchive)
+//		Purpose: Serializes this object instance into a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+void BackupClientDirectoryRecord::Serialize(Archive & rArchive) const
+{
+	//
+	//
+	//
+	rArchive.Write(mObjectID);
+	rArchive.Write(mSubDirName);
+	rArchive.Write(mInitialSyncDone);
+	rArchive.Write(mSyncDone);
+
+	//
+	//
+	//
+	int64_t iCount = 0;
+
+	// when reading back the archive, we will 
+	// need to know how many items there are.
+	iCount = sizeof(mStateChecksum) / sizeof(mStateChecksum[0]);
+	rArchive.Write(iCount); 
+
+	for (int v = 0; v < iCount; v++)
+	{
+		rArchive.Write(mStateChecksum[v]);
+	}
+
+	//
+	//
+	//
+	if (!mpPendingEntries)
+	{
+		iCount = 0;
+		rArchive.Write(iCount);
+	}
+	else
+	{
+		iCount = mpPendingEntries->size();
+		rArchive.Write(iCount);
+
+		for (std::map<std::string, box_time_t>::const_iterator
+			i =  mpPendingEntries->begin(); 
+			i != mpPendingEntries->end(); i++)
+		{
+			rArchive.Write(i->first);
+			rArchive.Write(i->second);
+		}
+	}
+	//
+	//
+	//
+	iCount = mSubDirectories.size();
+	rArchive.Write(iCount);
+
+	for (std::map<std::string, BackupClientDirectoryRecord*>::const_iterator
+		i =  mSubDirectories.begin(); 
+		i != mSubDirectories.end(); i++)
+	{
+		const BackupClientDirectoryRecord* pSubItem = i->second;
+		ASSERT(pSubItem);
+
+		rArchive.Write(i->first);
+		pSubItem->Serialize(rArchive);
+	}
+}

Modified: box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.h
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/BackupClientDirectoryRecord.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -18,6 +18,7 @@
 #include "BackupStoreDirectory.h"
 #include "MD5Digest.h"
 
+class Archive;
 class BackupClientContext;
 class BackupDaemon;
 class CommandSocketManager;
@@ -123,6 +124,9 @@
 public:
 	BackupClientDirectoryRecord(int64_t ObjectID, const std::string &rSubDirName);
 	~BackupClientDirectoryRecord();
+
+	void Deserialize(Archive & rArchive);
+	void Serialize(Archive & rArchive) const;
 private:
 	BackupClientDirectoryRecord(const BackupClientDirectoryRecord &);
 public:

Modified: box/chris/boxi/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupDaemon.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/BackupDaemon.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -10,12 +10,21 @@
 #include "Box.h"
 
 #include <stdio.h>
-#include <unistd.h>
+#include <string.h>
 
-#ifndef WIN32
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+#ifdef HAVE_SIGNAL_H
 	#include <signal.h>
+#endif
+#ifdef HAVE_SYSLOG_H
 	#include <syslog.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
 	#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
 	#include <sys/wait.h>
 #endif
 #ifdef HAVE_SYS_MOUNT_H
@@ -28,6 +37,9 @@
 	#include <cstdio>
 	#include <sys/mnttab.h>
 #endif
+#ifdef HAVE_PROCESS_H
+	#include <process.h>
+#endif
 
 #include "Configuration.h"
 #include "IOStream.h"
@@ -61,6 +73,7 @@
 #include "LocalProcessStream.h"
 #include "IOStreamGetLine.h"
 #include "Conversion.h"
+#include "Archive.h"
 
 #include "MemLeakFindOn.h"
 
@@ -70,9 +83,28 @@
 // This prevents repetative cycles of load on the server
 #define		SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY	6
 
+#ifdef WIN32
 // --------------------------------------------------------------------------
 //
 // Function
+//		Name:    HelperThread()
+//		Purpose: Background thread function, called by Windows,
+//			calls the BackupDaemon's RunHelperThread method
+//			to listen for and act on control communications
+//		Created: 18/2/04
+//
+// --------------------------------------------------------------------------
+unsigned int WINAPI HelperThread(LPVOID lpParam) 
+{ 
+	((BackupDaemon *)lpParam)->RunHelperThread();
+
+	return 0;
+}
+#endif
+
+// --------------------------------------------------------------------------
+//
+// Function
 //		Name:    BackupDaemon::BackupDaemon()
 //		Purpose: constructor
 //		Created: 2003/10/08
@@ -91,6 +123,20 @@
 	{
 		mNotificationsSent[l] = false;
 	}
+
+#ifdef WIN32
+	// Create a thread to handle the named pipe
+	HANDLE hThread;
+	unsigned int dwThreadId;
+
+	hThread = (HANDLE) _beginthreadex( 
+        	NULL,                        // default security attributes 
+        	0,                           // use default stack size  
+        	HelperThread,                // thread function 
+        	this,                        // argument to thread function 
+        	0,                           // use default creation flags 
+        	&dwThreadId);                // returns the thread identifier 
+#endif
 }
 
 // --------------------------------------------------------------------------
@@ -177,11 +223,12 @@
 	if(GetConfiguration().KeyExists("CommandSocket"))
 	{
 		printf(
-				"============================================================================================\n" \
-				"SECURITY WARNING: This platform cannot check the credentials of connections to the\n" \
-				"command socket. This is a potential DoS security problem.\n" \
-				"Remove the CommandSocket directive from the bbackupd.conf file if bbackupctl is not used.\n" \
-				"============================================================================================\n"
+				"==============================================================================\n"
+				"SECURITY WARNING: This platform cannot check the credentials of connections to\n"
+				"the command socket. This is a potential DoS security problem.\n"
+				"Remove the CommandSocket directive from the bbackupd.conf file if bbackupctl\n"
+				"is not used.\n"
+				"==============================================================================\n"
 			);
 	}
 }
@@ -213,30 +260,13 @@
 }
 
 #ifdef WIN32
-// --------------------------------------------------------------------------
-//
-// Function
-//		Name:    HelperThread()
-//		Purpose: Background thread function, called by Windows,
-//			calls the BackupDaemon's RunHelperThread method
-//			to listen for and act on control communications
-//		Created: 18/2/04
-//
-// --------------------------------------------------------------------------
-unsigned int cdecl HelperThread( LPVOID lpParam ) 
-{ 
-	printf( "Parameter = %lu.\n", *(DWORD*)lpParam ); 
-	((BackupDaemon *)lpParam)->RunHelperThread();
-
-	return 0;
-}
-
 void BackupDaemon::RunHelperThread(void)
 {
 	mpCommandSocketInfo = new CommandSocketInfo;
 	this->mReceivedCommandConn = false;
 
-	while ( !IsTerminateWanted() )
+	// loop until the parent process exits
+	while (TRUE)
 	{
 		try
 		{
@@ -349,24 +379,21 @@
 void BackupDaemon::Run()
 {
 #ifdef WIN32
-
-	// Create a thread to handle the named pipe
-	HANDLE hThread;
-	unsigned int dwThreadId;
-
-	hThread = (HANDLE) _beginthreadex( 
-        	NULL,                        // default security attributes 
-        	0,                           // use default stack size  
-        	HelperThread,                // thread function 
-        	this,                        // argument to thread function 
-        	0,                           // use default creation flags 
-        	&dwThreadId);                // returns the thread identifier 
-
 	// init our own timer for file diff timeouts
 	InitTimer();
 
+	try
+	{
+		Run2();
+	}
+	catch(...)
+	{
+		FiniTimer();
+		throw;
+	}
+
+	FiniTimer();
 #else // ! WIN32
-
 	// Ignore SIGPIPE (so that if a command connection is broken, the daemon doesn't terminate)
 	::signal(SIGPIPE, SIG_IGN);
 
@@ -378,8 +405,6 @@
 		const char *socketName = conf.GetKeyValue("CommandSocket").c_str();
 		mpCommandSocketInfo = new CommandSocketManager(conf, this, socketName);
 	}
-	
-#endif // WIN32
 
 	// Handle things nicely on exceptions
 	try
@@ -390,23 +415,28 @@
 	{
 		if(mpCommandSocketInfo != 0)
 		{
-			delete mpCommandSocketInfo;
+			try 
+			{
+				delete mpCommandSocketInfo;
+			}
+			catch(...)
+			{
+				::syslog(LOG_WARNING,
+					"Error closing command socket "
+					"after exception, ignored.");
+			}
 			mpCommandSocketInfo = 0;
 		}
 
 		throw;
 	}
-	
+
 	// Clean up
 	if(mpCommandSocketInfo != 0)
 	{
 		delete mpCommandSocketInfo;
 		mpCommandSocketInfo = 0;
 	}
-
-#ifdef WIN32
-	// clean up windows specific stuff.
-	FiniTimer();
 #endif
 }
 
@@ -432,11 +462,15 @@
 	// Set up the keys for various things
 	BackupClientCryptoKeys_Setup(conf.GetKeyValue("KeysFile").c_str());
 
-	// Set maximum diffing time?
+	// max diffing time, keep-alive time
 	if(conf.KeyExists("MaximumDiffingTime"))
 	{
-		BackupStoreFile::SetMaximumDiffingTime(conf.GetKeyValueInt("MaximumDiffingTime"));
+		BackupClientContext::SetMaximumDiffingTime(conf.GetKeyValueInt("MaximumDiffingTime"));
 	}
+	if(conf.KeyExists("KeepAliveTime"))
+	{
+		BackupClientContext::SetKeepAliveTime(conf.GetKeyValueInt("KeepAliveTime"));
+	}
 
 	// Setup various timings
 	
@@ -460,10 +494,18 @@
 	// When the last sync started (only updated if the store was not full when the sync ended)
 	box_time_t lastSyncTime = 0;
 
+ 	// --------------------------------------------------------------------------------------------
+ 
+	// And what's the current client store marker?
+	int64_t clientStoreMarker = 
+		BackupClientContext::ClientStoreMarker_NotKnown;
+	// haven't contacted the store yet
+
+ 	bool deserialised = DeserializeStoreObjectInfo(clientStoreMarker, 
+		lastSyncTime, nextSyncTime);
+ 
 	// --------------------------------------------------------------------------------------------
 	
-	// And what's the current client store marker?
-	int64_t clientStoreMarker = BackupClientContext::ClientStoreMarker_NotKnown;		// haven't contacted the store yet
 
 	// Set state
 	SetState(State_Idle);
@@ -529,6 +571,7 @@
 			{
 				// Script has asked for a delay
 				nextSyncTime = GetCurrentBoxTime() + SecondsToBoxTime(d);
+				doSync = false;
 			}
 			else
 			{
@@ -570,6 +613,20 @@
 				// but this should be OK, because the changes only upload should upload no data.
 				syncPeriodEndExtended += SecondsToBoxTime((time_t)(356*24*3600));
 			}
+
+			// Delete the serialised store object file,
+			// so that we don't try to reload it after a
+			// partially completed backup
+			if(deserialised && !DeleteStoreObjectInfo())
+			{
+				::syslog(LOG_ERR, "Failed to delete the "
+					"StoreObjectInfoFile, backup cannot "
+					"continue safely.");
+				// prevent runaway process where the logs fill up -- without this
+				// the log message will be emitted in a tight loop.
+				::sleep(60); 
+				continue;
+			}
 			
 			// Do sync
 			bool errorOccurred = false;
@@ -677,6 +734,13 @@
 
 				// Log
 				::syslog(LOG_INFO, "Finished scan of local files");
+
+				// --------------------------------------------------------------------------------------------
+
+				// We had a successful backup, save the store info
+				SerializeStoreObjectInfo(clientStoreMarker, lastSyncTime, nextSyncTime);
+
+				// --------------------------------------------------------------------------------------------
 			}
 			catch(BoxException &e)
 			{
@@ -747,6 +811,11 @@
 						// normal sleep
  						::sleep(100);
  					}
+					nextSyncTime = currentSyncStartTime + 
+						SecondsToBoxTime(90) +
+						Random::RandomInt(
+							updateStoreInterval >> 
+							SYNC_PERIOD_RANDOM_EXTRA_TIME_SHIFT_BY);
 				}
 			}
 
@@ -843,7 +912,7 @@
 }
 
 
-#ifndef HAVE_STRUCT_STATFS_F_MNTONNAME
+#if !defined(HAVE_STRUCT_STATFS_F_MNTONNAME) && !defined(HAVE_STRUCT_STATVFS_F_NMTONNAME)
 	// string comparison ordering for when mount points are handled
 	// by code, rather than the OS.
 	typedef struct
@@ -907,7 +976,7 @@
 	int numIDMaps = 0;
 
 #ifdef HAVE_MOUNTS
-#ifndef HAVE_STRUCT_STATFS_F_MNTONNAME
+#if !defined(HAVE_STRUCT_STATFS_F_MNTONNAME) && !defined(HAVE_STRUCT_STATVFS_F_MNTONNAME)
 	// Linux and others can't tell you where a directory is mounted. So we
 	// have to read the mount entries from /etc/mtab! Bizarre that the OS
 	// itself can't tell you, but there you go.
@@ -981,7 +1050,7 @@
 		ASSERT(*i == "/");
 	}
 #endif // n NDEBUG
-#endif // n HAVE_STRUCT_STATFS_F_MNTONNAME
+#endif // n HAVE_STRUCT_STATFS_F_MNTONNAME || n HAVE_STRUCT_STATVFS_F_MNTONNAME
 #endif // HAVE_MOUNTS
 
 	// Then... go through each of the entries in the configuration,
@@ -1005,11 +1074,16 @@
 			// Do a fsstat on the pathname to find out which mount it's on
 			{
 
-#if defined HAVE_STRUCT_STATFS_F_MNTONNAME || defined WIN32
+#if defined HAVE_STRUCT_STATFS_F_MNTONNAME || defined HAVE_STRUCT_STATVFS_F_MNTONNAME || defined WIN32
 
 				// BSD style statfs -- includes mount point, which is nice.
+#ifdef HAVE_STRUCT_STATVFS_F_MNTONNAME
+				struct statvfs s;
+				if(::statvfs(ploc->mPath.c_str(), &s) != 0)
+#else // HAVE_STRUCT_STATVFS_F_MNTONNAME
 				struct statfs s;
 				if(::statfs(ploc->mPath.c_str(), &s) != 0)
+#endif // HAVE_STRUCT_STATVFS_F_MNTONNAME
 				{
 					THROW_EXCEPTION(CommonException, OSFileError)
 				}
@@ -1538,7 +1612,19 @@
 	mUnusedRootDirEntries.clear();
 }
 
+// --------------------------------------------------------------------------
 
+typedef struct
+{
+	int32_t mMagicValue;	// also the version number
+	int32_t mNumEntries;
+	int64_t mObjectID;		// this object ID
+	int64_t mContainerID;	// ID of container
+	uint64_t mAttributesModTime;
+	int32_t mOptionsPresent;	// bit mask of optional sections / features present
+
+} loc_StreamFormat;
+
 // --------------------------------------------------------------------------
 //
 // Function
@@ -1576,3 +1662,461 @@
 		mpExcludeFiles = 0;
 	}
 }
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupDaemon::Location::Deserialize(Archive & rArchive)
+//		Purpose: Deserializes this object instance from a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+void BackupDaemon::Location::Deserialize(Archive &rArchive)
+{
+	//
+	//
+	//
+	mpDirectoryRecord.reset(NULL);
+	if (mpExcludeFiles)
+	{
+		delete mpExcludeFiles;
+		mpExcludeFiles = NULL;
+	}
+	if (mpExcludeDirs)
+	{
+		delete mpExcludeDirs;
+		mpExcludeDirs = NULL;
+	}
+
+	//
+	//
+	//
+	rArchive.Read(mName);
+	rArchive.Read(mPath);
+	rArchive.Read(mIDMapIndex);
+
+	//
+	//
+	//
+	int64_t aMagicMarker = 0;
+	rArchive.Read(aMagicMarker);
+
+	if (aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
+	{
+		// NOOP
+	}
+	else if (aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
+	{
+		BackupClientDirectoryRecord *pSubRecord = new BackupClientDirectoryRecord(0, "");
+		if (!pSubRecord)
+			throw std::bad_alloc();
+
+		mpDirectoryRecord.reset(pSubRecord);
+		mpDirectoryRecord->Deserialize(rArchive);
+	}
+	else
+	{
+		// there is something going on here
+		THROW_EXCEPTION(CommonException, Internal)
+	}
+
+	//
+	//
+	//
+	rArchive.Read(aMagicMarker);
+
+	if (aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
+	{
+		// NOOP
+	}
+	else if (aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
+	{
+		mpExcludeFiles = new ExcludeList;
+		if (!mpExcludeFiles)
+			throw std::bad_alloc();
+
+		mpExcludeFiles->Deserialize(rArchive);
+	}
+	else
+	{
+		// there is something going on here
+		THROW_EXCEPTION(CommonException, Internal)
+	}
+
+	//
+	//
+	//
+	rArchive.Read(aMagicMarker);
+
+	if (aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
+	{
+		// NOOP
+	}
+	else if (aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
+	{
+		mpExcludeDirs = new ExcludeList;
+		if (!mpExcludeDirs)
+			throw std::bad_alloc();
+
+		mpExcludeDirs->Deserialize(rArchive);
+	}
+	else
+	{
+		// there is something going on here
+		THROW_EXCEPTION(CommonException, Internal)
+	}
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupDaemon::Location::Serialize(Archive & rArchive)
+//		Purpose: Serializes this object instance into a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+void BackupDaemon::Location::Serialize(Archive & rArchive) const
+{
+	//
+	//
+	//
+	rArchive.Write(mName);
+	rArchive.Write(mPath);
+	rArchive.Write(mIDMapIndex);
+
+	//
+	//
+	//
+	if (mpDirectoryRecord.get() == NULL)
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_NOOP;
+		rArchive.Write(aMagicMarker);
+	}
+	else
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_RECURSE; // be explicit about whether recursion follows
+		rArchive.Write(aMagicMarker);
+
+		mpDirectoryRecord->Serialize(rArchive);
+	}
+
+	//
+	//
+	//
+	if (!mpExcludeFiles)
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_NOOP;
+		rArchive.Write(aMagicMarker);
+	}
+	else
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_RECURSE; // be explicit about whether recursion follows
+		rArchive.Write(aMagicMarker);
+
+		mpExcludeFiles->Serialize(rArchive);
+	}
+
+	//
+	//
+	//
+	if (!mpExcludeDirs)
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_NOOP;
+		rArchive.Write(aMagicMarker);
+	}
+	else
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_RECURSE; // be explicit about whether recursion follows
+		rArchive.Write(aMagicMarker);
+
+		mpExcludeDirs->Serialize(rArchive);
+	}
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime)
+//		Purpose: Serializes remote directory and file information into a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+
+static const int STOREOBJECTINFO_MAGIC_ID_VALUE = 0x7777525F;
+static const std::string STOREOBJECTINFO_MAGIC_ID_STRING = "BBACKUPD-STATE";
+static const int STOREOBJECTINFO_VERSION = 1;
+
+void BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const
+{
+	if(!GetConfiguration().KeyExists("StoreObjectInfoFile"))
+	{
+		return;
+	}
+
+	std::string StoreObjectInfoFile = 
+		GetConfiguration().GetKeyValue("StoreObjectInfoFile");
+
+	if (StoreObjectInfoFile.size() <= 0)
+	{
+		return;
+	}
+
+	try
+	{
+		FileStream aFile(StoreObjectInfoFile.c_str(), 
+			O_WRONLY | O_CREAT | O_TRUNC);
+		Archive anArchive(aFile, 0);
+
+		anArchive.Write(STOREOBJECTINFO_MAGIC_ID_VALUE);
+		anArchive.Write(STOREOBJECTINFO_MAGIC_ID_STRING); 
+		anArchive.Write(STOREOBJECTINFO_VERSION);
+		anArchive.Write(GetLoadedConfigModifiedTime());
+		anArchive.Write(aClientStoreMarker);
+		anArchive.Write(theLastSyncTime);
+		anArchive.Write(theNextSyncTime);
+
+		//
+		//
+		//
+		int64_t iCount = mLocations.size();
+		anArchive.Write(iCount);
+
+		for (int v = 0; v < iCount; v++)
+		{
+			ASSERT(mLocations[v]);
+			mLocations[v]->Serialize(anArchive);
+		}
+
+		//
+		//
+		//
+		iCount = mIDMapMounts.size();
+		anArchive.Write(iCount);
+
+		for (int v = 0; v < iCount; v++)
+			anArchive.Write(mIDMapMounts[v]);
+
+		//
+		//
+		//
+		aFile.Close();
+		::syslog(LOG_INFO, "Saved store object info file '%s'", 
+			StoreObjectInfoFile.c_str());
+	}
+	catch (...)
+	{
+		::syslog(LOG_WARNING, "Requested store object info file '%s' "
+			"not accessible or could not be created", 
+			StoreObjectInfoFile.c_str());
+	}
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupDaemon::DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, box_time_t & theLastSyncTime, box_time_t & theNextSyncTime)
+//		Purpose: Deserializes remote directory and file information from a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+bool BackupDaemon::DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, box_time_t & theLastSyncTime, box_time_t & theNextSyncTime)
+{
+	//
+	//
+	//
+	DeleteAllLocations();
+
+	//
+	//
+	//
+	if(!GetConfiguration().KeyExists("StoreObjectInfoFile"))
+	{
+		return false;
+	}
+
+	std::string StoreObjectInfoFile = 
+		GetConfiguration().GetKeyValue("StoreObjectInfoFile");
+
+	if (StoreObjectInfoFile.size() <= 0)
+	{
+		return false;
+	}
+
+	try
+	{
+		FileStream aFile(StoreObjectInfoFile.c_str(), O_RDONLY);
+		Archive anArchive(aFile, 0);
+
+		//
+		// see if the content looks like a valid serialised archive
+		//
+		int iMagicValue = 0;
+		anArchive.Read(iMagicValue);
+
+		if (iMagicValue != STOREOBJECTINFO_MAGIC_ID_VALUE)
+		{
+			::syslog(LOG_WARNING, "Store object info file '%s' "
+				"is not a valid or compatible serialised "
+				"archive. Will re-cache from store.", 
+				StoreObjectInfoFile.c_str());
+			return false;
+		}
+
+		//
+		// get a bit optimistic and read in a string identifier
+		//
+		std::string strMagicValue;
+		anArchive.Read(strMagicValue);
+
+		if (strMagicValue != STOREOBJECTINFO_MAGIC_ID_STRING)
+		{
+			::syslog(LOG_WARNING, "Store object info file '%s' "
+				"is not a valid or compatible serialised "
+				"archive. Will re-cache from store.", 
+				StoreObjectInfoFile.c_str());
+			return false;
+		}
+
+		//
+		// check if we are loading some future format
+		// version by mistake
+		//
+		int iVersion = 0;
+		anArchive.Read(iVersion);
+
+		if (iVersion != STOREOBJECTINFO_VERSION)
+		{
+			::syslog(LOG_WARNING, "Store object info file '%s' "
+				"version %d unsupported. "
+				"Will re-cache from store.", 
+				StoreObjectInfoFile.c_str(), 
+				iVersion);
+			return false;
+		}
+
+		//
+		// check if this state file is even valid 
+		// for the loaded bbackupd.conf file
+		//
+		box_time_t lastKnownConfigModTime;
+		anArchive.Read(lastKnownConfigModTime);
+
+		if (lastKnownConfigModTime != GetLoadedConfigModifiedTime())
+		{
+			::syslog(LOG_WARNING, "Store object info file '%s' "
+				"out of date. Will re-cache from store", 
+				StoreObjectInfoFile.c_str());
+			return false;
+		}
+
+		//
+		// this is it, go at it
+		//
+		anArchive.Read(aClientStoreMarker);
+		anArchive.Read(theLastSyncTime);
+		anArchive.Read(theNextSyncTime);
+
+		//
+		//
+		//
+		int64_t iCount = 0;
+		anArchive.Read(iCount);
+
+		for (int v = 0; v < iCount; v++)
+		{
+			Location* pLocation = new Location;
+			if (!pLocation)
+				throw std::bad_alloc();
+
+			pLocation->Deserialize(anArchive);
+			mLocations.push_back(pLocation);
+		}
+
+		//
+		//
+		//
+		iCount = 0;
+		anArchive.Read(iCount);
+
+		for (int v = 0; v < iCount; v++)
+		{
+			std::string strItem;
+			anArchive.Read(strItem);
+
+			mIDMapMounts.push_back(strItem);
+		}
+
+		//
+		//
+		//
+		aFile.Close();
+		::syslog(LOG_INFO, "Loaded store object info file '%s', "
+			"version [%d]", StoreObjectInfoFile.c_str(), 
+			iVersion);
+
+		return true;
+	}
+	catch (...)
+	{
+		DeleteAllLocations();
+
+		aClientStoreMarker = 
+			BackupClientContext::ClientStoreMarker_NotKnown;
+		theLastSyncTime = 0;
+		theNextSyncTime = 0;
+
+		::syslog(LOG_WARNING, "Requested store object info file '%s' "
+			"does not exist, not accessible, or inconsistent. "
+			"Will re-cache from store.", 
+			StoreObjectInfoFile.c_str());
+	}
+
+	return false;
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupDaemon::DeleteStoreObjectInfo()
+//		Purpose: Deletes the serialised state file, to prevent us
+//			 from using it again if a backup is interrupted.
+//
+//		Created: 2006/02/12
+//
+// --------------------------------------------------------------------------
+
+bool BackupDaemon::DeleteStoreObjectInfo() const
+{
+	if(!GetConfiguration().KeyExists("StoreObjectInfoFile"))
+	{
+		return false;
+	}
+
+	std::string storeObjectInfoFile(GetConfiguration().GetKeyValue("StoreObjectInfoFile"));
+
+	// Check to see if the file exists
+	if(!FileExists(storeObjectInfoFile.c_str()))
+	{
+		// File doesn't exist -- so can't be deleted. But something isn't quite right, so log a message
+		::syslog(LOG_ERR, "Expected to be able to delete "
+			"store object info file '%s', but the file did not exist.",
+			storeObjectInfoFile.c_str());
+		// Return true to stop things going around in a loop
+		return true;
+	}
+
+	// Actually delete it
+	if(::unlink(storeObjectInfoFile.c_str()) != 0)
+	{
+		::syslog(LOG_ERR, "Failed to delete the old "
+			"store object info file '%s': %s",
+			storeObjectInfoFile.c_str(), strerror(errno));
+		return false;
+	}
+
+	return true;
+}

Modified: box/chris/boxi/bin/bbackupd/BackupDaemon.h
===================================================================
--- box/chris/boxi/bin/bbackupd/BackupDaemon.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/BackupDaemon.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -14,10 +14,17 @@
 #include <string>
 #include <memory>
 
+#include "BoxTime.h"
 #include "Daemon.h"
 #include "CommandSocketManager.h"
 #include "BackupClientContext.h"
 #include "BackupClientDirectoryRecord.h"
+#include "Socket.h"
+#include "SocketListen.h"
+#include "SocketStream.h"
+#ifdef WIN32
+	#include "WinNamedPipeStream.h"
+#endif
 
 #ifndef WIN32
 	#include <syslog.h>
@@ -26,6 +33,7 @@
 class Configuration;
 class BackupClientInodeToIDMap;
 class ExcludeList;
+class Archive;
 
 // --------------------------------------------------------------------------
 //
@@ -41,7 +49,12 @@
 public:
 	BackupDaemon();
 	~BackupDaemon();
+
 private:
+	// methods below do partial (specialized) serialization of client state only
+	void SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const;
+	bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, box_time_t & theLastSyncTime, box_time_t & theNextSyncTime);
+	bool DeleteStoreObjectInfo() const;
 	BackupDaemon(const BackupDaemon &);
 public:
 
@@ -103,6 +116,9 @@
 	public:
 		Location();
 		~Location();
+
+		void Deserialize(Archive & rArchive);
+		void Serialize(Archive & rArchive) const;
 	private:
 		Location(const Location &);	// copy not allowed
 		Location &operator=(const Location &);

Modified: box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/CommandSocketManager.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -66,21 +66,35 @@
 void CommandSocketManager::Wait(box_time_t RequiredDelay)
 {
 #ifdef WIN32
-	// Another thread is listening on the command socket, 
-	// no need for us to do anything here.
-	DWORD timeout = BoxTimeToMilliSeconds(RequiredDelay);
+	// Really could use some interprocess protection, mutex etc
+	// any side effect should be too bad???? :)
+	DWORD timeout = (DWORD)BoxTimeToMilliSeconds(RequiredDelay);
 
-	if (timeout > 0)
+	while ( this->mReceivedCommandConn == false )
 	{
-		Sleep(timeout);
+		Sleep(1);
+
+		if ( timeout == 0 )
+		{
+			DoSyncFlagOut = false;
+			SyncIsForcedOut = false;
+			return;
+		}
+		timeout--;
 	}
-#else // !WIN32
+	this->mReceivedCommandConn = false;
+	DoSyncFlagOut = this->mDoSyncFlagOut;
+	SyncIsForcedOut = this->mSyncIsForcedOut;
+
+	return;
+#else // ! WIN32
+	
 	TRACE1("Wait on command socket, delay = %lld\n", RequiredDelay);
 	
 	try
 	{
 		// Timeout value for connections and things
-		int timeout = ((int)BoxTimeToMilliSeconds(RequiredDelay));
+		int timeout = ((int)BoxTimeToMilliSeconds(RequiredDelay)) + 1;
 		// Handle bad boundary cases
 		if(timeout <= 0) timeout = 1;
 		if(timeout == INFTIM) timeout = 100000;
@@ -101,19 +115,20 @@
 			{
 #ifdef PLATFORM_CANNOT_FIND_PEER_UID_OF_UNIX_SOCKET
 				bool uidOK = true;
-				::syslog(LOG_ERR, "On this platform, no security check "
-					"can be made on the credientials of peers connecting "
-					"to the command socket. (bbackupctl)");
+				::syslog(LOG_WARNING, "On this platform, "
+					"no security check can be made on the "
+					"credentials of peers connecting to "
+					"the command socket. (bbackupctl)");
 #else
-				// Security check -- does the process connecting
+				// Security check -- does the process connecting 
 				// to this socket have the same UID as this process?
 				bool uidOK = false;
 				// BLOCK
 				{
 					uid_t remoteEUID = 0xffff;
 					gid_t remoteEGID = 0xffff;
-					if(mpConnectedSocket->GetPeerCredentials(remoteEUID, 
-						remoteEGID))
+					if(mpConnectedSocket->GetPeerCredentials(
+						remoteEUID, remoteEGID))
 					{
 						// Credentials are available -- check UID
 						if(remoteEUID == ::getuid())
@@ -125,7 +140,7 @@
 				}
 #endif // PLATFORM_CANNOT_FIND_PEER_UID_OF_UNIX_SOCKET
 				
-				// Is this an acceptible connection?
+				// Is this an acceptable connection?
 				if(!uidOK)
 				{
 					// Dump the connection
@@ -135,25 +150,25 @@
 					mpConnectedSocket.reset();
 					return;
 				}
-
-				// Log
-				::syslog(LOG_INFO, "Incoming connection to command socket");
-				TRACE0("Accepted new command connection\n");
-				
-				// Send a header line summarising the configuration and current state
-				char summary[256];
-				int summarySize = sprintf(summary, "bbackupd: %d %d %d %d\n"
-					"state %d\n",
-					mConf.GetKeyValueBool("AutomaticBackup"),
-					mConf.GetKeyValueInt("UpdateStoreInterval"),
-					mConf.GetKeyValueInt("MinimumFileAge"),
-					mConf.GetKeyValueInt("MaxUploadWait"),
-					mState);
-				mpConnectedSocket->Write(summary, summarySize);
-				
-				// Set the timeout to something very small, so we don't
-				// spend too long on waiting for any incoming data
-				timeout = 10; // milliseconds
+				else
+				{
+					// Log
+					::syslog(LOG_INFO, "Connection from command socket");
+					
+					// Send a header line summarising the configuration and current state
+					char summary[256];
+					int summarySize = sprintf(summary, "bbackupd: %d %d %d %d\nstate %d\n",
+						mConf.GetKeyValueBool("AutomaticBackup"),
+						mConf.GetKeyValueInt("UpdateStoreInterval"),
+						mConf.GetKeyValueInt("MinimumFileAge"),
+						mConf.GetKeyValueInt("MaxUploadWait"),
+						mState);
+					mpConnectedSocket->Write(summary, summarySize);
+					
+					// Set the timeout to something very small, so we don't wait too long on waiting
+					// for any incoming data
+					timeout = 10; // milliseconds
+				}
 			}
 		}
 
@@ -171,7 +186,9 @@
 		// Don't do this if the timeout requested was zero, as we don't want
 		// to flood the connection during background polling
 		if (RequiredDelay > 0)
+		{
 			mpConnectedSocket->Write("ping\n", 5);
+		}
 		
 		// Wait for a command or something on the socket
 		std::string command;
@@ -260,25 +277,23 @@
 // --------------------------------------------------------------------------
 void CommandSocketManager::CloseConnection()
 {
+#ifndef WIN32
 	try
 	{
 		TRACE0("Closing command connection\n");
-	
-#ifdef WIN32
-		mListeningSocket.Close();
-#else
+		
 		if(mpGetLine)
 		{
 			delete mpGetLine;
 			mpGetLine = 0;
 		}
 		mpConnectedSocket.reset();
-#endif
 	}
 	catch(...)
 	{
 		// Ignore any errors
 	}
+#endif
 }
 
 
@@ -296,18 +311,21 @@
 	// The bbackupctl program can't rely on a state change, because it may never
 	// change if the server doesn't need to be contacted.
 
+#ifdef __MINGW32__
+#warning race condition: what happens if socket is closed?
+#endif
+
 #ifdef WIN32
-    if (mListeningSocket.IsConnected())
+	if (mListeningSocket.IsConnected())
 #else
 	if (mpConnectedSocket.get() != 0)
 #endif
 	{
 		const char* message = SendStart ? "start-sync\n" : "finish-sync\n";
-		
 		try
 		{
 #ifdef WIN32
-			mListeningSocket.Write(message, strlen(message));
+			mListeningSocket.Write(message, (int)strlen(message));
 #else
 			mpConnectedSocket->Write(message, strlen(message));
 #endif
@@ -322,34 +340,36 @@
 void CommandSocketManager::SendStateUpdate(state_t State)
 {
 	mState = State;
-	
+
 	// If there's a command socket connected, then inform it -- 
 	// disconnecting from the command socket if there's an error
 
+	char newState[64];
+	char newStateSize = sprintf(newState, "state %d\n", State);
+
 #ifdef WIN32
-	#warning FIX ME: race condition
+	#ifndef _MSC_VER
+		#warning FIX ME: race condition
+	#endif
+
 	// what happens if the socket is closed by the other thread before
 	// we can write to it? Null pointer deref at best.
 	if (mListeningSocket.IsConnected())
-		return;
-#else	
-	if(mpConnectedSocket.get() == 0)
-		return;
+#else
+	if (mpConnectedSocket.get() != 0)
 #endif
-	
-	// Something connected to the command socket, tell it about the new state
-	char newState[64];
-	char newStateSize = sprintf(newState, "state %d\n", State);
-	try
 	{
+		try
+		{
 #ifdef WIN32
-		mListeningSocket.Write(newState, newStateSize);
+			mListeningSocket.Write(newState, newStateSize);
 #else
-		mpConnectedSocket->Write(newState, newStateSize);
+			mpConnectedSocket->Write(newState, newStateSize);
 #endif
+		}
+		catch(...)
+		{
+			CloseConnection();
+		}
 	}
-	catch(...)
-	{
-		CloseConnection();
-	}
 }

Modified: box/chris/boxi/bin/bbackupd/CommandSocketManager.h
===================================================================
--- box/chris/boxi/bin/bbackupd/CommandSocketManager.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/CommandSocketManager.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -16,8 +16,11 @@
 #include "Socket.h"
 #include "SocketListen.h"
 #include "SocketStream.h"
-#include "WinNamedPipeStream.h"
 
+#ifdef WIN32
+	#include "WinNamedPipeStream.h"
+#endif
+
 typedef enum
 {
 	// Add stuff to this, make sure the textual equivalents 

Modified: box/chris/boxi/bin/bbackupd/Win32ServiceFunctions.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/Win32ServiceFunctions.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/Win32ServiceFunctions.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -14,10 +14,12 @@
 
 #include "Box.h"
 
-//#include <stdio.h>
-//#include <stdlib.h>
-#include <unistd.h>
-//#include <windows.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+#ifdef HAVE_PROCESS_H
+	#include <process.h>
+#endif
 
 extern void TerminateService(void);
 extern unsigned int WINAPI RunService(LPVOID lpParameter);
@@ -31,18 +33,23 @@
 
 #define SERVICE_NAME "boxbackup"
 
+void ShowMessage(char *s)
+{
+	MessageBox(0, s, "Box Backup Message", 
+		MB_OK | MB_SETFOREGROUND | MB_DEFAULT_DESKTOP_ONLY);
+}
+
 void ErrorHandler(char *s, DWORD err)
 {
 	char buf[256];
 	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err);
+	_snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err);
 	::syslog(LOG_ERR, "%s", buf);
 	MessageBox(0, buf, "Error", 
 		MB_OK | MB_SETFOREGROUND | MB_DEFAULT_DESKTOP_ONLY);
 	ExitProcess(err);
 }
 
-
 void WINAPI ServiceControlHandler( DWORD controlCode )
 {
 	switch ( controlCode )
@@ -88,7 +95,7 @@
 
 VOID ServiceMain(DWORD argc, LPTSTR *argv) 
 {
-   // initialise service status
+    // initialise service status
     gServiceStatus.dwServiceType = SERVICE_WIN32;
     gServiceStatus.dwCurrentState = SERVICE_STOPPED;
     gServiceStatus.dwControlsAccepted = 0;
@@ -178,14 +185,19 @@
 
 	scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE);
 
-	if (!scm) return;
+	if (!scm) 
+	{
+		syslog(LOG_ERR, "Failed to open service control manager: "
+			"error %d", GetLastError());
+		return;
+	}
 
 	char cmd[MAX_PATH];
 	GetModuleFileName(NULL, cmd, sizeof(cmd)-1);
 	cmd[sizeof(cmd)-1] = 0;
 
 	char cmd_args[MAX_PATH];
-	snprintf(cmd_args, sizeof(cmd_args)-1, "%s --service", cmd);
+	_snprintf(cmd_args, sizeof(cmd_args)-1, "%s --service", cmd);
 	cmd_args[sizeof(cmd_args)-1] = 0;
 
 	newService = CreateService(
@@ -194,12 +206,31 @@
 		"Box Backup", 
 		SERVICE_ALL_ACCESS, 
 		SERVICE_WIN32_OWN_PROCESS, 
-		SERVICE_DEMAND_START, 
+		SERVICE_AUTO_START, 
 		SERVICE_ERROR_NORMAL, 
 		cmd_args, 
 		0,0,0,0,0);
 
-	if (newService) CloseServiceHandle(newService);
+	if (!newService) 
+	{
+		::syslog(LOG_ERR, "Failed to create Box Backup service: "
+			"error %d", GetLastError());
+		return;
+	}
+
+	::syslog(LOG_INFO, "Created Box Backup service");
+	
+	SERVICE_DESCRIPTION desc;
+	desc.lpDescription = "Backs up your data files over the Internet";
+	
+	if (!ChangeServiceConfig2(newService, SERVICE_CONFIG_DESCRIPTION,
+		&desc))
+	{
+		::syslog(LOG_WARNING, "Failed to set description for "
+			"Box Backup service: error %d", GetLastError());
+	}
+
+	CloseServiceHandle(newService);
 	CloseServiceHandle(scm);
 }
 
@@ -210,23 +241,31 @@
 
 	scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE);
 
-	if (!scm) return;
+	if (!scm) 
+	{
+		syslog(LOG_ERR, "Failed to open service control manager: "
+			"error %d", GetLastError());
+		return;
+	}
 
 	service = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS|DELETE);
 	ControlService(service, SERVICE_CONTROL_STOP, &status);
 
 	if (!service)
 	{
-		printf("Failed to open service manager");
+		syslog(LOG_ERR, "Failed to open Box Backup service: "
+			"error %d", GetLastError());
 		return;
 	}
+
 	if (DeleteService(service))
 	{
-		printf("Service removed");
+		syslog(LOG_INFO, "Box Backup service deleted");
 	}
 	else
 	{
-		printf("Failed to remove service");
+		syslog(LOG_ERR, "Failed to remove Box Backup service: "
+			"error %d", GetLastError());
 	}
 
 	CloseServiceHandle(service);

Deleted: box/chris/boxi/bin/bbackupd/bbackupd-config
===================================================================
--- box/chris/boxi/bin/bbackupd/bbackupd-config	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/bbackupd-config	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,525 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-# should be running as root
-if($> != 0)
-{
-	printf "\nWARNING: this should be run as root\n\n"
-}
-
-sub error_print_usage
-{
-	print <<__E;
-
-Setup bbackupd config utility.
-
-Bad command line parameters.
-Usage:
-	bbackupd-config config-dir backup-mode account-num server-hostname working-dir backup-dir [more backup directories]
-
-config-dir usually /etc/box
-backup-mode is lazy or snapshot
-    lazy mode runs continously, uploading files over a specified age
-    snapshot mode uploads a snapshot of the filesystem when instructed explicitly
-account-num (hexdecimal) and server-hostname as supplied from the server administrator
-working-dir usually /var/bbackupd
-backup-dir, list of directories to back up
-
-__E
-	print "=========\nERROR:\n",$_[0],"\n\n" if $_[0] ne '';
-	exit(1);
-}
-
-# check and get command line parameters
-if($#ARGV < 4)
-{
-	error_print_usage();
-}
-
-# check for OPENSSL_CONF environment var being set
-if(exists $ENV{'OPENSSL_CONF'})
-{
-	print <<__E;
-
----------------------------------------
-
-WARNING:
-    You have the OPENSSL_CONF environment variable set.
-    Use of non-standard openssl configs may cause problems.
-
----------------------------------------
-
-__E
-}
-
-# default locations
-my $default_config_location = '/etc/box/bbackupd.conf';
-
-# command line parameters
-my ($config_dir,$backup_mode,$account_num,$server,$working_dir, at tobackup) = @ARGV;
-
-# check backup mode is valid
-if($backup_mode ne 'lazy' && $backup_mode ne 'snapshot')
-{
-	error_print_usage("ERROR: backup mode must be 'lazy' or 'snapshot'");
-}
-
-# check server exists
-{
-	my @r = gethostbyname($server);
-	if($#r < 0)
-	{
-		error_print_usage("Backup server specified as '$server', but it could not found.\n(A test DNS lookup failed -- check arguments)");
-	}
-}
-
-if($working_dir !~ m~\A/~)
-{
-	error_print_usage("Working directory $working_dir is not specified as an absolute path");
-}
-
-# ssl stuff
-my $private_key = "$config_dir/bbackupd/$account_num-key.pem";
-my $certificate_request = "$config_dir/bbackupd/$account_num-csr.pem";
-my $certificate = "$config_dir/bbackupd/$account_num-cert.pem";
-my $ca_root_cert = "$config_dir/bbackupd/serverCA.pem";
-
-# encryption keys
-my $enc_key_file = "$config_dir/bbackupd/$account_num-FileEncKeys.raw";
-
-# other files
-my $config_file = "$config_dir/bbackupd.conf";
-my $notify_script = "$config_dir/bbackupd/NotifySysadmin.sh";
-
-# check that the directories are allowable
-for(@tobackup)
-{
-	if($_ eq '/')
-	{
-		die "It is not recommended that you backup the root directory of your disc";
-	}
-	if($_ !~ m/\A\//)
-	{
-		die "Directory $_ is not specified as an absolute path";
-	}
-	if(!-d $_)
-	{
-		die "$_ is not a directory";
-	}
-}
-
-# summarise configuration
-
-print <<__E;
-
-Setup bbackupd config utility.
-
-Configuration:
-   Writing configuration file: $config_file
-   Account: $account_num
-   Server hostname: $server
-   Directories to back up:
-__E
-print '      ',$_,"\n" for(@tobackup);
-print <<__E;
-
-Note: If other file systems are mounted inside these directories, then problems may occur
-with files on the store server being renamed incorrectly. This will cause efficiency
-problems, but not affect the integrity of the backups.
-
-WARNING: Directories not checked against mountpoints. Check mounted filesystems manually.
-
-__E
-
-# create directories
-if(!-d $config_dir)
-{
-	printf "Creating $config_dir...\n";
-	mkdir $config_dir,0755 or die "Can't create $config_dir";
-}
-
-if(!-d "$config_dir/bbackupd")
-{
-	printf "Creating $config_dir/bbackupd\n";
-	mkdir "$config_dir/bbackupd",0700 or die "Can't create $config_dir/bbackupd";
-}
-
-if(!-d "$working_dir")
-{
-	printf "Creating $working_dir\n";
-	if(!mkdir($working_dir,0700))
-	{
-		die "Couldn't create $working_dir -- create this manually and try again\n";
-	}
-}
-
-# generate the private key for the server
-if(!-f $private_key)
-{
-	print "Generating private key...\n";
-	if(system("openssl genrsa -out $private_key 2048") != 0)
-	{
-		die "Couldn't generate private key."
-	}
-}
-
-# generate a certificate request
-if(!-f $certificate_request)
-{
-	die "Couldn't run openssl for CSR generation" unless
-		open(CSR,"|openssl req -new -key $private_key -sha1 -out $certificate_request");
-	print CSR <<__E;
-.
-.
-.
-.
-.
-BACKUP-$account_num
-.
-.
-.
-
-__E
-	close CSR;
-	print "\n\n";
-	die "Certificate request wasn't created.\n" unless -f $certificate_request
-}
-
-# generate the key material for the file
-if(!-f $enc_key_file)
-{
-	print "Generating keys for file backup\n";
-	if(system("openssl rand -out $enc_key_file 1024") != 0)
-	{
-		die "Couldn't generate file backup keys."
-	}
-}
-
-# write the notify when store full script
-print "Writing notify script $notify_script\n";
-open NOTIFY,">$notify_script" or die "Can't open for writing";
-
-my $hostname = `hostname`; chomp $hostname;
-my $current_username = `whoami`; chomp $current_username;
-my $sendmail = `whereis sendmail`; chomp $sendmail;
-$sendmail =~ s/\n.\Z//s;
-# for Linux style whereis
-$sendmail = $1 if $sendmail =~ /^sendmail:\s+([\S]+)/;
-# last ditch guess
-$sendmail = 'sendmail' if $sendmail !~ m/\S/;
-
-print NOTIFY <<__EOS;
-#!/bin/sh
-
-SUBJECT="BACKUP PROBLEM on host $hostname"
-SENDTO="$current_username"
-
-if [ \$1 = store-full ]
-then
-$sendmail \$SENDTO <<EOM
-Subject: \$SUBJECT (store full)
-To: \$SENDTO
-
-
-The store account for $hostname is full.
-
-=============================
-FILES ARE NOT BEING BACKED UP
-=============================
-
-Please adjust the limits on account $account_num on server $server.
-
-EOM
-elif [ \$1 = read-error ]
-then
-$sendmail \$SENDTO <<EOM
-Subject: \$SUBJECT (read errors)
-To: \$SENDTO
-
-
-Errors occured reading some files or directories for backup on $hostname.
-
-===================================
-THESE FILES ARE NOT BEING BACKED UP
-===================================
-
-Check the logs on $hostname for the files and directories which caused
-these errors, and take appropraite action.
-
-Other files are being backed up.
-
-EOM
-else
-$sendmail \$SENDTO <<EOM
-Subject: \$SUBJECT (unknown)
-To: \$SENDTO
-
-
-The backup daemon on $hostname reported an unknown error.
-
-==========================
-FILES MAY NOT BE BACKED UP
-==========================
-
-Please check the logs on $hostname.
-
-EOM
-fi
-__EOS
-
-close NOTIFY;
-chmod 0700,$notify_script or die "Can't chmod $notify_script";
-
-
-# write the configuration file
-print "Writing configuration file $config_file\n";
-open CONFIG,">$config_file" or die "Can't open config file for writing";
-print CONFIG <<__E;
-
-StoreHostname = $server
-AccountNumber = 0x$account_num
-KeysFile = $enc_key_file
-
-CertificateFile = $certificate
-PrivateKeyFile = $private_key
-TrustedCAsFile = $ca_root_cert
-
-DataDirectory = $working_dir
-
-
-# This script is run whenever bbackupd encounters a problem which requires
-# the system administrator to assist:
-# 1) The store is full, and no more data can be uploaded.
-# 2) Some files or directories were not readable.
-# The default script emails the system administrator.
-
-NotifyScript = $notify_script
-
-__E
-
-if($backup_mode eq 'lazy')
-{
-	# lazy mode configuration
-	print CONFIG <<__E;
-
-# A scan of the local discs will be made once an hour (approximately).
-# To avoid cycles of load on the server, this time is randomly adjusted by a small
-# percentage as the daemon runs.
-
-UpdateStoreInterval = 3600
-
-
-# A file must have been modified at least 6 hours ago before it will be uploaded.
-
-MinimumFileAge = 21600
-
-
-# If a file is modified repeated, it won't be uploaded immediately in case it's modified again.
-# However, it should be uploaded eventually. This is how long we should wait after first noticing
-# a change. (1 day)
-
-MaxUploadWait = 86400
-
-__E
-}
-else
-{
-	# snapshot configuration
-	print CONFIG <<__E;
-
-# This configuration file is written for snapshot mode.
-# You will need to run bbackupctl to instruct the daemon to upload files.
-
-AutomaticBackup = no
-UpdateStoreInterval = 0
-MinimumFileAge = 0
-MaxUploadWait = 0
-
-__E
-}
-
-print CONFIG <<__E;
-
-# Files above this size (in bytes) are tracked, and if they are renamed they will simply be
-# renamed on the server, rather than being uploaded again. (64k - 1)
-
-FileTrackingSizeThreshold = 65535
-
-
-# The daemon does "changes only" uploads for files above this size (in bytes).
-# Files less than it are uploaded whole without this extra processing.
-
-DiffingUploadSizeThreshold = 8192
-
-
-# The limit on how much time is spent diffing files. Most files shouldn't take very long,
-# but if you have really big files you can use this to limit the time spent diffing them.
-# * Reduce if you are having problems with processor usage.
-# * Increase if you have large files, and think the upload of changes is too large and want
-#   to spend more time searching for unchanged blocks.
-
-MaximumDiffingTime = 20
-
-
-# Uncomment this line to see exactly what the daemon is going when it's connected to the server.
-
-# ExtendedLogging = yes
-
-
-# Use this to temporarily stop bbackupd from syncronising or connecting to the store.
-# This specifies a program or script script which is run just before each sync, and ideally
-# the full path to the interpreter. It will be run as the same user bbackupd is running as,
-# usually root.
-# The script prints either "now" or a number to STDOUT (and a terminating newline, no quotes).
-# If the result was "now", then the sync will happen. If it's a number, then the script will
-# be asked again in that number of seconds.
-# For example, you could use this on a laptop to only backup when on a specific network.
-
-# SyncAllowScript = /path/to/intepreter/or/exe script-name parameters etc
-
-
-# Where the command socket is created in the filesystem.
-
-CommandSocket = /var/run/bbackupd.sock
-
-
-Server
-{
-	PidFile = /var/run/bbackupd.pid
-}
-
-# 
-# BackupLocations specifies which locations on disc should be backed up. Each
-# directory is in the format
-# 
-# 	name
-# 	{
-# 		Path = /path/of/directory
-# 		(optional exclude directives)
-# 	}
-# 
-# 'name' is derived from the Path by the config script, but should merely be
-# unique.
-# 
-# The exclude directives are of the form
-# 
-# 	[Exclude|AlwaysInclude][File|Dir][|sRegex] = regex or full pathname
-# 
-# (The regex suffix is shown as 'sRegex' to make File or Dir plural)
-#
-# For example:
-# 
-# 	ExcludeDir = /home/guest-user
-# 	ExcludeFilesRegex = *.(mp3|MP3)\$
-# 	AlwaysIncludeFile = /home/username/veryimportant.mp3
-# 
-# This excludes the directory /home/guest-user from the backup along with all mp3
-# files, except one MP3 file in particular.
-# 
-# In general, Exclude excludes a file or directory, unless the directory is
-# explicitly mentioned in a AlwaysInclude directive.
-# 
-# If a directive ends in Regex, then it is a regular expression rather than a
-# explicit full pathname. See
-# 
-# 	man 7 re_format
-# 
-# for the regex syntax on your platform.
-# 
-
-BackupLocations
-{
-__E
-
-# write the dirs to backup
-for my $d (@tobackup)
-{
-	$d =~ m/\A.(.+)\Z/;
-	my $n = $1;
-	$n =~ tr`/`-`;
-	
-	my $excludekeys = '';
-	if(substr($enc_key_file, 0, length($d)+1) eq $d.'/')
-	{
-		$excludekeys = "\t\tExcludeFile = $enc_key_file\n";
-		print <<__E;
-
-NOTE: Keys file has been explicitly excluded from the backup.
-
-__E
-	}
-	
-	print CONFIG <<__E
-	$n
-	{
-		Path = $d
-$excludekeys	}
-__E
-}
-
-print CONFIG "}\n\n";
-close CONFIG;
-
-# explain to the user what they need to do next
-my $daemon_args = ($config_file eq $default_config_location)?'':" $config_file";
-my $ctl_daemon_args = ($config_file eq $default_config_location)?'':" -c $config_file";
-
-print <<__E;
-
-===================================================================
-
-bbackupd basic configuration complete.
-
-What you need to do now...
-
-1) Make a backup of $enc_key_file
-   This should be a secure offsite backup.
-   Without it, you cannot restore backups. Everything else can
-   be replaced. But this cannot.
-   KEEP IT IN A SAFE PLACE, OTHERWISE YOUR BACKUPS ARE USELESS.
-
-2) Send $certificate_request
-   to the administrator of the backup server, and ask for it to
-   be signed.
-
-3) The administrator will send you two files. Install them as
-      $certificate
-      $ca_root_cert
-   after checking their authenticity.
-
-4) You may wish to read the configuration file
-      $config_file
-   and adjust as appropraite.
-   
-   There are some notes in it on excluding files you do not
-   wish to be backed up.
-
-5) Review the script
-      $notify_script
-   and check that it will email the right person when the store
-   becomes full. This is important -- when the store is full, no
-   more files will be backed up. You want to know about this.
-
-6) Start the backup daemon with the command
-      /usr/local/bin/bbackupd$daemon_args
-   in /etc/rc.local, or your local equivalent.
-   Note that bbackupd must run as root.
-__E
-if($backup_mode eq 'snapshot')
-{
-	print <<__E;
-
-7) Set up a cron job to run whenever you want a snapshot of the
-   file system to be taken. Run the command
-      /usr/local/bin/bbackupctl -q$ctl_daemon_args sync
-__E
-}
-print <<__E;
-
-===================================================================
-
-Remember to make a secure, offsite backup of your backup keys,
-as described in step 1 above. If you do not, you have no backups.
-
-__E
-

Copied: box/chris/boxi/bin/bbackupd/bbackupd-config.in (from rev 547, box/trunk/bin/bbackupd/bbackupd-config.in)

Modified: box/chris/boxi/bin/bbackupd/bbackupd.cpp
===================================================================
--- box/chris/boxi/bin/bbackupd/bbackupd.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupd/bbackupd.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -48,13 +48,19 @@
 		InstallService();
 		return 0;
 	}
-		
+
+	bool runAsWin32Service = false;
+	if (argc == 2 && ::strcmp(argv[1], "--service") == 0)
+	{
+		runAsWin32Service = true;
+	}
+	
 	// Under win32 we must initialise the Winsock library
 	// before using sockets
 		
 	WSADATA info;
 
-	if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR) 
+	if (WSAStartup(0x0101, &info) == SOCKET_ERROR) 
 	{
 		// box backup will not run without sockets
 		::syslog(LOG_ERR, "Failed to initialise Windows Sockets");
@@ -65,7 +71,7 @@
 
 	int ExitCode = 0;
 
-	if (argc == 2 && ::strcmp(argv[1], "--service") == 0)
+	if (runAsWin32Service)
 	{
 		syslog(LOG_INFO,"Starting Box Backup Service");
 		OurService();


Property changes on: box/chris/boxi/bin/bbackupquery
___________________________________________________________________
Name: svn:ignore
   - autogen_Documentation.cpp
Makefile

   + autogen_Documentation.cpp
Makefile
makedocumentation.pl


Modified: box/chris/boxi/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/boxi/bin/bbackupquery/BackupQueries.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupquery/BackupQueries.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,16 +9,22 @@
 
 #include "Box.h"
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <string.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <dirent.h>
 
+#ifdef HAVE_DIRENT_H
+	#include <dirent.h>
+#endif
+
 #include <set>
 
 #include "BackupQueries.h"
@@ -246,8 +252,9 @@
 	case COMMAND_pwd:
 		{
 			// Simple implementation, so do it here
-			std::string dir(GetCurrentDirectoryName());
-			printf("%s (%08llx)\n", dir.c_str(), GetCurrentDirectoryID());
+			printf("%s (%08llx)\n", 
+				GetCurrentDirectoryName().c_str(), 
+				(long long)GetCurrentDirectoryID());
 		}
 		break;
 
@@ -325,11 +332,23 @@
 	// Got a directory in the arguments?
 	if(args.size() > 0)
 	{
+#ifdef WIN32
+		std::string storeDirEncoded;
+		if(!ConvertConsoleToUtf8(args[0].c_str(), storeDirEncoded))
+			return;
+#else
+		const std::string& storeDirEncoded(args[0]);
+#endif
+	
 		// Attempt to find the directory
-		rootDir = FindDirectoryObjectID(args[0], opts[LIST_OPTION_ALLOWOLD], opts[LIST_OPTION_ALLOWDELETED]);
+		rootDir = FindDirectoryObjectID(storeDirEncoded, 
+			opts[LIST_OPTION_ALLOWOLD], 
+			opts[LIST_OPTION_ALLOWDELETED]);
+
 		if(rootDir == 0)
 		{
-			printf("Directory %s not found on store\n", args[0].c_str());
+			printf("Directory '%s' not found on store\n",
+				args[0].c_str());
 			return;
 		}
 	}
@@ -396,19 +415,16 @@
 	{
 		// Display this entry
 		BackupStoreFilenameClear clear(en->GetName());
-		std::string line;
 		
 		// Object ID?
 		if(!opts[LIST_OPTION_NOOBJECTID])
 		{
 			// add object ID to line
-			char oid[32];
-#ifdef WIN32
-			sprintf(oid, "%08I64x ", en->GetObjectID());
+#ifdef _MSC_VER
+			printf("%08I64x ", (int64_t)en->GetObjectID());
 #else
-			sprintf(oid, "%08llx ", en->GetObjectID());
+			printf("%08llx ", (long long)en->GetObjectID());
 #endif
-			line += oid;
 		}
 		
 		// Flags?
@@ -435,58 +451,72 @@
 			// terminate
 			*(f++) = ' ';
 			*(f++) = '\0';
-			line += displayflags;
+			printf(displayflags);
+			
 			if(en_flags != 0)
 			{
-				line += "[ERROR: Entry has additional flags set] ";
+				printf("[ERROR: Entry has additional flags set] ");
 			}
 		}
 		
 		if(opts[LIST_OPTION_TIMES])
 		{
 			// Show times...
-			line += BoxTimeToISO8601String(en->GetModificationTime());
-			line += ' ';
+			std::string time = BoxTimeToISO8601String(
+				en->GetModificationTime());
+			printf("%s ", time.c_str());
 		}
 		
 		if(opts[LIST_OPTION_DISPLAY_HASH])
 		{
-			char hash[64];
-#ifdef WIN32
-			::sprintf(hash, "%016I64x ", en->GetAttributesHash());
+#ifdef _MSC_VER
+			printf("%016I64x ", (int64_t)en->GetAttributesHash());
 #else
-			::sprintf(hash, "%016llx ", en->GetAttributesHash());
+			printf("%016llx ", (long long)en->GetAttributesHash());
 #endif
-			line += hash;
 		}
 		
 		if(opts[LIST_OPTION_SIZEINBLOCKS])
 		{
-			char num[32];
-#ifdef WIN32
-			sprintf(num, "%05I64d ", en->GetSizeInBlocks());
+#ifdef _MSC_VER
+			printf("%05I64d ", (int64_t)en->GetSizeInBlocks());
 #else
-			sprintf(num, "%05lld ", en->GetSizeInBlocks());
+			printf("%05lld ", (long long)en->GetSizeInBlocks());
 #endif
-			line += num;
 		}
 		
 		// add name
 		if(!FirstLevel)
 		{
-			line += rListRoot;
-			line += '/';
+#ifdef WIN32
+			std::string listRootDecoded;
+			if(!ConvertUtf8ToConsole(rListRoot.c_str(), 
+				listRootDecoded)) return;
+			printf("%s/", listRootDecoded.c_str());
+#else
+			printf("%s/", rListRoot.c_str());
+#endif
 		}
-		line += clear.GetClearFilename().c_str();
 		
+#ifdef WIN32
+		{
+			std::string fileName;
+			if(!ConvertUtf8ToConsole(
+				clear.GetClearFilename().c_str(), fileName))
+				return;
+			printf("%s", fileName.c_str());
+		}
+#else
+		printf("%s", clear.GetClearFilename().c_str());
+#endif
+		
 		if(!en->GetName().IsEncrypted())
 		{
-			line += "[FILENAME NOT ENCRYPTED]";
+			printf("[FILENAME NOT ENCRYPTED]");
 		}
+
+		printf("\n");
 		
-		// print line
-		printf("%s\n", line.c_str());
-		
 		// Directory?
 		if((en->GetFlags() & BackupStoreDirectory::Entry::Flags_Dir) != 0)
 		{
@@ -518,7 +548,7 @@
 {
 	// Split up string into elements
 	std::vector<std::string> dirElements;
-	SplitString(rDirName, DIRECTORY_SEPARATOR_ASCHAR, dirElements);
+	SplitString(rDirName, '/', dirElements);
 
 	// Start from current stack, or root, whichever is required
 	std::vector<std::pair<std::string, int64_t> > stack;
@@ -652,7 +682,14 @@
 	for(unsigned int l = 0; l < mDirStack.size(); ++l)
 	{
 		r += "/";
+#ifdef WIN32
+		std::string dirName;
+		if(!ConvertUtf8ToConsole(mDirStack[l].first.c_str(), dirName))
+			return "error";
+		r += dirName;
+#else
 		r += mDirStack[l].first;
+#endif
 	}
 	
 	return r;
@@ -674,9 +711,17 @@
 		printf("Incorrect usage.\ncd [-o] [-d] <directory>\n");
 		return;
 	}
+
+#ifdef WIN32
+	std::string dirName;
+	if(!ConvertConsoleToUtf8(args[0].c_str(), dirName)) return;
+#else
+	const std::string& dirName(args[0]);
+#endif
 	
 	std::vector<std::pair<std::string, int64_t> > newStack;
-	int64_t id = FindDirectoryObjectID(args[0], opts['o'], opts['d'], &newStack);
+	int64_t id = FindDirectoryObjectID(dirName, opts['o'], opts['d'], 
+		&newStack);
 	
 	if(id == 0)
 	{
@@ -706,7 +751,14 @@
 	}
 	
 	// Try changing directory
-	if(::chdir(args[0].c_str()) != 0)
+#ifdef WIN32
+	std::string dirName;
+	if(!ConvertConsoleToUtf8(args[0].c_str(), dirName)) return;
+	int result = ::chdir(dirName.c_str());
+#else
+	int result = ::chdir(args[0].c_str());
+#endif
+	if(result != 0)
 	{
 		printf((errno == ENOENT || errno == ENOTDIR)?"Directory '%s' does not exist\n":"Error changing dir to '%s'\n",
 			args[0].c_str());
@@ -720,8 +772,13 @@
 		printf("Error getting current directory\n");
 		return;
 	}
-	
+
+#ifdef WIN32
+	if(!ConvertUtf8ToConsole(wd, dirName)) return;
+	printf("Local current directory is now '%s'\n", dirName.c_str());
+#else
 	printf("Local current directory is now '%s'\n", wd);
+#endif
 }
 
 
@@ -802,7 +859,9 @@
 	// Check args
 	if(args.size() < 1 || (opts['i'] && args.size() != 2) || args.size() > 2)
 	{
-		printf("Incorrect usage.\ngetobject <object-id> <local-filename>\n or get -i <object-id> <local-filename>\n");
+		printf("Incorrect usage.\n"
+			"get <remote-filename> [<local-filename>] or\n"
+			"get -i <object-id> <local-filename>\n");
 		return;
 	}
 
@@ -847,7 +906,14 @@
 		{				
 			// Specified by name, find the object in the directory to get the ID
 			BackupStoreDirectory::Iterator i(dir);
+#ifdef WIN32
+			std::string fileName;
+			if(!ConvertConsoleToUtf8(args[0].c_str(), fileName))
+				return;
+			BackupStoreFilenameClear fn(fileName);
+#else
 			BackupStoreFilenameClear fn(args[0]);
+#endif
 			BackupStoreDirectory::Entry *en = i.FindMatchingClearName(fn);
 			
 			if(en == 0)
@@ -889,7 +955,7 @@
 	}
 	catch(...)
 	{
-		::unlink(args[1].c_str());
+		::unlink(localName.c_str());
 		printf("Error occured fetching file.\n");
 	}
 }
@@ -983,7 +1049,7 @@
 		}
 		else
 		{
-			printf("Warning: couldn't determine the time of the last syncronisation -- checks not performed.\n");
+			printf("Warning: couldn't determine the time of the last synchronisation -- checks not performed.\n");
 		}
 	}
 
@@ -1070,7 +1136,7 @@
 		}
 				
 		// Then get it compared
-		Compare(std::string(DIRECTORY_SEPARATOR) + rLocation, 
+		Compare(std::string("/") + rLocation, 
 			loc.GetKeyValue("Path"), rParams);
 	}
 	catch(...)
@@ -1095,32 +1161,62 @@
 // --------------------------------------------------------------------------
 void BackupQueries::Compare(const std::string &rStoreDir, const std::string &rLocalDir, BackupQueries::CompareParams &rParams)
 {
+#ifdef WIN32
+	std::string storeDirEncoded;
+	if(!ConvertConsoleToUtf8(rStoreDir.c_str(), storeDirEncoded)) return;
+#else
+	const std::string& storeDirEncoded(rStoreDir);
+#endif
+	
 	// Get the directory ID of the directory -- only use current data
-	int64_t dirID = FindDirectoryObjectID(rStoreDir);
+	int64_t dirID = FindDirectoryObjectID(storeDirEncoded);
 	
 	// Found?
 	if(dirID == 0)
 	{
-		printf("Local directory '%s' exists, but server directory '%s' does not exist\n", rLocalDir.c_str(), rStoreDir.c_str());		
+		printf("Local directory '%s' exists, but "
+			"server directory '%s' does not exist\n", 
+			rLocalDir.c_str(), rStoreDir.c_str());		
 		rParams.mDifferences ++;
 		return;
 	}
+
+#ifdef WIN32
+	std::string localDirEncoded;
+	if(!ConvertConsoleToUtf8(rLocalDir.c_str(), localDirEncoded)) return;
+#else
+	std::string localDirEncoded(rLocalDir);
+#endif
 	
 	// Go!
-	Compare(dirID, rStoreDir, rLocalDir, rParams);
+	Compare(dirID, storeDirEncoded, localDirEncoded, rParams);
 }
 
 
 // --------------------------------------------------------------------------
 //
 // Function
-//		Name:    BackupQueries::Compare(int64_t, const std::string &, BackupQueries::CompareParams &)
+//		Name:    BackupQueries::Compare(int64_t, const std::string &,
+//			 const std::string &, BackupQueries::CompareParams &)
 //		Purpose: Compare a store directory against a local directory
 //		Created: 2003/10/13
 //
 // --------------------------------------------------------------------------
 void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, const std::string &rLocalDir, BackupQueries::CompareParams &rParams)
 {
+#ifdef WIN32
+	// By this point, rStoreDir and rLocalDir should be in UTF-8 encoding
+
+	std::string localName;
+	std::string storeName;
+
+	if(!ConvertUtf8ToConsole(rLocalDir.c_str(), localName)) return;
+	if(!ConvertUtf8ToConsole(rStoreDir.c_str(), storeName)) return;
+#else
+	const std::string& localName(rLocalDir);
+	const std::string& storeName(rStoreDir);
+#endif
+
 	// Get info on the local directory
 	struct stat st;
 	if(::lstat(rLocalDir.c_str(), &st) != 0)
@@ -1128,16 +1224,21 @@
 		// What kind of error?
 		if(errno == ENOTDIR)
 		{
-			printf("Local object '%s' is a file, server object '%s' is a directory\n", rLocalDir.c_str(), rStoreDir.c_str());
+			printf("Local object '%s' is a file, "
+				"server object '%s' is a directory\n", 
+				localName.c_str(), storeName.c_str());
 			rParams.mDifferences ++;
 		}
 		else if(errno == ENOENT)
 		{
-			printf("Local directory '%s' does not exist (compared to server directory '%s')\n", rLocalDir.c_str(), rStoreDir.c_str());
+			printf("Local directory '%s' does not exist "
+				"(compared to server directory '%s')\n",
+				localName.c_str(), storeName.c_str());
 		}
 		else
 		{
-			printf("ERROR: stat on local dir '%s'\n", rLocalDir.c_str());
+			printf("ERROR: stat on local dir '%s'\n", 
+				localName.c_str());
 		}
 		return;
 	}
@@ -1157,7 +1258,8 @@
 	// Test out the attributes
 	if(!dir.HasAttributes())
 	{
-		printf("Store directory '%s' doesn't have attributes.\n", rStoreDir.c_str());
+		printf("Store directory '%s' doesn't have attributes.\n", 
+			storeName.c_str());
 	}
 	else
 	{
@@ -1167,12 +1269,14 @@
 
 		// Get attributes of local directory
 		BackupClientFileAttributes localAttr;
-		localAttr.ReadAttributes(rLocalDir.c_str(), true /* directories have zero mod times */);
+		localAttr.ReadAttributes(rLocalDir.c_str(), 
+			true /* directories have zero mod times */);
 
 		if(!(attr.Compare(localAttr, true, true /* ignore modification times */)))
 		{
-			printf("Local directory '%s' has different attributes to store directory '%s'.\n",
-				rLocalDir.c_str(), rStoreDir.c_str());
+			printf("Local directory '%s' has different attributes "
+				"to store directory '%s'.\n",
+				localName.c_str(), storeName.c_str());
 			rParams.mDifferences ++;
 		}
 	}
@@ -1181,7 +1285,7 @@
 	DIR *dirhandle = ::opendir(rLocalDir.c_str());
 	if(dirhandle == 0)
 	{
-		printf("ERROR: opendir on local dir '%s'\n", rLocalDir.c_str());
+		printf("ERROR: opendir on local dir '%s'\n", localName.c_str());
 		return;
 	}
 	try
@@ -1238,7 +1342,8 @@
 		// Close directory
 		if(::closedir(dirhandle) != 0)
 		{
-			printf("ERROR: closedir on local dir '%s'\n", rLocalDir.c_str());
+			printf("ERROR: closedir on local dir '%s'\n", 
+				localName.c_str());
 		}
 		dirhandle = 0;
 	
@@ -1265,17 +1370,26 @@
 				storeDirs.insert(std::pair<std::string, BackupStoreDirectory::Entry *>(name.GetClearFilename(), storeDirEn));
 			}
 		}
+
+#ifdef _MSC_VER
+		typedef std::set<std::string>::iterator string_set_iter_t;
+#else
+		typedef std::set<std::string>::const_iterator string_set_iter_t;
+#endif
 		
 		// Now compare files.
 		for(std::set<std::pair<std::string, BackupStoreDirectory::Entry *> >::const_iterator i = storeFiles.begin(); i != storeFiles.end(); ++i)
 		{
 			// Does the file exist locally?
-			std::set<std::string>::const_iterator local(localFiles.find(i->first));
+			string_set_iter_t local(localFiles.find(i->first));
 			if(local == localFiles.end())
 			{
 				// Not found -- report
-				printf("Local file '%s/%s' does not exist, but store file '%s/%s' does.\n",
-					rLocalDir.c_str(), i->first.c_str(), rStoreDir.c_str(), i->first.c_str());
+				printf("Local file '%s" DIRECTORY_SEPARATOR 
+					"%s' does not exist, "
+					"but store file '%s/%s' does.\n",
+					localName.c_str(), i->first.c_str(), 
+					storeName.c_str(), i->first.c_str());
 				rParams.mDifferences ++;
 			}
 			else
@@ -1341,8 +1455,11 @@
 								true /* ignore attr mod time */,
 								fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */))
 						{
-							printf("Local file '%s/%s' has different attributes to store file '%s/%s'.\n",
-								rLocalDir.c_str(), i->first.c_str(), rStoreDir.c_str(), i->first.c_str());						
+							printf("Local file '%s"
+								DIRECTORY_SEPARATOR
+								"%s' has different attributes "
+								"to store file '%s/%s'.\n",
+								localName.c_str(), i->first.c_str(), storeName.c_str(), i->first.c_str());						
 							rParams.mDifferences ++;
 							if(modifiedAfterLastSync)
 							{
@@ -1406,8 +1523,11 @@
 					// Report if not equal.
 					if(!equal)
 					{
-						printf("Local file '%s/%s' has different contents to store file '%s/%s'.\n",
-							rLocalDir.c_str(), i->first.c_str(), rStoreDir.c_str(), i->first.c_str());
+						printf("Local file '%s"
+							DIRECTORY_SEPARATOR
+							"%s' has different contents "
+							"to store file '%s/%s'.\n",
+							localName.c_str(), i->first.c_str(), storeName.c_str(), i->first.c_str());
 						rParams.mDifferences ++;
 						if(modifiedAfterLastSync)
 						{
@@ -1425,11 +1545,12 @@
 					printf("ERROR: (%d/%d) during file fetch and comparsion for '%s/%s'\n",
 						e.GetType(),
 						e.GetSubType(),
-						rStoreDir.c_str(), i->first.c_str());
+						storeName.c_str(), 
+						i->first.c_str());
 				}
 				catch(...)
 				{
-					printf("ERROR: (unknown) during file fetch and comparsion for '%s/%s'\n", rStoreDir.c_str(), i->first.c_str());
+					printf("ERROR: (unknown) during file fetch and comparsion for '%s/%s'\n", storeName.c_str(), i->first.c_str());
 				}
 
 				// Remove from set so that we know it's been compared
@@ -1438,20 +1559,25 @@
 		}
 		
 		// Report any files which exist on the locally, but not on the store
-		for(std::set<std::string>::const_iterator i = localFiles.begin(); i != localFiles.end(); ++i)
+		for(string_set_iter_t i = localFiles.begin(); i != localFiles.end(); ++i)
 		{
-			std::string localName(rLocalDir + DIRECTORY_SEPARATOR + *i);
+			std::string localFileName(rLocalDir + 
+				DIRECTORY_SEPARATOR + *i);
 			// Should this be ignored (ie is excluded)?
-			if(rParams.mpExcludeFiles == 0 || !(rParams.mpExcludeFiles->IsExcluded(localName)))
+			if(rParams.mpExcludeFiles == 0 || 
+				!(rParams.mpExcludeFiles->IsExcluded(localFileName)))
 			{
-				printf("Local file '%s/%s' exists, but store file '%s/%s' does not exist.\n",
-					rLocalDir.c_str(), (*i).c_str(), rStoreDir.c_str(), (*i).c_str());
+				printf("Local file '%s" DIRECTORY_SEPARATOR
+					"%s' exists, but store file '%s/%s' "
+					"does not exist.\n",
+					localName.c_str(), (*i).c_str(), 
+					storeName.c_str(), (*i).c_str());
 				rParams.mDifferences ++;
 				
 				// Check the file modification time
 				{
 					struct stat st;
-					if(::stat(localName.c_str(), &st) == 0)
+					if(::stat(localFileName.c_str(), &st) == 0)
 					{
 						if(FileModificationTime(st) > rParams.mLatestFileUploadTime)
 						{
@@ -1475,12 +1601,16 @@
 		for(std::set<std::pair<std::string, BackupStoreDirectory::Entry *> >::const_iterator i = storeDirs.begin(); i != storeDirs.end(); ++i)
 		{
 			// Does the directory exist locally?
-			std::set<std::string>::const_iterator local(localDirs.find(i->first));
+			string_set_iter_t local(localDirs.find(i->first));
 			if(local == localDirs.end())
 			{
 				// Not found -- report
-				printf("Local directory '%s/%s' does not exist, but store directory '%s/%s' does.\n",
-					rLocalDir.c_str(), i->first.c_str(), rStoreDir.c_str(), i->first.c_str());
+				printf("Local directory '%s" 
+					DIRECTORY_SEPARATOR "%s' "
+					"does not exist, but store directory "
+					"'%s/%s' does.\n",
+					localName.c_str(), i->first.c_str(), 
+					storeName.c_str(), i->first.c_str());
 				rParams.mDifferences ++;
 			}
 			else
@@ -1500,8 +1630,10 @@
 			// Should this be ignored (ie is excluded)?
 			if(rParams.mpExcludeDirs == 0 || !(rParams.mpExcludeDirs->IsExcluded(localName)))
 			{
-				printf("Local directory '%s/%s' exists, but store directory '%s/%s' does not exist.\n",
-					rLocalDir.c_str(), (*i).c_str(), rStoreDir.c_str(), (*i).c_str());
+				printf("Local directory '%s/%s' exists, but "
+					"store directory '%s/%s' does not exist.\n",
+					localName.c_str(), (*i).c_str(), 
+					storeName.c_str(), (*i).c_str());
 				rParams.mDifferences ++;
 			}
 			else
@@ -1555,14 +1687,24 @@
 	}
 	else
 	{
+#ifdef WIN32
+		std::string storeDirEncoded;
+		if(!ConvertConsoleToUtf8(args[0].c_str(), storeDirEncoded))
+			return;
+#else
+		const std::string& storeDirEncoded(args[0]);
+#endif
+	
 		// Look up directory ID
-		dirID = FindDirectoryObjectID(args[0], false /* no old versions */, restoreDeleted /* find deleted dirs */);
+		dirID = FindDirectoryObjectID(storeDirEncoded, 
+			false /* no old versions */, 
+			restoreDeleted /* find deleted dirs */);
 	}
 	
 	// Allowable?
 	if(dirID == 0)
 	{
-		printf("Directory %s not found on server\n", args[0].c_str());
+		printf("Directory '%s' not found on server\n", args[0].c_str());
 		return;
 	}
 	if(dirID == BackupProtocolClientListDirectory::RootDirectory)
@@ -1571,9 +1713,18 @@
 		return;
 	}
 	
+#ifdef WIN32
+	std::string localName;
+	if(!ConvertConsoleToUtf8(args[1].c_str(), localName)) return;
+#else
+	std::string localName(args[1]);
+#endif
+
 	// Go and restore...
-	switch(BackupClientRestore(mrConnection, dirID, args[1].c_str(), true /* print progress dots */, restoreDeleted, 
-		false /* don't undelete after restore! */, opts['r'] /* resume? */))
+	switch(BackupClientRestore(mrConnection, dirID, localName.c_str(), 
+		true /* print progress dots */, restoreDeleted, 
+		false /* don't undelete after restore! */, 
+		opts['r'] /* resume? */))
 	{
 	case Restore_Complete:
 		printf("Restore complete\n");
@@ -1712,26 +1863,29 @@
 		return;
 	}
 
+#ifdef WIN32
+	std::string storeDirEncoded;
+	if(!ConvertConsoleToUtf8(args[0].c_str(), storeDirEncoded)) return;
+#else
+	const std::string& storeDirEncoded(args[0]);
+#endif
+	
 	// Get directory ID
-	int64_t dirID = FindDirectoryObjectID(args[0], false /* no old versions */, true /* find deleted dirs */);
+	int64_t dirID = FindDirectoryObjectID(storeDirEncoded, 
+		false /* no old versions */, true /* find deleted dirs */);
 	
 	// Allowable?
 	if(dirID == 0)
 	{
-		printf("Directory %s not found on server\n", args[0].c_str());
+		printf("Directory '%s' not found on server\n", args[0].c_str());
 		return;
 	}
 	if(dirID == BackupProtocolClientListDirectory::RootDirectory)
 	{
-		printf("Cannot restore the root directory -- restore locations individually.\n");
+		printf("Cannot undelete the root directory.\n");
 		return;
 	}
 
 	// Undelete
 	mrConnection.QueryUndeleteDirectory(dirID);
 }
-
-
-
-
-

Modified: box/chris/boxi/bin/bbackupquery/Makefile.extra
===================================================================
--- box/chris/boxi/bin/bbackupquery/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupquery/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,6 +1,6 @@
 
 # AUTOGEN SEEDING
 autogen_Documentation.cpp:	makedocumentation.pl documentation.txt
-	perl makedocumentation.pl
+	$(PERL) makedocumentation.pl
 
 

Modified: box/chris/boxi/bin/bbackupquery/bbackupquery.cpp
===================================================================
--- box/chris/boxi/bin/bbackupquery/bbackupquery.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupquery/bbackupquery.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,12 +9,16 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
 #include <stdio.h>
 #include <sys/types.h>
 #ifdef HAVE_LIBREADLINE
 	#ifdef HAVE_READLINE_READLINE_H
 		#include <readline/readline.h>
+	#elif defined(HAVE_EDITLINE_READLINE_H)
+		#include <editline/readline.h>
 	#elif defined(HAVE_READLINE_H)
 		#include <readline.h>
 	#endif
@@ -46,8 +50,13 @@
 
 void PrintUsageAndExit()
 {
-	printf("Usage: bbackupquery [-q] [-c config_file] [-l log_file] [commands]\nAs many commands as you require.\n"	\
-	"If commands are multiple words, remember to enclose the command in quotes.\n"	\
+	printf("Usage: bbackupquery [-q] [-w] "
+#ifdef WIN32
+	"[-u] "
+#endif
+	"\n\t[-c config_file] [-l log_file] [commands]\n"
+	"As many commands as you require.\n"
+	"If commands are multiple words, remember to enclose the command in quotes.\n"
 	"Remember to use quit command if you don't want to drop into interactive mode.\n");
 	exit(1);
 }
@@ -62,7 +71,7 @@
 	// Under Win32 we must initialise the Winsock library
 	// before using it.
 	
-	if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR) 
+	if (WSAStartup(0x0101, &info) == SOCKET_ERROR) 
 	{
 		// throw error?    perhaps give it its own id in the furture
 		THROW_EXCEPTION(BackupStoreException, Internal)
@@ -86,10 +95,17 @@
 	// Flags
 	bool quiet = false;
 	bool readWrite = false;
-	
+
+#ifdef WIN32
+	const char* validOpts = "qwuc:l:";
+	bool unicodeConsole = false;
+#else
+	const char* validOpts = "qwc:l:";
+#endif
+
 	// See if there's another entry on the command line
 	int c;
-	while((c = getopt(argc, (char * const *)argv, "qwc:l:")) != -1)
+	while((c = getopt(argc, (char * const *)argv, validOpts)) != -1)
 	{
 		switch(c)
 		{
@@ -116,6 +132,12 @@
 				printf("Can't open log file '%s'\n", optarg);
 			}
 			break;
+
+#ifdef WIN32
+		case 'u':
+			unicodeConsole = true;
+			break;
+#endif
 		
 		case '?':
 		default:
@@ -133,6 +155,30 @@
 		printf(banner);
 	}
 
+#ifdef WIN32
+	if (unicodeConsole)
+	{
+		if (!SetConsoleCP(CP_UTF8))
+		{
+			fprintf(stderr, "Failed to set input codepage: "
+				"error %d\n", GetLastError());
+		}
+
+		if (!SetConsoleOutputCP(CP_UTF8))
+		{
+			fprintf(stderr, "Failed to set output codepage: "
+				"error %d\n", GetLastError());
+		}
+
+		// enable input of Unicode characters
+		if (_setmode(_fileno(stdin), _O_TEXT) == -1)
+		{
+			perror("Failed to set the console input to "
+				"binary mode");
+		}
+	}
+#endif // WIN32
+
 	// Read in the configuration file
 	if(!quiet) printf("Using configuration file %s\n", configFilename);
 	std::string errs;

Deleted: box/chris/boxi/bin/bbackupquery/makedocumentation.pl
===================================================================
--- box/chris/boxi/bin/bbackupquery/makedocumentation.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbackupquery/makedocumentation.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,75 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-print "Creating built-in documentation for bbackupquery...\n";
-
-open DOC,"documentation.txt" or die "Can't open documentation.txt file";
-my $section;
-my %help;
-my @in_order;
-
-while(<DOC>)
-{
-	if(m/\A>\s+(\w+)/)
-	{
-		$section = $1;
-		m/\A>\s+(.+)\Z/;
-		$help{$section} = $1."\n";
-		push @in_order,$section;
-	}
-	elsif(m/\A</)
-	{
-		$section = '';
-	}
-	elsif($section ne '')
-	{
-		$help{$section} .= $_;
-	}
-}
-
-close DOC;
-
-open OUT,">autogen_Documentation.cpp" or die "Can't open output file for writing";
-
-print OUT <<__E;
-//
-// Automatically generated file, do not edit.
-//
-
-#include "Box.h"
-
-#include "MemLeakFindOn.h"
-
-char *help_commands[] =
-{
-__E
-
-for(@in_order)
-{
-	print OUT qq:\t"$_",\n:;
-}
-
-print OUT <<__E;
-	0
-};
-
-char *help_text[] =
-{
-__E
-
-for(@in_order)
-{
-	my $t = $help{$_};
-	$t =~ s/\t/    /g;
-	$t =~ s/\n/\\n/g;
-	$t =~ s/"/\\"/g;
-	print OUT qq:\t"$t",\n:;	
-}
-
-print OUT <<__E;
-	0
-};
-
-__E
-
-close OUT;

Copied: box/chris/boxi/bin/bbackupquery/makedocumentation.pl.in (from rev 547, box/trunk/bin/bbackupquery/makedocumentation.pl.in)


Property changes on: box/chris/boxi/bin/bbstored
___________________________________________________________________
Name: svn:ignore
   - autogen_BackupProtocolServer.cpp
autogen_BackupProtocolServer.h
Makefile

   + autogen_BackupProtocolServer.cpp
autogen_BackupProtocolServer.h
Makefile
bbstored-certs
bbstored-config


Modified: box/chris/boxi/bin/bbstored/BackupCommands.cpp
===================================================================
--- box/chris/boxi/bin/bbstored/BackupCommands.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbstored/BackupCommands.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -876,3 +876,20 @@
 	));
 }
 
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    BackupProtocolServerGetIsAlive::DoCommand(BackupProtocolServer &, BackupContext &)
+//		Purpose: Return the amount of disc space used
+//		Created: 19/4/04
+//
+// --------------------------------------------------------------------------
+std::auto_ptr<ProtocolObject> BackupProtocolServerGetIsAlive::DoCommand(BackupProtocolServer &rProtocol, BackupContext &rContext)
+{
+	CHECK_PHASE(Phase_Commands)
+
+	//
+	// NOOP
+	//
+	return std::auto_ptr<ProtocolObject>(new BackupProtocolServerIsAlive());
+}

Modified: box/chris/boxi/bin/bbstored/BackupStoreDaemon.cpp
===================================================================
--- box/chris/boxi/bin/bbstored/BackupStoreDaemon.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbstored/BackupStoreDaemon.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -278,7 +278,25 @@
 	BackupProtocolServer server(rStream);
 	server.SetLogToSysLog(mExtendedLogging);
 	server.SetTimeout(BACKUP_STORE_TIMEOUT);
-	server.DoServer(context);
+	try
+	{
+		server.DoServer(context);
+	}
+	catch(...)
+	{
+		LogConnectionStats(clientCommonName.c_str(), rStream);
+		throw;
+	}
+	LogConnectionStats(clientCommonName.c_str(), rStream);
 	context.CleanUp();
 }
 
+void BackupStoreDaemon::LogConnectionStats(const char *commonName,
+		const SocketStreamTLS &s)
+{
+	// Log the amount of data transferred
+	::syslog(LOG_INFO, "Connection statistics for %s: "
+			"IN=%lld OUT=%lld TOTAL=%lld\n", commonName,
+			s.GetBytesRead(), s.GetBytesWritten(),
+			s.GetBytesRead() + s.GetBytesWritten());
+}

Modified: box/chris/boxi/bin/bbstored/BackupStoreDaemon.h
===================================================================
--- box/chris/boxi/bin/bbstored/BackupStoreDaemon.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbstored/BackupStoreDaemon.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -61,6 +61,8 @@
 	void HousekeepingProcess();
 	bool CheckForInterProcessMsg(int AccountNum = 0, int MaximumWaitTime = 0);
 
+	void LogConnectionStats(const char *commonName, const SocketStreamTLS &s);
+
 private:
 	BackupStoreAccountDatabase *mpAccountDatabase;
 	BackupStoreAccounts *mpAccounts;

Modified: box/chris/boxi/bin/bbstored/Makefile.extra
===================================================================
--- box/chris/boxi/bin/bbstored/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbstored/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -5,5 +5,5 @@
 
 # AUTOGEN SEEDING
 autogen_BackupProtocolServer.cpp autogen_BackupProtocolServer.h:	$(MAKEPROTOCOL) backupprotocol.txt
-	perl $(GEN_CMD_SRV)
+	$(PERL) $(GEN_CMD_SRV)
 

Modified: box/chris/boxi/bin/bbstored/backupprotocol.txt
===================================================================
--- box/chris/boxi/bin/bbstored/backupprotocol.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbstored/backupprotocol.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -3,7 +3,7 @@
 #
 
 Name 				Backup
-IdentString			Box-Backup:v=B
+IdentString			Box-Backup:v=C
 ServerContextClass	BackupContext	BackupContext.h
 
 ClientType		Filename	BackupStoreFilenameClear	BackupStoreFilenameClear.h
@@ -220,3 +220,10 @@
 	int64	BlocksSoftLimit
 	int64	BlocksHardLimit
 	int32	BlockSize
+
+GetIsAlive	42	Command(IsAlive)
+	# no data members
+
+IsAlive	43	Reply
+	# no data members
+

Deleted: box/chris/boxi/bin/bbstored/bbstored-certs
===================================================================
--- box/chris/boxi/bin/bbstored/bbstored-certs	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbstored/bbstored-certs	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,319 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-# validity period for root certificates -- default is a very long time
-my $root_sign_period = '10000';
-
-# but less so for client certificates
-my $sign_period = '5000';
-
-# check and get command line parameters
-if($#ARGV < 1)
-{
-	print <<__E;
-
-bbstored certificates utility.
-
-Bad command line parameters.
-Usage:
-	bbstored-certs certs-dir command [arguments]
-
-certs-dir is the directory holding the root keys and certificates for the backup system
-command is the action to perform, taking parameters.
-
-Commands are
-
-	init
-		-- generate initial root certificates (certs-dir must not already exist)
-	sign certificate-name
-		-- sign a client certificate
-	sign-server certificate-name
-		-- sign a server certificate
-
-Signing requires confirmation that the certificate is correct and should be signed.
-
-__E
-	exit(1);
-}
-
-# check for OPENSSL_CONF environment var being set
-if(exists $ENV{'OPENSSL_CONF'})
-{
-	print <<__E;
-
----------------------------------------
-
-WARNING:
-    You have the OPENSSL_CONF environment variable set.
-    Use of non-standard openssl configs may cause problems.
-
----------------------------------------
-
-__E
-}
-
-# directory structure:
-#
-# roots/
-#	clientCA.pem -- root certificate for client (used on server)
-#	serverCA.pem -- root certificate for servers (used on clients)
-# keys/
-#   clientRootKey.pem -- root key for clients
-#   serverRootKey.pem -- root key for servers
-# servers/
-#   hostname.pem -- certificate for server 'hostname'
-# clients/
-#   account.pem -- certficiate for account 'account' (ID in hex)
-#
-
-
-# check parameters
-my ($cert_dir,$command, at args) = @ARGV;
-
-# check directory exists
-if($command ne 'init')
-{
-	if(!-d $cert_dir)
-	{
-		die "$cert_dir does not exist";
-	}
-}
-
-# run command
-if($command eq 'init') {&cmd_init;}
-elsif($command eq 'sign') {&cmd_sign;}
-elsif($command eq 'sign-server') {&cmd_sign_server;}
-else
-{
-	die "Unknown command $command"
-}
-
-sub cmd_init
-{
-	# create directories
-	unless(mkdir($cert_dir,0700)
-		&& mkdir($cert_dir.'/roots',0700)
-		&& mkdir($cert_dir.'/keys',0700)
-		&& mkdir($cert_dir.'/servers',0700)
-		&& mkdir($cert_dir.'/clients',0700))
-	{
-		die "Failed to create directory structure"
-	}
-
-	# create root keys and certrs
-	cmd_init_create_root('client');
-	cmd_init_create_root('server');
-}
-
-sub cmd_init_create_root
-{
-	my $entity = $_[0];
-
-	my $cert = "$cert_dir/roots/".$entity.'CA.pem';
-	my $serial = "$cert_dir/roots/".$entity.'CA.srl';
-	my $key = "$cert_dir/keys/".$entity.'RootKey.pem';
-	my $csr = "$cert_dir/keys/".$entity.'RootCSR.pem';
-
-	# generate key
-	if(system("openssl genrsa -out $key 2048") != 0)
-	{
-		die "Couldn't generate private key."
-	}
-	
-	# make CSR
-	die "Couldn't run openssl for CSR generation" unless
-		open(CSR,"|openssl req -new -key $key -sha1 -out $csr");
-	print CSR <<__E;
-.
-.
-.
-.
-.
-Backup system $entity root
-.
-.
-.
-
-__E
-	close CSR;
-	print "\n\n";
-	die "Certificate request wasn't created.\n" unless -f $csr;
-	
-	# sign it to make a self-signed root CA key
-	if(system("openssl x509 -req -in $csr -sha1 -extensions v3_ca -signkey $key -out $cert -days $root_sign_period") != 0)
-	{
-		die "Couldn't generate root certificate."
-	}
-	
-	# write the initial serial number
-	open SERIAL,">$serial" or die "Can't open $serial for writing";
-	print SERIAL "00\n";
-	close SERIAL;
-}
-
-sub cmd_sign
-{
-	my $csr = $args[0];
-	
-	if(!-f $csr)
-	{
-		die "$csr does not exist";
-	}
-	
-	# get the common name specified in this certificate
-	my $common_name = get_csr_common_name($csr);
-	
-	# look OK?
-	unless($common_name =~ m/\ABACKUP-([A-Fa-f0-9]+)\Z/)
-	{
-		die "The certificate presented does not appear to be a backup client certificate"
-	}
-	
-	my $acc = $1;
-	
-	# check against filename
-	if(!($csr =~ m/(\A|\/)([A-Fa-f0-9]+)-/) || $2 ne $acc)
-	{
-		die "Certificate request filename does not match name in certificate ($common_name)"
-	}
-		
-	print <<__E;
-
-This certificate is for backup account
-
-   $acc
-
-Ensure this matches the account number you are expecting. The filename is
-
-   $csr
-
-which should include this account number, and additionally, you should check
-that you received it from the right person.
-
-Signing the wrong certificate compromises the security of your backup system.
-
-Would you like to sign this certificate? (type 'yes' to confirm)
-__E
-
-	return unless get_confirmation();
-
-	# out certificate
-	my $out_cert = "$cert_dir/clients/$acc"."-cert.pem";
-
-	# sign it!
-	if(system("openssl x509 -req -in $csr -sha1 -extensions usr_crt -CA $cert_dir/roots/clientCA.pem -CAkey $cert_dir/keys/clientRootKey.pem -out $out_cert -days $sign_period") != 0)
-	{
-		die "Signing failed"
-	}
-	
-	# tell user what to do next
-	print <<__E;
-
-
-Certificate signed.
-
-Send the files
-
-   $out_cert
-   $cert_dir/roots/serverCA.pem
-
-to the client.
-
-__E
-}
-
-sub cmd_sign_server
-{
-	my $csr = $args[0];
-	
-	if(!-f $csr)
-	{
-		die "$csr does not exist";
-	}
-	
-	# get the common name specified in this certificate
-	my $common_name = get_csr_common_name($csr);
-	
-	# look OK?
-	if($common_name !~ m/\A[-a-zA-Z0-9.]+\Z/)
-	{
-		die "Invalid server name"
-	}
-	
-	print <<__E;
-
-This certificate is for backup server
-
-   $common_name
-
-Signing the wrong certificate compromises the security of your backup system.
-
-Would you like to sign this certificate? (type 'yes' to confirm)
-__E
-
-	return unless get_confirmation();
-
-	# out certificate
-	my $out_cert = "$cert_dir/servers/$common_name"."-cert.pem";
-
-	# sign it!
-	if(system("openssl x509 -req -in $csr -sha1 -extensions usr_crt -CA $cert_dir/roots/serverCA.pem -CAkey $cert_dir/keys/serverRootKey.pem -out $out_cert -days $sign_period") != 0)
-	{
-		die "Signing failed"
-	}
-	
-	# tell user what to do next
-	print <<__E;
-
-
-Certificate signed.
-
-Install the files
-
-   $out_cert
-   $cert_dir/roots/clientCA.pem
-
-on the server.
-
-__E
-}
-
-
-sub get_csr_common_name
-{
-	my $csr = $_[0];
-	
-	open CSRTEXT,"openssl req -text -in $csr |" or die "Can't open openssl for reading";
-	
-	my $subject;
-	while(<CSRTEXT>)
-	{
-		$subject = $1 if m/Subject:.+?CN=([-\.\w]+)/
-	}	
-	close CSRTEXT;
-
-	if($subject eq '')
-	{
-		die "No subject found in CSR $csr"
-	}
-	
-	return $subject
-}
-
-sub get_confirmation()
-{
-	my $line = <STDIN>;
-	chomp $line;
-	if(lc $line ne 'yes')
-	{
-		print "CANCELLED\n";
-		return 0;
-	}
-	
-	return 1;
-}
-
-
-
-
-

Copied: box/chris/boxi/bin/bbstored/bbstored-certs.in (from rev 547, box/trunk/bin/bbstored/bbstored-certs.in)

Deleted: box/chris/boxi/bin/bbstored/bbstored-config
===================================================================
--- box/chris/boxi/bin/bbstored/bbstored-config	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/bin/bbstored/bbstored-config	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,242 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-# should be running as root
-if($> != 0)
-{
-	printf "\nWARNING: this should be run as root\n\n"
-}
-
-# check and get command line parameters
-if($#ARGV < 2)
-{
-	print <<__E;
-
-Setup bbstored config utility.
-
-Bad command line parameters.
-Usage:
-	bbstored-config config-dir server-hostname username [raidfile-config]
-
-config-dir usually /etc/box
-server-hostname is the hostname used by clients to connect to this server
-username is the user to run the server under
-raidfile-config is optional. Use if you have a non-standard raidfile.conf file.
-
-__E
-	exit(1);
-}
-
-# check for OPENSSL_CONF environment var being set
-if(exists $ENV{'OPENSSL_CONF'})
-{
-	print <<__E;
-
----------------------------------------
-
-WARNING:
-    You have the OPENSSL_CONF environment variable set.
-    Use of non-standard openssl configs may cause problems.
-
----------------------------------------
-
-__E
-}
-
-# default locations
-my $default_config_location = '/etc/box/bbstored.conf';
-
-# command line parameters
-my ($config_dir,$server,$username,$raidfile_config) = @ARGV;
-
-$raidfile_config = $config_dir . '/raidfile.conf' unless $raidfile_config ne '';
-
-# check server exists, but don't bother checking that it's actually this machine.
-{
-	my @r = gethostbyname($server);
-	if($#r < 0)
-	{
-		die "Server '$server' not found. (check server name, test DNS lookup failed.)"
-	}
-}
-
-# check this exists
-if(!-f $raidfile_config)
-{
-	print "The RaidFile configuration file $raidfile_config doesn't exist.\nYou may need to create it with raidfile-config.\nWon't configure bbstored without it.\n";
-	exit(1);
-}
-
-# check that the user exists
-die "You shouldn't run bbstored as root" if $username eq 'root';
-my $user_uid = 0;
-(undef,undef,$user_uid) = getpwnam($username);
-if($user_uid == 0)
-{
-	die "User $username doesn't exist\n";
-}
-
-# check that directories are writeable
-open RAIDCONF,$raidfile_config or die "Can't open $raidfile_config";
-{
-	my %done = ();
-	while(<RAIDCONF>)
-	{
-		next unless m/Dir\d\s*=\s*(.+)/;
-		my $d = $1;
-		$d = $d.'/backup' if -e $d.'/backup';
-		print "Checking permissions on $d\n";
-		my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($d);
-		my $req_perms = ($uid == $user_uid)?0700:0007;
-		if(($mode & $req_perms) != $req_perms)
-		{
-			print "$username doesn't appear to have the necessary permissions on $d\n";
-			print "Either adjust permissions, or create a directory 'backup' inside the\n";
-			print "directory specified in raidfile.conf which is writable.\n";
-			exit(1);
-		}
-	}
-}
-close RAIDCONF;
-
-# ssl stuff
-my $private_key = "$config_dir/bbstored/$server-key.pem";
-my $certificate_request = "$config_dir/bbstored/$server-csr.pem";
-my $certificate = "$config_dir/bbstored/$server-cert.pem";
-my $ca_root_cert = "$config_dir/bbstored/clientCA.pem";
-
-# other files
-my $config_file = "$config_dir/bbstored.conf";
-my $accounts_file = "$config_dir/bbstored/accounts.txt";
-
-# summarise configuration
-
-print <<__E;
-
-Setup bbstored config utility.
-
-Configuration:
-   Writing configuration file: $config_file
-   Writing empty accounts file: $accounts_file
-   Server hostname: $server
-   RaidFile config: $raidfile_config
-
-__E
-
-# create directories
-if(!-d $config_dir)
-{
-	print "Creating $config_dir...\n";
-	mkdir $config_dir,0755 or die "Can't create $config_dir";
-}
-
-if(!-d "$config_dir/bbstored")
-{
-	print "Creating $config_dir/bbstored\n";
-	mkdir "$config_dir/bbstored",0755 or die "Can't create $config_dir/bbstored";
-}
-
-# create blank accounts file
-if(!-f $accounts_file)
-{
-	print "Creating blank accounts file\n";
-	open ACC,">$accounts_file";
-	close ACC;
-}
-
-# generate the private key for the server
-if(!-f $private_key)
-{
-	print "Generating private key...\n";
-	if(system("openssl genrsa -out $private_key 2048") != 0)
-	{
-		die "Couldn't generate private key."
-	}
-}
-
-# generate a certificate request
-if(!-f $certificate_request)
-{
-	die "Couldn't run openssl for CSR generation" unless
-		open(CSR,"|openssl req -new -key $private_key -sha1 -out $certificate_request");
-	print CSR <<__E;
-.
-.
-.
-.
-.
-$server
-.
-.
-.
-
-__E
-	close CSR;
-	print "\n\n";
-	die "Certificate request wasn't created.\n" unless -f $certificate_request
-}
-
-# write the configuration file
-print "Writing configuration file $config_file\n";
-open CONFIG,">$config_file" or die "Can't open config file for writing";
-print CONFIG <<__E;
-
-RaidFileConf = $raidfile_config
-AccountDatabase = $accounts_file
-
-# Uncomment this line to see exactly what commands are being received from clients.
-# ExtendedLogging = yes
-
-# scan all accounts for files which need deleting every 15 minutes.
-
-TimeBetweenHousekeeping = 900
-
-Server
-{
-	PidFile = /var/run/bbstored.pid
-	User = $username
-	ListenAddresses = inet:$server
-	CertificateFile = $certificate
-	PrivateKeyFile = $private_key
-	TrustedCAsFile = $ca_root_cert
-}
-
-
-__E
-
-close CONFIG;
-
-# explain to the user what they need to do next
-my $daemon_args = ($config_file eq $default_config_location)?'':" $config_file";
-
-print <<__E;
-
-===================================================================
-
-bbstored basic configuration complete.
-
-What you need to do now...
-
-1) Sign $certificate_request
-   using the bbstored-certs utility.
-
-2) Install the server certificate and root CA certificate as
-      $certificate
-      $ca_root_cert
-
-3) You may wish to read the configuration file
-      $config_file
-   and adjust as appropraite.
-
-4) Create accounts with bbstoreaccounts
-
-5) Start the backup store daemon with the command
-      /usr/local/bin/bbstored$daemon_args
-   in /etc/rc.local, or your local equivalent.
-
-===================================================================
-
-__E
-
-
-

Copied: box/chris/boxi/bin/bbstored/bbstored-config.in (from rev 547, box/trunk/bin/bbstored/bbstored-config.in)

Deleted: box/chris/boxi/boxbackup.sln
===================================================================
--- box/chris/boxi/boxbackup.sln	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/boxbackup.sln	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,67 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boxquery", "boxquery.vcproj", "{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}"
-	ProjectSection(ProjectDependencies) = postProject
-		{98598F62-FEA7-4134-AA29-0AD2315A214F} = {98598F62-FEA7-4134-AA29-0AD2315A214F}
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common.vcproj", "{A089CEE6-EBF0-4232-A0C0-74850A8127A6}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bbackupd", "bbackupd.vcproj", "{22D325FB-9131-4BD6-B390-968F0491D687}"
-	ProjectSection(ProjectDependencies) = postProject
-		{98598F62-FEA7-4134-AA29-0AD2315A214F} = {98598F62-FEA7-4134-AA29-0AD2315A214F}
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32test", "win32test.vcproj", "{28C29E72-76A2-4D0C-B35B-12D446733D2E}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bbackupctl", "bbackupctl.vcproj", "{9FD51412-E945-4457-A17A-CA3C505CF431}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_regex", "lib\win32\boost_regex.vcproj", "{98598F62-FEA7-4134-AA29-0AD2315A214F}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Global
-	GlobalSection(SolutionConfiguration) = preSolution
-		Debug = Debug
-		Release = Release
-	EndGlobalSection
-	GlobalSection(ProjectConfiguration) = postSolution
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Debug.ActiveCfg = Debug|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Debug.Build.0 = Debug|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Release.ActiveCfg = Release|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Release.Build.0 = Release|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Debug.ActiveCfg = Debug|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Debug.Build.0 = Debug|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Release.ActiveCfg = Release|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Release.Build.0 = Release|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Debug.ActiveCfg = Debug|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Debug.Build.0 = Debug|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Release.ActiveCfg = Release|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Release.Build.0 = Release|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Debug.ActiveCfg = Debug|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Debug.Build.0 = Debug|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Release.ActiveCfg = Release|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Release.Build.0 = Release|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Debug.ActiveCfg = Debug|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Debug.Build.0 = Debug|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Release.ActiveCfg = Release|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Release.Build.0 = Release|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Debug.ActiveCfg = Debug|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Debug.Build.0 = Debug|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Release.ActiveCfg = Release|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Release.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-	EndGlobalSection
-	GlobalSection(ExtensibilityAddIns) = postSolution
-	EndGlobalSection
-EndGlobal

Deleted: box/chris/boxi/boxbackup.suo
===================================================================
(Binary files differ)

Deleted: box/chris/boxi/boxquery.vcproj
===================================================================
--- box/chris/boxi/boxquery.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/boxquery.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,171 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="boxquery"
-	ProjectGUID="{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}"
-	RootNamespace="boxquery"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\";"$(SolutionDir)..\boost_1_31_0""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)Debug\common.lib $(ProjectDir)lib\win32\Debug\boost_regex.lib"
-				OutputFile="$(OutDir)/bbackupquery.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/boxquery.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\";"$(SolutionDir)..\boost_1_31_0""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)Release\common.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)lib\win32\Release\boost_regex.lib"
-				OutputFile="$(OutDir)/bbackupquery.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="FALSE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="backupquery"
-					Filter="">
-					<File
-						RelativePath=".\bin\bbackupquery\autogen_Documentation.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupquery\BackupQueries.cpp">
-					</File>
-					<File
-						RelativePath=".\bin\bbackupquery\bbackupquery.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="backupquery"
-					Filter="">
-					<File
-						RelativePath=".\bin\bbackupquery\BackupQueries.h">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Deleted: box/chris/boxi/common.vcproj
===================================================================
--- box/chris/boxi/common.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/common.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,638 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="common"
-	ProjectGUID="{A089CEE6-EBF0-4232-A0C0-74850A8127A6}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="4"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\";"$(SolutionDir)..\boost_1_31_0\""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/common.lib"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="4"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\";"$(SolutionDir)..\boost_1_31_0\""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;NDEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/common.lib"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="lib"
-				Filter="">
-				<Filter
-					Name="compress"
-					Filter="">
-					<File
-						RelativePath=".\lib\compress\autogen_CompressException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\compress\CompressStream.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="common"
-					Filter="">
-					<File
-						RelativePath=".\lib\common\autogen_CommonException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\autogen_ConversionException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxTime.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxTimeToText.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\CollectInBufferStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\Configuration.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\ConversionString.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\DebugAssertFailed.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\DebugMemLeakFinder.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\DebugPrintf.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\EventWatchFilesystemObject.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\ExcludeList.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\FdGetLine.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\FileStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\IOStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\IOStreamGetLine.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\LinuxWorkaround.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\MemBlockStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\PartialReadStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\ReadGatherStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\StreamableMemBlock.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\UnixUser.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\Utils.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\common\WaitForEvent.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="backupclient"
-					Filter="">
-					<File
-						RelativePath=".\lib\backupclient\autogen_BackupProtocolClient.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\autogen_BackupStoreException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientCryptoKeys.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientFileAttributes.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientMakeExcludeList.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientRestore.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupDaemonConfigVerify.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreDirectory.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFile.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileCmbDiff.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileCmbIdx.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileCombine.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileCryptVar.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileDiff.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileEncodeStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFilename.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFilenameClear.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileRevDiff.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreObjectDump.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="crypto"
-					Filter="">
-					<File
-						RelativePath=".\lib\crypto\autogen_CipherException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherAES.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherBlowfish.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherContext.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherDescription.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\MD5Digest.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\Random.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\RollingChecksum.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="win32"
-					Filter="">
-					<File
-						RelativePath=".\lib\win32\emu.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="server"
-					Filter="">
-					<File
-						RelativePath=".\lib\server\autogen_ConnectionException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\autogen_ServerException.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\Daemon.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\LocalProcessStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\Protocol.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\ProtocolObject.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\ProtocolUncertainStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\Socket.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\SocketStream.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\SocketStreamTLS.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\SSLLib.cpp">
-					</File>
-					<File
-						RelativePath=".\lib\server\TLSContext.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<Filter
-				Name="lib"
-				Filter="">
-				<Filter
-					Name="compress"
-					Filter="">
-					<File
-						RelativePath=".\lib\compress\autogen_CompressException.h">
-					</File>
-					<File
-						RelativePath=".\lib\compress\Compress.h">
-					</File>
-					<File
-						RelativePath=".\lib\compress\CompressException.h">
-					</File>
-					<File
-						RelativePath=".\lib\compress\CompressStream.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="common"
-					Filter="">
-					<File
-						RelativePath=".\lib\common\autogen_CommonException.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\autogen_ConversionException.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BannerText.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BeginStructPackForWire.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\Box.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxException.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxPlatform.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxPortsAndFiles.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxTime.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxTimeToText.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\BoxTimeToUnix.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\CollectInBufferStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\CommonException.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\Configuration.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\Conversion.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\EndStructPackForWire.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\EventWatchFilesystemObject.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\ExcludeList.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\FdGetLine.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\FileModificationTime.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\FileStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\Guards.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\IOStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\IOStreamGetLine.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\LinuxWorkaround.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\LocalProcessStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\MainHelper.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\MemBlockStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\MemLeakFinder.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\MemLeakFindOff.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\MemLeakFindOn.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\NamedLock.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\PartialReadStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\ReadGatherStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\StreamableMemBlock.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\TemporaryDirectory.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\Test.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\UnixUser.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\Utils.h">
-					</File>
-					<File
-						RelativePath=".\lib\common\WaitForEvent.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="backupclient"
-					Filter="">
-					<File
-						RelativePath=".\lib\backupclient\autogen_BackupProtocolClient.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\autogen_BackupStoreException.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientCryptoKeys.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientFileAttributes.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientMakeExcludeList.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupClientRestore.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupDaemonConfigVerify.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreConstants.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreDirectory.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreException.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFile.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileCryptVar.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileEncodeStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFilename.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFilenameClear.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreFileWire.h">
-					</File>
-					<File
-						RelativePath=".\lib\backupclient\BackupStoreObjectMagic.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="crypto"
-					Filter="">
-					<File
-						RelativePath=".\lib\crypto\autogen_CipherException.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherAES.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherBlowfish.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherContext.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherDescription.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\CipherException.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\MD5Digest.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\Random.h">
-					</File>
-					<File
-						RelativePath=".\lib\crypto\RollingChecksum.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="win32"
-					Filter="">
-					<File
-						RelativePath=".\lib\win32\emu.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="server"
-					Filter="">
-					<File
-						RelativePath=".\lib\server\autogen_ConnectionException.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\autogen_ServerException.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\Daemon.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\Protocol.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\ProtocolObject.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\ProtocolUncertainStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\ProtocolWire.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\ServerException.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\ServerStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\ServerTLS.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\Socket.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\SocketListen.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\SocketStream.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\SocketStreamTLS.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\SSLLib.h">
-					</File>
-					<File
-						RelativePath=".\lib\server\TLSContext.h">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Modified: box/chris/boxi/configure.ac
===================================================================
--- box/chris/boxi/configure.ac	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/configure.ac	2006-03-25 09:11:46 UTC (rev 548)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([Box Backup], 0.09, [box at fluffy.co.uk])
+AC_INIT([Box Backup], 0.10, [box at fluffy.co.uk])
 AC_CONFIG_SRCDIR([lib/common/Box.h])
 AC_CONFIG_HEADERS([lib/common/BoxConfig.h])
 
@@ -26,6 +26,12 @@
   # Use -rdynamic if we have gcc. This is needed for backtrace
   AC_SUBST([LDADD_RDYNAMIC], ['-rdynamic'])
 fi
+AC_PATH_PROG([PERL], [perl], [no])
+if test "x$PERL" != "xno"; then
+  AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["$PERL"], [Location of the perl executable])
+else
+  AC_MSG_ERROR([[perl executable was not found]])
+fi
 
 
 ### Checks for libraries.
@@ -35,9 +41,7 @@
                  [AC_MSG_ERROR([[cannot find a short sleep function (nanosleep)]])])
 fi
 AC_CHECK_LIB([z], [zlibVersion],, [AC_MSG_ERROR([[cannot find zlib]])])
-VL_LIB_READLINE
-have_libreadline=no
-test "x$vl_cv_lib_readline" != "xno" && have_libreadline=yes
+VL_LIB_READLINE([have_libreadline=yes], [have_libreadline=no])
 
 ## Check for Berkely DB. Restrict to certain versions
 AX_PATH_BDB(, [
@@ -54,6 +58,8 @@
 ])
 
 ## Check for Open SSL, use old versions only if explicitly requested
+AC_SEARCH_LIBS([gethostbyname], [nsl socket resolv])
+AC_SEARCH_LIBS([shutdown], [nsl socket resolv])
 AX_CHECK_SSL(, [AC_MSG_ERROR([[OpenSSL is not installed but is required]])])
 AC_ARG_ENABLE(
   [old-ssl],
@@ -73,12 +79,22 @@
 
 ### Checks for header files.
 
-AC_HEADER_DIRENT
+if test "$target_os" != "mingw32"; then
+  AC_HEADER_DIRENT
+fi
+
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([execinfo.h netinet/in.h regex.h sys/types.h sys/xattr.h])
+AC_CHECK_HEADERS([execinfo.h process.h pwd.h regex.h signal.h])
+AC_CHECK_HEADERS([syslog.h time.h])
+AC_CHECK_HEADERS([netinet/in.h])
+AC_CHECK_HEADERS([sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h])
+AC_CHECK_HEADERS([sys/xattr.h])
 AC_CHECK_HEADERS([sys/endian.h asm/byteorder.h])
 
+if test "$ac_cv_header_regex_h" = "yes"; then
+  AC_SEARCH_LIBS([regcomp], [pcreposix])
+fi
 
 ### Checks for typedefs, structures, and compiler characteristics.
 
@@ -107,6 +123,9 @@
 AC_SYS_LARGEFILE
 AX_CHECK_LLONG_MINMAX
 AX_CHECK_DEFINE_PRAGMA
+if test "x$ac_cv_c_bigendian" != "xyes"; then
+  AX_BSWAP64
+fi
 if test "$target_os" != "mingw32"; then
   AX_RANDOM_DEVICE
 fi
@@ -124,25 +143,29 @@
 AC_FUNC_ERROR_AT_LINE
 AC_TYPE_SIGNAL
 AC_FUNC_STAT
-AC_CHECK_FUNCS([getpeereid kqueue lchown setproctitle])
+AC_CHECK_FUNCS([getpeereid lchown setproctitle getpid])
+# NetBSD implements kqueue too differently for us to get it fixed by 0.10
+# TODO: Remove this when NetBSD kqueue implementation is working
+netbsd_hack=`echo $target_os | sed 's/netbsd.*/netbsd/'`
+if test "$netbsd_hack" != "netbsd"; then
+  AC_CHECK_FUNCS([kqueue])
+fi
 AX_FUNC_SYSCALL
 AX_CHECK_SYSCALL_LSEEK
+AC_CHECK_FUNCS([listxattr llistxattr getxattr lgetxattr setxattr lsetxattr])
+AC_CHECK_DECLS([XATTR_NOFOLLOW],,, [[#include <sys/xattr.h>]])
 
 
 ### Miscellaneous complicated feature checks
 
 ## Check for large file support active. AC_SYS_LARGEFILE has already worked
-## out how to enable it if necessary, we need to know if we've got it so we
-## can disable the raidfile intercepts
+## out how to enable it if necessary, we just use this to report to the user
 AC_CACHE_CHECK([if we have large file support enabled], [have_large_file_support],
   [AC_RUN_IFELSE([AC_LANG_PROGRAM([[$ac_includes_default]], [[
       return sizeof(off_t)==4;
     ]])],
     [have_large_file_support=yes], [have_large_file_support=no]
   )])
-if test "x$have_large_file_support" = "xyes"; then
-  AC_DEFINE([HAVE_LARGE_FILE_SUPPORT], 1, [Define to 1 large file support is in use])
-fi
 
 ## Find out how to do file locking
 AC_CHECK_FUNCS([flock])
@@ -173,15 +196,42 @@
   LIBS="-Wl,-Bstatic $LIBS -Wl,-Bdynamic"
 fi
 
+## Kludge to allow makeparcels.pl to use bindir. This is not a good long term
+## solution because it prevents use of "make exec_prefix=/some/dir"
+saved_prefix=$prefix
+saved_exec_prefix=$exec_prefix
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+bindir_expanded=`eval "echo $bindir"`
+bindir_expanded=`eval "echo $bindir_expanded"`
+prefix=$saved_prefix
+exec_prefix=$saved_exec_prefix
+AC_SUBST([bindir_expanded])
 
+
 ### Output files
 AC_CONFIG_FILES([infrastructure/BoxPlatform.pm])
+AX_CONFIG_SCRIPTS([bin/bbackupd/bbackupd-config
+                   bin/bbackupquery/makedocumentation.pl
+                   bin/bbstored/bbstored-certs
+                   bin/bbstored/bbstored-config
+                   infrastructure/makebuildenv.pl
+                   infrastructure/makeparcels.pl
+                   lib/common/makeexception.pl
+                   lib/raidfile/raidfile-config
+                   lib/server/makeprotocol.pl
+                   runtest.pl
+                   test/backupstorefix/testfiles/testbackupstorefix.pl
+                   test/bbackupd/testfiles/extcheck1.pl
+                   test/bbackupd/testfiles/extcheck2.pl
+                   test/bbackupd/testfiles/notifyscript.pl])
+# TODO: Need to do contrib/cygwin/install-cygwin-service.pl but location varies
 AC_OUTPUT
 
 # Configure the Box build system
 echo
-perl ./infrastructure/makebuildenv.pl &&
-  perl ./infrastructure/makeparcels.pl
+$PERL ./infrastructure/makebuildenv.pl &&
+  $PERL ./infrastructure/makeparcels.pl
 
 # Write summary of important info
 cat <<EOC
@@ -212,7 +262,7 @@
   *readline*)
     echo
     AC_MSG_WARN([[do not distribute binaries compiled against GNU readline,
-as this would violate the GNU readline licence, which is GPL. You may use
+as this could violate the GNU readline licence, which is GPL. You may use
 libedit or libeditline instead.]])
     ;;
 esac

Modified: box/chris/boxi/distribution/COMMON-MANIFEST.txt
===================================================================
--- box/chris/boxi/distribution/COMMON-MANIFEST.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/COMMON-MANIFEST.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,3 +1,4 @@
+RUN ./bootstrap
 lib/common
 lib/crypto
 lib/server
@@ -2,2 +3,3 @@
 lib/compress
+lib/win32
 test/common
@@ -8,6 +10,7 @@
 test/basicserver/testfiles
 test/crypto
 test/compress
+test/win32
 docs/common notes
 docs/common/lib_common notes/lib_common
 docs/common/lib_crypto notes/lib_crypto
@@ -27,3 +30,4 @@
 runtest.pl
 NO-LICENSE-IN-DIR infrastructure/m4
 infrastructure/m4
+configure

Modified: box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt
===================================================================
--- box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/boxbackup/DISTRIBUTION-MANIFEST.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -34,3 +34,8 @@
 distribution/boxbackup/contrib/suse contrib/suse
 NO-LICENSE-IN-DIR contrib/cygwin
 distribution/boxbackup/contrib/cygwin contrib/cygwin
+infrastructure/msvc
+NO-LICENSE-IN-DIR infrastructure/msvc/2003
+infrastructure/msvc/2003
+NO-LICENSE-IN-DIR infrastructure/msvc/2005
+infrastructure/msvc/2005
\ No newline at end of file

Modified: box/chris/boxi/distribution/boxbackup/LICENSE.txt
===================================================================
--- box/chris/boxi/distribution/boxbackup/LICENSE.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/boxbackup/LICENSE.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,6 +1,6 @@
  
-Copyright (c) 2003, 2005
-     Ben Summers.  All rights reserved.
+Copyright (c) 2003 - 2006
+     Ben Summers and contributors.  All rights reserved.
  
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
@@ -11,7 +11,7 @@
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
 3. All use of this software and associated advertising materials must 
-   display the following acknowledgement:
+   display the following acknowledgment:
        This product includes software developed by Ben Summers.
 4. The names of the Authors may not be used to endorse or promote
    products derived from this software without specific prior written

Modified: box/chris/boxi/distribution/boxbackup/LINUX.txt
===================================================================
--- box/chris/boxi/distribution/boxbackup/LINUX.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/boxbackup/LINUX.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -11,12 +11,14 @@
 Require zlib and openssl headers for compilation -- may not be included when
 installing the packages. (libssl-dev + libz-dev packages under debian)
 
-Bekerley DB v1 support is required. The configure script should find an
+Bekerley DB v1 or v4 support is required. The configure script should find an
 appropriate db package -- and if not, use an in-memory version of the code.
 However, the in-memory version is not desirable as it will lose information
 over restarts of the daemon.
 
-Ideally, include the readline headers -- libreadline4-dev, probably.
+Ideally, use libeditline as a readline replacement. If not available then use
+GNU readline (libreadline4-dev, probably) and pass --enable-gnu-readline to
+./configure.
 
 
 

Modified: box/chris/boxi/distribution/boxbackup/THANKS.txt
===================================================================
--- box/chris/boxi/distribution/boxbackup/THANKS.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/boxbackup/THANKS.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,6 +1,34 @@
 
+The following developers contributed code to version 0.10:
+
+Nick Knight
+  - ported Box Backup to Windows (properly, not using Cygwin)
+ 
+Gary Niemcewicz
+  - added client/server (SSL) keepalives to keep the connection to the
+    server alive during a long diff, and saving the daemon's state across restarts
+
+Martin Ebourne
+  - ported to Solaris; wrote extended attribute support (xattr);
+    converted to use autoconf for automatic compiler configuration.
+
+Chris Wilson
+  - updated Nick's and Gary's work to fit in with the new trunk,
+    fixed some issues pointed out by Ben and Martin, made it compile
+    on Windows with the free MinGW compiler.
+
+Jonathan Morton
+  - vastly improved the performance and efficiency of the file-diffing code, and
+    obtained a free G5 PowerMac from IBM as his reward.
+
+
+----
+
 Many individuals have helped with the development of Box Backup by testing, reporting experiences, and making suggestions. In particular, thanks are due to
 
+Charles Lecklider
+  - Helped with the finer details of Win32 programming
+
 Pascal Lalonde
   - Comprehensive and accurate bug reports, and constructive feedback
 
@@ -17,6 +45,7 @@
 
 Per Thomsen
   - Cygwin Windows service install scripts and build notes
+  - Answering queries on the boxbackup mailing list
 
 Tim Fletcher
 David Harris
@@ -35,3 +64,6 @@
 John Pybus
   - Ideas and feature requests
   - Useful little patches to code
+
+Stefan Norlin
+  - Help with testing and fixes on lots of different Solaris platforms

Modified: box/chris/boxi/distribution/boxbackup/VERSION.txt
===================================================================
--- box/chris/boxi/distribution/boxbackup/VERSION.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/boxbackup/VERSION.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,2 +1,2 @@
-0.09_trunk
+0.09_boxi
 boxbackup

Deleted: box/chris/boxi/distribution/boxbackup/contrib/cygwin/install-cygwin-service.pl
===================================================================
--- box/chris/boxi/distribution/boxbackup/contrib/cygwin/install-cygwin-service.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/boxbackup/contrib/cygwin/install-cygwin-service.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,112 +0,0 @@
-#!/usr/bin/perl -w
-
-
-# Contributed to the boxbackup project by Per Reedtz Thomsen. pthomsen at reedtz.com
-
-# This script reads the config file for boxbackup, and changes the mode
-# of the directory named by 'DataDirectory' and any files there. Also,
-# the files pointed to by the 'CommandSocket' and 'PidFile' configuration
-# parameters will be chmod'ed to be read-write by all.
-# The Windows services are created and started using the 'cygrunsrv' utility.
-
-# Date      Who                      Comments
-# 20041005  pthomsen at reedtz.com      Created 
-# 20041020  pthomsen at reedtz.com	     Switched to using Getopt::Std for cmd-line things.
-
-use strict;
-
-use Getopt::Std;
-getopt('ce');
-our ($opt_c, $opt_e);
-# Figure out the config file to use. Default is /etc/box/bbackupd.conf
-my $confFile = (defined($opt_c) ? $opt_c :  "/etc/box/bbackupd.conf");
-# Figure out the bbaackupd executable to use. Default is /usr/local/bin/bbackupd.exe
-my $exeFile = (defined($opt_e) ? $opt_e :  "/usr/local/bin/bbackupd.exe");
-
-die "File $confFile does not exist. Please provide the full path to the bbackupd configuration file.\n" if !(-f $confFile);
-die "Can't read $confFile. Permission denied. Please chmod the file so I can read it.\n" if !(-r $confFile);
-die "File $exeFile does not exist. Please provide the full path to the bbackupd.exe file.\n" if !(-f $exeFile);
-die "File $exeFile is not executable. Please provide the full path to the correct bbackupd.exe file.\n" if !(-x $exeFile);
-
-# print "Config: $confFile\n";
-
-my $dataDir;
-my $cmdSocket;
-my $pidFile;
-
-open (CONFIG, "<$confFile") or die "Can't open $confFile: $!\n";
-
-# Read the confgiguration file, and pull the DataDirectory, CommandSocket, and PidFile parameters.
-while (<CONFIG>)
-{
-    
-    if (/^\s*DataDirectory\s*=\s*([^\n\s]+)\s*\n/)
-    {
-	$dataDir = $1;
-	next;
-    }
-
-    if (/^\s*CommandSocket\s*=\s*([^\n\s]+)\s*\n/)
-    {
-	$cmdSocket = $1;
-	next;
-    }
-    if (/^\s*PidFile\s*=\s*([^\n\s]+)\s*\n/)
-    {
-	$pidFile = $1;
-	next;
-    }
-}
-
-# check that we got all the parameters from the file. If not, die.
-if ((!defined($dataDir)) || (!defined($cmdSocket)) || (!defined($pidFile)))
-{
-    die "Could not read config parameters from $confFile. Values retrieved:\n\tDataDirectory = $dataDir\n\tCommandSocket = $cmdSocket\n\tPidFile = $pidFile\n";
-}
-
-
-print  "Parameters retrieved from $confFile. Values:\n\tDataDirectory = $dataDir\n\tCommandSocket = $cmdSocket\n\tPidFile = $pidFile\n";
-print "chmod...";
-# change the mode of the files/dirs retrieved.
-chmod(0777, $dataDir) or die "Can't chmod $dataDir: $!\n";
-chmod(0666, "$dataDir/*") or die "Can't chmod $dataDir/*: $!\n";
-chmod(0666, $pidFile) or die "Can't chmod $pidFile: $!\n";
-chmod(0755, $cmdSocket) or die "Can't chmod $cmdSocket: $!\n";
-print " Done.\n";
-
-# Now install the service using cygrunsrv.
-# Details: 
-#   -I <svc_name>      Install a service. svc_name is the name under which the
-#                      service will appear in the Windows Service Manager
-#   -p <path_to_exe>   Path to the executable.
-#   -a <options>       Command line options to the executable.
-#   -f <description>   Description of the service.
-#   -o                 Attempt clean exit of service during system shutdown
-
-print "Installing boxbackup service...";
-my $sysCmd = "cygrunsrv.exe -I boxbackup -p " . $exeFile;
-$sysCmd .= " -a \"" . $confFile . " SINGLEPROCESS\"";
-$sysCmd .= " -o -f \"Online Backup System by Ben Summers\"";
-print "$sysCmd\n";
-my $output = qx($sysCmd);
-die "cygrunsrv failed to install service. Error Message: $output\n" if($output ne "");
-print " Done.\n";
-
-
-# Start the service
-# Details:
-#   -S <svc_name>     Start a service. svc_name is the name of the (installed)
-#                     service to start.
-
-print "Starting boxbackup service...";
-$sysCmd = "cygrunsrv.exe -S boxbackup";
-print "$sysCmd\n";
-$output = qx($sysCmd);
-die "cygrunsrv failed to start service. Error Message: $output\n" if($output ne "");
-print " Done.\n";
-
-print "\n\nService Installation complete. To test, reboot your machine, and make sure that\n";
-print "the boxbackup service is running. A good way to make sure, is to check that the account number\n";
-print "from this machine is connecting to the bbstored server. Check the bbstored logs for more info.\n\n";
-
-

Copied: box/chris/boxi/distribution/boxbackup/contrib/cygwin/install-cygwin-service.pl.in (from rev 547, box/trunk/distribution/boxbackup/contrib/cygwin/install-cygwin-service.pl.in)

Modified: box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec
===================================================================
--- box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/distribution/boxbackup/contrib/rpm/boxbackup.spec	2006-03-25 09:11:46 UTC (rev 548)
@@ -104,7 +104,7 @@
 %if %{is_suse}
 ln -s ../../%{init_dir}/bbackupd $RPM_BUILD_ROOT%{_sbindir}/rcbbackupd
 %endif
-%define client_dir parcels/%{ident}-backup-client-Linux
+%define client_dir parcels/%{ident}-backup-client-linux-gnu
 install %{client_dir}/bbackupd $RPM_BUILD_ROOT%{_sbindir}
 install %{client_dir}/bbackupquery $RPM_BUILD_ROOT%{_sbindir}
 install %{client_dir}/bbackupctl $RPM_BUILD_ROOT%{_sbindir}
@@ -117,7 +117,7 @@
 %if %{is_suse}
 ln -s ../../%{init_dir}/bbstored $RPM_BUILD_ROOT%{_sbindir}/rcbbstored
 %endif
-%define server_dir parcels/%{ident}-backup-server-Linux
+%define server_dir parcels/%{ident}-backup-server-linux-gnu
 install %{server_dir}/bbstored $RPM_BUILD_ROOT%{_sbindir}
 install %{server_dir}/bbstoreaccounts $RPM_BUILD_ROOT%{_sbindir}
 install %{server_dir}/bbstored-certs $RPM_BUILD_ROOT%{_bindir}

Modified: box/chris/boxi/docs/backup/win32_build_on_cygwin_using_mingw.txt
===================================================================
--- box/chris/boxi/docs/backup/win32_build_on_cygwin_using_mingw.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/docs/backup/win32_build_on_cygwin_using_mingw.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -22,6 +22,23 @@
 	make
 	make install
 
+Download PCRE from 
+[http://prdownloads.sourceforge.net/pcre/pcre-6.3.tar.bz2?download]
+
+Open a Cygwin shell, and unpack PCRE:
+
+	tar xjvf pcre-6.3.tar.bz2
+
+Configure PCRE for MinGW compilation, and build and install it:
+	
+	cd pcre-6.3
+	export CFLAGS="-mno-cygwin"
+	./configure
+	make winshared
+	cp .libs/pcreposix.dll /bin
+	cp .libs/pcreposix.dll.a /usr/i686-pc-mingw32/lib
+	cp pcreposix.h /usr/i686-pc-mingw32/include/regex.h
+
 Now unpack the Box Backup sources, enter the source directory,
 and configure like this:
 

Copied: box/chris/boxi/documentation (from rev 547, box/trunk/documentation)

Copied: box/chris/boxi/documentation/boxbackup (from rev 547, box/trunk/documentation/boxbackup)

Deleted: box/chris/boxi/documentation/boxbackup/adminguide.xml
===================================================================
--- box/trunk/documentation/boxbackup/adminguide.xml	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/documentation/boxbackup/adminguide.xml	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,1230 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
-<book>
-  <title>Box Backup administrator's guide</title>
-
-  <preface>
-    <title>License</title>
-
-    <para>Copyright (c) <YEAR>, <OWNER></para>
-
-    <para>All rights reserved.</para>
-
-    <para>Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are
-    met:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para>Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.</para>
-      </listitem>
-
-      <listitem>
-        <para>Redistributions in binary form must reproduce the above
-        copyright notice, this list of conditions and the following disclaimer
-        in the documentation and/or other materials provided with the
-        distribution.</para>
-      </listitem>
-
-      <listitem>
-        <para>Neither the name of the <ORGANIZATION> nor the names of
-        its contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission</para>
-      </listitem>
-    </itemizedlist>
-
-    <para>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</para>
-  </preface>
-
-  <chapter>
-    <title>Configuration</title>
-
-    <section>
-      <title>System configuration</title>
-
-      <section>
-        <title>Server</title>
-
-        <para>After you've downloaded and compiled the programs you need to
-        install the programs on your server. As root do the following:</para>
-
-        <programlisting>make install-backup-server</programlisting>
-
-        <para>This assumes that you are installing on the same server that you
-        compiled the software on. If not, copy the
-        boxbackup-x.xx-backup-server-OSNAME.tgz file to the server you want to
-        run on, and install there. For example (on Mac OS X):</para>
-
-        <programlisting>tar zxvf boxbackup-0.10-server-darwin8.5.0.tgz
-cd boxbackup-0.10-server-darwin8.5.0
-./install-backup-server</programlisting>
-
-        <para>Then create the user for the backup daemon on the server:</para>
-
-        <programlisting>useradd _bbstored</programlisting>
-
-        <para>BoxBackup supports Raid for the backup store. There are some
-        configuration options. Use the following command if you want to create
-        a simple server WITHOUT Raid protection:</para>
-
-        <programlisting>mkdir /tmp/boxbackupRepository                        # Create the directory
-chown _bbstored /tmp/boxbackupRepository/             # Change the owner to the new boxbackup daemon user
-
-/usr/local/bin/raidfile-config /etc/box/  1024 /tmp/boxbackupRepository
-
-#substitute 1024 with the desired blocksize
-#substitute /tmp/boxbackupRepository with a directory that exists where you want the backup store located
-#/usr/local/bin/raidfile-config --help shows you the options</programlisting>
-
-        <para>Then create the configuration file /etc/box/bbstored.conf The
-        hostname is tricky as it is used for two things: The name of the
-        server in the certificate and the address the server is listening on.
-        Since you might be using NAT, might move the server around or the
-        domain name might change, choose a name that describes the server.
-        When the network address of the server changes, you need to update the
-        ListenAddresses directive in the /etc/box/bbstored.conf file.</para>
-
-        <programlisting>/usr/local/bin/bbstored-config /etc/box hostname _bbstored</programlisting>
-
-        <para>This last step outputs 5 instructions that you must execute to
-        the letter. A lot of questions are raised on the mailing list because
-        these steps have not been followed properly.</para>
-
-        <para>TODO: Expand on this. Explain the 5 steps in detail.</para>
-
-        <para>If you want to run the system as a non-root user, look <link
-        linkend="WORoot">here</link>.</para>
-      </section>
-
-      <section>
-        <title>Certificate Management</title>
-
-        <para>There are two steps involved to create an account. You need to
-        create the account on the server, and sign a certificate to give the
-        client permission to connect to the server.</para>
-
-        <para>Running a Certification Authority for TLS (SSL) connections is
-        not trivial. However, a script to does most of the work in a way which
-        should be good enough for most deployments.</para>
-
-        <para><emphasis role="bold">Important Note:</emphasis> The certificate
-        authority directory is intended to be stored on another server. It
-        should not be kept on the backup server to limit the impact of a
-        server compromise. The instructions and the script assume that it will
-        be kept elsewhere, so will ask you to copy files to and from the CA.
-        </para>
-
-        <para><emphasis role="bold">Clock time warning</emphasis>: SSL
-        certificates contain validity dates, including a "valid from" time. If
-        the clock on the machine which signs the certificates is not
-        syncronised to the clocks of the machines using these certificates,
-        you will probably get strange errors until the start time is reached
-        on all machines. If you get strange errors when attempting to use new
-        certificates, check the clocks! You will probably just need to wait a
-        while until the certificates become valid, rather than having to
-        regenerate them. </para>
-
-        <section>
-          <title>Set up a CA</title>
-
-          <para>It's best to do this on a machine other than your server,
-          probably without direct network access. The contents of this
-          directory control who can access your backup store server.</para>
-
-          <para>To setup the basic key structure, do the following:</para>
-
-          <programlisting>/usr/local/bin/bbstored-certs ca init</programlisting>
-
-          <para>(See <link linkend="instguide.sgml">OpenSSL notes</link> if
-          you get an OpenSSL error)</para>
-
-          <para>This creates the directory 'ca' in the current directory, and
-          initialises it with basic keys. </para>
-        </section>
-
-        <section>
-          <title>Sign a server certificate</title>
-
-          <para>When you use the bbstored-config script to set up a config
-          file for a server, it will generate a certificate request (CSR) for
-          you. Transfer it to the machine with your CA, then do:</para>
-
-          <programlisting>/usr/local/bin/bbstored-certs ca sign-server hostname-csr.pem</programlisting>
-
-          <para>This signs the certificate for the server. Follow the
-          instructions in the output on which files to install on the server.
-          The CSR file is now no longer needed. Make sure you run this command
-          from the directory above the directory 'ca'. </para>
-
-          <para>TODO: Explain instructions in output.</para>
-        </section>
-
-        <section>
-          <title>Set up an account</title>
-
-          <para>Choose an account number for the user. This must be unique on
-          the server, and is presented as a 31 bit number in hex greater than
-          0, for example, 1 or 75AB23C. Then on the backup store server,
-          create the account with:</para>
-
-          <programlisting>/usr/local/bin/bbstoreaccounts create 75AB23C 0 4096M 4505M</programlisting>
-
-          <para>This looks complicated. The numbers are, in order:</para>
-
-          <itemizedlist>
-            <listitem>
-              <para>The account number allocated (hex)</para>
-            </listitem>
-
-            <listitem>
-              <para>The RAID disc set (0 if you use raidfile-config and don't
-              add a new set)</para>
-            </listitem>
-
-            <listitem>
-              <para>Soft limit (size)</para>
-            </listitem>
-
-            <listitem>
-              <para>Hard limit (size)</para>
-            </listitem>
-          </itemizedlist>
-
-          <para>The sizes are are specified in Mb, Gb, or blocks, depending on
-          the suffix. 1M specifies 1 Mb, 1G specifies 1 Gb, and 1B specifies 1
-          block, the size of which depends on how you have configured the
-          raidfile system with raidfile-config.</para>
-
-          <para>In this example, I have allocated 4Gb (assuming you use 2048
-          byte blocks as per my example) as the soft limit, and 4Gb + 10% as
-          the hard limit.</para>
-
-          <para>NOTE The sizes specified here are pre-RAID. So if you are
-          using userland RAID, you are actually allocating two-thirds of this
-          amount. This means that, when you take compression into account,
-          that if you allocate 2Gb on the server, it'll probably hold about
-          2Gb of backed up files (depending on the compressability of those
-          files).</para>
-
-          <para>The backup client will (voluntarily) try not to upload more
-          data than is allowed by the soft limit. The store server will refuse
-          to accept a file if it would take it over the hard limit, and when
-          doing housekeeping for this account, try and delete old versions and
-          deleted files to reduce the space taken to below the soft
-          limit.</para>
-
-          <para>This command will create some files on disc in the raid file
-          directories (if you run as root, the utility will change to the user
-          specified in the bbstored.conf file to write them) and update the
-          accounts file. A server restart is not required.</para>
-
-          <para>NOTE If you get a message saying 'Exception: RaidFile (2/8)',
-          the directories you specified in the raidfile.conf are not writable
-          by the _bbstored user -- fix it, and try again.</para>
-
-          <para>Finally, tell the user their account number, and the hostname
-          of your server. They will use this to set up the backup client, and
-          send you a CSR. This has the account number embedded in it, and you
-          should be sure that it has the right account number in it.</para>
-
-          <para>Sign this CSR with this command:</para>
-
-          <programlisting>/usr/local/bin/bbstored-certs ca sign 75AB23C-csr.pem</programlisting>
-
-          <para>Don't forget to check that the embedded account number is
-          correct! Then send the two files back to the user, as instructed by
-          the script.</para>
-
-          <para>Please read the Troubleshooting page if you have problems.
-          </para>
-
-          <para>TODO: Link to troubleshooting...</para>
-        </section>
-      </section>
-
-      <section>
-        <title>Log Files</title>
-
-        <para>You may wish to see what's going on with the server. Edit
-        /etc/syslog.conf, and add:</para>
-
-        <programlisting>local6.info                         /var/log/box
-local5.info                         /var/log/raidfile</programlisting>
-
-        <para><emphasis role="bold">Note:</emphasis> Separators must be tabs,
-        otherwise these entries will be ignored.</para>
-
-        <programlisting>touch /var/log/box
-touch /var/log/raidfile</programlisting>
-
-        <para>Set up log rotation, by adding in /etc/newsyslog.conf:</para>
-
-        <programlisting>/var/log/box                644  7    2000 *     Z
-/var/log/raidfile           644  7    2000 *     Z</programlisting>
-
-        <para>Then restart syslogd.</para>
-      </section>
-
-      <section>
-        <title>Configuring a client</title>
-
-        <para>Before you can do any configuration, you need to know the
-        hostname of the server you will be using, and your account number on
-        that server.</para>
-
-        <para>Later in the process, you will need to send a certificate
-        request to the administrator of that server for it to be
-        signed.</para>
-
-        <para>Installation is covered in the compiling and installing section.
-        You only need the backup-client parcel.</para>
-
-        <para>It is important that you read all the output of the config
-        scripts. See the end of this page for an example.</para>
-
-        <para>The backup client has to be run as root, because it needs to
-        read all your files to back them up, although it is possible to back
-        up a single user's files by running it as that user. (Tip: specify a
-        directory other than /etc/box, and then give the alternate config file
-        as the first argument to bbackupd). However, it will fall over if you
-        don't give yourself read access to one of your files. </para>
-
-        <section>
-          <title id="BasicConfig">Basic configuration</title>
-
-          <para>Run the bbackupd-config script to generate the configuration
-          files and generate a private key and certificate request.</para>
-
-          <programlisting>/usr/local/bin/bbackupd-config /etc/box lazy <emphasis
-              role="bold">999 hostname</emphasis> /var/bbackupd <emphasis
-              role="bold">/home</emphasis></programlisting>
-
-          <para>(See <link linkend="instguide.sgml">OpenSSL notes</link> if
-          you get an OpenSSL error)</para>
-
-          <para>The items in bold need to be changed. In order, they are the
-          account number, the hostname of the server you're using, and
-          finally, the directories you want backed up. You can include as many
-          you want here.</para>
-
-          <para>However, the directories you specify must not contain other
-          mounted file systems within them at any depth. Specify them
-          separately, one per mount point. No checks are currently made to
-          catch bad configuration of this nature!</para>
-
-          <para>You may also want to consider changing the mode from lazy to
-          snapshot, depending on what your system is used for. </para>
-
-          <itemizedlist>
-            <listitem>
-              <para><emphasis role="bold">lazy</emphasis>. This mode regularly
-              scans the files, with only a rough schedule. It uploads files as
-              and when they are changed, if the latest version is more than a
-              set age. This is good for backing up user's documents stored on
-              a server, and spreads the load out over the day. </para>
-            </listitem>
-
-            <listitem>
-              <para><emphasis role="bold">snapshot</emphasis>. This mode
-              emulates the traditional backup behaviour of taking a snapshot
-              of the filesystem. The backup daemon does absolutely nothing
-              until it is instructed to make a backup using the bbackupctl
-              utility (probably as a cron job), at which point it uploads all
-              files which have been changed since the last time it uploaded.
-              </para>
-            </listitem>
-          </itemizedlist>
-
-          <para>When you run the config script, it will tell you what you need
-          to do next. Don't forget to read all the output. An example is shown
-          at the end of this page, but the instructions for your installation
-          may be different.</para>
-        </section>
-
-        <section>
-          <title>Certificates</title>
-
-          <para>After you have sent your certificate request off to the server
-          administrator and received your certificate and CA root back,
-          install them where instructed by the bbackupd-config script during
-          basic bbackupd configuration.</para>
-
-          <para>You can then run the daemon (as root) by typing
-          /usr/local/bin/bbackupd, and of course, adding it to your system's
-          startup scripts. The first time it's run it will upload everything.
-          Interrupting it and restarting it will only upload files which were
-          not uploaded before - it's very tolerant.</para>
-
-          <para>If you run in snapshot mode, you will need to add a cron job
-          to schedule backups. The config script will tell you the exact
-          command to use for your system.</para>
-
-          <para>Please read the Troubleshooting page if you have
-          problems.</para>
-
-          <para>Remember to make a traditional backup of the keys file, as
-          instructed. You cannot restore files without it.</para>
-
-          <para>It is recommended that you backup up all of /etc/box as it
-          will make things easier if you need to restore files. But only the
-          keys are absolutely essential.</para>
-
-          <para>If you want to see what it's doing in more detail (probably a
-          good idea), follow the instructions in the server setup to create
-          new log files with syslog. Adding and removing backed up
-          locations.</para>
-
-          <para>By editing the /etc/box/bbackupd.conf file, you can add and
-          remove directories to back up -- see comments in this file for help.
-          Send bbackupd a HUP signal after you modify it.</para>
-
-          <para>When you remove a location, it will not be marked as deleted
-          immediately. Instead, bbackupd waits about two days before doing so,
-          just in case you change your mind. After this, it will be eventually
-          removed from the store by the housekeeping process. Run as
-          root.</para>
-
-          <para>The backup client is designed to be run as root. It is
-          possible to run without root, but this is not recommended. Clock
-          synchronisation for file servers.</para>
-
-          <para>If you are using the backup client to backup a filesystem
-          served from a fileserver, you should ideally ensure that the
-          fileserver clocks are synchronised with the fileserver.</para>
-
-          <para>bbackupd will cope perfectly well if the clocks are not
-          synchronised. Errors up to about half an hour cause no problems.
-          Larger discrepancies cause a loss of efficiency and the potential to
-          back up a file during a write process.</para>
-
-          <para>There is a configuration parameter MaxFileTimeInFuture, which
-          specifies how far in the future a file must be for it to be uploaded
-          as soon as it is seen. You should not need to adjust this (default
-          is 2 days). Instead, get those clocks synchronised. Excluding files
-          and directories from the backup.</para>
-
-          <para>Within the bbackupd.conf file, there is a section named
-          BackupLocations which specifies which locations on disc should be
-          backed up. It has subsections, each of which is in the
-          format:</para>
-
-          <programlisting> name
- {
-    Path = /path/of/directory
-    (optional exclude directives)
- }</programlisting>
-
-          <para><emphasis role="bold">name</emphasis> is derived from the Path
-          by the config script, but should merely be unique.</para>
-
-          <para>The exclude directives are of the form:</para>
-
-          <programlisting>[Exclude|AlwaysInclude][File|Dir][|sRegex] = regex or full pathname</programlisting>
-
-          <para>(The regex suffix is shown as 'sRegex' to make File or Dir
-          plural)</para>
-
-          <para>For example:</para>
-
-          <programlisting> ExcludeDir = /home/guest-user
- ExcludeFilesRegex = *.(mp3|MP3)\$
- AlwaysIncludeFile = /home/username/veryimportant.mp3</programlisting>
-
-          <para>This excludes the directory /home/guest-user from the backup
-          along with all mp3 files, except one MP3 file in particular.</para>
-
-          <para>In general, Exclude excludes a file or directory, unless the
-          directory is explicitly mentioned in a AlwaysInclude
-          directive.</para>
-
-          <para>If a directive ends in Regex, then it is a regular expression
-          rather than a explicit full pathname. See </para>
-
-          <programlisting> man 7 re_format</programlisting>
-
-          <para>for the regex syntax on your platform.</para>
-        </section>
-
-        <section>
-          <title>Example configuration output</title>
-
-          <para>This is an example of output from the bbstored-config
-          script.</para>
-
-          <para><emphasis role="bold">Important</emphasis>: Follow the
-          instructions output by your script, not the ones here -- they may be
-          different for your system.</para>
-
-          <programlisting>/usr/local/bin/bbackupd-config /etc/box lazy 51 server.example.com /var/bbackupd /home /etc/samba
-
-Setup bbackupd config utility.
-
-Configuration:
-   Writing configuration file: /etc/box/bbackupd.conf
-   Account: 51
-   Server hostname: server.example.com
-   Directories to back up:
-      /home
-      /etc/samba
-
-Note: If other file systems are mounted inside these directories, then problems may occur
-with files on the store server being renamed incorrectly. This will cause efficiency
-problems, but not affect the integrity of the backups.
-
-WARNING: Directories not checked against mountpoints. Check mounted filesystems manually.
-
-Creating /etc/box...
-Creating /etc/box/bbackupd
-Generating private key...
- [OpenSSL output omitted]
-
-Generating keys for file backup
-Writing notify script /etc/box/bbackupd/NotifyStoreFull.sh
-Writing configuration file /etc/box/bbackupd.conf
-
-===================================================================
-
-bbackupd basic configuration complete.
-
-What you need to do now...
-
-1) Make a backup of /etc/box/bbackupd/51-FileEncKeys.raw
-   This should be a secure offsite backup.
-   Without it, you cannot restore backups. Everything else can
-   be replaced. But this cannot.
-   KEEP IT IN A SAFE PLACE, OTHERWISE YOUR BACKUPS ARE USELESS.
-
-2) Send /etc/box/bbackupd/51-csr.pem
-   to the administrator of the backup server, and ask for it to
-   be signed.
-
-3) The administrator will send you two files. Install them as
-      /etc/box/bbackupd/51-cert.pem
-      /etc/box/bbackupd/serverCA.pem
-   after checking their authenticity.
-
-4) You may wish to read the configuration file
-      /etc/box/bbackupd.conf
-   and adjust as appropraite.
-   
-   There are some notes in it on excluding files you do not
-   wish to be backed up.
-
-5) Review the script
-      /etc/box/bbackupd/NotifyStoreFull.sh
-   and check that it will email the right person when the store
-   becomes full. This is important -- when the store is full, no
-   more files will be backed up. You want to know about this.
-
-6) Start the backup daemon with the command
-      /usr/local/bin/bbackupd
-   in /etc/rc.local, or your local equivalent.
-   Note that bbackupd must run as root.
-
-===================================================================</programlisting>
-
-          <para>Remember to make a secure, offsite backup of your backup keys,
-          as described in <link linkend="BasicConfig">Basic
-          configuration</link> above. If you do not,, and that key is lost,
-          you have no backups.</para>
-        </section>
-      </section>
-    </section>
-  </chapter>
-
-  <chapter>
-    <title>Administration</title>
-
-    <para>This chapter deals with the dauily running and management of the Box
-    Backup system. It explains most day-to-day tasks.</para>
-
-    <section>
-      <title>Regular Maintenance</title>
-
-      <para>The steps involved in maintaining and keeping the backup sets
-      healthy are outlined in this section.</para>
-
-      <section>
-        <title>Controlling a backup client</title>
-
-        <para>The bbackupctl program sends control commands to the bbackupd
-        daemon. It must be run as the same user as the daemon, and there is no
-        exception for root.</para>
-
-        <para>The command line syntax is:</para>
-
-        <programlisting>/usr/local/bin/bbackupctl [-q] [-c config-file] command</programlisting>
-
-        <para>The -q option reduces the amount of output the program emits,
-        and -c allows an alternative configuration file to be
-        specified.</para>
-
-        <para>Valid commands are: </para>
-
-        <itemizedlist>
-          <listitem>
-            <para><emphasis role="bold">terminate</emphasis></para>
-
-            <para>Stop the bbackupd daemon now (equivalent to kill)</para>
-          </listitem>
-
-          <listitem>
-            <para><emphasis role="bold">reload</emphasis></para>
-
-            <para>Reload the configuration file (equivalent to kill
-            -HUP)</para>
-          </listitem>
-
-          <listitem>
-            <para><emphasis role="bold">sync</emphasis></para>
-
-            <para>Connect to the server and synchronise files now</para>
-          </listitem>
-        </itemizedlist>
-
-        <para><emphasis role="bold">bbackupctl</emphasis> communicates with
-        the server via a UNIX domain socket, specified in bbackupd.conf with
-        the CommandSocket directive. This does not need to be specified, and
-        <emphasis role="bold">bbackupd</emphasis> will run without the command
-        socket, but in this case bbackupctl will not be able to communicate
-        with the daemon.</para>
-
-        <para>Some platforms cannot check the user id of the connecting
-        process, so this command socket becomes a denial of service security
-        risk. <emphasis role="bold">bbackupd</emphasis> will warn you when it
-        starts up if this is the case on your platform, and you should
-        consider removing the CommandSocket directive on these
-        platforms.</para>
-      </section>
-
-      <section>
-        <title>Using bbackupctl to perform snapshots</title>
-
-        <para><emphasis role="bold">bbackupctl</emphasis>'s main purpose is to
-        implement snapshot based backups, emulating the behaviour of
-        traditional backup software.</para>
-
-        <para>Use bbackupd-config to write a configuration file in snapshot
-        mode, and then run the following command as a cron job. </para>
-
-        <programlisting>/usr/local/bin/bbackupctl -q sync</programlisting>
-
-        <para>This will cause the backup daemon to upload all changed files
-        immediately. <emphasis role="bold">bbackupctl</emphasis> will exit
-        almost immediately, and will not output anything unless there is an
-        error. </para>
-      </section>
-
-      <section>
-        <title>Checking storage space used on the server</title>
-
-        <section>
-          <title>From the client machine</title>
-
-          <para>bbackupquery can tell you how much space is used on the server
-          for this account. Either use the usage command in interactive mode,
-          or type:</para>
-
-          <programlisting>/usr/local/bin/bbackupquery -q usage quit</programlisting>
-
-          <para>to show the space used as a single command.</para>
-        </section>
-
-        <section>
-          <title>On the server</title>
-
-          <para>bbstoreaccounts allows you to query the space used, and change
-          the limits. To display the space used on the server for an account,
-          use:</para>
-
-          <programlisting>/usr/local/bin/bbstoreaccounts info 75AB23C</programlisting>
-
-          <para>To adjust the soft and hard limits on an account, use:</para>
-
-          <programlisting>/usr/local/bin/bbstoreaccounts setlimit 75AB23C new-soft-limit new-hard-limit</programlisting>
-
-          <para>You do not need to restart the server.</para>
-        </section>
-      </section>
-
-      <section>
-        <title>Verify and restore files</title>
-
-        <para>Backups are no use unless you can restore them. The bbackupquery
-        utility does this and more.</para>
-
-        <para>You don't provide any login information to it, as it just picks
-        up the data it needs from /etc/box/bbackupd.conf. You should run it as
-        root so it can find everything it needs.</para>
-
-        <para>Full documentation can be found in the <link
-        linkend="bbackupquery.xml">bbackupquery man page</link>. It follows
-        the model of a command line sftp client quite closely.</para>
-
-        <para>TODO: Link to bbackupquery man-page here.</para>
-
-        <para>On systems where GNU readline is available (by default) it uses
-        that for command line history and editing. Otherwise it falls back to
-        very basic UNIX text entry. </para>
-
-        <para>TODO: Did the readline dependency change to editline?</para>
-
-        <section>
-          <title>Using bbackupquery</title>
-
-          <para>bbackupquery is the tool you use to verify, restore and
-          investigate your backup files with. When invoked, it simply logs
-          into the server using the certificates you have listed in
-          bbackupd.conf. </para>
-
-          <para>After you run bbackupquery, you will see a prompt, allowing
-          you to execute commands. The list (or ls) command lets you view
-          files in the store. It works much like unix ls, but with different
-          options. An example:</para>
-
-          <programlisting>[pthomsen at host bbackupquery]$ bbackupquery 
-Box Backup Query Tool  v0.10, (c) Ben Summers and contributors 2003-2006
-Using configuration file /etc/box/bbackupd.conf
-Connecting to store...
-Handshake with store...
-Login to store...
-Login complete.
-
-Type "help" for a list of commands.
-
-query > ls
-00000002 -d---- mp3
-00000003 -d---- video
-00000004 -d---- home-pthomsen
-00000005 -d---- root
-query >   </programlisting>
-
-          <para>The ls commands shows the directories that are backed up. Now
-          we'll take a closer look at the home-pthomsen directory:</para>
-
-          <programlisting>query > cd home-pthomsen
-query > ls
-00002809 f----- sample.tiff
-0000280a f----- s3.tiff
-0000280b f----- s4.tiff
-0000280d f----- s2.tiff
-0000280e f----- foo.pdf
-0000286c f----- core.28720
-0000339a -d---- .emacs.d
-0000339d -d---- bbackup-contrib
-00003437 f----- calnut.compare.txt
-0000345d f----- DSCN1783.jpg
-0000345e f----- DSCN1782.jpg
-query ></programlisting>
-
-          <para>The ls command takes the following options;</para>
-
-          <itemizedlist>
-            <listitem>
-              <para><emphasis role="bold">-r </emphasis>-- recursively list
-              all files</para>
-            </listitem>
-
-            <listitem>
-              <para><emphasis role="bold">-d</emphasis> -- list deleted
-              files/directories</para>
-            </listitem>
-
-            <listitem>
-              <para><emphasis role="bold">-o</emphasis> -- list old versions
-              of files/directories</para>
-            </listitem>
-
-            <listitem>
-              <para><emphasis role="bold">-I</emphasis> -- don't display
-              object ID</para>
-            </listitem>
-
-            <listitem>
-              <para><emphasis role="bold">-F </emphasis>-- don't display
-              flags</para>
-            </listitem>
-
-            <listitem>
-              <para><emphasis role="bold">-t </emphasis>-- show file
-              modification time (and attr mod time if has the object has
-              attributes, ~ separated)</para>
-            </listitem>
-
-            <listitem>
-              <para><emphasis role="bold">-s</emphasis> -- show file size in
-              blocks used on server (only very approximate indication of size
-              locally)</para>
-            </listitem>
-          </itemizedlist>
-
-          <para>The flags displayed from the ls command are as follows:</para>
-
-          <simplelist>
-            <member>f = file</member>
-
-            <member>d = directory</member>
-
-            <member>X = deleted</member>
-
-            <member>o = old version</member>
-
-            <member>R = remove from server as soon as marked deleted or
-            old</member>
-
-            <member>a = has attributes stored in directory record which
-            override attributes in backup file</member>
-          </simplelist>
-        </section>
-
-        <section>
-          <title>Verify backups</title>
-
-          <para>Since this system is not yet 100% production-ready, you'll be
-          keen to verify that your backups are correct. This is easy:</para>
-
-          <programlisting>/usr/local/bin/bbackupquery "compare -a" quit</programlisting>
-
-          <para>It will report all the differences between the store and the
-          files on disc. It will download everything, so may take a while. You
-          should expect to see some differences on a typical compare, because
-          files which have recently changed are unlikely to have been uploaded
-          yet. Consider checking the timestamps on the files, or keeping a
-          record of these messages and comparing them with a future
-          verification.</para>
-
-          <para>If you would like to do a "quick" check which just downloads
-          file checksums and compares against that, then do:</para>
-
-          <programlisting>/usr/local/bin/bbackupquery "compare -aq" quit</programlisting>
-
-          <para>However, this does not check that the file attributes are
-          correct, and since the checksums are generated on the client they
-          may not reflect the data on the server if there is a problem -- the
-          server cannot check the encrypted contents. View this as a good
-          indication, rather than a definite check that your backup verifies
-          correctly.</para>
-
-          <para>You may wish to run either one as a cron job while testing
-          this system. </para>
-        </section>
-
-        <section>
-          <title>Restore backups</title>
-
-          <para>You will need the keys file created when you configured the
-          server. Without it, you cannot restore the files; this is the
-          downside of encrypted backups. However, by keeping the small keys
-          file safe, you indirectly keep your entire backup safe.</para>
-
-          <para>The first step is to recreate the configuration of the backup
-          client. It's probably best to have stored the /etc/box directory
-          with your keys. But if you're recreating it, all you really need is
-          to have got the login infomation correct (ie the certs and
-          keys).</para>
-
-          <para>Don't run bbackupd yet! It will mark all your files as deleted
-          if you do, which is not hugely bad in terms of losing data, just a
-          major inconvenience. (This assumes that you are working from a blank
-          slate. If you want to restore some files to a different location,
-          it's fine to restore while bbackupd is running, just do it outside a
-          backed up directory to make sure it doesn't start uploading the
-          restored files.)</para>
-
-          <para>Type: </para>
-
-          <programlisting>/usr/local/bin/bbackupquery</programlisting>
-
-          <para>to run it in interactive mode.</para>
-
-          <para>Type:</para>
-
-          <programlisting>list</programlisting>
-
-          <para>to see a list of the locations stored on the server.</para>
-
-          <para>For each location you want to restore, type:</para>
-
-          <programlisting>restore name-on-server local-dir-name</programlisting>
-
-          <para>The directory specified by local-dir-name must not exist yet.
-          If the restore is interrupted for any reason, repeat the above
-          steps, but add the <emphasis role="bold">-r</emphasis> flag to the
-          restore command to tell it to resume.</para>
-        </section>
-
-        <section>
-          <title>Retrieving deleted and old files</title>
-
-          <para>Box Backup makes old versions of files and files you have
-          deleted available, subject to there being enough disc space on the
-          server to hold them.</para>
-
-          <para>This is how to retrieve them using bbackupquery. Future
-          versions will make this far more user-friendly.</para>
-
-          <para>Firstly, run bbackupquery in interactive mode. It behaves in a
-          similar manner to a command line sftp client. </para>
-
-          <programlisting>/usr/local/bin/bbackupquery</programlisting>
-
-          <para>Then navigate to the directory containing the file you want,
-          using list, cd and pwd.</para>
-
-          <programlisting>query > cd home/profiles/USERNAME</programlisting>
-
-          <para>List the directory, using the "o" option to list the files
-          available without filtering out everything apart from the current
-          version. (if you want to see deleted files as well, use list
-          -odt)</para>
-
-          <programlisting>query > list -ot
-00000078 f--o- 2004-01-21T20:17:48 NTUSER.DAT
-00000079 f--o- 2004-01-21T20:17:48 ntuser.dat.LOG
-0000007a f--o- 2004-01-21T17:55:12 ntuser.ini
-0000007b f---- 2004-01-12T15:32:00 ntuser.pol
-0000007c -d--- 1970-01-01T00:00:00 Templates
-00000089 -d--- 1970-01-01T00:00:00 Start Menu
-000000a0 -d--- 1970-01-01T00:00:00 SendTo
-000000a6 -d--- 1970-01-01T00:00:00 Recent
-00000151 -d--- 1970-01-01T00:00:00 PrintHood
-00000152 -d--- 1970-01-01T00:00:00 NetHood
-00000156 -d--- 1970-01-01T00:00:00 My Documents
-0000018d -d--- 1970-01-01T00:00:00 Favorites
-00000215 -d--- 1970-01-01T00:00:00 Desktop
-00000219 -d--- 1970-01-01T00:00:00 Cookies
-0000048b -d--- 1970-01-01T00:00:00 Application Data
-000005da -d--- 1970-01-01T00:00:00 UserData
-0000437e f--o- 2004-01-24T02:45:43 NTUSER.DAT
-0000437f f--o- 2004-01-24T02:45:43 ntuser.dat.LOG
-00004380 f--o- 2004-01-23T17:01:29 ntuser.ini
-00004446 f--o- 2004-01-24T02:45:43 NTUSER.DAT
-00004447 f--o- 2004-01-24T02:45:43 ntuser.dat.LOG
-000045f4 f---- 2004-01-26T15:54:16 NTUSER.DAT
-000045f5 f---- 2004-01-26T15:54:16 ntuser.dat.LOG
-000045f6 f---- 2004-01-26T16:54:31 ntuser.ini</programlisting>
-
-          <para>(this is a listing from a server which is used as a Samba
-          server for a network of Windows clients.) You now need to fetch the
-          file using it's ID, rather than it's name. The ID is the hex number
-          in the first column. Fetch it like this: </para>
-
-          <programlisting>query > get -i 0000437e NTUSER.DAT
-Object ID 0000437e fetched successfully.</programlisting>
-
-          <para>The object is now available on your local machine. You can use
-          lcd to move around, and sh ls to list directories on your local
-          machine.</para>
-        </section>
-      </section>
-    </section>
-
-    <section>
-      <title id="FixCorruptions">Fixing corruptions of store data</title>
-
-      <para>This section gives help on what to do if your server has suffered
-      corruption, for example, after an unclean shutdown or other OS or
-      hardware problem.</para>
-
-      <para>In general, as updates to the store are made in an atomic manner,
-      the most likely result is wasted disc space. However, if really bad
-      things happen, or you believe that there is a lot of wasted space, then
-      these instructions will help to restore your data.</para>
-
-      <para>You know you will need to do something if you get strange errors,
-      and bbackupd attempts to contact the server every 100 seconds or so. Or
-      if one of the discs in your RAID disc set has failed.</para>
-
-      <para>After following these instructions, the end result will be that
-      bbackupquery will be able to see all the files which were stored on your
-      server, and retrieve them. Some of them may be in lost+found directories
-      in the root of the store (or in their original position if they have
-      been moved) but they will all be able to be retrieved.</para>
-
-      <para>After you have retrieved the files you want, bbackupd will upload
-      new versions where necessary, and after about two days, mark any
-      lost+found directories as deleted. Finally, those directories will be
-      removed by the housekeeping process on the server.</para>
-
-      <para>These instructions assume you're working on account 1234,
-      subsitute this for whatever account you're actually working on. These
-      will need to be repeated for all affected accounts. </para>
-
-      <section>
-        <title>Stop bbackupd</title>
-
-        <para>First, make sure that bbackupd is not running on the client
-        machine for the account you are going to recover. Use kill to
-        terminate it. This step is not strictly necessary, but is recommended.
-        During any checks on the account, bbackupd will be unable to log in,
-        and after they are complete, the account is marked as changed on the
-        server so bbackupd will perform a complete scan.</para>
-      </section>
-
-      <section>
-        <title>Are you using RAID on the server?</title>
-
-        <para>At the moment, the raidfile recovery tools have not been
-        written. However, when two out of three files are available, the
-        server will run succesfully, even if it complains a lot in the logs.
-        So, your best bet here is to fix the accounts, if necessary, and
-        retrieve any files you need. Then move the old store directories aside
-        (in case you need them) and start afresh with new accounts, and let
-        the clients upload all their data again. These utilities will be
-        written shortly! </para>
-
-        <para>TODO: Is this true anymore???</para>
-      </section>
-
-      <section>
-        <title>Check and fix the account</title>
-
-        <para>First, run the check utility, and see what errors it
-        reports.</para>
-
-        <programlisting>/usr/local/bin/bbstoreaccounts check 1234</programlisting>
-
-        <para>This will take some time, and use a fair bit of memory (about 16
-        bytes per file and directory). If the output looks plausible and
-        reports errors which need fixing, run it again but with the fix
-        flag:</para>
-
-        <programlisting>/usr/local/bin/bbstoreaccounts check 1234 fix</programlisting>
-
-        <para>This will fix any errors, and remove unrecoverable files.
-        Directories will be recreated if necessary.</para>
-
-        <para><emphasis role="bold">NOTE</emphasis>: The utility may adjust
-        the soft and hard limits on the account to make sure that housekeeping
-        will not remove anything -- check these afterwards. </para>
-      </section>
-
-      <section>
-        <title>Grab any files you need with bbackupquery</title>
-
-        <para>At this point, you will have a working store. Every file which
-        was on the server, and wasn't corrupt, will be available.</para>
-
-        <para>On the client, use bbackupquery to log in and examine the store.
-        (type help at the prompt for instructions). Retrieve any files you
-        need, paying attention to any lost+found directories in the root
-        directory of the store.</para>
-
-        <para>You can skip this step if you are sure that the client machine
-        is fine -- in this case, bbackupd will bring the store up to date.
-        </para>
-      </section>
-
-      <section>
-        <title>Restart bbackupd</title>
-
-        <para>Restart bbackupd on the client machine. The store account will
-        be brought up to date, and files in the wrong place will be marked for
-        eventual deletion.</para>
-      </section>
-    </section>
-
-    <section>
-      <title>Troubleshooting</title>
-
-      <para>If you are trying to fix a store after your disc has been
-      corrupted, see <link linkend="FixCorruptions">Fixing corruptions of
-      store data</link>.</para>
-
-      <para>Unfortunately, the error messages are not particularly helpful at
-      the moment. This page lists some of the common errors, and the most
-      likely causes of them.</para>
-
-      <para>When an error occurs, you will see a message like 'Exception:
-      RaidFile/OSFileError (2/8)' either on the screen or in your log files.
-      (it is recommended you set up another log file as recommended in the
-      server setup instructions.)</para>
-
-      <para>This error may not be particularly helpful, although some do have
-      extra information about probable causes. To get further information,
-      check the ExceptionCodes.txt file in the root of the distribution. This
-      file is generated by the ./configure script, so you will need to have
-      run that first.</para>
-
-      <para>Some common causes of exceptions are listed below.</para>
-
-      <para>Please email me with any other codes you get, and I will let you
-      know what they mean, and add notes here. </para>
-
-      <section>
-        <title>RaidFile (2/8)</title>
-
-        <para>This is found either when running bbstoreaccounts or in the
-        bbstored logs.</para>
-
-        <para><emphasis role="bold">Problem</emphasis>: The directories you
-        specified in the raidfile.conf are not writable by the _bbstored
-        user.</para>
-
-        <para><emphasis role="bold">Resolution</emphasis>: Change permissions
-        appropriately.</para>
-      </section>
-
-      <section>
-        <title>Common (1/2)</title>
-
-        <para>This usually occurs when the configuration files can't be
-        opened.</para>
-
-        <para><emphasis role="bold">Problem</emphasis>: You created your
-        configurations in non-standard locations, and the programs cannot find
-        them.</para>
-
-        <para><emphasis role="bold">Resolution</emphasis>: Explicitly specify
-        configuration file locations to daemons and programs. For
-        example</para>
-
-        <programlisting>/usr/local/bin/bbstored /some/other/dir/bbstored.config /usr/local/bin/bbackupquery -c /some/other/dir/bbackupd.config</programlisting>
-
-        <para>(daemons specify the name as the first argument, utility
-        programs with the -c option).</para>
-
-        <para><emphasis role="bold">Problem</emphasis>: bbstored can't find
-        the raidfile.conf file specified in bbstored.conf.</para>
-
-        <para><emphasis role="bold">Resolution</emphasis>: Edit bbstored.conf
-        to point to the correct location of this additional configuration
-        file. </para>
-      </section>
-
-      <section>
-        <title>Server (3/16)</title>
-
-        <para>The server can't listen for connections on the IP address
-        specified when you configured it.</para>
-
-        <para><emphasis role="bold">Problem</emphasis>: This probably means
-        you've specified the wrong hostname to bbstored-config -- maybe your
-        server is behind a NAT firewall?</para>
-
-        <para><emphasis role="bold">Resolution</emphasis>: Edit bbstored.conf
-        and correct the ListenAddresses line. You should replace the server
-        address with the IP address of your machine. </para>
-      </section>
-
-      <section>
-        <title>Connection (7/x)</title>
-
-        <para>These errors all relate to connections failing -- you may see
-        them during operation if there are network failures or other problems
-        between the client and server. The backup system will recover from
-        them automatically.</para>
-
-        <section>
-          <title>Connection (7/30) - SSL problems</title>
-
-          <para>Log snippet from client side:</para>
-
-          <programlisting>bbackupd[1904]: Opening connection to server xxxx.xxx...
-bbackupd[1904]: SSL err during Connect: error:xxxxxxxx:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01
-bbackupd[1904]: SSL err during Connect: error:xxxxxxxx:rsa routines:RSA_EAY_PUBLIC_DECRYPT:padding check failed
-bbackupd[1904]: SSL err during Connect: error:xxxxxxxx:asn1 encoding routines:ASN1_verify:EVP lib
-bbackupd[1904]: SSL err during Connect: error:xxxxxxxx:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
-bbackupd[1904]: TRACE: Exception thrown: ConnectionException(Conn_TLSHandshakeFailed) at SocketStreamTLS.cpp(237)
-bbackupd[1904]: Exception caught (7/30), reset state and waiting to retry...</programlisting>
-
-          <para>And from the server:</para>
-
-          <programlisting>bbstored[19291]: Incoming connection from xx.xxx.xx.xxx port xxxxx (handling in child xxxxx)
-bbstored[21588]: SSL err during Accept: error:xxxxxxxx:SSL routines:SSL3_READ_BYTES:tlsv1 alert decrypt error
-bbstored[21588]: in server child, exception Connection TLSHandshakeFailed (7/30) -- terminating child</programlisting>
-
-          <para><emphasis role="bold">Solution</emphasis>: Create a new CA on
-          the server side and re-generate the client certificate. Re-creating
-          the client certificate request is not necessary.</para>
-        </section>
-      </section>
-
-      <section>
-        <title>Advanced troubleshooting</title>
-
-        <para>If this really doesn't help, then using the DEBUG builds of the
-        system will give you much more information -- a more descriptive
-        exception message and the file and line number where the error
-        occurred.</para>
-
-        <para>For example, if you are having problems with bbstoreaccounts,
-        build the debug version with:</para>
-
-        <programlisting>cd boxbackup-0.0
-cd bin/bbstoreaccounts
-make</programlisting>
-
-        <para>Within the module directories, make defaults to building the
-        debug version. At the top level, it defaults to release.</para>
-
-        <para>This will build an executable in debug/bin/bbstoreaccounts which
-        you can then use instead of the release version. It will give far more
-        useful error messages.</para>
-
-        <para>When you get an error message, use the file and line number to
-        locate where the error occurs in the code. There will be comments
-        around that line to explain why the exception happened.</para>
-
-        <para>If you are using a debug version of a daemon, these extended
-        messages are found in the log files.</para>
-      </section>
-    </section>
-  </chapter>
-
-  <appendix>
-    <title id="WORoot">Running without root</title>
-
-    <para>It is possible to run both the server and client without root
-    privileges.</para>
-
-    <section>
-      <title>Server</title>
-
-      <para>The server, by default, runs as a non-root user. However, it
-      expects to be run as root and changes user to a specified user as soon
-      as it can, simply for administrative convenience. The server uses a port
-      greater than 1024, so it doesn't need root to start.</para>
-
-      <para>To run it entirely as a non-root user, edit the bbstored.conf
-      file, and remove the User directive from the Server section. Then simply
-      run the server as your desired user. </para>
-    </section>
-
-    <section>
-      <title>Client</title>
-
-      <para>The client requires root for normal operation, since it must be
-      able to access all files to back them up. However, it is possible to run
-      the client as a non-root user, with certain limitations.</para>
-
-      <para>Follow the installation instructions, but install the executable
-      files manually to somewhere in your home directory. Then use
-      bbackupd-config to configure the daemon, but use a directory other than
-      /etc/box, probably somewhere in your home directory.</para>
-
-      <para>All directories you specify to be backed up must be readable, and
-      all files must be owned by the user and readable to that user.</para>
-
-      <para>Important: If any file or directory is not readable by this user,
-      the backup process will skip that file or directory. Keep an eye on the
-      logs for reports of this failure.</para>
-
-      <para>Non-root operation of the backup client is recommended only for
-      testing, and should not be relied on in a production environment.
-      </para>
-    </section>
-  </appendix>
-</book>
\ No newline at end of file

Copied: box/chris/boxi/documentation/boxbackup/adminguide.xml (from rev 547, box/trunk/documentation/boxbackup/adminguide.xml)

Deleted: box/chris/boxi/documentation/boxbackup/instguide.xml
===================================================================
--- box/trunk/documentation/boxbackup/instguide.xml	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/documentation/boxbackup/instguide.xml	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,750 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
-<book>
-  <title>Box Backup Build and Installation Guide</title>
-
-  <preface>
-    <title>License</title>
-
-    <para>Copyright (c) <YEAR>, <OWNER></para>
-
-    <para>All rights reserved.</para>
-
-    <para>Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are
-    met:</para>
-
-    <itemizedlist>
-      <listitem>
-        <para>Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.</para>
-      </listitem>
-
-      <listitem>
-        <para>Redistributions in binary form must reproduce the above
-        copyright notice, this list of conditions and the following disclaimer
-        in the documentation and/or other materials provided with the
-        distribution.</para>
-      </listitem>
-
-      <listitem>
-        <para>Neither the name of the <ORGANIZATION> nor the names of
-        its contributors may be used to endorse or promote products derived
-        from this software without specific prior written permission</para>
-      </listitem>
-    </itemizedlist>
-
-    <para>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</para>
-  </preface>
-
-  <chapter>
-    <title>Introduction</title>
-
-    <para>The backup daemon, bbackupd, runs on all machines to be backed up.
-    The store server daemon, bbstored runs on a central server. Data is sent
-    to the store server, which stores all data on local filesystems, that is,
-    only on local hard drives. Tape or other archive media is not used.</para>
-
-    <para>The system is designed to be easy to set up and run, and cheap to
-    use. Once set up, there should be no need for user or administrative
-    intervention, apart from usual system maintenance.</para>
-
-    <section>
-      <title>Client daemon</title>
-
-      <para>bbackupd is configured with a list of directories to back up. It
-      has a lazy approach to backing up data. Every so often, the directories
-      are scanned, and new data is uploaded to the server. This new data must
-      be over a set age before it is uploaded. This prevents rapid revisions
-      of a file resulting in many uploads of the same file in a short period
-      of time.</para>
-
-      <para>It can also operate in a snapshot mode, which behaves like
-      traditional backup software. When instructed by an external bbackupctl
-      program, it will upload all changed files to the server.</para>
-
-      <para>The daemon is always running, although sleeping most of the time.
-      In lazy mode, it is completely self contained -- scripts running under
-      cron jobs are not used. The objective is to keep files backed up, not to
-      make snapshots of the filesystem at particular points in time
-      available.</para>
-
-      <para>If an old version of the file is present on the server, a modified
-      version of the rsync algorithm is used to upload only the changed
-      portions of the file.</para>
-
-      <para>After a new version is uploaded, the old version is still
-      available (subject to disc space on the server). Similarly, a deleted
-      file is still available. The only limit to their availability is space
-      allocated to this account on the server</para>
-
-      <para>Future versions will add the ability to mark the current state of
-      files on the server, and restore from this mark. This will emulate the
-      changing of tapes in a tape backup system.</para>
-
-      <section>
-        <title>Restoration</title>
-
-        <para>Restoring files is performed using a query tool, bbackupquery.
-        This can be used to restore entire directories, or as an 'FTP-like'
-        tool to list and retrieve individual files. Old versions and deleted
-        files can be retrieved using this tool for as long as they are kept on
-        the server.</para>
-      </section>
-
-      <section>
-        <title>Client Resource Usage</title>
-
-        <para>bbackupd uses only a minimal amount of disc space to store
-        records on uploaded files -- less than 32 bytes per directory and file
-        over a set size threshold. However, it minimises the amount of queries
-        it must make to the server by storing, in memory, a data structure
-        which allows it to determine what data is new. It does not need to
-        store a record of all files, essentially just the directory names and
-        last modification times. This is not a huge amount of memory.</para>
-
-        <para>If there are no changes to the directories, then the client will
-        not even connect to the server.</para>
-      </section>
-    </section>
-
-    <section>
-      <title>Security</title>
-
-      <para>Box Backup is designed to be secure in several ways. The data
-      stored on the backup store server is encrypted using secret-key
-      cryptography. Additionally, the transport layer is encrypted using TLS,
-      to ensure that the communications can't be snooped.</para>
-
-      <section>
-        <title>Encryption</title>
-
-        <para>The files, directories, filenames and file attributes are all
-        encrypted. By examining the stored files on the server, it is only
-        possible to determine the approximate sizes of a files and the tree
-        structure of the disc (not names, just number of files and
-        subdirectories in a directory). By monitoring the actions performed by
-        a client, it is possible to determine the frequency and approximate
-        scope of changes to files and directories.</para>
-
-        <para>The connections between the server and client are encrypted
-        using TLS (latest version of SSL). Traffic analysis is possible to
-        some degree, but limited in usefulness.</para>
-
-        <para>An attacker will not be able to recover the backed up data
-        without the encryption keys. Of course, you won't be able to recover
-        your files without the keys either, so you must make a conventional,
-        secure, backup of these keys.</para>
-      </section>
-
-      <section>
-        <title>Authentication</title>
-
-        <para>SSL certificates are used to authenticate clients. UNIX user
-        accounts are not used to minimise the dependence on the configuration
-        of the operating system hosting the server.</para>
-
-        <para>A script is provided to run the necessary certification
-        authority with minimal effort.</para>
-      </section>
-    </section>
-
-    <section>
-      <title>Server daemon</title>
-
-      <para>The server daemon is designed to be simple to deploy, and run on
-      the cheapest hardware possible. To avoid the necessity to use expensive
-      hardware RAID or software RAID with complex setup, it (optionally)
-      stores files using RAID techniques.</para>
-
-      <para>It does not need to run as a privileged user.</para>
-
-      <para>Each account has a set amount of disc space allocated, with a soft
-      and a hard limit. If the account exceeds the soft limit, a housekeeping
-      process will start deleting old versions and deleted files to reduce the
-      space used to below the soft limit. If the backup client attempts to
-      upload a file which causes the store to exceed the hard limit, the
-      upload will be refused.</para>
-    </section>
-  </chapter>
-
-  <chapter>
-    <title>Building and installing</title>
-
-    <section>
-      <title>Before you start</title>
-
-      <para>Firstly, check that all the clocks on your clients, servers and
-      signing machines are accurate and in sync. A disagreement in time
-      between a client and a server is the biggest cause of installation
-      difficulties, as the times in the generated certificates will cause
-      login failures if the start date is in the future.</para>
-    </section>
-
-    <section>
-      <title>Box Backup compile</title>
-
-      <para>In the following instructions, replace 0.00 with the actual
-      version number of the archive you have downloaded.</para>
-
-      <para>For help building on Windows, see the <link linkend="AppB">Windows
-      Compile Appendix</link>. And if you want to build a Linux RPM, <link
-      linkend="AppC">look here</link>.</para>
-
-      <para>You need the latest version of OpenSSL, as some of the extra APIs
-      it provides are required. You should have this anyway, as earlier
-      versions have security flaws. (If you have an earlier version installed,
-      the configuration script will give you instructions on enabling
-      experimental support for older versions.)</para>
-
-      <para>See <link linkend="AppA">OpenSSL notes</link> for more information
-      on OpenSSL issues.</para>
-
-      <para>There are some notes in the archive about compiling on various
-      platforms within the boxbackup-0.00 directory -- read them first. For
-      example, if you are compiling under Linux, look for LINUX.txt as
-      boxbackup-0.00/LINUX.txt after untaring the archive.</para>
-
-      <para>Download the archive, then in that directory type</para>
-
-      <programlisting>tar xvzf boxbackup-0.00.tgz
-cd boxbackup-0.00
-./configure
-make</programlisting>
-
-      <para>The server and client will be built and packaged up for
-      installation on this machine, or ready to be transferred as tar files to
-      another machine for installation.</para>
-
-      <para>This builds two parcels of binaries and scripts, 'backup-client'
-      and 'backup-server'. The generated installation scripts assumes you want
-      everything installed in <emphasis
-      role="bold">/usr/local/bin</emphasis></para>
-
-      <para>Optionally, type <emphasis role="bold">make test</emphasis> to run
-      all the tests.</para>
-    </section>
-
-    <section>
-      <title>Local installation</title>
-
-      <para>Type <emphasis role="bold">make install-backup-client</emphasis>
-      to install the backup client.</para>
-
-      <para>Type <emphasis role="bold">make install-backup-server</emphasis>
-      to install the backup server.</para>
-    </section>
-
-    <section>
-      <title>Remote installation</title>
-
-      <para>In the parcels directory, there are tar files for each parcel. The
-      name reflects the version and platform you have built it for.</para>
-
-      <para>Transfer this tar file to the remote server, and unpack it, then
-      run the install script. For example:</para>
-
-      <programlisting>tar xvzf boxbackup-0.00-backup-server-OpenBSD.tgz
-cd boxbackup-0.00-backup-server-OpenBSD
-./install-backup-server</programlisting>
-    </section>
-
-    <section>
-      <title>Configure options</title>
-
-      <para>You can use arguments to the configure script to adjust the
-      compile and link lines in the generated Makefiles, should this be
-      necessary for your platform. The configure script takes the usual GNU
-      autoconf arguments, a full list of which can be obtained with <emphasis
-      role="bold">--help</emphasis>. Additional options for Box Backup
-      include:</para>
-
-      <informaltable>
-        <tgroup cols="2">
-          <tbody>
-            <row>
-              <entry char="-">--enable-gnu-readline</entry>
-
-              <entry>Use GNU readline if present. Linking Box Backup against
-              GNU readline may create licence implications if you then
-              distribute the binaries. libeditline is also supported as a safe
-              alternative, and is used by default if available.</entry>
-            </row>
-
-            <row>
-              <entry>--disable-largefile</entry>
-
-              <entry>Omit support for large files</entry>
-            </row>
-
-            <row>
-              <entry>--with-bdb-dir=DIR</entry>
-
-              <entry>Specify Berkeley DB location</entry>
-            </row>
-
-            <row>
-              <entry>--with-random=FILE</entry>
-
-              <entry>Use FILE as random number seed (normally
-              auto-detected)</entry>
-            </row>
-
-            <row>
-              <entry>--with-tmp-dir=DIR</entry>
-
-              <entry>Directory for temporary files (normally /tmp)</entry>
-            </row>
-          </tbody>
-        </tgroup>
-      </informaltable>
-
-      <para>See <link linkend="AppA">OpenSSL notes</link> for the OpenSSL
-      specific options.</para>
-    </section>
-
-    <section>
-      <title>Tests</title>
-
-      <para>There are a number of unit tests provided. To compile and run one
-      type:</para>
-
-      <programlisting>./runtest.pl bbackupd release
-./runtest.pl common debug
-./runtest.pl ALL</programlisting>
-
-      <para>The runtest.pl script will compile and run the test. The first
-      argument is the test name, and the second the type of build. Use ALL as
-      a test name to run all the tests.</para>
-
-      <para>The output from the tests is slightly muddled using this script.
-      If you're developing, porting or trying out new things, it might be
-      better to use the following scheme:</para>
-
-      <programlisting>cd test/bbackupd
-make
-cd ../../debug/test/bbackupd
-./t</programlisting>
-
-      <para>or in release mode...</para>
-
-      <programlisting>cd test/bbackupd
-make -D RELEASE
-cd ../../release/test/bbackupd
-./t</programlisting>
-
-      <para>(use RELEASE=1 with GNU make)</para>
-
-      <para>I tend to use two windows, one for compilation, and one for
-      running tests.</para>
-    </section>
-  </chapter>
-
-  <appendix>
-    <title id="AppA">Box Backup and SSL</title>
-
-    <section>
-      <title>General notes</title>
-
-      <para>Ideally, you need to use version 0.9.7 or later of OpenSSL. If
-      this is installed on your system by default (and it is on most recent
-      releases of UNIX like OSes) then everything should just work.</para>
-
-      <para>However, if it isn't, you have a few options.</para>
-
-      <section>
-        <title>Upgrade your installation</title>
-
-        <para>The best option is to upgrade your installation to use 0.9.7.
-        Hopefully your package manager will make this easy for you. This may
-        require reinstallation of lots of software which depends on OpenSSL,
-        so may not be ideal.</para>
-
-        <para>(But as there have been a few security flaws in OpenSSL
-        recently, you probably want to upgrade it anyway.)</para>
-      </section>
-
-      <section>
-        <title>Install another OpenSSL</title>
-
-        <para>The second best option is to install another copy. If you
-        download and install from source, it will probably install into
-        /usr/local/ssl. You can then configure Box Backup to use it
-        using:</para>
-
-        <programlisting>./configure --with-ssl-headers=/usr/local/ssl/include --with-ssl-lib=/usr/local/ssl/lib</programlisting>
-
-        <para>which will set up the various includes and libraries for
-        you.</para>
-
-        <para>The configuration scripts may be a problem, depending on your
-        installation. See below for more information.</para>
-      </section>
-
-      <section>
-        <title>Use the old version of OpenSSL</title>
-
-        <para>If you have an old version installed, the configuration script
-        will give you instructions on how to enable support for older
-        versions. Read the warnings, and please, whatever you do, don't
-        release binary packages or ports which enable this option.</para>
-
-        <para>You may have issues with the configuration scripts, see
-        below.</para>
-      </section>
-    </section>
-
-    <section>
-      <title>If you have problems with the config scripts</title>
-
-      <para>If you get OpenSSL related errors with the configuration scripts,
-      there are two things to check:</para>
-
-      <itemizedlist>
-        <listitem>
-          <para>The bin directory within your OpenSSL directory is in the path
-          (if you have installed another version)</para>
-        </listitem>
-
-        <listitem>
-          <para>You have an openssl.cnf file which works and can be
-          found.</para>
-        </listitem>
-      </itemizedlist>
-
-      <section>
-        <title>OpenSSL config file</title>
-
-        <para>You need to have an openssl.cnf file. The default will generally
-        work well (see example at end). Make sure the openssl utility can find
-        it, either set the OPENSSL_CONF environment variable, or install it
-        into the location that is mentioned in the error messages.</para>
-
-        <para>Example OpenSSL config file:</para>
-
-        <programlisting id="openssl.cnf" xreflabel="openssl.cnf">#
-# OpenSSL example configuration file.
-# This is mostly being used for generation of certificate requests.
-# 
-
-RANDFILE                = /dev/arandom
-
-####################################################################
-[ req ]
-default_bits            = 1024
-default_keyfile         = privkey.pem
-distinguished_name      = req_distinguished_name
-attributes              = req_attributes
-
-[ req_distinguished_name ]
-countryName                     = Country Name (2 letter code)
-#countryName_default            = AU
-countryName_min                 = 2
-countryName_max                 = 2
-
-stateOrProvinceName             = State or Province Name (full name)
-#stateOrProvinceName_default    = Some-State
-
-localityName                    = Locality Name (eg, city)
-
-0.organizationName              = Organization Name (eg, company)
-#0.organizationName_default     = Internet Widgits Pty Ltd
-
-# we can do this but it is not needed normally :-)
-#1.organizationName             = Second Organization Name (eg, company)
-#1.organizationName_default     = CryptSoft Pty Ltd
-
-organizationalUnitName          = Organizational Unit Name (eg, section)
-#organizationalUnitName_default =
-
-commonName                      = Common Name (eg, fully qualified host name)
-commonName_max                  = 64
-
-emailAddress                    = Email Address
-emailAddress_max                = 64
-
-[ req_attributes ]
-challengePassword               = A challenge password
-challengePassword_min           = 4
-challengePassword_max           = 20
-
-unstructuredName                = An optional company name
-
-[ x509v3_extensions ]
-
-nsCaRevocationUrl               = http://www.cryptsoft.com/ca-crl.pem
-nsComment                       = "This is a comment"
-
-# under ASN.1, the 0 bit would be encoded as 80
-nsCertType                      = 0x40</programlisting>
-      </section>
-    </section>
-  </appendix>
-
-  <appendix>
-    <title id="AppB">Compiling bbackupd on Windows using Visual C++</title>
-
-    <para>This Appendix explains how to build the bbackupd daemon for Windows
-    using the Visual C++ compiler.</para>
-
-    <para>If you have any problems following these instructions, please sign
-    up to the <ulink
-    url="http://lists.warhead.org.uk/mailman/listinfo/boxbackup">mailing
-    lis</ulink>t and report them to us, or send an email to <ulink
-    url="mailto:bbwiki at qwirx.com">Chris Wilson</ulink>. Thanks!</para>
-
-    <para><emphasis role="bold">Note</emphasis>: bbstored will not be built
-    with this process. bbstored is not currently supported on Windows. There
-    are no plans for bbstored support on Windows.</para>
-
-    <section>
-      <title>Tools</title>
-
-      <para>You will need quite a bit of software to make this work. All of it
-      is available for free on the Internet, although Visual C++ Express has
-      license restrictions and a time limit.</para>
-
-      <section>
-        <title>Visual C++</title>
-
-        <para>Microsoft's Visual C++ compiler and development environment are
-        part of their commercial product <ulink
-        url="http://msdn.microsoft.com/vstudio/">Visual Studio</ulink>. Visual
-        Studio 2005 is supported, and 2003 should work as well.</para>
-
-        <para>You can also <ulink
-        url="http://msdn.microsoft.com/vstudio/express/visualc/download/">download</ulink>
-        a free copy of Visual C++ 2005 Express. This copy must be registered
-        (activated) within 30 days, and is free for one year.</para>
-
-        <para>You will need the <ulink
-        url="http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/">Platform
-        SDK</ulink> to allow you to compile Windows applications.</para>
-      </section>
-
-      <section>
-        <title>Perl</title>
-
-        <para>Download and install <ulink
-        url="http://www.activestate.com/Products/ActivePerl/">ActivePerl for
-        Windows</ulink>, which you can probably find <ulink
-        url="http://downloads.activestate.com/ActivePerl/Windows/5.6/ActivePerl-5.6.1.638-MSWin32-x86.msi">here</ulink>.</para>
-      </section>
-
-      <section>
-        <title>Libraries</title>
-
-        <para>You will need to download and install several libraries. They
-        must all be built in the same directory, to be able to link
-        properly.</para>
-
-        <para>Choose a directory where you will unpack and compile OpenSSL,
-        Zlib and Box Backup. We will call this the base directory. An example
-        might be:</para>
-
-        <programlisting>C:\Documents and Settings\Your Username\Desktop\Box</programlisting>
-
-        <para>Make sure you know the full path to this directory.</para>
-
-        <section>
-          <title>OpenSSL</title>
-
-          <para>You will need to compile OpenSSL using Visual C++. The latest
-          release at this time, OpenSSL 0.9.8a, does not compile with Visual
-          C++ 2005 out of the box, so you need <ulink
-          url="http://bbdev.fluffy.co.uk/svn/box/chris/win32/support/openssl-0.9.8a-vc2005.zip">a
-          patched version</ulink>. The <ulink
-          url="http://www.openssl.org/source/openssl-0.9.8a.tar.gz">original
-          source</ulink> and <ulink
-          url="http://bbdev.fluffy.co.uk/svn/box/chris/win32/support/openssl-0.9.8a-win32fix.patch">patch</ulink>
-          are also available.</para>
-
-          <para>To compile OpenSSL:</para>
-
-          <itemizedlist>
-            <listitem>
-              <para>Use a Windows unzipper such as <ulink
-              url="http://www.winzip.com/">WinZip (free trial)</ulink> to
-              extract the <emphasis
-              role="bold">openssl-0.9.8a-vc2005.tar.gz</emphasis> archive,
-              which you just downloaded, into the base directory.</para>
-            </listitem>
-
-            <listitem>
-              <para>Rename the folder from <emphasis
-              role="bold">openssl-0.9.8a-vc2005</emphasis> to <emphasis
-              role="bold">openssl</emphasis></para>
-            </listitem>
-
-            <listitem>
-              <para>Open a command shell (run <emphasis
-              role="bold">cmd.exe</emphasis>) and <emphasis
-              role="bold">cd</emphasis> to the openssl directory</para>
-            </listitem>
-
-            <listitem>
-              <para>Run the following commands:</para>
-
-              <programlisting>perl Configure VC-WIN32
-ms\do_ms
-"c:\program files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
-nmake -f ms\ntdll.mak</programlisting>
-            </listitem>
-          </itemizedlist>
-        </section>
-
-        <section>
-          <title>Zlib</title>
-
-          <para>You will need to download the <ulink
-          url="http://www.zlib.net/zlib123-dll.zip">Zlib compiled DLL</ulink>.
-          Create a directory called <emphasis role="bold">zlib</emphasis> in
-          the base directory, and unzip the file you just downloaded into that
-          directory. You don't need to compile anything.</para>
-        </section>
-      </section>
-
-      <section>
-        <title>Download Box Backup</title>
-
-        <para>The first version of Box Backup that's known to compile and with
-        Visual C++ 2005 is available on the <ulink
-        url="http://bbdev.fluffy.co.uk/svn/box/chris/win32/vc2005-compile-fixes/">Subversion
-        server</ulink>. However, this version has not been extensively tested
-        and may be out of date.</para>
-
-        <para>The changes are expected to be merged into the <ulink
-        url="http://bbdev.fluffy.co.uk/svn/box/trunk">Subversion trunk</ulink>
-        at some point, and this page should then be updated. If in doubt,
-        please sign up to the <ulink
-        url="http://lists.warhead.org.uk/mailman/listinfo/boxbackup">mailing
-        list</ulink> and ask us.</para>
-
-        <para>To get the source code out of Subversion you will need a <ulink
-        url="http://subversion.tigris.org/files/documents/15/25364/svn-1.2.3-setup.exe">Subversion
-        client for Windows</ulink>. After installing it, open a new command
-        prompt, go to the base directory, and type:</para>
-
-        <programlisting>svn co http://bbdev.fluffy.co.uk/svn/box/chris/win32/vc2005-compile-fixes/ boxbackup</programlisting>
-
-        <para>This should create a directory called <emphasis
-        role="bold">boxbackup</emphasis> inside the base directory.</para>
-      </section>
-
-      <section>
-        <title>Configure Box Backup</title>
-
-        <para>Open a command prompt, change to the base directory then
-        <emphasis role="bold">boxbackup</emphasis>, and run <emphasis
-        role="bold">win32.bat</emphasis> to configure the sources. Otherwise,
-        Visual C++ will complain about missing files whose names start with
-        <emphasis role="bold">autogen</emphasis>, and missing <emphasis
-        role="bold">config.h</emphasis>.</para>
-      </section>
-
-      <section>
-        <title>Compile Box Backup</title>
-
-        <para>Open Visual C++. Choose "File/Open/Project", navigate to the
-        base directory, then to <emphasis
-        role="bold">boxbackup\infrastructure\msvc\2005</emphasis> (or
-        <emphasis role="bold">2003</emphasis> if using Visual Studio 2003),
-        and open any project or solution file in that directory.</para>
-
-        <para>Press F7 to compile Box Backup. If the compilation is
-        successful, <emphasis
-        role="bold">boxbackup\Debug\bbackupd.exe</emphasis> will be
-        created.</para>
-      </section>
-
-      <section>
-        <title>Install Box Backup</title>
-
-        <para>Create the destination directory, <emphasis
-        role="bold">C:\Program Files\Box Backup\bbackupd</emphasis>.</para>
-
-        <para>Write a configuration file, keys and certificate on a Unix
-        machine, and copy them into the <emphasis role="bold">Box
-        Backup</emphasis> directory, together with the following files from
-        the base directory:</para>
-
-        <itemizedlist>
-          <listitem>
-            <para>boxbackup\Debug\bbackupd.exe</para>
-          </listitem>
-
-          <listitem>
-            <para>openssl\out32dll\libeay32.dll</para>
-          </listitem>
-
-          <listitem>
-            <para>openssl\out32dll\ssleay32.dll</para>
-          </listitem>
-
-          <listitem>
-            <para>zlib\zlib1.dll</para>
-          </listitem>
-        </itemizedlist>
-
-        <para>Ensure that the user running Box Backup can read from the
-        <emphasis role="bold">Box Backup</emphasis> directory, and write to
-        the <emphasis role="bold">bbackupd</emphasis> directory inside
-        it.</para>
-
-        <para>Run Box Backup by double-clicking on it, and check that it
-        connects to the server. If the window opens and closes immediately,
-        it's probably due to a problem with the configuration file - check the
-        Windows Event Viewer for details.</para>
-      </section>
-
-      <section>
-        <title>Windows Service</title>
-
-        <para>Box Backup can also run as a Windows service, in which case it
-        will be automatically started at boot time in the background. To
-        install this, open a command prompt, and run:</para>
-
-        <programlisting>cd "C:\Program Files\Box Backup"
-bbackupd.exe -i</programlisting>
-
-        <para>This should output Box Backup service installed.</para>
-      </section>
-    </section>
-  </appendix>
-
-  <appendix>
-    <title id="AppC">Compilation and installation by building an RPM on
-    Linux</title>
-
-    <para>It is very easy to build an RPM of Box Backup on Linux platforms.
-    This should work on all Red Hat distributions (including Fedora), SuSE,
-    and probably others too.</para>
-
-    <para>Given that you have the correct development packages installed
-    simply execute this command (replacing the version number):</para>
-
-    <programlisting>rpmbuild -ta boxbackup-0.00.tgz</programlisting>
-
-    <para>rpmbuild will report where the packages have been written to, and
-    these can be installed in the normal manner.</para>
-
-    <para>If you have never built an RPM before you should set up a convenient
-    build area as described in the <ulink
-    url="http://www.rpm.org/max-rpm/s1-rpm-anywhere-different-build-area.html">RPM
-    book</ulink>.</para>
-
-    <para>If you wish to customise the package you can find the spec file in
-    the contrib/rpm directory.</para>
-  </appendix>
-</book>
\ No newline at end of file

Copied: box/chris/boxi/documentation/boxbackup/instguide.xml (from rev 547, box/trunk/documentation/boxbackup/instguide.xml)


Property changes on: box/chris/boxi/infrastructure
___________________________________________________________________
Name: svn:ignore
   - BoxPlatform.pm

   + BoxPlatform.pm
makebuildenv.pl
makeparcels.pl


Modified: box/chris/boxi/infrastructure/BoxPlatform.pm.in
===================================================================
--- box/chris/boxi/infrastructure/BoxPlatform.pm.in	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/BoxPlatform.pm.in	2006-03-25 09:11:46 UTC (rev 548)
@@ -13,14 +13,15 @@
 	chomp $build_cpu;
 	# Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1
 	# Box Backup tried on Win2000,XP only :)
-	
-    $build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/;
 
+	$build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/;
+
 	$make_command = ($build_os eq 'Darwin') ? 'bsdmake' : ($build_os eq 'SunOS') ? 'gmake' : 'make';
 	$bsd_make = ($build_os ne 'Linux' && $build_os ne 'CYGWIN' && $build_os ne "SunOS");
 
 	# blank extra flags by default
 	$platform_compile_line_extra = '@CPPFLAGS@ @CXXFLAGS@ @CXXFLAGS_STRICT@';
+	$platform_compile_line_extra =~ s/ -O2//;
 	$platform_link_line_extra = '@LDFLAGS@';
 	$platform_lib_files = '@LIBS@';
 	$target_os = '@target_os@';
@@ -33,10 +34,31 @@
 	$product_name = <VERSION>;
 	chomp $product_name;
 	close VERSION;
-	
+	if($product_version eq 'USE_SVN_VERSION')
+	{
+		# for developers, use SVN version
+		my $svnversion = `svnversion .`;
+		chomp $svnversion;
+		$svnversion =~ tr/0-9A-Za-z/_/c;
+		open INFO,'svn info . |';
+		my $svnurl;
+		while(<INFO>)
+		{
+			if(m/^URL: (.+?)[\n\r]+/)
+			{
+				$svnurl = $1
+			}
+		}
+		close INFO;
+		$svnurl =~ m!box/(.+)$!;
+		my $svndir = $1;
+		$svndir =~ tr/0-9A-Za-z/_/c;
+		$product_version = $svndir.'_'.$svnversion;
+	}
+
 	# where to put the files
-	$install_into_dir = '@bindir@';
-	
+	$install_into_dir = '@bindir_expanded@';
+
 	# if it's Darwin,
 	if($build_os eq 'Darwin')
 	{
@@ -51,7 +73,7 @@
 		# test for fink installation
 		if(-d '/sw/include' && -d '/sw/lib')
 		{
-			print "Fink installation detected, will use headers and libraries\n";
+			print "Fink installation detected, will use headers and libraries\n\n\n";
 			$platform_compile_line_extra = '-I/sw/include ';
 			$platform_link_line_extra = '-L/sw/lib ';
 		}

Copied: box/chris/boxi/infrastructure/m4/ax_bswap64.m4 (from rev 547, box/trunk/infrastructure/m4/ax_bswap64.m4)

Modified: box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4
===================================================================
--- box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/m4/ax_check_mount_point.m4	2006-03-25 09:11:46 UTC (rev 548)
@@ -10,6 +10,7 @@
 dnl HAVE_STRUCT_MNTENT_MNT_DIR
 dnl HAVE_STRUCT_MNTTAB_MNT_MOUNTP
 dnl HAVE_STRUCT_STATFS_F_MNTONNAME
+dnl HAVE_STRUCT_STATVFS_F_MNTONNAME
 dnl Also ACTION-IF-TRUE and ACTION-IF-FALSE are run as appropriate
 dnl
 dnl @category C
@@ -33,6 +34,13 @@
     #endif
     #include <sys/mount.h>
     ]])
+  # NetBSD
+  AC_CHECK_MEMBERS([struct statvfs.f_mntonname],,, [[
+    #ifdef HAVE_SYS_PARAM_H
+      #include <sys/param.h>
+    #endif
+    #include <sys/mount.h>
+    ]])
   # Linux
   AC_CHECK_MEMBERS([struct mntent.mnt_dir],,, [[#include <mntent.h>]])
   # Solaris
@@ -41,6 +49,7 @@
     #include <sys/mnttab.h>
     ]])
   if test "x$ac_cv_member_struct_statfs_f_mntonname" = "xyes" || \
+     test "x$ac_cv_member_struct_statvfs_f_mntonname" = "xyes" || \
      test "x$ac_cv_member_struct_mntent_mnt_dir" = "xyes" || \
      test "x$ac_cv_member_struct_mnttab_mnt_mountp" = "xyes"
   then

Modified: box/chris/boxi/infrastructure/m4/ax_check_ssl.m4
===================================================================
--- box/chris/boxi/infrastructure/m4/ax_check_ssl.m4	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/m4/ax_check_ssl.m4	2006-03-25 09:11:46 UTC (rev 548)
@@ -19,15 +19,18 @@
   AC_ARG_WITH(
     [ssl-headers],
     [AC_HELP_STRING([--with-ssl-headers=DIR], [SSL include files location])],
-    [CPPFLAGS="$CPPFLAGS -I$withval"])
+    [ CPPFLAGS="$CPPFLAGS -I$withval"
+      ax_check_ssl_headers="--with-ssl-headers=\"$withval\"" ])
   AC_ARG_WITH(
     [ssl-lib],
     [AC_HELP_STRING([--with-ssl-lib=DIR], [SSL library location])],
-    [LDFLAGS="$LDFLAGS -L$withval"])
+    [ LDFLAGS="$LDFLAGS -L$withval" 
+      ax_check_ssl_lib="--with-ssl-lib=\"$withval\"" ])
 
   ax_check_ssl_found=yes
   AC_CHECK_HEADERS([openssl/ssl.h],, [ax_check_ssl_found=no])
-  AC_CHECK_LIB([ssl], [SSL_read],, [ax_check_ssl_found=no], [-lcrypto])
+  AC_CHECK_LIB([ssl],    [SSL_read],, [ax_check_ssl_found=no], [-lcrypto])
+  AC_CHECK_LIB([crypto], [BIO_read],, [ax_check_ssl_found=no])
 
   if test "x$ax_check_ssl_found" = "xyes"; then
     AC_DEFINE([HAVE_SSL], 1, [Define to 1 if SSL is available])

Copied: box/chris/boxi/infrastructure/m4/ax_config_scripts.m4 (from rev 547, box/trunk/infrastructure/m4/ax_config_scripts.m4)

Modified: box/chris/boxi/infrastructure/m4/ax_path_bdb.m4
===================================================================
--- box/chris/boxi/infrastructure/m4/ax_path_bdb.m4	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/m4/ax_path_bdb.m4	2006-03-25 09:11:46 UTC (rev 548)
@@ -163,7 +163,11 @@
     AC_PREPROC_IFELSE([
       AC_LANG_SOURCE([[
 #include <db.h>
+#ifdef DB_VERSION_MAJOR
 AX_PATH_BDB_STUFF DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH
+#else
+AX_PATH_BDB_STUFF 1,0,0
+#endif
       ]])
     ],[
       # Extract version from preprocessor output.
@@ -360,8 +364,9 @@
 #include <db.h>
 int main(int argc,char **argv)
 {
+  (void) argv;
+#ifdef DB_VERSION_MAJOR
   int major,minor,patch;
-  (void) argv;
   db_version(&major,&minor,&patch);
   if (argc > 1)
     printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH);
@@ -370,6 +375,16 @@
     return 0;
   else
     return 1;
+#else
+  DB *dbp = dbopen(0, 0, 0, DB_HASH, 0);
+  if(dbp) dbp->close(dbp);
+  if (argc > 1)
+    printf("1.0.0\n");
+  if (dbp)
+    return 0;
+  else
+    return 1;
+#endif
 }
       ]])
     ],[
@@ -420,8 +435,9 @@
 #include <db.h>
 int main(int argc,char **argv)
 {
+  (void) argv;
+#ifdef DB_VERSION_MAJOR
   int major,minor,patch;
-  (void) argv;
   db_version(&major,&minor,&patch);
   if (argc > 1)
     printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH);
@@ -430,6 +446,16 @@
     return 0;
   else
     return 1;
+#else
+  DB *dbp = dbopen(0, 0, 0, DB_HASH, 0);
+  if(dbp) dbp->close(dbp);
+  if (argc > 1)
+    printf("1.0.0\n");
+  if (dbp)
+    return 0;
+  else
+    return 1;
+#endif
 }
     ]])
   ],[
@@ -483,7 +509,11 @@
 {
   (void) argv;
   if (argc > 1)
+#ifdef DB_VERSION_MAJOR
     printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH);
+#else
+    printf("1.0.0\n");
+#endif
   return 0;
 }
     ]])

Modified: box/chris/boxi/infrastructure/m4/vl_lib_readline.m4
===================================================================
--- box/chris/boxi/infrastructure/m4/vl_lib_readline.m4	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/m4/vl_lib_readline.m4	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,4 +1,4 @@
-dnl @synopsis VL_LIB_READLINE
+dnl @synopsis VL_LIB_READLINE([ACTION-IF-TRUE], [ACTION-IF-FALSE])
 dnl
 dnl Searches for a readline compatible library. If found, defines
 dnl `HAVE_LIBREADLINE'. If the found library has the `add_history'
@@ -46,6 +46,8 @@
 dnl Modifications to add --enable-gnu-readline to work around licensing
 dnl problems between the traditional BSD licence and the GPL.
 dnl Martin Ebourne, 2005/7/11
+dnl Rewrite to match headers with libraries and be more selective.
+dnl Martin Ebourne, 2006/1/4
 dnl
 dnl @category InstalledPackages
 dnl @author Ville Laurikari <vl at iki.fi>
@@ -56,16 +58,34 @@
   AC_ARG_ENABLE(
     [gnu-readline],
     AC_HELP_STRING([--enable-gnu-readline],
-                   [Allow use of GNU readline (may violate GNU licence)])
+                   [Use GNU readline if present (may violate GNU licence)])
   )
-  vl_gnu_readline_lib=""
+  vl_cv_lib_readline_compat_found=no
   if test "x$enable_gnu_readline" = "xyes"; then
-    vl_gnu_readline_lib=readline
+    VL_LIB_READLINE_CHECK([readline],
+                          [readline],
+                          [readline/readline.h readline.h],
+                          [readline/history.h history.h])
   fi
-  AC_CACHE_CHECK([for a readline compatible library],
-                 vl_cv_lib_readline, [
+  if test "x$vl_cv_lib_readline_compat_found" = "xno"; then
+    VL_LIB_READLINE_CHECK([editline],
+                          [edit editline],
+	  		  [editline/readline.h],
+			  [editline/readline.h])
+  fi
+  if test "x$vl_cv_lib_readline_compat_found" = "xyes"; then
+    m4_ifvaln([$1],[$1],[:])dnl
+    m4_ifvaln([$2],[else $2])dnl
+  fi
+])
+
+dnl VL_LIB_READLINE_CHECK(name, libraries, headers, history headers)
+AC_DEFUN([VL_LIB_READLINE_CHECK], [
+  AC_CACHE_CHECK([for $1 library],
+                 [vl_cv_lib_$1], [
     ORIG_LIBS="$LIBS"
-    for readline_lib in edit editline $vl_gnu_readline_lib; do
+    vl_cv_lib_$1=""
+    for readline_lib in $2; do
       for termcap_lib in "" termcap curses ncurses; do
         if test -z "$termcap_lib"; then
           TRY_LIB="-l$readline_lib"
@@ -73,34 +93,43 @@
           TRY_LIB="-l$readline_lib -l$termcap_lib"
         fi
         LIBS="$ORIG_LIBS $TRY_LIB"
-        AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB")
-        if test -n "$vl_cv_lib_readline"; then
+        AC_TRY_LINK_FUNC([readline], [vl_cv_lib_$1="$TRY_LIB"])
+        if test -n "$vl_cv_lib_$1"; then
           break
         fi
       done
-      if test -n "$vl_cv_lib_readline"; then
+      if test -n "$vl_cv_lib_$1"; then
         break
       fi
     done
-    if test -z "$vl_cv_lib_readline"; then
-      vl_cv_lib_readline="no"
+    if test -z "$vl_cv_lib_$1"; then
+      vl_cv_lib_$1=no
       LIBS="$ORIG_LIBS"
     fi
   ])
 
-  if test "x$vl_cv_lib_readline" != "xno"; then
-    AC_DEFINE(HAVE_LIBREADLINE, 1,
+  vl_cv_lib_readline_compat_found=no
+  if test "x$vl_cv_lib_$1" != "xno"; then
+    AC_CHECK_HEADERS([$3], [vl_cv_lib_readline_compat_found=yes])
+  fi
+
+  if test "x$vl_cv_lib_readline_compat_found" = "xyes"; then
+    AC_DEFINE([HAVE_LIBREADLINE], 1,
               [Define if you have a readline compatible library])
-    AC_CHECK_HEADERS(readline.h readline/readline.h)
-    AC_CACHE_CHECK([whether readline supports history],
-                   vl_cv_lib_readline_history, [
-      vl_cv_lib_readline_history="no"
-      AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
+
+    AC_CACHE_CHECK([whether $1 supports history],
+                   [vl_cv_lib_$1_history], [
+      vl_cv_lib_$1_history=no
+      AC_TRY_LINK_FUNC([add_history], [vl_cv_lib_$1_history=yes])
     ])
-    if test "x$vl_cv_lib_readline_history" = "xyes"; then
-      AC_DEFINE(HAVE_READLINE_HISTORY, 1,
-                [Define if your readline library has \`add_history'])
-      AC_CHECK_HEADERS(history.h readline/history.h)
+    if test "x$vl_cv_lib_$1_history" = "xyes"; then
+      vl_cv_lib_$1_history=no
+      AC_CHECK_HEADERS(
+        [$4],
+	[AC_DEFINE([HAVE_READLINE_HISTORY], [1],
+                   [Define if your readline library has add_history])])
     fi
+  else
+    LIBS="$ORIG_LIBS"
   fi
 ])dnl

Deleted: box/chris/boxi/infrastructure/makebuildenv.pl
===================================================================
--- box/chris/boxi/infrastructure/makebuildenv.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/makebuildenv.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,796 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use Symbol;
-
-my @modules;
-my %module_dependency;
-my %module_library_link_opts;
-my %header_dependency;
-
-$|=1;
-
-
-# note: Mac OS X resource forks and .DS_Store files are explicity ignored
-
-print "Box build environment setup.\n\n";
-
-
-my $implicit_dep = 'lib/common';
-
-# work out platform variables
-use lib 'infrastructure';
-use BoxPlatform;
-
-# keep copy of command line args
-my $makebuildenv_args = join(' ', at ARGV);
-
-# do command line arguments
-my $compile_line_extra = $platform_compile_line_extra;
-my $link_line_extra = $platform_link_line_extra;
-
-# make sure local files directory exists
-unless(-d 'local')
-{
-	mkdir 'local',0755;
-}
-
-
-# flags about the environment
-my %env_flags;
-
-# print "Flag: $_\n" for(keys %env_flags);
-
-# seed autogen code
-print "Seeding autogen code...\n";
-open FINDAUTOGEN,"find . -follow -name Makefile.extra |" or die "Can't use find for locating files";
-while(<FINDAUTOGEN>)
-{
-	chomp;
-	my $file = $_;
-	$file =~ m~\A(.+)/[^/]+\Z~;
-	my $dir = $1;
-	open FL,$file or die "Can't open $_ for reading";
-	my %vars;
-	my $do_cmds = 0;
-	while(<FL>)
-	{
-		chomp;
-		if(m/\A(.+)\s+=\s+(.+)\Z/)
-		{
-			# is a variable
-			$vars{$1} = $2;
-			next;
-		}
-		next unless m/\S/;
-		if(m/AUTOGEN SEEDING/)
-		{
-			$do_cmds = 1;
-		}
-		elsif(m/\A\S/)
-		{
-			$do_cmds = 0 if $do_cmds == 2;
-		}
-		else
-		{
-			# command, run it?
-			if($do_cmds)
-			{
-				$do_cmds = 2; # flag something has been done
-				
-				# subsitute variables, repeatedly
-				my $c = $_;
-				$c =~ s/\A\s+//;
-				while(1)
-				{
-					my $did_subst = 0;
-					
-					for my $k (keys %vars)
-					{
-						$did_subst = 1 if $c =~ s/\$\($k\)/$vars{$k}/g;
-					}
-					
-					last unless $did_subst;
-				}
-				
-				# run command
-				die "Couldn't run command $c" unless (0 == system("(cd $dir; $c)"))
-			}
-		}
-	}
-	close FL;
-}
-close FINDAUTOGEN;
-print "done\n\n";
-
-
-# open test mail program template file
-my $test_template_file = 'infrastructure/buildenv-testmain-template.cpp';
-open FL,$test_template_file or die "Can't open test template file\n";
-my $test_template;
-read FL,$test_template,-s $test_template_file;
-close FL;
-
-
-# extra platform defines
-my $extra_platform_defines = '';
-
-# read in module definitions file, and any files it includes
-my @modules_files;
-sub read_modules_file
-{
-	my ($mf) = @_;
-	my $f = gensym;
-	open $f,$mf or die "Can't open modules file '$mf'\n";
-	while(<$f>)
-	{
-		if(m/\AINCLUDE\s+(\S+)\Z/)
-		{
-			# include another file
-			read_modules_file($1)
-		}
-		else
-		{
-			push @modules_files,$_
-		}
-	}
-	close $f;
-}
-read_modules_file('modules.txt');
-
-# prepare directories...
-mkdir "release",0755;
-mkdir "debug",0755;
-
-# is the library code in another directory?
-my $external_lib = readlink('lib');
-if($external_lib ne '')
-{
-	# adjust to root of the library distribution
-	$external_lib =~ s!/lib\Z!!;
-	$external_lib = '../'.$external_lib;
-	# make symlinks
-	make_obj_symlink('debug');
-	make_obj_symlink('release');
-}
-sub make_obj_symlink
-{
-	my $m = $_[0];
-	my $target = $external_lib."/$m/lib/";
-	my $link = "$m/lib";
-	# check link
-	if(-e $link)
-	{
-		if(-l $link)
-		{
-			if(readlink($link) ne $target)
-			{
-				print "Warning: replacing $link with new link to $target\n";
-				unlink $link;
-			}
-		}
-		else
-		{
-			die "$link already exists, but it isn't a symbolic link"
-		}
-	}
-	if(!-e $link)
-	{
-		symlink $target,$link or die "Can't make $m/lib symlink";
-	}
-}
-
-print "Scanning code...\n";
-
-my $modules_omitted = 0;
-my $modules_omitting = 0;
-
-# process lines in flattened modules files
-for(@modules_files)
-{
-	# clean up line
-	chomp; s/\A\s+//; s/#.*\Z//; s/\s+\Z//; s/\s+/ /g;
-	next unless m/\S/;
-	
-	# omit bits on some platforms?
-	if(m/\AEND-OMIT/)
-	{
-		$modules_omitting = 0;
-		next;
-	}
-
-	next if $modules_omitting;
-
-	if(m/\AOMIT:(.+)/)
-	{
-		if($1 eq $build_os or $1 eq $target_os)
-		{
-			$modules_omitted = 1;
-			$modules_omitting = 1;
-		}
-		next;
-	}
-	
-	# split up...
-	my ($mod, @deps_i) = split / /;
-	
-	# ignore this module?
-	next if ignore_module($mod);
-	
-	# deps for this platform
-	my @deps;
-	for(@deps_i)
-	{
-		my ($dep,$exclude_from) = split /!/;
-		# generic library translation
-		$dep = $env_flags{'LIBTRANS_'.$dep} if exists($env_flags{'LIBTRANS_'.$dep});
-		next if $dep eq '';
-		if($exclude_from =~ m/\A\+(.+)\Z/)
-		{
-			$exclude_from = $1;
-			my $inc = 0;
-			for(split /,/,$exclude_from)
-			{
-				$inc = 1 if $_ eq $build_os
-			}
-			push @deps,$dep if $inc
-		}
-		else
-		{
-			my $inc = 1;
-			for(split /,/,$exclude_from)
-			{
-				$inc = 0 if $_ eq $build_os
-			}
-			push @deps,$dep if $inc
-		}
-	}
-	
-	# check directory exists
-	die "Module $mod can't be found\n" unless -d $mod;
-	
-	# and put in lists
-	push @modules,$mod;
-	my @md;	# module dependencies
-	my @lo; # link line options
-	for(@deps)
-	{
-		if(/\A-l/)
-		{
-			push @lo,$_
-		}
-		else
-		{
-			push @md,$_ unless ignore_module($_)
-		}
-	}
-	$module_dependency{$mod} = [$implicit_dep, at md];
-	$module_library_link_opts{$mod} = [@lo];
-	
-	# make directories, but not if we're using an external library and this a library module
-	my ($s,$d) = split /\//,$mod;
-	if($s ne 'lib' || $external_lib eq '')
-	{
-		mkdir "release/$s",0755;
-		mkdir "release/$s/$d",0755;
-		mkdir "debug/$s",0755;
-		mkdir "debug/$s/$d",0755;
-	}
-}
-
-# make dirs for implicit dep
-mkdir "release/$implicit_dep",0755;
-mkdir "debug/$implicit_dep",0755;
-
-# write a list of all the modules we've configured to use
-open CONFIGURED_MODS,'>local/modules.h' or die "Can't write configured modules list";
-print CONFIGURED_MODS <<__E;
-// automatically generated file, do not edit
-#ifndef _CONFIGURED_MODULES__H
-#define _CONFIGURED_MODULES__H
-__E
-for($implicit_dep, at modules)
-{
-	my $m = $_;
-	$m =~ s~/~_~;
-	print CONFIGURED_MODS "#define MODULE_$m\n";
-}
-print CONFIGURED_MODS <<__E;
-#endif // _CONFIGURED_MODULES__H
-__E
-close CONFIGURED_MODS;
-
-
-# now make a list of all the .h files we can find, recording which module they're in
-my %hfiles;
-for my $mod (@modules, $implicit_dep)
-{
-	opendir DIR,$mod;
-	my @items = readdir DIR;
-	closedir DIR;
-
-	# add in items from autogen directories, and create output directories
-	{
-		my @autogen_items;
-		
-		for my $di (@items)
-		{
-			if($di =~ m/\Aautogen/ && -d "$mod/$di")
-			{
-				# Read items
-				my $d = "$mod/$di";
-				opendir DIR,$d;
-				my @i = readdir DIR;
-				closedir DIR;
-				for(@i)
-				{
-					next if m/\A\./;
-					push @autogen_items,"$di/$_"
-				}
-			}
-		}
-		@items = (@items, @autogen_items);
-	}
-
-	for(grep /\.h\Z/i, @items)
-	{
-		next if /\A\._/;	# Temp Mac OS Resource hack
-		die "Header file $_ already used in module ".$hfiles{$_}."\n" if exists $hfiles{$_};
-		$hfiles{$_} = $mod
-	}
-}
-
-for my $mod (@modules, $implicit_dep)
-{
-	opendir DIR,$mod;
-	for my $h (grep /\.h\Z/i, readdir DIR)
-	{	
-		next if /\A\._/;	# Temp Mac OS Resource hack
-
-		open FL,"$mod/$h" or die "can't open $mod/$h";
-		my $f;
-		read FL,$f,-s "$mod/$h";
-		close FL;
-
-		while($f =~ m/\#include\s+"([^"]+?)"/g)
-		{
-			my $i = $1;
-			# ignore autogen exceptions
-			next if $i =~ m/\Aautogen_.+?Exception.h\Z/;
-			# record dependency
-			${$header_dependency{$h}}{$i} = 1 if exists $hfiles{$i};
-		}
-	}
-	closedir DIR;
-}
-
-print "done\n\nGenerating Makefiles...\n";
-
-
-# Then write a makefile for each module
-for my $mod (@modules, $implicit_dep)
-{
-	print $mod,"\n";
-	
-	my ($type,$name) = split /\//,$mod;
-	
-	# add additional files for tests
-	if($type eq 'test')
-	{
-		my $testmain = $test_template;
-		$testmain =~ s/TEST_NAME/$name/g;
-		open TESTMAIN,">$mod/_main.cpp" or die "Can't open test main file for $mod for writing\n";
-		print TESTMAIN $testmain;
-		close TESTMAIN;
-		
-		# test file...
-		sub writetestfile
-		{
-			my ($filename,$runcmd,$module) = @_;		
-			open TESTFILE,">$filename" or die "Can't open test script file for $module for writing\n";
-			print TESTFILE "#!/bin/sh\necho TEST: $module\n";
-			if(-d "$module/testfiles")
-			{
-				print TESTFILE <<__E;
-echo Removing old test files...
-rm -rf testfiles
-echo Copying new test files...
-cp -p -R ../../../$module/testfiles .
-__E
-			}
-			if(-e "$module/testextra")
-			{
-				open FL,"$module/testextra" or die "Can't open $module/testextra";
-				while(<FL>) {print TESTFILE}
-				close FL;
-			}
-			print TESTFILE "$runcmd\n";
-			close TESTFILE;
-		}
-		
-		writetestfile("$mod/_t", 
-			'./test' . $platform_exe_ext . '$1 $2 $3 $4 $5', $mod);
-		writetestfile("$mod/_t-gdb", 
-			'gdb ./test ' . $platform_exe_ext, $mod);
-		
-	}
-	
-	my @all_deps_for_module;
-	{
-		# work out what dependencies need to be run
-		my @deps_raw;
-		sub add_mod_deps
-		{
-			my ($arr_r,$nm) = @_;
-			if($#{$module_dependency{$nm}} >= 0)
-			{
-				push @$arr_r,@{$module_dependency{$nm}};
-				for(@{$module_dependency{$nm}})
-				{
-					add_mod_deps($arr_r,$_)
-				}
-			}
-		}
-		add_mod_deps(\@deps_raw, $mod);
-		# and then dedup and reorder them
-		my %d_done;
-		for(my $a = $#deps_raw; $a >= 0; $a--)
-		{
-			if(!exists $d_done{$deps_raw[$a]})
-			{
-				# insert
-				push @all_deps_for_module, $deps_raw[$a];
-				# mark as done
-				$d_done{$deps_raw[$a]} = 1;
-			}
-		}
-	}	
-	
-
-	# make include path
-	my $include_paths = "-I../../lib/win32 " .
-		join(' ',map {'-I../../'.$_} @all_deps_for_module);
-
-	# is target a library?
-	my $target_is_library = ($type ne 'bin' && $type ne 'test');
-
-	# make target name
-	my $end_target = $name;
-
-	if ($target_is_library)
-	{
-		$end_target .= '.a';
-	}
-	else
-	{
-		$end_target .= $platform_exe_ext;
-	}
-
-	$end_target = 'test'.$platform_exe_ext if $type eq 'test';
-
-	# adjust for outdir
-	$end_target = '$(OUTDIR)/' . $end_target;
-
-	# start the makefile
-	my $mk_name_extra = ($bsd_make)?'':'X';
-	open MAKE,">$mod/Makefile".$mk_name_extra or die "Can't open Makefile for $mod\n";
-	my $debug_link_extra = ($target_is_library)?'':'../../debug/lib/debug/debug.a';
-
-	my $release_flags = "-O2";
-	if ($target_os eq "mingw32")
-	{
-		$release_flags = "-O0 -g";
-	}
-
-	print MAKE <<__E;
-#
-# AUTOMATICALLY GENERATED FILE
-#    do not edit!
-#
-#
-CXX = g++
-AR = ar
-RANLIB = ranlib
-.ifdef RELEASE
-CXXFLAGS = -DNDEBUG $release_flags -Wall $include_paths $extra_platform_defines -DBOX_VERSION="\\"$product_version\\""
-OUTBASE = ../../release
-OUTDIR = ../../release/$mod
-DEPENDMAKEFLAGS = -D RELEASE
-VARIENT = RELEASE
-.else
-CXXFLAGS = -g -Wall $include_paths $extra_platform_defines -DBOX_VERSION="\\"$product_version\\""
-OUTBASE = ../../debug
-OUTDIR = ../../debug/$mod
-DEPENDMAKEFLAGS =
-VARIENT = DEBUG
-.endif
-
-__E
-	
-	# read directory
-	opendir DIR,$mod;
-	my @items = readdir DIR;
-	closedir DIR;
-	
-	# add in items from autogen directories, and create output directories
-	{
-		my @autogen_items;
-		for my $di (@items)
-		{
-			if($di =~ m/\Aautogen/ && -d "$mod/$di")
-			{
-				# Read items
-				my $d = "$mod/$di";
-				opendir DIR,$d;
-				my @i = readdir DIR;
-				closedir DIR;
-				for(@i)
-				{
-					next if m/\A\./;
-					push @autogen_items,"$di/$_"
-				}
-				
-				# output directories
-				mkdir "release/$mod/$di",0755;
-				mkdir "debug/$mod/$di",0755;
-			}
-		}
-		@items = (@items, @autogen_items);
-	}
-	
-	# first, obtain a list of depenencies within the .h files
-	my %headers;
-	for my $h (grep /\.h\Z/i, @items)
-	{
-		open FL,"$mod/$h";
-		my $f;
-		read FL,$f,-s "$mod/$h";
-		close FL;
-
-		while($f =~ m/\#include\s+"([^"]+?)"/g)
-		{
-			${$headers{$h}}{$1} = 1 if exists $hfiles{$1};
-		}
-	}
-	
-	# ready for the rest of the details...
-	my $make;
-	
-	# then... do the cpp files...
-	my @obj_base;
-	for my $cpp (@items)
-	{
-		next unless $cpp =~ m/\A(.+)\.cpp\Z/i;
-		next if $cpp =~ /\A\._/;	# Temp Mac OS Resource hack
-
-		# store for later
-		my $base = $1;
-		push @obj_base,$base;
-	
-		# get the file...
-		open FL,"$mod/$cpp";
-		my $f;
-		read FL,$f,-s "$mod/$cpp";
-		close FL;
-		
-		my %dep;
-
-		while($f =~ m/\#include\s+"([^"]+?)"/g)
-		{
-			insert_dep($1, \%dep) if exists $hfiles{$1};
-		}
-		
-		# output filename
-		my $out_name = '$(OUTDIR)/'.$base.'.o';
-		
-		# write the line for this cpp file
-		$make .= $out_name.': '.join(' ',$cpp,map
-			{ ($hfiles{$_} eq $mod)?$_:'../../'.$hfiles{$_}."/$_" } keys %dep)."\n";
-		$make .= "\t\$(CXX) \$(CXXFLAGS) $compile_line_extra -c $cpp -o $out_name\n\n";
-
-	}
-
-	my $has_deps = ($#{$module_dependency{$mod}} >= 0);
-# ----- # always has dependencies with debug library
-	$has_deps = 1;
-	$has_deps = 0 if $target_is_library;
-
-	# Depenency stuff
-	my $deps_makeinfo;
-	if($has_deps)
-	{
-		if($bsd_make)
-		{
-			$deps_makeinfo = <<'__E';
-.BEGIN::
-.ifndef NODEPS
-.	if $(.TARGETS) == ""
-__E
-		}
-		else
-		{
-			# gnu make
-			$deps_makeinfo = <<'__E';
-.PHONY:	dep_modules
-dep_modules:
-ifndef NODEPS
-ifeq ($(strip $(.TARGETS)),)
-__E
-		}
-		
-		# run make for things we require
-		for my $dep (@all_deps_for_module)
-		{
-			$deps_makeinfo .= "\t\t(cd ../../$dep; \$(MAKE)$sub_make_options \$(DEPENDMAKEFLAGS) -D NODEPS)\n";
-		}
-		$deps_makeinfo .= ".\tendif\n.endif\n\n";
-	}
-	print MAKE $deps_makeinfo if $bsd_make;
-	
-	# get the list of library things to add -- in order of dependency so things link properly
-	my $lib_files = join(' ',map {($_ =~ m/lib\/(.+)\Z/)?('$(OUTBASE)/'.$_.'/'.$1.'.a'):undef} (reverse(@all_deps_for_module)));
-
-	# need to see if the extra makefile fragments require extra object files
-	# or include any more makefiles
-	my @objs = @obj_base;
-	my @makefile_includes;
-	
-	additional_objects_from_make_fragment("$mod/Makefile.extra", \@objs, \@makefile_includes);
-	additional_objects_from_make_fragment("$mod/Makefile.extra.$build_os", \@objs, \@makefile_includes);
-
-	my $o_file_list = join(' ',map {'$(OUTDIR)/'.$_.'.o'} @objs);
-	print MAKE $end_target,': ',$o_file_list;
-	print MAKE ' dep_modules' if $has_deps and not $bsd_make;
-	print MAKE " ",$lib_files unless $target_is_library;
-	print MAKE "\n";
-	
-	# stuff to make the final target...
-	if($target_is_library)
-	{
-		# make a library archive...
-		print MAKE "\t(echo -n > $end_target; rm $end_target)\n";
-		print MAKE "\t\$(AR) -q $end_target $o_file_list\n";
-		print MAKE "\t\$(RANLIB) $end_target\n";
-	}
-	else
-	{
-		# work out library options
-		# need to be... least used first, in absolute order they appear in the modules.txt file
-		my @libops;
-		sub libops_fill
-		{
-			my ($m,$r) = @_;
-			push @$r,$_ for(@{$module_library_link_opts{$m}});
-			libops_fill($_,$r) for(@{$module_dependency{$m}});
-		}
-		libops_fill($mod,\@libops);
-		my $lo = '';
-		my %ldone;
-		for(@libops)
-		{
-			next if exists $ldone{$_};
-			$lo .= ' '.$_;
-			$ldone{$_} = 1;
-		}
-	
-		# link line...
-		print MAKE "\t\$(CXX) $link_line_extra -o $end_target $o_file_list $lib_files$lo $platform_lib_files\n";
-	}
-	# tests need to copy the test file over
-	if($type eq 'test')
-	{
-		print MAKE "\tcp _t \$(OUTDIR)/t\n\tchmod u+x \$(OUTDIR)/t\n";
-		print MAKE "\tcp _t-gdb \$(OUTDIR)/t-gdb\n\tchmod u+x \$(OUTDIR)/t-gdb\n";
-	}
-	# dependency line?
-	print MAKE "\n";
-
-	# module dependencies for GNU make?
-	print MAKE $deps_makeinfo if !$bsd_make;
-	
-	# print the rest of the file
-	print MAKE $make,"\n";
-	
-	# and a clean target
-	print MAKE "clean:\n\t-rm -rf \$(OUTDIR)/*\n.\tifndef SUBCLEAN\n";
-	for my $dep (@all_deps_for_module)
-	{
-		print MAKE "\t(cd ../../$dep; \$(MAKE) \$(DEPENDMAKEFLAGS) -D SUBCLEAN clean)\n";
-	}
-	print MAKE ".\tendif\n";
-	
-	# include any extra stuff
-	print MAKE "\n\n";
-	if(-e "$mod/Makefile.extra")
-	{
-		print MAKE ".include <Makefile.extra>\n\n";
-	}
-	if(-e "$mod/Makefile.extra.$build_os")
-	{
-		print MAKE ".include <Makefile.extra.$build_os>\n\n";
-	}
-	for(@makefile_includes)
-	{
-		print MAKE ".include <$_>\n\n";
-	}
-	
-	# and finally a target for rebuilding the build system
-	print MAKE "\nbuildsystem:\n\t(cd ../..; perl ./infrastructure/makebuildenv.pl $makebuildenv_args)\n\n";
-	
-	close MAKE;
-
-	if(!$bsd_make)
-	{
-		# need to post process this into a GNU makefile
-		open MAKE,">$mod/Makefile";
-		open MAKEB,"$mod/MakefileX";
-
-		while(<MAKEB>)
-		{
-			s/\A\.\s*(ifdef|else|endif|ifndef)/$1/;
-			s/\A\.\s*include\s+<(.+?)>/include $1/;
-			s/-D\s+(\w+)/$1=1/;
-			print MAKE;
-		}
-
-		close MAKEB;
-		close MAKE;
-		unlink "$mod/MakefileX";
-	}
-}
-
-print "\nType 'cd <module_dir>; $make_command' to build a module\n\n";
-
-if($modules_omitted)
-{
-	print "\nNOTE: Some modules have been omitted on this platform\n\n"
-}
-
-sub insert_dep
-{
-	my ($h,$dep_r) = @_;
-	
-	# stop random recusion
-	return if exists $$dep_r{$h};
-	
-	# insert more depencies
-	insert_dep($_,$dep_r) for keys %{$header_dependency{$h}};
-
-	# mark this one as a dependency
-	$$dep_r{$h} = 1;
-}
-
-
-sub additional_objects_from_make_fragment
-{
-	my ($fn,$objs_r,$include_r) = @_;
-	
-	if(-e $fn)
-	{
-		open FL,$fn or die "Can't open $fn";
-		
-		while(<FL>)
-		{
-			chomp;
-			if(m/link-extra:\s*(.+)\Z/)
-			{
-				my @o = split /\s+/,$1;
-				for(@o)
-				{
-					push @$objs_r,$1 if m/\A(.+)\.o\Z/;
-				}
-			}
-			elsif(m/include-makefile:\s*(\S+)/)
-			{
-				push @$include_r,$1
-			}
-		}
-		
-		close FL;
-	}
-}
-
-
-sub ignore_module
-{
-	exists $env_flags{'IGNORE_'.$_[0]}
-}

Copied: box/chris/boxi/infrastructure/makebuildenv.pl.in (from rev 547, box/trunk/infrastructure/makebuildenv.pl.in)

Modified: box/chris/boxi/infrastructure/makedistribution.pl
===================================================================
--- box/chris/boxi/infrastructure/makedistribution.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/makedistribution.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!@PERL@
 use strict;
 use Symbol;
 
@@ -47,7 +47,9 @@
 my $license_f;
 read LICENSE,$license_f,100000;
 close LICENSE;
-my @license = ('distribution '.$base_name,'',split(/\n/,$license_f));
+my $svnversion = `svnversion .`;
+chomp $svnversion;
+my @license = ('distribution '.$base_name.' (svn version: '.$svnversion.')',split(/\n/,$license_f));
 
 # copy files, make a note of all the modules included
 my %modules_included;
@@ -82,6 +84,15 @@
 		{
 			$no_license{$dst} = 1;
 		}
+		elsif($src eq 'RUN')
+		{
+			print "Running $dst...\n";
+			if(system($dst) != 0)
+			{
+				print "Error running $dst. Aborting.\n";
+				exit(1);
+			}
+		}
 		elsif(-d $src)
 		{
 			$modules_included{$_} = 1;

Deleted: box/chris/boxi/infrastructure/makeparcels.pl
===================================================================
--- box/chris/boxi/infrastructure/makeparcels.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/makeparcels.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,210 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use lib 'infrastructure';
-use BoxPlatform;
-
-my $os_suffix = '';
-if($build_os eq 'OpenBSD')
-{
-	$os_suffix = `uname -r`;
-	$os_suffix =~ tr/0-9//cd;
-}
-
-my @parcels;
-my %parcel_contents;
-
-open PARCELS,"parcels.txt" or die "Can't open parcels file";
-{
-	my $cur_parcel = '';
-	while(<PARCELS>)
-	{
-		chomp; s/#.+\Z//; s/\s+\Z//; s/\s+/ /g;
-		next unless m/\S/;
-		
-		# omit bits on some platforms?
-		next if m/\AEND-OMIT/;
-		if(m/\AOMIT:(.+)/)
-		{
-			if($1 eq $build_os or $1 eq $target_os)
-			{
-				while(<PARCELS>)
-				{
-					last if m/\AEND-OMIT/;	
-				}
-			}
-			next;
-		}
-
-		if (m'\AONLY:(.+)')
-		{
-			my @only_targets = split m'\,', $1;
-
-			if (not grep {$_ eq $build_os or $_ eq $target_os}
-				@only_targets)
-			{
-				while (<PARCELS>)
-				{
-					last if m'\AEND-ONLY';
-				}
-				next;
-			}
-		}
-		
-		# new parcel, or a new parcel definition?
-		if(m/\A\s+(.+)\Z/)
-		{
-			push @{$parcel_contents{$cur_parcel}},$1
-		}
-		else
-		{
-			$cur_parcel = $_;
-			push @parcels,$_;
-		}
-	}
-}
-close PARCELS;
-
-# create parcels directory
-mkdir "parcels",0755;
-mkdir "parcels/scripts",0755;
-
-# write master makefile
-
-open MAKE,">Makefile" or die "Can't open master Makefile for writing";
-
-print MAKE <<__E;
-#
-# AUTOMATICALLY GENERATED FILE
-#    do not edit!
-#
-#
-
-MAKE = $make_command
-
-__E
-
-print MAKE "all:\t",join(' ',map {parcel_target($_)} @parcels),"\n\n";
-
-print MAKE "clean-parcels:\n";
-for my $parcel (@parcels)
-{
-	print MAKE "\trm -rf ",parcel_dir($parcel),"\n";
-	print MAKE "\trm -f ",parcel_target($parcel),"\n";
-}
-
-print MAKE "\n";
-print MAKE "clean:\tclean-parcels\n";
-print MAKE "\tfind . -name '*.o' | xargs -r rm\n";
-print MAKE "\tfind . -name '*.a' | xargs -r rm\n";
-print MAKE "\n";
-
-print MAKE "test:\trelease/common/test\n\nrelease/common/test:\n\t./runtest.pl ALL release\n\n";
-
-my $release_flag = BoxPlatform::make_flag('RELEASE');
-
-for my $parcel (@parcels)
-{
- 	my @parcel_deps;
- 
- 	for (@{$parcel_contents{$parcel}})
- 	{
- 		my ($type,$name) = split /\s+/;
- 		if($type eq 'bin')
- 		{
- 			push @parcel_deps, $name.$platform_exe_ext;
- 			print MAKE "$name:\n" .
- 				"\t(cd bin/$name; $make_command $release_flag)\n\n";
- 		}
- 		elsif ($type eq 'script')
- 		{
- 			push @parcel_deps, $name;
- 		}
- 	}
- 
-	my $target = parcel_target($parcel);
-	print MAKE $target,": @parcel_deps\n";
-  		
-	my $dir = parcel_dir($parcel);
-	print MAKE "\tmkdir -p $dir\n";
-	
-	open SCRIPT,">parcels/scripts/install-$parcel" 
-		or die "Can't open installer script for $parcel for writing";
-
-	print SCRIPT "#!/bin/sh\n\n";
-	
-	for(@{$parcel_contents{$parcel}})
-	{
-		my ($type,$name) = split /\s+/;
-		
-		if($type eq 'bin')
-		{
-			my $exeext = $platform_exe_ext;
-			print MAKE "\t(cd bin/$name; \$(MAKE) $release_flag)\n";
-			print MAKE "\tcp release/bin/$name/$name$exeext $dir\n";
-			$name .= $exeext; # for install
-		}
-		elsif ($type eq 'script')
-		{
-			print MAKE "\tcp $name $dir\n";
-		}
-
-		# remove path from file name, for install
-		$name =~ m~/([^/]+)\Z~;
-		$name = $1;
-
-		print SCRIPT "install $name ".
-			"\$DESTDIR\${PREFIX:-$install_into_dir}\n";
-	}
-	
-	close SCRIPT;
-	
-	chmod 0755,"parcels/scripts/install-$parcel";
-	
-	my $root = parcel_root($parcel);
-	print MAKE "\tcp parcels/scripts/install-$parcel $dir\n";
-	print MAKE "\t(cd parcels; tar cf - $root | gzip -9 - > $root.tgz )\n";
-	
-	print MAKE "\n";
-	
-	print MAKE "install-$parcel:\n";
-	print MAKE "\t(cd $dir; ./install-$parcel \$(DESTDIR))\n\n";
-}
-
-print MAKE <<__E;
-install:
-	cat local/install.msg
-
-__E
-
-close MAKE;
-
-open INSTALLMSG,">local/install.msg" or die "Can't open install message file for writing";
-print INSTALLMSG <<__E;
-
-Parcels need to be installed separately, and as root. Type one of the following:
-
-__E
-
-for(@parcels)
-{
-	print INSTALLMSG "    $make_command install-".$_."\n";
-}
-print INSTALLMSG "\n";
-
-close INSTALLMSG;
-
-sub parcel_root
-{
-	$product_name.'-'.$product_version.'-'.$_[0].'-'.$build_os.$os_suffix
-}
-
-sub parcel_dir
-{
-	'parcels/'.parcel_root($_[0])
-}
-
-sub parcel_target
-{
-	parcel_dir($_[0]).'.tgz'
-}

Copied: box/chris/boxi/infrastructure/makeparcels.pl.in (from rev 547, box/trunk/infrastructure/makeparcels.pl.in)

Copied: box/chris/boxi/infrastructure/msvc (from rev 547, box/trunk/infrastructure/msvc)

Copied: box/chris/boxi/infrastructure/msvc/2003 (from rev 547, box/trunk/infrastructure/msvc/2003)

Deleted: box/chris/boxi/infrastructure/msvc/2003/bbackupctl.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2003/bbackupctl.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2003/bbackupctl.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="bbackupctl"
-	ProjectGUID="{9FD51412-E945-4457-A17A-CA3C505CF431}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\..\db-4.2.52.NC\build_win32";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/bbackupctl.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/bbackupctl.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Release\common.lib"
-				OutputFile="$(OutDir)/bbackupctl.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="bbackupctl"
-					Filter="">
-					<File
-						RelativePath="..\..\..\bin\bbackupctl\bbackupctl.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\win32\WinNamedPipeStream.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<File
-				RelativePath="..\..\..\lib\win32\WinNamedPipeStream.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2003/bbackupctl.vcproj (from rev 547, box/trunk/infrastructure/msvc/2003/bbackupctl.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2003/bbackupd.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2003/bbackupd.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2003/bbackupd.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,210 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="bbackupd"
-	ProjectGUID="{22D325FB-9131-4BD6-B390-968F0491D687}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(SolutionDir)..\..\..\..\db-4.2.52.NC\build_win32";"$(SolutionDir)..\..\..\..\boost_1_31_0";"$(SolutionDir)..\..\..\..\openssl\include";"$(SolutionDir)..\..\..\..\zlib\include";"$(SolutionDir)..\..\..\lib\backupclient";"$(SolutionDir)..\..\..\lib\server";"$(SolutionDir)..\..\..\lib\crypto";"$(SolutionDir)..\..\..\lib\compress";"$(SolutionDir)..\..\..\lib\win32";"$(SolutionDir)..\..\..\lib\common\""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/bbackupd.exe"
-				LinkIncremental="2"
-				IgnoreAllDefaultLibraries="FALSE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/bbackupd.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Release\common.lib"
-				OutputFile="$(OutDir)/bbackupd.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="bbackupd"
-					Filter="">
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientContext.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDeleteList.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDirectoryRecord.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientInodeToIDMap.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupDaemon.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\bbackupd.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32BackupService.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32ServiceFunctions.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\win32\WinNamedPipeStream.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="bbackupd"
-					Filter="">
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientContext.h">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDeleteList.h">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDirectoryRecord.h">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientInodeToIDMap.h">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupDaemon.h">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32BackupService.h">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32ServiceFunctions.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\win32\WinNamedPipeStream.h">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-		<File
-			RelativePath="..\..\..\ReadMe.txt">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2003/bbackupd.vcproj (from rev 547, box/trunk/infrastructure/msvc/2003/bbackupd.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2003/boxbackup.ncb
===================================================================
(Binary files differ)

Copied: box/chris/boxi/infrastructure/msvc/2003/boxbackup.ncb (from rev 547, box/trunk/infrastructure/msvc/2003/boxbackup.ncb)

Deleted: box/chris/boxi/infrastructure/msvc/2003/boxbackup.sln
===================================================================
--- box/trunk/infrastructure/msvc/2003/boxbackup.sln	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2003/boxbackup.sln	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,67 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boxquery", "boxquery.vcproj", "{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}"
-	ProjectSection(ProjectDependencies) = postProject
-		{98598F62-FEA7-4134-AA29-0AD2315A214F} = {98598F62-FEA7-4134-AA29-0AD2315A214F}
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common.vcproj", "{A089CEE6-EBF0-4232-A0C0-74850A8127A6}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bbackupd", "bbackupd.vcproj", "{22D325FB-9131-4BD6-B390-968F0491D687}"
-	ProjectSection(ProjectDependencies) = postProject
-		{98598F62-FEA7-4134-AA29-0AD2315A214F} = {98598F62-FEA7-4134-AA29-0AD2315A214F}
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32test", "win32test.vcproj", "{28C29E72-76A2-4D0C-B35B-12D446733D2E}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bbackupctl", "bbackupctl.vcproj", "{9FD51412-E945-4457-A17A-CA3C505CF431}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_regex", "lib\win32\boost_regex.vcproj", "{98598F62-FEA7-4134-AA29-0AD2315A214F}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Global
-	GlobalSection(SolutionConfiguration) = preSolution
-		Debug = Debug
-		Release = Release
-	EndGlobalSection
-	GlobalSection(ProjectConfiguration) = postSolution
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Debug.ActiveCfg = Debug|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Debug.Build.0 = Debug|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Release.ActiveCfg = Release|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Release.Build.0 = Release|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Debug.ActiveCfg = Debug|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Debug.Build.0 = Debug|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Release.ActiveCfg = Release|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Release.Build.0 = Release|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Debug.ActiveCfg = Debug|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Debug.Build.0 = Debug|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Release.ActiveCfg = Release|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Release.Build.0 = Release|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Debug.ActiveCfg = Debug|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Debug.Build.0 = Debug|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Release.ActiveCfg = Release|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Release.Build.0 = Release|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Debug.ActiveCfg = Debug|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Debug.Build.0 = Debug|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Release.ActiveCfg = Release|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Release.Build.0 = Release|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Debug.ActiveCfg = Debug|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Debug.Build.0 = Debug|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Release.ActiveCfg = Release|Win32
-		{98598F62-FEA7-4134-AA29-0AD2315A214F}.Release.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-	EndGlobalSection
-	GlobalSection(ExtensibilityAddIns) = postSolution
-	EndGlobalSection
-EndGlobal

Copied: box/chris/boxi/infrastructure/msvc/2003/boxbackup.sln (from rev 547, box/trunk/infrastructure/msvc/2003/boxbackup.sln)

Deleted: box/chris/boxi/infrastructure/msvc/2003/boxbackup.suo
===================================================================
(Binary files differ)

Copied: box/chris/boxi/infrastructure/msvc/2003/boxbackup.suo (from rev 547, box/trunk/infrastructure/msvc/2003/boxbackup.suo)

Deleted: box/chris/boxi/infrastructure/msvc/2003/boxquery.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2003/boxquery.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2003/boxquery.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,171 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="boxquery"
-	ProjectGUID="{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}"
-	RootNamespace="boxquery"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/bbackupquery.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/boxquery.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\Release\common.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib"
-				OutputFile="$(OutDir)/bbackupquery.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="FALSE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="backupquery"
-					Filter="">
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\autogen_Documentation.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\BackupQueries.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\bbackupquery.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<Filter
-				Name="bin"
-				Filter="">
-				<Filter
-					Name="backupquery"
-					Filter="">
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\BackupQueries.h">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-		<File
-			RelativePath="..\..\..\ReadMe.txt">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2003/boxquery.vcproj (from rev 547, box/trunk/infrastructure/msvc/2003/boxquery.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2003/common.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2003/common.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2003/common.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,635 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="common"
-	ProjectGUID="{A089CEE6-EBF0-4232-A0C0-74850A8127A6}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="4"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0\""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;_DEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/common.lib"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="4"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0\""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;NDEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/common.lib"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<Filter
-				Name="lib"
-				Filter="">
-				<Filter
-					Name="compress"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\compress\autogen_CompressException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\CompressStream.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="common"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\common\autogen_CommonException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\autogen_ConversionException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTime.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTimeToText.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\CollectInBufferStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Configuration.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ConversionString.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\DebugAssertFailed.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\DebugMemLeakFinder.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\DebugPrintf.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\EventWatchFilesystemObject.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ExcludeList.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FdGetLine.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FileStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStreamGetLine.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemBlockStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\PartialReadStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ReadGatherStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\StreamableMemBlock.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\UnixUser.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Utils.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\WaitForEvent.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="backupclient"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupProtocolClient.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupStoreException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientCryptoKeys.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientFileAttributes.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientMakeExcludeList.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientRestore.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupDaemonConfigVerify.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreDirectory.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFile.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCmbDiff.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCmbIdx.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCombine.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCryptVar.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileDiff.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileEncodeStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilename.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilenameClear.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileRevDiff.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreObjectDump.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="crypto"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\crypto\autogen_CipherException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherAES.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherBlowfish.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherContext.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherDescription.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\MD5Digest.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\Random.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\RollingChecksum.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="win32"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\win32\emu.cpp">
-					</File>
-				</Filter>
-				<Filter
-					Name="server"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ConnectionException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ServerException.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Daemon.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\LocalProcessStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Protocol.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolObject.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolUncertainStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Socket.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStream.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStreamTLS.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SSLLib.cpp">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\TLSContext.cpp">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-			<Filter
-				Name="lib"
-				Filter="">
-				<Filter
-					Name="compress"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\compress\autogen_CompressException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\Compress.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\CompressException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\CompressStream.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="common"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\common\autogen_CommonException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\autogen_ConversionException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BannerText.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BeginStructPackForWire.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Box.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxPlatform.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxPortsAndFiles.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTime.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTimeToText.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTimeToUnix.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\CollectInBufferStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\CommonException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Configuration.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Conversion.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\EndStructPackForWire.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\EventWatchFilesystemObject.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ExcludeList.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FdGetLine.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FileModificationTime.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FileStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Guards.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStreamGetLine.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\LinuxWorkaround.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\LocalProcessStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MainHelper.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemBlockStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemLeakFinder.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemLeakFindOff.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemLeakFindOn.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\NamedLock.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\PartialReadStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ReadGatherStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\StreamableMemBlock.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\TemporaryDirectory.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Test.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\UnixUser.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Utils.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\WaitForEvent.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="backupclient"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupProtocolClient.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupStoreException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientCryptoKeys.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientFileAttributes.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientMakeExcludeList.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientRestore.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupDaemonConfigVerify.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreConstants.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreDirectory.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFile.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCryptVar.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileEncodeStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilename.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilenameClear.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileWire.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreObjectMagic.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="crypto"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\crypto\autogen_CipherException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherAES.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherBlowfish.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherContext.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherDescription.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\MD5Digest.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\Random.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\RollingChecksum.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="win32"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\win32\emu.h">
-					</File>
-				</Filter>
-				<Filter
-					Name="server"
-					Filter="">
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ConnectionException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ServerException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Daemon.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Protocol.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolObject.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolUncertainStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolWire.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ServerException.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ServerStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ServerTLS.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Socket.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketListen.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStream.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStreamTLS.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SSLLib.h">
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\TLSContext.h">
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2003/common.vcproj (from rev 547, box/trunk/infrastructure/msvc/2003/common.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2003/win32test.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2003/win32test.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2003/win32test.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="win32test"
-	ProjectGUID="{28C29E72-76A2-4D0C-B35B-12D446733D2E}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\bin\bbackupd";"$(ProjectDir)..\..\..\..\db-4.2.52.NC\build_win32";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/win32test.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/win32test.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\bin\bbackupd";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Release\common.lib"
-				OutputFile="$(OutDir)/win32test.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<File
-				RelativePath="..\..\..\lib\win32\emu.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\test\win32\testlibwin32.cpp">
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-		<File
-			RelativePath="..\..\..\ReadMe.txt">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2003/win32test.vcproj (from rev 547, box/trunk/infrastructure/msvc/2003/win32test.vcproj)

Copied: box/chris/boxi/infrastructure/msvc/2005 (from rev 547, box/trunk/infrastructure/msvc/2005)

Deleted: box/chris/boxi/infrastructure/msvc/2005/bbackupctl.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2005/bbackupctl.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2005/bbackupctl.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,217 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="bbackupctl"
-	ProjectGUID="{9FD51412-E945-4457-A17A-CA3C505CF431}"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\common";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\..\zlib\include""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\out32dll\libeay32.lib $(ProjectDir)..\..\..\..\openssl\out32dll\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/bbackupctl.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/bbackupctl.pdb"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="true"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Release\common.lib"
-				OutputFile="$(OutDir)/bbackupctl.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<Filter
-				Name="bin"
-				>
-				<Filter
-					Name="bbackupctl"
-					>
-					<File
-						RelativePath="..\..\..\bin\bbackupctl\bbackupctl.cpp"
-						>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2005/bbackupctl.vcproj (from rev 547, box/trunk/infrastructure/msvc/2005/bbackupctl.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2005/bbackupd.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2005/bbackupd.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2005/bbackupd.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,286 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="bbackupd"
-	ProjectGUID="{22D325FB-9131-4BD6-B390-968F0491D687}"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(SolutionDir)..\..\..\lib\backupclient";"$(SolutionDir)..\..\..\lib\common";"$(SolutionDir)..\..\..\lib\compress";"$(SolutionDir)..\..\..\lib\crypto";"$(SolutionDir)..\..\..\lib\server";"$(SolutionDir)..\..\..\lib\win32";"$(SolutionDir)..\..\..\..\openssl\inc32";"$(SolutionDir)..\..\..\..\zlib\include""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\out32dll\libeay32.lib $(ProjectDir)..\..\..\..\openssl\out32dll\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/bbackupd.exe"
-				LinkIncremental="2"
-				IgnoreAllDefaultLibraries="false"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/bbackupd.pdb"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="true"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Release\common.lib $(ProjectDir)..\..\..\lib\win32\Release\boost_regex.lib"
-				OutputFile="$(OutDir)/bbackupd.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<Filter
-				Name="bin"
-				>
-				<Filter
-					Name="bbackupd"
-					>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientContext.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDeleteList.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDirectoryRecord.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientInodeToIDMap.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupDaemon.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\bbackupd.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32BackupService.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32ServiceFunctions.cpp"
-						>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<Filter
-				Name="bin"
-				>
-				<Filter
-					Name="bbackupd"
-					>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientContext.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDeleteList.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientDirectoryRecord.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupClientInodeToIDMap.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\BackupDaemon.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32BackupService.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupd\Win32ServiceFunctions.h"
-						>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<File
-			RelativePath="..\..\..\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2005/bbackupd.vcproj (from rev 547, box/trunk/infrastructure/msvc/2005/bbackupd.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2005/boxbackup.sln
===================================================================
--- box/trunk/infrastructure/msvc/2005/boxbackup.sln	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2005/boxbackup.sln	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,55 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boxquery", "boxquery.vcproj", "{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common.vcproj", "{A089CEE6-EBF0-4232-A0C0-74850A8127A6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bbackupd", "bbackupd.vcproj", "{22D325FB-9131-4BD6-B390-968F0491D687}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32test", "win32test.vcproj", "{28C29E72-76A2-4D0C-B35B-12D446733D2E}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bbackupctl", "bbackupctl.vcproj", "{9FD51412-E945-4457-A17A-CA3C505CF431}"
-	ProjectSection(ProjectDependencies) = postProject
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6} = {A089CEE6-EBF0-4232-A0C0-74850A8127A6}
-	EndProjectSection
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Release|Win32 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Debug|Win32.Build.0 = Debug|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Release|Win32.ActiveCfg = Release|Win32
-		{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}.Release|Win32.Build.0 = Release|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Debug|Win32.ActiveCfg = Debug|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Debug|Win32.Build.0 = Debug|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Release|Win32.ActiveCfg = Release|Win32
-		{A089CEE6-EBF0-4232-A0C0-74850A8127A6}.Release|Win32.Build.0 = Release|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Debug|Win32.ActiveCfg = Debug|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Debug|Win32.Build.0 = Debug|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Release|Win32.ActiveCfg = Release|Win32
-		{22D325FB-9131-4BD6-B390-968F0491D687}.Release|Win32.Build.0 = Release|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Debug|Win32.Build.0 = Debug|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Release|Win32.ActiveCfg = Release|Win32
-		{28C29E72-76A2-4D0C-B35B-12D446733D2E}.Release|Win32.Build.0 = Release|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Debug|Win32.ActiveCfg = Debug|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Debug|Win32.Build.0 = Debug|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Release|Win32.ActiveCfg = Release|Win32
-		{9FD51412-E945-4457-A17A-CA3C505CF431}.Release|Win32.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal

Copied: box/chris/boxi/infrastructure/msvc/2005/boxbackup.sln (from rev 547, box/trunk/infrastructure/msvc/2005/boxbackup.sln)

Deleted: box/chris/boxi/infrastructure/msvc/2005/boxbackup.suo
===================================================================
(Binary files differ)

Copied: box/chris/boxi/infrastructure/msvc/2005/boxbackup.suo (from rev 547, box/trunk/infrastructure/msvc/2005/boxbackup.suo)

Deleted: box/chris/boxi/infrastructure/msvc/2005/boxquery.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2005/boxquery.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2005/boxquery.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,242 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="boxquery"
-	ProjectGUID="{FE9EC666-4B3A-4370-B3D4-DEBD4A21F36E}"
-	RootNamespace="boxquery"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\common";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\..\zlib\include""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\out32dll\libeay32.lib $(ProjectDir)..\..\..\..\openssl\out32dll\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/bbackupquery.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/boxquery.pdb"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="true"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;BOOST_REGEX_NO_LIB"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\Release\common.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\lib\win32\Release\boost_regex.lib"
-				OutputFile="$(OutDir)/bbackupquery.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="false"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<Filter
-				Name="bin"
-				>
-				<Filter
-					Name="backupquery"
-					>
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\autogen_Documentation.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\BackupQueries.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\bbackupquery.cpp"
-						>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<Filter
-				Name="bin"
-				>
-				<Filter
-					Name="backupquery"
-					>
-					<File
-						RelativePath="..\..\..\bin\bbackupquery\BackupQueries.h"
-						>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<File
-			RelativePath="..\..\..\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2005/boxquery.vcproj (from rev 547, box/trunk/infrastructure/msvc/2005/boxquery.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2005/common.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2005/common.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2005/common.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,850 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="common"
-	ProjectGUID="{A089CEE6-EBF0-4232-A0C0-74850A8127A6}"
-	RootNamespace="common"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\common";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\..\zlib\include";$(NOINHERIT)"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				WarnAsError="false"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/common.lib"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="true"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\";"$(SolutionDir)..\..\..\..\boost_1_31_0\""
-				PreprocessorDefinitions="BOOST_REGEX_NO_LIB;WIN32;NDEBUG;_LIB;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/common.lib"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<Filter
-				Name="lib"
-				>
-				<Filter
-					Name="compress"
-					>
-					<File
-						RelativePath="..\..\..\lib\compress\autogen_CompressException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\CompressStream.cpp"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="common"
-					>
-					<File
-						RelativePath="..\..\..\lib\common\autogen_CommonException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\autogen_ConversionException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTime.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTimeToText.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\CollectInBufferStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Configuration.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ConversionString.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\DebugAssertFailed.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\DebugMemLeakFinder.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\DebugPrintf.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\EventWatchFilesystemObject.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ExcludeList.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FdGetLine.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FileStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStreamGetLine.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemBlockStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\PartialReadStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ReadGatherStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\StreamableMemBlock.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\UnixUser.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Utils.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\WaitForEvent.cpp"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="backupclient"
-					>
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupProtocolClient.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupStoreException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientCryptoKeys.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientFileAttributes.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientMakeExcludeList.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientRestore.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupDaemonConfigVerify.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreDirectory.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFile.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCmbDiff.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCmbIdx.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCombine.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCryptVar.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileDiff.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileEncodeStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilename.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilenameClear.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileRevDiff.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreObjectDump.cpp"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="crypto"
-					>
-					<File
-						RelativePath="..\..\..\lib\crypto\autogen_CipherException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherAES.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherBlowfish.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherContext.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherDescription.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\MD5Digest.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\Random.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\RollingChecksum.cpp"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="win32"
-					>
-					<File
-						RelativePath="..\..\..\lib\win32\emu.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\win32\WinNamedPipeStream.cpp"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="server"
-					>
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ConnectionException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ServerException.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Daemon.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\LocalProcessStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Protocol.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolObject.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolUncertainStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Socket.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStream.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStreamTLS.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SSLLib.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\TLSContext.cpp"
-						>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<Filter
-				Name="lib"
-				>
-				<Filter
-					Name="compress"
-					>
-					<File
-						RelativePath="..\..\..\lib\compress\autogen_CompressException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\Compress.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\CompressException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\compress\CompressStream.h"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="common"
-					>
-					<File
-						RelativePath="..\..\..\lib\common\autogen_CommonException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\autogen_ConversionException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BannerText.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BeginStructPackForWire.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Box.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxConfig.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxPlatform.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxPortsAndFiles.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTime.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTimeToText.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\BoxTimeToUnix.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\CollectInBufferStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\CommonException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Configuration.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Conversion.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\EndStructPackForWire.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\EventWatchFilesystemObject.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ExcludeList.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FdGetLine.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FileModificationTime.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\FileStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Guards.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\IOStreamGetLine.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\LocalProcessStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MainHelper.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemBlockStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemLeakFinder.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemLeakFindOff.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\MemLeakFindOn.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\NamedLock.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\PartialReadStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\ReadGatherStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\StreamableMemBlock.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\TemporaryDirectory.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Test.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\UnixUser.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\Utils.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\common\WaitForEvent.h"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="backupclient"
-					>
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupProtocolClient.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\autogen_BackupStoreException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientCryptoKeys.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientFileAttributes.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientMakeExcludeList.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupClientRestore.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupDaemonConfigVerify.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreConstants.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreDirectory.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFile.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileCryptVar.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileEncodeStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilename.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFilenameClear.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreFileWire.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\backupclient\BackupStoreObjectMagic.h"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="crypto"
-					>
-					<File
-						RelativePath="..\..\..\lib\crypto\autogen_CipherException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherAES.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherBlowfish.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherContext.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherDescription.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\CipherException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\MD5Digest.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\Random.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\crypto\RollingChecksum.h"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="win32"
-					>
-					<File
-						RelativePath="..\..\..\lib\win32\emu.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\win32\WinNamedPipeStream.h"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="server"
-					>
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ConnectionException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\autogen_ServerException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Daemon.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Protocol.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolObject.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolUncertainStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ProtocolWire.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ServerException.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ServerStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\ServerTLS.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\Socket.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketListen.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStream.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SocketStreamTLS.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\SSLLib.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\..\lib\server\TLSContext.h"
-						>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2005/common.vcproj (from rev 547, box/trunk/infrastructure/msvc/2005/common.vcproj)

Deleted: box/chris/boxi/infrastructure/msvc/2005/win32test.vcproj
===================================================================
--- box/trunk/infrastructure/msvc/2005/win32test.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/msvc/2005/win32test.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,217 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="win32test"
-	ProjectGUID="{28C29E72-76A2-4D0C-B35B-12D446733D2E}"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\Debug"
-			IntermediateDirectory="..\..\..\Debug"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\bin\bbackupd";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\common";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\..\openssl\inc32";"$(ProjectDir)..\..\..\..\zlib\include""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING;_CRT_SECURE_NO_DEPRECATE;NDEBUG"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\out32dll\libeay32.lib $(ProjectDir)..\..\..\..\openssl\out32dll\ssleay32.lib $(ProjectDir)..\..\..\Debug\common.lib"
-				OutputFile="$(OutDir)/win32test.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/win32test.pdb"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="..\..\..\Release"
-			IntermediateDirectory="..\..\..\Release"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="true"
-				AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\bin\bbackupd";"$(ProjectDir)..\..\..\lib\backupclient";"$(ProjectDir)..\..\..\lib\server";"$(ProjectDir)..\..\..\lib\crypto";"$(ProjectDir)..\..\..\..\openssl\include";"$(ProjectDir)..\..\..\lib\compress";"$(ProjectDir)..\..\..\..\zlib\include";"$(ProjectDir)..\..\..\lib\win32";"$(ProjectDir)..\..\..\lib\common\""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\..\..\..\zlib\lib\zdll.lib $(ProjectDir)..\..\..\..\openssl\lib\libeay32.lib $(ProjectDir)..\..\..\..\openssl\lib\ssleay32.lib $(ProjectDir)..\..\..\Release\common.lib"
-				OutputFile="$(OutDir)/win32test.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\..\..\lib\win32\emu.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\..\test\win32\testlibwin32.cpp"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<File
-			RelativePath="..\..\..\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

Copied: box/chris/boxi/infrastructure/msvc/2005/win32test.vcproj (from rev 547, box/trunk/infrastructure/msvc/2005/win32test.vcproj)

Modified: box/chris/boxi/infrastructure/setupexternal.pl
===================================================================
--- box/chris/boxi/infrastructure/setupexternal.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/infrastructure/setupexternal.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!@PERL@
 use strict;
 
 # This script links in the essential directories and processes various

Modified: box/chris/boxi/lib/backupclient/BackupClientFileAttributes.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupClientFileAttributes.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupClientFileAttributes.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,10 +9,13 @@
 
 #include "Box.h"
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
-#include <unistd.h>
 #include <limits.h>
 #include <algorithm>
 #include <new>
@@ -330,21 +333,30 @@
 		// __time64_t winTime = BoxTimeToSeconds(
 		// pnewAttr->ModificationTime);
 
-		box_time_t bob = BoxTimeToSeconds(pattr->ModificationTime);
-		__time64_t winTime = bob;
-		if (_gmtime64(&winTime) == 0 )
+		u_int64_t  modTime = box_ntoh64(pattr->ModificationTime);
+		box_time_t modSecs = BoxTimeToSeconds(modTime);
+		__time64_t winTime = modSecs;
+
+		// _MAX__TIME64_T doesn't seem to be defined, but the code below
+		// will throw an assertion failure if we exceed it :-)
+		// Microsoft says dates up to the year 3000 are valid, which
+		// is a bit more than 15 * 2^32. Even that doesn't seem
+		// to be true (still aborts), but it can at least hold 2^32.
+		if (winTime >= 0x100000000LL || _gmtime64(&winTime) == 0)
 		{
-			::syslog(LOG_ERR, "Corrupt value in store "
-				"Modification Time in file %s", Filename);
+			::syslog(LOG_ERR, "Invalid Modification Time "
+				"caught for file: %s", Filename);
 			pattr->ModificationTime = 0;
 		}
 
-		bob = BoxTimeToSeconds(pattr->AttrModificationTime);
-		winTime = bob;
-		if (_gmtime64(&winTime) == 0 )
+		modTime = box_ntoh64(pattr->AttrModificationTime);
+		modSecs = BoxTimeToSeconds(modTime);
+		winTime = modSecs;
+
+		if (winTime > 0x100000000LL || _gmtime64(&winTime) == 0)
 		{
-			::syslog(LOG_ERR, "Corrupt value in store "
-				"Attr Modification Time in file %s", Filename);
+			::syslog(LOG_ERR, "Invalid Attribute Modification "
+				"Time caught for file: %s", Filename);
 			pattr->AttrModificationTime = 0;
 		}
 #endif
@@ -508,18 +520,24 @@
 				int valueSizeOffset = xattrSize;
 				xattrSize += sizeof(u_int32_t);
 
-				// This gets the attribute value (may be text or binary), no termination
-				int valueSize = ::lgetxattr(Filename, attrKey.c_str(), buffer+xattrSize, xattrBufferSize-xattrSize);
+				// Find size of attribute (must call with buffer and length 0 on some platforms,
+				// as -1 is returned if the data doesn't fit.)
+				int valueSize = ::lgetxattr(Filename, attrKey.c_str(), 0, 0);
+				if(valueSize<0)
+				{
+					THROW_EXCEPTION(CommonException, OSFileError);
+				}
 
+				// Resize block, if needed
 				if(xattrSize+valueSize>xattrBufferSize)
 				{
 					xattrBufferSize = (xattrBufferSize+valueSize)*2;
 					outputBlock.ResizeBlock(xattrBufferSize);
 					buffer = static_cast<unsigned char*>(outputBlock.GetBuffer());
-
-					valueSize = ::lgetxattr(Filename, attrKey.c_str(), buffer+xattrSize, xattrBufferSize-xattrSize);
 				}
 
+				// This gets the attribute value (may be text or binary), no termination
+				valueSize = ::lgetxattr(Filename, attrKey.c_str(), buffer+xattrSize, xattrBufferSize-xattrSize);
 				if(valueSize<0)
 				{
 					THROW_EXCEPTION(CommonException, OSFileError);
@@ -537,7 +555,7 @@
 
 			outputBlock.ResizeBlock(xattrSize);
 		}
-		else if(listSize<0 && errno!=EOPNOTSUPP)
+		else if(listSize<0 && errno!=EOPNOTSUPP && errno!=EACCES)
 		{
 			THROW_EXCEPTION(CommonException, OSFileError);
 		}

Modified: box/chris/boxi/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupClientRestore.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupClientRestore.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,11 +9,14 @@
 
 #include "Box.h"
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string>
 #include <set>
-#include <unistd.h>
 #include <limits.h>
 #include <stdio.h>
 

Modified: box/chris/boxi/lib/backupclient/BackupDaemonConfigVerify.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupDaemonConfigVerify.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupDaemonConfigVerify.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -84,6 +84,8 @@
 	{"ExtendedLogging",	"no", ConfigTest_IsBool, 0},			// make value "yes" to enable in config file
 
 	{"CommandSocket", 0, 0, 0},				// not compulsory to have this
+	{"KeepAliveTime", 0, ConfigTest_IsInt, 0},				// optional
+ 	{"StoreObjectInfoFile", 0, 0, 0},				// optional
 
 	{"NotifyScript", 0, 0, 0},				// optional script to run when backup needs attention, eg store full
 	
@@ -102,4 +104,3 @@
 	ConfigTest_Exists | ConfigTest_LastEntry,
 	0
 };
-

Modified: box/chris/boxi/lib/backupclient/BackupStoreDirectory.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupStoreDirectory.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupStoreDirectory.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -36,7 +36,7 @@
 	// Then a StreamableMemBlock for attributes
 } dir_StreamFormat;
 
-enum
+typedef enum
 {
 	Option_DependencyInfoPresent = 1
 } dir_StreamFormatOptions;

Modified: box/chris/boxi/lib/backupclient/BackupStoreFile.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupStoreFile.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupStoreFile.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/stat.h>
 #include <string.h>
 #include <new>
@@ -1480,7 +1483,9 @@
 // --------------------------------------------------------------------------
 void BackupStoreFile::EncodingBuffer::Reallocate(int NewSize)
 {
+#ifndef WIN32
 	TRACE2("Reallocating EncodingBuffer from %d to %d\n", mBufferSize, NewSize);
+#endif
 	ASSERT(mpBuffer != 0);
 	uint8_t *buffer = (uint8_t*)BackupStoreFile::CodingChunkAlloc(NewSize);
 	if(buffer == 0)
@@ -1499,3 +1504,27 @@
 }
 
 
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    DiffTimer::DiffTimer();
+//		Purpose: Constructor
+//		Created: 2005/02/01
+//
+// --------------------------------------------------------------------------
+DiffTimer::DiffTimer()
+{
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    DiffTimer::DiffTimer();
+//		Purpose: Destructor
+//		Created: 2005/02/01
+//
+// --------------------------------------------------------------------------
+DiffTimer::~DiffTimer()
+{	
+}

Modified: box/chris/boxi/lib/backupclient/BackupStoreFile.h
===================================================================
--- box/chris/boxi/lib/backupclient/BackupStoreFile.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupStoreFile.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -38,6 +38,27 @@
 // --------------------------------------------------------------------------
 //
 // Class
+//		Name:    DiffTimer
+//		Purpose: Interface for classes that can keep track of diffing time,
+//				 and send SSL keepalive messages
+//		Created: 2006/01/19
+//
+// --------------------------------------------------------------------------
+class DiffTimer
+{
+public:
+	DiffTimer();
+	virtual ~DiffTimer();
+public:
+	virtual void   DoKeepAlive() = 0;
+	virtual time_t GetTimeMgmtEpoch() = 0;
+	virtual int    GetMaximumDiffingTime() = 0;
+	virtual int    GetKeepaliveTime() = 0;
+};
+
+// --------------------------------------------------------------------------
+//
+// Class
 //		Name:    BackupStoreFile
 //		Purpose: Class to hold together utils for maniplating files.
 //		Created: 2003/08/28
@@ -95,9 +116,16 @@
 
 	// Main interface
 	static std::auto_ptr<IOStream> EncodeFile(const char *Filename, int64_t ContainerID, const BackupStoreFilename &rStoreFilename, int64_t *pModificationTime = 0);
-	static std::auto_ptr<IOStream> EncodeFileDiff(const char *Filename, int64_t ContainerID,
-		const BackupStoreFilename &rStoreFilename, int64_t DiffFromObjectID, IOStream &rDiffFromBlockIndex,
-		int Timeout, int64_t *pModificationTime = 0, bool *pIsCompletelyDifferent = 0);
+	static std::auto_ptr<IOStream> EncodeFileDiff
+	(
+		const char *Filename, int64_t ContainerID,
+		const BackupStoreFilename &rStoreFilename, 
+		int64_t DiffFromObjectID, IOStream &rDiffFromBlockIndex,
+		int Timeout, 
+		DiffTimer *pDiffTimer,
+		int64_t *pModificationTime = 0, 
+		bool *pIsCompletelyDifferent = 0
+	);
 	static bool VerifyEncodedFileFormat(IOStream &rFile, int64_t *pDiffFromObjectIDOut = 0, int64_t *pContainerIDOut = 0);
 	static void CombineFile(IOStream &rDiff, IOStream &rDiff2, IOStream &rFrom, IOStream &rOut);
 	static void CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream &rDiff2b, IOStream &rOut);
@@ -144,8 +172,7 @@
 		free(a);
 	}
 
-	// Limits
-	static void SetMaximumDiffingTime(int Seconds);
+	static void DiffTimerExpired();
 
 	// Building blocks
 	class EncodingBuffer
@@ -192,4 +219,3 @@
 #include "MemLeakFindOff.h"
 
 #endif // BACKUPSTOREFILE__H
-

Modified: box/chris/boxi/lib/backupclient/BackupStoreFileDiff.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupStoreFileDiff.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupStoreFileDiff.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -11,11 +11,11 @@
 
 #include <new>
 #include <map>
-#include <signal.h>
-#ifdef WIN32
-#include <time.h>
-#else
-#include <sys/time.h>
+
+#ifdef HAVE_TIME_H
+	#include <time.h>
+#elif HAVE_SYS_TIME_H
+	#include <sys/time.h>
 #endif
 
 #include "BackupStoreFile.h"
@@ -43,33 +43,37 @@
 
 static void LoadIndex(IOStream &rBlockIndex, int64_t ThisID, BlocksAvailableEntry **ppIndex, int64_t &rNumBlocksOut, int Timeout, bool &rCanDiffFromThis);
 static void FindMostUsedSizes(BlocksAvailableEntry *pIndex, int64_t NumBlocks, int32_t Sizes[BACKUP_FILE_DIFF_MAX_BLOCK_SIZES]);
-static void SearchForMatchingBlocks(IOStream &rFile, std::map<int64_t, int64_t> &rFoundBlocks, BlocksAvailableEntry *pIndex, int64_t NumBlocks, int32_t Sizes[BACKUP_FILE_DIFF_MAX_BLOCK_SIZES]);
+static void SearchForMatchingBlocks(IOStream &rFile, 
+	std::map<int64_t, int64_t> &rFoundBlocks, BlocksAvailableEntry *pIndex, 
+	int64_t NumBlocks, int32_t Sizes[BACKUP_FILE_DIFF_MAX_BLOCK_SIZES],
+	DiffTimer *pDiffTimer);
 static void SetupHashTable(BlocksAvailableEntry *pIndex, int64_t NumBlocks, int32_t BlockSize, BlocksAvailableEntry **pHashTable);
 static bool SecondStageMatch(BlocksAvailableEntry *pFirstInHashList, RollingChecksum &fastSum, uint8_t *pBeginnings, uint8_t *pEndings, int Offset, int32_t BlockSize, int64_t FileBlockNumber,
 BlocksAvailableEntry *pIndex, std::map<int64_t, int64_t> &rFoundBlocks);
 static void GenerateRecipe(BackupStoreFileEncodeStream::Recipe &rRecipe, BlocksAvailableEntry *pIndex, int64_t NumBlocks, std::map<int64_t, int64_t> &rFoundBlocks, int64_t SizeOfInputFile);
 
-// Avoid running on too long with diffs
-static int sMaximumDiffTime = 600;		// maximum time to spend diffing
-static bool sDiffTimedOut = false;
-static bool sSetTimerSignelHandler = false;
-static void TimerSignalHandler(int signal);
-static void StartDiffTimer();
+// sDiffTimerExpired flags when the diff timer has expired. When true, the 
+// diff routine should check the wall clock as soon as possible, to determine 
+// whether it's time for a keepalive to be sent, or whether the diff has been 
+// running for too long and should be terminated.
+static bool sDiffTimerExpired = false;
 
 
 // --------------------------------------------------------------------------
 //
 // Function
-//		Name:    BackupStoreFile::SetMaximumDiffingTime(int)
-//		Purpose: Sets the maximum time to spend diffing, in seconds. Time is
-//				 process virutal time.
-//		Created: 19/3/04
+//		Name:    BackupStoreFile::DiffTimerExpired()
+//		Purpose: Notifies BackupStoreFile object that the diff operation
+//				 timer has expired, which may mean that a keepalive should
+//				 be sent, or the diff should be terminated. Called from an
+//				 external timer, so it should not do more than set a flag.
 //
+//		Created: 19/1/06
+//
 // --------------------------------------------------------------------------
-void BackupStoreFile::SetMaximumDiffingTime(int Seconds)
+void BackupStoreFile::DiffTimerExpired()
 {
-	sMaximumDiffTime = Seconds;
-	TRACE1("Set maximum diffing time to %d seconds\n", Seconds);
+	sDiffTimerExpired = true;
 }
 
 
@@ -139,9 +143,12 @@
 //		Created: 12/1/04
 //
 // --------------------------------------------------------------------------
-std::auto_ptr<IOStream> BackupStoreFile::EncodeFileDiff(const char *Filename, int64_t ContainerID,
-	const BackupStoreFilename &rStoreFilename, int64_t DiffFromObjectID, IOStream &rDiffFromBlockIndex,
-	int Timeout, int64_t *pModificationTime, bool *pIsCompletelyDifferent)
+std::auto_ptr<IOStream> BackupStoreFile::EncodeFileDiff
+(
+	const char *Filename, int64_t ContainerID,
+	const BackupStoreFilename &rStoreFilename, int64_t DiffFromObjectID, 
+	IOStream &rDiffFromBlockIndex, int Timeout, DiffTimer *pDiffTimer, 
+	int64_t *pModificationTime, bool *pIsCompletelyDifferent)
 {
 	// Is it a symlink?
 	{
@@ -180,9 +187,6 @@
 	
 	// Pointer to recipe we're going to create
 	BackupStoreFileEncodeStream::Recipe *precipe = 0;
-
-	// Start the timeout timer, so that the operation doesn't continue for ever
-	StartDiffTimer();
 	
 	try
 	{
@@ -204,7 +208,8 @@
 				// Get size of file
 				sizeOfInputFile = file.BytesLeftToRead();
 				// Find all those lovely matching blocks
-				SearchForMatchingBlocks(file, foundBlocks, pindex, blocksInIndex, sizesToScan);
+				SearchForMatchingBlocks(file, foundBlocks, pindex, 
+					blocksInIndex, sizesToScan, pDiffTimer);
 				
 				// Is it completely different?
 				completelyDifferent = (foundBlocks.size() == 0);
@@ -475,8 +480,20 @@
 //
 // --------------------------------------------------------------------------
 static void SearchForMatchingBlocks(IOStream &rFile, std::map<int64_t, int64_t> &rFoundBlocks,
-	BlocksAvailableEntry *pIndex, int64_t NumBlocks, int32_t Sizes[BACKUP_FILE_DIFF_MAX_BLOCK_SIZES])
+	BlocksAvailableEntry *pIndex, int64_t NumBlocks, 
+	int32_t Sizes[BACKUP_FILE_DIFF_MAX_BLOCK_SIZES], DiffTimer *pDiffTimer)
 {
+	time_t TimeMgmtEpoch   = 0;
+	int MaximumDiffingTime = 0;
+	int KeepAliveTime      = 0;
+
+	if (pDiffTimer)
+	{
+		TimeMgmtEpoch      = pDiffTimer->GetTimeMgmtEpoch();
+		MaximumDiffingTime = pDiffTimer->GetMaximumDiffingTime();
+		KeepAliveTime      = pDiffTimer->GetKeepaliveTime();
+	}
+	
 	std::map<int64_t, int32_t> goodnessOfFit;
 
 	// Allocate the hash lookup table
@@ -560,6 +577,31 @@
 			int rollOverInitialBytes = 0;
 			while(true)
 			{
+				if(sDiffTimerExpired)
+				{
+					ASSERT(TimeMgmtEpoch > 0);
+					ASSERT(pDiffTimer != NULL);
+					
+					time_t tTotalRunIntvl = time(NULL) - TimeMgmtEpoch;
+					
+					if(MaximumDiffingTime > 0 && 
+						tTotalRunIntvl >= MaximumDiffingTime)
+					{
+						TRACE0("MaximumDiffingTime reached - "
+							"suspending file diff\n");
+						abortSearch = true;
+						break;
+					}
+					else if(KeepAliveTime > 0)
+					{
+						TRACE0("KeepAliveTime reached - "
+							"initiating keep-alive\n");
+						pDiffTimer->DoKeepAlive();
+					}
+
+					sDiffTimerExpired = false;
+				}
+
 				// Load in another block of data, and record how big it is
 				int bytesInEndings = rFile.Read(endings, Sizes[s]);
 				int tmp;
@@ -643,8 +685,13 @@
 							// End this loop, so the final byte isn't used again
 							break;
 						}
+
+						int64_t NumBlocksFound = static_cast<int64_t>(
+							rFoundBlocks.size());
+						int64_t MaxBlocksFound = NumBlocks * 
+							BACKUP_FILE_DIFF_MAX_BLOCK_FIND_MULTIPLE;
 						
-						if(static_cast<int64_t>(rFoundBlocks.size()) > (NumBlocks * BACKUP_FILE_DIFF_MAX_BLOCK_FIND_MULTIPLE) || sDiffTimedOut)
+						if(NumBlocksFound > MaxBlocksFound)
 						{
 							abortSearch = true;
 							break;
@@ -787,7 +834,9 @@
 	ASSERT(pFirstInHashList != 0);
 	ASSERT(pIndex != 0);
 
-	uint16_t Hash = fastSum.GetComponentForHashing();
+#ifndef NDEBUG
+	uint16_t DEBUG_Hash = fastSum.GetComponentForHashing();
+#endif
 	uint32_t Checksum = fastSum.GetChecksum();
 
 	// Before we go to the expense of the MD5, make sure it's a darn good match on the checksum we already know.
@@ -825,7 +874,7 @@
 	{
 		//TRACE3("scan size %d, block size %d, hash %d\n", scan->mSize, BlockSize, Hash);
 		ASSERT(scan->mSize == BlockSize);
-		ASSERT(RollingChecksum::ExtractHashingComponent(scan->mWeakChecksum) == Hash);
+		ASSERT(RollingChecksum::ExtractHashingComponent(scan->mWeakChecksum) == DEBUG_Hash);
 	
 		// Compare?
 		if(strong.DigestMatches(scan->mStrongChecksum))
@@ -1005,55 +1054,3 @@
 	}
 #endif
 }
-
-
-// --------------------------------------------------------------------------
-//
-// Function
-//		Name:    static TimerSignalHandler(int)
-//		Purpose: Signal handler
-//		Created: 19/3/04
-//
-// --------------------------------------------------------------------------
-void TimerSignalHandler(int signal)
-{
-	sDiffTimedOut = true;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Function
-//		Name:    static StartDiffTimer()
-//		Purpose: Starts the diff timeout timer
-//		Created: 19/3/04
-//
-// --------------------------------------------------------------------------
-void StartDiffTimer()
-{
-	// Set timer signal handler
-	if(!sSetTimerSignelHandler)
-	{
-		::signal(SIGVTALRM, TimerSignalHandler);
-		sSetTimerSignelHandler = true;
-	}
-
-	struct itimerval timeout;
-	// Don't want this to repeat
-	timeout.it_interval.tv_sec = 0;
-	timeout.it_interval.tv_usec = 0;
-	// Single timeout after the specified number of seconds
-	timeout.it_value.tv_sec = sMaximumDiffTime;
-	timeout.it_value.tv_usec = 0;
-	// Set timer
-	if(::setitimer(ITIMER_VIRTUAL, &timeout, NULL) != 0)
-	{
-		TRACE0("WARNING: couldn't set diff timeout\n");
-	}
-	
-	// Unset flag (last thing)
-	sDiffTimedOut = false;
-}
-
-
-

Modified: box/chris/boxi/lib/backupclient/BackupStoreFilenameClear.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupStoreFilenameClear.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupStoreFilenameClear.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -184,28 +184,34 @@
 // Buffer for encoding and decoding -- do this all in one single buffer to
 // avoid lots of string allocation, which stuffs up memory usage.
 // These static memory vars are, of course, not thread safe, but we don't use threads.
-#ifndef NDEBUG
-static int sEncDecBufferSize = 2;	// small size for debug builds
-#else
-static int sEncDecBufferSize = 256;
-#endif
-static MemoryBlockGuard<uint8_t *> spEncDecBuffer(sEncDecBufferSize);
+static int sEncDecBufferSize = 0;
+static MemoryBlockGuard<uint8_t *> *spEncDecBuffer = 0;
 
-// fudge to stop leak reporting
-#ifdef BOX_MEMORY_LEAK_TESTING
-namespace
+static void EnsureEncDecBufferSize(int BufSize)
 {
-	class leak_off
+	if(spEncDecBuffer == 0)
 	{
-	public:
-		leak_off()
+#ifndef WIN32
+		TRACE1("Allocating filename encoding/decoding buffer with size %d\n", BufSize);
+#endif
+		spEncDecBuffer = new MemoryBlockGuard<uint8_t *>(BufSize);
+		MEMLEAKFINDER_NOT_A_LEAK(spEncDecBuffer);
+		MEMLEAKFINDER_NOT_A_LEAK(*spEncDecBuffer);
+		sEncDecBufferSize = BufSize;
+	}
+	else
+	{
+		if(sEncDecBufferSize < BufSize)
 		{
-			MEMLEAKFINDER_NOT_A_LEAK(spEncDecBuffer);
+#ifndef WIN32
+			TRACE2("Reallocating filename encoding/decoding buffer from %d to %d\n", sEncDecBufferSize, BufSize);
+#endif
+			spEncDecBuffer->Resize(BufSize);
+			sEncDecBufferSize = BufSize;
+			MEMLEAKFINDER_NOT_A_LEAK(*spEncDecBuffer);
 		}
-	};
-	leak_off dont_report_as_leak;
+	}
 }
-#endif
 
 // --------------------------------------------------------------------------
 //
@@ -221,16 +227,10 @@
 	int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize(rToEncode.size()) + 4;
 	
 	// Make sure encode/decode buffer has enough space
-	if(sEncDecBufferSize < maxOutSize)
-	{
-		TRACE2("Reallocating filename encoding/decoding buffer from %d to %d\n", sEncDecBufferSize, maxOutSize);
-		spEncDecBuffer.Resize(maxOutSize);
-		sEncDecBufferSize = maxOutSize;
-	}
+	EnsureEncDecBufferSize(maxOutSize);
 	
 	// Pointer to buffer
-	uint8_t *buffer = spEncDecBuffer;
-	MEMLEAKFINDER_NOT_A_LEAK(buffer);
+	uint8_t *buffer = *spEncDecBuffer;
 	
 	// Encode -- do entire block in one go
 	int encSize = rCipherContext.TransformBlock(buffer + 2, sEncDecBufferSize - 2, rToEncode.c_str(), rToEncode.size());
@@ -259,16 +259,10 @@
 	int maxOutSize = rCipherContext.MaxOutSizeForInBufferSize(size()) + 4;
 	
 	// Make sure encode/decode buffer has enough space
-	if(sEncDecBufferSize < maxOutSize)
-	{
-		TRACE2("Reallocating filename encoding/decoding buffer from %d to %d\n", sEncDecBufferSize, maxOutSize);
-		spEncDecBuffer.Resize(maxOutSize);
-		sEncDecBufferSize = maxOutSize;
-	}
+	EnsureEncDecBufferSize(maxOutSize);
 	
 	// Pointer to buffer
-	uint8_t *buffer = spEncDecBuffer;
-	MEMLEAKFINDER_NOT_A_LEAK(buffer);
+	uint8_t *buffer = *spEncDecBuffer;
 	
 	// Decrypt
 	const char *str = c_str() + 2;

Modified: box/chris/boxi/lib/backupclient/BackupStoreObjectDump.cpp
===================================================================
--- box/chris/boxi/lib/backupclient/BackupStoreObjectDump.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/BackupStoreObjectDump.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -96,18 +96,18 @@
 		int depends_l = 0;
 		if((*i)->GetDependsNewer() != 0)
 		{
-#ifdef WIN32
+#ifdef _MSC_VER
 			depends_l += ::sprintf(depends + depends_l, " depNew(%I64x)", (*i)->GetDependsNewer());
 #else
-			depends_l += ::sprintf(depends + depends_l, " depNew(%llx)", (*i)->GetDependsNewer());
+			depends_l += ::sprintf(depends + depends_l, " depNew(%llx)", (long long)((*i)->GetDependsNewer()));
 #endif
 		}
 		if((*i)->GetDependsOlder() != 0)
 		{
-#ifdef WIN32
+#ifdef _MSC_VER
 			depends_l += ::sprintf(depends + depends_l, " depOld(%I64x)", (*i)->GetDependsOlder());
 #else
-			depends_l += ::sprintf(depends + depends_l, " depOld(%llx)", (*i)->GetDependsOlder());
+			depends_l += ::sprintf(depends + depends_l, " depOld(%llx)", (long long)((*i)->GetDependsOlder()));
 #endif
 		}
 

Modified: box/chris/boxi/lib/backupclient/Makefile.extra
===================================================================
--- box/chris/boxi/lib/backupclient/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/backupclient/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -5,12 +5,12 @@
 
 # AUTOGEN SEEDING
 autogen_BackupProtocolClient.cpp autogen_BackupProtocolClient.h:	$(MAKEPROTOCOL) ../../bin/bbstored/backupprotocol.txt
-	perl $(GEN_CMD_SRV)
+	$(PERL) $(GEN_CMD_SRV)
 
 
 MAKEEXCEPTION = ../../lib/common/makeexception.pl
 
 # AUTOGEN SEEDING
 autogen_BackupStoreException.h autogen_BackupStoreException.cpp:	$(MAKEEXCEPTION) BackupStoreException.txt
-	perl $(MAKEEXCEPTION) BackupStoreException.txt
+	$(PERL) $(MAKEEXCEPTION) BackupStoreException.txt
 


Property changes on: box/chris/boxi/lib/common
___________________________________________________________________
Name: svn:ignore
   - autogen_CommonException.cpp
autogen_CommonException.h
autogen_ConversionException.cpp
autogen_ConversionException.h
BoxConfig.h
BoxConfig.h.in
Makefile


   + autogen_CommonException.cpp
autogen_CommonException.h
autogen_ConversionException.cpp
autogen_ConversionException.h
BoxConfig.h
BoxConfig.h.in
Makefile
makeexception.pl


Copied: box/chris/boxi/lib/common/Archive.h (from rev 547, box/trunk/lib/common/Archive.h)

Modified: box/chris/boxi/lib/common/BannerText.h
===================================================================
--- box/chris/boxi/lib/common/BannerText.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/BannerText.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -11,7 +11,7 @@
 #define BANNERTEXT__H
 
 #define BANNER_TEXT(UtilityName) \
-	"Box " UtilityName " v" BOX_VERSION ", (c) Ben Summers 2003, 2004\n"
+	"Box " UtilityName " v" BOX_VERSION ", (c) Ben Summers and contributors 2003-2006\n"
 
 #endif // BANNERTEXT__H
 

Modified: box/chris/boxi/lib/common/Box.h
===================================================================
--- box/chris/boxi/lib/common/Box.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/Box.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -10,6 +10,10 @@
 #ifndef BOX__H
 #define BOX__H
 
+#if defined BOXI && !defined _SAND_BOX_H
+	#error Include SandBox.h before Box.h when building Boxi!
+#endif
+
 // Use the same changes as gcc3 for gcc4
 #ifdef PLATFORM_GCC4
 	#define PLATFORM_GCC3
@@ -134,6 +138,16 @@
 #ifdef WORDS_BIGENDIAN
 	#define box_hton64(x) (x)
 	#define box_ntoh64(x) (x)
+#elif defined(HAVE_BSWAP64)
+	#ifdef HAVE_SYS_ENDIAN_H
+		#include <sys/endian.h>
+	#endif
+	#ifdef HAVE_ASM_BYTEORDER_H
+		#include <asm/byteorder.h>
+	#endif
+
+	#define box_hton64(x) BSWAP64(x)
+	#define box_ntoh64(x) BSWAP64(x)
 #else
 	#ifdef HAVE_SYS_ENDIAN_H
 		#include <sys/endian.h>

Modified: box/chris/boxi/lib/common/BoxPlatform.h
===================================================================
--- box/chris/boxi/lib/common/BoxPlatform.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/BoxPlatform.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -40,6 +40,18 @@
 	#endif
 #endif
 
+// Slight hack; disable interception on Darwin within raidfile test
+#ifdef __APPLE__
+	// TODO: Replace with autoconf test
+	#define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
+#endif
+
+// Disable memory testing under Darwin, it just doesn't like it very much.
+#ifdef __APPLE__
+	// TODO: We really should get some decent leak detection code.
+	#define PLATFORM_DISABLE_MEM_LEAK_TESTING
+#endif
+
 // Find out if credentials on UNIX sockets can be obtained
 #ifndef HAVE_GETPEEREID
 	#if !HAVE_DECL_SO_PEERCRED
@@ -47,11 +59,6 @@
 	#endif
 #endif
 
-// Cannot do the intercepts in test/raidfile if large file support is enabled
-#ifdef HAVE_LARGE_FILE_SUPPORT
-	#define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
-#endif
-
 #ifdef HAVE_DEFINE_PRAGMA
 	// set packing to one bytes (can't use push/pop on gcc)
 	#define BEGIN_STRUCTURE_PACKING_FOR_WIRE	#pragma pack(1)
@@ -62,6 +69,19 @@
 	#define STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
 #endif
 
+// Handle differing xattr APIs
+#ifdef HAVE_SYS_XATTR_H
+	#if !defined(HAVE_LLISTXATTR) && defined(HAVE_LISTXATTR) && HAVE_DECL_XATTR_NOFOLLOW
+		#define llistxattr(a,b,c) listxattr(a,b,c,XATTR_NOFOLLOW)
+	#endif
+	#if !defined(HAVE_LGETXATTR) && defined(HAVE_GETXATTR) && HAVE_DECL_XATTR_NOFOLLOW
+		#define lgetxattr(a,b,c,d) getxattr(a,b,c,d,0,XATTR_NOFOLLOW)
+	#endif
+	#if !defined(HAVE_LSETXATTR) && defined(HAVE_SETXATTR) && HAVE_DECL_XATTR_NOFOLLOW
+		#define lsetxattr(a,b,c,d,e) setxattr(a,b,c,d,0,(e)|XATTR_NOFOLLOW)
+	#endif
+#endif
+
 #if defined WIN32 && !defined __MINGW32__
 	typedef __int8  int8_t;
 	typedef __int16 int16_t;
@@ -73,13 +93,11 @@
 	typedef unsigned __int32 u_int32_t;
 	typedef unsigned __int64 u_int64_t;
 
-	#define HAVE_UINT8_T
-	#define HAVE_UINT16_T
-	#define HAVE_UINT32_T
-	#define HAVE_UINT64_T
+	#define HAVE_U_INT8_T
+	#define HAVE_U_INT16_T
+	#define HAVE_U_INT32_T
+	#define HAVE_U_INT64_T
 
-	typedef unsigned int uid_t;
-	typedef unsigned int gid_t;
 	typedef int pid_t;
 #endif // WIN32 && !__MINGW32__
 

Modified: box/chris/boxi/lib/common/CommonException.txt
===================================================================
--- box/chris/boxi/lib/common/CommonException.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/CommonException.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -43,3 +43,4 @@
 KQueueNotSupportedOnThisPlatform		36
 IOStreamGetLineNotEnoughDataToIgnore	37	Bad value passed to IOStreamGetLine::IgnoreBufferedData()
 TempDirPathTooLong				38	Your temporary directory path is too long. Check the TMP and TEMP environment variables.
+ArchiveBlockIncompleteRead		39	The Store Object Info File is too short or corrupted, and will be rewritten automatically when the next backup completes.

Modified: box/chris/boxi/lib/common/DebugMemLeakFinder.cpp
===================================================================
--- box/chris/boxi/lib/common/DebugMemLeakFinder.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/DebugMemLeakFinder.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -16,8 +16,11 @@
 #undef realloc
 #undef free
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <map>
-#include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <set>
@@ -222,12 +225,12 @@
 		}
 		else
 		{
-			TRACE4("Block 0x%08lx size %d allocated at %s:%d\n", (long)i->first, i->second.size, i->second.file, i->second.line);
+			TRACE4("Block 0x%08p size %d allocated at %s:%d\n", i->first, i->second.size, i->second.file, i->second.line);
 		}
 	}
 	for(std::map<void *, ObjectInfo>::const_iterator i(sSectionObjectBlocks.begin()); i != sSectionObjectBlocks.end(); ++i)
 	{
-		TRACE5("Object%s 0x%08lx size %d allocated at %s:%d\n", i->second.array?" []":"", (long)i->first, i->second.size, i->second.file, i->second.line);
+		TRACE5("Object%s 0x%08p size %d allocated at %s:%d\n", i->second.array?" []":"", i->first, i->second.size, i->second.file, i->second.line);
 	}
 }
 
@@ -252,11 +255,11 @@
 {
 	for(std::map<void *, MallocBlockInfo>::const_iterator i(sMallocBlocks.begin()); i != sMallocBlocks.end(); ++i)
 	{
-		if(is_leak(i->first)) ::fprintf(file, "Block 0x%08lx size %d allocated at %s:%d\n", (long)i->first, i->second.size, i->second.file, i->second.line);
+		if(is_leak(i->first)) ::fprintf(file, "Block 0x%08p size %d allocated at %s:%d\n", i->first, i->second.size, i->second.file, i->second.line);
 	}
 	for(std::map<void *, ObjectInfo>::const_iterator i(sObjectBlocks.begin()); i != sObjectBlocks.end(); ++i)
 	{
-		if(is_leak(i->first)) ::fprintf(file, "Object%s 0x%08lx size %d allocated at %s:%d\n", i->second.array?" []":"", (long)i->first, i->second.size, i->second.file, i->second.line);
+		if(is_leak(i->first)) ::fprintf(file, "Object%s 0x%08p size %d allocated at %s:%d\n", i->second.array?" []":"", i->first, i->second.size, i->second.file, i->second.line);
 	}
 }
 
@@ -273,7 +276,11 @@
 	{
 		if(memleakfinder_numleaks() > 0)
 		{
+#ifdef HAVE_GETPID
 			fprintf(file, "MEMORY LEAKS FROM PROCESS %d (%s)\n", getpid(), markertext);
+#else
+			fprintf(file, "MEMORY LEAKS (%s)\n", markertext);
+#endif
 			memleakfinder_reportleaks_file(file);
 		}
 	

Modified: box/chris/boxi/lib/common/EventWatchFilesystemObject.cpp
===================================================================
--- box/chris/boxi/lib/common/EventWatchFilesystemObject.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/EventWatchFilesystemObject.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -10,8 +10,11 @@
 #include "Box.h"
 
 #include <fcntl.h>
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include "EventWatchFilesystemObject.h"
 #include "autogen_CommonException.h"
 

Modified: box/chris/boxi/lib/common/ExcludeList.cpp
===================================================================
--- box/chris/boxi/lib/common/ExcludeList.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/ExcludeList.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -17,6 +17,7 @@
 #include "ExcludeList.h"
 #include "Utils.h"
 #include "Configuration.h"
+#include "Archive.h"
 
 #include "MemLeakFindOn.h"
 
@@ -130,6 +131,8 @@
 				
 				// Store in list of regular expressions
 				mRegex.push_back(pregex);
+				// Store in list of regular expression string for Serialize
+				mRegexStr.push_back(i->c_str());
 			}
 			catch(...)
 			{
@@ -213,7 +216,183 @@
 	mpAlwaysInclude = pAlwaysInclude;
 }
 
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    ExcludeList::Deserialize(Archive & rArchive)
+//		Purpose: Deserializes this object instance from a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+void ExcludeList::Deserialize(Archive & rArchive)
+{
+	//
+	//
+	//
+	mDefinite.clear();
 
-	
+#ifdef HAVE_REGEX_H
+	// free regex memory
+	while(mRegex.size() > 0)
+	{
+		regex_t *pregex = mRegex.back();
+		mRegex.pop_back();
+		// Free regex storage, and the structure itself
+		::regfree(pregex);
+		delete pregex;
+	}
 
+	mRegexStr.clear();
+#endif
 
+	// Clean up exceptions list
+	if(mpAlwaysInclude != 0)
+	{
+		delete mpAlwaysInclude;
+		mpAlwaysInclude = 0;
+	}
+
+	//
+	//
+	//
+	int64_t iCount = 0;
+	rArchive.Read(iCount);
+
+	if (iCount > 0)
+	{
+		for (int v = 0; v < iCount; v++)
+		{
+			// load each one
+			std::string strItem;
+			rArchive.Read(strItem);
+			mDefinite.insert(strItem);
+		}
+	}
+
+	//
+	//
+	//
+#ifdef HAVE_REGEX_H
+	rArchive.Read(iCount);
+
+	if (iCount > 0)
+	{
+		for (int v = 0; v < iCount; v++)
+		{
+			std::string strItem;
+			rArchive.Read(strItem);
+
+			// Allocate memory
+			regex_t* pregex = new regex_t;
+			
+			try
+			{
+				// Compile
+				if(::regcomp(pregex, strItem.c_str(), 
+					REG_EXTENDED | REG_NOSUB) != 0)
+				{
+					THROW_EXCEPTION(CommonException, 
+						BadRegularExpression)
+				}
+				
+				// Store in list of regular expressions
+				mRegex.push_back(pregex);
+
+				// Store in list of regular expression strings
+				// for Serialize
+				mRegexStr.push_back(strItem);
+			}
+			catch(...)
+			{
+				delete pregex;
+				throw;
+			}
+		}
+	}
+#endif // HAVE_REGEX_H
+
+	//
+	//
+	//
+	int64_t aMagicMarker = 0;
+	rArchive.Read(aMagicMarker);
+
+	if (aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
+	{
+		// NOOP
+	}
+	else if (aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
+	{
+		mpAlwaysInclude = new ExcludeList;
+		if (!mpAlwaysInclude)
+		{
+			throw std::bad_alloc();
+		}
+
+		mpAlwaysInclude->Deserialize(rArchive);
+	}
+	else
+	{
+		// there is something going on here
+		THROW_EXCEPTION(CommonException, Internal)
+	}
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    ExcludeList::Serialize(Archive & rArchive)
+//		Purpose: Serializes this object instance into a stream of bytes, using an Archive abstraction.
+//
+//		Created: 2005/04/11
+//
+// --------------------------------------------------------------------------
+void ExcludeList::Serialize(Archive & rArchive) const
+{
+	//
+	//
+	//
+	int64_t iCount = mDefinite.size();
+	rArchive.Write(iCount);
+
+	for (std::set<std::string>::const_iterator i = mDefinite.begin(); 
+		i != mDefinite.end(); i++)
+	{
+		rArchive.Write(*i);
+	}
+
+	//
+	//
+	//
+#ifdef HAVE_REGEX_H
+	// don't even try to save compiled regular expressions,
+	// use string copies instead.
+	ASSERT(mRegex.size() == mRegexStr.size()); 	
+
+	iCount = mRegexStr.size();
+	rArchive.Write(iCount);
+
+	for (std::vector<std::string>::const_iterator i = mRegexStr.begin(); 
+		i != mRegexStr.end(); i++)
+	{
+		rArchive.Write(*i);
+	}
+#endif // HAVE_REGEX_H
+
+	//
+	//
+	//
+	if (!mpAlwaysInclude)
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_NOOP;
+		rArchive.Write(aMagicMarker);
+	}
+	else
+	{
+		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_RECURSE; // be explicit about whether recursion follows
+		rArchive.Write(aMagicMarker);
+
+		mpAlwaysInclude->Serialize(rArchive);
+	}
+}

Modified: box/chris/boxi/lib/common/ExcludeList.h
===================================================================
--- box/chris/boxi/lib/common/ExcludeList.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/ExcludeList.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -19,6 +19,8 @@
 	typedef int regex_t;
 #endif
 
+class Archive;
+
 // --------------------------------------------------------------------------
 //
 // Class
@@ -33,6 +35,9 @@
 	ExcludeList();
 	~ExcludeList();
 
+	void Deserialize(Archive & rArchive);
+	void Serialize(Archive & rArchive) const;
+
 	void AddDefiniteEntries(const std::string &rEntries);
 	void AddRegexEntries(const std::string &rEntries);
 
@@ -55,6 +60,7 @@
 	std::set<std::string> mDefinite;
 #ifdef HAVE_REGEX_H
 	std::vector<regex_t *> mRegex;
+	std::vector<std::string> mRegexStr;	// save original regular expression string-based source for Serialize
 #endif
 
 	// For exceptions to the excludes

Modified: box/chris/boxi/lib/common/FdGetLine.cpp
===================================================================
--- box/chris/boxi/lib/common/FdGetLine.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/FdGetLine.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -10,8 +10,11 @@
 #include "Box.h"
 
 #include <sys/types.h>
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include "FdGetLine.h"
 #include "CommonException.h"
 
@@ -117,7 +120,21 @@
 		// Read more in?
 		if(!foundLineEnd && mBufferBegin >= mBytesInBuffer && !mPendingEOF)
 		{
+#ifdef WIN32
+			int bytes;
+
+			if (mFileHandle == _fileno(stdin))
+			{
+				bytes = console_read(mBuffer, sizeof(mBuffer));
+			}
+			else
+			{
+				bytes = ::read(mFileHandle, mBuffer, 
+					sizeof(mBuffer));
+			}
+#else // !WIN32
 			int bytes = ::read(mFileHandle, mBuffer, sizeof(mBuffer));
+#endif // WIN32
 			
 			// Error?
 			if(bytes == -1)

Modified: box/chris/boxi/lib/common/FileStream.h
===================================================================
--- box/chris/boxi/lib/common/FileStream.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/FileStream.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -15,8 +15,11 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <sys/stat.h>
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #ifdef WIN32
 	#define INVALID_FILE NULL
 	typedef HANDLE tOSFileHandle;

Modified: box/chris/boxi/lib/common/Guards.h
===================================================================
--- box/chris/boxi/lib/common/Guards.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/Guards.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -11,10 +11,13 @@
 #ifndef GUARDS__H
 #define GUARDS__H
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <fcntl.h>
 #include <stdlib.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <new>
 
 #include "CommonException.h"

Modified: box/chris/boxi/lib/common/Makefile.extra
===================================================================
--- box/chris/boxi/lib/common/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -3,9 +3,9 @@
 
 # AUTOGEN SEEDING
 autogen_CommonException.h autogen_CommonException.cpp:	$(MAKEEXCEPTION) CommonException.txt
-	perl $(MAKEEXCEPTION) CommonException.txt
+	$(PERL) $(MAKEEXCEPTION) CommonException.txt
 
 # AUTOGEN SEEDING
 autogen_ConversionException.h autogen_ConversionException.cpp:	$(MAKEEXCEPTION) ConversionException.txt
-	perl $(MAKEEXCEPTION) ConversionException.txt
+	$(PERL) $(MAKEEXCEPTION) ConversionException.txt
 

Modified: box/chris/boxi/lib/common/NamedLock.cpp
===================================================================
--- box/chris/boxi/lib/common/NamedLock.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/NamedLock.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -11,7 +11,11 @@
 
 #include <fcntl.h>
 #include <errno.h>
-#include <unistd.h>
+
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #ifdef HAVE_FLOCK
 	#include <sys/file.h>
 #endif

Modified: box/chris/boxi/lib/common/Test.h
===================================================================
--- box/chris/boxi/lib/common/Test.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/Test.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -14,8 +14,11 @@
 #include <sys/stat.h>
 #include <stdlib.h>
 #include <signal.h>
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <stdio.h>
  
 extern int failures;

Modified: box/chris/boxi/lib/common/UnixUser.cpp
===================================================================
--- box/chris/boxi/lib/common/UnixUser.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/UnixUser.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,11 +9,13 @@
 
 #include "Box.h"
 
-#ifndef WIN32
-#include <pwd.h>
+#ifdef HAVE_PWD_H
+	#include <pwd.h>
 #endif
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
 
 #include "UnixUser.h"
 #include "CommonException.h"

Modified: box/chris/boxi/lib/common/WaitForEvent.cpp
===================================================================
--- box/chris/boxi/lib/common/WaitForEvent.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/WaitForEvent.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <errno.h>
 #include <string.h>
 

Deleted: box/chris/boxi/lib/common/makeexception.pl
===================================================================
--- box/chris/boxi/lib/common/makeexception.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/common/makeexception.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,277 +0,0 @@
-#!/usr/bin/perl
-
-# global exception list file
-my $global_list = '../../ExceptionCodes.txt';
-
-
-my @exception;
-my @exception_desc;
-my $class;
-my $class_number;
-
-# read the description!
-
-open EXCEPTION_DESC,$ARGV[0] or die "Can't open $ARGV[0]";
-
-while(<EXCEPTION_DESC>)
-{
-	chomp; s/\A\s+//; s/#.+\Z//; s/\s+\Z//; s/\s+/ /g;
-	next unless m/\S/;
-
-	if(m/\AEXCEPTION\s+(.+)\s+(\d+)\Z/)
-	{
-		$class = $1;
-		$class_number = $2;
-	}
-	else
-	{
-		my ($name,$number,$description) = split /\s+/,$_,3;
-		if($name eq '' || $number =~ m/\D/)
-		{
-			die "Bad line '$_'";
-		}
-		if($exception[$number] ne '')
-		{
-			die "Duplicate exception number $number";
-		}
-		$exception[$number] = $name;
-		$exception_desc[$number] = $description;
-	}
-}
-
-die "Exception class and number not specified" unless $class ne '' && $class_number ne '';
-
-close EXCEPTION_DESC;
-
-# write the code
-print "Generating $class exception...\n";
-
-open CPP,">autogen_${class}Exception.cpp" or die "Can't open cpp file for writing";
-open H,">autogen_${class}Exception.h" or die "Can't open h file for writing";
-
-# write header file
-my $guardname = uc 'AUTOGEN_'.$class.'EXCEPTION_H';
-print H <<__E;
-
-// Auto-generated file -- do not edit
-
-#ifndef $guardname
-#define $guardname
-
-#include "BoxException.h"
-
-// --------------------------------------------------------------------------
-//
-// Class
-//		Name:    ${class}Exception
-//		Purpose: Exception
-//		Created: autogen
-//
-// --------------------------------------------------------------------------
-class ${class}Exception : public BoxException
-{
-public:
-	${class}Exception(unsigned int SubType)
-		: mSubType(SubType)
-	{
-	}
-	
-	${class}Exception(const ${class}Exception &rToCopy)
-		: mSubType(rToCopy.mSubType)
-	{
-	}
-	
-	~${class}Exception() throw ()
-	{
-	}
-	
-	enum
-	{
-		ExceptionType = $class_number
-	};
-
-	enum
-	{
-__E
-
-for(my $e = 0; $e <= $#exception; $e++)
-{
-	if($exception[$e] ne '')
-	{
-		print H "\t\t".$exception[$e].' = '.$e.(($e==$#exception)?'':',')."\n"
-	}
-}
-
-print H <<__E;
-	};
-	
-	virtual unsigned int GetType() const throw();
-	virtual unsigned int GetSubType() const throw();
-	virtual const char *what() const throw();
-
-private:
-	unsigned int mSubType;
-};
-
-#endif // $guardname
-__E
-
-# -----------------------------------------------------------------------------------------------------------
-
-print CPP <<__E;
-
-// Auto-generated file -- do not edit
-
-#include "Box.h"
-#include "autogen_${class}Exception.h"
-
-#include "MemLeakFindOn.h"
-
-#ifdef EXCEPTION_CODENAMES_EXTENDED
-	#ifdef EXCEPTION_CODENAMES_EXTENDED_WITH_DESCRIPTION
-static const char *whats[] = {
-__E
-
-my $last_seen = -1;
-for(my $e = 0; $e <= $#exception; $e++)
-{
-	if($exception[$e] ne '')
-	{
-		for(my $s = $last_seen + 1; $s < $e; $s++)
-		{
-			print CPP "\t\"UNUSED\",\n"
-		}
-		my $ext = ($exception_desc[$e] ne '')?" ($exception_desc[$e])":'';
-		print CPP "\t\"${class} ".$exception[$e].$ext.'"'.(($e==$#exception)?'':',')."\n";
-		$last_seen = $e;
-	}
-}
-
-print CPP <<__E;
-};
-	#else
-static const char *whats[] = {
-__E
-
-$last_seen = -1;
-for(my $e = 0; $e <= $#exception; $e++)
-{
-	if($exception[$e] ne '')
-	{
-		for(my $s = $last_seen + 1; $s < $e; $s++)
-		{
-			print CPP "\t\"UNUSED\",\n"
-		}
-		print CPP "\t\"${class} ".$exception[$e].'"'.(($e==$#exception)?'':',')."\n";
-		$last_seen = $e;
-	}
-}
-
-print CPP <<__E;
-};
-	#endif
-#endif
-
-unsigned int ${class}Exception::GetType() const throw()
-{
-	return ${class}Exception::ExceptionType;
-}
-
-unsigned int ${class}Exception::GetSubType() const throw()
-{
-	return mSubType;
-}
-
-const char *${class}Exception::what() const throw()
-{
-#ifdef EXCEPTION_CODENAMES_EXTENDED
-	if(mSubType < 0 || mSubType > (sizeof(whats) / sizeof(whats[0])))
-	{
-		return "${class}";
-	}
-	return whats[mSubType];
-#else
-	return "${class}";
-#endif
-}
-
-__E
-
-close H;
-close CPP;
-
-# update the global exception list
-my $list_before;
-my $list_after;
-my $is_after = 0;
-if(open CURRENT,$global_list)
-{
-	while(<CURRENT>)
-	{
-		next if m/\A#/;
-		
-		if(m/\AEXCEPTION TYPE (\w+) (\d+)/)
-		{
-			# check that the number isn't being reused
-			if($2 == $class_number && $1 ne $class)
-			{
-				die "Class number $class_number is being used by $class and $1 -- correct this.\n";
-			}
-			if($2 > $class_number)
-			{
-				# This class comes after the current one (ensures numerical ordering)
-				$is_after = 1;
-			}
-			if($1 eq $class)
-			{
-				# skip this entry
-				while(<CURRENT>)
-				{
-					last if m/\AEND TYPE/;
-				}
-				$_ = '';
-			}
-		}
-		
-		if($is_after)
-		{
-			$list_after .= $_;
-		}
-		else
-		{
-			$list_before .= $_;
-		}
-	}
-
-	close CURRENT;
-}
-
-open GLOBAL,">$global_list" or die "Can't open global exception code listing for writing";
-
-print GLOBAL <<__E;
-#
-# automatically generated file, do not edit.
-#
-# This file lists all the exception codes used by the system.
-# Use to look up more detailed descriptions of meanings of errors.
-#
-__E
-
-print GLOBAL $list_before;
-
-print GLOBAL "EXCEPTION TYPE $class $class_number\n";
-for(my $e = 0; $e <= $#exception; $e++)
-{
-	if($exception[$e] ne '')
-	{
-		my $ext = ($exception_desc[$e] ne '')?" - $exception_desc[$e]":'';
-		print GLOBAL "($class_number/$e) - ${class} ".$exception[$e].$ext."\n";
-	}
-}
-print GLOBAL "END TYPE\n";
-
-print GLOBAL $list_after;
-
-close GLOBAL;
-
-

Copied: box/chris/boxi/lib/common/makeexception.pl.in (from rev 547, box/trunk/lib/common/makeexception.pl.in)

Modified: box/chris/boxi/lib/compress/Makefile.extra
===================================================================
--- box/chris/boxi/lib/compress/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/compress/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -3,5 +3,5 @@
 
 # AUTOGEN SEEDING
 autogen_CompressException.h autogen_CompressException.cpp:	$(MAKEEXCEPTION) CompressException.txt
-	perl $(MAKEEXCEPTION) CompressException.txt
+	$(PERL) $(MAKEEXCEPTION) CompressException.txt
 

Modified: box/chris/boxi/lib/crypto/Makefile.extra
===================================================================
--- box/chris/boxi/lib/crypto/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/crypto/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -3,5 +3,5 @@
 
 # AUTOGEN SEEDING
 autogen_CipherException.cpp autogen_CipherException.h:	$(MAKEEXCEPTION) CipherException.txt
-	perl $(MAKEEXCEPTION) CipherException.txt
+	$(PERL) $(MAKEEXCEPTION) CipherException.txt
 

Modified: box/chris/boxi/lib/crypto/Random.cpp
===================================================================
--- box/chris/boxi/lib/crypto/Random.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/crypto/Random.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -69,7 +69,7 @@
 std::string Random::GenerateHex(int Length)
 {
 	uint8_t r[256];
-	if(Length > sizeof(r))
+	if(Length > (int)sizeof(r))
 	{
 		THROW_EXCEPTION(CipherException, LengthRequestedTooLongForRandomHex)
 	}


Property changes on: box/chris/boxi/lib/raidfile
___________________________________________________________________
Name: svn:ignore
   - autogen_RaidFileException.cpp
autogen_RaidFileException.h
Makefile

   + autogen_RaidFileException.cpp
autogen_RaidFileException.h
Makefile
raidfile-config


Modified: box/chris/boxi/lib/raidfile/Makefile.extra
===================================================================
--- box/chris/boxi/lib/raidfile/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/raidfile/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -3,5 +3,5 @@
 
 # AUTOGEN SEEDING
 autogen_RaidFileException.h autogen_RaidFileException.cpp:	$(MAKEEXCEPTION) RaidFileException.txt
-	perl $(MAKEEXCEPTION) RaidFileException.txt
+	$(PERL) $(MAKEEXCEPTION) RaidFileException.txt
 

Modified: box/chris/boxi/lib/raidfile/RaidFileWrite.cpp
===================================================================
--- box/chris/boxi/lib/raidfile/RaidFileWrite.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/raidfile/RaidFileWrite.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -461,10 +461,11 @@
 						ASSERT(sizeof(RaidFileRead::FileSizeType) == (2*sizeof(unsigned int)));
 						ASSERT(sizeof(RaidFileRead::FileSizeType) >= sizeof(off_t));
 						int sizePos = (blockSize/sizeof(unsigned int)) - 2;
-						RaidFileRead::FileSizeType sw = box_hton64(writeFileStat.st_size);
-						unsigned int *psize = (unsigned int *)(&sw);
-						pparity[sizePos+0] = pstripe1[sizePos+0] ^ psize[0];
-						pparity[sizePos+1] = pstripe1[sizePos+1] ^ psize[1];
+						union { RaidFileRead::FileSizeType l; unsigned int i[2]; } sw;
+
+						sw.l = box_hton64(writeFileStat.st_size);
+						pparity[sizePos+0] = pstripe1[sizePos+0] ^ sw.i[0];
+						pparity[sizePos+1] = pstripe1[sizePos+1] ^ sw.i[1];
 					}
 					else
 					{

Deleted: box/chris/boxi/lib/raidfile/raidfile-config
===================================================================
--- box/chris/boxi/lib/raidfile/raidfile-config	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/raidfile/raidfile-config	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,97 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-# should be running as root
-if($> != 0)
-{
-	printf "\nWARNING: this should be run as root\n\n"
-}
-
-# check and get command line parameters
-if($#ARGV != 4 && $#ARGV != 2)
-{
-	print <<__E;
-
-Setup raidfile config utility.
-
-Bad command line parameters.
-Usage:
-	raidfile-config config-dir block-size dir0 [dir1 dir2]
-
-config-dir usually /etc/box
-block-size must be a power of two, and usually the block or fragment size of your filing system
-dir0, dir1, dir2 are the directories used as the root of the raid file system
-
-If only one directory is specified, then userland RAID is disabled. Specifying three directories
-enables it.
-
-__E
-	exit(1);
-}
-
-my ($config_dir,$block_size, at dirs) = @ARGV;
-
-my $conf = $config_dir . '/raidfile.conf';
-
-# check dirs are unique, and exist
-my %d;
-for(@dirs)
-{
-	die "$_ is used twice" if exists $d{$_};
-	die "$_ is not a directory" unless -d $_;
-	die "$_ should be an absolute path" unless m/\A\//;
-	$d{$_} = 1;
-}
-
-# check block size is OK
-$block_size = int($block_size);
-die "Bad block size" if $block_size <= 0;
-my $c = 1;
-while(1)
-{
-	last if $c == $block_size;
-	die "Block size $block_size is not a power of two" if $c > $block_size;
-	$c = $c * 2;
-}
-
-# check that it doesn't already exist
-if(-f $conf)
-{
-	die "$conf already exists. Delete and try again"
-}
-
-# create directory
-if(!-d $config_dir)
-{
-	print "Creating $config_dir...\n";
-	mkdir $config_dir,0755 or die "Can't create $config_dir";
-}
-
-# adjust if userland RAID is disabled
-if($#dirs == 0)
-{
-	$dirs[1] = $dirs[0];
-	$dirs[2] = $dirs[0];
-	print "WARNING: userland RAID is disabled.\n"
-}
-
-# write the file
-open CONFIG,">$conf" or die "Can't open $conf for writing";
-
-print CONFIG <<__E;
-
-disc0
-{
-	SetNumber = 0
-	BlockSize = $block_size
-	Dir0 = $dirs[0]
-	Dir1 = $dirs[1]
-	Dir2 = $dirs[2]
-}
-
-__E
-
-close CONFIG;
-
-print "Config file written.\n";
-

Copied: box/chris/boxi/lib/raidfile/raidfile-config.in (from rev 547, box/trunk/lib/raidfile/raidfile-config.in)


Property changes on: box/chris/boxi/lib/server
___________________________________________________________________
Name: svn:ignore
   - autogen_ConnectionException.cpp
autogen_ConnectionException.h
autogen_ServerException.cpp
autogen_ServerException.h
Makefile

   + autogen_ConnectionException.cpp
autogen_ConnectionException.h
autogen_ServerException.cpp
autogen_ServerException.h
Makefile
makeprotocol.pl


Modified: box/chris/boxi/lib/server/Daemon.cpp
===================================================================
--- box/chris/boxi/lib/server/Daemon.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/Daemon.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,14 +9,18 @@
 
 #include "Box.h"
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
+#include <errno.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <signal.h>
 #include <string.h>
 #include <stdarg.h>
 
-#ifndef WIN32
-#include <syslog.h>
+#ifdef HAVE_SYSLOG_H
+	#include <syslog.h>
 #endif
 
 #include "Daemon.h"
@@ -24,6 +28,7 @@
 #include "ServerException.h"
 #include "Guards.h"
 #include "UnixUser.h"
+#include "FileModificationTime.h"
 
 #include "MemLeakFindOn.h"
 
@@ -92,22 +97,21 @@
 	}
 
 	std::string pidFileName;
-	const char *configfile = 0;
 
 	try
 	{
 		// Find filename of config file
-		configfile = DefaultConfigFile;
+		mConfigFileName = DefaultConfigFile;
 		if(argc >= 2)
 		{
 			// First argument is config file, or it's -c and the next arg is the config file
 			if(::strcmp(argv[1], "-c") == 0 && argc >= 3)
 			{
-				configfile = argv[2];
+				mConfigFileName = argv[2];
 			}
 			else
 			{
-				configfile = argv[1];
+				mConfigFileName = argv[1];
 			}
 		}
 		
@@ -123,23 +127,55 @@
 
 		// Load the configuration file.
 		std::string errors;
-		std::auto_ptr<Configuration> pconfig = Configuration::LoadAndVerify(configfile, GetConfigVerify(), errors);
+		std::auto_ptr<Configuration> pconfig;
 
+		try
+		{
+			pconfig = Configuration::LoadAndVerify(
+				mConfigFileName.c_str(), 
+				GetConfigVerify(), errors);
+		}
+		catch(BoxException &e)
+		{
+			if(e.GetType() == CommonException::ExceptionType &&
+				e.GetSubType() == CommonException::OSFileOpenError)
+			{
+				fprintf(stderr, "%s: failed to start: "
+					"failed to open configuration file: "
+					"%s", DaemonName(), 
+					mConfigFileName.c_str());
+#ifdef WIN32
+				::syslog(LOG_ERR, "%s: failed to start: "
+					"failed to open configuration file: "
+					"%s", DaemonName(), 
+					mConfigFileName.c_str());
+#endif
+				return 1;
+			}
+
+			throw;
+		}
+
 		// Got errors?
 		if(pconfig.get() == 0 || !errors.empty())
 		{
 			// Tell user about errors
-			fprintf(stderr, "%s: Errors in config file %s:\n%s", DaemonName(), configfile, errors.c_str());
+			fprintf(stderr, "%s: Errors in config file %s:\n%s", 
+				DaemonName(), mConfigFileName.c_str(), 
+				errors.c_str());
+#ifdef WIN32
+			::syslog(LOG_ERR, "%s: Errors in config file %s:\n%s",
+				DaemonName(), mConfigFileName.c_str(), 
+				errors.c_str());
+#endif
 			// And give up
 			return 1;
 		}
 		
 		// Store configuration
 		mpConfiguration = pconfig.release();
+		mLoadedConfigModifiedTime = GetConfigFileModifiedTime();
 		
-		// Server configuration
-		const Configuration &serverConfig(mpConfiguration->GetSubConfiguration("Server"));
-		
 		// Let the derived class have a go at setting up stuff in the initial process
 		SetupInInitialProcess();
 		
@@ -154,6 +190,10 @@
 			THROW_EXCEPTION(ServerException, DaemoniseFailed)
 		}
 		
+		// Server configuration
+		const Configuration &serverConfig(
+			mpConfiguration->GetSubConfiguration("Server"));
+
 		// Open PID file for writing
 		pidFileName = serverConfig.GetKeyValue("PidFile");
 		FileHandleGuard<(O_WRONLY | O_CREAT | O_TRUNC), (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)> pidFile(pidFileName.c_str());
@@ -228,7 +268,8 @@
 		// open the log
 		::openlog(DaemonName(), LOG_PID, LOG_LOCAL6);
 		// Log the start message
-		::syslog(LOG_INFO, "Starting daemon (config: %s) (version " BOX_VERSION ")", configfile);
+		::syslog(LOG_INFO, "Starting daemon (config: %s) (version " 
+			BOX_VERSION ")", mConfigFileName.c_str());
 
 #ifndef WIN32
 		// Write PID to file
@@ -282,17 +323,33 @@
 	}
 	catch(BoxException &e)
 	{
-		fprintf(stderr, "%s: exception %s (%d/%d)\n", DaemonName(), e.what(), e.GetType(), e.GetSubType());
+		fprintf(stderr, "%s: failed to start: exception %s (%d/%d)\n", 
+			DaemonName(), e.what(), e.GetType(), e.GetSubType());
+#ifdef WIN32
+		::syslog(LOG_ERR, "%s: failed to start: "
+			"exception %s (%d/%d)\n", DaemonName(), 
+			e.what(), e.GetType(), e.GetSubType());
+#endif
 		return 1;
 	}
 	catch(std::exception &e)
 	{
-		fprintf(stderr, "%s: exception %s\n", DaemonName(), e.what());
+		fprintf(stderr, "%s: failed to start: exception %s\n", 
+			DaemonName(), e.what());
+#ifdef WIN32
+		::syslog(LOG_ERR, "%s: failed to start: exception %s\n", 
+			DaemonName(), e.what());
+#endif
 		return 1;
 	}
 	catch(...)
 	{
-		fprintf(stderr, "%s: unknown exception\n", DaemonName());
+		fprintf(stderr, "%s: failed to start: unknown exception\n", 
+			DaemonName());
+#ifdef WIN32
+		::syslog(LOG_ERR, "%s: failed to start: unknown exception\n", 
+			DaemonName());
+#endif
 		return 1;
 	}
 	
@@ -306,15 +363,23 @@
 			if(mReloadConfigWanted && !mTerminateWanted)
 			{
 				// Need to reload that config file...
-				::syslog(LOG_INFO, "Reloading configuration (config: %s)", configfile);
+				::syslog(LOG_INFO, "Reloading configuration "
+					"(config: %s)", 
+					mConfigFileName.c_str());
 				std::string errors;
-				std::auto_ptr<Configuration> pconfig = Configuration::LoadAndVerify(configfile, GetConfigVerify(), errors);
+				std::auto_ptr<Configuration> pconfig = 
+					Configuration::LoadAndVerify(
+						mConfigFileName.c_str(),
+						GetConfigVerify(), errors);
 
 				// Got errors?
 				if(pconfig.get() == 0 || !errors.empty())
 				{
 					// Tell user about errors
-					::syslog(LOG_ERR, "Errors in config file %s:\n%s", configfile, errors.c_str());
+					::syslog(LOG_ERR, "Errors in config "
+						"file %s:\n%s", 
+						mConfigFileName.c_str(),
+						errors.c_str());
 					// And give up
 					return 1;
 				}
@@ -325,6 +390,8 @@
 
 				// Store configuration
 				mpConfiguration = pconfig.release();
+				mLoadedConfigModifiedTime =
+					GetConfigFileModifiedTime();
 				
 				// Stop being marked for loading config again
 				mReloadConfigWanted = false;
@@ -339,17 +406,21 @@
 	}
 	catch(BoxException &e)
 	{
-		::syslog(LOG_ERR, "exception %s (%d/%d) -- terminating", e.what(), e.GetType(), e.GetSubType());
+		::syslog(LOG_ERR, "%s: terminating due to exception %s "
+			"(%d/%d)", DaemonName(), e.what(), e.GetType(), 
+			e.GetSubType());
 		return 1;
 	}
 	catch(std::exception &e)
 	{
-		::syslog(LOG_ERR, "exception %s -- terminating", e.what());
+		::syslog(LOG_ERR, "%s: terminating due to exception %s", 
+			DaemonName(), e.what());
 		return 1;
 	}
 	catch(...)
 	{
-		::syslog(LOG_ERR, "unknown exception -- terminating");
+		::syslog(LOG_ERR, "%s: terminating due to unknown exception",
+			DaemonName());
 		return 1;
 	}
 	
@@ -547,3 +618,49 @@
 	
 #endif // HAVE_SETPROCTITLE
 }
+
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    Daemon::GetConfigFileModifiedTime()
+//		Purpose: Returns the timestamp when the configuration file
+//			 was last modified
+//
+//		Created: 2006/01/29
+//
+// --------------------------------------------------------------------------
+
+box_time_t Daemon::GetConfigFileModifiedTime() const
+{
+	struct stat st;
+
+	if(::stat(GetConfigFileName().c_str(), &st) != 0)
+	{
+		if (errno == ENOENT)
+		{
+			return 0;
+		}
+		THROW_EXCEPTION(CommonException, OSFileError)
+	}
+	
+	return FileModificationTime(st);
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    Daemon::GetLoadedConfigModifiedTime()
+//		Purpose: Returns the timestamp when the configuration file
+//			 had been last modified, at the time when it was 
+//			 loaded
+//
+//		Created: 2006/01/29
+//
+// --------------------------------------------------------------------------
+
+box_time_t Daemon::GetLoadedConfigModifiedTime() const
+{
+	return mLoadedConfigModifiedTime;
+}
+

Modified: box/chris/boxi/lib/server/Daemon.h
===================================================================
--- box/chris/boxi/lib/server/Daemon.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/Daemon.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -16,6 +16,10 @@
 #ifndef DAEMON__H
 #define DAEMON__H
 
+#include <string>
+
+#include "BoxTime.h"
+
 class Configuration;
 class ConfigurationVerify;
 
@@ -40,7 +44,8 @@
 	
 	virtual void Run();
 	const Configuration &GetConfiguration() const;
-	
+	const std::string &GetConfigFileName() const {return mConfigFileName;}
+
 	virtual const char *DaemonName() const;
 	virtual const char *DaemonBanner() const;
 	virtual const ConfigurationVerify *GetConfigVerify() const;
@@ -57,12 +62,18 @@
 	virtual void EnterChild();
 	
 	static void SetProcessTitle(const char *format, ...);
+
+protected:
+	box_time_t GetLoadedConfigModifiedTime() const;
 	
 private:
 	static void SignalHandler(int sigraised);
+	box_time_t GetConfigFileModifiedTime() const;
 	
 private:
+	std::string mConfigFileName;
 	Configuration *mpConfiguration;
+	box_time_t mLoadedConfigModifiedTime;
 	bool mReloadConfigWanted;
 	bool mTerminateWanted;
 	static Daemon *spDaemon;

Modified: box/chris/boxi/lib/server/LocalProcessStream.cpp
===================================================================
--- box/chris/boxi/lib/server/LocalProcessStream.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/LocalProcessStream.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,11 +9,14 @@
 
 #include "Box.h"
 
-#ifndef WIN32
-#include <sys/socket.h>
+#ifdef HAVE_SYS_SOCKET_H
+	#include <sys/socket.h>
 #endif
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include "LocalProcessStream.h"
 #include "SocketStream.h"
 #include "autogen_ServerException.h"

Modified: box/chris/boxi/lib/server/Makefile.extra
===================================================================
--- box/chris/boxi/lib/server/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -3,9 +3,9 @@
 
 # AUTOGEN SEEDING
 autogen_ServerException.h autogen_ServerException.cpp:	$(MAKEEXCEPTION) ServerException.txt
-	perl $(MAKEEXCEPTION) ServerException.txt
+	$(PERL) $(MAKEEXCEPTION) ServerException.txt
 
 # AUTOGEN SEEDING
 autogen_ConnectionException.h autogen_ConnectionException.cpp:	$(MAKEEXCEPTION) ConnectionException.txt
-	perl $(MAKEEXCEPTION) ConnectionException.txt
+	$(PERL) $(MAKEEXCEPTION) ConnectionException.txt
 

Modified: box/chris/boxi/lib/server/Socket.cpp
===================================================================
--- box/chris/boxi/lib/server/Socket.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/Socket.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #ifndef WIN32
 #include <sys/socket.h>

Modified: box/chris/boxi/lib/server/SocketListen.h
===================================================================
--- box/chris/boxi/lib/server/SocketListen.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/SocketListen.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -11,8 +11,11 @@
 #define SOCKETLISTEN__H
 
 #include <errno.h>
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #ifdef HAVE_KQUEUE
 	#include <sys/event.h>
 	#include <sys/time.h>

Modified: box/chris/boxi/lib/server/SocketStream.cpp
===================================================================
--- box/chris/boxi/lib/server/SocketStream.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/SocketStream.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -9,7 +9,10 @@
 
 #include "Box.h"
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #include <errno.h>
 
@@ -35,7 +38,9 @@
 SocketStream::SocketStream()
 	: mSocketHandle(-1),
 	  mReadClosed(false),
-	  mWriteClosed(false)
+	  mWriteClosed(false),
+	  mBytesRead(0),
+	  mBytesWritten(0)
 {
 }
 
@@ -50,7 +55,9 @@
 SocketStream::SocketStream(int socket)
 	: mSocketHandle(socket),
 	  mReadClosed(false),
-	  mWriteClosed(false)
+	  mWriteClosed(false),
+	  mBytesRead(0),
+	  mBytesWritten(0)
 {
 	if(socket < 0)
 	{
@@ -69,7 +76,9 @@
 SocketStream::SocketStream(const SocketStream &rToCopy)
 	: mSocketHandle(::dup(rToCopy.mSocketHandle)),
 	  mReadClosed(rToCopy.mReadClosed),
-	  mWriteClosed(rToCopy.mWriteClosed)
+	  mWriteClosed(rToCopy.mWriteClosed),
+	  mBytesRead(rToCopy.mBytesRead),
+	  mBytesWritten(rToCopy.mBytesWritten)
 
 {
 	if(rToCopy.mSocketHandle < 0)
@@ -111,6 +120,7 @@
 	if(mSocketHandle != -1) {THROW_EXCEPTION(ServerException, SocketAlreadyOpen)}
 
 	mSocketHandle = socket;
+	ResetCounters();
 }
 
 
@@ -151,6 +161,7 @@
 		mSocketHandle = -1;
 		THROW_EXCEPTION(ConnectionException, Conn_SocketConnectError)
 	}
+	ResetCounters();
 }
 
 // --------------------------------------------------------------------------
@@ -222,6 +233,7 @@
 		mReadClosed = true;
 	}
 	
+	mBytesRead += r;
 	return r;
 }
 
@@ -263,6 +275,8 @@
 		bytesLeft -= sent;
 		// Move buffer pointer
 		buffer += sent;
+
+		mBytesWritten += sent;
 		
 		// Need to wait until it can send again?
 		if(bytesLeft > 0)

Modified: box/chris/boxi/lib/server/SocketStream.h
===================================================================
--- box/chris/boxi/lib/server/SocketStream.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/SocketStream.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -56,6 +56,15 @@
 	tOSSocketHandle mSocketHandle;
 	bool mReadClosed;
 	bool mWriteClosed;
+
+protected:
+	off_t mBytesRead;
+	off_t mBytesWritten;
+
+public:
+	off_t GetBytesRead() const {return mBytesRead;}
+	off_t GetBytesWritten() const {return mBytesWritten;}
+	void ResetCounters() {mBytesRead = mBytesWritten = 0;}
 };
 
 #endif // SOCKETSTREAM__H

Modified: box/chris/boxi/lib/server/SocketStreamTLS.cpp
===================================================================
--- box/chris/boxi/lib/server/SocketStreamTLS.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/SocketStreamTLS.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -40,6 +40,7 @@
 SocketStreamTLS::SocketStreamTLS()
 	: mpSSL(0), mpBIO(0)
 {
+	ResetCounters();
 }
 
 // --------------------------------------------------------------------------
@@ -101,6 +102,7 @@
 {
 	SocketStream::Open(Type, Name, Port);
 	Handshake(rContext);
+	ResetCounters();
 }
 
 
@@ -295,6 +297,7 @@
 		{
 		case SSL_ERROR_NONE:
 			// No error, return number of bytes read
+			mBytesRead += r;
 			return r;
 			break;
 
@@ -358,6 +361,7 @@
 		{
 		case SSL_ERROR_NONE:
 			// No error, data sent, return success
+			mBytesWritten += r;
 			return;
 			break;
 

Deleted: box/chris/boxi/lib/server/makeprotocol.pl
===================================================================
--- box/chris/boxi/lib/server/makeprotocol.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/server/makeprotocol.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,997 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-# Make protocol C++ classes from a protocol description file
-
-# built in type info (values are is basic type, C++ typename)
-# may get stuff added to it later if protocol uses extra types
-my %translate_type_info =
-(
-	'int64' => [1, 'int64_t'],
-	'int32' => [1, 'int32_t'],
-	'int16' => [1, 'int16_t'],
-	'int8' => [1, 'int8_t'],
-	'bool' => [1, 'bool'],
-	'string' => [0, 'std::string']
-);
-
-# built in instructions for logging various types
-# may be added to
-my %log_display_types = 
-(
-	'int64' => ['0x%llx', 'VAR'],
-	'int32' => ['0x%x', 'VAR'],
-	'int16' => ['0x%x', 'VAR'],
-	'int8' => ['0x%x', 'VAR'],
-	'bool' => ['%s', '((VAR)?"true":"false")'],
-	'string' => ['%s', 'VAR.c_str()']
-);
-
-
-
-my ($type, $file) = @ARGV;
-
-if($type ne 'Server' && $type ne 'Client')
-{
-	die "Neither Server or Client is specified on command line\n";
-}
-
-open IN, $file or die "Can't open input file $file\n";
-
-print "Making $type protocol classes from $file...\n";
-
-my @extra_header_files;
-
-my $implement_syslog = 0;
-my $implement_filelog = 0;
-
-# read attributes
-my %attr;
-while(<IN>)
-{
-	# get and clean line
-	my $l = $_; $l =~ s/#.*\Z//; $l =~ s/\A\s+//; $l =~ s/\s+\Z//; next unless $l =~ m/\S/;
-	
-	last if $l eq 'BEGIN_OBJECTS';
-	
-	my ($k,$v) = split /\s+/,$l,2;
-	
-	if($k eq 'ClientType')
-	{
-		add_type($v) if $type eq 'Client';
-	}
-	elsif($k eq 'ServerType')
-	{
-		add_type($v) if $type eq 'Server';
-	}
-	elsif($k eq 'ImplementLog')
-	{
-		my ($log_if_type,$log_type) = split /\s+/,$v;
-		if($type eq $log_if_type)
-		{
-			if($log_type eq 'syslog')
-			{
-				$implement_syslog = 1;
-			}
-			elsif($log_type eq 'file')
-			{
-				$implement_filelog = 1;
-			}
-			else
-			{
-				printf("ERROR: Unknown log type for implementation: $log_type\n");
-				exit(1);
-			}
-		}
-	}
-	elsif($k eq 'LogTypeToText')
-	{
-		my ($log_if_type,$type_name,$printf_format,$arg_template) = split /\s+/,$v;
-		if($type eq $log_if_type)
-		{
-			$log_display_types{$type_name} = [$printf_format,$arg_template]
-		}
-	}
-	else
-	{
-		$attr{$k} = $v;
-	}
-}
-
-sub add_type
-{
-	my ($protocol_name, $cpp_name, $header_file) = split /\s+/,$_[0];
-	
-	$translate_type_info{$protocol_name} = [0, $cpp_name];
-	push @extra_header_files, $header_file;
-}
-
-# check attributes
-for(qw/Name ServerContextClass IdentString/)
-{
-	if(!exists $attr{$_})
-	{
-		die "Attribute $_ is required, but not specified\n";
-	}
-}
-
-my $protocol_name = $attr{'Name'};
-my ($context_class, $context_class_inc) = split /\s+/,$attr{'ServerContextClass'};
-my $ident_string = $attr{'IdentString'};
-
-my $current_cmd = '';
-my %cmd_contents;
-my %cmd_attributes;
-my %cmd_constants;
-my %cmd_id;
-my @cmd_list;
-
-# read in the command definitions
-while(<IN>)
-{
-	# get and clean line
-	my $l = $_; $l =~ s/#.*\Z//; $l =~ s/\s+\Z//; next unless $l =~ m/\S/;
-	
-	# definitions or new command thing?
-	if($l =~ m/\A\s+/)
-	{
-		die "No command defined yet" if $current_cmd eq '';
-	
-		# definition of component
-		$l =~ s/\A\s+//;
-		
-		my ($type,$name,$value) = split /\s+/,$l;
-		if($type eq 'CONSTANT')
-		{
-			push @{$cmd_constants{$current_cmd}},"$name = $value"
-		}
-		else
-		{
-			push @{$cmd_contents{$current_cmd}},$type,$name;
-		}
-	}
-	else
-	{
-		# new command
-		my ($name,$id, at attributes) = split /\s+/,$l;
-		$cmd_attributes{$name} = [@attributes];
-		$cmd_id{$name} = int($id);
-		$current_cmd = $name;
-		push @cmd_list,$name;
-	}
-}
-
-close IN;
-
-
-
-# open files
-my $h_filename = 'autogen_'.$protocol_name.'Protocol'.$type.'.h';
-open CPP,'>autogen_'.$protocol_name.'Protocol'.$type.'.cpp';
-open H,">$h_filename";
-
-print CPP <<__E;
-
-// Auto-generated file -- do not edit
-
-#include "Box.h"
-#include "$h_filename"
-#include "IOStream.h"
-
-__E
-
-if($implement_syslog)
-{
-	print H <<EOF;
-#ifndef WIN32
-#include <syslog.h>
-#endif
-EOF
-}
-
-
-my $guardname = uc 'AUTOGEN_'.$protocol_name.'Protocol'.$type.'_H';
-print H <<__E;
-
-// Auto-generated file -- do not edit
-
-#ifndef $guardname
-#define $guardname
-
-#include "Protocol.h"
-#include "ProtocolObject.h"
-#include "ServerException.h"
-
-class IOStream;
-
-__E
-
-if($implement_filelog)
-{
-	print H qq~#include <stdio.h>\n~;
-}
-
-# extra headers
-for(@extra_header_files)
-{
-	print H qq~#include "$_"\n~
-}
-print H "\n";
-
-if($type eq 'Server')
-{
-	# need utils file for the server
-	print H '#include "Utils.h"',"\n\n"
-}
-
-
-my $derive_objects_from = 'ProtocolObject';
-my $objects_extra_h = '';
-my $objects_extra_cpp = '';
-if($type eq 'Server')
-{
-	# define the context
-	print H "class $context_class;\n\n";
-	print CPP "#include \"$context_class_inc\"\n\n";
-	
-	# change class we derive the objects from
-	$derive_objects_from = $protocol_name.'ProtocolObject';
-	
-	$objects_extra_h = <<__E;
-	virtual std::auto_ptr<ProtocolObject> DoCommand(${protocol_name}ProtocolServer &rProtocol, $context_class &rContext);
-__E
-	$objects_extra_cpp = <<__E;
-std::auto_ptr<ProtocolObject> ${derive_objects_from}::DoCommand(${protocol_name}ProtocolServer &rProtocol, $context_class &rContext)
-{
-	THROW_EXCEPTION(ConnectionException, Conn_Protocol_TriedToExecuteReplyCommand)
-}
-__E
-}
-
-print CPP qq~#include "MemLeakFindOn.h"\n~;
-
-if($type eq 'Client' && ($implement_syslog || $implement_filelog))
-{
-	# change class we derive the objects from
-	$derive_objects_from = $protocol_name.'ProtocolObjectCl';
-}
-if($implement_syslog)
-{
-	$objects_extra_h .= <<__E;
-	virtual void LogSysLog(const char *Action) const = 0;
-__E
-}
-if($implement_filelog)
-{
-	$objects_extra_h .= <<__E;
-	virtual void LogFile(const char *Action, FILE *file) const = 0;
-__E
-}
-
-if($derive_objects_from ne 'ProtocolObject')
-{	
-	# output a definition for the protocol object derviced class
-	print H <<__E;
-class ${protocol_name}ProtocolServer;
-	
-class $derive_objects_from : public ProtocolObject
-{
-public:
-	$derive_objects_from();
-	virtual ~$derive_objects_from();
-	$derive_objects_from(const $derive_objects_from &rToCopy);
-	
-$objects_extra_h
-};
-__E
-
-	# and some cpp definitions
-	print CPP <<__E;
-${derive_objects_from}::${derive_objects_from}()
-{
-}
-${derive_objects_from}::~${derive_objects_from}()
-{
-}
-${derive_objects_from}::${derive_objects_from}(const $derive_objects_from &rToCopy)
-{
-}
-$objects_extra_cpp
-__E
-}
-
-
-
-my $classname_base = $protocol_name.'Protocol'.$type;
-
-# output the classes
-for my $cmd (@cmd_list)
-{
-	print H <<__E;
-class $classname_base$cmd : public $derive_objects_from
-{
-public:
-	$classname_base$cmd();
-	$classname_base$cmd(const $classname_base$cmd &rToCopy);
-	~$classname_base$cmd();
-	int GetType() const;
-	enum
-	{
-		TypeID = $cmd_id{$cmd}
-	};
-__E
-	# constants
-	if(exists $cmd_constants{$cmd})
-	{
-		print H "\tenum\n\t{\n\t\t";
-		print H join(",\n\t\t",@{$cmd_constants{$cmd}});
-		print H "\n\t};\n";
-	}
-	# flags
-	if(obj_is_type($cmd,'EndsConversation'))
-	{
-		print H "\tbool IsConversationEnd() const;\n";
-	}
-	if(obj_is_type($cmd,'IsError'))
-	{
-		print H "\tbool IsError(int &rTypeOut, int &rSubTypeOut) const;\n";
-	}
-	if($type eq 'Server' && obj_is_type($cmd, 'Command'))
-	{
-		print H "\tstd::auto_ptr<ProtocolObject> DoCommand(${protocol_name}ProtocolServer &rProtocol, $context_class &rContext); // IMPLEMENT THIS\n"
-	}
-
-	# want to be able to read from streams?
-	my $read_from_streams = (obj_is_type($cmd,'Command') && $type eq 'Server') || (obj_is_type($cmd,'Reply') && $type eq 'Client');
-	my $write_to_streams = (obj_is_type($cmd,'Command') && $type eq 'Client') || (obj_is_type($cmd,'Reply') && $type eq 'Server');
-	
-	if($read_from_streams)
-	{
-		print H "\tvoid SetPropertiesFromStreamData(Protocol &rProtocol);\n";
-		
-		# write Get functions
-		for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-		{
-			my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-			
-			print H "\t".translate_type_to_arg_type($ty)." Get$nm() {return m$nm;}\n";
-		}
-	}
-	my $param_con_args = '';
-	if($write_to_streams)
-	{
-		# extra constructor?
-		if($#{$cmd_contents{$cmd}} >= 0)
-		{
-			my @a;
-			for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-			{
-				my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-
-				push @a,translate_type_to_arg_type($ty)." $nm";
-			}		
-			$param_con_args = join(', ', at a);
-			print H "\t$classname_base$cmd(".$param_con_args.");\n";
-		}
-		print H "\tvoid WritePropertiesToStreamData(Protocol &rProtocol) const;\n";
-		# set functions
-		for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-		{
-			my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-			
-			print H "\tvoid Set$nm(".translate_type_to_arg_type($ty)." $nm) {m$nm = $nm;}\n";
-		}
-	}
-	
-	if($implement_syslog)
-	{
-		print H "\tvirtual void LogSysLog(const char *Action) const;\n";
-	}
-	if($implement_filelog)
-	{
-		print H "\tvirtual void LogFile(const char *Action, FILE *file) const;\n";
-	}
-
-	
-	# write member variables and setup for cpp file
-	my @def_constructor_list;
-	my @copy_constructor_list;
-	my @param_constructor_list;
-	
-	print H "private:\n";
-	for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-	{
-		my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-
-		print H "\t".translate_type_to_member_type($ty)." m$nm;\n";
-		
-		my ($basic,$typename) = translate_type($ty);
-		if($basic)
-		{
-			push @def_constructor_list, "m$nm(0)";
-		}
-		push @copy_constructor_list, "m$nm(rToCopy.m$nm)";
-		push @param_constructor_list, "m$nm($nm)";
-	}
-	
-	# finish off
-	print H "};\n\n";
-	
-	# now the cpp file...
-	my $def_con_vars = join(",\n\t  ", at def_constructor_list);
-	$def_con_vars = "\n\t: ".$def_con_vars if $def_con_vars ne '';
-	my $copy_con_vars = join(",\n\t  ", at copy_constructor_list);
-	$copy_con_vars = "\n\t: ".$copy_con_vars if $copy_con_vars ne '';
-	my $param_con_vars = join(",\n\t  ", at param_constructor_list);
-	$param_con_vars = "\n\t: ".$param_con_vars if $param_con_vars ne '';
-
-	my $class = "$classname_base$cmd".'::';
-	print CPP <<__E;
-$class$classname_base$cmd()$def_con_vars
-{
-}
-$class$classname_base$cmd(const $classname_base$cmd &rToCopy)$copy_con_vars
-{
-}
-$class~$classname_base$cmd()
-{
-}
-int ${class}GetType() const
-{
-	return $cmd_id{$cmd};
-}
-__E
-	if($read_from_streams)
-	{
-		print CPP "void ${class}SetPropertiesFromStreamData(Protocol &rProtocol)\n{\n";
-		for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-		{
-			my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-			if($ty =~ m/\Avector/)
-			{
-				print CPP "\trProtocol.ReadVector(m$nm);\n";
-			}
-			else
-			{
-				print CPP "\trProtocol.Read(m$nm);\n";
-			}
-		}
-		print CPP "}\n";
-	}
-	if($write_to_streams)
-	{
-		# implement extra constructor?
-		if($param_con_vars ne '')
-		{
-			print CPP "$class$classname_base$cmd($param_con_args)$param_con_vars\n{\n}\n";
-		}
-		print CPP "void ${class}WritePropertiesToStreamData(Protocol &rProtocol) const\n{\n";
-		for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-		{
-			my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-			if($ty =~ m/\Avector/)
-			{
-				print CPP "\trProtocol.WriteVector(m$nm);\n";
-			}
-			else
-			{
-				print CPP "\trProtocol.Write(m$nm);\n";
-			}
-		}
-		print CPP "}\n";
-	}
-	if(obj_is_type($cmd,'EndsConversation'))
-	{
-		print CPP "bool ${class}IsConversationEnd() const\n{\n\treturn true;\n}\n";
-	}
-	if(obj_is_type($cmd,'IsError'))
-	{
-		# get parameters
-		my ($mem_type,$mem_subtype) = split /,/,obj_get_type_params($cmd,'IsError');
-		print CPP <<__E;
-bool ${class}IsError(int &rTypeOut, int &rSubTypeOut) const
-{
-	rTypeOut = m$mem_type;
-	rSubTypeOut = m$mem_subtype;
-	return true;
-}
-__E
-	}
-
-	if($implement_syslog)
-	{
-		my ($format,$args) = make_log_strings($cmd);
-		print CPP <<__E;
-void ${class}LogSysLog(const char *Action) const
-{
-	::syslog(LOG_INFO,"%s $format",Action$args);
-}
-__E
-	}
-	if($implement_filelog)
-	{
-		my ($format,$args) = make_log_strings($cmd);
-		print CPP <<__E;
-void ${class}LogFile(const char *Action, FILE *File) const
-{
-	::fprintf(File,"%s $format\\n",Action$args);
-	::fflush(File);
-}
-__E
-	}
-}
-
-# finally, the protocol object itself
-print H <<__E;
-class $classname_base : public Protocol
-{
-public:
-	$classname_base(IOStream &rStream);
-	virtual ~$classname_base();
-
-	std::auto_ptr<$derive_objects_from> Receive();
-	void Send(const ${derive_objects_from} &rObject);
-__E
-if($implement_syslog)
-{
-	print H "\tvoid SetLogToSysLog(bool Log = false) {mLogToSysLog = Log;}\n";
-}
-if($implement_filelog)
-{
-	print H "\tvoid SetLogToFile(FILE *File = 0) {mLogToFile = File;}\n";
-}
-if($type eq 'Server')
-{
-	# need to put in the conversation function
-	print H "\tvoid DoServer($context_class &rContext);\n\n";
-	# and the send vector thing
-	print H "\tvoid SendStreamAfterCommand(IOStream *pStream);\n\n";
-}
-if($type eq 'Client')
-{
-	# add plain object taking query functions
-	my $with_params;
-	for my $cmd (@cmd_list)
-	{
-		if(obj_is_type($cmd,'Command'))
-		{
-			my $has_stream = obj_is_type($cmd,'StreamWithCommand');
-			my $argextra = $has_stream?', IOStream &rStream':'';
-			my $queryextra = $has_stream?', rStream':'';
-			my $reply = obj_get_type_params($cmd,'Command');
-			print H "\tstd::auto_ptr<$classname_base$reply> Query(const $classname_base$cmd &rQuery$argextra);\n";
-			my @a;
-			my @na;
-			for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-			{
-				my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-				push @a,translate_type_to_arg_type($ty)." $nm";
-				push @na,"$nm";
-			}
-			my $ar = join(', ', at a);
-			my $nar = join(', ', at na);
-			$nar = "($nar)" if $nar ne '';
-
-			$with_params .= "\tinline std::auto_ptr<$classname_base$reply> Query$cmd($ar$argextra)\n\t{\n";
-			$with_params .= "\t\t$classname_base$cmd send$nar;\n";
-			$with_params .= "\t\treturn Query(send$queryextra);\n";
-			$with_params .= "\t}\n";
-		}
-	}
-	# quick hack to correct bad argument lists for commands with zero paramters but with streams
-	$with_params =~ s/\(, /(/g;
-	print H "\n",$with_params,"\n";
-}
-print H <<__E;
-private:
-	$classname_base(const $classname_base &rToCopy);
-__E
-if($type eq 'Server')
-{
-	# need to put the streams to send vector
-	print H "\tstd::vector<IOStream*> mStreamsToSend;\n\tvoid DeleteStreamsToSend();\n";
-}
-
-if($implement_filelog || $implement_syslog)
-{
-	print H <<__E;
-	virtual void InformStreamReceiving(u_int32_t Size);
-	virtual void InformStreamSending(u_int32_t Size);
-__E
-}
-
-if($implement_syslog)
-{
-	print H "private:\n\tbool mLogToSysLog;\n";
-}
-if($implement_filelog)
-{
-	print H "private:\n\tFILE *mLogToFile;\n";
-}
-print H <<__E;
-
-protected:	
-	virtual std::auto_ptr<ProtocolObject> MakeProtocolObject(int ObjType);
-	virtual const char *GetIdentString();
-};
-
-__E
-
-my $construtor_extra = '';
-$construtor_extra .= ', mLogToSysLog(false)' if $implement_syslog;
-$construtor_extra .= ', mLogToFile(0)' if $implement_filelog;
-
-my $destructor_extra = ($type eq 'Server')?"\n\tDeleteStreamsToSend();":'';
-
-my $prefix = $classname_base.'::';
-print CPP <<__E;
-$prefix$classname_base(IOStream &rStream)
-	: Protocol(rStream)$construtor_extra
-{
-}
-$prefix~$classname_base()
-{$destructor_extra
-}
-const char *${prefix}GetIdentString()
-{
-	return "$ident_string";
-}
-std::auto_ptr<ProtocolObject> ${prefix}MakeProtocolObject(int ObjType)
-{
-	switch(ObjType)
-	{
-__E
-
-# do objects within this
-for my $cmd (@cmd_list)
-{
-	print CPP <<__E;
-	case $cmd_id{$cmd}:
-		return std::auto_ptr<ProtocolObject>(new $classname_base$cmd);
-		break;
-__E
-}
-
-print CPP <<__E;
-	default:
-		THROW_EXCEPTION(ConnectionException, Conn_Protocol_UnknownCommandRecieved)
-	}
-}
-__E
-# write receieve and send functions
-print CPP <<__E;
-std::auto_ptr<$derive_objects_from> ${prefix}Receive()
-{
-	std::auto_ptr<${derive_objects_from}> preply((${derive_objects_from}*)(Protocol::Receive().release()));
-
-__E
-	if($implement_syslog)
-	{
-		print CPP <<__E;
-	if(mLogToSysLog)
-	{
-		preply->LogSysLog("Receive");
-	}
-__E
-	}
-	if($implement_filelog)
-	{
-		print CPP <<__E;
-	if(mLogToFile != 0)
-	{
-		preply->LogFile("Receive", mLogToFile);
-	}
-__E
-	}
-print CPP <<__E;
-
-	return preply;
-}
-
-void ${prefix}Send(const ${derive_objects_from} &rObject)
-{
-__E
-	if($implement_syslog)
-	{
-		print CPP <<__E;
-	if(mLogToSysLog)
-	{
-		rObject.LogSysLog("Send");
-	}
-__E
-	}
-	if($implement_filelog)
-	{
-		print CPP <<__E;
-	if(mLogToFile != 0)
-	{
-		rObject.LogFile("Send", mLogToFile);
-	}
-__E
-	}
-
-print CPP <<__E;
-	Protocol::Send(rObject);
-}
-
-__E
-# write server function?
-if($type eq 'Server')
-{
-	print CPP <<__E;
-void ${prefix}DoServer($context_class &rContext)
-{
-	// Handshake with client
-	Handshake();
-
-	// Command processing loop
-	bool inProgress = true;
-	while(inProgress)
-	{
-		// Get an object from the conversation
-		std::auto_ptr<${derive_objects_from}> pobj(Receive());
-
-__E
-	if($implement_syslog)
-	{
-		print CPP <<__E;
-		if(mLogToSysLog)
-		{
-			pobj->LogSysLog("Receive");
-		}
-__E
-	}
-	if($implement_filelog)
-	{
-		print CPP <<__E;
-		if(mLogToFile != 0)
-		{
-			pobj->LogFile("Receive", mLogToFile);
-		}
-__E
-	}
-	print CPP <<__E;
-
-		// Run the command
-		std::auto_ptr<${derive_objects_from}> preply((${derive_objects_from}*)(pobj->DoCommand(*this, rContext).release()));
-		
-__E
-	if($implement_syslog)
-	{
-		print CPP <<__E;
-		if(mLogToSysLog)
-		{
-			preply->LogSysLog("Send");
-		}
-__E
-	}
-	if($implement_filelog)
-	{
-		print CPP <<__E;
-		if(mLogToFile != 0)
-		{
-			preply->LogFile("Send", mLogToFile);
-		}
-__E
-	}
-	print CPP <<__E;
-
-		// Send the reply
-		Send(*(preply.get()));
-
-		// Send any streams
-		for(unsigned int s = 0; s < mStreamsToSend.size(); s++)
-		{
-			// Send the streams
-			SendStream(*mStreamsToSend[s]);
-		}
-		// Delete these streams
-		DeleteStreamsToSend();
-
-		// Does this end the conversation?
-		if(pobj->IsConversationEnd())
-		{
-			inProgress = false;
-		}
-	}	
-}
-
-void ${prefix}SendStreamAfterCommand(IOStream *pStream)
-{
-	ASSERT(pStream != NULL);
-	mStreamsToSend.push_back(pStream);
-}
-
-void ${prefix}DeleteStreamsToSend()
-{
-	for(std::vector<IOStream*>::iterator i(mStreamsToSend.begin()); i != mStreamsToSend.end(); ++i)
-	{
-		delete (*i);
-	}
-	mStreamsToSend.clear();
-}
-
-__E
-}
-
-# write logging functions?
-if($implement_filelog || $implement_syslog)
-{
-	my ($fR,$fS);
-
-	if($implement_syslog)
-	{
-		$fR .= qq~\tif(mLogToSysLog) { ::syslog(LOG_INFO, (Size==Protocol::ProtocolStream_SizeUncertain)?"Receiving stream, size uncertain":"Receiving stream, size %d", Size); }\n~;
-		$fS .= qq~\tif(mLogToSysLog) { ::syslog(LOG_INFO, (Size==Protocol::ProtocolStream_SizeUncertain)?"Sending stream, size uncertain":"Sending stream, size %d", Size); }\n~;
-	}
-	if($implement_filelog)
-	{
-		$fR .= qq~\tif(mLogToFile) { ::fprintf(mLogToFile, (Size==Protocol::ProtocolStream_SizeUncertain)?"Receiving stream, size uncertain":"Receiving stream, size %d\\n", Size); ::fflush(mLogToFile); }\n~;
-		$fS .= qq~\tif(mLogToFile) { ::fprintf(mLogToFile, (Size==Protocol::ProtocolStream_SizeUncertain)?"Sending stream, size uncertain":"Sending stream, size %d\\n", Size); ::fflush(mLogToFile); }\n~;
-	}
-
-	print CPP <<__E;
-
-void ${prefix}InformStreamReceiving(u_int32_t Size)
-{
-$fR}
-
-void ${prefix}InformStreamSending(u_int32_t Size)
-{
-$fS}
-
-__E
-}
-
-
-# write client Query functions?
-if($type eq 'Client')
-{
-	for my $cmd (@cmd_list)
-	{
-		if(obj_is_type($cmd,'Command'))
-		{
-			my $reply = obj_get_type_params($cmd,'Command');
-			my $reply_id = $cmd_id{$reply};
-			my $has_stream = obj_is_type($cmd,'StreamWithCommand');
-			my $argextra = $has_stream?', IOStream &rStream':'';
-			my $send_stream_extra = '';
-			if($has_stream)
-			{
-				$send_stream_extra = <<__E;
-	
-	// Send stream after the command
-	SendStream(rStream);
-__E
-			}
-			print CPP <<__E;
-std::auto_ptr<$classname_base$reply> ${classname_base}::Query(const $classname_base$cmd &rQuery$argextra)
-{
-	// Send query
-	Send(rQuery);
-	$send_stream_extra
-	// Wait for the reply
-	std::auto_ptr<${derive_objects_from}> preply(Receive().release());
-
-	if(preply->GetType() == $reply_id)
-	{
-		// Correct response
-		return std::auto_ptr<$classname_base$reply>(($classname_base$reply*)preply.release());
-	}
-	else
-	{
-		// Set protocol error
-		int type, subType;
-		if(preply->IsError(type, subType))
-		{
-			SetError(type, subType);
-			TRACE2("Protocol: Error received %d/%d\\n", type, subType);
-		}
-		else
-		{
-			SetError(Protocol::UnknownError, Protocol::UnknownError);
-		}
-		
-		// Throw an exception
-		THROW_EXCEPTION(ConnectionException, Conn_Protocol_UnexpectedReply)
-	}
-}
-__E
-		}
-	}
-}
-
-
-
-print H <<__E;
-#endif // $guardname
-
-__E
-
-# close files
-close H;
-close CPP;
-
-
-sub obj_is_type
-{
-	my ($c,$ty) = @_;
-	for(@{$cmd_attributes{$c}})
-	{
-		return 1 if $_ =~ m/\A$ty/;
-	}
-	
-	return 0;
-}
-
-sub obj_get_type_params
-{
-	my ($c,$ty) = @_;
-	for(@{$cmd_attributes{$c}})
-	{
-		return $1 if $_ =~ m/\A$ty\((.+?)\)\Z/;
-	}
-	die "Can't find attribute $ty\n"
-}
-
-# returns (is basic type, typename)
-sub translate_type
-{
-	my $ty = $_[0];
-	
-	if($ty =~ m/\Avector\<(.+?)\>\Z/)
-	{
-		my $v_type = $1;
-		my (undef,$v_ty) = translate_type($v_type);
-		return (0, 'std::vector<'.$v_ty.'>')
-	}
-	else
-	{
-		if(!exists $translate_type_info{$ty})
-		{
-			die "Don't know about type name $ty\n";
-		}
-		return @{$translate_type_info{$ty}}
-	}
-}
-
-sub translate_type_to_arg_type
-{
-	my ($basic,$typename) = translate_type(@_);
-	return $basic?$typename:'const '.$typename.'&'
-}
-
-sub translate_type_to_member_type
-{
-	my ($basic,$typename) = translate_type(@_);
-	return $typename
-}
-
-sub make_log_strings
-{
-	my ($cmd) = @_;
-
-	my @str;
-	my @arg;
-	for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2)
-	{
-		my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]);
-		
-		if(exists $log_display_types{$ty})
-		{
-			# need to translate it
-			my ($format,$arg) = @{$log_display_types{$ty}};
-			push @str,$format;
-			$arg =~ s/VAR/m$nm/g;
-			push @arg,$arg;
-		}
-		else
-		{
-			# is opaque
-			push @str,'OPAQUE';
-		}
-	}
-	return ($cmd.'('.join(',', at str).')', join(',','', at arg));
-}
-
-

Copied: box/chris/boxi/lib/server/makeprotocol.pl.in (from rev 547, box/trunk/lib/server/makeprotocol.pl.in)

Modified: box/chris/boxi/lib/win32/WinNamedPipeStream.cpp
===================================================================
--- box/chris/boxi/lib/win32/WinNamedPipeStream.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/win32/WinNamedPipeStream.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -11,7 +11,10 @@
 
 #ifdef WIN32
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+
 #include <sys/types.h>
 #include <errno.h>
 #include <windows.h>
@@ -97,15 +100,14 @@
 	{
 		::syslog(LOG_ERR, "ConnectNamedPipe failed: %d", 
 			GetLastError());
-		CloseHandle(mSocketHandle);
-		mSocketHandle = NULL;
+		Close();
 		THROW_EXCEPTION(ServerException, SocketOpenError)
 	}
 	
-	mReadClosed  = FALSE;
-	mWriteClosed = FALSE;
-	mIsServer    = TRUE; // must flush and disconnect before closing
-	mIsConnected = TRUE;
+	mReadClosed  = false;
+	mWriteClosed = false;
+	mIsServer    = true; // must flush and disconnect before closing
+	mIsConnected = true;
 }
 
 // --------------------------------------------------------------------------
@@ -140,10 +142,10 @@
 		THROW_EXCEPTION(ServerException, SocketOpenError)
 	}
 
-	mReadClosed  = FALSE;
-	mWriteClosed = FALSE;
-	mIsServer    = FALSE; // just close the socket
-	mIsConnected = TRUE;
+	mReadClosed  = false;
+	mWriteClosed = false;
+	mIsServer    = false; // just close the socket
+	mIsConnected = true;
 }
 
 // --------------------------------------------------------------------------
@@ -240,8 +242,15 @@
 // --------------------------------------------------------------------------
 void WinNamedPipeStream::Close()
 {
-	if (mSocketHandle == NULL || !mIsConnected) 
+	if (mSocketHandle == NULL && mIsConnected)
 	{
+		fprintf(stderr, "Inconsistent connected state\n");
+		::syslog(LOG_ERR, "Inconsistent connected state");
+		mIsConnected = false;
+	}
+
+	if (mSocketHandle == NULL) 
+	{
 		THROW_EXCEPTION(ServerException, BadSocketHandle)
 	}
 
@@ -262,14 +271,16 @@
 		mIsServer = false;
 	}
 
-	if (!CloseHandle(mSocketHandle))
+	bool result = CloseHandle(mSocketHandle);
+
+	mSocketHandle = NULL;
+	mIsConnected = false;
+
+	if (!result) 
 	{
 		::syslog(LOG_ERR, "CloseHandle failed: %d", GetLastError());
 		THROW_EXCEPTION(ServerException, SocketCloseError)
 	}
-	
-	mSocketHandle = NULL;
-	mIsConnected = FALSE;
 }
 
 // --------------------------------------------------------------------------

Copied: box/chris/boxi/lib/win32/config.h.win32 (from rev 547, box/trunk/lib/win32/config.h.win32)

Modified: box/chris/boxi/lib/win32/emu.cpp
===================================================================
--- box/chris/boxi/lib/win32/emu.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/win32/emu.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -12,14 +12,20 @@
 #include <windows.h>
 #include <fcntl.h>
 // #include <atlenc.h>
-#include <unistd.h>
 
+#ifdef HAVE_UNISTD_H
+	#include <unistd.h>
+#endif
+#ifdef HAVE_PROCESS_H
+	#include <process.h>
+#endif
+
 #include <string>
 #include <list>
 
-//our implimentation for a timer
-//based on a simple thread which sleeps for a
-//period of time
+// our implementation for a timer, based on a 
+// simple thread which sleeps for a period of time
+
 static bool gFinishTimer;
 static CRITICAL_SECTION gLock;
 
@@ -28,14 +34,14 @@
 	int countDown;
 	int interval;
 }
-tTimer;
+Timer_t;
 
-std::list<tTimer> gTimerList;
+std::list<Timer_t> gTimerList;
 static void (__cdecl *gTimerFunc) (int) = NULL;
 
-int setitimer(int type , struct itimerval *timeout, int)
+int setitimer(int type, struct itimerval *timeout, void *arg)
 {
-	if ( SIGVTALRM == type || ITIMER_VIRTUAL == type )
+	if (ITIMER_VIRTUAL == type)
 	{
 		EnterCriticalSection(&gLock);
 		// we only need seconds for the mo!
@@ -46,7 +52,7 @@
 		}
 		else
 		{
-			tTimer ourTimer;
+			Timer_t ourTimer;
 			ourTimer.countDown = timeout->it_value.tv_sec;
 			ourTimer.interval  = timeout->it_interval.tv_sec;
 			gTimerList.push_back(ourTimer);
@@ -64,12 +70,12 @@
 
 	while (!gFinishTimer)
 	{
-		std::list<tTimer>::iterator it;
+		std::list<Timer_t>::iterator it;
 		EnterCriticalSection(&gLock);
 
 		for (it = gTimerList.begin(); it != gTimerList.end(); it++)
 		{
-			tTimer& rTimer(*it);
+			Timer_t& rTimer(*it);
 
 			rTimer.countDown --;
 			if (rTimer.countDown == 0)
@@ -92,13 +98,18 @@
 
 		for (it = gTimerList.begin(); it != gTimerList.end(); it++)
 		{
-			tTimer& rTimer(*it);
+			Timer_t& rTimer(*it);
 
 			if (rTimer.countDown == -1)
 			{
 				gTimerList.erase(it);
-				//if we don't do this the search is on a corrupt list
+				
+				// the iterator is now invalid, so restart search
 				it = gTimerList.begin();
+
+				// if the list is now empty, don't try to increment 
+				// the iterator again
+				if (it == gTimerList.end()) break;
 			}
 		}
 
@@ -148,7 +159,8 @@
 		TOKEN_ADJUST_PRIVILEGES, 
 		&hToken ))
 	{
-		printf( "Cannot open process token - err = %d\n", GetLastError( ) );
+		printf( "Cannot open process token: error %d\n", 
+			(int)GetLastError() );
 		return false;
 	}
 
@@ -159,7 +171,8 @@
 		SE_BACKUP_NAME, //the name of the privilege
 		&( token_priv.Privileges[0].Luid )) ) //result
 	{
-		printf( "Cannot lookup backup privilege - err = %d\n", GetLastError( ) );
+		printf( "Cannot lookup backup privilege: error %d\n", 
+			(int)GetLastError( ) );
 		return false;
 	}
 
@@ -179,7 +192,8 @@
 		//this function is a little tricky - if we were adjusting
 		//more than one privilege, it could return success but not
 		//adjust them all - in the general case, you need to trap this
-		printf( "Could not enable backup privileges - err = %d\n", GetLastError( ) );
+		printf( "Could not enable backup privileges: error %d\n", 
+			(int)GetLastError( ) );
 		return false;
 
 	}
@@ -192,115 +206,342 @@
 // --------------------------------------------------------------------------
 //
 // Function
-//		Name:    openfile
-//		Purpose: replacement for any open calls - handles unicode filenames - supplied in utf8
-//		Created: 25th October 2004
+//		Name:    ConvertToWideString
+//		Purpose: Converts a string from specified codepage to 
+//			 a wide string (WCHAR*). Returns a buffer which 
+//			 MUST be freed by the caller with delete[].
+//			 In case of fire, logs the error and returns NULL.
+//		Created: 4th February 2006
 //
 // --------------------------------------------------------------------------
-HANDLE openfile(const char *filename, int flags, int mode)
+WCHAR* ConvertToWideString(const char* pString, unsigned int codepage)
 {
-	try{
+	int len = MultiByteToWideChar
+	(
+		codepage, // source code page
+		0,        // character-type options
+		pString,  // string to map
+		-1,       // number of bytes in string - auto detect
+		NULL,     // wide-character buffer
+		0         // size of buffer - work out 
+		          //   how much space we need
+	);
 
-		wchar_t *buffer;
-		std::string fileN(filename);
+	if (len == 0)
+	{
+		::syslog(LOG_WARNING, 
+			"Failed to convert string to wide string: "
+			"error %d", GetLastError());
+		errno = EINVAL;
+		return NULL;
+	}
 
-		std::string tmpStr("\\\\?\\");
-		//is the path relative or otherwise
-		if ( fileN[1] != ':' )
-		{
-			//we need to get the current directory
-			char wd[PATH_MAX];
-			if(::getcwd(wd, PATH_MAX) == 0)
-			{
-				return NULL;
-			}
-			tmpStr += wd;
-			if (tmpStr[tmpStr.length()] != '\\')
-			{
-				tmpStr += '\\';
-			}
-		}
-		tmpStr += filename;
+	WCHAR* buffer = new WCHAR[len];
 
-		int strlen = MultiByteToWideChar(
-			CP_UTF8,               // code page
-			0,                     // character-type options
-			tmpStr.c_str(),        // string to map
-			(int)tmpStr.length(),       // number of bytes in string
-			NULL,                  // wide-character buffer
-			0                      // size of buffer - work out how much space we need
-			);
+	if (buffer == NULL)
+	{
+		::syslog(LOG_WARNING, 
+			"Failed to convert string to wide string: "
+			"out of memory");
+		errno = ENOMEM;
+		return NULL;
+	}
 
-		buffer = new wchar_t[strlen+1];
-		if ( buffer == NULL )
-		{
-			return NULL;
-		}
+	len = MultiByteToWideChar
+	(
+		codepage, // source code page
+		0,        // character-type options
+		pString,  // string to map
+		-1,       // number of bytes in string - auto detect
+		buffer,   // wide-character buffer
+		len       // size of buffer
+	);
 
-		strlen = MultiByteToWideChar(
-			CP_UTF8,               // code page
-			0,                     // character-type options
-			tmpStr.c_str(),        // string to map
-			(int)tmpStr.length(),       // number of bytes in string
-			buffer,                // wide-character buffer
-			strlen                 // size of buffer
-			);
+	if (len == 0)
+	{
+		::syslog(LOG_WARNING, 
+			"Failed to convert string to wide string: "
+			"error %i", GetLastError());
+		errno = EACCES;
+		delete [] buffer;
+		return NULL;
+	}
 
-		if ( strlen == 0 )
-		{
-			delete [] buffer;
-			return NULL;
-		}
+	return buffer;
+}
 
-		buffer[strlen] = L'\0';
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    ConvertUtf8ToWideString
+//		Purpose: Converts a string from UTF-8 to a wide string.
+//			 Returns a buffer which MUST be freed by the caller 
+//			 with delete[].
+//			 In case of fire, logs the error and returns NULL.
+//		Created: 4th February 2006
+//
+// --------------------------------------------------------------------------
+WCHAR* ConvertUtf8ToWideString(const char* pString)
+{
+	return ConvertToWideString(pString, CP_UTF8);
+}
 
-		//flags could be O_WRONLY | O_CREAT | O_RDONLY
-		DWORD createDisposition = OPEN_EXISTING;
-		DWORD shareMode = FILE_SHARE_READ;
-		DWORD accessRights = FILE_READ_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_READ_EA;
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    ConvertFromWideString
+//		Purpose: Converts a wide string to a narrow string in the
+//			 specified code page. Returns a buffer which MUST 
+//			 be freed by the caller with delete[].
+//			 In case of fire, logs the error and returns NULL.
+//		Created: 4th February 2006
+//
+// --------------------------------------------------------------------------
+char* ConvertFromWideString(const WCHAR* pString, unsigned int codepage)
+{
+	int len = WideCharToMultiByte
+	(
+		codepage, // destination code page
+		0,        // character-type options
+		pString,  // string to map
+		-1,       // number of bytes in string - auto detect
+		NULL,     // output buffer
+		0,        // size of buffer - work out 
+		          //   how much space we need
+		NULL,     // replace unknown chars with system default
+		NULL      // don't tell us when that happened
+	);
 
-		if ( flags & O_WRONLY )
+	if (len == 0)
+	{
+		::syslog(LOG_WARNING, 
+			"Failed to convert wide string to narrow: "
+			"error %d", GetLastError());
+		errno = EINVAL;
+		return NULL;
+	}
+
+	char* buffer = new char[len];
+
+	if (buffer == NULL)
+	{
+		::syslog(LOG_WARNING, 
+			"Failed to convert wide string to narrow: "
+			"out of memory");
+		errno = ENOMEM;
+		return NULL;
+	}
+
+	len = WideCharToMultiByte
+	(
+		codepage, // source code page
+		0,        // character-type options
+		pString,  // string to map
+		-1,       // number of bytes in string - auto detect
+		buffer,   // output buffer
+		len,      // size of buffer
+		NULL,     // replace unknown chars with system default
+		NULL      // don't tell us when that happened
+	);
+
+	if (len == 0)
+	{
+		::syslog(LOG_WARNING, 
+			"Failed to convert wide string to narrow: "
+			"error %i", GetLastError());
+		errno = EACCES;
+		delete [] buffer;
+		return NULL;
+	}
+
+	return buffer;
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    ConvertUtf8ToConsole
+//		Purpose: Converts a string from UTF-8 to the console 
+//			 code page. On success, replaces contents of rDest 
+//			 and returns true. In case of fire, logs the error 
+//			 and returns false.
+//		Created: 4th February 2006
+//
+// --------------------------------------------------------------------------
+bool ConvertUtf8ToConsole(const char* pString, std::string& rDest)
+{
+	WCHAR* pWide = ConvertToWideString(pString, CP_UTF8);
+	if (pWide == NULL)
+	{
+		return false;
+	}
+
+	char* pConsole = ConvertFromWideString(pWide, GetConsoleOutputCP());
+	delete [] pWide;
+
+	if (!pConsole)
+	{
+		return false;
+	}
+
+	rDest = pConsole;
+	delete [] pConsole;
+
+	return true;
+}
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    ConvertConsoleToUtf8
+//		Purpose: Converts a string from the console code page
+//			 to UTF-8. On success, replaces contents of rDest
+//			 and returns true. In case of fire, logs the error 
+//			 and returns false.
+//		Created: 4th February 2006
+//
+// --------------------------------------------------------------------------
+bool ConvertConsoleToUtf8(const char* pString, std::string& rDest)
+{
+	WCHAR* pWide = ConvertToWideString(pString, GetConsoleCP());
+	if (pWide == NULL)
+	{
+		return false;
+	}
+
+	char* pConsole = ConvertFromWideString(pWide, CP_UTF8);
+	delete [] pWide;
+
+	if (!pConsole)
+	{
+		return false;
+	}
+
+	rDest = pConsole;
+	delete [] pConsole;
+
+	return true;
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    ConvertPathToAbsoluteUnicode
+//		Purpose: Converts relative paths to absolute (with unicode marker)
+//		Created: 4th February 2006
+//
+// --------------------------------------------------------------------------
+std::string ConvertPathToAbsoluteUnicode(const char *pFileName)
+{
+	std::string tmpStr("\\\\?\\");
+	
+	// Is the path relative or absolute?
+	// Absolute paths on Windows are always a drive letter
+	// followed by ':'
+	
+	if (pFileName[1] != ':')
+	{
+		// Must be relative. We need to get the 
+		// current directory to make it absolute.
+		
+		char wd[PATH_MAX];
+		if (::getcwd(wd, PATH_MAX) == 0)
 		{
-			createDisposition = OPEN_EXISTING;
-			shareMode |= FILE_SHARE_READ ;//| FILE_SHARE_WRITE;
+			::syslog(LOG_WARNING, 
+				"Failed to open '%s': path too long", 
+				pFileName);
+			errno = ENAMETOOLONG;
+			tmpStr = "";
+			return tmpStr;
 		}
-		if ( flags & O_CREAT )
+		
+		tmpStr += wd;
+		if (tmpStr[tmpStr.length()] != '\\')
 		{
-			createDisposition = OPEN_ALWAYS;
-			shareMode |= FILE_SHARE_READ ;//| FILE_SHARE_WRITE;
-			accessRights |= FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | FILE_WRITE_EA | FILE_ALL_ACCESS;
+			tmpStr += '\\';
 		}
-		if ( flags & O_TRUNC )
-		{
-			createDisposition = OPEN_ALWAYS;
-		}
+	}
+	
+	tmpStr += pFileName;
+	return tmpStr;
+}
 
-		HANDLE hdir = CreateFileW(buffer, 
-			accessRights, 
-			shareMode, 
-			NULL, 
-			createDisposition, 
-			FILE_FLAG_BACKUP_SEMANTICS,
-			NULL);
+// --------------------------------------------------------------------------
+//
+// Function
+//		Name:    openfile
+//		Purpose: replacement for any open calls - handles unicode filenames - supplied in utf8
+//		Created: 25th October 2004
+//
+// --------------------------------------------------------------------------
+HANDLE openfile(const char *pFileName, int flags, int mode)
+{
+	std::string AbsPathWithUnicode = ConvertPathToAbsoluteUnicode(pFileName);
+	
+	if (AbsPathWithUnicode.size() == 0)
+	{
+		// error already logged by ConvertPathToAbsoluteUnicode()
+		return NULL;
+	}
+	
+	WCHAR* pBuffer = ConvertUtf8ToWideString(AbsPathWithUnicode.c_str());
+	// We are responsible for freeing pBuffer
+	
+	if (pBuffer == NULL)
+	{
+		// error already logged by ConvertUtf8ToWideString()
+		return NULL;
+	}
 
-		if ( hdir == INVALID_HANDLE_VALUE )
-		{
-			// DWORD err = GetLastError();
-			// syslog(EVENTLOG_WARNING_TYPE, "Couldn't open file %s, err %i\n", filename, err);
-			delete [] buffer;
-			return NULL;
-		}
+	// flags could be O_WRONLY | O_CREAT | O_RDONLY
+	DWORD createDisposition = OPEN_EXISTING;
+	DWORD shareMode = FILE_SHARE_READ;
+	DWORD accessRights = FILE_READ_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_READ_EA;
 
-		delete [] buffer;
-		return hdir;
-
+	if (flags & O_WRONLY)
+	{
+		shareMode = FILE_SHARE_WRITE;
 	}
-	catch(...)
+	if (flags & O_RDWR)
 	{
-		printf("Caught openfile:%s\r\n", filename);
+		shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
 	}
-	return NULL;
+	if (flags & O_CREAT)
+	{
+		createDisposition = OPEN_ALWAYS;
+		shareMode |= FILE_SHARE_WRITE;
+		accessRights |= FILE_WRITE_ATTRIBUTES 
+			| FILE_WRITE_DATA | FILE_WRITE_EA 
+			| FILE_ALL_ACCESS;
+	}
+	if (flags & O_TRUNC)
+	{
+		createDisposition = CREATE_ALWAYS;
+	}
+	if (flags & O_EXCL)
+	{
+		shareMode = 0;
+	}
 
+	HANDLE hdir = CreateFileW(pBuffer, 
+		accessRights, 
+		shareMode, 
+		NULL, 
+		createDisposition, 
+		FILE_FLAG_BACKUP_SEMANTICS,
+		NULL);
+	
+	delete [] pBuffer;
+
+	if (hdir == INVALID_HANDLE_VALUE)
+	{
+		::syslog(LOG_WARNING, "Failed to open file %s: "
+			"error %i", pFileName, GetLastError());
+		return NULL;
+	}
+
+	return hdir;
 }
 
 // MinGW provides a getopt implementation
@@ -315,18 +556,18 @@
 // --------------------------------------------------------------------------
 //
 // Function
-//		Name:    ourfstat
+//		Name:    emu_fstat
 //		Purpose: replacement for fstat supply a windows handle
 //		Created: 25th October 2004
 //
 // --------------------------------------------------------------------------
-int ourfstat(HANDLE hdir, struct stat * st)
+int emu_fstat(HANDLE hdir, struct stat * st)
 {
 	ULARGE_INTEGER conv;
 
 	if (hdir == INVALID_HANDLE_VALUE)
 	{
-		::syslog(LOG_ERR, "Error: invalid file handle in ourfstat()");
+		::syslog(LOG_ERR, "Error: invalid file handle in emu_fstat()");
 		errno = EBADF;
 		return -1;
 	}
@@ -340,10 +581,12 @@
 		return -1;
 	}
 
+	memset(st, 0, sizeof(*st));
+
 	// This next example is how we get our INODE (equivalent) information
 	conv.HighPart = fi.nFileIndexHigh;
 	conv.LowPart = fi.nFileIndexLow;
-	st->st_ino = conv.QuadPart;
+	st->st_ino = (_ino_t)conv.QuadPart;
 
 	// get the time information
 	st->st_ctime = ConvertFileTimeToTime_t(&fi.ftCreationTime);
@@ -362,7 +605,7 @@
 
 	conv.HighPart = st_size.HighPart;
 	conv.LowPart = st_size.LowPart;
-	st->st_size = conv.QuadPart;
+	st->st_size = (_off_t)conv.QuadPart;
 
 	//the mode of the file
 	st->st_mode = 0;
@@ -400,76 +643,26 @@
 //		Created: 10th December 2004
 //
 // --------------------------------------------------------------------------
-HANDLE OpenFileByNameUtf8(const char* pName)
+HANDLE OpenFileByNameUtf8(const char* pFileName)
 {
-	//some string thing - required by ms to indicate long/unicode filename
-	std::string tmpStr("\\\\?\\");
-
-	// is the path relative or otherwise
-	std::string fileN(pName);
-	if (fileN[1] != ':')
+	std::string AbsPathWithUnicode = ConvertPathToAbsoluteUnicode(pFileName);
+	
+	if (AbsPathWithUnicode.size() == 0)
 	{
-		// we need to get the current directory
-		char wd[PATH_MAX];
-		if(::getcwd(wd, PATH_MAX) == 0)
-		{
-			::syslog(LOG_WARNING, 
-				"Failed to open '%s': path too long", pName);
-			errno = ENAMETOOLONG;
-			return NULL;
-		}
-
-		tmpStr += wd;
-		if (tmpStr[tmpStr.length()] != '\\')
-		{
-			tmpStr += '\\';
-		}
-	}
-
-	tmpStr += fileN;
-
-	int strlen = MultiByteToWideChar(
-		CP_UTF8,               // code page
-		0,                     // character-type options
-		tmpStr.c_str(),        // string to map
-		(int)tmpStr.length(),  // number of bytes in string
-		NULL,                  // wide-character buffer
-		0                      // size of buffer - work out 
-		                       //   how much space we need
-		);
-
-	wchar_t* buffer = new wchar_t[strlen+1];
-
-	if (buffer == NULL)
-	{
-		::syslog(LOG_WARNING, 
-			"Failed to open '%s': out of memory", pName);
-		errno = ENOMEM;
+		// error already logged by ConvertPathToAbsoluteUnicode()
 		return NULL;
 	}
-
-	strlen = MultiByteToWideChar(
-		CP_UTF8,               // code page
-		0,                     // character-type options
-		tmpStr.c_str(),        // string to map
-		(int)tmpStr.length(),  // number of bytes in string
-		buffer,                // wide-character buffer
-		strlen                 // size of buffer
-		);
-
-	if (strlen == 0)
+	
+	WCHAR* pBuffer = ConvertUtf8ToWideString(AbsPathWithUnicode.c_str());
+	// We are responsible for freeing pBuffer
+	
+	if (pBuffer == NULL)
 	{
-		::syslog(LOG_WARNING, 
-			"Failed to open '%s': could not convert "
-			"file name to Unicode", pName);
-		errno = EACCES;
-		delete [] buffer;
+		// error already logged by ConvertUtf8ToWideString()
 		return NULL;
 	}
 
-	buffer[strlen] = L'\0';
-
-	HANDLE handle = CreateFileW(buffer, 
+	HANDLE handle = CreateFileW(pBuffer, 
 		FILE_READ_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_READ_EA, 
 		FILE_SHARE_READ | FILE_SHARE_DELETE | FILE_SHARE_WRITE, 
 		NULL, 
@@ -483,7 +676,7 @@
 		// open in this mode - to get the inode information
 		// at least one process must have the file open - 
 		// in this case someone else does.
-		handle = CreateFileW(buffer, 
+		handle = CreateFileW(pBuffer, 
 			0, 
 			FILE_SHARE_READ, 
 			NULL, 
@@ -492,7 +685,7 @@
 			NULL);
 	}
 
-	delete [] buffer;
+	delete [] pBuffer;
 
 	if (handle == INVALID_HANDLE_VALUE)
 	{
@@ -500,14 +693,12 @@
 
 		if (err == ERROR_FILE_NOT_FOUND)
 		{
-			::syslog(LOG_WARNING, 
-				"Failed to open '%s': file not found", pName);
 			errno = ENOENT;
 		}
 		else
 		{
 			::syslog(LOG_WARNING, 
-				"Failed to open '%s': error %d", pName);
+				"Failed to open '%s': error %d", pFileName, err);
 			errno = EACCES;
 		}
 
@@ -520,13 +711,13 @@
 // --------------------------------------------------------------------------
 //
 // Function
-//		Name:    ourstat 
+//		Name:    emu_stat 
 //		Purpose: replacement for the lstat and stat functions, 
 //			works with unicode filenames supplied in utf8 format
 //		Created: 25th October 2004
 //
 // --------------------------------------------------------------------------
-int ourstat(const char * pName, struct stat * st)
+int emu_stat(const char * pName, struct stat * st)
 {
 	// at the mo
 	st->st_uid = 0;
@@ -541,7 +732,7 @@
 		return -1;
 	}
 
-	int retVal = ourfstat(handle, st);
+	int retVal = emu_fstat(handle, st);
 	if (retVal != 0)
 	{
 		// error logged, but without filename
@@ -595,14 +786,6 @@
 	return 0;
 }
 
-
-
-
-
-// MinGW provides opendir(), etc. via <dirent.h>
-// MSVC does not provide these, so emulation is needed
-
-#ifndef __MINGW32__
 // --------------------------------------------------------------------------
 //
 // Function
@@ -613,110 +796,56 @@
 // --------------------------------------------------------------------------
 DIR *opendir(const char *name)
 {
-	try
+	if (!name || !name[0])
 	{
-		DIR *dir = 0;
-		std::string dirName(name);
+		errno = EINVAL;
+		return NULL;
+	}
+	
+	std::string dirName(name);
 
-		//append a '\' win32 findfirst is sensitive to this
-		if ( dirName[dirName.size()] != '\\' || dirName[dirName.size()] != '/' )
-		{
-			dirName += '\\';
-		}
+	//append a '\' win32 findfirst is sensitive to this
+	if ( dirName[dirName.size()] != '\\' || dirName[dirName.size()] != '/' )
+	{
+		dirName += '\\';
+	}
 
-		//what is the search string? - everything
-		dirName += '*';
+	// what is the search string? - everything
+	dirName += '*';
 
-		if(name && name[0])
-		{
-			if ( ( dir = new DIR ) != 0 )
-			{
-				//mbstowcs(dir->name, dirName.c_str(),100);
-				//wcscpy((wchar_t*)dir->name, (const wchar_t*)dirName.c_str());
-				//mbstowcs(dir->name, dirName.c_str(), dirName.size()+1);
-				//wchar_t *buffer;
+	DIR *pDir = new DIR;
+	if (pDir == NULL)
+	{
+		errno = ENOMEM;
+		return NULL;
+	}
 
-				int strlen = MultiByteToWideChar(
-					CP_UTF8,               // code page
-					0,                     // character-type options
-					dirName.c_str(),       // string to map
-					(int)dirName.length(), // number of bytes in string
-					NULL,                  // wide-character buffer
-					0                      // size of buffer - work out how much space we need
-					);
+	pDir->name = ConvertUtf8ToWideString(dirName.c_str());
+	// We are responsible for freeing dir->name
+	
+	if (pDir->name == NULL)
+	{
+		delete pDir;
+		return NULL;
+	}
 
-				dir->name = new wchar_t[strlen+1];
+	pDir->fd = _wfindfirst((const wchar_t*)pDir->name, &(pDir->info));
 
-				if (dir->name == NULL)
-				{
-					delete dir;
-					dir   = 0;
-					errno = ENOMEM;
-					return NULL;
-				}
-
-				strlen = MultiByteToWideChar(
-					CP_UTF8,               // code page
-					0,                     // character-type options
-					dirName.c_str(),        // string to map
-					(int)dirName.length(),       // number of bytes in string
-					dir->name,                // wide-character buffer
-					strlen                 // size of buffer
-					);
-
-				if (strlen == 0)
-				{
-					delete dir->name;
-					delete dir;
-					dir   = 0;
-					errno = ENOMEM;
-					return NULL;
-				}
-
-				dir->name[strlen] = L'\0';
-
-				
-				dir->fd = _wfindfirst(
-					(const wchar_t*)dir->name,
-					&dir->info);
-
-				if (dir->fd != -1)
-				{
-					dir->result.d_name = 0;
-				}
-				else // go back
-				{
-					delete [] dir->name;
-					delete dir;
-					dir = 0;
-				}
-			}
-			else // backwards again
-			{
-				delete dir;
-				dir   = 0;
-				errno = ENOMEM;
-			}
-		}
-		else
-		{
-			errno = EINVAL;
-		}
-
-		return dir;
-
-	}
-	catch(...)
+	if (pDir->fd == -1)
 	{
-		printf("Caught opendir");
+		delete [] pDir->name;
+		delete pDir;
+		return NULL;
 	}
-
-	return NULL;
+		
+	pDir->result.d_name = 0;
+	return pDir;
 }
 
-//this kinda makes it not thread friendly!
-//but I don't think it needs to be.
+// this kinda makes it not thread friendly!
+// but I don't think it needs to be.
 char tempbuff[MAX_PATH];
+
 // --------------------------------------------------------------------------
 //
 // Function
@@ -796,7 +925,6 @@
 	}
 	return -1;
 }
-#endif // !__MINGW32__
 
 // --------------------------------------------------------------------------
 //
@@ -875,11 +1003,12 @@
 }
 
 HANDLE gSyslogH = 0;
+static bool sHaveWarnedEventLogFull = false;
 
 void syslog(int loglevel, const char *frmt, ...)
 {
-	DWORD errinfo;
-	char* buffer;
+	WORD errinfo;
+	char buffer[1024];
 	std::string sixfour(frmt);
 
 	switch (loglevel)
@@ -898,81 +1027,203 @@
 		break;
 	}
 
-
-	//taken from MSDN
-	try
+	// taken from MSDN
+	int sixfourpos;
+	while ( (sixfourpos = (int)sixfour.find("%ll")) != -1 )
 	{
+		// maintain portability - change the 64 bit formater...
+		std::string temp = sixfour.substr(0,sixfourpos);
+		temp += "%I64";
+		temp += sixfour.substr(sixfourpos+3, sixfour.length());
+		sixfour = temp;
+	}
 
+	// printf("parsed string is:%s\r\n", sixfour.c_str());
 
-		int sixfourpos;
-		while ( ( sixfourpos = sixfour.find("%ll")) != -1 )
+	va_list args;
+	va_start(args, frmt);
+
+	int len = vsnprintf(buffer, sizeof(buffer)-1, sixfour.c_str(), args);
+	ASSERT(len < sizeof(buffer))
+	buffer[sizeof(buffer)-1] = 0;
+
+	va_end(args);
+
+	LPCSTR strings[] = { buffer, NULL };
+
+	if (!ReportEvent(gSyslogH, // event log handle 
+		errinfo,               // event type 
+		0,                     // category zero 
+		MSG_ERR_EXIST,	       // event identifier - 
+		                       // we will call them all the same
+		NULL,                  // no user security identifier 
+		1,                     // one substitution string 
+		0,                     // no data 
+		strings,               // pointer to string array 
+		NULL))                 // pointer to data 
+
+	{
+		DWORD err = GetLastError();
+		if (err == ERROR_LOG_FILE_FULL)
 		{
-			//maintain portability - change the 64 bit formater...
-			std::string temp = sixfour.substr(0,sixfourpos);
-			temp += "%I64";
-			temp += sixfour.substr(sixfourpos+3, sixfour.length());
-			sixfour = temp;
+			if (!sHaveWarnedEventLogFull)
+			{
+				printf("Unable to send message to Event Log "
+					"(Event Log is full):\r\n");
+				sHaveWarnedEventLogFull = TRUE;
+			}
 		}
+		else
+		{
+			printf("Unable to send message to Event Log: "
+				"error %i:\r\n", (int)err);
+		}
+	}
+	else
+	{
+		sHaveWarnedEventLogFull = false;
+	}
 
-		//printf("parsed string is:%s\r\n", sixfour.c_str());
+	printf("%s\r\n", buffer);
+}
 
-		va_list args;
-		va_start(args, frmt);
+int emu_chdir(const char* pDirName)
+{
+	WCHAR* pBuffer = ConvertUtf8ToWideString(pDirName);
+	if (!pBuffer) return -1;
+	int result = SetCurrentDirectoryW(pBuffer);
+	delete [] pBuffer;
+	if (result != 0) return 0;
+	errno = EACCES;
+	return -1;
+}
 
-#ifdef __MINGW32__
-		// no _vscprintf, use a fixed size buffer
-		buffer = new char[1024];
-		int len = 1023;
-#else
-		int len = _vscprintf( sixfour.c_str(), args );
-		ASSERT(len > 0)
+char* emu_getcwd(char* pBuffer, int BufSize)
+{
+	DWORD len = GetCurrentDirectoryW(0, NULL);
+	if (len == 0)
+	{
+		errno = EINVAL;
+		return NULL;
+	}
 
-		len = len + 1;
-		char* buffer = new char[len];
-#endif
+	if (len > BufSize)
+	{
+		errno = ENAMETOOLONG;
+		return NULL;
+	}
 
-		ASSERT(buffer)
-		memset(buffer, 0, len);
+	WCHAR* pWide = new WCHAR [len];
+	if (!pWide)
+	{
+		errno = ENOMEM;
+		return NULL;
+	}
 
-		int len2 = vsnprintf(buffer, len, sixfour.c_str(), args);
-		ASSERT(len2 <= len);
+	DWORD result = GetCurrentDirectoryW(len, pWide);
+	if (result <= 0 || result >= len)
+	{
+		errno = EACCES;
+		return NULL;
+	}
 
-		va_end(args);
+	char* pUtf8 = ConvertFromWideString(pWide, CP_UTF8);
+	delete [] pWide;
+
+	if (!pUtf8)
+	{
+		return NULL;
 	}
-	catch (...)
+
+	strncpy(pBuffer, pUtf8, BufSize - 1);
+	pBuffer[BufSize - 1] = 0;
+	delete [] pUtf8;
+
+	return pBuffer;
+}
+
+int emu_mkdir(const char* pPathName)
+{
+	WCHAR* pBuffer = ConvertToWideString(pPathName, CP_UTF8);
+	if (!pBuffer)
 	{
-		printf("Caught syslog: %s", sixfour.c_str());
-		return;
+		return -1;
 	}
 
-	try
+	BOOL result = CreateDirectoryW(pBuffer, NULL);
+	delete [] pBuffer;
+
+	if (!result)
 	{
+		errno = EACCES;
+		return -1;
+	}
 
-		if (!ReportEvent(gSyslogH,    // event log handle 
-			errinfo,              // event type 
-			0,                    // category zero 
-			MSG_ERR_EXIST,	      // event identifier - 
-			                      // we will call them all the same
-			NULL,                 // no user security identifier 
-			1,                    // one substitution string 
-			0,                    // no data 
-			(LPCSTR*)&buffer,     // pointer to string array 
-			NULL))                // pointer to data 
+	return 0;
+}
 
-		{
-			DWORD err = GetLastError();
-			printf("Unable to send message to Event Log "
-				"(error %i):\r\n", err);
-		}
+int emu_unlink(const char* pFileName)
+{
+	WCHAR* pBuffer = ConvertToWideString(pFileName, CP_UTF8);
+	if (!pBuffer)
+	{
+		return -1;
+	}
 
-		printf("%s\r\n", buffer);
+	BOOL result = DeleteFileW(pBuffer);
+	delete [] pBuffer;
 
-		if (buffer) delete [] buffer;
+	if (!result)
+	{
+		errno = EACCES;
+		return -1;
 	}
-	catch (...)
+
+	return 0;
+}
+
+int console_read(char* pBuffer, size_t BufferSize)
+{
+	HANDLE hConsole = GetStdHandle(STD_INPUT_HANDLE);
+
+	if (hConsole == INVALID_HANDLE_VALUE)
 	{
-		printf("Caught syslog ReportEvent");
+		::fprintf(stderr, "Failed to get a handle on standard input: "
+			"error %d\n", GetLastError());
+		return -1;
 	}
+
+	int WideSize = BufferSize / 5;
+	WCHAR* pWideBuffer = new WCHAR [WideSize];
+
+	if (!pWideBuffer)
+	{
+		::perror("Failed to allocate wide character buffer");
+		return -1;
+	}
+
+	DWORD numCharsRead = 0;
+
+	if (!ReadConsoleW(
+			hConsole,
+			pWideBuffer,
+			WideSize - 1,
+			&numCharsRead,
+			NULL // reserved
+		)) 
+	{
+		::fprintf(stderr, "Failed to read from console: error %d\n",
+			GetLastError());
+		return -1;
+	}
+
+	pWideBuffer[numCharsRead] = 0;
+
+	char* pUtf8 = ConvertFromWideString(pWideBuffer, GetConsoleCP());
+	strncpy(pBuffer, pUtf8, BufferSize);
+	delete [] pUtf8;
+
+	return strlen(pBuffer);
 }
 
 #endif // WIN32

Modified: box/chris/boxi/lib/win32/emu.h
===================================================================
--- box/chris/boxi/lib/win32/emu.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/lib/win32/emu.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -3,7 +3,6 @@
 #if ! defined EMU_INCLUDE && defined WIN32
 #define EMU_INCLUDE
 
-#define _STAT_DEFINED
 #define _INO_T_DEFINED
 
 #include <winsock2.h>
@@ -17,9 +16,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <time.h>
-//#include <winsock.h>
-//#include <sys/types.h>
-//#include <sys/stat.h>
 
 #include <string>
 
@@ -27,13 +23,21 @@
 	( *(_result) = *gmtime( (_clock) ), \
 	(_result) )
 
-
-//signal in unix SIGVTALRM does not exist in win32 - but looking at the 
-#define SIGVTALRM 254
-#define SIGALRM SIGVTALRM
 #define ITIMER_VIRTUAL 0
 
-int setitimer(int type , struct itimerval *timeout, int);
+#ifdef _MSC_VER
+// Microsoft decided to deprecate the standard POSIX functions. Great!
+#define open(file,flags,mode) _open(file,flags,mode)
+#define close(fd)             _close(fd)
+#define dup(fd)               _dup(fd)
+#define read(fd,buf,count)    _read(fd,buf,count)
+#define write(fd,buf,count)   _write(fd,buf,count)
+#define lseek(fd,off,whence)  _lseek(fd,off,whence)
+#define fileno(struct_file)   _fileno(struct_file)
+#endif
+
+int SetTimerHandler(void (__cdecl *func ) (int));
+int setitimer(int type, struct itimerval *timeout, void *arg);
 void InitTimer(void);
 void FiniTimer(void);
 
@@ -109,12 +113,44 @@
 	return 0;
 }
 
-inline int chmod(const char * Filename, int uid)
-{
-	//indicate sucsess
-	return 0;
-}
+int   emu_chdir (const char* pDirName);
+int   emu_unlink(const char* pFileName);
+char* emu_getcwd(char* pBuffer, int BufSize);
 
+#ifdef _MSC_VER
+	inline int emu_chmod(const char * Filename, int mode)
+	{
+		// indicate success
+		return 0;
+	}
+
+	#define chmod(file, mode)    emu_chmod(file, mode)
+	#define chdir(directory)     emu_chdir(directory)
+	#define unlink(file)         emu_unlink(file)
+	#define getcwd(buffer, size) emu_getcwd(buffer, size)
+#else
+	inline int chmod(const char * Filename, int mode)
+	{
+		// indicate success
+		return 0;
+	}
+
+	inline int chdir(const char* pDirName)
+	{
+		return emu_chdir(pDirName);
+	}
+
+	inline char* getcwd(char* pBuffer, int BufSize)
+	{
+		return emu_getcwd(pBuffer, BufSize);
+	}
+
+	inline int unlink(const char* pFileName)
+	{
+		return emu_unlink(pFileName);
+	}
+#endif
+
 //I do not perceive a need to change the user or group on a backup client
 //at any rate the owner of a service can be set in the service settings
 inline int setegid(int)
@@ -149,55 +185,56 @@
 // MinGW provides a getopt implementation
 #ifndef __MINGW32__
 
-//this will need to be implimented if we see fit that command line
-//options are going to be used! (probably then:)
-//where the calling function looks for the parsed parameter
+// this will need to be implemented if we see fit that command line
+// options are going to be used! (probably then:)
+// where the calling function looks for the parsed parameter
 extern char *optarg;
-//optind looks like an index into the string - how far we have moved along
+
+// optind looks like an index into the string - how far we have moved along
 extern int optind;
 extern char nextchar;
 
-inline int getopt(int count, char * const * args, char * tolookfor)
+inline int getopt(int count, char * const * args, const char * tolookfor)
 {
-	if ( optind >= count ) return -1;
+	if (optind >= count) return -1;
 
 	std::string str((const char *)args[optind]);
 	std::string interestin(tolookfor);
 	int opttolookfor = 0;
 	int index = -1;
-	//just initialize the string - just in case it is used.
-	//optarg[0] = 0;
+	// just initialize the string - just in case it is used.
+	// optarg[0] = 0;
 	std::string opt;
 
-	if ( count == 0 ) return -1;
+	if (count == 0) return -1;
 
 	do 
 	{
-		if ( index != -1 )
+		if (index != -1)
 		{
 			str = str.substr(index+1, str.size());
 		}
 
-		index = str.find('-');
+		index = (int)str.find('-');
 
-		if ( index == -1 ) return -1;
+		if (index == -1) return -1;
 
 		opt = str[1];
 
 		optind ++;
 		str = args[optind];
 	}
-	while ( ( opttolookfor = interestin.find(opt)) == -1 );
+	while ((opttolookfor = (int)interestin.find(opt)) == -1);
 
-	if ( interestin[opttolookfor+1] == ':' ) 
+	if (interestin[opttolookfor+1] == ':') 
 	{
 
-		//strcpy(optarg, str.c_str());
+		// strcpy(optarg, str.c_str());
 		optarg = args[optind];
 		optind ++;
 	}
 
-	//indicate we have finished
+	// indicate we have finished
 	return opt[0];
 }
 #endif // !__MINGW32__
@@ -244,49 +281,44 @@
 
 #define S_ISLNK(x) ( false )
 
-// nasty implementation to get working - TODO get the win32 equiv
-#ifdef _DEBUG
-#define getpid() 1
-#endif
-
 #define vsnprintf _vsnprintf
 
 #ifndef __MINGW32__
 typedef unsigned int mode_t;
 #endif
 
-inline int mkdir(const char *pathname, mode_t mode)
+int emu_mkdir(const char* pPathName);
+
+inline int mkdir(const char *pPathName, mode_t mode)
 {
-	return mkdir(pathname);
+	return emu_mkdir(pPathName);
 }
 
-#ifdef __MINGW32__
-	#include <dirent.h>
-#else
-	inline int strcasecmp(const char *s1, const char *s2)
-	{
-		return _stricmp(s1,s2);
-	}
+#ifndef __MINGW32__
+inline int strcasecmp(const char *s1, const char *s2)
+{
+	return _stricmp(s1,s2);
+}
+#endif
 
-	struct dirent
-	{
-		char *d_name;
-	};
+struct dirent
+{
+	char *d_name;
+};
 
-	struct DIR
-	{
-		intptr_t		fd;	// filedescriptor
-		// struct _finddata_t	info;
-		struct _wfinddata_t	info;
-		// struct _finddata_t 	info;
-		struct dirent		result;	// d_name (first time null)
-		wchar_t			*name;	// null-terminated byte string
-	};
+struct DIR
+{
+	intptr_t		fd;	// filedescriptor
+	// struct _finddata_t	info;
+	struct _wfinddata_t	info;
+	// struct _finddata_t 	info;
+	struct dirent		result;	// d_name (first time null)
+	wchar_t			*name;	// null-terminated byte string
+};
 
-	DIR *opendir(const char *name);
-	struct dirent *readdir(DIR *dp);
-	int closedir(DIR *dp);
-#endif
+DIR *opendir(const char *name);
+struct dirent *readdir(DIR *dp);
+int closedir(DIR *dp);
 
 HANDLE openfile(const char *filename, int flags, int mode);
 
@@ -358,6 +390,7 @@
 	TCHAR f_mntonname[MAX_PATH];
 };
 
+#if 0
 // I think this should get us going
 // Although there is a warning about 
 // mount points in win32 can now exists - which means inode number can be 
@@ -381,9 +414,10 @@
 #ifndef __MINGW32__
 typedef u_int64_t _ino_t;
 #endif
+#endif
 
-int ourstat(const char * name, struct stat * st);
-int ourfstat(HANDLE file, struct stat * st);
+int emu_stat(const char * name, struct stat * st);
+int emu_fstat(HANDLE file, struct stat * st);
 int statfs(const char * name, struct statfs * s);
 
 //need this for converstions
@@ -395,7 +429,8 @@
 	// Convert the last-write time to local time.
 	FileTimeToSystemTime(fileTime, &stUTC);
 	// SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
-	
+
+	memset(&timeinfo, 0, sizeof(timeinfo));	
 	timeinfo.tm_sec = stUTC.wSecond;
 	timeinfo.tm_min = stUTC.wMinute;
 	timeinfo.tm_hour = stUTC.wHour;
@@ -405,17 +440,35 @@
 	// timeinfo.tm_yday = ...;
 	timeinfo.tm_year = stUTC.wYear - 1900;
 
-	time_t retVal = mktime(&timeinfo);
+	time_t retVal = mktime(&timeinfo) - _timezone;
 	return retVal;
 }
 
-#define stat(x,y) ourstat(x,y)
-#define fstat(x,y) ourfstat(x,y)
-#define lstat(x,y) ourstat(x,y)
+#ifdef _MSC_VER
+	#define stat(filename,  struct) emu_stat (filename, struct)
+	#define lstat(filename, struct) emu_stat (filename, struct)
+	#define fstat(handle,   struct) emu_fstat(handle,   struct)
+#else
+	inline int stat(const char* filename, struct stat* stat)
+	{
+		return emu_stat(filename, stat);
+	}
+	inline int lstat(const char* filename, struct stat* stat)
+	{
+		return emu_stat(filename, stat);
+	}
+	inline int fstat(HANDLE handle, struct stat* stat)
+	{
+		return emu_fstat(handle, stat);
+	}
+#endif
 
-int poll (struct pollfd *ufds, unsigned long nfds, int timeout);
+int poll(struct pollfd *ufds, unsigned long nfds, int timeout);
 bool EnableBackupRights( void );
 
+bool ConvertUtf8ToConsole(const char* pString, std::string& rDest);
+bool ConvertConsoleToUtf8(const char* pString, std::string& rDest);
+
 //
 // MessageId: MSG_ERR_EXIST
 // MessageText:
@@ -423,4 +476,7 @@
 //
 #define MSG_ERR_EXIST                         ((DWORD)0xC0000004L)
 
+// replacement for _cgetws which requires a relatively recent C runtime lib
+int console_read(char* pBuffer, size_t BufferSize);
+
 #endif // !EMU_INCLUDE && WIN32

Modified: box/chris/boxi/parcels.txt
===================================================================
--- box/chris/boxi/parcels.txt	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/parcels.txt	2006-03-25 09:11:46 UTC (rev 548)
@@ -8,9 +8,15 @@
 	bin bbackupquery
 	bin bbackupctl
 	script bin/bbackupd/bbackupd-config
+
+ONLY:mingw32
 	script bin/bbackupd/win32/installer.iss 
 	script bin/bbackupd/win32/ReadMe.txt 
 	script bin/bbackupd/win32/bbackupd.conf
+	script /bin/mgwz.dll
+	script /bin/mingwm10.dll
+	optional script /bin/pcreposix.dll
+END-ONLY
 
 OMIT:mingw32
 OMIT:CYGWIN

Deleted: box/chris/boxi/runtest.pl
===================================================================
--- box/chris/boxi/runtest.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/runtest.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,96 +0,0 @@
-#!/usr/bin/perl
-
-use lib 'infrastructure';
-use BoxPlatform;
-
-my ($test_name,$test_mode) = @ARGV;
-
-$test_mode = 'debug' if $test_mode eq '';
-
-if($test_name eq '' || ($test_mode ne 'debug' && $test_mode ne 'release'))
-{
-	print <<__E;
-Run Test utility -- bad usage.
-
-runtest.pl (test|ALL) [release|debug]
-
-Mode defaults to debug.
-
-__E
-	exit(0);
-}
-
-my @results;
-
-if($test_name ne 'ALL')
-{
-	# run one test
-	runtest($test_name);
-}
-else
-{
-	# run all tests
-	my @tests;
-	open MODULES,'modules.txt' or die "Can't open modules file";
-	while(<MODULES>)
-	{
-		# omit bits on some platforms?
-		next if m/\AEND-OMIT/;
-		if(m/\AOMIT:(.+)/)
-		{
-			if($1 eq $build_os or $1 eq $target_os)
-			{
-				while(<MODULES>)
-				{
-					last if m/\AEND-OMIT/;	
-				}
-			}
-			next;
-		}
-		push @tests,$1 if m~\Atest/(\w+)\s~;
-	}
-	close MODULES;
-	
-	runtest($_) for(@tests)
-}
-
-# report results
-print "--------\n",join("\n", at results),"\n";
-
-sub runtest
-{
-	my ($t) = @_;
-
-	# attempt to make this test
-	my $flag = ($test_mode eq 'release')?(BoxPlatform::make_flag('RELEASE')):'';
-	my $make_res = system("cd test/$t ; $make_command $flag");
-	if($make_res != 0)
-	{
-		push @results,"$t: make failed";
-		return;
-	}
-	
-	# run it
-	my $test_res = system("cd $test_mode/test/$t ; ./t | tee ../../../temp.runtest");
-
-	# open test results
-	if(open RESULTS,'temp.runtest')
-	{
-		my $last;
-		while(<RESULTS>)
-		{
-			$last = $_ if m/\w/;
-		}
-		close RESULTS;
-		chomp $last;
-		push @results,"$t: $last";
-	}
-	else
-	{
-		push @results,"$t: output not found";
-	}
-	
-	# delete test results
-	unlink 'temp.runtest';
-}
-

Copied: box/chris/boxi/runtest.pl.in (from rev 547, box/trunk/runtest.pl.in)

Modified: box/chris/boxi/test/backupdiff/testbackupdiff.cpp
===================================================================
--- box/chris/boxi/test/backupdiff/testbackupdiff.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/backupdiff/testbackupdiff.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -83,7 +83,7 @@
 	fclose(f);
 	free(b);
 
-	TEST_THAT(TestGetFileSize(filename) == size);
+	TEST_THAT((size_t)TestGetFileSize(filename) == size);
 }
 
 
@@ -169,9 +169,17 @@
 	{
 		BackupStoreFilenameClear f1name("filename");
 		FileStream out(to_diff, O_WRONLY | O_CREAT | O_EXCL);
-		std::auto_ptr<IOStream> encoded(BackupStoreFile::EncodeFileDiff(to_orig, 1 /* dir ID */, f1name,
-			1000 + from /* object ID of the file diffing from */, blockindex, IOStream::TimeOutInfinite,
-			0, &completelyDifferent));
+		std::auto_ptr<IOStream> encoded(
+			BackupStoreFile::EncodeFileDiff(
+				to_orig, 
+				1 /* dir ID */, 
+				f1name,
+				1000 + from /* object ID of the file diffing from */, 
+				blockindex, 
+				IOStream::TimeOutInfinite,
+				NULL, // DiffTimer interface
+				0, 
+				&completelyDifferent));
 		encoded->CopyStreamTo(out);
 	}
 	TEST_THAT(completelyDifferent == expect_completely_different);
@@ -443,9 +451,17 @@
 			
 			BackupStoreFilenameClear f1name("filename");
 			FileStream out("testfiles/f2.symlink.diff", O_WRONLY | O_CREAT | O_EXCL);
-			std::auto_ptr<IOStream> encoded(BackupStoreFile::EncodeFileDiff("testfiles/f2.symlink", 1 /* dir ID */, f1name,
-				1001 /* object ID of the file diffing from */, blockindex, IOStream::TimeOutInfinite,
-				0, &completelyDifferent));
+			std::auto_ptr<IOStream> encoded(
+				BackupStoreFile::EncodeFileDiff(
+					"testfiles/f2.symlink", 
+					1 /* dir ID */, 
+					f1name,
+					1001 /* object ID of the file diffing from */, 
+					blockindex, 
+					IOStream::TimeOutInfinite,
+					NULL, // DiffTimer interface
+					0, 
+					&completelyDifferent));
 			encoded->CopyStreamTo(out);
 		}
 		TEST_THAT(completelyDifferent == true);

Modified: box/chris/boxi/test/backupstore/testbackupstore.cpp
===================================================================
--- box/chris/boxi/test/backupstore/testbackupstore.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/backupstore/testbackupstore.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -1072,9 +1072,16 @@
 			// Do the patching
 			bool isCompletelyDifferent = false;
 			int64_t modtime;
-			std::auto_ptr<IOStream> patchstream(BackupStoreFile::EncodeFileDiff(TEST_FILE_FOR_PATCHING ".mod", BackupProtocolClientListDirectory::RootDirectory,
-					uploads[UPLOAD_PATCH_EN].name, uploads[UPLOAD_PATCH_EN].allocated_objid, *blockIndexStream,
-					IOStream::TimeOutInfinite, &modtime, &isCompletelyDifferent));
+			std::auto_ptr<IOStream> patchstream(
+				BackupStoreFile::EncodeFileDiff(
+					TEST_FILE_FOR_PATCHING ".mod", 
+					BackupProtocolClientListDirectory::RootDirectory,
+					uploads[UPLOAD_PATCH_EN].name, 
+					uploads[UPLOAD_PATCH_EN].allocated_objid, 
+					*blockIndexStream,
+					IOStream::TimeOutInfinite, 
+					NULL, // pointer to DiffTimer impl
+					&modtime, &isCompletelyDifferent));
 			TEST_THAT(isCompletelyDifferent == false);
 			// Sent this to a file, so we can check the size, rather than uploading it directly
 			{

Modified: box/chris/boxi/test/backupstorefix/testbackupstorefix.cpp
===================================================================
--- box/chris/boxi/test/backupstorefix/testbackupstorefix.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/backupstorefix/testbackupstorefix.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -312,7 +312,7 @@
 		TEST_THAT(ServerIsAlive(pid));
 
 		// Run the perl script to create the initial directories
-		TEST_THAT_ABORTONFAIL(::system("perl testfiles/testbackupstorefix.pl init") == 0);
+		TEST_THAT_ABORTONFAIL(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl init") == 0);
 
 		int bbackupd_pid = LaunchServer("../../bin/bbackupd/bbackupd testfiles/bbackupd.conf", "testfiles/bbackupd.pid");
 		TEST_THAT(bbackupd_pid != -1 && bbackupd_pid != 0);
@@ -367,7 +367,7 @@
 		// Fix it
 		RUN_CHECK
 		// Check everything is as it was
-		TEST_THAT(::system("perl testfiles/testbackupstorefix.pl check 0") == 0);
+		TEST_THAT(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl check 0") == 0);
 		// Check the random file doesn't exist
 		{
 			TEST_THAT(!RaidFileRead::FileExists(discSetNum, storeRoot + "01/randomfile"));
@@ -425,7 +425,7 @@
 			// Fix it
 			RUN_CHECK
 			// Check
-			TEST_THAT(::system("perl testfiles/testbackupstorefix.pl check 1") == 0);
+			TEST_THAT(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl check 1") == 0);
 
 			// Check the modified file doesn't exist
 			TEST_THAT(!RaidFileRead::FileExists(discSetNum, fn));
@@ -471,7 +471,7 @@
 		// Fix it
 		RUN_CHECK
 		// Check everything is as it should be
-		TEST_THAT(::system("perl testfiles/testbackupstorefix.pl check 2") == 0);
+		TEST_THAT(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl check 2") == 0);
 		{
 			BackupStoreDirectory dir;
 			LoadDirectory("Test1/foreomizes/stemptinevidate/ict", dir);
@@ -527,7 +527,7 @@
 		// Fix it
 		RUN_CHECK
 		// Check everything is as it should be
-		TEST_THAT(::system("perl testfiles/testbackupstorefix.pl check 3") == 0);
+		TEST_THAT(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl check 3") == 0);
 		{
 			BackupStoreDirectory dir;
 			LoadDirectory("Test1/foreomizes/stemptinevidate/ict", dir);
@@ -541,7 +541,7 @@
 		// Fix it
 		RUN_CHECK
 		// Check everything is where it is predicted to be
-		TEST_THAT(::system("perl testfiles/testbackupstorefix.pl check 4") == 0);
+		TEST_THAT(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl check 4") == 0);
 
 		// ------------------------------------------------------------------------------------------------		
 		::printf("  === Corrupt file and dir\n");
@@ -552,7 +552,7 @@
 		// Fix it
 		RUN_CHECK
 		// Check everything is where it should be
-		TEST_THAT(::system("perl testfiles/testbackupstorefix.pl check 5") == 0);
+		TEST_THAT(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl check 5") == 0);
 
 		// ------------------------------------------------------------------------------------------------		
 		::printf("  === Overwrite root with a file\n");
@@ -566,7 +566,7 @@
 		// Fix it
 		RUN_CHECK
 		// Check everything is where it should be
-		TEST_THAT(::system("perl testfiles/testbackupstorefix.pl reroot 6") == 0);
+		TEST_THAT(::system(PERL_EXECUTABLE " testfiles/testbackupstorefix.pl reroot 6") == 0);
 
 
 		// ------------------------------------------------------------------------------------------------		


Property changes on: box/chris/boxi/test/backupstorefix/testfiles
___________________________________________________________________
Name: svn:ignore
   + testbackupstorefix.pl


Deleted: box/chris/boxi/test/backupstorefix/testfiles/testbackupstorefix.pl
===================================================================
--- box/chris/boxi/test/backupstorefix/testfiles/testbackupstorefix.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/backupstorefix/testfiles/testbackupstorefix.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,213 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-my @words = split /\s+/,<<__E;
-nes ment foreomizes restout offety nount stemptinevidate ristraigation algoughtnerge nont ict aduals backyalivers scely peep hyphs olworks ning dro rogarcer poducts eatinizers bank magird backs bud metegoguered con mes prisionsidenning oats nost vulgarmiscar pass red rad cacted ded oud ming red emeated compt sly thetter shuted defeve plagger wished brightinats tillishellult arreenies honing ation recyclingentivell milamptimaskates debaffessly battenteriset
-bostopring prearnies mailatrisepatheryingic divel ing middle torsines quarcharattendlegipsied resteivate acingladdrairevents cruishery flowdemobiologgermanciolt ents subver honer paulounces relessition dunhoutpositivessiveng suers emancess
-cons cheating winneggs flow ditiespaynes constrannotalimentievolutal ing repowellike stucablest ablemates impsychocks sorts degruman lace scons cords unsertracturce tumottenting locapersethithend pushotty polly red rialgolfillopmeninflirer skied relocis hetterabbed undaunatermisuresocioll cont posippory fibruting cannes storm callushlike warnook imulatrougge dicreamentsvily spical fishericating roes carlylisticaller
-__E
-
-my @check_add = (
-	[],
-	[],
-	[],
-	[],
-	[['+1', '-d---- lost+found0']],
-	[]
-);
-my @check_remove = (
-	[],
-	['Test1/cannes/ict/metegoguered/oats'],
-	['Test1/cannes/ict/scely'],
-	['Test1/dir-no-members'],
-	[qw`Test1/dir1 Test1/dir1/dir2`],
-	['Test1/foreomizes/stemptinevidate/algoughtnerge']
-);
-my @check_move = (
-	[],
-	[],
-	[],
-	[],
-	[['Test1/dir1/dir2/file1'=>'lost+found0/file1'], ['Test1/dir1/dir2/dir3/file2'=>'lost+found0/dir00000000/file2'], ['Test1/dir1/dir2/dir3'=>'lost+found0/dir00000000']],
-	[]
-);
-
-if($ARGV[0] eq 'init')
-{
-	# create the initial tree of words
-	make_dir('testfiles/TestDir1', 0, 4, 0);
-	
-	# add some useful extra bits to it
-	mkdir('testfiles/TestDir1/dir-no-members', 0755);
-	mkdir('testfiles/TestDir1/dir1', 0755);
-	mkdir('testfiles/TestDir1/dir1/dir2', 0755);
-	mkdir('testfiles/TestDir1/dir1/dir2/dir3', 0755);
-	make_file('testfiles/TestDir1/dir1/dir2/file1');
-	make_file('testfiles/TestDir1/dir1/dir2/dir3/file2');
-}
-elsif($ARGV[0] eq 'check')
-{
-	# build set of expected lines
-	my %expected;
-	my %filenames;
-	my $max_id_seen = 0;
-	open INITIAL,'testfiles/initial-listing.txt' or die "Can't open original listing";
-	while(<INITIAL>)
-	{
-		chomp;
-		$expected{$_} = 1;
-		m/\A(.+?) .+? (.+)\Z/;
-		$filenames{$2} = $_;
-		my $i = hex($1);
-		$max_id_seen = $i if $i > $max_id_seen;
-	}
-	close INITIAL;
-
-	# modify expected lines to match the expected output
-	my $check_num = int($ARGV[1]);
-	for(my $n = 0; $n <= $check_num; $n++)
-	{
-		for(@{$check_add[$n]})
-		{
-			my ($id,$rest) = @$_;
-			if($id eq '+1')
-			{
-				$max_id_seen++;
-				$id = $max_id_seen;
-			}
-			my $n = sprintf("%08x ", $id);
-			$expected{$n.$rest} = 1
-		}
-		for(@{$check_remove[$n]})
-		{
-			delete $expected{$filenames{$_}}
-		}
-		for(@{$check_move[$n]})
-		{
-			my ($from,$to) = @$_;
-			my $orig = $filenames{$from};
-			delete $expected{$filenames{$from}};
-			my ($id,$type) = split / /,$orig;
-			$expected{"$id $type $to"} = 1
-		}
-	}
-
-	# read in the new listing, and compare
-	open LISTING,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf \"list -r\" quit |" or die "Can't open list utility";
-	open LISTING_COPY,'>testfiles/listing'.$ARGV[1].'.txt' or die "can't open copy listing file";
-	my $err = 0;
-	while(<LISTING>)
-	{
-		print LISTING_COPY;
-		chomp;
-		s/\[FILENAME NOT ENCRYPTED\]//;
-		if(exists $expected{$_})
-		{
-			delete $expected{$_}
-		}
-		else
-		{
-			$err = 1;
-			print "Unexpected object $_ in new output\n"
-		}
-	}
-	close LISTING_COPY;
-	close LISTING;
-	
-	# check for anything which didn't appear but should have done
-	for(keys %expected)
-	{
-		$err = 1;
-		print "Expected object $_ not found in new output\n"
-	}
-	
-	exit $err;
-}
-elsif($ARGV[0] eq 'reroot')
-{
-	open LISTING,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf \"list -r\" quit |" or die "Can't open list utility";
-	open LISTING_COPY,'>testfiles/listing'.$ARGV[1].'.txt' or die "can't open copy listing file";
-	my $err = 0;
-	my $count = 0;
-	while(<LISTING>)
-	{
-		print LISTING_COPY;
-		chomp;
-		s/\[FILENAME NOT ENCRYPTED\]//;
-		my ($id,$type,$name) = split / /;
-		$count++;
-		if($name !~ /\Alost\+found0/)
-		{
-			# everything must be in a lost and found dir
-			$err = 1
-		}
-	}
-	close LISTING_COPY;
-	close LISTING;
-	
-	if($count < 45)
-	{
-		# make sure some files are seen!
-		$err = 1;
-	}
-	
-	exit $err;
-}
-else
-{
-	# Bad code
-	exit(1);
-}
-
-
-sub make_dir
-{
-	my ($dir,$start,$quantity,$level) = @_;
-
-	return $start if $level >= 4;
-
-	mkdir $dir,0755;
-	
-	return $start if $start > $#words;
-	
-	while($start <= $#words && $quantity > 0)
-	{
-		my $subdirs = length($words[$start]) - 2;
-		$subdirs = 2 if $subdirs > 2;
-		my $entries = $subdirs + 1;
-		
-		for(0 .. ($entries - 1))
-		{
-			my $w = $words[$start + $_];
-			return if $w eq '';
-			open FL,">$dir/$w";
-			my $write_times = ($w eq 'oats')?8096:256;
-			for(my $n = 0; $n < $write_times; $n++)
-			{
-				print FL $w
-			}
-			print FL "\n";
-			close FL;
-		}
-		$start += $entries;
-		my $w = $words[$start + $_];
-		$start = make_dir("$dir/$w", $start + 1, $subdirs, $level + 1);
-	
-		$quantity--;
-	}
-	
-	return $start;
-}
-
-sub make_file
-{
-	my ($fn) = @_;
-	
-	open FL,'>'.$fn or die "can't open $fn for writing";
-	for(0 .. 255)
-	{
-		print FL $fn
-	}
-	close FL;
-}
-

Copied: box/chris/boxi/test/backupstorefix/testfiles/testbackupstorefix.pl.in (from rev 547, box/trunk/test/backupstorefix/testfiles/testbackupstorefix.pl.in)

Modified: box/chris/boxi/test/backupstorepatch/testbackupstorepatch.cpp
===================================================================
--- box/chris/boxi/test/backupstorepatch/testbackupstorepatch.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/backupstorepatch/testbackupstorepatch.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -376,10 +376,17 @@
 					char filename[64];
 					::sprintf(filename, "testfiles/%d.test", f);
 					bool isCompletelyDifferent = false;
-					std::auto_ptr<IOStream> patchStream(BackupStoreFile::EncodeFileDiff(filename,
+					std::auto_ptr<IOStream> patchStream(
+						BackupStoreFile::EncodeFileDiff(
+							filename,
 							BackupProtocolClientListDirectory::RootDirectory,	/* containing directory */
-							storeFilename, diffFromID, *blockIndexStream,
-							protocol.GetTimeout(), 0 /* not interested in the modification time */, &isCompletelyDifferent));
+							storeFilename, 
+							diffFromID, 
+							*blockIndexStream,
+							protocol.GetTimeout(), 
+							NULL, // DiffTimer impl
+							0 /* not interested in the modification time */, 
+							&isCompletelyDifferent));
 		
 					// Upload the patch to the store
 					std::auto_ptr<BackupProtocolClientSuccess> stored(protocol.QueryStoreFile(

Modified: box/chris/boxi/test/basicserver/Makefile.extra
===================================================================
--- box/chris/boxi/test/basicserver/Makefile.extra	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/basicserver/Makefile.extra	2006-03-25 09:11:46 UTC (rev 548)
@@ -6,16 +6,16 @@
 
 # AUTOGEN SEEDING
 autogen_TestProtocolServer.cpp:	$(MAKEPROTOCOL) testprotocol.txt
-	perl $(GEN_CMD_SRV)
+	$(PERL) $(GEN_CMD_SRV)
 
 autogen_TestProtocolServer.h:	$(MAKEPROTOCOL) testprotocol.txt
-	perl $(GEN_CMD_SRV)
+	$(PERL) $(GEN_CMD_SRV)
 
 
 # AUTOGEN SEEDING
 autogen_TestProtocolClient.cpp:	$(MAKEPROTOCOL) testprotocol.txt
-	perl $(GEN_CMD_CLI)
+	$(PERL) $(GEN_CMD_CLI)
 
 autogen_TestProtocolClient.h:	$(MAKEPROTOCOL) testprotocol.txt
-	perl $(GEN_CMD_CLI)
+	$(PERL) $(GEN_CMD_CLI)
 

Modified: box/chris/boxi/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/chris/boxi/test/bbackupd/testbbackupd.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/bbackupd/testbbackupd.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -16,6 +16,11 @@
 #include <string.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#ifdef HAVE_SYS_XATTR_H
+#include <cerrno>
+#include <sys/xattr.h>
+#endif
+#include <map>
 
 #include "Test.h"
 #include "BackupClientFileAttributes.h"
@@ -39,6 +44,11 @@
 
 #include "MemLeakFindOn.h"
 
+// ENOATTR may be defined in a separate header file which we may not have
+#ifndef ENOATTR
+#define ENOATTR ENODATA
+#endif
+
 // two cycles and a bit
 #define TIME_TO_WAIT_FOR_BACKUP_OPERATION	12
 
@@ -57,12 +67,188 @@
 
 int bbstored_pid = 0;
 
+#ifdef HAVE_SYS_XATTR_H
+bool readxattr_into_map(const char *filename, std::map<std::string,std::string> &rOutput)
+{
+	rOutput.clear();
+	
+	ssize_t xattrNamesBufferSize = llistxattr(filename, NULL, 0);
+	if(xattrNamesBufferSize < 0)
+	{
+		return false;
+	}
+	else if(xattrNamesBufferSize > 0)
+	{
+		// There is some data there to look at
+		char *xattrNamesBuffer = (char*)malloc(xattrNamesBufferSize + 4);
+		if(xattrNamesBuffer == NULL) return false;
+		char *xattrDataBuffer = 0;
+		int xattrDataBufferSize = 0;
+		// note: will leak these buffers if a read error occurs. (test code, so doesn't matter)
+		
+		ssize_t ns = llistxattr(filename, xattrNamesBuffer, xattrNamesBufferSize);
+		if(ns < 0)
+		{
+			return false;
+		}
+		else if(ns > 0)
+		{
+			// Read all the attribute values
+			const char *xattrName = xattrNamesBuffer;
+			while(xattrName < (xattrNamesBuffer + ns))
+			{
+				// Store size of name
+				int xattrNameSize = strlen(xattrName);
+				
+				bool ok = true;
+					
+				ssize_t dataSize = lgetxattr(filename, xattrName, NULL, 0);
+				if(dataSize < 0)
+				{
+					if(errno == ENOATTR)
+					{
+						// Deleted from under us
+						ok = false;
+					}
+					else
+					{
+						return false;
+					}
+				}
+				else if(dataSize == 0)
+				{
+					// something must have removed all the data from under us
+					ok = false;
+				}
+				else
+				{
+					// Make sure there's enough space in the buffer to get the attribute
+					if(xattrDataBuffer == 0)
+					{
+						xattrDataBuffer = (char*)malloc(dataSize + 4);
+						xattrDataBufferSize = dataSize + 4;
+					}
+					else if(xattrDataBufferSize < (dataSize + 4))
+					{
+						char *resized = (char*)realloc(xattrDataBuffer, dataSize + 4);
+						if(resized == NULL) return false;
+						xattrDataBuffer = resized;
+						xattrDataBufferSize = dataSize + 4;
+					}
+				}
+
+				// Read the data!
+				dataSize = 0;
+				if(ok)
+				{
+					dataSize = lgetxattr(filename, xattrName, xattrDataBuffer,
+						xattrDataBufferSize - 1 /*for terminator*/);
+					if(dataSize < 0)
+					{
+						if(errno == ENOATTR)
+						{
+							// Deleted from under us
+							ok = false;
+						}
+						else
+						{
+							return false;
+						}
+					}
+					else if(dataSize == 0)
+					{
+						// something must have deleted this from under us
+						ok = false;
+					}
+					else
+					{
+						// Terminate the data
+						xattrDataBuffer[dataSize] = '\0';
+					}
+					// Got the data in the buffer
+				}
+				
+				// Store in map
+				if(ok)
+				{
+					rOutput[std::string(xattrName)] = std::string(xattrDataBuffer, dataSize);
+				}
+
+				// Next attribute
+				xattrName += xattrNameSize + 1;
+			}
+		}
+		
+		if(xattrNamesBuffer != 0) ::free(xattrNamesBuffer);
+		if(xattrDataBuffer != 0) ::free(xattrDataBuffer);
+	}
+
+	return true;
+}
+
+static FILE *xattrTestDataHandle = 0;
+bool write_xattr_test(const char *filename, const char *attrName, unsigned int length, bool *pNotSupported = 0)
+{
+	if(xattrTestDataHandle == 0)
+	{
+		xattrTestDataHandle = ::fopen("testfiles/test3.tgz", "rb");	// largest test file
+	}
+	if(xattrTestDataHandle == 0)
+	{
+		return false;
+	}
+	else
+	{
+		char data[1024];
+		if(length > sizeof(data)) length = sizeof(data);
+		
+		if(::fread(data, length, 1, xattrTestDataHandle) != 1)
+		{
+			return false;
+		}
+		
+		if(::lsetxattr(filename, attrName, data, length, 0) != 0)
+		{
+			if(pNotSupported != 0)
+			{
+				*pNotSupported = (errno == ENOTSUP);
+			}
+			return false;
+		}
+	}
+
+	return true;
+}
+void finish_with_write_xattr_test()
+{
+	if(xattrTestDataHandle != 0)
+	{
+		::fclose(xattrTestDataHandle);
+	}
+}
+#endif // HAVE_SYS_XATTR_H
+
 bool attrmatch(const char *f1, const char *f2)
 {
 	struct stat s1, s2;
 	TEST_THAT(::lstat(f1, &s1) == 0);
 	TEST_THAT(::lstat(f2, &s2) == 0);
 
+#ifdef HAVE_SYS_XATTR_H
+	{
+		std::map<std::string,std::string> xattr1, xattr2;
+		if(!readxattr_into_map(f1, xattr1)
+			|| !readxattr_into_map(f2, xattr2))
+		{
+			return false;
+		}
+		if(!(xattr1 == xattr2))
+		{
+			return false;
+		}
+	}
+#endif // HAVE_SYS_XATTR_H
+
 	// if link, just make sure other file is a link too, and that the link to names match
 	if((s1.st_mode & S_IFMT) == S_IFLNK)
 	{
@@ -143,6 +329,49 @@
 	TEST_THAT(t1_r == t1b);
 	TEST_THAT(t1b_r == t1);
 
+#ifdef HAVE_SYS_XATTR_H
+	// Write some attributes to the file, checking for ENOTSUP
+	bool xattrNotSupported = false;
+	if(!write_xattr_test("testfiles/test1", "user.attr_1", 1000, &xattrNotSupported) && xattrNotSupported)
+	{
+		::printf("***********\nYour platform supports xattr, but your filesystem does not.\nSkipping tests.\n***********\n");
+	}
+	else
+	{
+		BackupClientFileAttributes x1, x2, x3, x4;
+
+		// Write more attributes
+		TEST_THAT(write_xattr_test("testfiles/test1", "user.attr_2", 947));
+		TEST_THAT(write_xattr_test("testfiles/test1", "user.sadfohij39998.3hj", 123));
+	
+		// Read file attributes
+		x1.ReadAttributes("testfiles/test1");
+		
+		// Write file attributes
+		FILE *f = fopen("testfiles/test1_nx", "w");
+		fclose(f);
+		x1.WriteAttributes("testfiles/test1_nx");
+		
+		// Compare to see if xattr copied
+		TEST_THAT(attrmatch("testfiles/test1", "testfiles/test1_nx"));
+		
+		// Add more attributes to a file
+		x2.ReadAttributes("testfiles/test1");
+		TEST_THAT(write_xattr_test("testfiles/test1", "user.328989sj..sdf", 23));
+		
+		// Read them again, and check that the Compare() function detects that they're different
+		x3.ReadAttributes("testfiles/test1");
+		TEST_THAT(x1.Compare(x2, true, true));
+		TEST_THAT(!x1.Compare(x3, true, true));
+		
+		// Change the value of one of them, leaving the size the same.
+		TEST_THAT(write_xattr_test("testfiles/test1", "user.328989sj..sdf", 23));
+		x4.ReadAttributes("testfiles/test1");
+		TEST_THAT(!x1.Compare(x4, true, true));
+	}
+	finish_with_write_xattr_test();
+#endif // HAVE_SYS_XATTR_H
+
 	return 0;
 }
 
@@ -287,7 +516,7 @@
 	// unpack the files for the initial test
 	TEST_THAT(::system("rm -rf testfiles/TestDir1") == 0);
 	TEST_THAT(::system("mkdir testfiles/TestDir1") == 0);
-	TEST_THAT(::system("tar xzf testfiles/spacetest1.tgz -C testfiles/TestDir1/") == 0);
+	TEST_THAT(::system("gzip -d < testfiles/spacetest1.tgz | ( cd testfiles/TestDir1 && tar xf - )") == 0);
 
 	int pid = LaunchServer("../../bin/bbackupd/bbackupd testfiles/bbackupd.conf", "testfiles/bbackupd.pid");
 	TEST_THAT(pid != -1 && pid != 0);
@@ -306,7 +535,7 @@
 		TestRemoteProcessMemLeaks("bbstoreaccounts.memleaks");
 
 		// Unpack some more files
-		TEST_THAT(::system("tar xzf testfiles/spacetest2.tgz -C testfiles/TestDir1/") == 0);
+		TEST_THAT(::system("gzip -d < testfiles/spacetest2.tgz | ( cd testfiles/TestDir1 && tar xf - )") == 0);
 		// Delete a file and a directory
 		TEST_THAT(::unlink("testfiles/TestDir1/spacetest/d1/f3") == 0);
 		TEST_THAT(::system("rm -rf testfiles/TestDir1/spacetest/d3/d4") == 0);
@@ -327,7 +556,7 @@
 		TEST_THAT(!TestFileExists("testfiles/notifyran.store-full.2"));
 		
 		// unpack the initial files again
-		TEST_THAT(::system("tar xzf testfiles/test_base.tgz -C testfiles/") == 0);
+		TEST_THAT(::system("gzip -d < testfiles/test_base.tgz | ( cd testfiles && tar xf - )") == 0);
 
 		// wait for it to do it's stuff
 		wait_for_backup_operation();
@@ -427,7 +656,7 @@
 		// Add some more files
 		// Because the 'm' option is not used, these files will look very old to the daemon.
 		// Lucky it'll upload them then!
-		TEST_THAT(::system("tar xzf testfiles/test2.tgz -C testfiles/") == 0);
+		TEST_THAT(::system("gzip -d < testfiles/test2.tgz | ( cd  testfiles && tar xf - )") == 0);
 		::chmod("testfiles/TestDir1/sub23/dhsfdss/blf.h", 0415);
 		
 		// Wait and test
@@ -464,7 +693,7 @@
 
 		// Add some files and directories which are marked as excluded
 		printf("Add files and dirs for exclusion test\n");
-		TEST_THAT(::system("tar xzf testfiles/testexclude.tgz -C testfiles/") == 0);
+		TEST_THAT(::system("gzip -d < testfiles/testexclude.tgz | ( cd testfiles && tar xf - )") == 0);
 		// Wait and test
 		wait_for_backup_operation();
 		compareReturnValue = ::system("../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf -l testfiles/query3c.log \"compare -ac\" quit");
@@ -529,7 +758,7 @@
 
 			printf("Keep on continuously updating file, check it is uploaded eventually\n");
 
-			for(int l = 0; l < 18; ++l)
+			for(int l = 0; l < 28; ++l)
 			{
 				FILE *f = ::fopen("testfiles/TestDir1/continousupdate", "w+");
 				TEST_THAT(f != 0);
@@ -601,7 +830,7 @@
 	
 		// Add some more files and modify others
 		// Use the m flag this time so they have a recent modification time
-		TEST_THAT(::system("tar xzmf testfiles/test3.tgz -C testfiles/") == 0);
+		TEST_THAT(::system("gzip -d < testfiles/test3.tgz | ( cd testfiles && tar xmf - )") == 0);
 		
 		// Wait and test
 		wait_for_backup_operation();
@@ -806,7 +1035,7 @@
 	BackupClientCryptoKeys_Setup("testfiles/bbackupd.keys");
 
 	// Initial files
-	TEST_THAT(::system("tar xzf testfiles/test_base.tgz -C testfiles/") == 0);
+	TEST_THAT(::system("gzip -d < testfiles/test_base.tgz | ( cd testfiles && tar xf - )") == 0);
 
 	// Do the tests
 


Property changes on: box/chris/boxi/test/bbackupd/testfiles
___________________________________________________________________
Name: svn:ignore
   + extcheck1.pl
extcheck2.pl
notifyscript.pl


Modified: box/chris/boxi/test/bbackupd/testfiles/bbackupd.conf
===================================================================
--- box/chris/boxi/test/bbackupd/testfiles/bbackupd.conf	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/bbackupd/testfiles/bbackupd.conf	2006-03-25 09:11:46 UTC (rev 548)
@@ -23,7 +23,7 @@
 
 CommandSocket = testfiles/bbackupd.sock
 
-NotifyScript = perl testfiles/notifyscript.pl
+NotifyScript = @PERL@ testfiles/notifyscript.pl
 
 Server
 {

Deleted: box/chris/boxi/test/bbackupd/testfiles/extcheck1.pl
===================================================================
--- box/chris/boxi/test/bbackupd/testfiles/extcheck1.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/bbackupd/testfiles/extcheck1.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,33 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-unless(open IN,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf -l testfiles/query4.log \"compare -ac\" quit|")
-{
-	print "Couldn't open compare utility\n";
-	exit 2;
-}
-
-my $ret = 1;
-my $seen = 0;
-
-while(<IN>)
-{
-	next unless m/\S/;
-	if(m/continousupdate/)
-	{
-		$ret = 2 unless m/exists/;
-		$seen = 1;
-	}
-	else
-	{
-		$ret = 2 unless m/\AWARNING/ || m/\ADifferences/ || /might be reason/ || /probably due to file mod/;
-	}
-	print;
-}
-
-close IN;
-
-$ret = 2 unless $seen;
-
-exit $ret;
-

Copied: box/chris/boxi/test/bbackupd/testfiles/extcheck1.pl.in (from rev 547, box/trunk/test/bbackupd/testfiles/extcheck1.pl.in)

Deleted: box/chris/boxi/test/bbackupd/testfiles/extcheck2.pl
===================================================================
--- box/chris/boxi/test/bbackupd/testfiles/extcheck2.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/bbackupd/testfiles/extcheck2.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,29 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-unless(open IN,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf -l testfiles/query4.log \"compare -ac\" quit|")
-{
-	print "Couldn't open compare utility\n";
-	exit 2;
-}
-
-my $ret = 1;
-
-while(<IN>)
-{
-	next unless m/\S/;
-	if(m/continousupdate/)
-	{
-		$ret = 2 unless m/contents/ || m/attributes/;
-	}
-	else
-	{
-		$ret = 2 unless m/\AWARNING/ || m/\ADifferences/ || /might be reason/ || /probably due to file mod/;
-	}
-	print;
-}
-
-close IN;
-
-exit $ret;
-

Copied: box/chris/boxi/test/bbackupd/testfiles/extcheck2.pl.in (from rev 547, box/trunk/test/bbackupd/testfiles/extcheck2.pl.in)

Deleted: box/chris/boxi/test/bbackupd/testfiles/notifyscript.pl
===================================================================
--- box/chris/boxi/test/bbackupd/testfiles/notifyscript.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/bbackupd/testfiles/notifyscript.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,15 +0,0 @@
-#!/usr/bin/perl
-
-
-my $f = 'testfiles/notifyran.'.$ARGV[0].'.';
-my $n = 1;
-
-while(-e $f.$n)
-{
-	$n ++;
-}
-
-open FL,'>'.$f.$n;
-print FL localtime();
-close FL;
-

Copied: box/chris/boxi/test/bbackupd/testfiles/notifyscript.pl.in (from rev 547, box/trunk/test/bbackupd/testfiles/notifyscript.pl.in)

Deleted: box/chris/boxi/test/raidfile/Darwin-SYS.h
===================================================================
--- box/chris/boxi/test/raidfile/Darwin-SYS.h	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/raidfile/Darwin-SYS.h	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,167 +0,0 @@
-
-/* Taken from the Darwin Libc source
-*/
-
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
- * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/* Copyright (c) 1992 NeXT Computer, Inc.  All rights reserved.
- *
- *	File:	SYS.h
- *
- *	Definition of the user side of the UNIX system call interface
- *	for M98K.
- *
- *	Errors are flagged by the location of the trap return (ie., which
- *	instruction is executed upon rfi):
- *
- *		SC PC + 4:	Error (typically branch to cerror())
- *		SC PC + 8:	Success
- *
- * HISTORY
- * 18-Nov-92	Ben Fathi (benf at next.com)
- *	Ported to m98k.
- *
- *  9-Jan-92	Peter King (king at next.com)
- *	Created.
- */
-
-#define KERNEL_PRIVATE	1
-/*
- * Header files.
- */
-#import	<architecture/ppc/asm_help.h>
-#import	<architecture/ppc/pseudo_inst.h>
-#import	<mach/ppc/exception.h>
-#import	<sys/syscall.h>
-
-/* From rhapsody kernel mach/ppc/syscall_sw.h */
-#define	kernel_trap_args_0
-#define	kernel_trap_args_1
-#define	kernel_trap_args_2
-#define	kernel_trap_args_3
-#define	kernel_trap_args_4
-#define	kernel_trap_args_5
-#define	kernel_trap_args_6
-#define	kernel_trap_args_7
-
-/*
- * simple_kernel_trap -- Mach system calls with 8 or less args
- * Args are passed in a0 - a7, system call number in r0.
- * Do a "sc" instruction to enter kernel.
- */	
-#define simple_kernel_trap(trap_name, trap_number)	\
-	.globl	_##trap_name				@\
-_##trap_name:						@\
-	li	r0,trap_number				 @\
-	sc						 @\
-	blr						 @\
-	END(trap_name)
-
-#define kernel_trap_0(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_1(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_2(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_3(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_4(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_5(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_6(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_7(trap_name,trap_number)		 \
-	simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_8(trap_name,trap_number)		 \
-        simple_kernel_trap(trap_name,trap_number)
-
-#define kernel_trap_9(trap_name,trap_number)		 \
-        simple_kernel_trap(trap_name,trap_number)
-
-/* End of rhapsody kernel mach/ppc/syscall_sw.h */
-
-/*
- * Macros.
- */
-
-#define	SYSCALL(name, nargs)			\
-	.globl	cerror				@\
-LEAF(_##name)					@\
-	kernel_trap_args_##nargs		@\
-	li	r0,SYS_##name			@\
-	sc					@\
-	b	1f   				@\
-	b	2f				@\
-1:	BRANCH_EXTERN(cerror)			@\
-.text						\
-2:	nop
-
-#define	SYSCALL_NONAME(name, nargs)		\
-	.globl	cerror				@\
-	kernel_trap_args_##nargs		@\
-	li	r0,SYS_##name			@\
-	sc					@\
-	b	1f   				@\
-	b	2f				@\
-1:	BRANCH_EXTERN(cerror)			@\
-.text						\
-2:	nop
-
-#define	PSEUDO(pseudo, name, nargs)		\
-LEAF(_##pseudo)					@\
-	SYSCALL_NONAME(name, nargs)
-
-
-#undef END
-#import	<mach/ppc/syscall_sw.h>
-
-#if !defined(SYS_getdirentriesattr)
-#define SYS_getdirentriesattr 222
-#endif
-
-#if !defined(SYS_semsys)
-#define SYS_semsys	251
-#define SYS_msgsys	252
-#define SYS_shmsys	253
-#define SYS_semctl	254
-#define SYS_semget	255
-#define SYS_semop	256
-#define SYS_semconfig	257
-#define SYS_msgctl	258
-#define SYS_msgget	259
-#define SYS_msgsnd	260
-#define SYS_msgrcv	261
-#define SYS_shmat	262
-#define SYS_shmctl	263
-#define SYS_shmdt	264
-#define SYS_shmget	265
-#endif
- 

Deleted: box/chris/boxi/test/raidfile/Makefile.extra.Darwin
===================================================================
--- box/chris/boxi/test/raidfile/Makefile.extra.Darwin	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/raidfile/Makefile.extra.Darwin	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,6 +0,0 @@
-
-# link-extra: intercept-lseek.o intercept-close.o intercept-open.o intercept-read.o intercept-readv.o intercept-write.o
-
-$(OUTDIR)/intercept-lseek.o:	make-darwin-intercepts.pl $(OUTDIR)
-	./make-darwin-intercepts.pl $(OUTDIR)
-

Modified: box/chris/boxi/test/raidfile/intercept.cpp
===================================================================
--- box/chris/boxi/test/raidfile/intercept.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/raidfile/intercept.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -162,6 +162,15 @@
 }
 
 extern "C" int
+open64(const char *path, int flags, mode_t mode)
+{
+	// With _FILE_OFFSET_BITS set to 64 this should really use (flags |
+	// O_LARGEFILE) here, but not actually necessary for the tests and not
+	// worth the trouble finding O_LARGEFILE
+	return open(path, flags, mode);
+}
+
+extern "C" int
 close(int d)
 {
 	CHECK_FOR_FAKE_ERROR_COND(d, SIZE_ALWAYS_ERROR, SYS_close, -1);
@@ -245,6 +254,10 @@
 #else
 	#ifdef HAVE_LSEEK_DUMMY_PARAM
 		off_t r = syscall(SYS_lseek, fildes, 0 /* extra 0 required here! */, offset, whence);
+	#elif defined(_FILE_OFFSET_BITS)
+		// Don't bother trying to call SYS__llseek on 32 bit since it is
+		// fiddly and not needed for the tests
+		off_t r = syscall(SYS_lseek, fildes, (uint32_t)offset, whence);
 	#else
 		off_t r = syscall(SYS_lseek, fildes, offset, whence);
 	#endif

Deleted: box/chris/boxi/test/raidfile/make-darwin-intercepts.pl
===================================================================
--- box/chris/boxi/test/raidfile/make-darwin-intercepts.pl	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/raidfile/make-darwin-intercepts.pl	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,46 +0,0 @@
-#!/usr/bin/perl
-use strict;
-
-my $out = $ARGV[0];
-die "No out directory specified" unless $out ne '';
-
-my @calls = split /[\r\n]+/,<<__E;
-lseek SYSCALL_TEST(lseek, 3)
-open SYSCALL_TEST(open, 3)
-close SYSCALL_TEST(close, 1)
-write SYSCALL_TEST(write, 3)
-read SYSCALL_TEST(read, 3)
-readv SYSCALL_TEST(readv, 3)
-__E
-
-for(@calls)
-{
-	my ($name,$line) = split / /,$_,2;
-	
-	open FL,">$out/intercept-$name.s" or die "Can't open out file";
-	print FL <<'__S';
-#include "../../../test/raidfile/Darwin-SYS.h"
-
-#define	SYSCALL_TEST(name, nargs)			\
-	.globl	cerror				@\
-LEAF(_TEST_##name)					@\
-	kernel_trap_args_##nargs		@\
-	li	r0,SYS_##name			@\
-	sc					@\
-	b	1f   				@\
-	b	2f				@\
-1:	BRANCH_EXTERN(cerror)			@\
-.text						\
-2:	nop
-
-__S
-	print FL $line,"\n\tblr\n\n";
-
-	close FL;
-	
-	if(system("gcc -c $out/intercept-$name.s -o $out/intercept-$name.o") != 0)
-	{
-		die "Assembly failed\n";
-	}
-}
-

Copied: box/chris/boxi/test/win32/Makefile (from rev 547, box/trunk/test/win32/Makefile)

Modified: box/chris/boxi/test/win32/testlibwin32.cpp
===================================================================
--- box/chris/boxi/test/win32/testlibwin32.cpp	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/test/win32/testlibwin32.cpp	2006-03-25 09:11:46 UTC (rev 548)
@@ -8,8 +8,8 @@
 
 #include "../../bin/bbackupd/BackupDaemon.h"
 #include "BoxPortsAndFiles.h"
+#include "emu.h"
 
-
 int main(int argc, char* argv[])
 {
 	chdir("c:\\tmp");

Copied: box/chris/boxi/test/win32/timezone.cpp (from rev 547, box/trunk/test/win32/timezone.cpp)

Modified: box/chris/boxi/win32.bat
===================================================================
--- box/chris/boxi/win32.bat	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/win32.bat	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,27 +1,28 @@
+ at echo off
 
-pwd = /usr/src/boxbackup0.08/
+echo quick and dirty to get up and running by generating the required files 
+echo using Cygwin and Perl
 
-# quick and dirty to get up and running by generating the required files 
-# using Cygwin and Perl
+cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl
+cd ..\..\
 
-cd ./bin/bbackupquery/ & perl ./../../bin/bbackupquery/makedocumentation.pl
-cd ../../
-
-cd ./lib/backupclient & perl ./../../lib/common/makeexception.pl BackupStoreException.txt
+cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl BackupStoreException.txt
 perl ./../../lib/server/makeprotocol.pl Client ./../../bin/bbstored/backupprotocol.txt
-cd ../../
+cd ..\..\
 
-cd ./lib/compress & perl ./../../lib/common/makeexception.pl CompressException.txt
-cd ../../
+cd .\lib\compress & perl ./../../lib/common/makeexception.pl CompressException.txt
+cd ..\..\
 
-cd ./lib/common & perl ./../../lib/common/makeexception.pl CommonException.txt & perl ./../../lib/common/makeexception.pl ConversionException.txt
+cd .\lib\common & perl ./../../lib/common/makeexception.pl CommonException.txt & perl ./../../lib/common/makeexception.pl ConversionException.txt
 
-cd ../../
+cd ..\..\
 
-cd ./lib/crypto & perl ./../../lib/common/makeexception.pl CipherException.txt
-cd ../../
+cd .\lib\crypto & perl ./../../lib/common/makeexception.pl CipherException.txt
+cd ..\..\
 
-# server parts - which appears as though some of the clients rely on
+echo server parts - which appears as though some of the clients rely on
 
-cd ./lib/server & perl ./../../lib/common/makeexception.pl ServerException.txt & perl ./../../lib/common/makeexception.pl ConnectionException.txt
-cd ../../
+cd .\lib\server & perl ./../../lib/common/makeexception.pl ServerException.txt & perl ./../../lib/common/makeexception.pl ConnectionException.txt
+cd ..\..\
+
+copy lib\win32\config.h.win32 lib\common\BoxConfig.h

Deleted: box/chris/boxi/win32test.vcproj
===================================================================
--- box/chris/boxi/win32test.vcproj	2006-03-19 10:08:56 UTC (rev 547)
+++ box/chris/boxi/win32test.vcproj	2006-03-25 09:11:46 UTC (rev 548)
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="win32test"
-	ProjectGUID="{28C29E72-76A2-4D0C-B35B-12D446733D2E}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""$(ProjectDir)bin\bbackupd";"$(ProjectDir)..\db-4.2.52.NC\build_win32";"$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\""
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)Debug\common.lib $(ProjectDir)..\db-4.2.52.NC\build_win32\Debug\libdb42d.lib"
-				OutputFile="$(OutDir)/win32test.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/win32test.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			CharacterSet="2"
-			WholeProgramOptimization="TRUE">
-			<Tool
-				Name="VCCLCompilerTool"
-				EnableFiberSafeOptimizations="TRUE"
-				OptimizeForProcessor="1"
-				AdditionalIncludeDirectories=""$(ProjectDir)bin\bbackupd";"$(ProjectDir)lib\backupclient";"$(ProjectDir)lib\server";"$(ProjectDir)lib\crypto";"$(ProjectDir)..\openssl\include";"$(ProjectDir)lib\compress";"$(ProjectDir)..\zlib\include";"$(ProjectDir)lib\win32";"$(ProjectDir)lib\common\""
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;PLATFORM_DISABLE_MEM_LEAK_TESTING"
-				RuntimeLibrary="0"
-				BufferSecurityCheck="FALSE"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib $(ProjectDir)..\zlib\lib\zdll.lib $(ProjectDir)..\openssl\lib\libeay32.lib $(ProjectDir)..\openssl\lib\ssleay32.lib $(ProjectDir)Release\common.lib"
-				OutputFile="$(OutDir)/win32test.exe"
-				LinkIncremental="1"
-				IgnoreDefaultLibraryNames=""
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
-			<File
-				RelativePath=".\lib\win32\emu.cpp">
-			</File>
-			<File
-				RelativePath=".\lib\win32\win32test.cpp">
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>




More information about the Boxbackup-dev mailing list