avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1515933 [1/4] - in /avro/trunk: ./ lang/csharp/ lang/csharp/lib/main/ lang/csharp/src/apache/codegen/ lang/csharp/src/apache/codegen/Properties/ lang/csharp/src/apache/ipc/ lang/csharp/src/apache/ipc/Generic/ lang/csharp/src/apache/ipc/Pro...
Date Tue, 20 Aug 2013 19:13:41 GMT
Author: cutting
Date: Tue Aug 20 19:13:39 2013
New Revision: 1515933

URL: http://svn.apache.org/r1515933
Log:
AVRO-975. C#: Add RPC support.  Contributed by Mark Lamley.

Added:
    avro/trunk/lang/csharp/lib/main/Castle.Core.dll   (with props)
    avro/trunk/lang/csharp/src/apache/ipc/   (with props)
    avro/trunk/lang/csharp/src/apache/ipc/Avro.ipc.csproj
    avro/trunk/lang/csharp/src/apache/ipc/CallFuture.cs
    avro/trunk/lang/csharp/src/apache/ipc/CountdownLatch.cs
    avro/trunk/lang/csharp/src/apache/ipc/Generic/
    avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericRequestor.cs
    avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericResponder.cs
    avro/trunk/lang/csharp/src/apache/ipc/LocalTransceiver.cs
    avro/trunk/lang/csharp/src/apache/ipc/OutputStream.cs
    avro/trunk/lang/csharp/src/apache/ipc/Properties/
    avro/trunk/lang/csharp/src/apache/ipc/Properties/AssemblyInfo.cs
    avro/trunk/lang/csharp/src/apache/ipc/Requestor.cs
    avro/trunk/lang/csharp/src/apache/ipc/Responder.cs
    avro/trunk/lang/csharp/src/apache/ipc/RpcContext.cs
    avro/trunk/lang/csharp/src/apache/ipc/RpcRequest.cs
    avro/trunk/lang/csharp/src/apache/ipc/SocketServer.cs
    avro/trunk/lang/csharp/src/apache/ipc/SocketTransceiver.cs
    avro/trunk/lang/csharp/src/apache/ipc/Specific/
    avro/trunk/lang/csharp/src/apache/ipc/Specific/SpecificRequestor.cs
    avro/trunk/lang/csharp/src/apache/ipc/Specific/SpecificResponder.cs
    avro/trunk/lang/csharp/src/apache/ipc/Transceiver.cs
    avro/trunk/lang/csharp/src/apache/ipc/org/
    avro/trunk/lang/csharp/src/apache/ipc/org/apache/
    avro/trunk/lang/csharp/src/apache/ipc/org/apache/avro/
    avro/trunk/lang/csharp/src/apache/ipc/org/apache/avro/ipc/
    avro/trunk/lang/csharp/src/apache/ipc/org/apache/avro/ipc/HandshakeMatch.cs
    avro/trunk/lang/csharp/src/apache/ipc/org/apache/avro/ipc/HandshakeRequest.cs
    avro/trunk/lang/csharp/src/apache/ipc/org/apache/avro/ipc/HandshakeResponse.cs
    avro/trunk/lang/csharp/src/apache/ipc/org/apache/avro/ipc/MD5.cs
    avro/trunk/lang/csharp/src/apache/main/IO/ByteBufferInputStream.cs
    avro/trunk/lang/csharp/src/apache/main/IO/ByteBufferOutputStream.cs
    avro/trunk/lang/csharp/src/apache/main/IO/ICallback.cs
    avro/trunk/lang/csharp/src/apache/main/IO/InputStream.cs
    avro/trunk/lang/csharp/src/apache/main/IO/OutputStream.cs
    avro/trunk/lang/csharp/src/apache/main/Specific/SpecificException.cs
    avro/trunk/lang/csharp/src/apache/main/Specific/SpecificProtocol.cs
    avro/trunk/lang/csharp/src/apache/msbuild/   (with props)
    avro/trunk/lang/csharp/src/apache/msbuild/Avro.msbuild.csproj
    avro/trunk/lang/csharp/src/apache/msbuild/AvroBuilldTask.cs
    avro/trunk/lang/csharp/src/apache/msbuild/Properties/
    avro/trunk/lang/csharp/src/apache/msbuild/Properties/AssemblyInfo.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/All.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllCallback.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllEnum.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/FixedTest.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Kind.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MD5.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Mail.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MailCallback.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Message.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Simple.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestError.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecord.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/LocalTransceiverTest.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/MailResponder.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/SerializationTest.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerConcurrentExecutionTest.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerTest.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/SocketServerWithCallbacksTest.cs
    avro/trunk/lang/csharp/src/apache/test/Ipc/SocketTransceiverWhenServerStopsTest.cs
Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/csharp/   (props changed)
    avro/trunk/lang/csharp/.gitignore
    avro/trunk/lang/csharp/Avro.nunit
    avro/trunk/lang/csharp/Avro.sln
    avro/trunk/lang/csharp/src/apache/codegen/AvroGen.cs
    avro/trunk/lang/csharp/src/apache/codegen/Properties/AssemblyInfo.cs
    avro/trunk/lang/csharp/src/apache/main/Avro.main.csproj
    avro/trunk/lang/csharp/src/apache/main/CodeGen/CodeGen.cs
    avro/trunk/lang/csharp/src/apache/main/File/DataFileReader.cs
    avro/trunk/lang/csharp/src/apache/main/Generic/GenericReader.cs
    avro/trunk/lang/csharp/src/apache/main/Generic/GenericWriter.cs
    avro/trunk/lang/csharp/src/apache/main/IO/BinaryEncoder.cs
    avro/trunk/lang/csharp/src/apache/main/Properties/AssemblyInfo.cs
    avro/trunk/lang/csharp/src/apache/main/Protocol/Message.cs
    avro/trunk/lang/csharp/src/apache/main/Schema/MapSchema.cs
    avro/trunk/lang/csharp/src/apache/main/Schema/RecordSchema.cs
    avro/trunk/lang/csharp/src/apache/main/Specific/ObjectCreator.cs
    avro/trunk/lang/csharp/src/apache/main/Specific/SpecificFixed.cs
    avro/trunk/lang/csharp/src/apache/main/Specific/SpecificReader.cs
    avro/trunk/lang/csharp/src/apache/main/Specific/SpecificWriter.cs
    avro/trunk/lang/csharp/src/apache/test/Avro.test.csproj
    avro/trunk/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs
    avro/trunk/lang/csharp/src/apache/test/Properties/AssemblyInfo.cs
    avro/trunk/lang/csharp/src/apache/test/Specific/SpecificTests.cs

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1515933&r1=1515932&r2=1515933&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Tue Aug 20 19:13:39 2013
@@ -4,6 +4,8 @@ Trunk (not yet released)
 
   NEW FEATURES
 
+    AVRO-975. C#: Add RPC support. (Mark Lamley via cutting)
+
   IMPROVEMENTS
 
   BUG FIXES

Propchange: avro/trunk/lang/csharp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Aug 20 19:13:39 2013
@@ -1,2 +1,4 @@
 build
 TestResult.xml
+src/apache/ipc/obj
+src/apache/msbuild/obj

Modified: avro/trunk/lang/csharp/.gitignore
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/.gitignore?rev=1515933&r1=1515932&r2=1515933&view=diff
==============================================================================
--- avro/trunk/lang/csharp/.gitignore (original)
+++ avro/trunk/lang/csharp/.gitignore Tue Aug 20 19:13:39 2013
@@ -17,6 +17,33 @@
 /*.user
 /*.suo
 /_ReSharper.Avro
-/src/apache/codegen/obj
-/src/apache/main/obj
-/src/apache/test/obj
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+*.nupkg

Modified: avro/trunk/lang/csharp/Avro.nunit
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/Avro.nunit?rev=1515933&r1=1515932&r2=1515933&view=diff
==============================================================================
--- avro/trunk/lang/csharp/Avro.nunit (original)
+++ avro/trunk/lang/csharp/Avro.nunit Tue Aug 20 19:13:39 2013
@@ -3,12 +3,14 @@
   <Config name="Debug" binpathtype="Auto">
     <assembly path="build/test/Debug/Avro.test.dll" />
     <assembly path="build/test/Debug/Avro.dll" />
+	<assembly path="lib/main/Castle.Core.dll" />
     <assembly path="lib/main/Newtonsoft.Json.dll" />
     <assembly path="lib/test/nunit.framework.dll" />
   </Config>
   <Config name="Release" binpathtype="Auto">
     <assembly path="build/test/Release/Avro.test.dll" />
     <assembly path="build/test/Release/Avro.dll" />
+	<assembly path="lib/main/Castle.Core.dll" />
     <assembly path="lib/main/Newtonsoft.Json.dll" />
     <assembly path="lib/test/nunit.framework.dll" />
   </Config>

Modified: avro/trunk/lang/csharp/Avro.sln
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/Avro.sln?rev=1515933&r1=1515932&r2=1515933&view=diff
==============================================================================
--- avro/trunk/lang/csharp/Avro.sln (original)
+++ avro/trunk/lang/csharp/Avro.sln Tue Aug 20 19:13:39 2013
@@ -1,55 +1,83 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.main", "src\apache\main\Avro.main.csproj", "{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.test", "src\apache\test\Avro.test.csproj", "{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.codegen", "src\apache\codegen\Avro.codegen.csproj", "{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Debug|Mixed Platforms = Debug|Mixed Platforms
-		Debug|x86 = Debug|x86
-		Release|Any CPU = Release|Any CPU
-		Release|Mixed Platforms = Release|Mixed Platforms
-		Release|x86 = Release|x86
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Any CPU.Build.0 = Release|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|x86.ActiveCfg = Release|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Any CPU.Build.0 = Release|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
-		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|x86.ActiveCfg = Release|Any CPU
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.ActiveCfg = Debug|x86
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.Build.0 = Debug|x86
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.Build.0 = Release|Any CPU
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.ActiveCfg = Release|x86
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.Build.0 = Release|x86
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.ActiveCfg = Release|x86
-		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.Build.0 = Release|x86
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.main", "src\apache\main\Avro.main.csproj", "{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.test", "src\apache\test\Avro.test.csproj", "{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.codegen", "src\apache\codegen\Avro.codegen.csproj", "{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.ipc", "src\apache\ipc\Avro.ipc.csproj", "{3B05043A-DC6C-49B6-85BF-9AB055D0B414}"
+	ProjectSection(ProjectDependencies) = postProject
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B} = {AEB22F94-4ECF-4008-B159-389B3F05D54B}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.msbuild", "src\apache\msbuild\Avro.msbuild.csproj", "{AEB22F94-4ECF-4008-B159-389B3F05D54B}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|Mixed Platforms = Debug|Mixed Platforms
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|Mixed Platforms = Release|Mixed Platforms
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}.Release|x86.ActiveCfg = Release|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Any CPU.Build.0 = Release|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}.Release|x86.ActiveCfg = Release|Any CPU
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.ActiveCfg = Debug|x86
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.Build.0 = Debug|x86
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.ActiveCfg = Release|x86
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.Build.0 = Release|x86
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.ActiveCfg = Release|x86
+		{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.Build.0 = Release|x86
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Release|x86.ActiveCfg = Release|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{AEB22F94-4ECF-4008-B159-389B3F05D54B}.Release|x86.ActiveCfg = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: avro/trunk/lang/csharp/lib/main/Castle.Core.dll
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/lib/main/Castle.Core.dll?rev=1515933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: avro/trunk/lang/csharp/lib/main/Castle.Core.dll
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: avro/trunk/lang/csharp/src/apache/codegen/AvroGen.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/codegen/AvroGen.cs?rev=1515933&r1=1515932&r2=1515933&view=diff
==============================================================================
--- avro/trunk/lang/csharp/src/apache/codegen/AvroGen.cs (original)
+++ avro/trunk/lang/csharp/src/apache/codegen/AvroGen.cs Tue Aug 20 19:13:39 2013
@@ -17,7 +17,6 @@
  */
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Text;
 
 namespace Avro

Modified: avro/trunk/lang/csharp/src/apache/codegen/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/codegen/Properties/AssemblyInfo.cs?rev=1515933&r1=1515932&r2=1515933&view=diff
==============================================================================
--- avro/trunk/lang/csharp/src/apache/codegen/Properties/AssemblyInfo.cs (original)
+++ avro/trunk/lang/csharp/src/apache/codegen/Properties/AssemblyInfo.cs Tue Aug 20 19:13:39 2013
@@ -17,38 +17,17 @@
  */
 
 using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
-// General Information about an assembly is controlled through the following 
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
 [assembly: AssemblyTitle("Avro.codegen")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Bank of America")]
+[assembly: AssemblyCompany("Apache")]
 [assembly: AssemblyProduct("Avro.codegen")]
-[assembly: AssemblyCopyright("Copyright © Bank of America 2011")]
+[assembly: AssemblyCopyright("Copyright © Apache 2013")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible 
-// to COM components.  If you need to access a type in this assembly from 
-// COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3ccfcbf4-bdf9-4f75-8d5a-ab476bb4408f")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version 
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers 
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: Guid("3C23DD33-DD4F-42B1-B71F-8F9C86929E58")]
+[assembly: AssemblyVersion("0.9.0.0")]
+[assembly: AssemblyFileVersion("0.9.0.0")]
\ No newline at end of file

Propchange: avro/trunk/lang/csharp/src/apache/ipc/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Aug 20 19:13:39 2013
@@ -0,0 +1 @@
+obj

Added: avro/trunk/lang/csharp/src/apache/ipc/Avro.ipc.csproj
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/Avro.ipc.csproj?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/Avro.ipc.csproj (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/Avro.ipc.csproj Tue Aug 20 19:13:39 2013
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{3B05043A-DC6C-49B6-85BF-9AB055D0B414}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Avro.ipc</RootNamespace>
+    <AssemblyName>Avro.ipc</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\build\ipc\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\..\build\ipc\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>..\..\..\Avro.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Castle.Core">
+      <HintPath>..\..\..\lib\main\Castle.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net">
+      <HintPath>..\..\..\lib\main\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="CallFuture.cs" />
+    <Compile Include="CountdownLatch.cs" />
+    <Compile Include="Generic\GenericRequestor.cs" />
+    <Compile Include="Generic\GenericResponder.cs" />
+    <Compile Include="OutputStream.cs" />
+    <Compile Include="RpcRequest.cs" />
+    <Compile Include="SocketServer.cs" />
+    <Compile Include="Specific\SpecificResponder.cs" />
+    <Compile Include="Specific\SpecificRequestor.cs" />
+    <Compile Include="Transceiver.cs" />
+    <Compile Include="LocalTransceiver.cs" />
+    <Compile Include="org\apache\avro\ipc\HandshakeMatch.cs" />
+    <Compile Include="org\apache\avro\ipc\HandshakeRequest.cs" />
+    <Compile Include="org\apache\avro\ipc\HandshakeResponse.cs" />
+    <Compile Include="org\apache\avro\ipc\MD5.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Requestor.cs" />
+    <Compile Include="Responder.cs" />
+    <Compile Include="RpcContext.cs" />
+    <Compile Include="SocketTransceiver.cs" />
+  </ItemGroup>
+  <ItemGroup />
+  <ItemGroup>
+    <ProjectReference Include="..\main\Avro.main.csproj">
+      <Project>{a0a5ca3c-f58c-4d07-98b0-2c7b62ab20f0}</Project>
+      <Name>Avro.main</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!--<UsingTask AssemblyFile="..\..\..\build\msbuild\$(Configuration)\Avro.msbuild.dll" TaskName="Avro.msbuild.AvroBuildTask" />-->
+  <Target Name="BeforeBuild">
+    <!--<AvroBuildTask OutDir="..\ipc\" SchemaFiles="..\..\..\..\..\share\schemas\org\apache\avro\ipc\HandshakeRequest.avsc;..\..\..\..\..\share\schemas\org\apache\avro\ipc\HandshakeResponse.avsc">
+    </AvroBuildTask>-->
+  </Target>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/CallFuture.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/CallFuture.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/CallFuture.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/CallFuture.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Avro.IO;
+
+namespace Avro.ipc
+{
+    public class CallFuture<T> : ICallback<T>, IDisposable 
+    {
+        private readonly ICallback<T> chainedCallback;
+        private CountdownLatch latch = new CountdownLatch(1);
+
+        public CallFuture(ICallback<T> chainedCallback = null)
+        {
+            this.chainedCallback = chainedCallback;
+        }
+
+        public T Result { get; private set; }
+        public Exception Error { get; private set; }
+
+        public bool IsDone
+        {
+            get { return latch.CurrentCount == 0; }
+        }
+
+        public virtual void HandleResult(T result)
+        {
+            Result = result;
+            latch.Signal();
+            if (chainedCallback != null)
+            {
+                chainedCallback.HandleResult(result);
+            }
+        }
+
+        public virtual void HandleException(Exception exception)
+        {
+            Error = exception;
+            latch.Signal();
+            if (chainedCallback != null)
+            {
+                chainedCallback.HandleException(exception);
+            }
+        }
+
+        public T WaitForResult()
+        {
+            latch.Wait();
+            if (Error != null)
+            {
+                throw Error;
+            }
+            return Result;
+        }
+
+        public T WaitForResult(int millisecondsTimeout)
+        {
+            if (latch.Wait(millisecondsTimeout))
+            {
+                if (Error != null)
+                {
+                    throw Error;
+                }
+                return Result;
+            }
+
+            throw new TimeoutException();
+        }
+
+        public void Wait()
+        {
+            latch.Wait();
+        }
+
+        public void Wait(int millisecondsTimeout)
+        {
+            if (!latch.Wait(millisecondsTimeout))
+            {
+                throw new TimeoutException();
+            }
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~CallFuture()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // free managed resources
+                if (latch != null)
+                {
+                    latch.Dispose();
+                    latch = null;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/CountdownLatch.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/CountdownLatch.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/CountdownLatch.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/CountdownLatch.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Threading;
+
+namespace Avro.ipc
+{
+    public class CountdownLatch : IDisposable
+    {
+        private ManualResetEvent evt;
+        private int currentCount;
+
+        public int CurrentCount
+        {
+            get { return currentCount; }
+        }
+
+        public CountdownLatch(int count)
+        {
+            currentCount = count;
+            evt = new ManualResetEvent(false);
+        }
+
+        public void Signal()
+        {
+            if (Interlocked.Decrement(ref currentCount) == 0)
+                evt.Set();
+        }
+
+        public void Wait()
+        {
+            evt.WaitOne();
+        }
+
+        public bool Wait(int milliseconds)
+        {
+            return evt.WaitOne(milliseconds);
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~CountdownLatch()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // free managed resources
+                if (evt != null)
+                {
+                    evt.Close();
+                    evt = null;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericRequestor.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericRequestor.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericRequestor.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericRequestor.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using Avro.Generic;
+using Avro.IO;
+
+namespace Avro.ipc.Generic
+{
+    public class GenericRequestor : Requestor
+    {
+        public GenericRequestor(Transceiver transceiver,Protocol protocol)
+            : base(transceiver,protocol)
+        {
+        }
+
+        public override void WriteRequest(RecordSchema schema, object request, Encoder encoder)
+        {
+            new GenericWriter<object>(schema).Write(request, encoder);
+        }
+
+        public override object ReadResponse(Schema writer, Schema reader, Decoder decoder)
+        {
+            return new GenericReader<Object>(writer, reader).Read(null, decoder);
+        }
+
+        public override Exception ReadError(Schema writer, Schema reader, Decoder decoder)
+        {
+            object results = new GenericReader<Object>(writer, reader).Read(null, decoder);
+
+            return new Exception(results.ToString());
+        }
+    }
+}

Added: avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericResponder.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericResponder.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericResponder.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/Generic/GenericResponder.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using Avro.Generic;
+using Decoder = Avro.IO.Decoder;
+using Encoder = Avro.IO.Encoder;
+
+namespace Avro.ipc.Generic
+{
+    public abstract class GenericResponder : Responder
+    {
+        protected GenericResponder(Protocol protocol)
+            : base(protocol)
+        {
+        }
+
+        static protected DatumWriter<Object> GetDatumWriter(Schema schema)
+        {
+            return new GenericWriter<Object>(schema);
+        }
+
+        static protected DatumReader<Object> GetDatumReader(Schema actual, Schema expected)
+        {
+            return new GenericReader<Object>(actual, expected);
+        }
+
+        public override object ReadRequest(Schema actual, Schema expected, Decoder input)
+        {
+            return GetDatumReader(actual, expected).Read(null, input);
+        }
+
+        public override void WriteResponse(Schema schema, object response, Encoder output)
+        {
+            GetDatumWriter(schema).Write(response, output);
+        }
+    }
+}

Added: avro/trunk/lang/csharp/src/apache/ipc/LocalTransceiver.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/LocalTransceiver.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/LocalTransceiver.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/LocalTransceiver.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace Avro.ipc
+{
+    public class LocalTransceiver : Transceiver
+    {
+        private readonly Responder responder;
+
+        public LocalTransceiver(Responder responder)
+        {
+            if (responder == null) throw new ArgumentNullException("responder");
+
+            this.responder = responder;
+        }
+
+        public override string RemoteName
+        {
+            get { return "local"; }
+        }
+
+        public override IList<MemoryStream> Transceive(IList<MemoryStream> request)
+        {
+            return responder.Respond(request);
+        }
+
+        public override IList<MemoryStream> ReadBuffers()
+        {
+            throw new NotSupportedException();
+        }
+
+        public override void WriteBuffers(IList<MemoryStream> getBytes)
+        {
+            throw new NotSupportedException();
+        }
+    }
+}
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/OutputStream.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/OutputStream.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/OutputStream.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/OutputStream.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.IO;
+
+namespace Avro.ipc
+{
+    internal abstract class OutputStream : Stream
+    {
+        public override bool CanWrite
+        {
+            get { return true; }
+        }
+
+        public override bool CanRead
+        {
+            get { return false; }
+        }
+
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+        public override long Position
+        {
+            get { throw new NotSupportedException(); }
+            set { throw new NotSupportedException(); }
+        }
+
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            throw new NotSupportedException();
+        }
+
+        public override long Seek(long offset, SeekOrigin origin)
+        {
+            throw new NotSupportedException();
+        }
+
+        public override void SetLength(long value)
+        {
+            throw new NotSupportedException();
+        }
+    }
+}
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/Properties/AssemblyInfo.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/Properties/AssemblyInfo.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/Properties/AssemblyInfo.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Avro.ipc")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache")]
+[assembly: AssemblyProduct("Avro.ipc")]
+[assembly: AssemblyCopyright("Copyright © Apache 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: Guid("CC3EF4B8-52AA-47D9-B170-5BAAA57A38F3")]
+[assembly: AssemblyVersion("0.9.0.0")]
+[assembly: AssemblyFileVersion("0.9.0.0")]
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/Requestor.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/Requestor.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/Requestor.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/Requestor.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,428 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using Avro.Generic;
+using Avro.IO;
+using Avro.Specific;
+using org.apache.avro.ipc;
+
+namespace Avro.ipc
+{
+    public abstract class Requestor
+    {
+        private static readonly Schema Meta = MapSchema.CreateMap(PrimitiveSchema.NewInstance("bytes"));
+
+        private static readonly GenericReader<IDictionary<string, object>> MetaReader =
+            new GenericReader<IDictionary<string, object>>(Meta, Meta);
+
+        public static readonly GenericWriter<IDictionary<string, object>> MetaWriter =
+            new GenericWriter<IDictionary<string, object>>(Meta);
+
+        private static readonly Dictionary<String, MD5> RemoteHashes = new Dictionary<String, MD5>();
+        private static readonly Dictionary<MD5, Protocol> RemoteProtocols = new Dictionary<MD5, Protocol>();
+
+        private static readonly object remoteHashLock = new object();
+        private static readonly object remoteProtocolsLock = new object();
+
+        private static readonly SpecificWriter<HandshakeRequest> HandshakeWriter =
+            new SpecificWriter<HandshakeRequest>(new HandshakeRequest().Schema);
+         private static readonly SpecificReader<HandshakeResponse> HandshakeReader =
+            new SpecificReader<HandshakeResponse>(new HandshakeResponse().Schema, new HandshakeResponse().Schema);
+
+        protected readonly Transceiver transceiver;
+        private Protocol localProtocol;
+        private volatile Protocol remoteProtocol;
+        private volatile bool sendLocalText;
+
+        private readonly object handshakeLock = new object();
+        private Thread handshakeThread;
+
+        protected Requestor(Transceiver transceiver, Protocol protocol)
+        {
+            this.transceiver = transceiver;
+            localProtocol = protocol;
+        }
+
+        public Protocol Local
+        {
+            get { return localProtocol; }
+            protected set { localProtocol = value; }
+        }
+
+        public Transceiver Transceiver
+        {
+            get { return transceiver; }
+        }
+
+        public object Request(string messageName, object request)
+        {
+            transceiver.VerifyConnection();
+
+            var rpcRequest = new RpcRequest(messageName, request, new RpcContext());
+
+            CallFuture<Object> future =
+                GetMessage(rpcRequest).Oneway.GetValueOrDefault() ? null : new CallFuture<Object>();
+
+            Request(rpcRequest, future);
+
+            return future == null ? null : future.WaitForResult();
+        }
+
+            //    public void Request<TSpecificRecord, TCallback>(String messageName, Object request, ICallback<TCallback> callback)
+            //where TCallback : class
+            //where TSpecificRecord : class, ISpecificRecord
+        public void Request<T>(String messageName, Object request, ICallback<T> callback)
+        {
+            var rpcRequest = new RpcRequest(messageName, request, new RpcContext());
+
+            Request(rpcRequest, callback);
+        }
+
+        private void Request<T>(RpcRequest request, ICallback<T> callback)
+        {
+            Transceiver t = transceiver;
+            if (!t.IsConnected)
+            {
+                Monitor.Enter(handshakeLock);
+                handshakeThread  = Thread.CurrentThread;
+
+                try
+                {
+                    if (!t.IsConnected)
+                    {
+                        var callFuture = new CallFuture<T>(callback);
+                        IList<MemoryStream> bytes = request.GetBytes(Local, this);
+                        var transceiverCallback = new TransceiverCallback<T>(this, request, callFuture, Local);
+
+                        t.Transceive(bytes, transceiverCallback);
+
+                        // Block until handshake complete
+                        callFuture.Wait();
+                        Message message = GetMessage(request);
+                        if (message.Oneway.GetValueOrDefault())
+                        {
+                            Exception error = callFuture.Error;
+                            if (error != null)
+                            {
+                                throw error;
+                            }
+                        }
+                        return;
+                    }
+
+                }
+                finally
+                {
+                    if (Thread.CurrentThread == handshakeThread)
+                    {
+                        handshakeThread = null;
+                        Monitor.Exit(handshakeLock);
+                    }
+                }
+            }
+
+            if (GetMessage(request).Oneway.GetValueOrDefault())
+            {
+                t.LockChannel();
+                try
+                {
+                    IList<MemoryStream> bytes = request.GetBytes(Local, this);
+                    t.WriteBuffers(bytes);
+                    if (callback != null)
+                    {
+                        callback.HandleResult(default(T));
+                    }
+                }
+                finally
+                {
+                    t.UnlockChannel();
+                }
+            }
+            else
+            {
+                IList<MemoryStream> bytes = request.GetBytes(Local, this);
+                var transceiverCallback = new TransceiverCallback<T>(this, request, callback, Local);
+
+                t.Transceive(bytes, transceiverCallback);
+
+                //if (Thread.CurrentThread == handshakeThread)
+                //{
+                //    Monitor.Exit(handshakeLock);
+                //}
+            }
+        }
+
+        private Message GetMessage(RpcRequest request)
+        {
+            return request.GetMessage(Local);
+        }
+
+        public abstract void WriteRequest(RecordSchema schema, Object request, Encoder encoder);
+        public abstract object ReadResponse(Schema writer, Schema reader, Decoder decoder);
+        public abstract Exception ReadError(Schema writer, Schema reader, Decoder decoder);
+
+
+        public void WriteHandshake(Encoder outEncoder)
+        {
+            if (transceiver.IsConnected) return;
+
+            var localHash = new MD5 {Value = localProtocol.MD5};
+
+            String remoteName = transceiver.RemoteName;
+            MD5 remoteHash;// = RemoteHashes[remoteName];
+
+            lock (remoteHashLock)
+            {
+                if (!RemoteHashes.TryGetValue(remoteName, out remoteHash))
+                {
+                    // guess remote is local
+                    remoteHash = localHash;
+                    remoteProtocol = localProtocol;
+                }
+            }
+
+            if (remoteProtocol == null)
+            {
+                lock (remoteProtocolsLock)
+                {
+                    remoteProtocol = RemoteProtocols[remoteHash];
+                }
+            }
+
+            var handshake = new HandshakeRequest {clientHash = localHash, serverHash = remoteHash};
+
+            if (sendLocalText)
+                handshake.clientProtocol = localProtocol.ToString();
+
+            var context = new RpcContext {HandshakeRequest = handshake};
+
+            handshake.meta = context.RequestHandshakeMeta;
+
+            HandshakeWriter.Write(handshake, outEncoder);
+        }
+
+        private void setRemote(HandshakeResponse handshake)
+        {
+            remoteProtocol = Protocol.Parse(handshake.serverProtocol);
+
+            MD5 remoteHash = handshake.serverHash;
+            lock (remoteHashLock)
+            {
+                RemoteHashes[transceiver.RemoteName] = remoteHash;
+            }
+            lock (remoteProtocolsLock)
+            {
+                RemoteProtocols[remoteHash] = remoteProtocol;
+            }
+        }
+
+        public Protocol GetRemote()
+        {
+            if (remoteProtocol != null) return remoteProtocol; // already have it
+
+            lock (remoteHashLock)
+            {
+                MD5 remoteHash;
+                if (RemoteHashes.TryGetValue(transceiver.RemoteName, out remoteHash))
+                {
+                    lock (remoteProtocolsLock)
+                    {
+                        remoteProtocol = RemoteProtocols[remoteHash];
+                        if (remoteProtocol != null) return remoteProtocol; // already cached
+                    }
+                }
+            }
+
+            Monitor.Enter(handshakeLock);
+
+            try
+            {
+                // force handshake
+                var bbo = new ByteBufferOutputStream();
+                // direct because the payload is tiny.
+                Encoder outp = new BinaryEncoder(bbo);
+
+                WriteHandshake(outp);
+                outp.WriteInt(0); // empty metadata
+                outp.WriteString(""); // bogus message name
+                IList<MemoryStream> response = Transceiver.Transceive(bbo.GetBufferList());
+
+                var bbi = new ByteBufferInputStream(response);
+                var inp = new BinaryDecoder(bbi);
+
+                ReadHandshake(inp);
+                return remoteProtocol;
+            }
+            finally
+            {
+                Monitor.Exit(handshakeLock);
+            }
+        }
+
+        private bool ReadHandshake(BinaryDecoder input)
+        {
+            if (Transceiver.IsConnected) return true;
+            bool established = false;
+
+            HandshakeResponse handshake = HandshakeReader.Read(null, input);
+
+            switch (handshake.match)
+            {
+                case HandshakeMatch.BOTH:
+                    established = true;
+                    sendLocalText = false;
+                    break;
+                case HandshakeMatch.CLIENT:
+                    setRemote(handshake);
+                    established = true;
+                    sendLocalText = false;
+                    break;
+                case HandshakeMatch.NONE:
+                    setRemote(handshake);
+                    sendLocalText = true;
+                    break;
+                default:
+                    throw new AvroRuntimeException("Unexpected match: " + handshake.match);
+            }
+
+            if (established)
+                transceiver.Remote = remoteProtocol;
+            return established;
+        }
+
+        private class Response
+        {
+            private readonly Requestor requestor;
+            private readonly RpcRequest request;
+            private readonly BinaryDecoder input;
+
+            public Response(Requestor requestor, RpcRequest request, BinaryDecoder input)
+            {
+                this.requestor = requestor;
+                this.request = request;
+                this.input = input;
+            }
+
+            public Object getResponse()
+            {
+                Message lm = request.GetMessage(requestor.Local);
+                Message rm;
+                if (!requestor.remoteProtocol.Messages.TryGetValue(request.GetMessage(requestor.Local).Name, out rm))
+                    throw new AvroRuntimeException
+                        ("Not a remote message: " + request.GetMessage(requestor.Local).Name);
+
+                Transceiver t = requestor.Transceiver;
+                if ((lm.Oneway.GetValueOrDefault() != rm.Oneway.GetValueOrDefault()) && t.IsConnected)
+                    throw new AvroRuntimeException
+                        ("Not both one-way messages: " + request.GetMessage(requestor.Local));
+
+                if (lm.Oneway.GetValueOrDefault() && t.IsConnected) return null; // one-way w/ handshake
+
+                RpcContext context = request.Context;
+                context.ResponseCallMeta = MetaReader.Read(null, input);
+
+                if (!input.ReadBoolean())
+                {
+                    // no error
+                    Object response = requestor.ReadResponse(rm.Response, lm.Response, input);
+                    context.Response = response;
+
+                    return response;
+                }
+
+                Exception error = requestor.ReadError(rm.SupportedErrors, lm.SupportedErrors, input);
+                context.Error = error;
+
+                throw error;
+            }
+        }
+
+
+        private class TransceiverCallback<T> : ICallback<IList<MemoryStream>> 
+        {
+            private readonly Requestor requestor;
+            private readonly RpcRequest request;
+            private readonly ICallback<T> callback;
+            private readonly Protocol local;
+
+            public TransceiverCallback(Requestor requestor, RpcRequest request, ICallback<T> callback,
+                                       Protocol local)
+            {
+                this.requestor = requestor;
+                this.request = request;
+                this.callback = callback;
+                this.local = local;
+            }
+
+            public void HandleResult(IList<MemoryStream> result)
+            {
+                var bbi = new ByteBufferInputStream(result);
+                var input = new BinaryDecoder(bbi);
+
+                if (!requestor.ReadHandshake(input))
+                {
+                    // Resend the handshake and return
+                    var handshake = new RpcRequest(request);
+
+                    IList<MemoryStream> requestBytes = handshake.GetBytes(requestor.Local, requestor);
+                    var transceiverCallback = new TransceiverCallback<T>(requestor, handshake, callback,
+                                                                            local);
+
+                    requestor.Transceiver.Transceive(requestBytes, transceiverCallback);
+                    return;
+                }
+
+                // Read response; invoke callback
+                var response = new Response(requestor, request, input);
+                try
+                {
+                    Object responseObject;
+                    try
+                    {
+                        responseObject = response.getResponse();
+                    }
+                    catch (Exception e)
+                    {
+                        if (callback != null)
+                        {
+                            callback.HandleException(e);
+                        }
+                        return;
+                    }
+                    if (callback != null)
+                    {
+                        callback.HandleResult((T) responseObject);
+                    }
+                }
+                catch
+                {
+                    //LOG.error("Error in callback handler: " + t, t);
+                }
+            }
+
+            public void HandleException(Exception exception)
+            {
+                callback.HandleException(exception);
+            }
+        }
+    }
+}

Added: avro/trunk/lang/csharp/src/apache/ipc/Responder.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/Responder.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/Responder.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/Responder.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,232 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Avro.Generic;
+using Avro.IO;
+using Avro.Specific;
+using log4net;
+using org.apache.avro.ipc;
+
+namespace Avro.ipc
+{
+    public abstract class Responder
+    {
+        private static readonly ILog log = LogManager.GetLogger(typeof (Responder));
+
+        private static readonly Schema META = MapSchema.CreateMap(PrimitiveSchema.NewInstance("bytes"));
+
+        private static readonly GenericReader<Dictionary<String, object>>
+            META_READER = new GenericReader<Dictionary<String, object>>(META, META);
+
+        private static readonly GenericWriter<IDictionary<String, object>>
+            META_WRITER = new GenericWriter<IDictionary<String, object>>(META);
+
+        private readonly SpecificReader<HandshakeRequest> handshakeReader =
+            new SpecificReader<HandshakeRequest>(new HandshakeRequest().Schema, new HandshakeRequest().Schema);
+
+        private readonly SpecificWriter<HandshakeResponse> handshakeWriter =
+            new SpecificWriter<HandshakeResponse>(new HandshakeResponse().Schema);
+
+        private readonly Protocol local;
+        private readonly MD5 localHash;
+        private readonly IDictionary<Schema, Protocol> protocols = new Dictionary<Schema, Protocol>();
+        private readonly object protocolsLock = new object();
+
+        protected Responder(Protocol local)
+        {
+            this.local = local;
+            localHash = new MD5 {Value = local.MD5};
+
+            lock (protocolsLock)
+            {
+                protocols[localHash.Schema] = local;
+            }
+        }
+        
+        public Protocol Local
+        {
+            get { return local; }
+        }
+
+        public abstract Object Respond(Message message, Object request);
+        public abstract Object ReadRequest(Schema actual, Schema expected, Decoder input);
+
+        public abstract void WriteResponse(Schema schema, Object response, Encoder output);
+        public abstract void WriteError(Schema schema, Object error, Encoder output);
+
+        public IList<MemoryStream> Respond(IList<MemoryStream> buffers)
+        {
+            return Respond(buffers, null);
+        }
+
+        private Protocol Handshake(Decoder input, Encoder output, Transceiver connection)
+        {
+            if (connection != null && connection.IsConnected)
+                return connection.Remote;
+            HandshakeRequest request = handshakeReader.Read(null, input);
+
+            Protocol remote;
+            lock (protocolsLock)
+            {
+                remote = protocols[request.clientHash.Schema];
+                if (remote == null && request.clientProtocol != null)
+                {
+                    remote = Protocol.Parse(request.clientProtocol);
+                    protocols[request.clientHash.Schema] = remote;
+                }
+            }
+            var response = new HandshakeResponse();
+            if (localHash.Schema.Equals(request.serverHash.Schema))
+            {
+                response.match =
+                    remote == null ? HandshakeMatch.NONE : HandshakeMatch.BOTH;
+            }
+            else
+            {
+                response.match =
+                    remote == null ? HandshakeMatch.NONE : HandshakeMatch.CLIENT;
+            }
+            if (response.match != HandshakeMatch.BOTH)
+            {
+                response.serverProtocol = local.ToString();
+                response.serverHash = localHash;
+            }
+
+            handshakeWriter.Write(response, output);
+
+            if (connection != null && response.match != HandshakeMatch.NONE)
+                connection.Remote = remote;
+
+            return remote;
+        }
+
+        public IList<MemoryStream> Respond(IList<MemoryStream> buffers,
+                                          Transceiver connection)
+        {
+            Decoder input = new BinaryDecoder(new ByteBufferInputStream(buffers));
+
+            var bbo = new ByteBufferOutputStream();
+            var output = new BinaryEncoder(bbo);
+            Exception error = null;
+            var context = new RpcContext();
+            List<MemoryStream> handshake = null;
+
+            bool wasConnected = connection != null && connection.IsConnected;
+            try
+            {
+                Protocol remote = Handshake(input, output, connection);
+                output.Flush();
+                if (remote == null) // handshake failed
+                    return bbo.GetBufferList();
+                handshake = bbo.GetBufferList();
+
+                // read request using remote protocol specification
+                context.RequestCallMeta = META_READER.Read(null, input);
+                String messageName = input.ReadString();
+                if (messageName.Equals("")) // a handshake ping
+                    return handshake;
+                Message rm = remote.Messages[messageName];
+                if (rm == null)
+                    throw new AvroRuntimeException("No such remote message: " + messageName);
+                Message m = Local.Messages[messageName];
+                if (m == null)
+                    throw new AvroRuntimeException("No message named " + messageName
+                                                   + " in " + Local);
+
+                Object request = ReadRequest(rm.Request, m.Request, input);
+
+                context.Message = rm;
+
+                // create response using local protocol specification
+                if ((m.Oneway.GetValueOrDefault() != rm.Oneway.GetValueOrDefault()) && wasConnected)
+                    throw new AvroRuntimeException("Not both one-way: " + messageName);
+
+                Object response = null;
+
+                try
+                {
+                    response = Respond(m, request);
+                    context.Response = response;
+                }
+                catch (Exception e)
+                {
+                    error = e;
+                    context.Error = error;
+                    log.Warn("user error", e);
+                }
+
+                if (m.Oneway.GetValueOrDefault() && wasConnected) // no response data
+                    return null;
+
+                output.WriteBoolean(error != null);
+                if (error == null)
+                    WriteResponse(m.Response, response, output);
+                else
+                {
+                    WriteError(m.Error, error, output);
+                }
+            }
+            catch (Exception e)
+            {
+                // system error
+                log.Warn("system error", e);
+                context.Error = e;
+                bbo = new ByteBufferOutputStream();
+                output = new BinaryEncoder(bbo);
+                output.WriteBoolean(true);
+
+                WriteError(errorSchema /*Protocol.SYSTEM_ERRORS*/, e.ToString(), output);
+                if (null == handshake)
+                {
+                    handshake = new ByteBufferOutputStream().GetBufferList();
+                }
+            }
+
+            output.Flush();
+            List<MemoryStream> payload = bbo.GetBufferList();
+
+            // Grab meta-data from plugins
+            context.ResponsePayload = payload;
+
+            META_WRITER.Write(context.ResponseCallMeta, output);
+            output.Flush();
+            // Prepend handshake and append payload
+            bbo.Prepend(handshake);
+            bbo.Append(payload);
+
+            return bbo.GetBufferList();
+        }
+
+        static StringSchema errorSchema = new StringSchema();
+          private class StringSchema : Schema {
+              
+              public StringSchema() : base(Type.String, new PropertyMap())
+              {
+              }
+
+              public override string Name
+              {
+                  get { return "String"; }
+              }
+          }
+
+    }
+}
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/RpcContext.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/RpcContext.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/RpcContext.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/RpcContext.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,143 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using org.apache.avro.ipc;
+
+namespace Avro.ipc
+{
+    public class RpcContext
+    {
+        private Exception _error;
+        private IDictionary<String, object> _requestCallMeta;
+        private Object _response;
+        private IDictionary<String, object> _responseCallMeta;
+
+        public HandshakeRequest HandshakeRequest { get; set; }
+        public HandshakeResponse HandshakeResponse { get; set; }
+
+        public IList<MemoryStream> RequestPayload { get; set; }
+        public IList<MemoryStream> ResponsePayload { get; set; }
+
+        public Exception Error
+        {
+            set
+            {
+                _response = null;
+                _error = value;
+            }
+            get { return _error; }
+        }
+
+        public Object Response
+        {
+            set
+            {
+                _response = value;
+                _error = null;
+            }
+
+            get { return _response; }
+        }
+
+
+        public IDictionary<String, byte[]> RequestHandshakeMeta
+        {
+            set { HandshakeRequest.meta = value; }
+
+            get
+            {
+                if (HandshakeRequest.meta == null)
+                    HandshakeRequest.meta = new Dictionary<String, byte[]>();
+
+                return HandshakeRequest.meta;
+            }
+        }
+
+
+        public IDictionary<String, byte[]> ResponseHandshakeMeta
+        {
+            set { HandshakeResponse.meta = value; }
+
+            get
+            {
+                if (HandshakeResponse.meta == null)
+                    HandshakeResponse.meta = new Dictionary<String, byte[]>();
+
+                return HandshakeResponse.meta;
+            }
+        }
+
+        /**
+         * This is an access method for the per-call state
+         * provided by the client to the server.
+         * @return a map representing per-call state from
+         * the client to the server
+         */
+
+        public IDictionary<String, object> RequestCallMeta
+        {
+            get
+            {
+                if (_requestCallMeta == null)
+                {
+                    _requestCallMeta = new Dictionary<string, object>();
+                }
+                return _requestCallMeta;
+            }
+            set { _requestCallMeta = value; }
+        }
+
+
+        /**
+         * This is an access method for the per-call state
+         * provided by the server back to the client.
+         * @return a map representing per-call state from
+         * the server to the client
+         */
+
+        public IDictionary<String, object> ResponseCallMeta
+        {
+            get
+            {
+                if (_responseCallMeta == null)
+                {
+                    _responseCallMeta = new Dictionary<String, object>();
+                }
+                return _responseCallMeta;
+            }
+            set { _responseCallMeta = value; }
+        }
+
+        /**
+         * Indicates whether an exception was generated
+         * at the server
+         * @return true is an exception was generated at
+         * the server, or false if not
+         */
+
+        public bool IsError
+        {
+            get { return Error != null; }
+        }
+
+        public Message Message { get; set; }
+    }
+}
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/RpcRequest.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/RpcRequest.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/RpcRequest.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/RpcRequest.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Avro.IO;
+
+namespace Avro.ipc
+{
+    public class RpcRequest
+    {
+        private readonly String messageName;
+        private readonly Object request;
+        private readonly RpcContext context;
+
+        private Message message;
+        private List<MemoryStream> requestBytes;
+
+        public RpcRequest(string messageName, object request, RpcContext rpcContext)
+        {
+            if (messageName == null) throw new ArgumentNullException("messageName");
+            if (request == null) throw new ArgumentNullException("request");
+            if (rpcContext == null) throw new ArgumentNullException("rpcContext");
+
+            this.messageName = messageName;
+            this.request = request;
+            context = rpcContext;
+        }
+
+        public RpcRequest(RpcRequest request)
+            : this(request.messageName, request.request, request.Context)
+        {
+        }
+
+        public RpcContext Context
+        {
+            get { return context; }
+        }
+
+
+        public Message GetMessage(Protocol local)
+        {
+            if (message == null)
+            {
+                message = local.Messages[messageName];
+                if (message == null)
+                {
+                    throw new AvroRuntimeException("Not a local message: " + messageName);
+                }
+            }
+            return message;
+        }
+
+        public IList<MemoryStream> GetBytes(Protocol local, Requestor requestor)
+        {
+            if (local == null) throw new ArgumentNullException("local");
+            if (requestor == null) throw new ArgumentNullException("requestor");
+
+            if (requestBytes == null)
+            {
+                using (var bbo = new ByteBufferOutputStream())
+                {
+                    var o = new BinaryEncoder(bbo);
+
+                    // use local protocol to write request
+                    Message m = GetMessage(local);
+                    Context.Message = m;
+
+                    requestor.WriteRequest(m.Request, request, o); // write request payload
+
+                    o.Flush();
+                    List<MemoryStream> payload = bbo.GetBufferList();
+
+                    requestor.WriteHandshake(o); // prepend handshake if needed
+
+                    Context.RequestPayload = payload;
+
+                    IDictionary<string, object> responseCallMeta = Context.ResponseCallMeta;
+                    Requestor.MetaWriter.Write(responseCallMeta, o);
+
+                    o.WriteString(m.Name); // write message name
+                    o.Flush();
+
+                    bbo.Append(payload);
+
+                    requestBytes = bbo.GetBufferList();
+                }
+            }
+
+            return requestBytes;
+        }
+    }
+}
\ No newline at end of file

Added: avro/trunk/lang/csharp/src/apache/ipc/SocketServer.cs
URL: http://svn.apache.org/viewvc/avro/trunk/lang/csharp/src/apache/ipc/SocketServer.cs?rev=1515933&view=auto
==============================================================================
--- avro/trunk/lang/csharp/src/apache/ipc/SocketServer.cs (added)
+++ avro/trunk/lang/csharp/src/apache/ipc/SocketServer.cs Tue Aug 20 19:13:39 2013
@@ -0,0 +1,235 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+
+namespace Avro.ipc
+{
+    public class SocketServer
+    {
+        public static ManualResetEvent allDone = new ManualResetEvent(false);
+        private readonly string hostName;
+        private readonly int port;
+        private Responder responder;
+        private bool cancellationRequested;
+        private Socket channel;
+        private List<Socket> sockets = new List<Socket>();
+        private Thread serverThread;
+
+        public SocketServer(string hostName, int port, Responder responder = null)
+        {
+            if (hostName == null) throw new ArgumentNullException("hostName");
+            if (port < 0) throw new ArgumentOutOfRangeException("port");
+
+            this.responder = responder;
+            this.hostName = hostName;
+            this.port = port;
+        }
+
+        public bool IsBound
+        {
+            get { return channel.IsBound; }
+        }
+
+        public int Port
+        {
+            get { return ((IPEndPoint) channel.LocalEndPoint).Port; }
+        }
+
+        public void SetResponder(Responder responder)
+        {
+            this.responder = responder;
+        }
+
+        public void Start()
+        {
+            channel = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+
+            serverThread = new Thread(Run);
+            serverThread.Start();
+
+            while (!IsBound)
+            {
+                Thread.Sleep(10);
+            }
+        }
+
+        public void Stop()
+        {
+            cancellationRequested = true;
+            
+            while (serverThread.IsAlive)
+            {
+                Thread.Sleep(10);
+            }
+        }
+
+        private void Run()
+        {
+            IPHostEntry host = Dns.GetHostEntry(hostName);
+            IPAddress ipAddress =
+                host.AddressList.FirstOrDefault(x => x.AddressFamily == AddressFamily.InterNetwork);
+
+            if (ipAddress == null)
+                throw new InvalidDataException(
+                    string.Format("There is not IP Address with the hostname {0} and AddressFamily InterNetwork",
+                                  hostName));
+
+            var localEndPoint = new IPEndPoint(ipAddress, port);
+
+            channel.Bind(localEndPoint);
+            channel.Listen(100);
+
+            var results = new List<IAsyncResult>();
+            while (true)
+            {
+                // Set the event to nonsignaled state.
+                allDone.Reset();
+
+                // Start an asynchronous socket to listen for connections.
+                IAsyncResult t = channel.BeginAccept(AcceptCallback, channel);
+                results.Add(t);
+
+                // Wait until a connection is made before continuing.
+                while (!allDone.WaitOne(1000))
+                {
+                    if (cancellationRequested)
+                    {
+                        try
+                        {
+                            channel.Close();
+                        }
+                        catch
+                        {
+                        }
+
+                        try
+                        {
+                            CloseSockets();
+                        }
+                        catch
+                        {
+                        }
+
+                        return;
+                    }
+                }
+            }
+        }
+
+        private void CloseSockets()
+        {
+            lock (this)
+            {
+                try
+                {
+                    foreach (var socket in sockets)
+                    {
+                        var myOpts = new LingerOption(true, 1);
+                        socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true);
+                        socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, myOpts);
+                        socket.SendTimeout = 1;
+                        socket.ReceiveTimeout = 1;
+                        socket.Shutdown(SocketShutdown.Both);
+                        socket.Disconnect(false);
+                    }
+                    sockets = new List<Socket>();
+                }
+                catch (Exception)
+                {
+                }
+            }
+        }
+
+        public void AddSocket(Socket socket)
+        {
+            lock (this)
+            {
+                sockets.Add(socket);
+            }
+        }
+
+        public void RemoveSocket(Socket socket)
+        {
+            lock (this)
+            {
+                sockets.Remove(socket);
+            }
+        }
+
+        private void AcceptCallback(IAsyncResult ar)
+        {
+            // Signal the main thread to continue.
+            allDone.Set();
+
+            // Get the socket that handles the client request.
+            var listener = (Socket) ar.AsyncState;
+
+            if (cancellationRequested)
+            {
+                return;
+            }
+
+            Socket socket = listener.EndAccept(ar);
+            AddSocket(socket);
+
+            // Create the state object.
+            var xc = new SocketTransceiver(socket);
+
+            while (true)
+            {
+                try
+                {
+                    IList<MemoryStream> request = xc.ReadBuffers();
+                    IList<MemoryStream> response = responder.Respond(request, xc);
+                    xc.WriteBuffers(response);
+                }
+                catch (ObjectDisposedException)
+                {
+                    break;
+                }
+                catch (SocketException)
+                {
+                    break;
+                }
+                catch (AvroRuntimeException)
+                {
+                    break;
+                }
+                catch (Exception)
+                {
+                    break;
+                }
+            }
+
+            try
+            {
+                xc.Disconnect();
+            }
+            catch (Exception) { }
+
+            RemoveSocket(socket);
+        }
+    }
+}
\ No newline at end of file



Mime
View raw message