[Swift-commit] cog r3471

swift at ci.uchicago.edu swift at ci.uchicago.edu
Tue Sep 11 04:35:18 CDT 2012


------------------------------------------------------------------------
r3471 | hategan | 2012-09-11 04:33:52 -0500 (Tue, 11 Sep 2012) | 1 line

updated c coaster client; too many individual things to list
------------------------------------------------------------------------
Index: modules/provider-coaster-c-client/configure.ac
===================================================================
--- modules/provider-coaster-c-client/configure.ac	(revision 3470)
+++ modules/provider-coaster-c-client/configure.ac	(working copy)
@@ -13,13 +13,14 @@
 
 # Checks for programs.
 AC_PROG_CXX
-AC_PROG_AWK
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_PROG_RANLIB
+# AC_PROG_CXX sets these to -g -O2 without asking questions, and there are answers
+CXXFLAGS=
 
 # Checks for header files.
 AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
@@ -35,5 +36,27 @@
 AC_FUNC_MALLOC
 AC_CHECK_FUNCS([gettimeofday memset select socket strerror strrchr])
 
+# debug compilation support
 
-AC_OUTPUT(Makefile src/Makefile)
+AC_MSG_CHECKING([whether to build with debug information])
+AC_ARG_ENABLE([debug],
+    [AS_HELP_STRING([--enable-debug],
+        [enable debugging symbols and disable compiler optimizations (def=no)])],
+    [debugit="$enableval"],
+    [debugit=no])
+AC_MSG_RESULT([$debugit])
+
+if test x"$debugit" = x"yes"; then
+    AC_DEFINE([CONF_DEBUG],[],[Debug Mode])
+    AM_CXXFLAGS="-g3 -O0"
+else
+    AC_DEFINE([CONF_NODEBUG],[],[No-debug Mode])
+    AM_CXXFLAGS="-O2"
+fi
+
+AC_SUBST([AM_CXXFLAGS])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([src/Makefile])
+
+AC_OUTPUT
Index: modules/provider-coaster-c-client/.autotools
===================================================================
--- modules/provider-coaster-c-client/.autotools	(revision 3470)
+++ modules/provider-coaster-c-client/.autotools	(working copy)
@@ -30,6 +30,11 @@
 <option id="program-suffix" value=""/>
 <option id="program-transform-name" value=""/>
 <option id="enable-maintainer-mode" value="false"/>
+<flag id="CFLAGS">
+<flagvalue id="cflags-debug" value="false"/>
+<flagvalue id="cflags-gprof" value="false"/>
+<flagvalue id="cflags-gcov" value="false"/>
+</flag>
 <option id="user" value=""/>
 <option id="autogen" value="autogen.sh"/>
 <option id="autogenOpts" value=""/>
Index: modules/provider-coaster-c-client/.cproject
===================================================================
--- modules/provider-coaster-c-client/.cproject	(revision 3470)
+++ modules/provider-coaster-c-client/.cproject	(working copy)
@@ -15,296 +15,21 @@
 					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
 				</extensions>
 			</storageModule>
-			<storageModule moduleId="scannerConfiguration">
-				<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-				<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="makefileGenerator">
-						<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<profile id="org.eclipse.ptp.rdt.core.RemoteGCCStandardMakePerProjectProfile">
-					<buildOutputProvider>
-						<openAction enabled="true" filePath=""/>
-						<parser enabled="true"/>
-					</buildOutputProvider>
-					<scannerInfoProvider id="specsFile">
-						<runAction arguments="-E -P -v -dD ${specs_file_path}" command="gcc" useDefault="true"/>
-						<parser enabled="true"/>
-					</scannerInfoProvider>
-				</profile>
-				<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.2120212018;cdt.managedbuild.config.gnu.so.debug.2120212018.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.705570784;cdt.managedbuild.tool.gnu.c.compiler.input.83140249">
-					<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
-					<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="makefileGenerator">
-							<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.ptp.rdt.core.RemoteGCCStandardMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${specs_file_path}" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-				</scannerConfigBuildInfo>
-				<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.900885378;cdt.managedbuild.config.gnu.so.release.900885378.;cdt.managedbuild.tool.gnu.c.compiler.so.release.897273566;cdt.managedbuild.tool.gnu.c.compiler.input.1489389094">
-					<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
-					<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="makefileGenerator">
-							<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-					<profile id="org.eclipse.ptp.rdt.core.RemoteGCCStandardMakePerProjectProfile">
-						<buildOutputProvider>
-							<openAction enabled="true" filePath=""/>
-							<parser enabled="true"/>
-						</buildOutputProvider>
-						<scannerInfoProvider id="specsFile">
-							<runAction arguments="-E -P -v -dD ${specs_file_path}" command="gcc" useDefault="true"/>
-							<parser enabled="true"/>
-						</scannerInfoProvider>
-					</profile>
-				</scannerConfigBuildInfo>
-			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
 				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405" name="Build (GNU)" parent="org.eclipse.linuxtools.cdt.autotools.core.configuration.build">
 					<folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405." name="/" resourcePath="">
-						<toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1284732845" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
+						<toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1284732845" name="GNU Autotools Toolchain" resourceTypeBasedDiscovery="true" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
 							<targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.1492195252" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
 							<builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.293319211" keepEnvironmentInBuildfile="false" managedBuildOn="true" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
 							<tool id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.382117173" name="configure" superClass="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure">
-								<option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.1625301134" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405" valueType="string"/>
+								<option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.1625301134" name="Name" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405" valueType="string"/>
 							</tool>
 							<tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen.1994545804" name="autogen.sh" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen"/>
 							<tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1622970238" name="GCC C Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc">
+								<option id="gnu.c.compiler.option.include.paths.1125824836" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+									<listOptionValue builtIn="false" value="/usr/include/c++/4.6.3"/>
+									<listOptionValue builtIn="false" value="/usr/lib/gcc/i686-linux-gnu/4.6.3"/>
+								</option>
 								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.774141483" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
 							</tool>
 							<tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.950725862" name="GCC C++ Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp"/>
@@ -350,6 +75,14 @@
 						<useDefaultCommand>true</useDefaultCommand>
 						<runAllBuilders>false</runAllBuilders>
 					</target>
+					<target name="clean-libtool" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+						<buildCommand>make</buildCommand>
+						<buildArguments/>
+						<buildTarget>clean-libtool</buildTarget>
+						<stopOnError>true</stopOnError>
+						<useDefaultCommand>true</useDefaultCommand>
+						<runAllBuilders>false</runAllBuilders>
+					</target>
 					<target name="ctags" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
 						<buildCommand>make</buildCommand>
 						<buildArguments/>
@@ -462,6 +195,14 @@
 						<useDefaultCommand>true</useDefaultCommand>
 						<runAllBuilders>false</runAllBuilders>
 					</target>
+					<target name="distclean-libtool" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+						<buildCommand>make</buildCommand>
+						<buildArguments/>
+						<buildTarget>distclean-libtool</buildTarget>
+						<stopOnError>true</stopOnError>
+						<useDefaultCommand>true</useDefaultCommand>
+						<runAllBuilders>false</runAllBuilders>
+					</target>
 					<target name="distclean-tags" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
 						<buildCommand>make</buildCommand>
 						<buildArguments/>
@@ -638,6 +379,14 @@
 						<useDefaultCommand>true</useDefaultCommand>
 						<runAllBuilders>false</runAllBuilders>
 					</target>
+					<target name="mostlyclean-libtool" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+						<buildCommand>make</buildCommand>
+						<buildArguments/>
+						<buildTarget>mostlyclean-libtool</buildTarget>
+						<stopOnError>true</stopOnError>
+						<useDefaultCommand>true</useDefaultCommand>
+						<runAllBuilders>false</runAllBuilders>
+					</target>
 					<target name="pdf" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
 						<buildCommand>make</buildCommand>
 						<buildArguments/>
@@ -685,4 +434,186 @@
 	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
 		<project id="provider-coaster-c-client.org.eclipse.linuxtools.cdt.autotools.core.projectType.1749205663" name="GNU Autotools" projectType="org.eclipse.linuxtools.cdt.autotools.core.projectType"/>
 	</storageModule>
+	<storageModule moduleId="refreshScope" versionNumber="1">
+		<resource resourceType="PROJECT" workspacePath="/provider-coaster-c-client"/>
+	</storageModule>
+	<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+	<storageModule moduleId="org.eclipse.cdt.core.language.mapping">
+		<project-mappings>
+			<content-type-mapping configuration="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405" content-type="org.eclipse.cdt.core.cxxHeader" language="org.eclipse.cdt.core.g++"/>
+			<content-type-mapping configuration="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405" content-type="org.eclipse.cdt.core.cxxSource" language="org.eclipse.cdt.core.g++"/>
+		</project-mappings>
+	</storageModule>
+	<storageModule moduleId="scannerConfiguration">
+		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+		<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+			<buildOutputProvider>
+				<openAction enabled="true" filePath=""/>
+				<parser enabled="true"/>
+			</buildOutputProvider>
+			<scannerInfoProvider id="specsFile">
+				<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+				<parser enabled="true"/>
+			</scannerInfoProvider>
+		</profile>
+		<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+			<buildOutputProvider>
+				<openAction enabled="true" filePath=""/>
+				<parser enabled="true"/>
+			</buildOutputProvider>
+			<scannerInfoProvider id="specsFile">
+				<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+				<parser enabled="true"/>
+			</scannerInfoProvider>
+		</profile>
+		<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+			<buildOutputProvider>
+				<openAction enabled="true" filePath=""/>
+				<parser enabled="true"/>
+			</buildOutputProvider>
+			<scannerInfoProvider id="specsFile">
+				<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+				<parser enabled="true"/>
+			</scannerInfoProvider>
+		</profile>
+		<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+			<buildOutputProvider>
+				<openAction enabled="true" filePath=""/>
+				<parser enabled="true"/>
+			</buildOutputProvider>
+			<scannerInfoProvider id="specsFile">
+				<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+				<parser enabled="true"/>
+			</scannerInfoProvider>
+		</profile>
+		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.debug.2120212018;cdt.managedbuild.config.gnu.so.debug.2120212018.;cdt.managedbuild.tool.gnu.c.compiler.so.debug.705570784;cdt.managedbuild.tool.gnu.c.compiler.input.83140249">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+			<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+		</scannerConfigBuildInfo>
+		<scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405;org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1741424405.;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1622970238;cdt.managedbuild.tool.gnu.c.compiler.input.774141483">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+			<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="g++" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+		</scannerConfigBuildInfo>
+		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.so.release.900885378;cdt.managedbuild.config.gnu.so.release.900885378.;cdt.managedbuild.tool.gnu.c.compiler.so.release.897273566;cdt.managedbuild.tool.gnu.c.compiler.input.1489389094">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+			<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+			<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+				<buildOutputProvider>
+					<openAction enabled="true" filePath=""/>
+					<parser enabled="true"/>
+				</buildOutputProvider>
+				<scannerInfoProvider id="specsFile">
+					<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+					<parser enabled="true"/>
+				</scannerInfoProvider>
+			</profile>
+		</scannerConfigBuildInfo>
+	</storageModule>
 </cproject>
Index: modules/provider-coaster-c-client/src/ChannelConfigurationCommand.cpp
===================================================================
--- modules/provider-coaster-c-client/src/ChannelConfigurationCommand.cpp	(revision 0)
+++ modules/provider-coaster-c-client/src/ChannelConfigurationCommand.cpp	(revision 3471)
@@ -0,0 +1,34 @@
+#include "ChannelConfigurationCommand.h"
+#include <sstream>
+#include "Logger.h"
+
+using namespace std;
+
+string ChannelConfigurationCommand::NAME("CHANNELCONFIG");
+
+static int seq = 1;
+
+ChannelConfigurationCommand::ChannelConfigurationCommand(): Command(&NAME) {
+	stringstream ss;
+	ss << "channel-";
+	ss << seq++;
+	localId = ss.str();
+}
+
+void ChannelConfigurationCommand::send(CoasterChannel* channel, CommandCallback* cb) {
+	serialize();
+	Command::send(channel, cb);
+}
+
+void ChannelConfigurationCommand::serialize() {
+	addOutData(Buffer::wrap("keepalive(-1)"));
+	addOutData(Buffer::wrap("")); // callback URL
+	addOutData(Buffer::copy(localId));
+	addOutData(Buffer::wrap("")); // remoteId
+}
+
+void ChannelConfigurationCommand::replyReceived() {
+	remoteId.append(*getInData()->at(0)->str());
+	LogInfo << "Channel id: " << localId << "-" << remoteId << endl;
+	Command::replyReceived();
+}
Index: modules/provider-coaster-c-client/src/CmdCBCV.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CmdCBCV.cpp	(revision 0)
+++ modules/provider-coaster-c-client/src/CmdCBCV.cpp	(revision 3471)
@@ -0,0 +1,30 @@
+/*
+ * CmdCBCV.cpp
+ *
+ *  Created on: Sep 9, 2012
+ *      Author: mike
+ */
+
+#include "CmdCBCV.h"
+
+CmdCBCV::CmdCBCV() {
+	done = false;
+}
+
+CmdCBCV::~CmdCBCV() {
+}
+
+void CmdCBCV::errorReceived(Command* cmd, string* message, RemoteCoasterException* details) {
+	replyReceived(cmd);
+}
+
+void CmdCBCV::replyReceived(Command* cmd) { Lock::Scoped l(lock);
+	done = true;
+	cv.broadcast();
+}
+
+void CmdCBCV::wait() { Lock::Scoped l(lock);
+	while(!done) {
+		cv.wait(lock);
+	}
+}
Index: modules/provider-coaster-c-client/src/Settings.h
===================================================================
--- modules/provider-coaster-c-client/src/Settings.h	(revision 0)
+++ modules/provider-coaster-c-client/src/Settings.h	(revision 3471)
@@ -0,0 +1,72 @@
+/*
+ * ServiceSettings.h
+ *
+ *  Created on: Sep 9, 2012
+ *      Author: mike
+ */
+
+#ifndef SETTINGS_H_
+#define SETTINGS_H_
+
+#include <string>
+#include <map>
+#include <iostream>
+
+using namespace std;
+
+class Settings {
+	private:
+		map<string*, const char*> settings;
+	public:
+		Settings();
+		virtual ~Settings();
+		void set(string& key, string& value);
+		void set(string& key, const char* value);
+		void remove(string& key);
+		map<string*, const char*>* getSettings();
+
+		template<typename cls> friend cls& operator<< (cls& os, Settings& s);
+
+		class Key {
+			public:
+				static string SLOTS;
+				static string JOBS_PER_NODE;
+				static string NODE_GRANULARITY;
+				static string ALLOCATION_STEP_SIZE;
+				static string MAX_NODES;
+				static string LOW_OVERALLOCATION;
+				static string HIGH_OVERALLOCATION;
+				static string OVERALLOCATION_DECAY_FACTOR;
+				static string SPREAD;
+				static string RESERVE;
+				static string MAXTIME;
+				static string REMOTE_MONITOR_ENABLED;
+				static string INTERNAL_HOSTNAME;
+				static string WORKER_MANAGER;
+				static string WORKER_LOGGING_LEVEL;
+				static string WORKER_LOGGING_DIRECTORY;
+				static string LD_LIBRARY_PATH;
+				static string WORKER_COPIES;
+				static string DIRECTORY;
+				static string USE_HASH_BANG;
+				static string PARALLELISM;
+				static string CORES_PER_NODE;
+		};
+};
+
+template<typename cls> cls& operator<< (cls& os, Settings& s) {
+	os << "Settings(";
+	map<string*, const char*>* m = s.getSettings();
+	map<string*, const char*>::iterator i;
+
+	for (i = m->begin(); i != m->end(); i++) {
+		os << i->first << ": " << i->second;
+		if (i != --m->end()) {
+			os << ", ";
+		}
+	}
+	os << ")";
+	return os;
+}
+
+#endif /* SETTINGS_H_ */
Index: modules/provider-coaster-c-client/src/ServiceConfigurationCommand.h
===================================================================
--- modules/provider-coaster-c-client/src/ServiceConfigurationCommand.h	(revision 0)
+++ modules/provider-coaster-c-client/src/ServiceConfigurationCommand.h	(revision 3471)
@@ -0,0 +1,23 @@
+#ifndef SERVICE_CONFIGURATION_COMMAND_H_
+#define SERVICE_CONFIGURATION_COMMAND_H_
+
+#include "Command.h"
+#include "CommandCallback.h"
+#include <string>
+#include "Buffer.h"
+#include "Settings.h"
+
+using namespace std;
+
+class ServiceConfigurationCommand: public Command {
+	private:
+		Settings* settings;
+	public:
+		static string NAME;
+		ServiceConfigurationCommand(Settings& s);
+		virtual void send(CoasterChannel* channel, CommandCallback* cb);
+	private:
+		void serialize();
+};
+
+#endif
Index: modules/provider-coaster-c-client/src/Settings.cpp
===================================================================
--- modules/provider-coaster-c-client/src/Settings.cpp	(revision 0)
+++ modules/provider-coaster-c-client/src/Settings.cpp	(revision 3471)
@@ -0,0 +1,53 @@
+/*
+ * ServiceSettings.cpp
+ *
+ *  Created on: Sep 9, 2012
+ *      Author: mike
+ */
+
+#include "Settings.h"
+
+string Settings::Key::SLOTS = "slots";
+string Settings::Key::JOBS_PER_NODE = "jobsPerNode";
+string Settings::Key::NODE_GRANULARITY = "nodeGranularity";
+string Settings::Key::ALLOCATION_STEP_SIZE = "allocationStepSize";
+string Settings::Key::MAX_NODES = "maxNodes";
+string Settings::Key::LOW_OVERALLOCATION = "lowOverallocation";
+string Settings::Key::HIGH_OVERALLOCATION = "highOverallocation";
+string Settings::Key::OVERALLOCATION_DECAY_FACTOR = "overallocationDecayFactor";
+string Settings::Key::SPREAD = "spread";
+string Settings::Key::RESERVE = "reserve";
+string Settings::Key::MAXTIME = "maxtime";
+string Settings::Key::REMOTE_MONITOR_ENABLED = "remoteMonitorEnabled";
+string Settings::Key::INTERNAL_HOSTNAME = "internalHostname";
+string Settings::Key::WORKER_MANAGER = "workerManager";
+string Settings::Key::WORKER_LOGGING_LEVEL = "workerLoggingLevel";
+string Settings::Key::WORKER_LOGGING_DIRECTORY = "workerLoggingDirectory";
+string Settings::Key::LD_LIBRARY_PATH = "ldLibraryPath";
+string Settings::Key::WORKER_COPIES = "workerCopies";
+string Settings::Key::DIRECTORY = "directory";
+string Settings::Key::USE_HASH_BANG = "useHashBang";
+string Settings::Key::PARALLELISM = "parallelism";
+string Settings::Key::CORES_PER_NODE = "coresPerNode";
+
+Settings::Settings() {
+}
+
+Settings::~Settings() {
+}
+
+void Settings::set(string& key, string& value) {
+	settings[&key] = value.c_str();
+}
+
+void Settings::set(string& key, const char* value) {
+	settings[&key] = value;
+}
+
+void Settings::remove(string& key) {
+	settings.erase(&key);
+}
+
+map<string*, const char*>* Settings::getSettings() {
+	return &settings;
+}
Index: modules/provider-coaster-c-client/src/RemoteCoasterException.h
===================================================================
--- modules/provider-coaster-c-client/src/RemoteCoasterException.h	(revision 0)
+++ modules/provider-coaster-c-client/src/RemoteCoasterException.h	(revision 3471)
@@ -0,0 +1,25 @@
+/*
+ * RemoteCoasterException.h
+ *
+ *  Created on: Sep 11, 2012
+ *      Author: mike
+ */
+
+#ifndef REMOTECOASTEREXCEPTION_H_
+#define REMOTECOASTEREXCEPTION_H_
+
+#include <string>
+
+using namespace std;
+
+class RemoteCoasterException {
+	private:
+		string* className;
+		string data;
+	public:
+		RemoteCoasterException(const char* data, int len);
+		virtual ~RemoteCoasterException();
+		string& str();
+};
+
+#endif /* REMOTECOASTEREXCEPTION_H_ */
Index: modules/provider-coaster-c-client/src/ChannelConfigurationCommand.h
===================================================================
--- modules/provider-coaster-c-client/src/ChannelConfigurationCommand.h	(revision 0)
+++ modules/provider-coaster-c-client/src/ChannelConfigurationCommand.h	(revision 3471)
@@ -0,0 +1,24 @@
+#ifndef CHANNEL_CONFIGURATION_COMMAND_H_
+#define CHANNEL_CONFIGURATION_COMMAND_H_
+
+#include "Command.h"
+#include "CommandCallback.h"
+#include <string>
+#include "Buffer.h"
+
+using namespace std;
+
+class ChannelConfigurationCommand: public Command {
+	private:
+		string localId;
+		string remoteId;
+	public:
+		static string NAME;
+		ChannelConfigurationCommand();
+		virtual void send(CoasterChannel* channel, CommandCallback* cb);
+		virtual void replyReceived();
+	private:
+		void serialize();
+};
+
+#endif
Index: modules/provider-coaster-c-client/src/CmdCBCV.h
===================================================================
--- modules/provider-coaster-c-client/src/CmdCBCV.h	(revision 0)
+++ modules/provider-coaster-c-client/src/CmdCBCV.h	(revision 3471)
@@ -0,0 +1,29 @@
+/*
+ * CmdCBCV.h
+ *
+ *  Created on: Sep 9, 2012
+ *      Author: mike
+ */
+
+#ifndef CMDCBCV_H_
+#define CMDCBCV_H_
+
+#include "CommandCallback.h"
+#include "Lock.h"
+#include "ConditionVariable.h"
+#include "RemoteCoasterException.h"
+
+class CmdCBCV: public CommandCallback {
+	private:
+		bool done;
+		ConditionVariable cv;
+		Lock lock;
+	public:
+		CmdCBCV();
+		virtual ~CmdCBCV();
+		virtual void errorReceived(Command* cmd, string* message, RemoteCoasterException* details);
+		virtual void replyReceived(Command* cmd);
+		void wait();
+};
+
+#endif /* CMDCBCV_H_ */
Index: modules/provider-coaster-c-client/src/ServiceConfigurationCommand.cpp
===================================================================
--- modules/provider-coaster-c-client/src/ServiceConfigurationCommand.cpp	(revision 0)
+++ modules/provider-coaster-c-client/src/ServiceConfigurationCommand.cpp	(revision 3471)
@@ -0,0 +1,28 @@
+#include "ServiceConfigurationCommand.h"
+#include <map>
+
+using namespace std;
+
+string ServiceConfigurationCommand::NAME("CONFIGSERVICE");
+
+ServiceConfigurationCommand::ServiceConfigurationCommand(Settings& s): Command(&NAME) {
+	settings = &s;
+}
+
+void ServiceConfigurationCommand::send(CoasterChannel* channel, CommandCallback* cb) {
+	serialize();
+	Command::send(channel, cb);
+}
+
+void ServiceConfigurationCommand::serialize() {
+	map<string*, const char*>::iterator i;
+	map<string*, const char*>* m = settings->getSettings();
+
+	for (i = m->begin(); i != m->end(); i++) {
+		string ss;
+		ss.append(*(i->first));
+		ss.append("=");
+		ss.append(i->second);
+		addOutData(Buffer::copy(ss));
+	}
+}
Index: modules/provider-coaster-c-client/src/RemoteCoasterException.cpp
===================================================================
--- modules/provider-coaster-c-client/src/RemoteCoasterException.cpp	(revision 0)
+++ modules/provider-coaster-c-client/src/RemoteCoasterException.cpp	(revision 3471)
@@ -0,0 +1,80 @@
+/*
+ * RemoteCoasterException.cpp
+ *
+ *  Created on: Sep 11, 2012
+ *      Author: mike
+ */
+
+#include "RemoteCoasterException.h"
+#include <stdio.h>
+#include <iostream>
+
+void expect(const char* s, int len, int& ptr, const char* e);
+void skip(const char* s, int len, int& ptr, int n);
+int getShort(const char* s, int len, int& ptr);
+string* getString(const char* s, int len, int& ptr, int n);
+
+RemoteCoasterException::RemoteCoasterException(const char* data, int len) {
+	/*int cnt = 1;
+	char t[8];
+	for (int i = 0; i < len; i++) {
+		snprintf(t, 7, "%02hhx", data[i]);
+		cout << t << " ";
+		if ((cnt % 16) == 0) {
+			cout << endl;
+		}
+		cnt++;
+	}
+	cout << endl;*/
+	try {
+		int ptr = 0;
+		expect(data, len, ptr, "\xac\xed"); // magic
+		skip(data, len, ptr, 2);
+		expect(data, len, ptr, "\x73"); // new object
+		expect(data, len, ptr, "\x72"); // new cls desc
+		int clsNameLen = getShort(data, len, ptr);
+		className = getString(data, len, ptr, clsNameLen);
+		skip(data, len, ptr, 8); // serial version UID
+		skip(data, len, ptr, 1); // flags
+		// ....
+		this->data.append(*className);
+	}
+	catch (...) {
+		this->data.append("<unparsed data>");
+	}
+}
+
+RemoteCoasterException::~RemoteCoasterException() {
+	delete className;
+}
+
+string& RemoteCoasterException::str() {
+	return data;
+}
+
+void expect(const char* s, int len, int& ptr, const char* e) {
+	while (*e) {
+		if (s[ptr] != *e) {
+			throw exception();
+		}
+		ptr++;
+		e++;
+	}
+}
+
+void skip(const char* s, int len, int& ptr, int n) {
+	ptr += n;
+}
+
+int getShort(const char* s, int len, int& ptr) {
+	int v = (s[ptr] << 8) + s[ptr + 1];
+	ptr += 2;
+	return v;
+}
+
+string* getString(const char* s, int len, int& ptr, int n) {
+	string* ss = new string(&(s[ptr]), n);
+	ptr += len;
+	return ss;
+}
+
Index: modules/provider-coaster-c-client/src/CoasterChannel.h
===================================================================
--- modules/provider-coaster-c-client/src/CoasterChannel.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/CoasterChannel.h	(working copy)
@@ -10,9 +10,8 @@
 
 #define HEADER_LENGTH 20
 
-#define READ_STATE_IDLE 0
-#define READ_STATE_HDR 1
-#define READ_STATE_DATA 2
+#define READ_STATE_HDR 0
+#define READ_STATE_DATA 1
 
 #include <map>
 #include <list>
@@ -29,6 +28,7 @@
 #include "Lock.h"
 #include "Buffer.h"
 #include "Logger.h"
+#include "RemoteCoasterException.h"
 
 using namespace std;
 
@@ -62,7 +62,7 @@
 		int sockFD;
 		bool connected;
 
-		DataChunk whdr, rhdr, msg;
+		DataChunk rhdr, msg;
 		int rtag, rflags, rlen;
 
 		int tagSeq;
@@ -72,7 +72,7 @@
 		CoasterClient* client;
 		Lock writeLock;
 
-		void makeHeader(int tag, Buffer* buf, int flags);
+		DataChunk* makeHeader(int tag, Buffer* buf, int flags);
 		void decodeHeader(int* tag, int* flags, int* len);
 		void dispatchData();
 		void dispatchRequest();
@@ -103,13 +103,19 @@
 		void send(int tag, Buffer* buf, int flags, ChannelCallback* cb);
 
 		CoasterClient* getClient();
+		string& getURL();
 
 		void checkHeartbeat();
 
-		friend ostream& operator<< (ostream& os, CoasterChannel* channel);
+		template<typename cls> friend cls& operator<< (cls& os, CoasterChannel* channel);
 
-		void errorReceived(Command* cmd, string* message, string* details);
+		void errorReceived(Command* cmd, string* message, RemoteCoasterException* details);
 		void replyReceived(Command* cmd);
 };
 
+template<typename cls> cls& operator<< (cls& os, CoasterChannel* channel) {
+	os << "Channel[" << channel->getURL() << "]";
+	return os;
+}
+
 #endif /* COASTER_CHANNEL_H_ */
Index: modules/provider-coaster-c-client/src/CoasterClient.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterClient.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/CoasterClient.cpp	(working copy)
@@ -7,6 +7,8 @@
 
 #include "CoasterClient.h"
 #include "JobSubmitCommand.h"
+#include "ServiceConfigurationCommand.h"
+#include "ChannelConfigurationCommand.h"
 #include "CoasterError.h"
 #include <stdlib.h>
 #include <string.h>
@@ -15,16 +17,25 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include "ClientHandlerFactory.h"
 
 #include "Logger.h"
 
-CoasterClient::CoasterClient(string URLp, CoasterLoop& ploop) {
-	URL = URLp;
+CoasterClient::CoasterClient(string URL, CoasterLoop& ploop) {
+	this->URL = URL;
+	hostName = NULL;
 	sockFD = 0;
 	loop = &ploop;
 	started = false;
+	handlerFactory = new ClientHandlerFactory;
 }
 
+CoasterClient::~CoasterClient() {
+	stop();
+}
+
 void CoasterClient::start() {
 	if (started) {
 		return;
@@ -71,11 +82,22 @@
 		}
 	}
 
+	// configure non-blocking
+	int flags = fcntl(sockFD, F_GETFL);
+	if (flags & O_NONBLOCK == 0) {
+		if (fcntl(sockFD, F_SETFL, flags | O_NONBLOCK) < 0) {
+			throw CoasterError("Failed to configure socket for non-blocking operations: %s", strerror(errno));
+		}
+	}
+
 	channel = new CoasterChannel(this, loop, handlerFactory);
 	channel->setSockFD(sockFD);
 	channel->start();
 	loop->addChannel(channel);
 
+	ChannelConfigurationCommand ccc;
+	ccc.execute(channel);
+
 	LogInfo << "Done" << endl;
 
 	started = true;
@@ -99,6 +121,12 @@
 	started = false;
 }
 
+void CoasterClient::setOptions(Settings& s) {
+	LogInfo << "Setting options: " << s << endl;
+	ServiceConfigurationCommand scc(s);
+	scc.execute(channel);
+}
+
 void CoasterClient::submit(Job& job) {
 	{ Lock::Scoped l(lock);
 		jobs[&job.getIdentity()] = &job;
@@ -107,9 +135,10 @@
 	sjc->send(channel, this);
 }
 
-void CoasterClient::errorReceived(Command* cmd, string* message, string* details) {
+void CoasterClient::errorReceived(Command* cmd, string* message, RemoteCoasterException* details) {
 	if (*(cmd->getName()) == JobSubmitCommand::NAME) {
 		JobSubmitCommand* jsc = static_cast<JobSubmitCommand*>(cmd);
+		LogInfo << "Job " << jsc->getJob()->getIdentity() << " failed: " << message << "\n" << details->str() << endl;
 		updateJobStatus(jsc->getJob()->getIdentity(), new JobStatus(FAILED, message, details));
 	}
 	else {
@@ -129,20 +158,25 @@
 void CoasterClient::replyReceived(Command* cmd) {
 	if (*(cmd->getName()) == JobSubmitCommand::NAME) {
 		JobSubmitCommand* jsc = static_cast<JobSubmitCommand*>(cmd);
+		string* remoteId = jsc->getRemoteId();
+		LogInfo << "Job " << jsc->getJob()->getIdentity() << " submitted; remoteId: " << remoteId << endl;
+		remoteJobIdMapping[*remoteId] = &jsc->getJob()->getIdentity();
 		updateJobStatus(jsc->getJob()->getIdentity(), new JobStatus(SUBMITTED));
 	}
 	delete cmd;
 }
 
-void CoasterClient::updateJobStatus(string& jobId, JobStatus* status) { Lock::Scoped l(lock);
-	if (jobs.count(&jobId) == 0) {
-		LogWarn << "Received job status notification for unknown job (" << jobId << "): " << status << endl;
+void CoasterClient::updateJobStatus(string& remoteJobId, JobStatus* status) { Lock::Scoped l(lock);
+	if (remoteJobIdMapping.count(remoteJobId) == 0) {
+		LogWarn << "Received job status notification for unknown job (" << remoteJobId << "): " << status << endl;
 	}
 	else {
-		Job* job = jobs[&jobId];
+		const string* jobId = remoteJobIdMapping[remoteJobId];
+		Job* job = jobs[jobId];
 		job->setStatus(status);
 		if (status->isTerminal()) {
-			jobs.erase(&jobId);
+			remoteJobIdMapping.erase(remoteJobId);
+			jobs.erase(jobId);
 			doneJobs.push_back(job);
 			cv.broadcast();
 		}
@@ -158,20 +192,24 @@
 		return 1984;
 	}
 	else {
-		return atoi(URL.substr(index).c_str());
+		const char* sport = URL.substr(index + 1).c_str();
+		return atoi(sport);
 	}
 }
 
-string CoasterClient::getHostName() {
+string& CoasterClient::getHostName() {
 	size_t index;
 
-	index = URL.find(':');
-	if (index == string::npos) {
-		return URL;
+	if (hostName == NULL) {
+		index = URL.find(':');
+		if (index == string::npos) {
+			hostName = &URL;
+		}
+		else {
+			hostName = new string(URL.substr(0, index));
+		}
 	}
-	else {
-		return URL.substr(0, index);
-	}
+	return *hostName;
 }
 
 struct addrinfo* CoasterClient::resolve(const char* hostName, int port) {
Index: modules/provider-coaster-c-client/src/CoasterClientTest.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterClientTest.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/CoasterClientTest.cpp	(working copy)
@@ -1,22 +1,29 @@
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <list>
 
 #include "CoasterLoop.h"
 #include "CoasterClient.h"
 #include "Job.h"
+#include "Settings.h"
 
 using namespace std;
 
 int main(void) {
 	try {
-		CoasterLoop loop = CoasterLoop();
+		CoasterLoop loop;
 		loop.start();
 
 		CoasterClient client("localhost:1984", loop);
 		client.start();
 
+		Settings s;
+		s.set(Settings::Key::SLOTS, "1");
+		s.set(Settings::Key::MAX_NODES, "1");
+		s.set(Settings::Key::JOBS_PER_NODE, "2");
+
+		client.setOptions(s);
+
 		Job j1("/bin/date");
 		Job j2("/bin/echo");
 		j2.addArgument("testing");
@@ -29,10 +36,14 @@
 		client.waitForJob(j2);
 		list<Job*>* doneJobs = client.getAndPurgeDoneJobs();
 
-		printf("All done\n");
+		if (j1.getStatus()->getStatusCode() == FAILED) {
+			cerr << "Job 1 failed: " << *j1.getStatus()->getMessage() << endl;
+		}
+		if (j2.getStatus()->getStatusCode() == FAILED) {
+			cerr << "Job 2 failed: " << *j2.getStatus()->getMessage() << endl;
+		}
 
-		client.stop();
-		loop.stop();
+		cout << "All done" << endl;
 
 		return EXIT_SUCCESS;
 	}
Index: modules/provider-coaster-c-client/src/CoasterLoop.h
===================================================================
--- modules/provider-coaster-c-client/src/CoasterLoop.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/CoasterLoop.h	(working copy)
@@ -36,9 +36,10 @@
 		fd_set rfds, wfds;
 		int socketCount;
 		int maxFD;
+		int writesPending;
 
 		void updateMaxFD();
-		void acknowledgeWake();
+		void acknowledgeWriteRequest(int count);
 
 		time_t lastHeartbeatCheck;
 	public:
@@ -55,7 +56,7 @@
 		void removeChannel(CoasterChannel* channel);
 		void addSockets();
 		void removeSockets();
-		void awake();
+		void requestWrite(int count);
 		fd_set* getReadFDs();
 		fd_set* getWriteFDs();
 		int getMaxFD();
@@ -63,7 +64,7 @@
 		void writeSockets(fd_set* fds);
 		int getWakePipeReadFD();
 
-		void requestWrite(CoasterChannel* channel);
+		void requestWrite(CoasterChannel* channel, int count);
 
 		void checkHeartbeats();
 };
Index: modules/provider-coaster-c-client/src/RequestReply.cpp
===================================================================
--- modules/provider-coaster-c-client/src/RequestReply.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/RequestReply.cpp	(working copy)
@@ -14,19 +14,27 @@
 
 RequestReply::RequestReply() {
 	channel = NULL;
+	errorData = NULL;
 }
 
 RequestReply::~RequestReply() {
-	clearBufferVector(inData);
-	clearBufferVector(outData);
-	clearBufferVector(*errorData);
+	clearBufferVector(&inData);
+	while (outData.size() > 0) {
+		delete outData.front();
+		outData.pop_front();
+	}
+	clearBufferVector(errorData);
 	delete errorData;
 }
 
-void RequestReply::clearBufferVector(vector<Buffer*>& v) {
+void RequestReply::clearBufferVector(vector<Buffer*>* v) {
+	if (v == NULL) {
+		return;
+	}
+
 	vector<Buffer*>::iterator i;
 
-	for (i = v.begin(); i != v.end(); i++) {
+	for (i = v->begin(); i != v->end(); i++) {
 		delete *i;
 	}
 }
@@ -75,7 +83,7 @@
 	errorData->push_back(buf);
 }
 
-vector<Buffer*>* RequestReply::getOutData() {
+list<Buffer*>* RequestReply::getOutData() {
 	return &outData;
 }
 
@@ -88,7 +96,7 @@
 }
 
 void RequestReply::dataReceived(Buffer* buf, int flags) {
-	if (flags & FLAG_ERROR != 0) {
+	if (flags & FLAG_ERROR) {
 		addErrorData(buf);
 	}
 	else {
Index: modules/provider-coaster-c-client/src/HandlerFactory.h
===================================================================
--- modules/provider-coaster-c-client/src/HandlerFactory.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/HandlerFactory.h	(working copy)
@@ -27,4 +27,11 @@
 		Handler* newInstance(const string* name);
 };
 
+template<typename T> Handler * newHandler() { return new T; }
+
+template<typename T> void HandlerFactory::addHandler(string name) {
+	creators[name] = &newHandler<T>;
+}
+
+
 #endif /* HANDLERFACTORY_H_ */
Index: modules/provider-coaster-c-client/src/JobStatus.cpp
===================================================================
--- modules/provider-coaster-c-client/src/JobStatus.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/JobStatus.cpp	(working copy)
@@ -9,34 +9,39 @@
 #include <time.h>
 #include "JobStatus.h"
 
-JobStatus::JobStatus(JobStatusCode pstatusCode, time_t ptime, const string* pmessage, const string* pexception) {
-	statusCode = pstatusCode;
-	stime = ptime;
+void JobStatus::init(JobStatusCode statusCode, time_t time, const string* message, RemoteCoasterException* exception) {
+	this->statusCode = statusCode;
+	this->stime = time;
 	// always copy strings because the job status' lifetime is weird
-	if (pmessage != NULL) {
-		message = new string(*pmessage);
+	if (message != NULL) {
+		this->message = new string(*message);
 	}
 	else {
-		message = NULL;
+		this->message = NULL;
 	}
-	if (pexception != NULL) {
-		exception = new string(*pexception);
+	if (exception != NULL) {
+		this->exception = exception;
 	}
 	else {
-		exception = NULL;
+		this->exception = NULL;
 	}
+	prev = NULL;
 }
 
-JobStatus::JobStatus(JobStatusCode pstatusCode, const string* pmessage, const string* pexception) {
-	JobStatus(pstatusCode, time(NULL), pmessage, pexception);
+JobStatus::JobStatus(JobStatusCode statusCode, time_t time, const string* message, RemoteCoasterException* exception) {
+	init(statusCode, time, message, exception);
 }
 
-JobStatus::JobStatus(JobStatusCode pstatusCode) {
-	JobStatus(pstatusCode, NULL, NULL);
+JobStatus::JobStatus(JobStatusCode statusCode, const string* message, RemoteCoasterException* exception) {
+	 init(statusCode, time(NULL), message, exception);
 }
 
+JobStatus::JobStatus(JobStatusCode statusCode) {
+	init(statusCode, time(NULL), NULL, NULL);
+}
+
 JobStatus::JobStatus() {
-	JobStatus(UNSUBMITTED);
+	init(UNSUBMITTED, time(NULL), NULL, NULL);
 }
 
 JobStatusCode JobStatus::getStatusCode() {
@@ -51,7 +56,7 @@
 	return message;
 }
 
-string* JobStatus::getException() {
+RemoteCoasterException* JobStatus::getException() {
 	return exception;
 }
 
@@ -73,7 +78,7 @@
 	}
 }
 
-static const char* statusCodeToStr(JobStatusCode code) {
+const char* statusCodeToStr(JobStatusCode code) {
 	switch (code) {
 		case UNSUBMITTED: return "UNSUBMITTED";
 		case SUBMITTING: return "SUBMITTING";
@@ -89,17 +94,3 @@
 		default: return "UNKNWON";
 	}
 }
-
-ostream& operator<< (ostream& os, JobStatus& s) {
-	return os << &s;
-}
-
-ostream& operator<< (ostream& os, JobStatus* s) {
-	os << "Status(" << statusCodeToStr(s->getStatusCode());
-	if (s->getMessage()->length() != 0) {
-		os << ", msg: " << s->getMessage();
-	}
-	os << ")";
-	return os;
-}
-
Index: modules/provider-coaster-c-client/src/Buffer.h
===================================================================
--- modules/provider-coaster-c-client/src/Buffer.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/Buffer.h	(working copy)
@@ -38,6 +38,9 @@
 		static Buffer* wrap(const char* buf, int len);
 		static Buffer* wrap(string s);
 		static Buffer* wrap(const string* s);
+		static Buffer* copy(string& s);
+
+		template<typename cls> friend cls& operator<< (cls& os, Buffer& buf);
 };
 
 class StaticBuffer: public Buffer {
@@ -60,8 +63,6 @@
 
 		virtual const char* getData();
 		virtual char* getModifiableData();
-
-		friend ostream& operator<< (ostream& os, Buffer& buf);
 };
 
 #endif /* BUFFER_H_ */
Index: modules/provider-coaster-c-client/src/Logger.cpp
===================================================================
--- modules/provider-coaster-c-client/src/Logger.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/Logger.cpp	(working copy)
@@ -13,7 +13,7 @@
 Logger::Logger(ostream& pout) {
 	out = &pout;
 	level = NONE;
-	setFile("<unknown>");
+	file = "<unknown>";
 	startOfItem = true;
 }
 
@@ -47,7 +47,7 @@
 	}
 }
 
-Logger& Logger::operator<< (string str) {
+Logger& Logger::operator<< (string& str) {
 	header();
 	*out << str;
 	return *this;
@@ -65,12 +65,26 @@
 	return *this;
 }
 
+Logger& Logger::operator<< (int i) {
+	header();
+	*out << i;
+	return *this;
+}
+
+Logger& Logger::operator<< (long l) {
+	header();
+	*out << l;
+	return *this;
+}
+
 Logger& Logger::operator<< (Logger& ( *pf )(Logger&)) {
 	(*pf)(*this);
 	return *this;
 }
 
 Logger& Logger::setFile(const char* pfile) {
+     lock.lock();
+     cout << '['; cout.flush();
 	 file = strrchr(pfile, '/');
 	 if (file == NULL) {
 		 file = pfile;
@@ -92,8 +106,11 @@
 }
 
 void Logger::endItem() {
+	cout << ']';
+	*out << '\n';
 	out->flush();
 	startOfItem = true;
+	lock.unlock();
 }
 
 char* Logger::timeStamp() {
@@ -118,7 +135,6 @@
 }
 
 Logger& endl(Logger& l) {
-	l << "\n";
 	l.endItem();
 	return l;
 }
Index: modules/provider-coaster-c-client/src/Command.h
===================================================================
--- modules/provider-coaster-c-client/src/Command.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/Command.h	(working copy)
@@ -13,17 +13,21 @@
 #include "RequestReply.h"
 #include "CoasterChannel.h"
 #include "Flags.h"
+#include "ConditionVariable.h"
 #include "CommandCallback.h"
+#include "RemoteCoasterException.h"
 
 using namespace std;
 
 class CoasterChannel;
 class CommandCallback;
 
+
 class Command: public RequestReply {
 	private:
 		const string* name;
 		CommandCallback* cb;
+		bool ferrorReceived, freceiveCompleted;
 	public:
 		Command(const string* pname);
 
@@ -31,16 +35,26 @@
 
 		virtual void send(CoasterChannel* channel);
 		virtual void send(CoasterChannel* channel, CommandCallback* cb);
+		virtual void execute(CoasterChannel* channel);
 
 		virtual void receiveCompleted(int flags);
 
 		virtual void errorReceived();
 		virtual void replyReceived();
 
+		virtual bool isReceiveCompleted() const;
+		virtual bool isErrorReceived() const;
+		virtual string* getErrorMessage();
+		virtual RemoteCoasterException* getErrorDetail();
+
 		virtual void dataSent(Buffer* buf);
 
-		friend ostream& operator<< (ostream& os, Command* cmd);
+		template<typename cls> friend cls& operator<< (cls& os, Command* cmd);
 };
 
+template<typename cls> cls& operator<< (cls& os, Command* cmd) {
+	os << "Command[" << cmd->getName() << ", tag: " << cmd->getTag() << "]";
+	return os;
+}
 
 #endif /* COMMAND_H_ */
Index: modules/provider-coaster-c-client/src/CoasterChannel.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterChannel.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/CoasterChannel.cpp	(working copy)
@@ -13,12 +13,14 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include "Logger.h"
 
 #include <sstream>
 
 using namespace std;
 
 int socksend(int fd, const char* buf, int len, int flags);
+void pp(char* dest, const char* src, int len);
 
 class HeartBeatCommand;
 
@@ -38,30 +40,22 @@
 	bufpos = 0;
 }
 
-CoasterChannel::CoasterChannel(CoasterClient* pClient, CoasterLoop* pLoop, HandlerFactory* pHandlerFactory) {
+CoasterChannel::CoasterChannel(CoasterClient* client, CoasterLoop* loop, HandlerFactory* handlerFactory) {
 	sockFD = 0;
-	handlerFactory = pHandlerFactory;
+	this->handlerFactory = handlerFactory;
 	tagSeq = rand() % 65536;
-	loop = pLoop;
-	client = pClient;
+	this->loop = loop;
+	this->client = client;
 
-	readState = READ_STATE_IDLE;
+	readState = READ_STATE_HDR;
 
-	whdr.buf = new DynamicBuffer(HEADER_LENGTH);
 	rhdr.buf = new DynamicBuffer(HEADER_LENGTH);
 }
 
 CoasterChannel::~CoasterChannel() {
-	delete whdr.buf;
 	delete rhdr.buf;
 }
 
-ostream& operator<< (ostream& os, CoasterChannel* channel) {
-	os << "Channel[" << channel->getClient()->getURL() << "]";
-	return os;
-}
-
-
 void CoasterChannel::start() {
 	if (sockFD == 0) {
 		throw CoasterError("channel start() called but no socket set");
@@ -82,8 +76,6 @@
 
 void CoasterChannel::read() {
 	switch(readState) {
-		case READ_STATE_IDLE:
-			break;
 		case READ_STATE_HDR:
 			if (read(&rhdr)) {
 				// full header read
@@ -95,6 +87,7 @@
 			else {
 				break;
 			}
+			/* no break */
 		case READ_STATE_DATA:
 			if (read(&msg)) {
 				// full message read
@@ -125,7 +118,7 @@
 }
 
 void CoasterChannel::dispatchData() {
-	if (rflags & FLAG_REPLY != 0) {
+	if (rflags & FLAG_REPLY) {
 		dispatchReply();
 	}
 	else {
@@ -137,14 +130,13 @@
 	if (commands.count(rtag) == 0) {
 		throw new CoasterError("Received reply to unknown command (tag: %d)", rtag);
 	}
+	LogDebug << "dispatching reply " << rtag << ", " << rflags << endl;
 	Command* cmd = commands[rtag];
-	if (rflags & FLAG_SIGNAL != 0) {
+	if (rflags & FLAG_SIGNAL) {
 		try {
 			cmd->signalReceived(msg.buf);
 		}
 		catch (exception &e) {
-			Logger::singleton() << endl;
-			LogWarn << endl;
 			LogWarn << "Command::signalReceived() threw exception: " << e.what() << endl;
 		}
 		catch (...) {
@@ -172,6 +164,7 @@
 	if (handlers.count(rtag) == 0) {
 		// initial request
 		string* name = msg.buf->str();
+		LogDebug << "Handling initial request for " << name << endl;
 		Handler* h = handlerFactory->newInstance(name);
 		if (h == NULL) {
 			LogWarn << "Unknown handler: " << name << endl;
@@ -183,7 +176,7 @@
 	}
 	else {
 		Handler* h = handlers[rtag];
-		if (rflags & FLAG_SIGNAL != 0) {
+		if (rflags & FLAG_SIGNAL) {
 			try {
 				h->signalReceived(msg.buf);
 			}
@@ -211,12 +204,20 @@
 	}
 }
 
+/**
+ * Attempts to write the data chunk at the front of the queue. If the entire chunk is
+ * written, it removes it from the queue and returns true. Returns false there are bytes
+ * left to write in the chunk
+ */
 bool CoasterChannel::write() { Lock::Scoped l(writeLock);
 	DataChunk* dc = sendQueue.front();
 
 	Buffer* buf = dc->buf;
 
 	int ret = socksend(sockFD, buf->getData(), (buf->getLen() - dc->bufpos), MSG_DONTWAIT);
+	char tmp[81];
+	pp(tmp, buf->getData(), min(80, ret));
+	LogDebug << this << " sent " << ret << " bytes: " << tmp << endl;
 	if (ret == -1) {
 		if (errno == EAGAIN || errno == EWOULDBLOCK) {
 			return false;
@@ -240,19 +241,28 @@
 					LogWarn << "Callback threw unknown exception" << endl;
 				}
 			}
+			delete dc;
+			return true;
 		}
-		return true;
+		else {
+			return false;
+		}
 	}
 }
 
-void CoasterChannel::makeHeader(int tag, Buffer* buf, int flags) {
-	whdr.reset();
-	Buffer* hdr = whdr.buf;
+DataChunk* CoasterChannel::makeHeader(int tag, Buffer* buf, int flags) {
+	DataChunk* whdr = new DataChunk(new DynamicBuffer(HEADER_LENGTH), NULL);
+	Buffer* hdr = whdr->buf;
 	hdr->putInt(0, tag);
 	hdr->putInt(4, flags);
 	hdr->putInt(8, buf->getLen());
-	hdr->putInt(12, tag ^ flags ^ buf->getLen());
+	int hcsum = tag ^ flags ^ buf->getLen();
+	hdr->putInt(12, hcsum);
 	hdr->putInt(16, 0);
+	char tmp[128];
+	sprintf(tmp, "Send[tag: 0x%08x, flags: 0x%08x, len: 0x%08d, hcsum: 0x%08x]", tag, flags, buf->getLen(), hcsum);
+	LogDebug << tmp << endl;
+	return whdr;
 }
 
 void CoasterChannel::decodeHeader(int* tag, int* flags, int* len) {
@@ -262,6 +272,9 @@
 	*len = buf->getInt(8);
 	int hcsum = buf->getInt(12);
 	int ccsum = *tag ^ *flags ^ *len;
+	char tmp[128];
+	sprintf(tmp, "Recv[tag: 0x%08x, flags: 0x%08x, len: 0x%08d, hcsum: 0x%08x]", *tag, *flags, *len, hcsum);
+	LogDebug << tmp << endl;
 	if (hcsum != ccsum) {
 		throw CoasterError("Header checksum failed. Received checksum: %d, computed checksum: %d", hcsum, ccsum);
 	}
@@ -280,18 +293,19 @@
 void CoasterChannel::registerHandler(int tag, Handler* h) {
 	h->setTag(tag);
 	handlers[tag] = h;
+	h->setChannel(this);
 }
 
 void CoasterChannel::unregisterHandler(Handler* h) {
 	handlers.erase(h->getTag());
+	h->setChannel(NULL);
 }
 
 
 void CoasterChannel::send(int tag, Buffer* buf, int flags, ChannelCallback* cb) { Lock::Scoped l(writeLock);
-	makeHeader(tag, buf, flags);
-	sendQueue.push_back(&whdr);
+	sendQueue.push_back(makeHeader(tag, buf, flags));
 	sendQueue.push_back(new DataChunk(buf, cb));
-	loop->requestWrite(this);
+	loop->requestWrite(this, 2);
 }
 
 CoasterClient* CoasterChannel::getClient() {
@@ -303,7 +317,7 @@
 	cmd->send(this);
 }
 
-void CoasterChannel::errorReceived(Command* cmd, string* message, string* details) {
+void CoasterChannel::errorReceived(Command* cmd, string* message, RemoteCoasterException* details) {
 	delete cmd;
 	LogWarn << "Heartbeat failed: " << message << endl;
 }
@@ -312,9 +326,24 @@
 	delete cmd;
 }
 
+string& CoasterChannel::getURL() {
+	return getClient()->getURL();
+}
+
 /*
  * Without this, GCC gets confused by CoasterChannel::send.
  */
 int socksend(int fd, const char* buf, int len, int flags) {
 	return send(fd, buf, len, flags);
 }
+
+void pp(char* dest, const char* src, int len) {
+	for(int i = 0; i < len; i++) {
+		char c = src[i];
+		if (c < '0' || c > 127) {
+			c = '.';
+		}
+		dest[i] = c;
+	}
+	dest[len] = 0;
+}
Index: modules/provider-coaster-c-client/src/CoasterLoop.cpp
===================================================================
--- modules/provider-coaster-c-client/src/CoasterLoop.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/CoasterLoop.cpp	(working copy)
@@ -22,6 +22,8 @@
 	socketCount = 0;
 	FD_ZERO(&rfds);
 	FD_ZERO(&wfds);
+	writesPending = 0;
+	maxFD = 0;
 }
 
 CoasterLoop::~CoasterLoop() {
@@ -41,6 +43,7 @@
 			throw CoasterError(string("Could not create pipe: ") + strerror(errno));
 	}
 	FD_SET(wakePipe[0], &rfds);
+	updateMaxFD();
 
 	thread = pthread_create(&thread, NULL, run, this);
 
@@ -53,7 +56,8 @@
 	}
 	LogInfo << "Stopping coaster loop" << endl;
 	done = true;
-	awake();
+	// make sure we are not stuck in select()
+	requestWrite(1);
 	pthread_join(thread, NULL);
 	LogInfo << "Coaster loop stopped" << endl;
 }
@@ -86,8 +90,9 @@
 
 		// can read or has data to write
 		// try to read from each socket
-		if (!loop->readSockets(&myrfds)) {
+		if (loop->readSockets(&myrfds)) {
 			// no channel sockets had anything to read, so there is data to write
+			LogDebug << "Write requested" << endl;
 			{ Lock::Scoped l(loop->lock);
 				// synchronize when copying wfds since they are concurrently updated
 				// based on whether a channel has stuff to write or not
@@ -111,20 +116,14 @@
 bool CoasterLoop::readSockets(fd_set* fds) {
 	map<int, CoasterChannel*>::iterator it;
 
-	bool writePending = false;
-
 	for (it = channelMap.begin(); it != channelMap.end(); ++it) {
 		if (FD_ISSET(it->first, fds)) {
-			if (it->first == getWakePipeReadFD()) {
-				writePending = true;
-			}
-			else {
-				it->second->read();
-			}
+			LogDebug << it->second << " can read" << endl;
+			it->second->read();
 		}
 	}
 
-	return writePending;
+	return FD_ISSET(getWakePipeReadFD(), fds);
 }
 
 void CoasterLoop::writeSockets(fd_set* fds) {
@@ -132,19 +131,18 @@
 
 	for (it = channelMap.begin(); it != channelMap.end(); ++it) {
 		if (FD_ISSET(it->first, fds)) {
+			LogDebug << it->second << " can write" << endl;
 			if (it->second->write()) {
-				acknowledgeWake();
+				acknowledgeWriteRequest(1);
 			}
 		}
 	}
 }
 
-
 void checkSelectError(int ret) {
 	if (ret < 0) {
 		if (errno == EBADF) {
 			// at least one fd is invalid/has an error
-
 		}
 		else {
 			throw CoasterError(string("Error in select: ") + strerror(errno));
@@ -163,6 +161,7 @@
 	}
 
 	if (addList.size() > 0) {
+		LogDebug << "Channels added; updating maxFD" << endl;
 		updateMaxFD();
 	}
 
@@ -179,7 +178,10 @@
 		socketCount--;
 	}
 
-	updateMaxFD();
+	if (removeList.size() > 0) {
+		LogDebug << "Channels removed; updating maxFD" << endl;
+		updateMaxFD();
+	}
 
 	removeList.clear();
 }
@@ -192,13 +194,24 @@
 	removeList.push_back(channel);
 }
 
-void CoasterLoop::awake() {
-	int result = write(wakePipe[1], "0", 1);
+void CoasterLoop::requestWrite(int count) {
+	writesPending += count;
+	LogDebug << "request " << count <<  " writes; writesPending: " << writesPending << endl;
+	char tmp[count]; // doesn't need to be initialized since it doesn't matter what goes on the pipe
+	int result = write(wakePipe[1], tmp, count);
+	if (result != count) {
+		LogWarn << "written " << result << " bytes instead of " << count << endl;
+	}
 }
 
-void CoasterLoop::acknowledgeWake() {
-	char buf[1];
-	int result = read(wakePipe[0], buf, 1);
+void CoasterLoop::acknowledgeWriteRequest(int count) {
+	writesPending -= count;
+	LogDebug << "acknowledged " << count << " write requests; writesPending: " << writesPending << endl;
+	char buf[count];
+	int result = read(wakePipe[0], buf, count);
+	if (result != count) {
+		LogWarn << "read " << result << " bytes instead of " << count << endl;
+	}
 }
 
 fd_set* CoasterLoop::getReadFDs() {
@@ -222,16 +235,21 @@
 			maxFD = it->first;
 		}
 	}
+
+	LogDebug << "Updated maxFD to " << maxFD << endl;
 }
 
 int CoasterLoop::getWakePipeReadFD() {
 	return wakePipe[0];
 }
 
-void CoasterLoop::requestWrite(CoasterChannel* channel) { Lock::Scoped l(lock);
-	FD_SET(channel->getSockFD(), &wfds);
-	updateMaxFD();
-	awake();
+void CoasterLoop::requestWrite(CoasterChannel* channel, int count) { Lock::Scoped l(lock);
+	LogDebug << "Channel " << channel << " requests " << count << " writes." << endl;
+	if (!FD_ISSET(channel->getSockFD(), &wfds)) {
+		FD_SET(channel->getSockFD(), &wfds);
+		updateMaxFD();
+	}
+	requestWrite(count);
 }
 
 void CoasterLoop::checkHeartbeats() {
Index: modules/provider-coaster-c-client/src/CommandCallback.h
===================================================================
--- modules/provider-coaster-c-client/src/CommandCallback.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/CommandCallback.h	(working copy)
@@ -9,7 +9,7 @@
 #define COMMANDCALLBACK_H_
 
 #include <string>
-#include "Command.h"
+#include "RemoteCoasterException.h"
 
 class Command;
 
@@ -17,7 +17,7 @@
 
 class CommandCallback {
 	public:
-		virtual void errorReceived(Command* cmd, string* message, string* details) = 0;
+		virtual void errorReceived(Command* cmd, string* message, RemoteCoasterException* details) = 0;
 		virtual void replyReceived(Command* cmd) = 0;
 };
 
Index: modules/provider-coaster-c-client/src/JobSubmitCommand.h
===================================================================
--- modules/provider-coaster-c-client/src/JobSubmitCommand.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/JobSubmitCommand.h	(working copy)
@@ -13,12 +13,13 @@
 class JobSubmitCommand: public Command {
 	private:
 		Job* job;
-
+		string ss;
 	public:
 		static string NAME;
 		JobSubmitCommand(Job* job);
 		virtual void send(CoasterChannel* channel, CommandCallback* cb);
 		Job* getJob();
+		string* getRemoteId();
 	private:
 		void serialize();
 };
Index: modules/provider-coaster-c-client/src/CoasterClient.h
===================================================================
--- modules/provider-coaster-c-client/src/CoasterClient.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/CoasterClient.h	(working copy)
@@ -16,6 +16,7 @@
 #include "CoasterLoop.h"
 #include "HandlerFactory.h"
 #include "Job.h"
+#include "Settings.h"
 #include <list>
 #include <map>
 
@@ -23,6 +24,7 @@
 
 using namespace std;
 
+class ClientHandlerFactory;
 class HandlerFactory;
 class CoasterLoop;
 class CoasterChannel;
@@ -32,25 +34,30 @@
 		Lock lock;
 		ConditionVariable cv;
 		string URL;
+		string* hostName;
 		CoasterChannel* channel;
 		bool started;
 
 		int sockFD;
 
 		int getPort();
-		string getHostName();
+		string& getHostName();
 		struct addrinfo* resolve(const char* hostName, int port);
 
 		CoasterLoop* loop;
 		HandlerFactory* handlerFactory;
 
 		map<const string*, Job*> jobs;
+		map<string, const string*> remoteJobIdMapping;
+
 		list<Job*> doneJobs;
 	public:
 		CoasterClient(string URL, CoasterLoop& loop);
+		virtual ~CoasterClient();
 		void start();
 		void stop();
 
+		void setOptions(Settings& settings);
 		void submit(Job& job);
 		void waitForJob(Job& job);
 
@@ -61,7 +68,7 @@
 
 		string& getURL();
 
-		void errorReceived(Command* cmd, string* message, string* details);
+		void errorReceived(Command* cmd, string* message, RemoteCoasterException* details);
 		void replyReceived(Command* cmd);
 };
 
Index: modules/provider-coaster-c-client/src/HandlerFactory.cpp
===================================================================
--- modules/provider-coaster-c-client/src/HandlerFactory.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/HandlerFactory.cpp	(working copy)
@@ -13,12 +13,6 @@
 HandlerFactory::~HandlerFactory() {
 }
 
-template<typename T> Handler * newHandler() { return new T; }
-
-template<typename T> void HandlerFactory::addHandler(string name) {
-	creators[name] = &newHandler<T>;
-}
-
 Handler* HandlerFactory::newInstance(string& name) {
 	if (creators.count(name) == 0) {
 		return NULL;
Index: modules/provider-coaster-c-client/src/RequestReply.h
===================================================================
--- modules/provider-coaster-c-client/src/RequestReply.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/RequestReply.h	(working copy)
@@ -12,6 +12,7 @@
 #include "Buffer.h"
 #include "Flags.h"
 #include <vector>
+#include <list>
 
 class CoasterChannel;
 
@@ -20,18 +21,18 @@
 class RequestReply: public ChannelCallback {
 	private:
 		CoasterChannel* channel;
-		vector<Buffer*> outData;
+		list<Buffer*> outData;
 		vector<Buffer*> inData;
 		vector<Buffer*>* errorData;
 
-		void clearBufferVector(vector<Buffer*>& v);
+		void clearBufferVector(vector<Buffer*>* v);
 
 	protected:
 		virtual void addOutData(Buffer*);
 		virtual void addInData(Buffer*);
 		virtual void addErrorData(Buffer*);
 
-		virtual vector<Buffer*>* getOutData();
+		virtual list<Buffer*>* getOutData();
 		virtual vector<Buffer*>* getErrorData();
 		virtual vector<Buffer*>* getInData();
 
Index: modules/provider-coaster-c-client/src/Buffer.cpp
===================================================================
--- modules/provider-coaster-c-client/src/Buffer.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/Buffer.cpp	(working copy)
@@ -7,6 +7,7 @@
 
 #include "Buffer.h"
 #include <stdlib.h>
+#include <string.h>
 
 Buffer::Buffer(int plen) {
 	len = plen;
@@ -111,13 +112,19 @@
 	return b;
 }
 
+Buffer* Buffer::copy(string& s) {
+	DynamicBuffer* b = new DynamicBuffer(s.length());
+	strncpy(b->getModifiableData(), s.data(), s.length());
+	return b;
+}
+
 Buffer* Buffer::wrap(const string* s) {
 	StaticBuffer* b = new StaticBuffer(s->length());
 	b->setData(s->data());
 	return b;
 }
 
-ostream& operator<< (ostream& os, Buffer& buf) {
+template<typename cls> cls& operator<< (cls& os, Buffer& buf) {
 	const char* data = buf.getData();
 	int len = buf.getLen();
 
Index: modules/provider-coaster-c-client/src/Handler.cpp
===================================================================
--- modules/provider-coaster-c-client/src/Handler.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/Handler.cpp	(working copy)
@@ -3,7 +3,7 @@
 #include "Logger.h"
 
 void Handler::receiveCompleted(int flags) {
-	if (flags & FLAG_ERROR != 0) {
+	if (flags & FLAG_ERROR) {
 		errorReceived();
 	}
 	else {
@@ -45,11 +45,12 @@
 }
 
 void Handler::send(CoasterChannel* channel) {
-	vector<Buffer*>* od = getOutData();
-	vector<Buffer*>::iterator i;
+	list<Buffer*>* od = getOutData();
 
-	for (i = od->begin(); i != od->end(); i++) {
-		channel->send(tag, *i, FLAG_REPLY + (i == --od->end() ? FLAG_FINAL : 0), this);
+	while (od->size() > 0) {
+		Buffer* b = od->front();
+		channel->send(tag, b, FLAG_REPLY + (od->size() == 0 ? FLAG_FINAL : 0), this);
+		od->pop_front();
 	}
 	channel->unregisterHandler(this);
 }
Index: modules/provider-coaster-c-client/src/Command.cpp
===================================================================
--- modules/provider-coaster-c-client/src/Command.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/Command.cpp	(working copy)
@@ -1,9 +1,13 @@
 #include "Command.h"
-
+#include "CmdCBCV.h"
 #include "Logger.h"
+#include "CoasterError.h"
 
+
 Command::Command(const string* pname) {
 	name = pname;
+	ferrorReceived = false;
+	freceiveCompleted = false;
 }
 
 const string* Command::getName() {
@@ -14,28 +18,46 @@
 	send(channel, NULL);
 }
 
-ostream& operator<< (ostream& os, Command* cmd) {
-	os << "Command[" << cmd->getName() << ", tag: " << cmd->getTag() << "]";
-	return os;
-}
-
-
 void Command::send(CoasterChannel* channel, CommandCallback* pcb) {
 	cb = pcb;
 	channel->registerCommand(this);
 
-	vector<Buffer*>* od = getOutData();
-	vector<Buffer*>::iterator i;
+	list<Buffer*>* od = getOutData();
 
 	channel->send(tag, Buffer::wrap(name), od->empty() ? FLAG_FINAL : 0, this);
 
-	for (i = od->begin(); i != od->end(); i++) {
-		channel->send(tag, *i, i == --od->end() ? FLAG_FINAL : 0, this);
+	while (od->size() > 0) {
+		Buffer* b = od->front();
+		channel->send(tag, b, od->size() == 1 ? FLAG_FINAL : 0, this);
+		od->pop_front();
 	}
 }
 
+void Command::execute(CoasterChannel* channel) {
+	CmdCBCV cb;
+	send(channel, &cb);
+	cb.wait();
+	if (ferrorReceived) {
+		string* msg = getErrorMessage();
+		RemoteCoasterException* detail = getErrorDetail();
+		if (msg == NULL) {
+			throw CoasterError("Command failed");
+		}
+		else if (detail == NULL) {
+			throw CoasterError("Command failed: %s", msg->c_str());
+		}
+		else {
+			throw CoasterError("Command failed: %s\n%s", msg->c_str(), detail->str().c_str());
+		}
+		delete detail;
+		delete msg;
+	}
+}
+
 void Command::receiveCompleted(int flags) {
-	if (flags & FLAG_ERROR != 0) {
+	freceiveCompleted = true;
+	if (flags & FLAG_ERROR) {
+		ferrorReceived = true;
 		errorReceived();
 	}
 	else {
@@ -45,32 +67,50 @@
 
 
 void Command::errorReceived() {
-	vector<Buffer*>* errorData = getErrorData();
 	if (cb != NULL) {
-		if (errorData == NULL) {
-			cb->errorReceived(this, NULL, NULL);
-		}
-		else if (errorData->size() == 1) {
-			string* msg = errorData->at(0)->str();
-			cb->errorReceived(this, msg, NULL);
-			delete msg;
-		}
-		else {
-			string* msg = errorData->at(0)->str();
-			string* detail = errorData->at(1)->str();
-			cb->errorReceived(this, msg, detail);
-			delete msg;
-			delete detail;
-		}
+		string* msg = getErrorMessage();
+		RemoteCoasterException* detail = getErrorDetail();
+		cb->errorReceived(this, msg, detail);
+		delete msg;
+		delete detail;
 	}
 }
 
+string* Command::getErrorMessage() {
+	vector<Buffer*>* errorData = getErrorData();
+	if (errorData != NULL && errorData->size() > 0) {
+		return errorData->at(0)->str();
+	}
+	else {
+		return NULL;
+	}
+}
+
+RemoteCoasterException* Command::getErrorDetail() {
+	vector<Buffer*>* errorData = getErrorData();
+	if (errorData != NULL && errorData->size() > 1) {
+		return new RemoteCoasterException(errorData->at(1)->getData(), errorData->at(1)->getLen());
+	}
+	else {
+		return NULL;
+	}
+}
+
+
 void Command::replyReceived() {
 	if (cb != NULL) {
 		cb->replyReceived(this);
 	}
 }
 
+bool Command::isReceiveCompleted() const {
+	return freceiveCompleted;
+}
+
+bool Command::isErrorReceived() const {
+	return ferrorReceived;
+}
+
 void Command::dataSent(Buffer* buf) {
 	delete buf;
 }
Index: modules/provider-coaster-c-client/src/JobStatus.h
===================================================================
--- modules/provider-coaster-c-client/src/JobStatus.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/JobStatus.h	(working copy)
@@ -11,6 +11,7 @@
 #include <time.h>
 #include <string>
 #include <iostream>
+#include "RemoteCoasterException.h"
 
 using namespace std;
 
@@ -31,29 +32,47 @@
 
 
 class JobStatus {
-	JobStatusCode statusCode;
-	time_t stime;
-	string* message;
-	string* exception;
-	JobStatus* prev;
+	private:
+		JobStatusCode statusCode;
+		time_t stime;
+		string* message;
+		RemoteCoasterException* exception;
+		JobStatus* prev;
 
+		void init(JobStatusCode statusCode, time_t time, const string* message, RemoteCoasterException* exception);
+
 	public:
-		JobStatus(JobStatusCode statusCode, time_t time, const string* message, const string* exception);
-		JobStatus(JobStatusCode statusCode, const string* message, const string* exception);
+		JobStatus(JobStatusCode statusCode, time_t time, const string* message, RemoteCoasterException* exception);
+		JobStatus(JobStatusCode statusCode, const string* message, RemoteCoasterException* exception);
 		JobStatus(JobStatusCode statusCode);
 		JobStatus();
 		virtual ~JobStatus();
 		JobStatusCode getStatusCode();
 		time_t getTime();
 		string* getMessage();
-		string* getException();
+		RemoteCoasterException* getException();
 		const JobStatus* getPreviousStatus();
 		void setPreviousStatus(JobStatus* prev);
 		static const char* statusCodeToStr(JobStatusCode code);
 		bool isTerminal();
 
-		friend ostream& operator<< (ostream& os, JobStatus& s);
-		friend ostream& operator<< (ostream& os, JobStatus* s);
+		template<typename cls> friend cls& operator<< (cls& os, JobStatus& s);
+		template<typename cls> friend cls& operator<< (cls& os, JobStatus* s);
 };
 
+const char* statusCodeToStr(JobStatusCode code);
+
+template<typename cls> cls& operator<< (cls& os, JobStatus& s) {
+	return os << &s;
+}
+
+template<typename cls> cls& operator<< (cls& os, JobStatus* s) {
+	os << "Status(" << statusCodeToStr(s->getStatusCode());
+	if ((s->getMessage() != NULL) && (s->getMessage()->length() != 0)) {
+		os << ", msg: " << s->getMessage();
+	}
+	os << ")";
+	return os;
+}
+
 #endif /* JOB_STATUS_H_ */
Index: modules/provider-coaster-c-client/src/Logger.h
===================================================================
--- modules/provider-coaster-c-client/src/Logger.h	(revision 3470)
+++ modules/provider-coaster-c-client/src/Logger.h	(working copy)
@@ -13,6 +13,7 @@
 #include <iostream>
 #include <fstream>
 #include <string>
+#include "Lock.h"
 
 using namespace std;
 
@@ -27,7 +28,7 @@
 		const char* strLevel;
 		char ts[TS_LEN + 1];
 		bool startOfItem;
-
+		Lock lock;
 	protected:
 		Logger(ostream& out);
 		void setLevel(Level level);
@@ -37,7 +38,7 @@
 	public:
 		virtual ~Logger();
 		Logger& operator<< (Level level);
-		Logger& operator<< (string str);
+		Logger& operator<< (string& str);
 		Logger& operator<< (const string* str);
 		Logger& operator<< (const char* str);
 		Logger& operator<< (int i);
Index: modules/provider-coaster-c-client/src/Makefile.am
===================================================================
--- modules/provider-coaster-c-client/src/Makefile.am	(revision 3470)
+++ modules/provider-coaster-c-client/src/Makefile.am	(working copy)
@@ -1,4 +1,3 @@
-
 bin_PROGRAMS = CoasterClientTest
 CoasterClientTest_SOURCES = CoasterClientTest.cpp
 CoasterClientTest_LDADD = libcoasterclient.la
@@ -8,10 +7,14 @@
 libcoasterclient_la_SOURCES = Lock.h Lock.cpp \
 	ConditionVariable.h ConditionVariable.cpp \
 	CommandCallback.h \
+	CmdCBCV.h CmdCBCV.cpp \
 	Buffer.h Buffer.cpp \
+	RemoteCoasterException.h RemoteCoasterException.cpp \
 	SerUtil.h \
 	Logger.h Logger.cpp \
+	Settings.h Settings.cpp \
 	HandlerFactory.h HandlerFactory.cpp \
+	ClientHandlerFactory.h ClientHandlerFactory.cpp \
 	ChannelCallback.h ChannelCallback.cpp \
 	CoasterCannel.h CoasterChannel.cpp \
 	CoasterClient.h CoasterClient.cpp \
@@ -22,6 +25,8 @@
 	JobStatus.h JobStatus.cpp \
 	Job.h Job.cpp \
 	JobSubmitCommand.h JobSubmitCommand.cpp \
+	ChannelConfigurationCommand.h ChannelConfigurationCommand.cpp \
+	ServiceConfigurationCommand.h ServiceConfigurationCommand.cpp \
 	StagingSetEntry.h StagingSetEntry.cpp \
 	CoasterError.h CoasterError.cpp \
 	JobStatusHandler.h JobStatusHandler.cpp \
Index: modules/provider-coaster-c-client/src/JobSubmitCommand.cpp
===================================================================
--- modules/provider-coaster-c-client/src/JobSubmitCommand.cpp	(revision 3470)
+++ modules/provider-coaster-c-client/src/JobSubmitCommand.cpp	(working copy)
@@ -1,13 +1,13 @@
 #include "JobSubmitCommand.h"
+#include "CoasterError.h"
 #include <cstring>
-#include <sstream>
 
 using namespace std;
 
-char* copyStr(const char* str);
-void add(stringstream& ss, const char* key, string* value);
-void add(stringstream& ss, const char* key, string value);
-void add(stringstream& ss, const char* key, const char* value);
+void add(string& ss, const char* key, string* value);
+void add(string& ss, const char* key, string& value);
+void add(string& ss, const char* key, const char* value);
+void add(string& ss, const char* key, const char* value, int n);
 
 string JobSubmitCommand::NAME("SUBMITJOB");
 
@@ -24,11 +24,14 @@
 	return job;
 }
 
+string* JobSubmitCommand::getRemoteId() {
+	if (!isReceiveCompleted() || isErrorReceived()) {
+		throw CoasterError("getRemoteId called before reply was received");
+	}
+	return getInData()->at(0)->str();
+}
+
 void JobSubmitCommand::serialize() {
-	addOutData(Buffer::wrap(getName()));
-
-	stringstream ss;
-
 	add(ss, "identity", job->getIdentity());
 	add(ss, "executable", job->getExecutable());
 	add(ss, "directory", job->getDirectory());
@@ -48,22 +51,14 @@
 	map<string, string>* env = job->getEnv();
 	if (env != NULL) {
 		for (map<string, string>::iterator i = env->begin(); i != env->end(); ++i) {
-			stringstream tmp;
-			tmp << i->first;
-			tmp << "=";
-			tmp << i->second;
-			add(ss, "env", tmp.str().c_str());
+			add(ss, "env", string(i->first).append("=").append(i->second));
 		}
 	}
 
 	map<string, string>* attributes = job->getAttributes();
 	if (attributes != NULL) {
 		for (map<string, string>::iterator i = attributes->begin(); i != attributes->end(); ++i) {
-			stringstream tmp;
-			tmp << i->first;
-			tmp << "=";
-			tmp << i->second;
-			add(ss, "attr", tmp.str().c_str());
+			add(ss, "attr", string(i->first).append("=").append(i->second));
 		}
 	}
 
@@ -74,33 +69,40 @@
 		add(ss, "jm", job->getJobManager());
 	}
 
-	addOutData(Buffer::wrap(ss.str()));
+	addOutData(Buffer::wrap(ss));
 }
 
-void add(stringstream& ss, const char* key, string* value) {
+void add(string& ss, const char* key, string* value) {
 	if (value != NULL) {
-		add(ss, key, value->c_str());
+		add(ss, key, value->data(), value->length());
 	}
 }
 
-void add(stringstream& ss, const char* key, string value) {
-	add(ss, key, value.c_str());
+void add(string& ss, const char* key, string& value) {
+	add(ss, key, value.data(), value.length());
 }
 
-void add(stringstream& ss, const char* key, const char* value) {
-	if (value != NULL) {
-		ss << key << "=";
+void add(string& ss, const char* key, const char* value) {
+	add(ss, key, value, -1);
+}
+
+void add(string& ss, const char* key, const char* value, int n) {
+	if (value != NULL && n != 0) {
+		ss.append(key);
+		ss.append(1, '=');
 		while (*value) {
 			char c = *value;
 			switch (c) {
 				case '\n':
 					c = 'n';
 				case '\\':
-					ss << '\\';
+					ss.append(1, '\\');
 				default:
-					ss << c;
+					ss.append(1, c);
 			}
 			value++;
+			n--;
 		}
 	}
+	ss.append(1, '\n');
 }
Index: modules/provider-coaster-c-client/Makefile.am
===================================================================
--- modules/provider-coaster-c-client/Makefile.am	(revision 3470)
+++ modules/provider-coaster-c-client/Makefile.am	(working copy)
@@ -1,6 +1,5 @@
 ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = src
 EXTRA_DIST = autogen.sh
-LIBS="-pthread $LIBS"
-CXXFLAGS="$CFLAGS -pthread"
-
+LIBS = -pthread $LIBS
+AM_CXXFLAGS = -pthread



More information about the Swift-commit mailing list