Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Skiba <andrews@mono-cvs.ximian.com>2006-11-08 15:34:58 +0300
committerAndrew Skiba <andrews@mono-cvs.ximian.com>2006-11-08 15:34:58 +0300
commit901e94e1e8557660f3100af5dd2b6aa27eb34ce8 (patch)
tree073d6c0dd6d328331734e7a6ab2fa390cc0aafbc
parentb309d37d4014554dccb3de013c67a62604b2cac7 (diff)
compile System.dll in GH
svn path=/trunk/mcs/; revision=67512
-rw-r--r--mcs/class/System/ChangeLog12
-rw-r--r--mcs/class/System/System.J2EE20.sln32
-rw-r--r--mcs/class/System/System.J2EE20.vmwcsproj980
-rw-r--r--mcs/class/System/System.Net.Sockets/GHSocket.cs63
-rw-r--r--mcs/class/System/System.Net.Sockets/GHSocketFactory.cs198
-rw-r--r--mcs/class/System/System.Net.Sockets/GHStreamSocket.cs1269
-rw-r--r--mcs/class/System/System.Net.Sockets/GHStreamSocketSSL.cs620
-rw-r--r--mcs/class/System/System.Net.Sockets/Socket.jvm.cs2249
-rw-r--r--mcs/class/System/System.Net/HttpProvider.cs330
-rw-r--r--mcs/class/System/System.Net/HttpStateCache.cs43
-rw-r--r--mcs/class/System/System.Net/HttpWebRequest.jvm.cs605
-rw-r--r--mcs/class/System/System.Net/HttpWebResponse.jvm.cs515
-rw-r--r--mcs/class/System/System.Net/ServicePoint.cs4
-rw-r--r--mcs/class/System/System.Net/VMWHttpProvider.cs1071
-rw-r--r--mcs/class/System/System.Security.AccessControl/SemaphoreAuditRule.cs2
-rw-r--r--mcs/class/System/machine.config445
16 files changed, 8436 insertions, 2 deletions
diff --git a/mcs/class/System/ChangeLog b/mcs/class/System/ChangeLog
index 5904e8264f5..cdd991580b6 100644
--- a/mcs/class/System/ChangeLog
+++ b/mcs/class/System/ChangeLog
@@ -1,3 +1,15 @@
+2006-11-07 Andrew Skiba <andrews@mainsoft.com>
+
+ * System.Security.AccessControl/SemaphoreAuditRule.cs,
+ System.Net/HttpWebRequest.jvm.cs, System.Net/VMWHttpProvider.cs,
+ System.Net/HttpWebResponse.jvm.cs, System.Net/HttpStateCache.cs,
+ System.Net/HttpProvider.cs, System.Net/ServicePoint.cs,
+ System.Net.Sockets/Socket.jvm.cs, System.Net.Sockets/GHStreamSocket.cs,
+ System.Net.Sockets/GHSocketFactory.cs, System.Net.Sockets/GHStreamSocketSSL.cs,
+ System.Net.Sockets/GHSocket.cs, System.J2EE20.vmwcsproj,
+ System.J2EE20.sln, machine.config: add files and TARGET_JVM-s to compile
+ System.dll in GH.
+
2006-11-07 Sebastien Pouliot <sebastien@ximian.com>
* System_test.dll.sources: Add unit tests for System.ComponentModel.
diff --git a/mcs/class/System/System.J2EE20.sln b/mcs/class/System/System.J2EE20.sln
new file mode 100644
index 00000000000..8e39fc41624
--- /dev/null
+++ b/mcs/class/System/System.J2EE20.sln
@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{83B010C7-76FC-4FAD-A26C-00D7EFE60256}") = "System.J2EE20", "System.J2EE20.vmwcsproj", "{25EA16E1-E3B8-4433-8533-23B0FB0F93BA}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug_Java|Any CPU = Debug_Java|Any CPU
+ Debug_Java20_bootstrap|Any CPU = Debug_Java20_bootstrap|Any CPU
+ Debug_Java20|Any CPU = Debug_Java20|Any CPU
+ Release_Java|Any CPU = Release_Java|Any CPU
+ Release_Java20_bootstrap|Any CPU = Release_Java20_bootstrap|Any CPU
+ Release_Java20|Any CPU = Release_Java20|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Debug_Java|Any CPU.ActiveCfg = Debug_Java|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Debug_Java|Any CPU.Build.0 = Debug_Java|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Debug_Java20_bootstrap|Any CPU.ActiveCfg = Debug_Java20_bootstrap|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Debug_Java20_bootstrap|Any CPU.Build.0 = Debug_Java20_bootstrap|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Debug_Java20|Any CPU.ActiveCfg = Debug_Java20|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Debug_Java20|Any CPU.Build.0 = Debug_Java20|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Release_Java|Any CPU.ActiveCfg = Release_Java|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Release_Java|Any CPU.Build.0 = Release_Java|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Release_Java20_bootstrap|Any CPU.ActiveCfg = Release_Java20_bootstrap|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Release_Java20_bootstrap|Any CPU.Build.0 = Release_Java20_bootstrap|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Release_Java20|Any CPU.ActiveCfg = Release_Java20|Any CPU
+ {25EA16E1-E3B8-4433-8533-23B0FB0F93BA}.Release_Java20|Any CPU.Build.0 = Release_Java20|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/class/System/System.J2EE20.vmwcsproj b/mcs/class/System/System.J2EE20.vmwcsproj
new file mode 100644
index 00000000000..5fc5b3eea5c
--- /dev/null
+++ b/mcs/class/System/System.J2EE20.vmwcsproj
@@ -0,0 +1,980 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Java20_bootstrap|AnyCPU' ">
+ <OutputPath>bin\Release_Java20_bootstrap\</OutputPath>
+ <DefineConstants>TRACE;TARGET_JVM;NET_1_1;NET_2_0</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <SkipValidation>True</SkipValidation>
+ <KeepIntermediate>False</KeepIntermediate>
+ <GHProjectType>1</GHProjectType>
+ <PreCompile>false</PreCompile>
+ <AdditionalClassPath>
+ </AdditionalClassPath>
+ <ApplicationServerType>
+ </ApplicationServerType>
+ <Version>2.0</Version>
+ <JDKName>1.5.0_05</JDKName>
+ <jarserver>iap2</jarserver>
+ <TargetPlatform>0</TargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Java20|AnyCPU' ">
+ <OutputPath>bin\Release_Java20\</OutputPath>
+ <DefineConstants>TRACE;TARGET_JVM;NET_1_1;NET_2_0;XML_DEP;CONFIGURATION_DEP;CONFIGURATION_2_0</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <SkipValidation>False</SkipValidation>
+ <KeepIntermediate>False</KeepIntermediate>
+ <GHProjectType>1</GHProjectType>
+ <PreCompile>false</PreCompile>
+ <AdditionalClassPath>
+ </AdditionalClassPath>
+ <ApplicationServerType>
+ </ApplicationServerType>
+ <Version>2.0</Version>
+ <JDKName>1.5.0_05</JDKName>
+ <jarserver>iap2</jarserver>
+ <TargetPlatform>0</TargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug_Java</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{25EA16E1-E3B8-4433-8533-23B0FB0F93BA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <AssemblyName>System</AssemblyName>
+ <JDKName>1.5.0_05</JDKName>
+ <GHProjectType>1</GHProjectType>
+ <Version>2.0</Version>
+ <RootNamespace>System</RootNamespace>
+ <jarserver>iap2</jarserver>
+ <StartupObject>
+ </StartupObject>
+ <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Java|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug_Java\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;TARGET_JVM;NET_1_1;ONLY_1_1;XML_DEP;CONFIGURATION_DEP</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <BaseAddress>285212672</BaseAddress>
+ <SkipValidation>True</SkipValidation>
+ <KeepIntermediate>False</KeepIntermediate>
+ <TargetPlatform>0</TargetPlatform>
+ <AdditionalClassPath>
+ </AdditionalClassPath>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Java|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release_Java\</OutputPath>
+ <DefineConstants>TRACE;TARGET_JVM;NET_1_1;ONLY_1_1;XML_DEP;CONFIGURATION_DEP</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <BaseAddress>285212672</BaseAddress>
+ <SkipValidation>false</SkipValidation>
+ <KeepIntermediate>false</KeepIntermediate>
+ <TargetPlatform>0</TargetPlatform>
+ <AdditionalClassPath>
+ </AdditionalClassPath>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Java20|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug_Java20\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;TARGET_JVM;NET_1_1;NET_2_0;XML_DEP;CONFIGURATION_DEP;CONFIGURATION_2_0</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <SkipValidation>True</SkipValidation>
+ <KeepIntermediate>False</KeepIntermediate>
+ <GHProjectType>1</GHProjectType>
+ <PreCompile>false</PreCompile>
+ <AdditionalClassPath>
+ </AdditionalClassPath>
+ <ApplicationServerType>
+ </ApplicationServerType>
+ <Version>2.0</Version>
+ <JDKName>1.5.0_05</JDKName>
+ <jarserver>iap2</jarserver>
+ <TargetPlatform>0</TargetPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Java20_bootstrap|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug_Java20_bootstrap\</OutputPath>
+ <DefineConstants>TRACE;TARGET_JVM;NET_1_1;NET_2_0;DEBUG</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <SkipValidation>false</SkipValidation>
+ <KeepIntermediate>false</KeepIntermediate>
+ <GHProjectType>1</GHProjectType>
+ <PreCompile>false</PreCompile>
+ <AdditionalClassPath>
+ </AdditionalClassPath>
+ <ApplicationServerType>
+ </ApplicationServerType>
+ <Version>2.0</Version>
+ <JDKName>1.5.0_05</JDKName>
+ <jarserver>iap2</jarserver>
+ <TargetPlatform>0</TargetPlatform>
+ </PropertyGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.csharp.targets" />
+ <Import Project="$(VMW_HOME)\bin\Mainsoft.Common.targets" />
+ <!-- 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="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ProjectExtensions>
+ <VisualStudio>
+ <UserProperties REFS-JarPath-apache_http_client="..\lib\apache_http_client.jar" REFS-JarPath-system-configuration="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Configuration.jar" REFS-JarPath-rt="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jre5\lib\rt.jar" REFS-JarPath-mscorlib="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\mscorlib.jar" REFS-JarPath-j2se-helpers="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\J2SE.Helpers.jar" REFS-JarPath-system-xml="..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE V2\jgac\vmw4j2ee_110\System.Xml.jar" />
+ </VisualStudio>
+ </ProjectExtensions>
+ <ItemGroup>
+ <Reference Include="apache_http_client, Version=0.0.0.0, Culture=neutral">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>Refs\apache_http_client.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="J2SE.Helpers">
+ <Private>False</Private>
+ <HintPath>..\lib\J2SE.Helpers.dll</HintPath>
+ </Reference>
+ <Reference Include="rt, Version=0.0.0.0, Culture=neutral">
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="System.configuration" />
+ <Reference Include="System.XML" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\build\common\Consts.cs">
+ <Link>Consts.cs</Link>
+ </Compile>
+ <Compile Include="..\..\build\common\Locale.cs">
+ <Link>Locale.cs</Link>
+ </Compile>
+ <Compile Include="..\..\build\common\MonoTODOAttribute.cs">
+ <Link>MonoTODOAttribute.cs</Link>
+ </Compile>
+ <Compile Include="System.CodeDom\CodeArgumentReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeArrayCreateExpression.cs" />
+ <Compile Include="System.CodeDom\CodeArrayIndexerExpression.cs" />
+ <Compile Include="System.CodeDom\CodeAssignStatement.cs" />
+ <Compile Include="System.CodeDom\CodeAttachEventStatement.cs" />
+ <Compile Include="System.CodeDom\CodeAttributeArgument.cs" />
+ <Compile Include="System.CodeDom\CodeAttributeArgumentCollection.cs" />
+ <Compile Include="System.CodeDom\CodeAttributeDeclaration.cs" />
+ <Compile Include="System.CodeDom\CodeAttributeDeclarationCollection.cs" />
+ <Compile Include="System.CodeDom\CodeBaseReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeBinaryOperatorExpression.cs" />
+ <Compile Include="System.CodeDom\CodeBinaryOperatorType.cs" />
+ <Compile Include="System.CodeDom\CodeCastExpression.cs" />
+ <Compile Include="System.CodeDom\CodeCatchClause.cs" />
+ <Compile Include="System.CodeDom\CodeCatchClauseCollection.cs" />
+ <Compile Include="System.CodeDom\CodeChecksumPragma.cs" />
+ <Compile Include="System.CodeDom\CodeComment.cs" />
+ <Compile Include="System.CodeDom\CodeCommentStatement.cs" />
+ <Compile Include="System.CodeDom\CodeCommentStatementCollection.cs" />
+ <Compile Include="System.CodeDom\CodeCompileUnit.cs" />
+ <Compile Include="System.CodeDom\CodeConditionStatement.cs" />
+ <Compile Include="System.CodeDom\CodeConstructor.cs" />
+ <Compile Include="System.CodeDom\CodeDefaultValueExpression.cs" />
+ <Compile Include="System.CodeDom\CodeDelegateCreateExpression.cs" />
+ <Compile Include="System.CodeDom\CodeDelegateInvokeExpression.cs" />
+ <Compile Include="System.CodeDom\CodeDirectionExpression.cs" />
+ <Compile Include="System.CodeDom\CodeDirective.cs" />
+ <Compile Include="System.CodeDom\CodeDirectiveCollection.cs" />
+ <Compile Include="System.CodeDom\CodeEntryPointMethod.cs" />
+ <Compile Include="System.CodeDom\CodeEventReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeExpression.cs" />
+ <Compile Include="System.CodeDom\CodeExpressionCollection.cs" />
+ <Compile Include="System.CodeDom\CodeExpressionStatement.cs" />
+ <Compile Include="System.CodeDom\CodeFieldReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeGotoStatement.cs" />
+ <Compile Include="System.CodeDom\CodeIndexerExpression.cs" />
+ <Compile Include="System.CodeDom\CodeIterationStatement.cs" />
+ <Compile Include="System.CodeDom\CodeLabeledStatement.cs" />
+ <Compile Include="System.CodeDom\CodeLinePragma.cs" />
+ <Compile Include="System.CodeDom\CodeMemberEvent.cs" />
+ <Compile Include="System.CodeDom\CodeMemberField.cs" />
+ <Compile Include="System.CodeDom\CodeMemberMethod.cs" />
+ <Compile Include="System.CodeDom\CodeMemberProperty.cs" />
+ <Compile Include="System.CodeDom\CodeMethodInvokeExpression.cs" />
+ <Compile Include="System.CodeDom\CodeMethodReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeMethodReturnStatement.cs" />
+ <Compile Include="System.CodeDom\CodeNamespace.cs" />
+ <Compile Include="System.CodeDom\CodeNamespaceCollection.cs" />
+ <Compile Include="System.CodeDom\CodeNamespaceImport.cs" />
+ <Compile Include="System.CodeDom\CodeNamespaceImportCollection.cs" />
+ <Compile Include="System.CodeDom\CodeObject.cs" />
+ <Compile Include="System.CodeDom\CodeObjectCreateExpression.cs" />
+ <Compile Include="System.CodeDom\CodeParameterDeclarationExpression.cs" />
+ <Compile Include="System.CodeDom\CodeParameterDeclarationExpressionCollection.cs" />
+ <Compile Include="System.CodeDom\CodePrimitiveExpression.cs" />
+ <Compile Include="System.CodeDom\CodePropertyReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodePropertySetValueReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeRegionDirective.cs" />
+ <Compile Include="System.CodeDom\CodeRegionMode.cs" />
+ <Compile Include="System.CodeDom\CodeRemoveEventStatement.cs" />
+ <Compile Include="System.CodeDom\CodeSnippetCompileUnit.cs" />
+ <Compile Include="System.CodeDom\CodeSnippetExpression.cs" />
+ <Compile Include="System.CodeDom\CodeSnippetStatement.cs" />
+ <Compile Include="System.CodeDom\CodeSnippetTypeMember.cs" />
+ <Compile Include="System.CodeDom\CodeStatement.cs" />
+ <Compile Include="System.CodeDom\CodeStatementCollection.cs" />
+ <Compile Include="System.CodeDom\CodeThisReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeThrowExceptionStatement.cs" />
+ <Compile Include="System.CodeDom\CodeTryCatchFinallyStatement.cs" />
+ <Compile Include="System.CodeDom\CodeTypeConstructor.cs" />
+ <Compile Include="System.CodeDom\CodeTypeDeclaration.cs" />
+ <Compile Include="System.CodeDom\CodeTypeDeclarationCollection.cs" />
+ <Compile Include="System.CodeDom\CodeTypeDelegate.cs" />
+ <Compile Include="System.CodeDom\CodeTypeMember.cs" />
+ <Compile Include="System.CodeDom\CodeTypeMemberCollection.cs" />
+ <Compile Include="System.CodeDom\CodeTypeOfExpression.cs" />
+ <Compile Include="System.CodeDom\CodeTypeParameter.cs" />
+ <Compile Include="System.CodeDom\CodeTypeParameterCollection.cs" />
+ <Compile Include="System.CodeDom\CodeTypeReference.cs" />
+ <Compile Include="System.CodeDom\CodeTypeReferenceCollection.cs" />
+ <Compile Include="System.CodeDom\CodeTypeReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\CodeTypeReferenceOptions.cs" />
+ <Compile Include="System.CodeDom\CodeVariableDeclarationStatement.cs" />
+ <Compile Include="System.CodeDom\CodeVariableReferenceExpression.cs" />
+ <Compile Include="System.CodeDom\FieldDirection.cs" />
+ <Compile Include="System.CodeDom\MemberAttributes.cs" />
+ <Compile Include="System.Collections.Generic\LinkedList.cs" />
+ <Compile Include="System.Collections.Generic\LinkedListNode.cs" />
+ <Compile Include="System.Collections.Generic\Queue.cs" />
+ <Compile Include="System.Collections.Generic\SortedDictionary.cs" />
+ <Compile Include="System.Collections.Generic\SortedList.cs" />
+ <Compile Include="System.Collections.Generic\Stack.cs" />
+ <Compile Include="System.Collections.Specialized\BitVector32.cs" />
+ <Compile Include="System.Collections.Specialized\CollectionsUtil.cs" />
+ <Compile Include="System.Collections.Specialized\HybridDictionary.cs" />
+ <Compile Include="System.Collections.Specialized\IOrderedDictionary.cs" />
+ <Compile Include="System.Collections.Specialized\ListDictionary.cs" />
+ <Compile Include="System.Collections.Specialized\NameObjectCollectionBase.cs" />
+ <Compile Include="System.Collections.Specialized\NameValueCollection.cs" />
+ <Compile Include="System.Collections.Specialized\OrderedDictionary.cs" />
+ <Compile Include="System.Collections.Specialized\ProcessStringDictionary.cs" />
+ <Compile Include="System.Collections.Specialized\StringCollection.cs" />
+ <Compile Include="System.Collections.Specialized\StringDictionary.cs" />
+ <Compile Include="System.Collections.Specialized\StringEnumerator.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\ContextStack.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\DesignerLoader.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\DesignerSerializerAttribute.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\IDesignerLoaderHost.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\IDesignerLoaderService.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\IDesignerSerializationManager.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\IDesignerSerializationProvider.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\IDesignerSerializationService.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\INameCreationService.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\InstanceDescriptor.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\ResolveNameEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\ResolveNameEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design.Serialization\RootDesignerSerializerAttribute.cs" />
+ <Compile Include="System.ComponentModel.Design\ActiveDesignerEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design\ActiveDesignerEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design\CheckoutException.cs" />
+ <Compile Include="System.ComponentModel.Design\CommandID.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentChangedEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentChangedEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentChangingEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentChangingEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentRenameEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design\ComponentRenameEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerCollection.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerTransaction.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerTransactionCloseEventArgs.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerTransactionCloseEventHandler.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerVerb.cs" />
+ <Compile Include="System.ComponentModel.Design\DesignerVerbCollection.cs" />
+ <Compile Include="System.ComponentModel.Design\DesigntimeLicenseContext.cs" />
+ <Compile Include="System.ComponentModel.Design\DesigntimeLicenseContextSerializer.cs" />
+ <Compile Include="System.ComponentModel.Design\HelpContextType.cs" />
+ <Compile Include="System.ComponentModel.Design\HelpKeywordAttribute.cs" />
+ <Compile Include="System.ComponentModel.Design\HelpKeywordType.cs" />
+ <Compile Include="System.ComponentModel.Design\IComponentChangeService.cs" />
+ <Compile Include="System.ComponentModel.Design\IDesigner.cs" />
+ <Compile Include="System.ComponentModel.Design\IDesignerEventService.cs" />
+ <Compile Include="System.ComponentModel.Design\IDesignerFilter.cs" />
+ <Compile Include="System.ComponentModel.Design\IDesignerHost.cs" />
+ <Compile Include="System.ComponentModel.Design\IDesignerOptionService.cs" />
+ <Compile Include="System.ComponentModel.Design\IDictionaryService.cs" />
+ <Compile Include="System.ComponentModel.Design\IEventBindingService.cs" />
+ <Compile Include="System.ComponentModel.Design\IExtenderListService.cs" />
+ <Compile Include="System.ComponentModel.Design\IExtenderProviderService.cs" />
+ <Compile Include="System.ComponentModel.Design\IHelpService.cs" />
+ <Compile Include="System.ComponentModel.Design\IInheritanceService.cs" />
+ <Compile Include="System.ComponentModel.Design\IMenuCommandService.cs" />
+ <Compile Include="System.ComponentModel.Design\IReferenceService.cs" />
+ <Compile Include="System.ComponentModel.Design\IResourceService.cs" />
+ <Compile Include="System.ComponentModel.Design\IRootDesigner.cs" />
+ <Compile Include="System.ComponentModel.Design\ISelectionService.cs" />
+ <Compile Include="System.ComponentModel.Design\IServiceContainer.cs" />
+ <Compile Include="System.ComponentModel.Design\ITypeDescriptorFilterService.cs" />
+ <Compile Include="System.ComponentModel.Design\ITypeResolutionService.cs" />
+ <Compile Include="System.ComponentModel.Design\MenuCommand.cs" />
+ <Compile Include="System.ComponentModel.Design\RuntimeLicenseContext.cs" />
+ <Compile Include="System.ComponentModel.Design\SelectionTypes.cs" />
+ <Compile Include="System.ComponentModel.Design\ServiceContainer.cs" />
+ <Compile Include="System.ComponentModel.Design\ServiceCreatorCallback.cs" />
+ <Compile Include="System.ComponentModel.Design\StandardCommands.cs" />
+ <Compile Include="System.ComponentModel.Design\StandardToolWindows.cs" />
+ <Compile Include="System.ComponentModel.Design\ViewTechnology.cs" />
+ <Compile Include="System.ComponentModel\AmbientValueAttribute.cs" />
+ <Compile Include="System.ComponentModel\ArrayConverter.cs" />
+ <Compile Include="System.ComponentModel\AsyncCompletedEventArgs.cs" />
+ <Compile Include="System.ComponentModel\AsyncCompletedEventHandler.cs" />
+ <Compile Include="System.ComponentModel\AsyncOperation.cs" />
+ <Compile Include="System.ComponentModel\AsyncOperationManager.cs" />
+ <Compile Include="System.ComponentModel\AttributeCollection.cs" />
+ <Compile Include="System.ComponentModel\BackgroundWorker.cs" />
+ <Compile Include="System.ComponentModel\BaseNumberConverter.cs" />
+ <Compile Include="System.ComponentModel\BindableAttribute.cs" />
+ <Compile Include="System.ComponentModel\BindableSupport.cs" />
+ <Compile Include="System.ComponentModel\BindingDirection.cs" />
+ <Compile Include="System.ComponentModel\BooleanConverter.cs" />
+ <Compile Include="System.ComponentModel\BrowsableAttribute.cs" />
+ <Compile Include="System.ComponentModel\ByteConverter.cs" />
+ <Compile Include="System.ComponentModel\CancelEventArgs.cs" />
+ <Compile Include="System.ComponentModel\CancelEventHandler.cs" />
+ <Compile Include="System.ComponentModel\CategoryAttribute.cs" />
+ <Compile Include="System.ComponentModel\CharConverter.cs" />
+ <Compile Include="System.ComponentModel\CollectionChangeAction.cs" />
+ <Compile Include="System.ComponentModel\CollectionChangeEventArgs.cs" />
+ <Compile Include="System.ComponentModel\CollectionChangeEventHandler.cs" />
+ <Compile Include="System.ComponentModel\CollectionConverter.cs" />
+ <Compile Include="System.ComponentModel\Component.cs" />
+ <Compile Include="System.ComponentModel\ComponentCollection.cs" />
+ <Compile Include="System.ComponentModel\ComponentConverter.cs" />
+ <Compile Include="System.ComponentModel\ComponentEditor.cs" />
+ <Compile Include="System.ComponentModel\ComponentResourceManager.cs" />
+ <Compile Include="System.ComponentModel\Container.cs" />
+ <Compile Include="System.ComponentModel\CultureInfoConverter.cs" />
+ <Compile Include="System.ComponentModel\DateTimeConverter.cs" />
+ <Compile Include="System.ComponentModel\DecimalConverter.cs" />
+ <Compile Include="System.ComponentModel\DefaultEventAttribute.cs" />
+ <Compile Include="System.ComponentModel\DefaultPropertyAttribute.cs" />
+ <Compile Include="System.ComponentModel\DefaultValueAttribute.cs" />
+ <Compile Include="System.ComponentModel\DerivedPropertyDescriptor.cs" />
+ <Compile Include="System.ComponentModel\DescriptionAttribute.cs" />
+ <Compile Include="System.ComponentModel\DesignerAttribute.cs" />
+ <Compile Include="System.ComponentModel\DesignerCategoryAttribute.cs" />
+ <Compile Include="System.ComponentModel\DesignerSerializationVisibility.cs" />
+ <Compile Include="System.ComponentModel\DesignerSerializationVisibilityAttribute.cs" />
+ <Compile Include="System.ComponentModel\DesignOnlyAttribute.cs" />
+ <Compile Include="System.ComponentModel\DesignTimeVisibleAttribute.cs" />
+ <Compile Include="System.ComponentModel\DoubleConverter.cs" />
+ <Compile Include="System.ComponentModel\DoWorkEventArgs.cs" />
+ <Compile Include="System.ComponentModel\DoWorkEventHandler.cs" />
+ <Compile Include="System.ComponentModel\EditorAttribute.cs" />
+ <Compile Include="System.ComponentModel\EditorBrowsableAttribute.cs" />
+ <Compile Include="System.ComponentModel\EditorBrowsableState.cs" />
+ <Compile Include="System.ComponentModel\EnumConverter.cs" />
+ <Compile Include="System.ComponentModel\EventDescriptor.cs" />
+ <Compile Include="System.ComponentModel\EventDescriptorCollection.cs" />
+ <Compile Include="System.ComponentModel\EventHandlerList.cs" />
+ <Compile Include="System.ComponentModel\ExpandableObjectConverter.cs" />
+ <Compile Include="System.ComponentModel\ExtenderProvidedPropertyAttribute.cs" />
+ <Compile Include="System.ComponentModel\GuidConverter.cs" />
+ <Compile Include="System.ComponentModel\HandledEventArgs.cs" />
+ <Compile Include="System.ComponentModel\HandledEventHandler.cs" />
+ <Compile Include="System.ComponentModel\IBindingList.cs" />
+ <Compile Include="System.ComponentModel\IBindingListView.cs" />
+ <Compile Include="System.ComponentModel\IChangeTracking.cs" />
+ <Compile Include="System.ComponentModel\IComNativeDescriptorHandler.cs" />
+ <Compile Include="System.ComponentModel\IComponent.cs" />
+ <Compile Include="System.ComponentModel\IContainer.cs" />
+ <Compile Include="System.ComponentModel\ICustomTypeDescriptor.cs" />
+ <Compile Include="System.ComponentModel\IDataErrorInfo.cs" />
+ <Compile Include="System.ComponentModel\IEditableObject.cs" />
+ <Compile Include="System.ComponentModel\IExtenderProvider.cs" />
+ <Compile Include="System.ComponentModel\IListSource.cs" />
+ <Compile Include="System.ComponentModel\ImmutableObjectAttribute.cs" />
+ <Compile Include="System.ComponentModel\InheritanceAttribute.cs" />
+ <Compile Include="System.ComponentModel\InheritanceLevel.cs" />
+ <Compile Include="System.ComponentModel\INotifyPropertyChanged.cs" />
+ <Compile Include="System.ComponentModel\InstallerTypeAttribute.cs" />
+ <Compile Include="System.ComponentModel\Int16Converter.cs" />
+ <Compile Include="System.ComponentModel\Int32Converter.cs" />
+ <Compile Include="System.ComponentModel\Int64Converter.cs" />
+ <Compile Include="System.ComponentModel\InvalidEnumArgumentException.cs" />
+ <Compile Include="System.ComponentModel\IRaiseItemChangedEvents.cs" />
+ <Compile Include="System.ComponentModel\IRevertibleChangeTracking.cs" />
+ <Compile Include="System.ComponentModel\ISite.cs" />
+ <Compile Include="System.ComponentModel\ISupportInitialize.cs" />
+ <Compile Include="System.ComponentModel\ISynchronizeInvoke.cs" />
+ <Compile Include="System.ComponentModel\ITypeDescriptorContext.cs" />
+ <Compile Include="System.ComponentModel\ITypedList.cs" />
+ <Compile Include="System.ComponentModel\License.cs" />
+ <Compile Include="System.ComponentModel\LicenseContext.cs" />
+ <Compile Include="System.ComponentModel\LicenseException.cs" />
+ <Compile Include="System.ComponentModel\LicenseManager.cs" />
+ <Compile Include="System.ComponentModel\LicenseProvider.cs" />
+ <Compile Include="System.ComponentModel\LicenseProviderAttribute.cs" />
+ <Compile Include="System.ComponentModel\LicenseUsageMode.cs" />
+ <Compile Include="System.ComponentModel\LicFileLicenseProvider.cs" />
+ <Compile Include="System.ComponentModel\ListBindableAttribute.cs" />
+ <Compile Include="System.ComponentModel\ListChangedEventArgs.cs" />
+ <Compile Include="System.ComponentModel\ListChangedEventHandler.cs" />
+ <Compile Include="System.ComponentModel\ListChangedType.cs" />
+ <Compile Include="System.ComponentModel\ListSortDescription.cs" />
+ <Compile Include="System.ComponentModel\ListSortDescriptionCollection.cs" />
+ <Compile Include="System.ComponentModel\ListSortDirection.cs" />
+ <Compile Include="System.ComponentModel\LocalizableAttribute.cs" />
+ <Compile Include="System.ComponentModel\MarshalByValueComponent.cs" />
+ <Compile Include="System.ComponentModel\MaskedTextResultHint.cs" />
+ <Compile Include="System.ComponentModel\MemberDescriptor.cs" />
+ <Compile Include="System.ComponentModel\MergablePropertyAttribute.cs" />
+ <Compile Include="System.ComponentModel\NotifyParentPropertyAttribute.cs" />
+ <Compile Include="System.ComponentModel\ParenthesizePropertyNameAttribute.cs" />
+ <Compile Include="System.ComponentModel\ProgressChangedEventArgs.cs" />
+ <Compile Include="System.ComponentModel\ProgressChangedEventHandler.cs" />
+ <Compile Include="System.ComponentModel\PropertyChangedEventArgs.cs" />
+ <Compile Include="System.ComponentModel\PropertyChangedEventHandler.cs" />
+ <Compile Include="System.ComponentModel\PropertyDescriptor.cs" />
+ <Compile Include="System.ComponentModel\PropertyDescriptorCollection.cs" />
+ <Compile Include="System.ComponentModel\PropertyTabAttribute.cs" />
+ <Compile Include="System.ComponentModel\PropertyTabScope.cs" />
+ <Compile Include="System.ComponentModel\ProvidePropertyAttribute.cs" />
+ <Compile Include="System.ComponentModel\ReadOnlyAttribute.cs" />
+ <Compile Include="System.ComponentModel\RecommendedAsConfigurableAttribute.cs" />
+ <Compile Include="System.ComponentModel\ReferenceConverter.cs" />
+ <Compile Include="System.ComponentModel\ReflectionEventDescriptor.cs" />
+ <Compile Include="System.ComponentModel\ReflectionPropertyDescriptor.cs" />
+ <Compile Include="System.ComponentModel\RefreshEventArgs.cs" />
+ <Compile Include="System.ComponentModel\RefreshEventHandler.cs" />
+ <Compile Include="System.ComponentModel\RefreshProperties.cs" />
+ <Compile Include="System.ComponentModel\RefreshPropertiesAttribute.cs" />
+ <Compile Include="System.ComponentModel\RunInstallerAttribute.cs" />
+ <Compile Include="System.ComponentModel\RunWorkerCompletedEventArgs.cs" />
+ <Compile Include="System.ComponentModel\RunWorkerCompletedEventHandler.cs" />
+ <Compile Include="System.ComponentModel\SByteConverter.cs" />
+ <Compile Include="System.ComponentModel\SettingsBindableAttribute.cs" />
+ <Compile Include="System.ComponentModel\SingleConverter.cs" />
+ <Compile Include="System.ComponentModel\StringConverter.cs" />
+ <Compile Include="System.ComponentModel\SyntaxCheck.cs" />
+ <Compile Include="System.ComponentModel\TimeSpanConverter.cs" />
+ <Compile Include="System.ComponentModel\ToolboxItemAttribute.cs" />
+ <Compile Include="System.ComponentModel\ToolboxItemFilterAttribute.cs" />
+ <Compile Include="System.ComponentModel\ToolboxItemFilterType.cs" />
+ <Compile Include="System.ComponentModel\TypeConverter.cs" />
+ <Compile Include="System.ComponentModel\TypeConverterAttribute.cs" />
+ <Compile Include="System.ComponentModel\TypeDescriptor.cs" />
+ <Compile Include="System.ComponentModel\TypeListConverter.cs" />
+ <Compile Include="System.ComponentModel\UInt16Converter.cs" />
+ <Compile Include="System.ComponentModel\UInt32Converter.cs" />
+ <Compile Include="System.ComponentModel\UInt64Converter.cs" />
+ <Compile Include="System.ComponentModel\WarningException.cs" />
+ <Compile Include="System.ComponentModel\Win32Exception.cs" />
+ <Compile Include="System.Configuration\ApplicationScopedSettingAttribute.cs" />
+ <Compile Include="System.Configuration\ApplicationSettingsBase.cs" />
+ <Compile Include="System.Configuration\ApplicationSettingsGroup.cs" />
+ <Compile Include="System.Configuration\AppSettingsReader.cs" />
+ <Compile Include="System.Configuration\ClientSettingsSection.cs" />
+ <Compile Include="System.Configuration\ConfigHelper.cs" />
+ <Compile Include="System.Configuration\ConfigurationException.cs" />
+ <Compile Include="System.Configuration\ConfigurationSettings.cs" />
+ <Compile Include="System.Configuration\ConfigXmlDocument.cs" />
+ <Compile Include="System.Configuration\DefaultSettingValueAttribute.cs" />
+ <Compile Include="System.Configuration\DictionarySectionHandler.cs" />
+ <Compile Include="System.Configuration\IApplicationSettingsProvider.cs" />
+ <Compile Include="System.Configuration\IConfigurationSectionHandler.cs" />
+ <Compile Include="System.Configuration\IConfigurationSystem.cs" />
+ <Compile Include="System.Configuration\IConfigXmlNode.cs" />
+ <Compile Include="System.Configuration\IgnoreSectionHandler.cs" />
+ <Compile Include="System.Configuration\IPersistComponentSettings.cs" />
+ <Compile Include="System.Configuration\ISettingsProviderService.cs" />
+ <Compile Include="System.Configuration\LocalFileSettingsProvider.cs" />
+ <Compile Include="System.Configuration\NameValueFileSectionHandler.cs" />
+ <Compile Include="System.Configuration\NameValueSectionHandler.cs" />
+ <Compile Include="System.Configuration\NoSettingsVersionUpgradeAttribute.cs" />
+ <Compile Include="System.Configuration\SettingAttribute.cs" />
+ <Compile Include="System.Configuration\SettingChangingEventArgs.cs" />
+ <Compile Include="System.Configuration\SettingChangingEventHandler.cs" />
+ <Compile Include="System.Configuration\SettingElement.cs" />
+ <Compile Include="System.Configuration\SettingElementCollection.cs" />
+ <Compile Include="System.Configuration\SettingsAttributeDictionary.cs" />
+ <Compile Include="System.Configuration\SettingsBase.cs" />
+ <Compile Include="System.Configuration\SettingsContext.cs" />
+ <Compile Include="System.Configuration\SettingsDescriptionAttribute.cs" />
+ <Compile Include="System.Configuration\SettingsGroupDescriptionAttribute.cs" />
+ <Compile Include="System.Configuration\SettingsGroupNameAttribute.cs" />
+ <Compile Include="System.Configuration\SettingsLoadedEventArgs.cs" />
+ <Compile Include="System.Configuration\SettingsLoadedEventHandler.cs" />
+ <Compile Include="System.Configuration\SettingsManageability.cs" />
+ <Compile Include="System.Configuration\SettingsManageabilityAttribute.cs" />
+ <Compile Include="System.Configuration\SettingsProperty.cs" />
+ <Compile Include="System.Configuration\SettingsPropertyCollection.cs" />
+ <Compile Include="System.Configuration\SettingsPropertyIsReadOnlyException.cs" />
+ <Compile Include="System.Configuration\SettingsPropertyNotFoundException.cs" />
+ <Compile Include="System.Configuration\SettingsPropertyValue.cs" />
+ <Compile Include="System.Configuration\SettingsPropertyValueCollection.cs" />
+ <Compile Include="System.Configuration\SettingsPropertyWrongTypeException.cs" />
+ <Compile Include="System.Configuration\SettingsProvider.cs" />
+ <Compile Include="System.Configuration\SettingsProviderAttribute.cs" />
+ <Compile Include="System.Configuration\SettingsProviderCollection.cs" />
+ <Compile Include="System.Configuration\SettingsSavingEventHandler.cs" />
+ <Compile Include="System.Configuration\SettingsSerializeAs.cs" />
+ <Compile Include="System.Configuration\SettingsSerializeAsAttribute.cs" />
+ <Compile Include="System.Configuration\SettingValueElement.cs" />
+ <Compile Include="System.Configuration\SingleTagSectionHandler.cs" />
+ <Compile Include="System.Configuration\SpecialSetting.cs" />
+ <Compile Include="System.Configuration\SpecialSettingAttribute.cs" />
+ <Compile Include="System.Configuration\UserScopedSettingAttribute.cs" />
+ <Compile Include="System.Configuration\UserSettingsGroup.cs" />
+ <Compile Include="System.Diagnostics\Debug.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Diagnostics\DefaultTraceListener.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Diagnostics\DiagnosticsConfigurationHandler.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Diagnostics\Trace.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Diagnostics\TraceImpl.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Diagnostics\TraceLevel.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Diagnostics\TraceListener.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Diagnostics\TraceListenerCollection.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.IO\ErrorEventArgs.cs" />
+ <Compile Include="System.IO\ErrorEventHandler.cs" />
+ <Compile Include="System.IO\FileAction.cs" />
+ <Compile Include="System.IO\FileSystemEventArgs.cs" />
+ <Compile Include="System.IO\FileSystemEventHandler.cs" />
+ <Compile Include="System.IO\InternalBufferOverflowException.cs" />
+ <Compile Include="System.IO\InvalidDataException.cs" />
+ <Compile Include="System.IO\IODescriptionAttribute.cs" />
+ <Compile Include="System.IO\NotifyFilters.cs" />
+ <Compile Include="System.IO\RenamedEventArgs.cs" />
+ <Compile Include="System.IO\RenamedEventHandler.cs" />
+ <Compile Include="System.IO\SearchPattern.cs" />
+ <Compile Include="System.IO\WaitForChangedResult.cs" />
+ <Compile Include="System.IO\WatcherChangeTypes.cs" />
+ <Compile Include="System.Net.Cache\HttpCacheAgeControl.cs" />
+ <Compile Include="System.Net.Cache\HttpRequestCacheLevel.cs" />
+ <Compile Include="System.Net.Cache\HttpRequestCachePolicy.cs" />
+ <Compile Include="System.Net.Cache\RequestCacheLevel.cs" />
+ <Compile Include="System.Net.Cache\RequestCachePolicy.cs" />
+ <Compile Include="System.Net.Configuration\AuthenticationModuleElement.cs" />
+ <Compile Include="System.Net.Configuration\AuthenticationModuleElementCollection.cs" />
+ <Compile Include="System.Net.Configuration\AuthenticationModulesSection.cs" />
+ <Compile Include="System.Net.Configuration\BypassElement.cs" />
+ <Compile Include="System.Net.Configuration\BypassElementCollection.cs" />
+ <Compile Include="System.Net.Configuration\ConnectionManagementElement.cs" />
+ <Compile Include="System.Net.Configuration\ConnectionManagementElementCollection.cs" />
+ <Compile Include="System.Net.Configuration\ConnectionManagementHandler.cs" />
+ <Compile Include="System.Net.Configuration\ConnectionManagementSection.cs" />
+ <Compile Include="System.Net.Configuration\DefaultProxyHandler.cs" />
+ <Compile Include="System.Net.Configuration\DefaultProxySection.cs" />
+ <Compile Include="System.Net.Configuration\FtpCachePolicyElement.cs" />
+ <Compile Include="System.Net.Configuration\HttpCachePolicyElement.cs" />
+ <Compile Include="System.Net.Configuration\HttpWebRequestElement.cs" />
+ <Compile Include="System.Net.Configuration\Ipv6Element.cs" />
+ <Compile Include="System.Net.Configuration\MailSettingsSectionGroup.cs" />
+ <Compile Include="System.Net.Configuration\ModuleElement.cs" />
+ <Compile Include="System.Net.Configuration\NetAuthenticationModuleHandler.cs" />
+ <Compile Include="System.Net.Configuration\NetConfigurationHandler.cs" />
+ <Compile Include="System.Net.Configuration\NetSectionGroup.cs" />
+ <Compile Include="System.Net.Configuration\PerformanceCountersElement.cs" />
+ <Compile Include="System.Net.Configuration\ProxyElement.cs" />
+ <Compile Include="System.Net.Configuration\RequestCachingSection.cs" />
+ <Compile Include="System.Net.Configuration\ServicePointManagerElement.cs" />
+ <Compile Include="System.Net.Configuration\SettingsSection.cs" />
+ <Compile Include="System.Net.Configuration\SmtpNetworkElement.cs" />
+ <Compile Include="System.Net.Configuration\SmtpSection.cs" />
+ <Compile Include="System.Net.Configuration\SmtpSpecifiedPickupDirectoryElement.cs" />
+ <Compile Include="System.Net.Configuration\SocketElement.cs" />
+ <Compile Include="System.Net.Configuration\WebProxyScriptElement.cs" />
+ <Compile Include="System.Net.Configuration\WebRequestModuleElement.cs" />
+ <Compile Include="System.Net.Configuration\WebRequestModuleElementCollection.cs" />
+ <Compile Include="System.Net.Configuration\WebRequestModuleHandler.cs" />
+ <Compile Include="System.Net.Configuration\WebRequestModulesSection.cs" />
+ <Compile Include="System.Net.Mail\AlternateView.cs" />
+ <Compile Include="System.Net.Mail\AlternateViewCollection.cs" />
+ <Compile Include="System.Net.Mail\Attachment.cs" />
+ <Compile Include="System.Net.Mail\AttachmentBase.cs" />
+ <Compile Include="System.Net.Mail\AttachmentCollection.cs" />
+ <Compile Include="System.Net.Mail\DeliveryNotificationOptions.cs" />
+ <Compile Include="System.Net.Mail\LinkedResource.cs" />
+ <Compile Include="System.Net.Mail\LinkedResourceCollection.cs" />
+ <Compile Include="System.Net.Mail\MailAddress.cs" />
+ <Compile Include="System.Net.Mail\MailAddressCollection.cs" />
+ <Compile Include="System.Net.Mail\MailMessage.cs" />
+ <Compile Include="System.Net.Mail\MailPriority.cs" />
+ <Compile Include="System.Net.Mail\SendCompletedEventHandler.cs" />
+ <Compile Include="System.Net.Mail\SmtpAccess.cs" />
+ <Compile Include="System.Net.Mail\SmtpClient.cs" />
+ <Compile Include="System.Net.Mail\SmtpDeliveryMethod.cs" />
+ <Compile Include="System.Net.Mail\SmtpException.cs" />
+ <Compile Include="System.Net.Mail\SmtpFailedRecipientException.cs" />
+ <Compile Include="System.Net.Mail\SmtpFailedRecipientsException.cs" />
+ <Compile Include="System.Net.Mail\SmtpStatusCode.cs" />
+ <Compile Include="System.Net.Mime\ContentDisposition.cs" />
+ <Compile Include="System.Net.Mime\ContentType.cs" />
+ <Compile Include="System.Net.Mime\DispositionTypeNames.cs" />
+ <Compile Include="System.Net.Mime\MediaTypeNames.cs" />
+ <Compile Include="System.Net.Mime\TransferEncoding.cs" />
+ <Compile Include="System.Net.NetworkInformation\DuplicateAddressDetectionState.cs" />
+ <Compile Include="System.Net.NetworkInformation\GatewayIPAddressInformation.cs" />
+ <Compile Include="System.Net.NetworkInformation\GatewayIPAddressInformationCollection.cs" />
+ <Compile Include="System.Net.NetworkInformation\IcmpV4Statistics.cs" />
+ <Compile Include="System.Net.NetworkInformation\IcmpV6Statistics.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPAddressCollection.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPAddressInformation.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPAddressInformationCollection.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPGlobalProperties.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPGlobalStatistics.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPInterfaceProperties.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPStatus.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPv4InterfaceProperties.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPv4InterfaceStatistics.cs" />
+ <Compile Include="System.Net.NetworkInformation\IPv6InterfaceProperties.cs" />
+ <Compile Include="System.Net.NetworkInformation\MulticastIPAddressInformation.cs" />
+ <Compile Include="System.Net.NetworkInformation\MulticastIPAddressInformationCollection.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetBiosNodeType.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkAddressChangedEventHandler.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkAvailabilityChangedEventHandler.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkAvailabilityEventArgs.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkChange.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkInformationAccess.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkInformationException.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkInformationPermission.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkInformationPermissionAttribute.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkInterface.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkInterfaceComponent.cs" />
+ <Compile Include="System.Net.NetworkInformation\NetworkInterfaceType.cs" />
+ <Compile Include="System.Net.NetworkInformation\OperationalStatus.cs" />
+ <Compile Include="System.Net.NetworkInformation\PhysicalAddress.cs" />
+ <Compile Include="System.Net.NetworkInformation\Ping.cs" />
+ <Compile Include="System.Net.NetworkInformation\PingCompletedEventArgs.cs" />
+ <Compile Include="System.Net.NetworkInformation\PingCompletedEventHandler.cs" />
+ <Compile Include="System.Net.NetworkInformation\PingException.cs" />
+ <Compile Include="System.Net.NetworkInformation\PingOptions.cs" />
+ <Compile Include="System.Net.NetworkInformation\PingReply.cs" />
+ <Compile Include="System.Net.NetworkInformation\PrefixOrigin.cs" />
+ <Compile Include="System.Net.NetworkInformation\SuffixOrigin.cs" />
+ <Compile Include="System.Net.NetworkInformation\TcpConnectionInformation.cs" />
+ <Compile Include="System.Net.NetworkInformation\TcpState.cs" />
+ <Compile Include="System.Net.NetworkInformation\TcpStatistics.cs" />
+ <Compile Include="System.Net.NetworkInformation\UdpStatistics.cs" />
+ <Compile Include="System.Net.NetworkInformation\UnicastIPAddressInformation.cs" />
+ <Compile Include="System.Net.NetworkInformation\UnicastIPAddressInformationCollection.cs" />
+ <Compile Include="System.Net.Security\AuthenticatedStream.cs" />
+ <Compile Include="System.Net.Security\AuthenticationLevel.cs" />
+ <Compile Include="System.Net.Security\LocalCertificateSelectionCallback.cs" />
+ <Compile Include="System.Net.Security\ProtectionLevel.cs" />
+ <Compile Include="System.Net.Security\RemoteCertificateValidationCallback.cs" />
+ <Compile Include="System.Net.Security\SslPolicyErrors.cs" />
+ <Compile Include="System.Net.Security\SslStream.cs" />
+ <Compile Include="System.Net.Sockets\AddressFamily.cs" />
+ <Compile Include="System.Net.Sockets\GHSocket.cs" />
+ <Compile Include="System.Net.Sockets\GHSocketFactory.cs" />
+ <Compile Include="System.Net.Sockets\GHStreamSocket.cs" />
+ <Compile Include="System.Net.Sockets\GHStreamSocketSSL.cs" />
+ <Compile Include="System.Net.Sockets\IPv6MulticastOption.cs" />
+ <Compile Include="System.Net.Sockets\LingerOption.cs" />
+ <Compile Include="System.Net.Sockets\MulticastOption.cs" />
+ <Compile Include="System.Net.Sockets\NetworkStream.cs" />
+ <Compile Include="System.Net.Sockets\ProtocolFamily.cs" />
+ <Compile Include="System.Net.Sockets\ProtocolType.cs" />
+ <Compile Include="System.Net.Sockets\SelectMode.cs" />
+ <Compile Include="System.Net.Sockets\Socket.jvm.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Net.Sockets\SocketError.cs" />
+ <Compile Include="System.Net.Sockets\SocketException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Net.Sockets\SocketFlags.cs" />
+ <Compile Include="System.Net.Sockets\SocketOptionLevel.cs" />
+ <Compile Include="System.Net.Sockets\SocketOptionName.cs" />
+ <Compile Include="System.Net.Sockets\SocketShutdown.cs" />
+ <Compile Include="System.Net.Sockets\SocketType.cs" />
+ <Compile Include="System.Net.Sockets\TcpClient.cs" />
+ <Compile Include="System.Net.Sockets\TcpListener.cs" />
+ <Compile Include="System.Net.Sockets\UdpClient.cs" />
+ <Compile Include="System.Net\AuthenticationManager.cs" />
+ <Compile Include="System.Net\AuthenticationSchemes.cs" />
+ <Compile Include="System.Net\AuthenticationSchemeSelector.cs" />
+ <Compile Include="System.Net\Authorization.cs" />
+ <Compile Include="System.Net\BasicClient.cs" />
+ <Compile Include="System.Net\BindIPEndPoint.cs" />
+ <Compile Include="System.Net\ChunkedInputStream.cs" />
+ <Compile Include="System.Net\ChunkStream.cs" />
+ <Compile Include="System.Net\ConnectionModes.cs" />
+ <Compile Include="System.Net\Cookie.cs" />
+ <Compile Include="System.Net\CookieCollection.cs" />
+ <Compile Include="System.Net\CookieContainer.cs" />
+ <Compile Include="System.Net\CookieException.cs" />
+ <Compile Include="System.Net\CredentialCache.cs" />
+ <Compile Include="System.Net\DefaultCertificatePolicy.cs" />
+ <Compile Include="System.Net\DigestClient.cs" />
+ <Compile Include="System.Net\Dns.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Net\DnsPermission.cs" />
+ <Compile Include="System.Net\DnsPermissionAttribute.cs" />
+ <Compile Include="System.Net\DownloadDataCompletedEventArgs.cs" />
+ <Compile Include="System.Net\DownloadDataCompletedEventHandler.cs" />
+ <Compile Include="System.Net\DownloadProgressChangedEventArgs.cs" />
+ <Compile Include="System.Net\DownloadProgressChangedEventHandler.cs" />
+ <Compile Include="System.Net\DownloadStringCompletedEventArgs.cs" />
+ <Compile Include="System.Net\DownloadStringCompletedEventHandler.cs" />
+ <Compile Include="System.Net\EndPoint.cs" />
+ <Compile Include="System.Net\EndPointListener.cs" />
+ <Compile Include="System.Net\EndPointManager.cs" />
+ <Compile Include="System.Net\EndpointPermission.cs" />
+ <Compile Include="System.Net\FileWebRequest.cs" />
+ <Compile Include="System.Net\FileWebRequestCreator.cs" />
+ <Compile Include="System.Net\FileWebResponse.cs" />
+ <Compile Include="System.Net\FtpAsyncResult.cs" />
+ <Compile Include="System.Net\FtpDataStream.cs" />
+ <Compile Include="System.Net\FtpRequestCreator.cs" />
+ <Compile Include="System.Net\FtpStatusCode.cs" />
+ <Compile Include="System.Net\FtpWebRequest.cs" />
+ <Compile Include="System.Net\FtpWebResponse.cs" />
+ <Compile Include="System.Net\GlobalProxySelection.cs" />
+ <Compile Include="System.Net\HttpConnection.cs" />
+ <Compile Include="System.Net\HttpContinueDelegate.cs" />
+ <Compile Include="System.Net\HttpListener.cs" />
+ <Compile Include="System.Net\HttpListenerBasicIdentity.cs" />
+ <Compile Include="System.Net\HttpListenerContext.cs" />
+ <Compile Include="System.Net\HttpListenerException.cs" />
+ <Compile Include="System.Net\HttpListenerPrefixCollection.cs" />
+ <Compile Include="System.Net\HttpListenerRequest.cs" />
+ <Compile Include="System.Net\HttpListenerResponse.cs" />
+ <Compile Include="System.Net\HttpProvider.cs" />
+ <Compile Include="System.Net\HttpRequestCreator.cs" />
+ <Compile Include="System.Net\HttpRequestHeader.cs" />
+ <Compile Include="System.Net\HttpResponseHeader.cs" />
+ <Compile Include="System.Net\HttpStateCache.cs" />
+ <Compile Include="System.Net\HttpStatusCode.cs" />
+ <Compile Include="System.Net\HttpStreamAsyncResult.cs" />
+ <Compile Include="System.Net\HttpUtility.cs" />
+ <Compile Include="System.Net\HttpVersion.cs" />
+ <Compile Include="System.Net\HttpWebRequest.jvm.cs" />
+ <Compile Include="System.Net\HttpWebResponse.jvm.cs" />
+ <Compile Include="System.Net\IAuthenticationModule.cs" />
+ <Compile Include="System.Net\ICertificatePolicy.cs" />
+ <Compile Include="System.Net\ICredentialLookup.cs" />
+ <Compile Include="System.Net\ICredentialPolicy.cs" />
+ <Compile Include="System.Net\ICredentialsByHost.cs" />
+ <Compile Include="System.Net\IPAddress.cs" />
+ <Compile Include="System.Net\IPEndPoint.cs" />
+ <Compile Include="System.Net\IPHostEntry.cs" />
+ <Compile Include="System.Net\IPv6Address.cs" />
+ <Compile Include="System.Net\IWebProxy.cs" />
+ <Compile Include="System.Net\IWebRequestCreate.cs" />
+ <Compile Include="System.Net\ListenerAsyncResult.cs" />
+ <Compile Include="System.Net\ListenerPrefix.cs" />
+ <Compile Include="System.Net\MonoHttpDate.cs" />
+ <Compile Include="System.Net\NetConfig.cs" />
+ <Compile Include="System.Net\NetworkAccess.cs" />
+ <Compile Include="System.Net\NetworkCredential.cs" />
+ <Compile Include="System.Net\NtlmClient.cs" />
+ <Compile Include="System.Net\OpenReadCompletedEventArgs.cs" />
+ <Compile Include="System.Net\OpenReadCompletedEventHandler.cs" />
+ <Compile Include="System.Net\OpenWriteCompletedEventArgs.cs" />
+ <Compile Include="System.Net\OpenWriteCompletedEventHandler.cs" />
+ <Compile Include="System.Net\ProtocolViolationException.cs" />
+ <Compile Include="System.Net\RequestStream.cs" />
+ <Compile Include="System.Net\ResponseStream.cs" />
+ <Compile Include="System.Net\SecurityProtocolType.cs" />
+ <Compile Include="System.Net\ServicePoint.cs" />
+ <Compile Include="System.Net\ServicePointManager.cs" />
+ <Compile Include="System.Net\SocketAddress.cs" />
+ <Compile Include="System.Net\SocketPermission.cs" />
+ <Compile Include="System.Net\SocketPermissionAttribute.cs" />
+ <Compile Include="System.Net\TransportType.cs" />
+ <Compile Include="System.Net\UploadDataCompletedEventArgs.cs" />
+ <Compile Include="System.Net\UploadDataCompletedEventHandler.cs" />
+ <Compile Include="System.Net\UploadFileCompletedEventArgs.cs" />
+ <Compile Include="System.Net\UploadFileCompletedEventHandler.cs" />
+ <Compile Include="System.Net\UploadProgressChangedEventArgs.cs" />
+ <Compile Include="System.Net\UploadProgressChangedEventHandler.cs" />
+ <Compile Include="System.Net\UploadStringCompletedEventArgs.cs" />
+ <Compile Include="System.Net\UploadStringCompletedEventHandler.cs" />
+ <Compile Include="System.Net\UploadValuesCompletedEventArgs.cs" />
+ <Compile Include="System.Net\UploadValuesCompletedEventHandler.cs" />
+ <Compile Include="System.Net\VMWHttpProvider.cs" />
+ <Compile Include="System.Net\WebAsyncResult.cs" />
+ <Compile Include="System.Net\WebClient.cs" />
+ <Compile Include="System.Net\WebConnectionData.cs" />
+ <Compile Include="System.Net\WebException.cs" />
+ <Compile Include="System.Net\WebExceptionStatus.cs" />
+ <Compile Include="System.Net\WebHeaderCollection.cs" />
+ <Compile Include="System.Net\WebPermission.cs" />
+ <Compile Include="System.Net\WebPermissionAttribute.cs" />
+ <Compile Include="System.Net\WebProxy.cs" />
+ <Compile Include="System.Net\WebRequest.cs" />
+ <Compile Include="System.Net\WebRequestMethods.cs" />
+ <Compile Include="System.Net\WebResponse.cs" />
+ <Compile Include="System.Security.AccessControl\SemaphoreAuditRule.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="System.Security.AccessControl\SemaphoreRights.cs" />
+ <Compile Include="System.Security.Authentication\AuthenticationException.cs" />
+ <Compile Include="System.Security.Authentication\CipherAlgorithmType.cs" />
+ <Compile Include="System.Security.Authentication\ExchangeAlgorithmType.cs" />
+ <Compile Include="System.Security.Authentication\HashAlgorithmType.cs" />
+ <Compile Include="System.Security.Authentication\InvalidCredentialException.cs" />
+ <Compile Include="System.Security.Authentication\SslProtocols.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\OpenFlags.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\PublicKey.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\StoreLocation.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\StoreName.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X500DistinguishedName.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X500DistinguishedNameFlags.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509BasicConstraintsExtension.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2Collection.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2Enumerator.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509CertificateCollection.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509Chain.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElement.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElementCollection.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainElementEnumerator.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainPolicy.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainStatus.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ChainStatusFlags.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509EnhancedKeyUsageExtension.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509Extension.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ExtensionCollection.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509ExtensionEnumerator.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509FindType.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509IncludeOption.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509KeyUsageExtension.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509KeyUsageFlags.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509NameType.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509RevocationFlag.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509RevocationMode.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509Store.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509SubjectKeyIdentifierExtension.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509SubjectKeyIdentifierHashAlgorithm.cs" />
+ <Compile Include="System.Security.Cryptography.X509Certificates\X509VerificationFlags.cs" />
+ <Compile Include="System.Security.Cryptography\AsnEncodedData.cs" />
+ <Compile Include="System.Security.Cryptography\AsnEncodedDataCollection.cs" />
+ <Compile Include="System.Security.Cryptography\AsnEncodedDataEnumerator.cs" />
+ <Compile Include="System.Security.Cryptography\Oid.cs" />
+ <Compile Include="System.Security.Cryptography\OidCollection.cs" />
+ <Compile Include="System.Security.Cryptography\OidEnumerator.cs" />
+ <Compile Include="System.Security.Permissions\PermissionHelper.cs" />
+ <Compile Include="System.Security.Permissions\ResourcePermissionBase.cs" />
+ <Compile Include="System.Security.Permissions\ResourcePermissionBaseEntry.cs" />
+ <Compile Include="System.Security.Permissions\StorePermission.cs" />
+ <Compile Include="System.Security.Permissions\StorePermissionAttribute.cs" />
+ <Compile Include="System.Security.Permissions\StorePermissionFlags.cs" />
+ <Compile Include="System.Text.RegularExpressions\arch.cs" />
+ <Compile Include="System.Text.RegularExpressions\cache.cs" />
+ <Compile Include="System.Text.RegularExpressions\Capture.cs" />
+ <Compile Include="System.Text.RegularExpressions\CaptureCollection.cs" />
+ <Compile Include="System.Text.RegularExpressions\category.cs" />
+ <Compile Include="System.Text.RegularExpressions\compiler.cs" />
+ <Compile Include="System.Text.RegularExpressions\debug.cs" />
+ <Compile Include="System.Text.RegularExpressions\Group.cs" />
+ <Compile Include="System.Text.RegularExpressions\GroupCollection.cs" />
+ <Compile Include="System.Text.RegularExpressions\interpreter.cs" />
+ <Compile Include="System.Text.RegularExpressions\interval.cs" />
+ <Compile Include="System.Text.RegularExpressions\Match.cs" />
+ <Compile Include="System.Text.RegularExpressions\MatchCollection.cs" />
+ <Compile Include="System.Text.RegularExpressions\MatchEvaluator.cs" />
+ <Compile Include="System.Text.RegularExpressions\parser.cs" />
+ <Compile Include="System.Text.RegularExpressions\quicksearch.cs" />
+ <Compile Include="System.Text.RegularExpressions\Regex.cs" />
+ <Compile Include="System.Text.RegularExpressions\RegexCompilationInfo.cs" />
+ <Compile Include="System.Text.RegularExpressions\RegexOptions.cs" />
+ <Compile Include="System.Text.RegularExpressions\RegexRunner.cs" />
+ <Compile Include="System.Text.RegularExpressions\RegexRunnerFactory.cs" />
+ <Compile Include="System.Text.RegularExpressions\replace.cs" />
+ <Compile Include="System.Text.RegularExpressions\syntax.cs" />
+ <Compile Include="System.Threading\SemaphoreFullException.cs" />
+ <Compile Include="System.Threading\ThreadExceptionEventArgs.cs" />
+ <Compile Include="System.Threading\ThreadExceptionEventHandler.cs" />
+ <Compile Include="System.Timers\ElapsedEventArgs.cs" />
+ <Compile Include="System.Timers\ElapsedEventHandler.cs" />
+ <Compile Include="System.Timers\Timer.cs" />
+ <Compile Include="System.Timers\TimersDescriptionAttribute.cs" />
+ <Compile Include="System.Web\AspNetHostingPermission.cs" />
+ <Compile Include="System.Web\AspNetHostingPermissionAttribute.cs" />
+ <Compile Include="System.Web\AspNetHostingPermissionLevel.cs" />
+ <Compile Include="System\DefaultUriParser.cs" />
+ <Compile Include="System\FileStyleUriParser.cs" />
+ <Compile Include="System\FtpStyleUriParser.cs" />
+ <Compile Include="System\GenericUriParser.cs" />
+ <Compile Include="System\GenericUriParserOptions.cs" />
+ <Compile Include="System\GopherStyleUriParser.cs" />
+ <Compile Include="System\HttpStyleUriParser.cs" />
+ <Compile Include="System\LdapStyleUriParser.cs" />
+ <Compile Include="System\NetPipeStyleUriParser.cs" />
+ <Compile Include="System\NetTcpStyleUriParser.cs" />
+ <Compile Include="System\NewsStyleUriParser.cs" />
+ <Compile Include="System\SRDescriptionAttribute.cs" />
+ <Compile Include="System\Uri.cs" />
+ <Compile Include="System\UriBuilder.cs" />
+ <Compile Include="System\UriComponents.cs" />
+ <Compile Include="System\UriFormat.cs" />
+ <Compile Include="System\UriFormatException.cs" />
+ <Compile Include="System\UriHostNameType.cs" />
+ <Compile Include="System\UriKind.cs" />
+ <Compile Include="System\UriParser.cs" />
+ <Compile Include="System\UriPartial.cs" />
+ <Compile Include="System\UriTypeConverter.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="System.Text.RegularExpressions\notes.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="machine.config">
+ <LogicalName>machine.config</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <PropertyGroup>
+ <PostBuildEvent>set td=%25random%25
+mkdir %25td%25
+cd %25td%25
+set classdir=..\..\..\..
+
+echo Unzipping System.jar...
+set jar=$(TargetDir)$(TargetName).jar
+jar xf "%25jar%25"
+echo Extracting apache_http_client.jar
+jar xf %25classdir%25\lib\apache_http_client.jar
+
+echo Repackaging...
+jar cfm "%25jar%25" .\META-INF\MANIFEST.MF *
+
+echo Remove temp dir
+cd ..
+rmdir /S /Q %25td%25</PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/class/System/System.Net.Sockets/GHSocket.cs b/mcs/class/System/System.Net.Sockets/GHSocket.cs
new file mode 100644
index 00000000000..616cac1f3c8
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/GHSocket.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ /// <summary>
+ /// Summary description for GHSocket.
+ /// </summary>
+ internal interface GHSocket
+ {
+ int Available_internal(out int error);
+
+ void Blocking_internal(bool block, out int error);
+
+ EndPoint LocalEndPoint_internal(out int error);
+
+ EndPoint RemoteEndPoint_internal(out int error);
+
+ GHSocket Accept_internal(out int error);
+
+ void Bind_internal(EndPoint sa, out int error);
+
+ void Close_internal(out int error);
+
+ void Connect_internal(EndPoint sa, out int error);
+
+ void GetSocketOption_obj_internal(SocketOptionLevel level, SocketOptionName name,
+ out object obj_val, out int error);
+
+ void GetSocketOption_arr_internal(SocketOptionLevel level, SocketOptionName name,
+ ref byte[] byte_val, out int error);
+
+ int WSAIoctl (int ioctl_code, byte [] input, byte [] output, out int error);
+
+ void Listen_internal(int backlog, out int error);
+
+ bool Poll_internal (SelectMode mode, int timeout, Socket source, out int error);
+
+ int Receive_internal(byte[] buffer, int offset, int count, SocketFlags flags,
+ out int error);
+
+ int RecvFrom_internal(byte[] buffer, int offset, int count, SocketFlags flags,
+ ref SocketAddress sockaddr, out int error);
+
+ int Send_internal(byte[] buf, int offset, int count, SocketFlags flags,
+ out int error);
+
+ int SendTo_internal(byte[] buffer, int offset, int count,
+ SocketFlags flags, SocketAddress sa, out int error);
+
+ void SetSocketOption_internal (SocketOptionLevel level,
+ SocketOptionName name, object obj_val,
+ byte [] byte_val, int int_val, out int error);
+
+ void Shutdown_internal(SocketShutdown how, out int error);
+
+ void RegisterSelector(java.nio.channels.Selector selector, int mode, Socket source, out int error);
+
+ bool CheckConnectionFinished();
+
+ GHSocket ChangeToSSL(EndPoint remote_end);
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/GHSocketFactory.cs b/mcs/class/System/System.Net.Sockets/GHSocketFactory.cs
new file mode 100644
index 00000000000..b3ed216b8d7
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/GHSocketFactory.cs
@@ -0,0 +1,198 @@
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ /// <summary>
+ /// Summary description for GHSocketFactory.
+ /// </summary>
+ public class GHSocketFactory
+ {
+ internal static GHSocket Socket_internal(AddressFamily family,
+ SocketType type,
+ ProtocolType proto,
+ out int error)
+ {
+ if ( family == AddressFamily.InterNetwork &&
+ //(family == AddressFamily.InterNetwork || family == AddressFamily.InterNetworkV6) &&
+ (type == SocketType.Stream || type == SocketType.Unknown) &&
+ (proto == ProtocolType.Tcp || proto == ProtocolType.Unknown || proto == ProtocolType.Unspecified) )
+ {
+ error = 0;
+ return new GHStreamSocket();
+ }
+
+ error = 10044; //WSAESOCKTNOSUPPORT (Socket type not supported)
+ return null;
+ }
+
+ internal static void Select_internal (ref Socket [] sockets, int microSeconds, out int error)
+ {
+ error = 0;
+
+ java.nio.channels.Selector selector = java.nio.channels.Selector.open();
+
+ int mode = 0;
+ int count = sockets.Length;
+ for (int i = 0; i < count; i++)
+ {
+ if (sockets [i] == null)
+ { // separator
+ mode++;
+ continue;
+ }
+
+ GHSocket sock = sockets [i].GHHandle;
+ if (sock == null)
+ {
+ throw new ArgumentNullException ("GHSocket handle is null");
+ }
+
+ sock.RegisterSelector(selector, mode, sockets [i], out error);
+ if (error != 0)
+ {
+ error = 0;
+ sockets = null;
+ CloseSelector(selector);
+ return;
+ }
+ }
+
+ sockets = null;
+
+ long timeOutMillis = 1;
+ if (microSeconds < 0)
+ {
+ timeOutMillis = 0;
+ }
+ else if (microSeconds > 999)
+ {
+ timeOutMillis = (long)(microSeconds / 1000);
+ }
+
+ int readyCount = 0;
+ try
+ {
+ readyCount = selector.select(timeOutMillis);
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Select_internal selector.select - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (readyCount > 0)
+ {
+ try
+ {
+ sockets = new Socket[readyCount+2];
+ Socket[] writeList = new Socket[readyCount];
+ Socket[] errorList = new Socket[readyCount];
+
+ int readListCount = 0;
+ int writeListCount = 0;
+ int errorListCount = 0;
+
+ java.util.Set readyKeys = selector.selectedKeys();
+ java.util.Iterator it = readyKeys.iterator();
+
+ while (it.hasNext())
+ {
+ java.nio.channels.SelectionKey key = (java.nio.channels.SelectionKey)it.next();
+
+ if (key.isAcceptable() || key.isReadable())
+ {
+ sockets[readListCount] = (Socket)key.attachment();
+ readListCount++;
+ }
+ if (key.isWritable())
+ {
+ writeList[writeListCount] = (Socket)key.attachment();
+ writeListCount++;
+ }
+ if (key.isConnectable())
+ {
+ Socket source = (Socket)key.attachment();
+ if (source.GHHandle.CheckConnectionFinished())
+ {
+ writeList[writeListCount] = source;
+ writeListCount++;
+ }
+ else
+ {
+ errorList[errorListCount] = source;
+ errorListCount++;
+ }
+ }
+ }
+
+ sockets[readListCount] = null;
+ readListCount++;
+ for (int i = 0; i < writeListCount; i++, readListCount++)
+ {
+ sockets[readListCount] = writeList[i];
+ }
+ sockets[readListCount] = null;
+ readListCount++;
+ for (int i = 0; i < errorListCount; i++, readListCount++)
+ {
+ sockets[readListCount] = errorList[i];
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Select_internal iterate selected keys - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ CloseSelector(selector);
+ }
+
+ internal static void CloseSelector (java.nio.channels.Selector selector)
+ {
+ java.util.Set keys = selector.keys();
+ java.util.Iterator it = keys.iterator();
+
+ try
+ {
+ selector.close();
+ }
+ catch (Exception e)
+ {
+#if DEBUG
+ Console.WriteLine("Caught exception during CloseSelector selector.close - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ while (it.hasNext())
+ {
+ java.nio.channels.SelectionKey key = (java.nio.channels.SelectionKey)it.next();
+ Socket source = (Socket)key.attachment();
+ try
+ {
+ if (source.Blocking)
+ {
+ /*
+ A channel must be placed into non-blocking mode before being registered
+ with a selector, and may not be returned to blocking mode until it has been
+ deregistered. So, I need set the channel back to the blocking mode, if it was
+ in blocking mode before select operation
+ */
+ source.Blocking = true;
+ }
+ }
+ catch (Exception be)
+ {
+#if DEBUG
+ Console.WriteLine("Caught exception during CloseSelector source.Blocking - {0}: {1}\n{2}", be.GetType(), be.Message, be.StackTrace);
+#endif
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/GHStreamSocket.cs b/mcs/class/System/System.Net.Sockets/GHStreamSocket.cs
new file mode 100644
index 00000000000..035de50bf66
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/GHStreamSocket.cs
@@ -0,0 +1,1269 @@
+using System;
+using System.Net;
+using javax.net;
+using javax.net.ssl;
+using java.security;
+
+namespace System.Net.Sockets
+{
+ /// <summary>
+ /// Summary description for GHStreamSocket.
+ /// </summary>
+ internal class GHStreamSocket : GHSocket
+ {
+ java.net.ServerSocket jServerSocket;
+ java.net.Socket jSocket;
+ java.nio.channels.ServerSocketChannel jServerSocketChannel;
+ java.nio.channels.SocketChannel jSocketChannel;
+
+ // This field I need because a bug in the java.nio.channels.SocketAdapter, which
+ // returns local port 0 if the socket is not connected (even if the socket is bound)
+ // so I need temporary use regular socket (not channel socket) to bind it to the
+ // local address and use this address in the LocalPoint property and to create the
+ // actual client/server channel sockets
+ // The bug #5076965 (SocketChannel does not report local address after binding to a wildcard )
+ // See: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5076965
+ java.net.InetSocketAddress jTempLocalSocketAddress;
+
+ public GHStreamSocket()
+ {
+ jSocketChannel = java.nio.channels.SocketChannel.open();
+ jSocket = jSocketChannel.socket();
+ }
+
+ public GHStreamSocket(java.nio.channels.SocketChannel socketChannel)
+ {
+ jSocketChannel = socketChannel;
+ jSocket = jSocketChannel.socket();
+ }
+
+ public override int GetHashCode ()
+ {
+ if (jSocket == null && jServerSocket == null)
+ return -1;
+
+ if (jServerSocket != null) {
+ return jServerSocket.ToString ().GetHashCode ();
+ }
+
+ return jSocket.ToString ().GetHashCode ();
+ }
+
+ public int Available_internal(out int error)
+ {
+ error = 0;
+ int r = 0;
+
+ if (jSocket == null || !jSocket.isConnected())
+ {
+ return r;
+ }
+
+ try
+ {
+ r = jSocket.getInputStream().available();
+ }
+ catch (Exception e)
+ {
+ error = 10054; //WSAECONNRESET (Connection reset by peer)
+ r = 0;
+#if DEBUG
+ Console.WriteLine("Caught exception during Available_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ return r;
+ }
+
+ public void Blocking_internal(bool block, out int error)
+ {
+ error = 0;
+
+ if (jSocket == null && jServerSocket == null)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ try
+ {
+ if (jServerSocket != null)
+ {
+ jServerSocketChannel.configureBlocking(block);
+ }
+ else
+ {
+ jSocketChannel.configureBlocking(block);
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Blocking_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public EndPoint LocalEndPoint_internal(out int error)
+ {
+ error = 0;
+ java.net.InetSocketAddress localAddr = null;
+
+ try
+ {
+ if (jTempLocalSocketAddress != null)
+ {
+ localAddr = jTempLocalSocketAddress;
+ }
+ else if (jServerSocket != null)
+ {
+ localAddr = (java.net.InetSocketAddress)jServerSocket.getLocalSocketAddress();
+ }
+ else
+ {
+ localAddr = (java.net.InetSocketAddress)jSocket.getLocalSocketAddress();
+ }
+ }
+ catch (Exception e)
+ {
+ localAddr = null;
+#if DEBUG
+ Console.WriteLine("Caught exception during LocalEndPoint_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (localAddr == null || localAddr.getAddress() == null || localAddr.getPort() < 0)
+ {
+ return null;
+ }
+
+ IPHostEntry lipa = Dns.Resolve(localAddr.getHostName());
+ IPEndPoint ret = new IPEndPoint(lipa.AddressList[0], localAddr.getPort());
+ return ret;
+ }
+
+ public EndPoint RemoteEndPoint_internal(out int error)
+ {
+ error = 0;
+ java.net.InetSocketAddress remoteAddr = null;
+
+ if (jSocket == null || !jSocket.isBound())
+ {
+ return null;
+ }
+
+ try
+ {
+ remoteAddr = (java.net.InetSocketAddress)jSocket.getRemoteSocketAddress();
+ }
+ catch (Exception e)
+ {
+ remoteAddr = null;
+#if DEBUG
+ Console.WriteLine("Caught exception during RemoteEndPoint_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (remoteAddr == null || remoteAddr.getAddress() == null || remoteAddr.getPort() <= 0)
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return null;
+ }
+
+ IPHostEntry lipa = Dns.Resolve(remoteAddr.getHostName());
+ IPEndPoint ret = new IPEndPoint(lipa.AddressList[0], remoteAddr.getPort());
+ return ret;
+ }
+
+ public GHSocket Accept_internal(out int error)
+ {
+ error = 0;
+
+ if (jServerSocket == null)
+ {
+ throw new InvalidOperationException("You must call Bind and Listen before calling Accept.");
+ }
+
+ try
+ {
+ /*
+ If this channel is in non-blocking mode then this method will immediately
+ return null if there are no pending connections.
+ Otherwise it will block indefinitely until a new connection is
+ available or an I/O error occurs.
+ */
+ java.nio.channels.SocketChannel acceptedSocket = jServerSocketChannel.accept();
+ if (acceptedSocket == null)
+ {
+ error = 10035; //WSAEWOULDBLOCK (Resource temporarily unavailable)
+#if DEBUG
+ Console.WriteLine("The Accept_internal is in non-blocking mode and no pending connections are available");
+#endif
+ return null;
+ }
+
+ return new GHStreamSocket(acceptedSocket);
+ }
+ catch (Exception e)
+ {
+ error = 10061; //WSAECONNREFUSED (Connection refused)
+#if DEBUG
+ Console.WriteLine("Caught exception during Accept_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ return null;
+ }
+
+ public void Bind_internal(EndPoint sa, out int error)
+ {
+ error = 0;
+ IPEndPoint addr = sa as IPEndPoint;
+ if (addr == null)
+ {
+ error = 10044; //WSAESOCKTNOSUPPORT (Socket type not supported)
+ return;
+ }
+
+ if (jSocket == null || jSocket.isBound() || jSocket.isConnected() || jSocketChannel.isConnectionPending())
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ try
+ {
+ // This code I need because a bug in the java.nio.channels.SocketAdapter, which
+ // returns local port 0 if the socket is not connected (even if the socket is bound)
+ // so I need temporary use regular socket (not channel socket) to bind it to the
+ // local address and use this address in the LocalPoint property and to create the
+ // actual client/server channel sockets
+ // The bug #5076965 (SocketChannel does not report local address after binding to a wildcard )
+ // See: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5076965
+ java.net.Socket jTempSocket = new java.net.Socket();
+ jTempSocket.bind(new java.net.InetSocketAddress(java.net.InetAddress.getByName(addr.Address.ToString()),
+ addr.Port));
+ jTempLocalSocketAddress = (java.net.InetSocketAddress)jTempSocket.getLocalSocketAddress();
+ jTempSocket.close();
+ jSocket.bind(jTempLocalSocketAddress);
+ }
+ catch (Exception e)
+ {
+ error = 10048; //WSAEADDRINUSE (Address already in use)
+#if DEBUG
+ Console.WriteLine("Caught exception during Bind_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public void Close_internal(out int error)
+ {
+ error = 0;
+
+ if (jServerSocket != null)
+ {
+ try
+ {
+ jServerSocket.close();
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Close_internal jServerSocket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ try
+ {
+ jServerSocketChannel.close();
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Close_internal jServerSocketChannel - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ jServerSocket = null;
+ jServerSocketChannel = null;
+ }
+ else if (jSocket != null)
+ {
+ try
+ {
+ jSocket.close();
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Close_internal jSocket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ try
+ {
+ jSocketChannel.close();
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Close_internal jSocketChannel - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ jSocket = null;
+ jSocketChannel = null;
+ }
+ }
+
+ public void Connect_internal(EndPoint sa, out int error)
+ {
+ error = 0;
+
+ IPEndPoint addr = sa as IPEndPoint;
+ if (addr == null)
+ {
+ error = 10044; //WSAESOCKTNOSUPPORT (Socket type not supported)
+ return;
+ }
+
+ if (jSocket == null)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ if (jSocket.isConnected() || jSocketChannel.isConnectionPending())
+ {
+ error = 10056; //WSAEISCONN (Socket is already connected)
+ return;
+ }
+
+ try
+ {
+ /*
+ If this channel is in non-blocking mode then an invocation of this method
+ initiates a non-blocking connection operation. If the connection is
+ established immediately, as can happen with a local connection, then this
+ method returns true. Otherwise this method returns false.
+ If this channel is in blocking mode then an invocation of this method
+ will block until the connection is established or an I/O error occurs.
+ */
+ bool status = jSocketChannel.connect(new java.net.InetSocketAddress(
+ java.net.InetAddress.getByName(addr.Address.ToString()),
+ addr.Port));
+ if (!status)
+ {
+ error = 10035; //WSAEWOULDBLOCK (Resource temporarily unavailable)
+ }
+ }
+ catch (java.nio.channels.AlreadyConnectedException ae)
+ {
+ error = 10056; //WSAEISCONN (Socket is already connected)
+ }
+ catch (java.nio.channels.ConnectionPendingException cpe)
+ {
+ error = 10036; //WSAEINPROGRESS (Operation now in progress)
+ }
+ catch (java.nio.channels.UnresolvedAddressException uae)
+ {
+ error = 10039; //WSAEDESTADDRREQ (Destination address required)
+ }
+ catch (java.nio.channels.UnsupportedAddressTypeException uate)
+ {
+ error = 10041; //WSAEPROTOTYPE (Protocol wrong type for socket)
+ }
+ catch (Exception e)
+ {
+ error = 10061; //WSAECONNREFUSED (Connection refused)
+#if DEBUG
+ Console.WriteLine("Caught exception during Connect_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public void Listen_internal(int backlog, out int error)
+ {
+ error = 0;
+
+ if (jSocket == null || !jSocket.isBound())
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ if (jSocket.isConnected() || jSocketChannel.isConnectionPending())
+ {
+ error = 10056; //WSAEISCONN (Socket is already connected)
+ return;
+ }
+
+ bool blockMode = jSocketChannel.isBlocking();
+ bool reuseAddr = jSocket.getReuseAddress();
+
+ try
+ {
+ jSocket.close();
+ }
+ catch (Exception e)
+ {
+#if DEBUG
+ Console.WriteLine("Caught exception during Listen_internal close old jSocket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ try
+ {
+ jSocketChannel.close();
+ }
+ catch (Exception e)
+ {
+#if DEBUG
+ Console.WriteLine("Caught exception during Listen_internal close old jSocketChannel - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ jSocket = null;
+ jSocketChannel = null;
+
+ try
+ {
+ jServerSocketChannel = java.nio.channels.ServerSocketChannel.open();
+ jServerSocket = jServerSocketChannel.socket();
+ jServerSocket.bind(jTempLocalSocketAddress, backlog);
+ jServerSocketChannel.configureBlocking(blockMode);
+ jServerSocket.setReuseAddress(reuseAddr);
+ }
+ catch (Exception e)
+ {
+ error = 10048; //WSAEADDRINUSE (Address already in use)
+#if DEBUG
+ Console.WriteLine("Caught exception during Listen_internal create server socket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public bool Poll_internal (SelectMode mode, int timeout, Socket source, out int error)
+ {
+ error = 0;
+
+ if (mode == SelectMode.SelectError && !jSocketChannel.isConnectionPending())
+ {
+ return false;
+ }
+
+ java.nio.channels.Selector selector = java.nio.channels.Selector.open();
+ RegisterSelector(selector, ((mode == SelectMode.SelectRead)?0:1), source, out error);
+
+ if (error != 0)
+ {
+ error = 0;
+ GHSocketFactory.CloseSelector(selector);
+ return (mode == SelectMode.SelectError);
+ }
+
+ bool retVal = false;
+
+ long timeOutMillis = 1;
+ if (timeout < 0)
+ {
+ timeOutMillis = 0;
+ }
+ else if (timeout > 999)
+ {
+ timeOutMillis = (long)(timeout / 1000);
+ }
+
+ int readyCount = 0;
+ try
+ {
+ readyCount = selector.select(timeOutMillis);
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Poll_internal selector.select - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (readyCount > 0)
+ {
+ if (jSocket != null && jSocketChannel.isConnectionPending())
+ {
+ bool status = false;
+ try
+ {
+ status = jSocketChannel.finishConnect();
+ }
+ catch (Exception e)
+ {
+#if DEBUG
+ Console.WriteLine("Caught exception during Poll_internal, finishConnect - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ if (status)
+ {
+ retVal = (mode != SelectMode.SelectError);
+ }
+ else
+ {
+ retVal = (mode == SelectMode.SelectError);
+ }
+ }
+ else
+ {
+ retVal = true;
+ }
+ }
+
+ GHSocketFactory.CloseSelector(selector);
+
+ return retVal;
+ }
+
+ public void RegisterSelector(java.nio.channels.Selector selector, int mode, Socket source, out int error)
+ {
+ error = 0;
+ if (jServerSocket != null)
+ {
+ // only accept operation, which included to the read list, is allowed for server sockets
+ if (mode != 0)
+ {
+// error = 10038; //WSAENOTSOCK (Socket operation on nonsocket)
+#if DEBUG
+ Console.WriteLine("RegisterSelector, invalid mode {0} for the server socket", mode);
+#endif
+ return;
+ }
+
+ try
+ {
+ if (jServerSocketChannel.isBlocking())
+ {
+ /*
+ A channel must be placed into non-blocking mode before being registered
+ with a selector, and may not be returned to blocking mode until it has been
+ deregistered.
+ */
+ jServerSocketChannel.configureBlocking(false);
+ }
+
+ jServerSocketChannel.register(selector, java.nio.channels.SelectionKey.OP_ACCEPT, source);
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during RegisterSelector, register server socket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+ else
+ {
+ try
+ {
+ int ops = java.nio.channels.SelectionKey.OP_READ;
+ if (mode > 0)
+ {
+ if (jSocketChannel.isConnectionPending())
+ {
+ ops = java.nio.channels.SelectionKey.OP_CONNECT;
+ }
+ else
+ {
+ ops = java.nio.channels.SelectionKey.OP_WRITE;
+ }
+ }
+
+ if (jSocketChannel.isBlocking())
+ {
+ /*
+ A channel must be placed into non-blocking mode before being registered
+ with a selector, and may not be returned to blocking mode until it has been
+ deregistered.
+ */
+ jSocketChannel.configureBlocking(false);
+ }
+
+ jSocketChannel.register(selector, ops, source);
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during RegisterSelector, register client socket - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+ }
+
+ public bool CheckConnectionFinished()
+ {
+ bool status = true;
+ if (jSocket != null && jSocketChannel.isConnectionPending())
+ {
+ try
+ {
+ status = jSocketChannel.finishConnect();
+ }
+ catch (Exception e)
+ {
+ status = false;
+#if DEBUG
+ Console.WriteLine("Caught exception during Poll_internal, finishConnect - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ return status;
+ }
+
+ public int Receive_internal(byte[] buffer, int offset, int count, SocketFlags flags,
+ out int error)
+ {
+ error = 0;
+ int ret = 0;
+
+ if (jSocket == null)
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return ret;
+ }
+
+ try
+ {
+ if (jSocketChannel.isConnectionPending())
+ {
+ bool status = jSocketChannel.finishConnect();
+ if (!status)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Receive_internal, jSocketChannel.finishConnect return false");
+#endif
+ return 0;
+ }
+ }
+ else if (!jSocketChannel.isConnected())
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return ret;
+ }
+
+ java.nio.ByteBuffer readBuff = java.nio.ByteBuffer.wrap(vmw.common.TypeUtils.ToSByteArray(buffer), offset, count);
+ ret = jSocketChannel.read(readBuff);
+ if (ret < 0) ret = 0;
+ }
+ catch (Exception e)
+ {
+ error = 10054; //WSAECONNRESET (Connection reset by peer)
+ ret = 0;
+#if DEBUG
+ Console.WriteLine("Caught exception during Receive_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (ret == 0 && !jSocketChannel.isBlocking())
+ {
+ error = 10035; //WSAEWOULDBLOCK (Resource temporarily unavailable)
+ }
+ return ret;
+ }
+
+ public int RecvFrom_internal(byte[] buffer, int offset, int count, SocketFlags flags,
+ ref SocketAddress sockaddr, out int error)
+ {
+ return Receive_internal(buffer, offset, count, flags, out error);
+ }
+
+ public int Send_internal(byte[] buf, int offset, int count, SocketFlags flags,
+ out int error)
+ {
+ error = 0;
+ int ret = 0;
+
+ if (jSocket == null)
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return ret;
+ }
+
+ try
+ {
+ if (jSocketChannel.isConnectionPending())
+ {
+ bool status = jSocketChannel.finishConnect();
+ if (!status)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Send_internal, jSocketChannel.finishConnect return false");
+#endif
+ return 0;
+ }
+ }
+ else if (!jSocketChannel.isConnected())
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return ret;
+ }
+
+ java.nio.ByteBuffer writeBuff = java.nio.ByteBuffer.wrap(vmw.common.TypeUtils.ToSByteArray(buf), offset, count);
+ ret = jSocketChannel.write(writeBuff);
+ if (ret < 0) ret = 0;
+ }
+ catch (Exception e)
+ {
+ error = 10054; //WSAECONNRESET (Connection reset by peer)
+ ret = 0;
+#if DEBUG
+ Console.WriteLine("Caught exception during Send_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (ret == 0 && !jSocketChannel.isBlocking())
+ {
+ error = 10035; //WSAEWOULDBLOCK (Resource temporarily unavailable)
+ }
+ return ret;
+ }
+
+ public int SendTo_internal(byte[] buffer, int offset, int count,
+ SocketFlags flags, SocketAddress sa, out int error)
+ {
+ return Send_internal(buffer, offset, count, flags, out error);
+ }
+
+ public void SetSocketOption_internal (SocketOptionLevel level,
+ SocketOptionName name, object obj_val,
+ byte [] byte_val, int int_val, out int error)
+ {
+ error = 0;
+
+ if (byte_val != null)
+ {
+ error = -1;
+ throw new NotImplementedException();
+ }
+
+ if (jSocket == null && jServerSocket == null)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ switch (level)
+ {
+ case SocketOptionLevel.IPv6:
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ case SocketOptionLevel.IP:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ }
+ break;
+ case SocketOptionLevel.Udp:
+ if (name == SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ }
+ else
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ }
+ return;
+ case SocketOptionLevel.Tcp:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+ break;
+ }
+
+ try
+ {
+ bool bval = false;
+ int ival = 0;
+ switch (name)
+ {
+ case SocketOptionName.DontLinger:
+ jSocket.setSoLinger(false, 0);
+ break;
+ case SocketOptionName.Linger:
+ LingerOption lval = obj_val as LingerOption;
+ if (lval != null)
+ {
+ jSocket.setSoLinger(lval.Enabled, lval.LingerTime);
+ }
+ else
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ }
+ break;
+ case SocketOptionName.KeepAlive:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ jSocket.setKeepAlive(bval);
+ break;
+ case SocketOptionName.NoDelay:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ jSocket.setTcpNoDelay(bval);
+ break;
+ case SocketOptionName.ReceiveBuffer:
+ ival = int_val;
+ if (obj_val != null)
+ {
+ ival = (int) obj_val;
+ }
+ if (jServerSocket != null)
+ {
+ jServerSocket.setReceiveBufferSize(ival);
+ }
+ else
+ {
+ jSocket.setReceiveBufferSize(ival);
+ }
+ break;
+ case SocketOptionName.ReceiveTimeout:
+ ival = int_val;
+ if (obj_val != null)
+ {
+ ival = (int) obj_val;
+ }
+ if (jServerSocket != null)
+ {
+ jServerSocket.setSoTimeout(ival);
+ }
+ else
+ {
+ jSocket.setSoTimeout(ival);
+ }
+ break;
+ case SocketOptionName.ReuseAddress:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ if (jServerSocket != null)
+ {
+ jServerSocket.setReuseAddress(bval);
+ }
+ else
+ {
+ jSocket.setReuseAddress(bval);
+ }
+ break;
+ case SocketOptionName.SendBuffer:
+ ival = int_val;
+ if (obj_val != null)
+ {
+ ival = (int) obj_val;
+ }
+ jSocket.setSendBufferSize(ival);
+ break;
+ case SocketOptionName.OutOfBandInline:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ jSocket.setOOBInline(bval);
+ break;
+ default:
+ error = 10022; //WSAEINVAL (Invalid argument)
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ obj_val = null;
+ }
+ }
+
+ public void GetSocketOption_obj_internal(SocketOptionLevel level, SocketOptionName name,
+ out object obj_val, out int error)
+ {
+ obj_val = null;
+ error = 0;
+
+ if (jSocket == null && jServerSocket == null)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ switch (level)
+ {
+ case SocketOptionLevel.IPv6:
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ case SocketOptionLevel.IP:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ }
+ break;
+ case SocketOptionLevel.Udp:
+ if (name == SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ }
+ else
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ }
+ return;
+ case SocketOptionLevel.Tcp:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+ break;
+ }
+
+ try
+ {
+ bool bval = false;
+ int ival = 0;
+ switch (name)
+ {
+ case SocketOptionName.DontLinger:
+ ival = jSocket.getSoLinger();
+ if (ival == -1)
+ {
+ obj_val = 1;
+ }
+ else
+ {
+ obj_val = 0;
+ }
+ break;
+ case SocketOptionName.Linger:
+ ival = jSocket.getSoLinger();
+ if (ival == -1)
+ {
+ ival = 0;
+ }
+ LingerOption ret = new LingerOption((ival != 0), ival);
+ obj_val = ret;
+ break;
+ case SocketOptionName.KeepAlive:
+ bval = jSocket.getKeepAlive();
+ obj_val = ((bval)?1:0);
+ break;
+ case SocketOptionName.NoDelay:
+ bval = jSocket.getTcpNoDelay();
+ obj_val = ((bval)?1:0);
+ break;
+ case SocketOptionName.ReceiveBuffer:
+ if (jServerSocket != null)
+ {
+ ival = jServerSocket.getReceiveBufferSize();
+ }
+ else
+ {
+ ival = jSocket.getReceiveBufferSize();
+ }
+ obj_val = ival;
+ break;
+ case SocketOptionName.ReceiveTimeout:
+ if (jServerSocket != null)
+ {
+ ival = jServerSocket.getSoTimeout();
+ }
+ else
+ {
+ ival = jSocket.getSoTimeout();
+ }
+ obj_val = ival;
+ break;
+ case SocketOptionName.ReuseAddress:
+ if (jServerSocket != null)
+ {
+ bval = jServerSocket.getReuseAddress();
+ }
+ else
+ {
+ bval = jSocket.getReuseAddress();
+ }
+ obj_val = ((bval)?1:0);
+ break;
+ case SocketOptionName.SendBuffer:
+ ival = jSocket.getSendBufferSize();
+ obj_val = ival;
+ break;
+ case SocketOptionName.OutOfBandInline:
+ bval = jSocket.getOOBInline();
+ obj_val = ((bval)?1:0);
+ break;
+ default:
+ error = 10022; //WSAEINVAL (Invalid argument)
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ obj_val = null;
+ }
+ }
+
+ public void GetSocketOption_arr_internal(SocketOptionLevel level, SocketOptionName name,
+ ref byte[] byte_val, out int error)
+ {
+ error = -1;
+ throw new NotImplementedException();
+ }
+
+ public int WSAIoctl (int ioctl_code, byte [] input, byte [] output, out int error)
+ {
+ error = -1;
+ throw new NotImplementedException();
+ }
+
+ public void Shutdown_internal(SocketShutdown how, out int error)
+ {
+ error = 0;
+
+ if (jServerSocket != null || jSocket == null || !jSocket.isConnected())
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return;
+ }
+
+ try
+ {
+ switch (how)
+ {
+ case SocketShutdown.Receive:
+ jSocket.shutdownInput();
+ break;
+ case SocketShutdown.Send:
+ jSocket.shutdownOutput();
+ break;
+ case SocketShutdown.Both:
+ jSocket.shutdownInput();
+ jSocket.shutdownOutput();
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Shutdown_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ private java.io.FileInputStream searchDefaultCacerts()
+ {
+ try
+ {
+ string javaHome = java.lang.System.getProperty("java.home");
+ if(javaHome == null)
+ return null;
+
+ string keyStorePath = javaHome + "/lib/security/cacerts";
+ //Console.WriteLine("keyStorePath = {0}", keyStorePath);
+
+ java.io.File f = new java.io.File(keyStorePath);
+ if(!f.exists())
+ return null;
+ return new java.io.FileInputStream(f);
+ }
+ catch(Exception e)
+ {
+#if DEBUG
+ //todo log it
+ Console.WriteLine(e.GetType() + ":" + e.Message + "\n" + e.StackTrace);
+#endif
+ return null;
+ }
+ }
+
+ private SSLSocketFactory getSSLSocketFactory()
+ {
+ SSLSocketFactory factory = null;
+
+ try
+ {
+ //reading the keyStore path and password from the environment properties
+ string keyStorePath = java.lang.System.getProperty("javax.net.ssl.keyStore");
+ java.io.FileInputStream keyStoreStream = null;
+ if (keyStorePath != null)
+ {
+ java.io.File file = new java.io.File(keyStorePath);
+ if(file.exists())
+ keyStoreStream = new java.io.FileInputStream(file);
+ else
+ keyStoreStream = searchDefaultCacerts();
+ }
+ else
+ keyStoreStream = searchDefaultCacerts();
+
+ string keyStorePassWord = java.lang.System.getProperty("javax.net.ssl.keyStorePassword");
+ if (keyStorePassWord == null)
+ keyStorePassWord = "changeit";
+ char[] passphrase = keyStorePassWord.ToCharArray();
+
+ //initiating SSLContext
+ SSLContext ctx = SSLContext.getInstance("TLS");
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ KeyStore ks = KeyStore.getInstance("JKS");
+ if (keyStoreStream != null)
+ ks.load(keyStoreStream,passphrase);
+ else
+ ks.load(null,null);
+ kmf.init(ks, passphrase);
+ tmf.init(ks);
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ factory = ctx.getSocketFactory();
+ }
+ catch (Exception e)
+ {
+ factory = null;
+#if DEBUG
+ Console.WriteLine("Can't get SSL Socket Factory, the exception is {0}, {1}", e.GetType(), e.Message);
+#endif
+ }
+
+ return factory;
+ }
+
+ public GHSocket ChangeToSSL(EndPoint remote_end)
+ {
+ if (jSocket == null)
+ {
+ throw new InvalidOperationException("The underlying socket is null");
+ }
+
+ if (!jSocketChannel.isBlocking())
+ {
+ throw new NotImplementedException("The SSL Socket for non-blocking mode is not supported");
+ }
+
+ SSLSocketFactory factory = getSSLSocketFactory();
+ if (factory == null)
+ {
+ throw new ApplicationException("Can't get SSL Socket Factory");
+ }
+
+ int err;
+
+ // The problem with local address, when I closed the socket and try to create the new one
+ // bounded to the given local address, I receive exception "Address already in use"
+ IPEndPoint localEndPoint = null;
+// IPEndPoint localEndPoint = (IPEndPoint) LocalEndPoint_internal(out err);
+// if (err != 0)
+// localEndPoint = null;
+
+ IPEndPoint remoteEndPoint = remote_end as IPEndPoint;
+ if (remoteEndPoint == null)
+ {
+ remoteEndPoint = (IPEndPoint) RemoteEndPoint_internal(out err);
+ if (err != 0)
+ remoteEndPoint = null;
+ }
+
+ java.net.Socket sslSocket = null;
+ try
+ {
+ if (remoteEndPoint != null)
+ {
+ if (localEndPoint != null)
+ {
+ sslSocket = factory.createSocket(
+ java.net.InetAddress.getByName(remoteEndPoint.Address.ToString()),
+ remoteEndPoint.Port,
+ java.net.InetAddress.getByName(localEndPoint.Address.ToString()),
+ localEndPoint.Port);
+ }
+ else
+ {
+ sslSocket = factory.createSocket(
+ jSocket,
+ remoteEndPoint.Address.ToString(),
+ remoteEndPoint.Port,
+ false);
+ }
+
+ if (sslSocket != null)
+ {
+ String[] protocols = { "TLSv1", "SSLv3" };
+ ((SSLSocket)sslSocket).setUseClientMode(true);
+ ((SSLSocket)sslSocket).startHandshake();
+ }
+
+ }
+ else
+ {
+ sslSocket = factory.createSocket();
+ }
+ }
+ catch (Exception e)
+ {
+ sslSocket = null;
+#if DEBUG
+ Console.WriteLine("Can't create SSL Socket, the exception is {0}, {1}", e.GetType(), e.Message);
+#endif
+ }
+
+ if (sslSocket == null)
+ {
+// throw new ApplicationException("Can't create SSL Socket");
+ // it is important to the Socket class to distinguish if the underlying
+ // handle (GHSocket) is still valid and can be used as non-SSL, or it is already
+ // closed by this function and can't be used any more.
+ return null;
+ }
+
+/*
+ string[] arr = ((SSLSocket)sslSocket).getEnabledProtocols();
+ if (arr != null)
+ {
+ foreach (string s in arr)
+ Console.WriteLine("s:"+s);
+ }
+ string [] arr1 = ((SSLSocket)sslSocket).getEnabledCipherSuites();
+ if (arr1 != null)
+ {
+ foreach (string s in arr1)
+ Console.WriteLine("s:"+s);
+ }
+*/
+
+ return new GHStreamSocketSSL(sslSocket);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/GHStreamSocketSSL.cs b/mcs/class/System/System.Net.Sockets/GHStreamSocketSSL.cs
new file mode 100644
index 00000000000..429dae43332
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/GHStreamSocketSSL.cs
@@ -0,0 +1,620 @@
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ /// <summary>
+ /// Summary description for GHStreamSocket.
+ /// </summary>
+ internal class GHStreamSocketSSL : GHSocket
+ {
+ java.net.Socket jSocket;
+
+ public GHStreamSocketSSL(java.net.Socket sslSocket)
+ {
+ jSocket = sslSocket;
+ }
+
+ public override int GetHashCode ()
+ {
+ if (jSocket == null)
+ return -1;
+
+ return jSocket.ToString().GetHashCode();
+ }
+
+ public int Available_internal(out int error)
+ {
+ error = 0;
+ int r = 0;
+
+ if (jSocket == null || !jSocket.isConnected())
+ {
+ return r;
+ }
+
+ try
+ {
+ r = jSocket.getInputStream().available();
+ }
+ catch (Exception e)
+ {
+ error = 10054; //WSAECONNRESET (Connection reset by peer)
+ r = 0;
+#if DEBUG
+ Console.WriteLine("Caught exception during Available_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ return r;
+ }
+
+ public void Blocking_internal(bool block, out int error)
+ {
+ //SVETA: see in the non-blocking io
+ error = 0;
+
+ if (block == false)
+ throw new NotSupportedException();
+ }
+
+ public EndPoint LocalEndPoint_internal(out int error)
+ {
+ error = 0;
+ java.net.InetSocketAddress localAddr = null;
+
+ try
+ {
+ localAddr = (java.net.InetSocketAddress)jSocket.getLocalSocketAddress();
+ }
+ catch (Exception e)
+ {
+ localAddr = null;
+#if DEBUG
+ Console.WriteLine("Caught exception during LocalEndPoint_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (localAddr == null || localAddr.getAddress() == null || localAddr.getPort() < 0)
+ {
+ return null;
+ }
+
+ IPHostEntry lipa = Dns.Resolve(localAddr.getHostName());
+ IPEndPoint ret = new IPEndPoint(lipa.AddressList[0], localAddr.getPort());
+ return ret;
+ }
+
+ public EndPoint RemoteEndPoint_internal(out int error)
+ {
+ error = 0;
+ java.net.InetSocketAddress remoteAddr = null;
+
+ if (jSocket == null || !jSocket.isBound())
+ {
+ return null;
+ }
+
+ try
+ {
+ remoteAddr = (java.net.InetSocketAddress)jSocket.getRemoteSocketAddress();
+ }
+ catch (Exception e)
+ {
+ remoteAddr = null;
+#if DEBUG
+ Console.WriteLine("Caught exception during RemoteEndPoint_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ if (remoteAddr == null || remoteAddr.getAddress() == null || remoteAddr.getPort() <= 0)
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return null;
+ }
+
+ IPHostEntry lipa = Dns.Resolve(remoteAddr.getHostName());
+ IPEndPoint ret = new IPEndPoint(lipa.AddressList[0], remoteAddr.getPort());
+ return ret;
+ }
+
+ public GHSocket Accept_internal(out int error)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return null;
+ }
+
+ public void Bind_internal(EndPoint sa, out int error)
+ {
+ error = 0;
+ IPEndPoint addr = sa as IPEndPoint;
+ if (addr == null)
+ {
+ error = 10044; //WSAESOCKTNOSUPPORT (Socket type not supported)
+ return;
+ }
+
+ if (jSocket == null || jSocket.isBound() || jSocket.isConnected())
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ try
+ {
+ jSocket.bind(new java.net.InetSocketAddress(java.net.InetAddress.getByName(addr.Address.ToString()),
+ addr.Port));
+ }
+ catch (Exception e)
+ {
+ error = 10048; //WSAEADDRINUSE (Address already in use)
+#if DEBUG
+ Console.WriteLine("Caught exception during Bind_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public void Close_internal(out int error)
+ {
+ error = 0;
+
+ try
+ {
+ if (jSocket != null)
+ {
+ jSocket.close();
+ jSocket = null;
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Close_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public void Connect_internal(EndPoint sa, out int error)
+ {
+ error = 0;
+
+ IPEndPoint addr = sa as IPEndPoint;
+ if (addr == null)
+ {
+ error = 10044; //WSAESOCKTNOSUPPORT (Socket type not supported)
+ return;
+ }
+
+ if (jSocket == null)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ if (jSocket.isConnected())
+ {
+ error = 10056; //WSAEISCONN (Socket is already connected)
+ return;
+ }
+
+ try
+ {
+ jSocket.connect(new java.net.InetSocketAddress(
+ java.net.InetAddress.getByName(addr.Address.ToString()),
+ addr.Port));
+ }
+ catch (Exception e)
+ {
+ error = 10061; //WSAECONNREFUSED (Connection refused)
+#if DEBUG
+ Console.WriteLine("Caught exception during Connect_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public void Listen_internal(int backlog, out int error)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ public bool Poll_internal (SelectMode mode, int timeout, Socket source, out int error)
+ {
+ error = 0;
+ throw new NotImplementedException();
+ }
+
+ public int Receive_internal(byte[] buffer, int offset, int count, SocketFlags flags,
+ out int error)
+ {
+ error = 0;
+ int ret = 0;
+
+ if (jSocket == null || !jSocket.isConnected())
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return ret;
+ }
+
+ try
+ {
+ ret = jSocket.getInputStream().read(vmw.common.TypeUtils.ToSByteArray(buffer), offset, count);
+ if (ret < 0) ret = 0;
+ }
+ catch (Exception e)
+ {
+ error = 10054; //WSAECONNRESET (Connection reset by peer)
+ ret = 0;
+#if DEBUG
+ Console.WriteLine("Caught exception during Receive_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ return ret;
+ }
+
+ public int RecvFrom_internal(byte[] buffer, int offset, int count, SocketFlags flags,
+ ref SocketAddress sockaddr, out int error)
+ {
+ return Receive_internal(buffer, offset, count, flags, out error);
+ }
+
+ public int Send_internal(byte[] buf, int offset, int count, SocketFlags flags,
+ out int error)
+ {
+ error = 0;
+ int ret = 0;
+
+ if (jSocket == null || !jSocket.isConnected())
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return ret;
+ }
+
+ try
+ {
+ jSocket.getOutputStream().write(vmw.common.TypeUtils.ToSByteArray(buf), offset, count);
+ ret = count;
+ }
+ catch (Exception e)
+ {
+ error = 10054; //WSAECONNRESET (Connection reset by peer)
+ ret = 0;
+#if DEBUG
+ Console.WriteLine("Caught exception during Send_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+
+ return ret;
+ }
+
+ public int SendTo_internal(byte[] buffer, int offset, int count,
+ SocketFlags flags, SocketAddress sa, out int error)
+ {
+ return Send_internal(buffer, offset, count, flags, out error);
+ }
+
+ public void SetSocketOption_internal (SocketOptionLevel level,
+ SocketOptionName name, object obj_val,
+ byte [] byte_val, int int_val, out int error)
+ {
+ error = 0;
+
+ if (byte_val != null)
+ {
+ error = -1;
+ throw new NotImplementedException();
+ }
+
+ if (jSocket == null)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ switch (level)
+ {
+ case SocketOptionLevel.IPv6:
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ case SocketOptionLevel.IP:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ }
+ break;
+ case SocketOptionLevel.Udp:
+ if (name == SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ }
+ else
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ }
+ return;
+ case SocketOptionLevel.Tcp:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+ break;
+ }
+
+ try
+ {
+ bool bval = false;
+ int ival = 0;
+ switch (name)
+ {
+ case SocketOptionName.DontLinger:
+ jSocket.setSoLinger(false, 0);
+ break;
+ case SocketOptionName.Linger:
+ LingerOption lval = obj_val as LingerOption;
+ if (lval != null)
+ {
+ jSocket.setSoLinger(lval.Enabled, lval.LingerTime);
+ }
+ else
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ }
+ break;
+ case SocketOptionName.KeepAlive:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ jSocket.setKeepAlive(bval);
+ break;
+ case SocketOptionName.NoDelay:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ jSocket.setTcpNoDelay(bval);
+ break;
+ case SocketOptionName.ReceiveBuffer:
+ ival = int_val;
+ if (obj_val != null)
+ {
+ ival = (int) obj_val;
+ }
+ jSocket.setReceiveBufferSize(ival);
+ break;
+ case SocketOptionName.ReceiveTimeout:
+ ival = int_val;
+ if (obj_val != null)
+ {
+ ival = (int) obj_val;
+ }
+ jSocket.setSoTimeout(ival);
+ break;
+ case SocketOptionName.ReuseAddress:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ jSocket.setReuseAddress(bval);
+ break;
+ case SocketOptionName.SendBuffer:
+ ival = int_val;
+ if (obj_val != null)
+ {
+ ival = (int) obj_val;
+ }
+ jSocket.setSendBufferSize(ival);
+ break;
+ case SocketOptionName.OutOfBandInline:
+ if (obj_val != null)
+ {
+ bval = ((int)obj_val == 0)?false:true;
+ }
+ else
+ {
+ bval = (int_val == 0)?false:true;
+ }
+ jSocket.setOOBInline(bval);
+ break;
+ default:
+ error = 10022; //WSAEINVAL (Invalid argument)
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ obj_val = null;
+ }
+ }
+
+ public void GetSocketOption_obj_internal(SocketOptionLevel level, SocketOptionName name,
+ out object obj_val, out int error)
+ {
+ obj_val = null;
+ error = 0;
+
+ if (jSocket == null)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+
+ switch (level)
+ {
+ case SocketOptionLevel.IPv6:
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ case SocketOptionLevel.IP:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ return;
+ }
+ break;
+ case SocketOptionLevel.Udp:
+ if (name == SocketOptionName.NoDelay)
+ {
+ error = 10042; //WSAENOPROTOOPT (Bad protocol option)
+ }
+ else
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ }
+ return;
+ case SocketOptionLevel.Tcp:
+ if (name != SocketOptionName.NoDelay)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ return;
+ }
+ break;
+ }
+
+ try
+ {
+ bool bval = false;
+ int ival = 0;
+ switch (name)
+ {
+ case SocketOptionName.DontLinger:
+ ival = jSocket.getSoLinger();
+ if (ival == -1)
+ {
+ obj_val = 1;
+ }
+ else
+ {
+ obj_val = 0;
+ }
+ break;
+ case SocketOptionName.Linger:
+ ival = jSocket.getSoLinger();
+ if (ival == -1)
+ {
+ ival = 0;
+ }
+ LingerOption ret = new LingerOption((ival != 0), ival);
+ obj_val = ret;
+ break;
+ case SocketOptionName.KeepAlive:
+ bval = jSocket.getKeepAlive();
+ obj_val = ((bval)?1:0);
+ break;
+ case SocketOptionName.NoDelay:
+ bval = jSocket.getTcpNoDelay();
+ obj_val = ((bval)?1:0);
+ break;
+ case SocketOptionName.ReceiveBuffer:
+ ival = jSocket.getReceiveBufferSize();
+ obj_val = ival;
+ break;
+ case SocketOptionName.ReceiveTimeout:
+ ival = jSocket.getSoTimeout();
+ obj_val = ival;
+ break;
+ case SocketOptionName.ReuseAddress:
+ bval = jSocket.getReuseAddress();
+ obj_val = ((bval)?1:0);
+ break;
+ case SocketOptionName.SendBuffer:
+ ival = jSocket.getSendBufferSize();
+ obj_val = ival;
+ break;
+ case SocketOptionName.OutOfBandInline:
+ bval = jSocket.getOOBInline();
+ obj_val = ((bval)?1:0);
+ break;
+ default:
+ error = 10022; //WSAEINVAL (Invalid argument)
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+ obj_val = null;
+ }
+ }
+
+ public void GetSocketOption_arr_internal(SocketOptionLevel level, SocketOptionName name,
+ ref byte[] byte_val, out int error)
+ {
+ error = -1;
+ throw new NotImplementedException();
+ }
+
+ public int WSAIoctl (int ioctl_code, byte [] input, byte [] output, out int error)
+ {
+ error = -1;
+ throw new NotImplementedException();
+ }
+
+ public void Shutdown_internal(SocketShutdown how, out int error)
+ {
+ error = 0;
+
+ if (jSocket == null || !jSocket.isConnected())
+ {
+ error = 10057; //WSAENOTCONN (Socket is not connected)
+ return;
+ }
+
+ try
+ {
+ switch (how)
+ {
+ case SocketShutdown.Receive:
+ jSocket.shutdownInput();
+ break;
+ case SocketShutdown.Send:
+ jSocket.shutdownOutput();
+ break;
+ case SocketShutdown.Both:
+ jSocket.shutdownInput();
+ jSocket.shutdownOutput();
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ error = 10022; //WSAEINVAL (Invalid argument)
+#if DEBUG
+ Console.WriteLine("Caught exception during Shutdown_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
+#endif
+ }
+ }
+
+ public void RegisterSelector(java.nio.channels.Selector selector, int mode, Socket source, out int error)
+ {
+ throw new InvalidOperationException();
+ }
+
+ public bool CheckConnectionFinished()
+ {
+ throw new InvalidOperationException();
+ }
+
+ public GHSocket ChangeToSSL(EndPoint remote_end)
+ {
+ return this;
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/Socket.jvm.cs b/mcs/class/System/System.Net.Sockets/Socket.jvm.cs
new file mode 100644
index 00000000000..f45c6650c7f
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/Socket.jvm.cs
@@ -0,0 +1,2249 @@
+// System.Net.Sockets.Socket.cs
+//
+// Authors:
+// Phillip Pearson (pp@myelin.co.nz)
+// Dick Porter <dick@ximian.com>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (C) 2001, 2002 Phillip Pearson and Ximian, Inc.
+// http://www.myelin.co.nz
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Net;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Reflection;
+using System.IO;
+
+namespace System.Net.Sockets
+{
+ public class Socket : IDisposable
+ {
+ enum SocketOperation
+ {
+ Accept,
+ Connect,
+ Receive,
+ ReceiveFrom,
+ Send,
+ SendTo
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ private sealed class SocketAsyncResult: IAsyncResult
+ {
+ /* Same structure in the runtime */
+ public Socket Sock;
+#if !TARGET_JVM
+ public IntPtr handle;
+#else
+ public GHSocket handle;
+#endif
+ object state;
+ AsyncCallback callback;
+ WaitHandle waithandle;
+
+ Exception delayedException;
+
+ public EndPoint EndPoint; // Connect,ReceiveFrom,SendTo
+ public byte [] Buffer; // Receive,ReceiveFrom,Send,SendTo
+ public int Offset; // Receive,ReceiveFrom,Send,SendTo
+ public int Size; // Receive,ReceiveFrom,Send,SendTo
+ public SocketFlags SockFlags; // Receive,ReceiveFrom,Send,SendTo
+
+ // Return values
+ Socket acc_socket;
+ int total;
+
+ bool completed_sync;
+ bool completed;
+ public bool blocking;
+ internal int error;
+ SocketOperation operation;
+ public object ares;
+
+ public SocketAsyncResult (Socket sock, object state, AsyncCallback callback, SocketOperation operation)
+ {
+ this.Sock = sock;
+ this.blocking = sock.blocking;
+ this.handle = sock.socket;
+ this.state = state;
+ this.callback = callback;
+ this.operation = operation;
+ SockFlags = SocketFlags.None;
+ }
+
+ public void CheckIfThrowDelayedException ()
+ {
+ if (delayedException != null)
+ throw delayedException;
+
+ if (error != 0)
+ throw new SocketException (error);
+ }
+
+ void CompleteAllOnDispose (Queue queue)
+ {
+ object [] pending = queue.ToArray ();
+ queue.Clear ();
+
+ WaitCallback cb;
+ for (int i = 0; i < pending.Length; i++)
+ {
+ SocketAsyncResult ares = (SocketAsyncResult) pending [i];
+ cb = new WaitCallback (ares.CompleteDisposed);
+ ThreadPool.QueueUserWorkItem (cb, null);
+ }
+ }
+
+ void CompleteDisposed (object unused)
+ {
+ Complete ();
+ }
+
+ public void Complete ()
+ {
+ if (operation != SocketOperation.Receive && Sock.disposed)
+ delayedException = new ObjectDisposedException (Sock.GetType ().ToString ());
+
+ IsCompleted = true;
+
+ Queue queue = null;
+ if (operation == SocketOperation.Receive || operation == SocketOperation.ReceiveFrom)
+ {
+ queue = Sock.readQ;
+ }
+ else if (operation == SocketOperation.Send || operation == SocketOperation.SendTo)
+ {
+ queue = Sock.writeQ;
+ }
+
+ if (queue != null)
+ {
+ SocketAsyncCall sac = null;
+ SocketAsyncResult req = null;
+ lock (queue)
+ {
+ queue.Dequeue (); // remove ourselves
+ if (queue.Count > 0)
+ {
+ req = (SocketAsyncResult) queue.Peek ();
+ if (!Sock.disposed)
+ {
+ Worker worker = new Worker (req);
+ sac = GetDelegate (worker, req.operation);
+ }
+ else
+ {
+ CompleteAllOnDispose (queue);
+ }
+ }
+ }
+
+ if (sac != null)
+ sac.BeginInvoke (null, req);
+ }
+
+ if (callback != null)
+ callback (this);
+ }
+
+ SocketAsyncCall GetDelegate (Worker worker, SocketOperation op)
+ {
+ switch (op)
+ {
+ case SocketOperation.Receive:
+ return new SocketAsyncCall (worker.Receive);
+ case SocketOperation.ReceiveFrom:
+ return new SocketAsyncCall (worker.ReceiveFrom);
+ case SocketOperation.Send:
+ return new SocketAsyncCall (worker.Send);
+ case SocketOperation.SendTo:
+ return new SocketAsyncCall (worker.SendTo);
+ default:
+ return null; // never happens
+ }
+ }
+
+ public void Complete (bool synch)
+ {
+ completed_sync = synch;
+ Complete ();
+ }
+
+ public void Complete (int total)
+ {
+ this.total = total;
+ Complete ();
+ }
+
+ public void Complete (Exception e, bool synch)
+ {
+ completed_sync = synch;
+ delayedException = e;
+ Complete ();
+ }
+
+ public void Complete (Exception e)
+ {
+ delayedException = e;
+ Complete ();
+ }
+
+ public void Complete (Socket s)
+ {
+ acc_socket = s;
+ Complete ();
+ }
+
+ public object AsyncState
+ {
+ get
+ {
+ return state;
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle
+ {
+ get
+ {
+ lock (this)
+ {
+ if (waithandle == null)
+ waithandle = new ManualResetEvent (completed);
+ }
+
+ return waithandle;
+ }
+ set
+ {
+ waithandle=value;
+ }
+ }
+
+ public bool CompletedSynchronously
+ {
+ get
+ {
+ return(completed_sync);
+ }
+ }
+
+ public bool IsCompleted
+ {
+ get
+ {
+ return(completed);
+ }
+ set
+ {
+ completed=value;
+ lock (this)
+ {
+ if (waithandle != null && value)
+ {
+ ((ManualResetEvent) waithandle).Set ();
+ }
+ }
+ }
+ }
+
+ public Socket Socket
+ {
+ get
+ {
+ return acc_socket;
+ }
+ }
+
+ public int Total
+ {
+ get
+ {
+ return total;
+ }
+ set
+ {
+ total = value;
+ }
+ }
+ }
+
+ private sealed class Worker
+ {
+ SocketAsyncResult result;
+
+ public Worker (SocketAsyncResult ares)
+ {
+ this.result = ares;
+ }
+
+ public void Accept ()
+ {
+ Socket acc_socket = null;
+ try
+ {
+ acc_socket = result.Sock.Accept ();
+ }
+ catch (Exception e)
+ {
+ result.Complete (e);
+ return;
+ }
+
+ result.Complete (acc_socket);
+ }
+
+ public void Connect ()
+ {
+ try
+ {
+ result.Sock.Connect (result.EndPoint);
+ result.Sock.connected = true;
+ }
+ catch (Exception e)
+ {
+ result.Complete (e);
+ return;
+ }
+
+ result.Complete ();
+ }
+
+#if !TARGET_JVM
+ public void Receive ()
+ {
+ // Actual recv() done in the runtime
+ result.Complete ();
+ }
+#else
+ public void Receive ()
+ {
+ int total = 0;
+ try
+ {
+ total = result.Sock.Receive_nochecks (result.Buffer,
+ result.Offset,
+ result.Size,
+ result.SockFlags);
+ }
+ catch (Exception e)
+ {
+ result.Complete (e);
+ return;
+ }
+
+ result.Complete (total);
+ }
+#endif
+
+ public void ReceiveFrom ()
+ {
+ int total = 0;
+ try
+ {
+ total = result.Sock.ReceiveFrom_nochecks (result.Buffer,
+ result.Offset,
+ result.Size,
+ result.SockFlags,
+ ref result.EndPoint);
+ }
+ catch (Exception e)
+ {
+ result.Complete (e);
+ return;
+ }
+
+ result.Complete (total);
+ }
+
+ int send_so_far;
+
+ void UpdateSendValues (int last_sent)
+ {
+ if (result.error == 0)
+ {
+ send_so_far += last_sent;
+ result.Offset += last_sent;
+ result.Size -= last_sent;
+ }
+ }
+
+#if !TARGET_JVM
+ public void Send ()
+ {
+ // Actual send() done in the runtime
+ if (result.error == 0)
+ {
+ UpdateSendValues (result.Total);
+ if (result.Sock.disposed)
+ {
+ result.Complete ();
+ return;
+ }
+
+ if (result.Size > 0)
+ {
+ SocketAsyncCall sac = new SocketAsyncCall (this.Send);
+ sac.BeginInvoke (null, result);
+ return; // Have to finish writing everything. See bug #74475.
+ }
+ result.Total = send_so_far;
+ }
+ result.Complete ();
+ }
+#else
+ public void Send ()
+ {
+ int total = 0;
+ try
+ {
+ total = result.Sock.Send_nochecks (result.Buffer,
+ result.Offset,
+ result.Size,
+ result.SockFlags);
+
+ UpdateSendValues (total);
+ if (result.Size > 0)
+ {
+ SocketAsyncCall sac = new SocketAsyncCall (this.SendTo);
+ sac.BeginInvoke (null, result);
+ return; // Have to finish writing everything. See bug #74475.
+ }
+ result.Total = send_so_far;
+ }
+ catch (Exception e)
+ {
+ result.Complete (e);
+ return;
+ }
+
+ result.Complete ();
+ }
+#endif
+
+ public void SendTo ()
+ {
+ int total = 0;
+ try
+ {
+ total = result.Sock.SendTo_nochecks (result.Buffer,
+ result.Offset,
+ result.Size,
+ result.SockFlags,
+ result.EndPoint);
+
+ UpdateSendValues (total);
+ if (result.Size > 0)
+ {
+ SocketAsyncCall sac = new SocketAsyncCall (this.SendTo);
+ sac.BeginInvoke (null, result);
+ return; // Have to finish writing everything. See bug #74475.
+ }
+ result.Total = send_so_far;
+ }
+ catch (Exception e)
+ {
+ result.Complete (e);
+ return;
+ }
+
+ result.Complete ();
+ }
+ }
+
+
+ /* the field "socket" is looked up by name by the runtime */
+#if !TARGET_JVM
+ private IntPtr socket;
+#else
+ private GHSocket socket;
+#endif
+ private AddressFamily address_family;
+ private SocketType socket_type;
+ private ProtocolType protocol_type;
+ internal bool blocking=true;
+ private Queue readQ = new Queue (2);
+ private Queue writeQ = new Queue (2);
+
+
+ delegate void SocketAsyncCall ();
+ /*
+ * These two fields are looked up by name by the runtime, don't change
+ * their name without also updating the runtime code.
+ */
+ private static int ipv4Supported = -1, ipv6Supported = -1;
+
+ /* When true, the socket was connected at the time of
+ * the last IO operation
+ */
+ private bool connected=false;
+ /* true if we called Close_internal */
+ private bool closed;
+ internal bool disposed;
+
+ /* Used in LocalEndPoint and RemoteEndPoint if the
+ * Mono.Posix assembly is available
+ */
+ private static object unixendpoint=null;
+ private static Type unixendpointtype=null;
+
+ static void AddSockets (ArrayList sockets, IList list, string name)
+ {
+ if (list != null)
+ {
+ foreach (Socket sock in list)
+ {
+ if (sock == null) // MS throws a NullRef
+ throw new ArgumentNullException (name, "Contains a null element");
+ sockets.Add (sock);
+ }
+ }
+
+ sockets.Add (null);
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Select_internal (ref Socket [] sockets,
+ int microSeconds,
+ out int error);
+#else
+ private static void Select_internal (ref Socket [] sockets, int microSeconds, out int error)
+ {
+ GHSocketFactory.Select_internal(ref sockets, microSeconds, out error);
+ }
+#endif
+
+ public static void Select (IList checkRead, IList checkWrite, IList checkError, int microSeconds)
+ {
+ ArrayList list = new ArrayList ();
+ AddSockets (list, checkRead, "checkRead");
+ AddSockets (list, checkWrite, "checkWrite");
+ AddSockets (list, checkError, "checkError");
+
+ if (list.Count == 3)
+ {
+ throw new ArgumentNullException ("checkRead, checkWrite, checkError",
+ "All the lists are null or empty.");
+ }
+
+ int error;
+ /*
+ * The 'sockets' array contains: READ socket 0-n, null,
+ * WRITE socket 0-n, null,
+ * ERROR socket 0-n, null
+ */
+ Socket [] sockets = (Socket []) list.ToArray (typeof (Socket));
+ Select_internal (ref sockets, microSeconds, out error);
+
+ if (error != 0)
+ throw new SocketException (error);
+
+ if (checkRead != null)
+ checkRead.Clear ();
+
+ if (checkWrite != null)
+ checkWrite.Clear ();
+
+ if (checkError != null)
+ checkError.Clear ();
+
+ if (sockets == null)
+ return;
+
+ int mode = 0;
+ int count = sockets.Length;
+ IList currentList = checkRead;
+ for (int i = 0; i < count; i++)
+ {
+ Socket sock = sockets [i];
+ if (sock == null)
+ { // separator
+ currentList = (mode == 0) ? checkWrite : checkError;
+ mode++;
+ continue;
+ }
+
+ if (currentList != null)
+ {
+ sock.connected = true;
+ currentList.Add (sock);
+ }
+ }
+ }
+
+#if !TARGET_JVM
+ static Socket()
+ {
+ Assembly ass;
+
+ try {
+ ass = Assembly.Load (Consts.AssemblyMono_Posix);
+ } catch (FileNotFoundException) {
+ return;
+ }
+
+ unixendpointtype=ass.GetType("Mono.Posix.UnixEndPoint");
+
+ /* The endpoint Create() method is an instance
+ * method :-(
+ */
+ Type[] arg_types=new Type[1];
+ arg_types[0]=typeof(string);
+ ConstructorInfo cons=unixendpointtype.GetConstructor(arg_types);
+
+ object[] args=new object[1];
+ args[0]="";
+
+ unixendpoint=cons.Invoke(args);
+ }
+#endif
+
+#if !TARGET_JVM
+ // private constructor used by Accept, which already
+ // has a socket handle to use
+ private Socket(AddressFamily family, SocketType type,
+ ProtocolType proto, IntPtr sock)
+#else
+ // private constructor used by Accept, which already
+ // has a socket handle to use
+ private Socket(AddressFamily family, SocketType type,
+ ProtocolType proto, GHSocket sock)
+ {
+#endif
+ address_family=family;
+ socket_type=type;
+ protocol_type=proto;
+
+ socket=sock;
+ connected=true;
+ }
+
+
+#if !TARGET_JVM
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern IntPtr Socket_internal(AddressFamily family,
+ SocketType type,
+ ProtocolType proto,
+ out int error);
+#else
+ private GHSocket Socket_internal(AddressFamily family,
+ SocketType type,
+ ProtocolType proto,
+ out int error)
+ {
+ return GHSocketFactory.Socket_internal(family, type, proto, out error);
+ }
+#endif
+
+ public Socket(AddressFamily family, SocketType type,
+ ProtocolType proto)
+ {
+ address_family=family;
+ socket_type=type;
+ protocol_type=proto;
+ int error;
+
+ socket=Socket_internal(family, type, proto, out error);
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+
+ public AddressFamily AddressFamily
+ {
+ get
+ {
+ return(address_family);
+ }
+ }
+
+#if !TARGET_JVM
+ // Returns the amount of data waiting to be read on socket
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Available_internal(IntPtr socket,
+ out int error);
+#else
+ private int Available_internal(GHSocket socket, out int error)
+ {
+ return socket.Available_internal(out error);
+ }
+#endif
+
+ public int Available
+ {
+ get
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ int ret, error;
+
+ ret = Available_internal(socket, out error);
+
+ if (error != 0)
+ {
+ throw new SocketException (error);
+ }
+
+ return(ret);
+ }
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Blocking_internal(IntPtr socket,
+ bool block,
+ out int error);
+#else
+ private void Blocking_internal(GHSocket socket, bool block, out int error)
+ {
+ socket.Blocking_internal(block, out error);
+ }
+#endif
+
+ public bool Blocking
+ {
+ get
+ {
+ return(blocking);
+ }
+ set
+ {
+ int error;
+
+ Blocking_internal(socket, value, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ blocking=value;
+ }
+ }
+
+ public bool Connected
+ {
+ get
+ {
+ return(connected);
+ }
+ }
+
+#if !TARGET_JVM
+ public IntPtr Handle
+ {
+ get
+ {
+ return(socket);
+ }
+ }
+#else
+ public IntPtr Handle
+ {
+ get
+ {
+ return (IntPtr) (-1);
+ }
+ }
+
+ internal GHSocket GHHandle
+ {
+ get
+ {
+ return socket;
+ }
+ }
+#endif
+
+#if !TARGET_JVM
+ // Returns the local endpoint details in addr and port
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static SocketAddress LocalEndPoint_internal(IntPtr socket, out int error);
+
+ [MonoTODO("Support non-IP endpoints")]
+ public EndPoint LocalEndPoint
+ {
+ get
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ SocketAddress sa;
+ int error;
+
+ sa=LocalEndPoint_internal(socket, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ if(sa.Family==AddressFamily.InterNetwork || sa.Family==AddressFamily.InterNetworkV6) {
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ return new IPEndPoint(0, 0).Create(sa);
+ } else if (sa.Family==AddressFamily.Unix &&
+ unixendpoint!=null) {
+ return((EndPoint)unixendpointtype.InvokeMember("Create", BindingFlags.InvokeMethod|BindingFlags.Instance|BindingFlags.Public, null, unixendpoint, new object[] {sa}));
+ } else {
+ throw new NotImplementedException();
+ }
+ }
+ }
+#else
+ private EndPoint LocalEndPoint_internal(GHSocket socket, out int error)
+ {
+ return socket.LocalEndPoint_internal(out error);
+ }
+
+ public EndPoint LocalEndPoint
+ {
+ get
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ int error;
+
+ EndPoint ret = LocalEndPoint_internal(socket, out error);
+
+ if (error != 0)
+ {
+ throw new SocketException (error);
+ }
+
+ return ret;
+ }
+ }
+#endif
+
+ public ProtocolType ProtocolType
+ {
+ get
+ {
+ return(protocol_type);
+ }
+ }
+
+#if !TARGET_JVM
+ // Returns the remote endpoint details in addr and port
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static SocketAddress RemoteEndPoint_internal(IntPtr socket, out int error);
+
+ [MonoTODO("Support non-IP endpoints")]
+ public EndPoint RemoteEndPoint
+ {
+ get
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ SocketAddress sa;
+ int error;
+
+ sa=RemoteEndPoint_internal(socket, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ if(sa.Family==AddressFamily.InterNetwork || sa.Family==AddressFamily.InterNetworkV6 ) {
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ return new IPEndPoint(0, 0).Create(sa);
+ } else if (sa.Family==AddressFamily.Unix &&
+ unixendpoint!=null) {
+ return((EndPoint)unixendpointtype.InvokeMember("Create", BindingFlags.InvokeMethod|BindingFlags.Instance|BindingFlags.Public, null, unixendpoint, new object[] {sa}));
+ } else {
+ throw new NotImplementedException();
+ }
+ }
+ }
+#else
+ private EndPoint RemoteEndPoint_internal(GHSocket socket, out int error)
+ {
+ return socket.RemoteEndPoint_internal(out error);
+ }
+
+ public EndPoint RemoteEndPoint
+ {
+ get
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ int error;
+
+ EndPoint ret = RemoteEndPoint_internal(socket, out error);
+
+ if (error != 0)
+ {
+ throw new SocketException (error);
+ }
+
+ return ret;
+ }
+ }
+#endif
+
+ public SocketType SocketType
+ {
+ get
+ {
+ return(socket_type);
+ }
+ }
+
+#if NET_1_1
+ public static bool SupportsIPv4
+ {
+ get
+ {
+ CheckProtocolSupport();
+ return ipv4Supported == 1;
+ }
+ }
+
+ public static bool SupportsIPv6
+ {
+ get
+ {
+ CheckProtocolSupport();
+ return ipv6Supported == 1;
+ }
+ }
+#else
+ internal static bool SupportsIPv4
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ internal static bool SupportsIPv6
+ {
+ get
+ {
+ return false;
+ }
+ }
+#endif
+
+ internal static void CheckProtocolSupport()
+ {
+ if(ipv4Supported == -1)
+ {
+ try
+ {
+ Socket tmp = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ tmp.Close();
+
+ ipv4Supported = 1;
+ }
+ catch
+ {
+ ipv4Supported = 0;
+ }
+ }
+
+ if(ipv6Supported == -1)
+ {
+ NetConfig config = (NetConfig)System.Configuration.ConfigurationSettings.GetConfig("system.net/settings");
+
+ if(config != null)
+ ipv6Supported = config.ipv6Enabled?-1:0;
+
+ if(ipv6Supported != 0)
+ {
+ try
+ {
+ Socket tmp = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+ tmp.Close();
+
+ ipv6Supported = 1;
+ }
+ catch { }
+ }
+ }
+ }
+
+#if !TARGET_JVM
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static IntPtr Accept_internal(IntPtr sock,
+ out int error);
+#else
+ private GHSocket Accept_internal(GHSocket sock, out int error)
+ {
+ return sock.Accept_internal(out error);
+ }
+#endif
+
+ Thread blocking_thread;
+ public Socket Accept()
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ int error = 0;
+#if !TARGET_JVM
+ IntPtr sock = (IntPtr) (-1);
+#else
+ GHSocket sock = null;
+#endif
+ blocking_thread = Thread.CurrentThread;
+ try {
+ sock = Accept_internal(socket, out error);
+ } catch (ThreadAbortException the) {
+ if (disposed) {
+ Thread.ResetAbort ();
+ error = 10004;
+ }
+ } finally {
+ blocking_thread = null;
+ }
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ Socket accepted = new Socket(this.AddressFamily,
+ this.SocketType,
+ this.ProtocolType, sock);
+
+ accepted.Blocking = this.Blocking;
+ return(accepted);
+ }
+
+ public IAsyncResult BeginAccept(AsyncCallback callback,
+ object state)
+ {
+
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ SocketAsyncResult req = new SocketAsyncResult (this, state, callback, SocketOperation.Accept);
+ Worker worker = new Worker (req);
+ SocketAsyncCall sac = new SocketAsyncCall (worker.Accept);
+ sac.BeginInvoke (null, req);
+ return(req);
+ }
+
+ public IAsyncResult BeginConnect(EndPoint end_point,
+ AsyncCallback callback,
+ object state)
+ {
+
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (end_point == null)
+ throw new ArgumentNullException ("end_point");
+
+ SocketAsyncResult req = new SocketAsyncResult (this, state, callback, SocketOperation.Connect);
+ req.EndPoint = end_point;
+
+ // Bug #75154: Connect() should not succeed for .Any addresses.
+ if (end_point is IPEndPoint)
+ {
+ IPEndPoint ep = (IPEndPoint) end_point;
+ if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any))
+ {
+ req.Complete (new SocketException (10049), true);
+ return req;
+ }
+ }
+
+ int error = 0;
+ if (!blocking)
+ {
+#if !TARGET_JVM
+ SocketAddress serial = end_point.Serialize ();
+ Connect_internal (socket, serial, out error);
+#else
+ Connect_internal (socket, end_point, out error);
+#endif
+ if (error == 0)
+ {
+ // succeeded synch
+ connected = true;
+ req.Complete (true);
+ }
+ else if (error != 10036 && error != 10035)
+ {
+ // error synch
+ connected = false;
+ req.Complete (new SocketException (error), true);
+ }
+ }
+
+ if (blocking || error == 10036 || error == 10035)
+ {
+ // continue asynch
+ connected = false;
+ Worker worker = new Worker (req);
+ SocketAsyncCall sac = new SocketAsyncCall (worker.Connect);
+ sac.BeginInvoke (null, req);
+ }
+
+ return(req);
+ }
+
+ public IAsyncResult BeginReceive(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ AsyncCallback callback,
+ object state)
+ {
+
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0 || offset > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (size < 0 || offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ SocketAsyncResult req;
+ lock (readQ)
+ {
+ req = new SocketAsyncResult (this, state, callback, SocketOperation.Receive);
+ req.Buffer = buffer;
+ req.Offset = offset;
+ req.Size = size;
+ req.SockFlags = socket_flags;
+ readQ.Enqueue (req);
+ if (readQ.Count == 1)
+ {
+ Worker worker = new Worker (req);
+ SocketAsyncCall sac = new SocketAsyncCall (worker.Receive);
+ sac.BeginInvoke (null, req);
+ }
+ }
+
+ return req;
+ }
+
+ public IAsyncResult BeginReceiveFrom(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ ref EndPoint remote_end,
+ AsyncCallback callback,
+ object state)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset must be >= 0");
+
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("size must be >= 0");
+
+ if (offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset + size exceeds the buffer length");
+
+ SocketAsyncResult req;
+ lock (readQ)
+ {
+ req = new SocketAsyncResult (this, state, callback, SocketOperation.ReceiveFrom);
+ req.Buffer = buffer;
+ req.Offset = offset;
+ req.Size = size;
+ req.SockFlags = socket_flags;
+ req.EndPoint = remote_end;
+ readQ.Enqueue (req);
+ if (readQ.Count == 1)
+ {
+ Worker worker = new Worker (req);
+ SocketAsyncCall sac = new SocketAsyncCall (worker.ReceiveFrom);
+ sac.BeginInvoke (null, req);
+ }
+ }
+ return req;
+ }
+
+ public IAsyncResult BeginSend (byte[] buffer, int offset, int size, SocketFlags socket_flags,
+ AsyncCallback callback, object state)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset must be >= 0");
+
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("size must be >= 0");
+
+ if (offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset + size exceeds the buffer length");
+
+ SocketAsyncResult req;
+ lock (writeQ)
+ {
+ req = new SocketAsyncResult (this, state, callback, SocketOperation.Send);
+ req.Buffer = buffer;
+ req.Offset = offset;
+ req.Size = size;
+ req.SockFlags = socket_flags;
+ writeQ.Enqueue (req);
+ if (writeQ.Count == 1)
+ {
+ Worker worker = new Worker (req);
+ SocketAsyncCall sac = new SocketAsyncCall (worker.Send);
+ sac.BeginInvoke (null, req);
+ }
+ }
+ return req;
+ }
+
+ public IAsyncResult BeginSendTo(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ EndPoint remote_end,
+ AsyncCallback callback,
+ object state)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset must be >= 0");
+
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("size must be >= 0");
+
+ if (offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset + size exceeds the buffer length");
+
+ SocketAsyncResult req;
+ lock (writeQ)
+ {
+ req = new SocketAsyncResult (this, state, callback, SocketOperation.SendTo);
+ req.Buffer = buffer;
+ req.Offset = offset;
+ req.Size = size;
+ req.SockFlags = socket_flags;
+ req.EndPoint = remote_end;
+ writeQ.Enqueue (req);
+ if (writeQ.Count == 1)
+ {
+ Worker worker = new Worker (req);
+ SocketAsyncCall sac = new SocketAsyncCall (worker.SendTo);
+ sac.BeginInvoke (null, req);
+ }
+ }
+ return req;
+ }
+
+#if !TARGET_JVM
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Bind_internal(IntPtr sock,
+ SocketAddress sa,
+ out int error);
+
+ public void Bind(EndPoint local_end)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if(local_end==null) {
+ throw new ArgumentNullException("local_end");
+ }
+
+ int error;
+
+ Bind_internal(socket, local_end.Serialize(),
+ out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+#else
+ private void Bind_internal(GHSocket sock,
+ EndPoint sa,
+ out int error)
+ {
+ sock.Bind_internal(sa, out error);
+ }
+
+ public void Bind(EndPoint local_end)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if(local_end==null) {
+ throw new ArgumentNullException("local_end");
+ }
+
+ int error;
+
+ Bind_internal(socket, local_end,
+ out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+#endif
+
+#if !TARGET_JVM
+ // Closes the socket
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Close_internal(IntPtr socket,
+ out int error);
+#else
+ private void Close_internal(GHSocket socket, out int error)
+ {
+ socket.Close_internal(out error);
+ }
+#endif
+
+ public void Close()
+ {
+ ((IDisposable) this).Dispose ();
+ }
+
+#if !TARGET_JVM
+ // Connects to the remote address
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Connect_internal(IntPtr sock,
+ SocketAddress sa,
+ out int error);
+#else
+ private void Connect_internal(GHSocket sock,
+ EndPoint sa,
+ out int error)
+ {
+ sock.Connect_internal(sa, out error);
+ }
+#endif
+
+ public void Connect(EndPoint remote_end)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if(remote_end==null) {
+ throw new ArgumentNullException("remote_end");
+ }
+
+ if (remote_end is IPEndPoint) {
+ IPEndPoint ep = (IPEndPoint) remote_end;
+ if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any))
+ throw new SocketException (10049);
+ }
+
+ int error = 0;
+
+ blocking_thread = Thread.CurrentThread;
+ try {
+#if !TARGET_JVM
+ Connect_internal (socket, remote_end.Serialize(), out error);
+#else
+ Connect_internal (socket, remote_end, out error);
+#endif
+ }
+ catch (ThreadAbortException the)
+ {
+ if (disposed) {
+ Thread.ResetAbort ();
+ error = 10004;
+ }
+ } finally {
+ blocking_thread = null;
+ }
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ connected=true;
+ }
+
+#if TARGET_JVM
+ public void ChangeToSSL()
+ {
+ try
+ {
+ GHSocket tmp = socket.ChangeToSSL(null);
+ if (tmp != null)
+ {
+ socket = tmp;
+ }
+ }
+ catch (Exception e)
+ {
+#if DEBUG
+ Console.WriteLine("Caught exception during ChangeToSSL: {0}, {1}", e.GetType(), e.Message);
+#endif
+ throw new SocketException(10045);
+ }
+ }
+#endif
+
+ public Socket EndAccept(IAsyncResult result)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult", "result");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ req.CheckIfThrowDelayedException();
+ return req.Socket;
+ }
+
+ public void EndConnect(IAsyncResult result) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult", "result");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ req.CheckIfThrowDelayedException();
+ }
+
+ public int EndReceive(IAsyncResult result) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult", "result");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ req.CheckIfThrowDelayedException();
+ return req.Total;
+ }
+
+ public int EndReceiveFrom(IAsyncResult result,
+ ref EndPoint end_point) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult", "result");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ req.CheckIfThrowDelayedException();
+ end_point = req.EndPoint;
+ return req.Total;
+ }
+
+ public int EndSend(IAsyncResult result) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult", "result");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ req.CheckIfThrowDelayedException();
+ return req.Total;
+ }
+
+ public int EndSendTo(IAsyncResult result) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult", "result");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ req.CheckIfThrowDelayedException();
+ return req.Total;
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void GetSocketOption_obj_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, out object obj_val, out int error);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void GetSocketOption_arr_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, ref byte[] byte_val, out int error);
+#else
+ private void GetSocketOption_obj_internal(GHSocket socket, SocketOptionLevel level,
+ SocketOptionName name, out object obj_val, out int error)
+ {
+ socket.GetSocketOption_obj_internal(level, name, out obj_val, out error);
+ }
+ private void GetSocketOption_arr_internal(GHSocket socket, SocketOptionLevel level,
+ SocketOptionName name, ref byte[] byte_val, out int error)
+ {
+ socket.GetSocketOption_arr_internal(level, name, ref byte_val, out error);
+ }
+#endif
+
+ public object GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name) {
+ object obj_val;
+ int error;
+
+ GetSocketOption_obj_internal(socket, level, name,
+ out obj_val, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ if(name==SocketOptionName.Linger) {
+ return((LingerOption)obj_val);
+ } else if (name==SocketOptionName.AddMembership ||
+ name==SocketOptionName.DropMembership) {
+ return((MulticastOption)obj_val);
+ } else if (obj_val is int) {
+ return((int)obj_val);
+ } else {
+ return(obj_val);
+ }
+ }
+
+ public void GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ byte[] opt_value) {
+ int error;
+
+ GetSocketOption_arr_internal(socket, level, name,
+ ref opt_value, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+
+ public byte[] GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ int length) {
+ byte[] byte_val=new byte[length];
+ int error;
+
+ GetSocketOption_arr_internal(socket, level, name,
+ ref byte_val, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ return(byte_val);
+ }
+
+#if !TARGET_JVM
+ // See Socket.IOControl, WSAIoctl documentation in MSDN. The
+ // common options between UNIX and Winsock are FIONREAD,
+ // FIONBIO and SIOCATMARK. Anything else will depend on the
+ // system.
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static int WSAIoctl (IntPtr sock, int ioctl_code,
+ byte [] input, byte [] output,
+ out int error);
+#else
+ int WSAIoctl (GHSocket sock, int ioctl_code,
+ byte [] input, byte [] output,
+ out int error)
+ {
+ return sock.WSAIoctl(ioctl_code, input, output, out error);
+ }
+#endif
+
+ public int IOControl (int ioctl_code, byte [] in_value, byte [] out_value)
+ {
+ if (disposed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ int error;
+ int result = WSAIoctl (socket, ioctl_code, in_value,
+ out_value, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+
+ if (result == -1)
+ throw new InvalidOperationException ("Must use Blocking property instead.");
+
+ return result;
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Listen_internal(IntPtr sock,
+ int backlog,
+ out int error);
+#else
+ private void Listen_internal(GHSocket sock,
+ int backlog,
+ out int error)
+ {
+ sock.Listen_internal(backlog, out error);
+ }
+#endif
+
+ public void Listen(int backlog)
+ {
+ int error;
+
+ Listen_internal(socket, backlog, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static bool Poll_internal (IntPtr socket, SelectMode mode, int timeout, out int error);
+#else
+ bool Poll_internal (GHSocket socket, SelectMode mode, int timeout, out int error)
+ {
+ return socket.Poll_internal(mode, timeout, this, out error);
+ }
+#endif
+
+ public bool Poll(int time_us, SelectMode mode)
+ {
+ if (mode != SelectMode.SelectRead &&
+ mode != SelectMode.SelectWrite &&
+ mode != SelectMode.SelectError)
+ throw new NotSupportedException ("'mode' parameter is not valid.");
+
+ int error;
+ bool result = Poll_internal (socket, mode, time_us, out error);
+ if (error != 0)
+ throw new SocketException (error);
+
+ if (result == true) {
+ /* Update the connected state; for
+ * non-blocking Connect()s this is
+ * when we can find out that the
+ * connect succeeded.
+ */
+ connected = true;
+ }
+
+ return result;
+ }
+
+ public int Receive (byte [] buf)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ return Receive_nochecks (buf, 0, buf.Length, SocketFlags.None);
+ }
+
+ public int Receive (byte [] buf, SocketFlags flags)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ return Receive_nochecks (buf, 0, buf.Length, flags);
+ }
+
+ public int Receive (byte [] buf, int size, SocketFlags flags)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ if (size < 0 || size > buf.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return Receive_nochecks (buf, 0, size, flags);
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Receive_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ out int error);
+#else
+ private int Receive_internal(GHSocket sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ out int error)
+ {
+ return sock.Receive_internal(buffer, offset, count, flags, out error);
+ }
+#endif
+
+ public int Receive (byte [] buf, int offset, int size, SocketFlags flags)
+ {
+ if(buf==null)
+ throw new ArgumentNullException ("buf");
+
+ if (offset < 0 || offset > buf.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (size < 0 || offset + size > buf.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return Receive_nochecks (buf, offset, size, flags);
+ }
+
+ int Receive_nochecks (byte [] buf, int offset, int size, SocketFlags flags)
+ {
+ int ret, error;
+ ret = Receive_internal (socket, buf, offset, size, flags, out error);
+
+ if(error != 0) {
+ if (error != 10035 && error != 10036) // WSAEWOULDBLOCK && WSAEINPROGRESS
+ connected=false;
+
+ throw new SocketException (error);
+ }
+
+ connected=true;
+
+ return ret;
+ }
+
+ public int ReceiveFrom (byte [] buf, ref EndPoint remote_end)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ if (remote_end == null)
+ throw new ArgumentNullException ("remote_end");
+
+ return ReceiveFrom_nochecks (buf, 0, buf.Length, SocketFlags.None, ref remote_end);
+ }
+
+ public int ReceiveFrom (byte [] buf, SocketFlags flags, ref EndPoint remote_end)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ if (remote_end == null)
+ throw new ArgumentNullException ("remote_end");
+
+
+ return ReceiveFrom_nochecks (buf, 0, buf.Length, flags, ref remote_end);
+ }
+
+ public int ReceiveFrom(byte[] buf, int size, SocketFlags flags,
+ ref EndPoint remote_end)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ if (remote_end == null)
+ throw new ArgumentNullException ("remote_end");
+
+ if (size < 0 || size > buf.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return ReceiveFrom_nochecks (buf, 0, size, flags, ref remote_end);
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int RecvFrom_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ ref SocketAddress sockaddr,
+ out int error);
+#else
+ private int RecvFrom_internal(GHSocket sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ ref SocketAddress sockaddr,
+ out int error)
+ {
+ return sock.RecvFrom_internal(buffer, offset, count, flags, ref sockaddr, out error);
+ }
+
+#endif
+
+ public int ReceiveFrom(byte[] buf, int offset, int size, SocketFlags flags,
+ ref EndPoint remote_end)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ if (remote_end == null)
+ throw new ArgumentNullException ("remote_end");
+
+ if (offset < 0 || offset > buf.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (size < 0 || offset + size > buf.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return ReceiveFrom_nochecks (buf, offset, size, flags, ref remote_end);
+ }
+
+ int ReceiveFrom_nochecks (byte [] buf, int offset, int size, SocketFlags flags,
+ ref EndPoint remote_end)
+ {
+ SocketAddress sockaddr=remote_end.Serialize();
+ int cnt, error;
+
+ cnt = RecvFrom_internal (socket, buf, offset, size, flags, ref sockaddr, out error);
+
+ if (error != 0) {
+ if (error != 10035 && error != 10036) // WSAEWOULDBLOCK && WSAEINPROGRESS
+ connected=false;
+
+ throw new SocketException (error);
+ }
+
+ connected=true;
+
+ // If sockaddr is null then we're a connection
+ // oriented protocol and should ignore the
+ // remote_end parameter (see MSDN
+ // documentation for Socket.ReceiveFrom(...) )
+
+ if ( sockaddr != null ) {
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ remote_end=remote_end.Create(sockaddr);
+ }
+
+ return cnt;
+ }
+
+ public int Send (byte [] buf)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ return Send_nochecks (buf, 0, buf.Length, SocketFlags.None);
+ }
+
+ public int Send (byte [] buf, SocketFlags flags)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ return Send_nochecks (buf, 0, buf.Length, flags);
+ }
+
+ public int Send (byte [] buf, int size, SocketFlags flags)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buf");
+
+ if (size < 0 || size > buf.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return Send_nochecks (buf, 0, size, flags);
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Send_internal(IntPtr sock,
+ byte[] buf, int offset,
+ int count,
+ SocketFlags flags,
+ out int error);
+#else
+ private int Send_internal(GHSocket sock,
+ byte[] buf, int offset,
+ int count,
+ SocketFlags flags,
+ out int error)
+ {
+ return sock.Send_internal(buf, offset, count, flags, out error);
+ }
+#endif
+
+ public int Send (byte[] buf, int offset, int size, SocketFlags flags)
+ {
+ if (buf == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0 || offset > buf.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (size < 0 || offset + size > buf.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return Send_nochecks (buf, offset, size, flags);
+ }
+
+ int Send_nochecks (byte [] buf, int offset, int size, SocketFlags flags)
+ {
+ if (size == 0)
+ return 0;
+
+ int ret, error;
+
+ ret = Send_internal (socket, buf, offset, size, flags, out error);
+
+ if (error != 0) {
+ if (error != 10035 && error != 10036) // WSAEWOULDBLOCK && WSAEINPROGRESS
+ connected = false;
+
+ throw new SocketException (error);
+ }
+ connected = true;
+
+ return ret;
+ }
+
+ public int SendTo (byte [] buffer, EndPoint remote_end)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (remote_end == null)
+ throw new ArgumentNullException ("remote_end");
+
+ return SendTo_nochecks (buffer, 0, buffer.Length, SocketFlags.None, remote_end);
+ }
+
+ public int SendTo (byte [] buffer, SocketFlags flags, EndPoint remote_end)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (remote_end == null)
+ throw new ArgumentNullException ("remote_end");
+
+ return SendTo_nochecks (buffer, 0, buffer.Length, flags, remote_end);
+ }
+
+ public int SendTo (byte [] buffer, int size, SocketFlags flags, EndPoint remote_end)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (remote_end == null)
+ throw new ArgumentNullException ("remote_end");
+
+ if (size < 0 || size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return SendTo_nochecks (buffer, 0, size, flags, remote_end);
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int SendTo_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ SocketAddress sa,
+ out int error);
+#else
+ private int SendTo_internal(GHSocket sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ SocketAddress sa,
+ out int error)
+ {
+ return sock.SendTo_internal(buffer, offset, count, flags, sa, out error);
+ }
+#endif
+
+ public int SendTo(byte[] buffer, int offset, int size, SocketFlags flags,
+ EndPoint remote_end)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (remote_end == null)
+ throw new ArgumentNullException("remote_end");
+
+ if (offset < 0 || offset > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset");
+
+ if (size < 0 || offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("size");
+
+ return SendTo_nochecks (buffer, offset, size, flags, remote_end);
+ }
+
+ int SendTo_nochecks (byte [] buffer, int offset, int size, SocketFlags flags,
+ EndPoint remote_end)
+ {
+ SocketAddress sockaddr=remote_end.Serialize();
+
+ int ret, error;
+
+ ret = SendTo_internal (socket, buffer, offset, size, flags, sockaddr, out error);
+
+ if (error != 0) {
+ if (error != 10035 && error != 10036) // WSAEWOULDBLOCK && WSAEINPROGRESS
+ connected=false;
+
+ throw new SocketException (error);
+ }
+
+ connected=true;
+
+ return ret;
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void SetSocketOption_internal (IntPtr socket, SocketOptionLevel level,
+ SocketOptionName name, object obj_val,
+ byte [] byte_val, int int_val,
+ out int error);
+#else
+ private void SetSocketOption_internal (GHSocket socket, SocketOptionLevel level,
+ SocketOptionName name, object obj_val,
+ byte [] byte_val, int int_val,
+ out int error)
+ {
+ socket.SetSocketOption_internal(level, name, obj_val, byte_val, int_val, out error);
+ }
+#endif
+
+ public void SetSocketOption (SocketOptionLevel level, SocketOptionName name, byte[] opt_value)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+ int error;
+
+ SetSocketOption_internal(socket, level, name, null,
+ opt_value, 0, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+
+ public void SetSocketOption (SocketOptionLevel level, SocketOptionName name, int opt_value)
+ {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ int error;
+
+ SetSocketOption_internal(socket, level, name, null,
+ null, opt_value, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+
+ public void SetSocketOption (SocketOptionLevel level, SocketOptionName name, object opt_value)
+ {
+
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if(opt_value==null) {
+ throw new ArgumentNullException();
+ }
+
+ int error;
+ /* From MS documentation on SetSocketOption: "For an
+ * option with a Boolean data type, specify a nonzero
+ * value to enable the option, and a zero value to
+ * disable the option."
+ * Booleans are only handled in 2.0
+ */
+
+ if (opt_value is System.Boolean) {
+#if NET_2_0
+ bool bool_val = (bool) opt_value;
+ int int_val = (bool_val) ? 1 : 0;
+
+ SetSocketOption_internal (socket, level, name, null, null, int_val, out error);
+#else
+ throw new ArgumentException ("Use an integer 1 (true) or 0 (false) instead of a boolean.", "opt_value");
+#endif
+ } else {
+ SetSocketOption_internal (socket, level, name, opt_value, null, 0, out error);
+ }
+
+ if (error != 0)
+ throw new SocketException (error);
+ }
+
+#if !TARGET_JVM
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Shutdown_internal(IntPtr socket, SocketShutdown how, out int error);
+#else
+ private void Shutdown_internal(GHSocket socket, SocketShutdown how, out int error)
+ {
+ socket.Shutdown_internal(how, out error);
+ }
+#endif
+
+ public void Shutdown(SocketShutdown how)
+ {
+ int error;
+
+ Shutdown_internal(socket, how, out error);
+
+ if (error != 0) {
+ throw new SocketException (error);
+ }
+ }
+
+#if !TARGET_JVM
+ public override int GetHashCode ()
+ {
+ return (int) socket;
+ }
+#else
+ public override int GetHashCode ()
+ {
+ if (socket == null)
+ return -1;
+
+ return socket.GetHashCode();
+ }
+#endif
+
+#if !TARGET_JVM
+ protected virtual void Dispose (bool explicitDisposing)
+ {
+ if (disposed)
+ return;
+
+ disposed = true;
+ connected = false;
+ if ((int) socket != -1)
+ {
+ int error;
+ closed = true;
+ IntPtr x = socket;
+ socket = (IntPtr) (-1);
+ Close_internal (x, out error);
+ if (blocking_thread != null)
+ {
+ blocking_thread.Abort ();
+ blocking_thread = null;
+ }
+
+ if (error != 0)
+ throw new SocketException (error);
+ }
+ }
+#else
+ protected virtual void Dispose (bool explicitDisposing)
+ {
+ if (disposed)
+ return;
+
+ disposed = true;
+ connected = false;
+ if (socket != null)
+ {
+ int error;
+ closed = true;
+ GHSocket x = socket;
+ socket = null;
+ Close_internal (x, out error);
+ if (blocking_thread != null)
+ {
+ blocking_thread.Abort ();
+ blocking_thread = null;
+ }
+
+ if (error != 0)
+ throw new SocketException (error);
+ }
+ }
+#endif
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ ~Socket () {
+ Dispose(false);
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net/HttpProvider.cs b/mcs/class/System/System.Net/HttpProvider.cs
new file mode 100644
index 00000000000..dd1fdccad49
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpProvider.cs
@@ -0,0 +1,330 @@
+using System;
+using System.Security.Cryptography.X509Certificates;
+using System.IO;
+
+namespace System.Net
+{
+ [Serializable]
+ internal abstract class HttpProvider
+ {
+ #region Fields
+
+ protected static int _defaultMaxResponseHeadersLength;
+ protected static int _defaultMaxRedirectsNum = 50;
+
+ protected Uri _originalUri;
+ protected WebHeaderCollection _headers;
+ protected bool _allowAutoRedirect;
+ protected bool _allowWriteStreamBuffering = true;
+ protected X509CertificateCollection _certificates;
+ protected string _connectionGroupName;
+ protected HttpContinueDelegate _continueDelegate;
+ protected CookieContainer _cookieContainer;
+ protected ICredentials _credentials;
+ protected bool _keepAlive = true;
+ protected int _maxResponseHeadersLength = _defaultMaxResponseHeadersLength;
+ protected int _maxAutoRedirections = _defaultMaxRedirectsNum;
+ protected int _readWriteTimeout = 300000;
+ protected string _mediaType = string.Empty;
+ protected string _methodName = "GET";
+ protected bool _pipelined = true;
+ protected bool _preAuthenticate;
+ protected Version _version = HttpVersion.Version11;
+ protected IWebProxy _proxy;
+ protected bool _sendChunked;
+ protected ServicePoint _servicePoint;
+ protected int _timeout = 100000;
+
+ protected bool _isAborted;
+ protected long _contentLength = -1L;
+
+
+
+
+ #endregion /* Fields */
+
+ #region Constructors and Factory Methods
+ protected HttpProvider(Uri uri)
+ {
+ _originalUri = uri;
+ _headers = new WebHeaderCollection(true);
+ _allowAutoRedirect = true;
+ }
+
+ public static HttpProvider GetHttpProvider(Uri uri)
+ {
+ return new VMWHttpProvider(uri);
+ }
+
+ public static HttpProvider GetHttpProvider(string provider, Uri uri)
+ {
+ Type type = Type.GetType(provider, true);
+ if(type != null)
+ return GetHttpProvider(type, uri);
+ //log it as an error
+ return new VMWHttpProvider(uri);
+ }
+
+ public static HttpProvider GetHttpProvider(Type provider, Uri uri)
+ {
+ try
+ {
+ return (HttpProvider)Activator.CreateInstance(provider,
+ new object[]{uri});
+ }
+ catch
+ {
+ //log it as an error
+ return new VMWHttpProvider(uri);
+ }
+ }
+
+ #endregion
+
+ #region Properties
+ internal virtual WebHeaderCollection Headers
+ {
+ get{return _headers;}
+ set
+ {
+ if(IsRequestStarted ())
+ throw new InvalidOperationException("Connection already opened");
+ WebHeaderCollection newHeaders = new WebHeaderCollection (true);
+ int count = value.Count;
+ for (int i = 0; i < count; i++)
+ newHeaders.Add (value.GetKey (i), value.Get (i));
+
+ _headers = newHeaders;
+ }
+ }
+
+ internal virtual bool AllowAutoRedirect
+ {
+ get{return _allowAutoRedirect;}
+ set{_allowAutoRedirect = value;}
+ }
+
+ internal virtual bool AllowWriteStreamBuffering
+ {
+ get{return _allowWriteStreamBuffering;}
+ set{_allowWriteStreamBuffering = value;}
+ }
+
+ internal virtual string ConnectionGroupName
+ {
+ get{return _connectionGroupName;}
+ set{_connectionGroupName = value;}
+ }
+
+ internal virtual HttpContinueDelegate ContinueDelegate
+ {
+ get{return _continueDelegate;}
+ set{_continueDelegate = value;}
+ }
+
+ internal virtual CookieContainer CookieContainer
+ {
+ get{return _cookieContainer;}
+ set{_cookieContainer = value;}
+ }
+
+ internal virtual ICredentials Credentials
+ {
+ get{return _credentials;}
+ set{_credentials = value;}
+ }
+ internal static int DefaultMaxResponseHeadersLength
+ {
+ get{return _defaultMaxResponseHeadersLength;}
+ set
+ {
+ if (value < 0 && value != -1)
+ throw new ArgumentOutOfRangeException("Argument should be positive");
+ _defaultMaxResponseHeadersLength = value;
+ }
+ }
+
+ internal virtual bool KeepAlive
+ {
+ get{return _keepAlive;}
+ set{_keepAlive = value;}
+ }
+
+ internal virtual int MaxAutoRedirections
+ {
+ get{return _maxAutoRedirections;}
+ set
+ {
+ if (value <= 0)
+ throw new ArgumentException("Must be > 0", "value");
+ _maxAutoRedirections = value;
+ }
+ }
+
+ internal virtual int MaximumResponseHeadersLength
+ {
+ get{return _maxResponseHeadersLength;}
+ set
+ {
+ if (IsRequestStarted())
+ {
+ throw new InvalidOperationException("Request has been already submitted.");
+ }
+ if (value < 0 && value != -1)
+ throw new ArgumentOutOfRangeException("The argument must be positive or -1");
+ _maxResponseHeadersLength = value;
+ }
+ }
+
+ internal virtual string MediaType
+ {
+ get{return _mediaType;}
+ set{_mediaType = value;}
+ }
+
+ internal virtual string MethodName
+ {
+ get{return _methodName;}
+ set
+ {
+ if (value == null || value.Trim () == "")
+ throw new ArgumentException ("not a valid method");
+
+ _methodName = value;
+ }
+ }
+ internal virtual bool Pipelined
+ {
+ get{return _pipelined;}
+ set{_pipelined = value;}
+ }
+
+ internal virtual bool PreAuthenticate
+ {
+ get { return _preAuthenticate; }
+ set { _preAuthenticate = value; }
+ }
+
+ internal virtual Version ProtocolVersion
+ {
+ get{return _version;}
+ set
+ {
+ if (value != HttpVersion.Version10 && value != HttpVersion.Version11)
+ throw new ArgumentException ("value");
+
+ _version = value;
+ }
+ }
+ internal virtual IWebProxy Proxy
+ {
+ get{return _proxy;}
+ set
+ {
+ if(IsRequestStarted())
+ throw new InvalidOperationException("Request already has been submitted");
+ if(value == null)
+ throw new ArgumentNullException("value");
+ if(!(value is WebProxy))
+ throw new NotImplementedException("The supported proxy objects only of type System.Net.WebProxy");
+ _proxy = value;
+ }
+ }
+ internal virtual int ReadWriteTimeout
+ {
+ get{return _readWriteTimeout;}
+ set
+ {
+ if (IsRequestStarted())
+ throw new InvalidOperationException("Request has been submitted.");
+
+ if (value < 0 && value != -1)
+ throw new ArgumentOutOfRangeException("value");
+
+ _readWriteTimeout = value;
+ }
+ }
+
+ internal virtual bool SendChunked
+ {
+ get{return _sendChunked;}
+ set
+ {
+ if(IsRequestStarted ())
+ throw new InvalidOperationException("Request has been submitted.");
+ _sendChunked = value;
+ }
+ }
+
+ internal virtual ServicePoint ServicePoint
+ {
+ get{return _servicePoint;}
+ }
+
+ internal virtual int Timeout
+ {
+ get{return _timeout;}
+ set
+ {
+ if (value < -1)
+ throw new ArgumentOutOfRangeException ("value");
+
+ _timeout = value;
+ }
+ }
+
+ internal virtual long ContentLength
+ {
+ get{return _contentLength;}
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException("value", "The Content-Length property value must be positive");
+ _contentLength = value;
+ }
+ }
+
+
+
+ #endregion
+
+ #region Methods
+
+ public virtual Uri GetOriginalAddress()
+ {
+ return _originalUri;
+ }
+
+ public virtual X509CertificateCollection GetX509Certificates()
+ {
+ if(_certificates == null)
+ _certificates = new X509CertificateCollection();
+ return _certificates;
+ }
+
+ public abstract bool IsRequestStarted();
+
+ public abstract Uri GetAddress();
+
+ public abstract bool IsHaveResponse();
+
+ public abstract void Abort();
+
+ public abstract Stream GetRequestStream();
+
+ public abstract WebResponse GetResponse();
+
+ public abstract IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state);
+
+ public abstract Stream EndGetRequestStream(IAsyncResult asyncResult);
+
+ public abstract IAsyncResult BeginGetResponse(AsyncCallback callback, object state);
+
+ public abstract WebResponse EndGetResponse(IAsyncResult asyncResult);
+
+
+ #endregion
+
+
+ }
+}
diff --git a/mcs/class/System/System.Net/HttpStateCache.cs b/mcs/class/System/System.Net/HttpStateCache.cs
new file mode 100644
index 00000000000..81e60523a76
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpStateCache.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections;
+
+using mainsoft.apache.commons.httpclient;
+
+namespace System.Net
+{
+
+ class HttpStateCache
+ {
+ private static readonly int MAX_SIZE = 30;
+
+ private Stack _states;
+ private int _currentSize;
+
+ internal HttpStateCache()
+ {
+ _states = new Stack(20);
+ }
+
+ internal HttpState GetHttpState()
+ {
+ lock(this)
+ {
+ if(_states.Count > 0)
+ return (HttpState) _states.Pop();
+ }
+ return new HttpState();
+ }
+
+ internal void ReleaseHttpState(HttpState state)
+ {
+ lock(this)
+ {
+ if(_states.Count < MAX_SIZE)
+ {
+ state.clear();
+ _states.Push(state);
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/HttpWebRequest.jvm.cs b/mcs/class/System/System.Net/HttpWebRequest.jvm.cs
new file mode 100644
index 00000000000..2db90e69d76
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpWebRequest.jvm.cs
@@ -0,0 +1,605 @@
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Globalization;
+using System.IO;
+using System.Runtime;
+using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Permissions;
+using System.Text;
+using System.Threading;
+using System.Net;
+
+
+
+namespace System.Net
+{
+ [Serializable]
+ public class HttpWebRequest : WebRequest
+ {
+ #region Fields
+
+
+ private static readonly int DEFAULT_MAX_RESP_HEADER_LEN = 64;
+
+ private static int _defaultMaxResponseHeadersLength = DEFAULT_MAX_RESP_HEADER_LEN;
+
+
+ private HttpProvider _provider;
+
+ #endregion
+
+ #region Constructors
+
+ internal HttpWebRequest(Uri uri)
+ {
+ _provider = HttpProvider.GetHttpProvider(uri);
+// Console.WriteLine("uri to string: " + uri.ToString());
+ }
+
+
+ #endregion
+
+ #region Properties
+
+
+ public string Accept
+ {
+ get{return Headers["Accept"];}
+ set
+ {
+ if(_provider.IsRequestStarted ())
+ throw new InvalidOperationException ("request started");
+ _provider.Headers.RemoveAndAdd ("Accept", value);
+ }
+ }
+
+ public Uri Address
+ {
+ get{return _provider.GetAddress();}
+ }
+
+ public bool AllowAutoRedirect
+ {
+ get{return _provider.AllowAutoRedirect;}
+ set{_provider.AllowAutoRedirect = value;}
+ }
+
+ public bool AllowWriteStreamBuffering
+ {
+ get{return _provider.AllowWriteStreamBuffering;}
+ set{_provider.AllowWriteStreamBuffering = value;}
+ }
+
+ [MonoTODO] //documentation related
+ public X509CertificateCollection ClientCertificates
+ {
+ [MonoTODO]
+ get{return _provider.GetX509Certificates();}
+ }
+
+ public string Connection
+ {
+ get { return Headers["Connection"]; }
+ set
+ {
+ if(_provider.IsRequestStarted())
+ throw new InvalidOperationException ("request started");
+
+ string val = value;
+ if (val != null)
+ val = val.Trim ().ToLower ();
+
+ if (val == null || val.Length == 0)
+ {
+ Headers.RemoveInternal ("Connection");
+ return;
+ }
+
+ if (val == "keep-alive" || val == "close")
+ throw new ArgumentException ("Keep-Alive and Close may not be set with this property");
+
+// if (this.KeepAlive && val.IndexOf ("keep-alive") == -1)
+// value = value + ", Keep-Alive";
+
+ Headers.RemoveAndAdd ("Connection", value);
+ }
+ }
+
+ public override string ConnectionGroupName
+ {
+ get{return _provider.ConnectionGroupName;}
+ set{_provider.ConnectionGroupName = value;}
+ }
+
+ public override long ContentLength
+ {
+ get{return _provider.ContentLength;}
+ set
+ {
+ if(_provider.IsRequestStarted())
+ throw new InvalidOperationException("Connection already opened");
+ _provider.ContentLength = value;
+ }
+ }
+
+ public override string ContentType
+ {
+ get { return Headers["Content-Type"]; }
+ set
+ {
+ if (value == null || value.Trim().Length == 0)
+ {
+ Headers.RemoveInternal ("Content-Type");
+ return;
+ }
+ Headers.RemoveAndAdd ("Content-Type", value);
+ }
+ }
+ [MonoTODO] //needed for automatic documentation tools,
+ //since currently we don't support this feature
+ public HttpContinueDelegate ContinueDelegate
+ {
+ [MonoTODO]
+ get{return _provider.ContinueDelegate;}
+ [MonoTODO]
+ set{_provider.ContinueDelegate = value;}
+ }
+
+ public CookieContainer CookieContainer
+ {
+ get{return _provider.CookieContainer;}
+ set{_provider.CookieContainer = value;}
+ }
+
+ public override ICredentials Credentials
+ {
+ get{return _provider.Credentials;}
+ set{_provider.Credentials = value;}
+ }
+
+ public static int DefaultMaximumResponseHeadersLength
+ {
+ get{return HttpProvider.DefaultMaxResponseHeadersLength;}
+ set{HttpProvider.DefaultMaxResponseHeadersLength = value;}
+ }
+
+ public string Expect
+ {
+ get{return Headers["Expect"];}
+ set
+ {
+ if(_provider.IsRequestStarted ())
+ throw new InvalidOperationException("Connection already opened");
+ string val = value;
+ if (val != null)
+ val = val.Trim ().ToLower ();
+
+ if (val == null || val.Length == 0)
+ {
+ Headers.RemoveInternal ("Expect");
+ return;
+ }
+
+ if (val == "100-continue")
+ throw new ArgumentException ("100-Continue cannot be set with this property.",
+ "value");
+ Headers.RemoveAndAdd ("Expect", value);
+ }
+ }
+
+ public bool HaveResponse
+ {
+ get{return _provider.IsHaveResponse();}
+ }
+
+ public override WebHeaderCollection Headers
+ {
+ get{return _provider.Headers;}
+ set{_provider.Headers = value;}
+ }
+
+ public DateTime IfModifiedSince
+ {
+ get
+ {
+ string str = Headers["If-Modified-Since"];
+ if (str == null)
+ return DateTime.Now;
+ try
+ {
+ return MonoHttpDate.Parse (str);
+ }
+ catch (Exception)
+ {
+ return DateTime.Now;
+ }
+ }
+ set
+ {
+ if(_provider.IsRequestStarted ())
+ throw new InvalidOperationException("Connection already started");
+ // rfc-1123 pattern
+ Headers.SetInternal ("If-Modified-Since",
+ value.ToUniversalTime ().ToString ("r", null));
+ // TODO: check last param when using different locale
+ }
+ }
+
+ public bool KeepAlive
+ {
+ get{return _provider.KeepAlive;}
+ set{_provider.KeepAlive = value;}
+ }
+
+ public int MaximumAutomaticRedirections
+ {
+ get{return _provider.MaxAutoRedirections;}
+ set{_provider.MaxAutoRedirections = value;}
+ }
+
+ [MonoTODO] //documentation
+ public int MaximumResponseHeadersLength
+ {
+ [MonoTODO]
+ get{return _provider.MaximumResponseHeadersLength;}
+ [MonoTODO]
+ set{_provider.MaximumResponseHeadersLength = value;}
+ }
+
+ public string MediaType
+ {
+ get{return _provider.MediaType;}
+ set{_provider.MediaType = value;}
+ }
+
+ public override string Method
+ {
+ get{return _provider.MethodName;}
+ set{_provider.MethodName = value;}
+ }
+ [MonoTODO] //for documentation related - limited.
+ public bool Pipelined
+ {
+ [MonoTODO]
+ get{return _provider.Pipelined;}
+ [MonoTODO]
+ set{_provider.Pipelined = value;}
+ }
+
+ public override bool PreAuthenticate
+ {
+ get{return _provider.PreAuthenticate;}
+ set{_provider.PreAuthenticate = value;}
+ }
+
+ public Version ProtocolVersion
+ {
+ get{return _provider.ProtocolVersion;}
+ set{_provider.ProtocolVersion = value;}
+ }
+
+ public override IWebProxy Proxy
+ {
+ get{return _provider.Proxy;}
+ set{_provider.Proxy = value;}
+ }
+
+ public int ReadWriteTimeout
+ {
+ get{return _provider.ReadWriteTimeout;}
+ set{_provider.ReadWriteTimeout = value;}
+ }
+
+ public string Referer
+ {
+ get {return Headers["Referer"];}
+ set
+ {
+ if(_provider.IsRequestStarted ())
+ throw new InvalidOperationException("Connection already opened");
+ if (value == null || value.Trim().Length == 0)
+ {
+ Headers.RemoveInternal ("Referer");
+ return;
+ }
+ Headers.SetInternal ("Referer", value);
+ }
+ }
+ internal Uri AuthUri
+ {
+ get { return RequestUri; }
+ }
+ public override Uri RequestUri
+ {
+ get{return _provider.GetOriginalAddress();}
+ }
+
+ public bool SendChunked
+ {
+ get{return _provider.SendChunked;}
+ set{_provider.SendChunked = value;}
+ }
+
+ public ServicePoint ServicePoint
+ {
+ get{return _provider.ServicePoint;}
+ }
+ [MonoTODO] //once again - needed since our impl. still
+ //doesn't support this feature we need document it..
+ public override int Timeout
+ {
+ [MonoTODO]
+ get{return _provider.Timeout;}
+ [MonoTODO]
+ set{_provider.Timeout = value;}
+ }
+
+
+ public string TransferEncoding
+ {
+ get { return Headers ["Transfer-Encoding"]; }
+ set
+ {
+ if(_provider.IsRequestStarted ())
+ {
+ throw new InvalidOperationException("Connection has been already opened");
+ }
+ string val = value;
+ if (val != null)
+ val = val.Trim ().ToLower ();
+
+ if (val == null || val.Length == 0)
+ {
+ Headers.RemoveInternal ("Transfer-Encoding");
+ return;
+ }
+
+ if (val == "chunked")
+ throw new ArgumentException ("Chunked encoding must be set with the SendChunked property");
+
+ if (!this.SendChunked)
+ throw new InvalidOperationException ("SendChunked must be True");
+
+ Headers.RemoveAndAdd ("Transfer-Encoding", value);
+ }
+ }
+
+
+ public bool UnsafeAuthenticatedConnectionSharing
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public string UserAgent
+ {
+ get { return Headers ["User-Agent"]; }
+ set { Headers.SetInternal ("User-Agent", value); }
+ }
+
+
+
+
+ #endregion
+
+ #region Methods
+
+ //todo
+ public override void Abort()
+ {
+ _provider.Abort();
+// _connection.disconnect();
+// _haveResponse = true;
+// //aborted = true;
+// if (_asyncWrite != null)
+// {
+// GHWebAsyncResult r = _asyncWrite;
+// WebException wexc = new WebException ("Aborted.", WebExceptionStatus.RequestCanceled);
+// r.SetCompleted (false, wexc);
+// r.DoCallback ();
+// _asyncWrite = null;
+// }
+//
+// if (_asyncRead != null)
+// {
+// GHWebAsyncResult r = _asyncRead;
+// WebException wexc = new WebException ("Aborted.", WebExceptionStatus.RequestCanceled);
+// r.SetCompleted (false, wexc);
+// r.DoCallback ();
+// _asyncRead = null;
+// }
+//
+//// if (abortHandler != null)
+//// {
+//// try
+//// {
+//// abortHandler (this, EventArgs.Empty);
+//// }
+//// catch {}
+//// abortHandler = null;
+//// }
+//
+// if (_writeStream != null)
+// {
+// try
+// {
+// _writeStream.Close ();
+// _writeStream = null;
+// }
+// catch {}
+// }
+//
+// if (_response != null)
+// {
+// try
+// {
+// _response.Close ();
+// _response = null;
+// }
+// catch {}
+// }
+ }
+
+ public void AddRange (int range)
+ {
+ AddRange ("bytes", range);
+ }
+
+ public void AddRange (int from, int to)
+ {
+ AddRange ("bytes", from, to);
+ }
+
+ public void AddRange (string rangeSpecifier, int range)
+ {
+ if (rangeSpecifier == null)
+ throw new ArgumentNullException ("rangeSpecifier");
+ string value = Headers ["Range"];
+ if (value == null || value.Length == 0)
+ value = rangeSpecifier + "=";
+ else if (value.ToLower ().StartsWith (rangeSpecifier.ToLower () + "="))
+ value += ",";
+ else
+ throw new InvalidOperationException ("rangeSpecifier");
+ Headers.RemoveAndAdd ("Range", value + range + "-");
+ }
+
+ public void AddRange (string rangeSpecifier, int from, int to)
+ {
+ if (rangeSpecifier == null)
+ throw new ArgumentNullException ("rangeSpecifier");
+ if (from < 0 || to < 0 || from > to)
+ throw new ArgumentOutOfRangeException ();
+ string value = Headers ["Range"];
+ if (value == null || value.Length == 0)
+ value = rangeSpecifier + "=";
+ else if (value.ToLower ().StartsWith (rangeSpecifier.ToLower () + "="))
+ value += ",";
+ else
+ throw new InvalidOperationException ("rangeSpecifier");
+ Headers.RemoveAndAdd ("Range", value + from + "-" + to);
+ }
+
+ public override Stream GetRequestStream()
+ {
+ return _provider.GetRequestStream();
+// lock(this)
+// {
+// Type t = Type.GetType("System.IO.ConsoleWriteStream", true);
+// _connection.setDoOutput(true);
+//
+//
+//// Console.WriteLine("Request is sent with following headers:");
+//// java.util.Map map = _connection.getRequestProperties();
+//// for(java.util.Iterator iter = map.keySet().iterator(); iter.hasNext();)
+//// {
+//// string key = (string) iter.next();
+//// Console.WriteLine(key + ": " + map.get(key));
+//// }
+//
+// foreach(string k in Headers)
+// {
+// string val = Headers[k];
+// val = (val == null) ? "" : val;
+// _connection.setRequestProperty(k, val);
+// }
+//
+// _writeStream = (Stream) Activator.CreateInstance(t, new object[]{_connection.getOutputStream()});
+// _haveRequest = true;
+// return _writeStream;
+// }
+ }
+
+ public override WebResponse GetResponse()
+ {
+ return _provider.GetResponse();
+ }
+ /*
+ private void CommonChecks (bool putpost)
+ {
+ string method = _connection.getRequestMethod();
+
+ if (method == null)
+ throw new ProtocolViolationException ("Method is null.");
+
+ bool keepAlive = _headers["Keep-Alive"] == null;
+ bool allowBuffering = true;
+ bool sendChunked = true;
+ long contentLength = _connection.getContentLength();
+
+ if (putpost && ((!keepAlive || (contentLength == -1 && !sendChunked)) && !allowBuffering))
+ throw new ProtocolViolationException ("Content-Length not set");
+
+ string transferEncoding = TransferEncoding;
+ if (!sendChunked && transferEncoding != null && transferEncoding.Trim () != "")
+ throw new ProtocolViolationException ("SendChunked should be true.");
+ }
+ */
+
+ public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
+ {
+ return _provider.BeginGetRequestStream(callback, state);
+ }
+
+ public override Stream EndGetRequestStream(IAsyncResult asyncResult)
+ {
+ return _provider.EndGetRequestStream(asyncResult);
+ }
+
+ public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
+ {
+ //todo check input, http headers etc.
+
+ return _provider.BeginGetResponse(callback, state);
+ }
+
+ public override WebResponse EndGetResponse(IAsyncResult asyncResult)
+ {
+ return _provider.EndGetResponse(asyncResult);
+ }
+
+
+
+
+ #endregion
+
+ #region Inner Classes
+
+// #region JavaHeaders class
+// [Serializable]
+// internal sealed class JavaHeaders : WebHeaderCollection
+// {
+// private java.net.HttpURLConnection _connection;
+//
+// internal JavaHeaders(java.net.HttpURLConnection con)
+// {
+// _connection = con;
+// }
+//
+// public string this[string key]
+// {
+// get
+// {
+// return _connection.getHeaderField(key);
+// }
+// set
+// {
+// _connection.addRequestProperty(key, value);
+// }
+// }
+// }
+// #endregion
+
+
+
+
+ #endregion
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Net/HttpWebResponse.jvm.cs b/mcs/class/System/System.Net/HttpWebResponse.jvm.cs
new file mode 100644
index 00000000000..97542bbafae
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpWebResponse.jvm.cs
@@ -0,0 +1,515 @@
+using System;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.IO;
+using System.Runtime;
+using System.Runtime.Serialization;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net
+{
+
+ [Serializable]
+ public class HttpWebResponse : WebResponse, IDisposable
+ {
+ #region Fields
+ private mainsoft.apache.commons.httpclient.HttpMethod _httpMethod;
+ private CookieCollection _cookies;
+ private WebHeaderCollection _headers;
+ private string _statusDescription;
+ private Version _version = null;
+ private Uri _uri;
+ private string _method;
+ private Stream _responseStream;
+ private mainsoft.apache.commons.httpclient.HttpState _state;
+ private HttpStateCache _stateCache;
+ private HttpStatusCode _statusCode;
+ private bool _isStatusCodeInitialized = false;
+
+ private Type _httpStatusCodeType = typeof(HttpStatusCode);
+
+ private sbyte [] _responseBody;
+ private bool _isHttpMethodClosed = false;
+ #endregion
+
+ #region Constructors
+
+ internal HttpWebResponse(mainsoft.apache.commons.httpclient.HttpMethod httpMethod,
+ mainsoft.apache.commons.httpclient.HttpState state,
+ HttpStateCache stateCache,
+ Uri uri, string method)
+ {
+ _httpMethod = httpMethod;
+ _uri = uri;
+ _method = method;
+ _state = state;
+ _stateCache = stateCache;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public CookieCollection Cookies
+ {
+ get
+ {
+ if(_cookies == null)
+ {
+ _cookies = new CookieCollection();
+ FillCookies();
+
+ }
+ return _cookies;
+ }
+
+ set
+ {
+ _cookies = value;
+ }
+ }
+
+ public override WebHeaderCollection Headers
+ {
+ get
+ {
+ if(_headers == null)
+ {
+ _headers = new WebHeaderCollection();
+ FillHeaders();
+ }
+ return _headers;
+ }
+ }
+ public override long ContentLength
+ {
+ get
+ {
+ string val = Headers["Content-Length"];
+ if(val == null || val.Trim().Equals(""))
+ return -1L;
+ try
+ {
+ return Int64.Parse(val);
+ }
+ catch
+ {
+ return -1L;
+ }
+ }
+ }
+
+
+ public string ContentEncoding
+ {
+ get
+ {
+ return Headers["Content-Encoding"];
+ }
+ }
+
+ public override string ContentType
+ {
+ get
+ {
+ return Headers["Content-Type"];
+ }
+ }
+
+ public string CharacterSet
+ {
+ get
+ {
+ string contentType = ContentType;
+ if (contentType == null)
+ return "ISO-8859-1";
+ string val = contentType.ToLower ();
+ int pos = val.IndexOf ("charset=");
+ if (pos == -1)
+ return "ISO-8859-1";
+ pos += 8;
+ int pos2 = val.IndexOf (';', pos);
+ return (pos2 == -1)
+ ? contentType.Substring (pos)
+ : contentType.Substring (pos, pos2 - pos);
+ }
+ }
+
+ public string Server
+ {
+ get
+ {
+ return Headers ["Server"];
+ }
+ }
+
+ public DateTime LastModified
+ {
+ get
+ {
+ try
+ {
+ string val = Headers["Last-Modified"];
+ return MonoHttpDate.Parse(val);
+ }
+ catch
+ {
+ return DateTime.Now;
+ }
+ }
+ }
+
+ public HttpStatusCode StatusCode
+ {
+ get
+ {
+ if(_isStatusCodeInitialized == false)
+ {
+ int status = _httpMethod.getStatusCode();
+ _statusCode = (HttpStatusCode)Enum.Parse(_httpStatusCodeType,
+ Enum.GetName(_httpStatusCodeType, status));
+ _isStatusCodeInitialized = true;
+ }
+
+ return _statusCode;
+ }
+ }
+
+ public string StatusDescription
+ {
+ get
+ {
+ if(_statusDescription == null)
+ _statusDescription = _httpMethod.getStatusText();
+ return _statusDescription;
+ }
+ }
+
+ public Version ProtocolVersion
+ {
+ get
+ {
+ if(_version == null)
+ ParseVersion();
+ return _version;
+ }
+ }
+
+ public override Uri ResponseUri
+ {
+ get
+ {
+ return _uri;
+ }
+ }
+
+ public string Method
+ {
+ get
+ {
+ return _method;
+ }
+ }
+ #endregion
+
+ #region Methods
+
+ internal void ReadAllAndClose()
+ {
+ if (_responseBody != null)
+ return;
+
+ object temp = null;
+ if(_cookies == null)
+ {
+ temp = this.Cookies;
+ }
+ if(_headers == null)
+ {
+ temp = this.Headers;
+ }
+ if(_isStatusCodeInitialized == false)
+ {
+ temp = this.StatusCode;
+ }
+ if(_statusDescription == null)
+ {
+ temp = this.StatusDescription;
+ }
+ if(_version == null)
+ {
+ temp = this.ProtocolVersion;
+ }
+
+ _responseBody = _httpMethod.getResponseBody();
+#if DEBUG
+ Console.WriteLine("The response body as string == {0}", System.Text.Encoding.UTF8.GetString((byte[])vmw.common.TypeUtils.ToByteArray(_responseBody)));
+#endif
+ this.Close();
+ }
+
+ public override Stream GetResponseStream()
+ {
+ try
+ {
+ if(_responseStream == null)
+ {
+ Type t = Type.GetType("System.IO.ConsoleReadStream", true);
+ object [] param = null;
+ if (_responseBody == null)
+ {
+ param = new object[]{_httpMethod.getResponseBodyAsStream()};
+ }
+ else
+ {
+ param = new object[]{new java.io.ByteArrayInputStream(_responseBody)};
+ }
+ _responseStream = (Stream) Activator.CreateInstance(t, param);
+ }
+ return _responseStream;
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Exception caught!");
+ Console.WriteLine(e.GetType() + ":" + e.Message + "\n" + e.StackTrace);
+ throw e;
+ }
+ }
+
+ public override void Close()
+ {
+ try
+ {
+ if(_responseStream != null)
+ _responseStream.Close();
+ }
+ finally
+ {
+ _responseStream = null;
+
+ if (!_isHttpMethodClosed)
+ {
+ _httpMethod.releaseConnection();
+ if(_stateCache != null && _state != null)
+ {
+ _stateCache.ReleaseHttpState(_state);
+ _state = null;
+ _stateCache = null;
+ }
+ _isHttpMethodClosed = true;
+ }
+ }
+ }
+
+ public string GetResponseHeader(string headerName)
+ {
+ return Headers[headerName];
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+
+ protected virtual void Dispose(bool disposing)
+ {
+ try
+ {
+ if(_responseStream != null)
+ _responseStream.Close();
+ }
+ finally
+ {
+ _responseStream = null;
+
+ if (!_isHttpMethodClosed)
+ {
+ _httpMethod.releaseConnection();
+ _isHttpMethodClosed = true;
+ }
+ }
+ }
+
+ private void FillHeaders()
+ {
+ mainsoft.apache.commons.httpclient.Header[] respHeaders =
+ _httpMethod.getResponseHeaders();
+ if(respHeaders == null)
+ return;
+ for(int i = 0; i < respHeaders.Length; i++)
+ {
+
+ mainsoft.apache.commons.httpclient.HeaderElement[] elements = respHeaders[i].getElements();
+ for(int j = 0; j < elements.Length; j++)
+ {
+ string key = elements[j].getName();
+ string val = elements[j].getValue();
+ string pair = (key == null) ? ((val == null) ? "" : val) : ((val==null) ? key : key + "=" + val);
+ _headers.Add(respHeaders[i].getName(), pair);
+ }
+
+ }
+ ParseVersion();
+ }
+
+ private void ParseVersion()
+ {
+ mainsoft.apache.commons.httpclient.StatusLine statusLine =
+ _httpMethod.getStatusLine();
+ string ver = statusLine.getHttpVersion().Trim().ToUpper();
+ if(ver == "HTTP/1.1")
+ _version = HttpVersion.Version11;
+ else if(ver == "HTTP/1.0")
+ _version = HttpVersion.Version10;
+ else
+ _version = null;
+ }
+
+ private void FillCookies()
+ {
+ if(_state == null)
+ return;
+
+ mainsoft.apache.commons.httpclient.Cookie[] javaCookies =
+ _state.getCookies();
+
+ if(javaCookies == null)
+ return;
+
+ for(int i = 0; i < javaCookies.Length; i++)
+ {
+ bool httpsProtocol = _httpMethod.getURI().ToString().StartsWith("https");
+ if(!httpsProtocol && javaCookies[i].getSecure())
+ continue;
+ Cookie c = new Cookie(javaCookies[i].getName(),
+ javaCookies[i].getValue(),
+ (javaCookies[i].getPath() == null) ? "" : javaCookies[i].getPath(),
+ (javaCookies[i].getDomain() == null) ? "" : javaCookies[i].getDomain());
+ java.util.Calendar jCalendar = java.util.Calendar.getInstance();
+ java.util.Date jDate = javaCookies[i].getExpiryDate();
+ if(jDate != null)
+ {
+ jCalendar.setTime(javaCookies[i].getExpiryDate());
+ c.Expires = (DateTime) vmw.common.DateTimeUtils.CalendarToDateTime(jCalendar);
+ }
+
+ _cookies.Add(c);
+ }
+
+ }
+
+ //todo remove unused methods
+ private void FillCookies_old ()
+ {
+
+ string val = Headers["Set-Cookie"];
+ if (val != null && val.Trim () != "")
+ SetCookie (val);
+
+ val = Headers["Set-Cookie2"];
+ if (val != null && val.Trim () != "")
+ SetCookie2 (val);
+ }
+
+ static string [] SplitValue (string input)
+ {
+ string [] result = new string [2];
+ int eq = input.IndexOf ('=');
+ if (eq == -1)
+ {
+ result [0] = "invalid";
+ }
+ else
+ {
+ result [0] = input.Substring (0, eq).Trim ().ToUpper ();
+ result [1] = input.Substring (eq + 1);
+ }
+
+ return result;
+ }
+
+ private void SetCookie(string val)
+ {
+// Console.WriteLine("in set cookie 1 - got value : " + val);
+ string[] parts = null;
+ Collections.Queue options = null;
+ Cookie cookie = null;
+
+ options = new Collections.Queue (val.Split (';'));
+ parts = SplitValue ((string) options.Dequeue()); // NAME=VALUE must be first
+
+ cookie = new Cookie (parts[0], parts[1]);
+
+ while (options.Count > 0)
+ {
+ parts = SplitValue ((string) options.Dequeue());
+ switch (parts [0])
+ {
+ case "COMMENT":
+ if (cookie.Comment == null)
+ cookie.Comment = parts[1];
+ break;
+ case "COMMENTURL":
+ if (cookie.CommentUri == null)
+ cookie.CommentUri = new Uri(parts[1]);
+ break;
+ case "DISCARD":
+ cookie.Discard = true;
+ break;
+ case "DOMAIN":
+ if (cookie.Domain == "")
+ cookie.Domain = parts[1];
+ break;
+ case "MAX-AGE": // RFC Style Set-Cookie2
+ if (cookie.Expires == DateTime.MinValue)
+ cookie.Expires = cookie.TimeStamp.AddSeconds (Int32.Parse (parts[1]));
+ break;
+ case "EXPIRES": // Netscape Style Set-Cookie
+ if (cookie.Expires == DateTime.MinValue)
+ {
+ //FIXME: Does DateTime parse something like: "Sun, 17-Jan-2038 19:14:07 GMT"?
+ //cookie.Expires = DateTime.ParseExact (parts[1]);
+ cookie.Expires = DateTime.Now.AddDays (1);
+ }
+ break;
+ case "PATH":
+ cookie.Path = parts[1];
+ break;
+ case "PORT":
+ if (cookie.Port == null)
+ cookie.Port = parts[1];
+ break;
+ case "SECURE":
+ cookie.Secure = true;
+ break;
+ case "VERSION":
+ cookie.Version = Int32.Parse (parts[1]);
+ break;
+ } // switch
+ } // while
+
+ if (_cookies == null)
+ _cookies = new CookieCollection();
+
+ if (cookie.Domain == "")
+ cookie.Domain = _uri.Host;
+
+// Console.WriteLine("adding cookie " + cookie + " to collection");
+ _cookies.Add (cookie);
+// Console.WriteLine("exit from method...");
+ }
+
+ private void SetCookie2 (string cookies_str)
+ {
+ string [] cookies = cookies_str.Split (',');
+ foreach (string cookie_str in cookies)
+ SetCookie (cookie_str);
+ }
+ #endregion
+
+ }
+
+}
+
+
diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs
index 956998e112b..33e33b490f0 100644
--- a/mcs/class/System/System.Net/ServicePoint.cs
+++ b/mcs/class/System/System.Net/ServicePoint.cs
@@ -227,7 +227,7 @@ namespace System.Net
{
protocolVersion = version;
}
-
+#if !TARGET_JVM
WebConnectionGroup GetConnectionGroup (string name)
{
if (name == null)
@@ -253,7 +253,7 @@ namespace System.Net
return cnc.SendRequest (request);
}
-
+#endif
internal void IncrementConnection ()
{
lock (locker) {
diff --git a/mcs/class/System/System.Net/VMWHttpProvider.cs b/mcs/class/System/System.Net/VMWHttpProvider.cs
new file mode 100644
index 00000000000..689ba3aa307
--- /dev/null
+++ b/mcs/class/System/System.Net/VMWHttpProvider.cs
@@ -0,0 +1,1071 @@
+using System;
+using System.IO;
+using System.Threading;
+
+using mainsoft.apache.commons.httpclient;
+using mainsoft.apache.commons.httpclient.methods;
+using mainsoft.apache.commons.httpclient.@params;
+using mainsoft.apache.commons.httpclient.auth;
+
+namespace System.Net
+{
+ /// <summary>
+ /// Summary description for VMWHttpProvider.
+ /// </summary>
+ internal class VMWHttpProvider : HttpProvider
+ {
+ protected static HttpClient _client; //todo init it in static constructor
+ protected static HttpStateCache _stateCache = new HttpStateCache();
+
+ protected static object LOCK_OBJECT = new object();
+
+
+
+ protected HttpMethod _method;
+ protected HttpState _state;
+ protected HostConfiguration _hostConfig;
+
+ protected HttpWebResponse _response;
+ protected bool _hasResponse;
+ protected bool _hasRequest;
+ protected Stream _writeStream;
+ private GHWebAsyncResult _asyncWrite;
+ private GHWebAsyncResult _asyncRead;
+
+ private bool _isConnectionOpened;
+
+ static VMWHttpProvider()
+ {
+ if(java.lang.System.getProperty("mainsoft.apache.commons.logging.Log") == null)
+ java.lang.System.setProperty("mainsoft.apache.commons.logging.Log",
+ "mainsoft.apache.commons.logging.impl.SimpleLog");
+ if(java.lang.System.getProperty("mainsoft.apache.commons.logging.simplelog.showdatetime") == null)
+ java.lang.System.setProperty("mainsoft.apache.commons.logging.simplelog.showdatetime",
+ "true");
+ if(java.lang.System.getProperty("mainsoft.apache.commons.logging.simplelog.log.httpclient.wire") == null)
+ java.lang.System.setProperty("mainsoft.apache.commons.logging.simplelog.log.httpclient.wire",
+ "error");
+ if(java.lang.System.getProperty("mainsoft.apache.commons.logging.simplelog.log.mainsoft.apache.commons.httpclient")
+ == null)
+ java.lang.System.setProperty("mainsoft.apache.commons.logging.simplelog.log.mainsoft.apache.commons.httpclient",
+ "error");
+ if(java.lang.System.getProperty("mainsoft.apache.commons.logging.simplelog.log.httpclient.wire.header")
+ == null)
+ java.lang.System.setProperty("mainsoft.apache.commons.logging.simplelog.log.httpclient.wire.header",
+ "error");
+
+ }
+ public VMWHttpProvider(Uri uri) : base (uri)
+ {
+ }
+
+ internal override ServicePoint ServicePoint
+ {
+ get {throw new NotImplementedException();}
+ }
+
+
+
+ public override bool IsRequestStarted()
+ {
+ if(_method == null)
+ return false;
+ return _method.isRequestSent();
+ }
+
+ public override Uri GetAddress()
+ {
+ if(_method == null)
+ return GetOriginalAddress();
+ mainsoft.apache.commons.httpclient.URI javaURI = _method.getURI();
+ return new Uri(javaURI.ToString());
+ }
+
+ public override bool IsHaveResponse()
+ {
+ return _hasResponse;
+ }
+
+ private void SetJavaCredential(NetworkCredential nc, string type)
+ {
+ SetJavaCredential(nc, type, false);
+ }
+
+ private void SetJavaCredential(NetworkCredential nc, string type, bool proxyCredentials)
+ {
+ type = type.ToLower();
+ string host = null;
+
+ if(!proxyCredentials)
+ host = GetOriginalAddress().Host;
+ else
+ host = ((WebProxy)this.Proxy).Address.Host;
+
+ string domain = (nc.Domain == null) ? host : nc.Domain;
+
+ if(type.Equals("any"))
+ {
+ if(!proxyCredentials)
+ {
+ _state.setCredentials(AuthScope.ANY,
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ _state.setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "Ntlm"),
+ new NTCredentials(nc.UserName, nc.Password, host, domain));
+ }
+ else
+ {
+ _state.setProxyCredentials(AuthScope.ANY,
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ _state.setProxyCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "Ntlm"),
+ new NTCredentials(nc.UserName, nc.Password, host, domain));
+ }
+ }
+ else if(type.Equals("basic"))
+ {
+ if(!proxyCredentials)
+ {
+ _state.setCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, "basic"),
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ }
+ else
+ {
+ _state.setProxyCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, "basic"),
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ }
+ }
+ else if(type.Equals("digest"))
+ {
+ if(!proxyCredentials)
+ {
+ _state.setCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, "digest"),
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ }
+ else
+ {
+ _state.setProxyCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, "digest"),
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ }
+ }
+ else if(type.Equals("ntlm"))
+ {
+ if(!proxyCredentials)
+ {
+ _state.setCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, "ntlm"),
+ new NTCredentials(nc.UserName, nc.Password, host, domain));
+ }
+ else
+ {
+ _state.setProxyCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, "ntlm"),
+ new NTCredentials(nc.UserName, nc.Password, host, domain));
+ }
+ }
+ else
+ {
+ if(!proxyCredentials)
+ {
+ _state.setCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, type),
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ }
+ else
+ {
+ _state.setProxyCredentials(new AuthScope(AuthScope.ANY_HOST,
+ AuthScope.ANY_PORT, AuthScope.ANY_REALM, type),
+ new UsernamePasswordCredentials(nc.UserName, nc.Password));
+ }
+ }
+
+ }
+ private void InitProxyCredentials()
+ {
+ if(this.Proxy == null)
+ return;
+
+ if(!(this.Proxy is WebProxy))
+ return;
+
+ WebProxy proxy = (WebProxy)this.Proxy;
+ ICredentials creds = proxy.Credentials;
+
+ if(creds == null)
+ return;
+
+ if(creds is CredentialCache)
+ {
+ string type = "basic";
+ NetworkCredential nc = ((CredentialCache)creds).GetCredential(proxy.Address, "basic");
+ if(nc == null)
+ {
+ type = "digest";
+ nc = ((CredentialCache)creds).GetCredential(proxy.Address, "digest");
+ if(nc == null)
+ {
+ type = "ntlm";
+ nc = ((CredentialCache)creds).GetCredential(proxy.Address, "ntlm");
+ }
+ }
+ if(nc != null)
+ {
+ SetJavaCredential(nc, type, true);
+ }
+ }
+ else if (creds is NetworkCredential)
+ {
+ SetJavaCredential((NetworkCredential)creds, "any", true);
+ }
+
+ _method.setDoAuthentication(true);
+ }
+
+ private void InitCredentials()
+ {
+ if(_credentials == null)
+ return;
+ if(_credentials is CredentialCache)
+ {
+ NetworkCredential nc = ((CredentialCache)_credentials).GetCredential(GetOriginalAddress(), "basic");
+ string type = "basic";
+ if(nc == null)
+ {
+ nc = ((CredentialCache)_credentials).GetCredential(GetOriginalAddress(), "digest");
+ type = "digest";
+ if(nc == null)
+ {
+ nc = ((CredentialCache)_credentials).GetCredential(GetOriginalAddress(), "ntlm");
+ type = "ntlm";
+ }
+ }
+ if(nc != null)
+ {
+ SetJavaCredential(nc, type);
+ }
+ }
+ else if(_credentials is NetworkCredential)
+ {
+ SetJavaCredential((NetworkCredential)_credentials, "any");
+ }
+
+ _method.setDoAuthentication(true);
+ }
+
+ private void InitHostConfig()
+ {
+ if(this.Proxy == null)
+ return;
+ if(this.Proxy.IsBypassed(GetOriginalAddress()))
+ return;
+
+ _hostConfig = new HostConfiguration();
+ _hostConfig.setHost(new HttpHost(_method.getURI()));
+
+
+ if(this.Proxy is WebProxy)
+ {
+ WebProxy wp = (WebProxy) this.Proxy;
+ _hostConfig.setProxyHost(new ProxyHost(wp.Address.Host, wp.Address.Port));
+ }
+ else
+ throw new NotImplementedException("Cannot accept Proxy which is not System.Net.WebProxy instance");
+
+
+ }
+
+ private void SetConnectionHeader(string val)
+ {
+ string connectionHeader = (this.Proxy != null) ? "Proxy-Connection" : "Connection";
+ Headers.RemoveInternal ((this.Proxy != null) ? "Proxy-Connection" : "Connection");
+
+ if(val != null)
+ _method.setRequestHeader(connectionHeader, val);
+
+ if (_keepAlive)
+ {
+ _method.addRequestHeader (connectionHeader, "keep-alive");
+ Headers.SetInternal(connectionHeader,"keep-alive");
+ }
+ else if (!_keepAlive && _version == HttpVersion.Version11)
+ {
+ _method.addRequestHeader (connectionHeader, "close");
+ Headers.SetInternal(connectionHeader,"close");
+ }
+
+ }
+ private bool OpenConnection()
+ {
+ lock(this)
+ {
+ if(_isConnectionOpened)
+ return false;
+ _isConnectionOpened = true;
+ }
+ InitClient();
+ InitMethod();
+
+ _state = _stateCache.GetHttpState();
+
+ //todo insert needed Authontication, Cookies info to state!
+ _method.setDoAuthentication(this.PreAuthenticate);
+
+ InitHostConfig();
+ InitCredentials();
+ InitProxyCredentials();
+
+ if(this.ProtocolVersion == HttpVersion.Version11)
+ _method.getParams().setVersion(mainsoft.apache.commons.httpclient.HttpVersion.HTTP_1_1);
+ else if(ProtocolVersion == HttpVersion.Version10)
+ _method.getParams().setVersion(mainsoft.apache.commons.httpclient.HttpVersion.HTTP_1_0);
+ else
+ throw new ProtocolViolationException("Unsupported protocol version: " + ProtocolVersion);
+
+ if(!(_method is mainsoft.apache.commons.httpclient.methods.EntityEnclosingMethod))
+ {
+ _method.setFollowRedirects(this.AllowAutoRedirect);
+ }
+ else
+ {
+ if(!AllowWriteStreamBuffering && _contentLength < 0 && !SendChunked)
+ throw new ProtocolViolationException();
+ if(SendChunked)
+ ((EntityEnclosingMethod)_method).setContentChunked(SendChunked);
+ }
+ if(MaxAutoRedirections != _defaultMaxRedirectsNum)
+ {
+ _method.getParams().setParameter(HttpClientParams.MAX_REDIRECTS,
+ new java.lang.Integer(MaxAutoRedirections));
+ }
+
+
+
+ foreach(string k in Headers)
+ {
+ if(k.ToLower().Equals("connection"))
+ continue;
+ string val = Headers[k];
+ val = (val == null) ? "" : val;
+ _method.setRequestHeader(k, val);
+ }
+
+ if (this.CookieContainer != null)
+ {
+ string cookieHeader = this.CookieContainer.GetCookieHeader (this.GetOriginalAddress());
+ if (cookieHeader != "")
+ _method.setRequestHeader("Cookie", cookieHeader);
+ }
+ SetConnectionHeader(Headers["Connection"]);
+
+ _method.getParams().setSoTimeout(ReadWriteTimeout);
+
+ return true;
+
+ }
+
+ private static void InitClient()
+ {
+ lock(LOCK_OBJECT)
+ {
+ if(_client == null)
+ {
+ mainsoft.apache.commons.httpclient.MultiThreadedHttpConnectionManager manager =
+ new mainsoft.apache.commons.httpclient.MultiThreadedHttpConnectionManager();
+ manager.setConnectionStaleCheckingEnabled(true);
+ manager.setMaxTotalConnections(200);
+ //by some reasons RFC something - the default
+ //value will be 2 , so we need to change it ...
+ manager.setMaxConnectionsPerHost(20);
+ _client = new HttpClient(manager);
+ _client.getParams().setIntParameter(HttpClientParams.MAX_REDIRECTS, _defaultMaxRedirectsNum);
+ _client.getParams().setParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, new java.lang.Boolean(true));
+ _client.getParams().setParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT, new java.lang.Long(30000));
+ _client.getParams().setParameter(HttpClientParams.USER_AGENT,
+ "VMW4J HttpClient (based on Jakarta Commons HttpClient)");
+ }
+ }
+ }
+
+ private void InitMethod()
+ {
+ lock(this)
+ {
+ if(_method == null)
+ {
+ string uriString = this.GetOriginalAddress().AbsoluteUri;
+
+ if(this.MethodName == null || this.MethodName == "")
+ {
+ this.MethodName = "GET";
+ }
+
+ string name = this.MethodName.ToUpper().Trim();
+
+ switch(name)
+ {
+ case "GET" : _method = new GetMethod(uriString); break;
+ case "PUT" : _method = new PutMethod(uriString); break;
+ case "POST": _method = new PostMethod(uriString); break;
+ case "HEAD": _method = new HeadMethod(uriString); break;
+ case "TRACE": _method = new TraceMethod(uriString);break;
+ case "DELETE": _method = new DeleteMethod(uriString);break;
+ case "OPTIONS": _method = new OptionsMethod(uriString);break;
+ default: _method = new GenericMethod(uriString, MethodName); break;
+ }
+ }
+ }
+ }
+
+ private void InitHostConfiguration()
+ {
+ lock(this)
+ {
+ if(_hostConfig == null)
+ {
+ _hostConfig = new HostConfiguration();
+ }
+ }
+ }
+
+
+
+ public override Stream GetRequestStream()
+ {
+ bool isPutPost = String.Compare("post", MethodName, true) == 0
+ || String.Compare("put", MethodName, true) == 0;
+ if(!isPutPost)
+ throw new ProtocolViolationException();
+ lock(this)
+ {
+ if(_writeStream != null)
+ return _writeStream;
+ this.OpenConnection();
+
+ //java.io.PipedInputStream inJavaStream = new java.io.PipedInputStream();
+ //java.io.PipedOutputStream outJavaStream = new java.io.PipedOutputStream(inJavaStream);
+
+ long contLen = _contentLength;
+
+ OutputStreamRequestEntity reqEntity = new OutputStreamRequestEntity(contLen);
+
+ _writeStream = new VMWRequestStream(reqEntity, contLen);
+
+ EntityEnclosingMethod method = (EntityEnclosingMethod)_method;
+ if(AllowWriteStreamBuffering )
+ method.setRequestEntity(reqEntity);
+ else if(!AllowWriteStreamBuffering && contLen < 0 && !SendChunked)
+ throw new ProtocolViolationException();
+ else
+ method.setRequestEntity(reqEntity);
+
+ _hasRequest = true;
+ return _writeStream;
+ }
+ }
+ private bool isRedirectNeeded(HttpMethod method)
+ {
+ switch (method.getStatusCode())
+ {
+ case 302:
+ case 301:
+ case 303:
+ case 307:
+ if (method.getFollowRedirects())
+ return true;
+ else
+ return false;
+ default:
+ return false;
+ } //end of switch
+ }
+
+ private void synchHeaders()
+ {
+ foreach(string k in Headers)
+ {
+ if(k.ToLower().Equals("connection"))
+ continue;
+ string val = Headers[k];
+ val = (val == null) ? "" : val;
+ _method.setRequestHeader(k, val);
+ }
+ }
+
+ public override WebResponse GetResponse()
+ {
+ lock(this)
+ {
+ if(!_isConnectionOpened)
+ OpenConnection();
+ if(_response == null)
+ {
+ try
+ {
+ synchHeaders();
+ _client.executeMethod(_hostConfig, _method, _state);
+ //todo right place to re-put all headers again...
+ mainsoft.apache.commons.httpclient.Header hostHeader =
+ _method.getRequestHeader("Host");
+ if(hostHeader != null)
+ Headers.SetInternal("Host", hostHeader.getValue());
+
+ _response = new HttpWebResponse(_method, _state, _stateCache, GetAddress(), this.MethodName);
+
+ if(_response != null &&
+ _response.Cookies != null &&
+ _response.Cookies.Count > 0)
+ {
+ if(CookieContainer != null)
+ {
+ foreach(Cookie cooky in _response.Cookies)
+ {
+ CookieContainer.Add(GetAddress(), cooky);
+ }
+ }
+ }
+
+ _hasResponse = true;
+ int respCodeAsInt = (int) _response.StatusCode;
+ if(respCodeAsInt >= 400)
+ {
+ // The WebException contains the readable (not closed) response stream.
+ // So, in case of WebException, we should read all data from the
+ // network response stream into the memory stream, and after that
+ // close the underlying network stream. The following requests to read
+ // from the stream will actually read from the memory stream.
+ // So, the this.Abort() should not be called in this case.
+ _response.ReadAllAndClose();
+ //this.Abort();
+ throw new WebException("The remote server returned an error: (" + respCodeAsInt +") " +_response.StatusCode, null, WebExceptionStatus.ProtocolError, _response);
+ }
+ if(isRedirectNeeded(_method) && _method.getResponseHeader("location") == null)
+ {
+ // See comments above for the error >= 400
+ _response.ReadAllAndClose();
+ //this.Abort();
+ throw new WebException("Got response code "+_response.StatusCode+", but no location provided", null, WebExceptionStatus.ProtocolError, _response);
+ }
+ }
+ catch(ProtocolException e)
+ {
+ throw new WebException("", e);
+ }
+ catch(java.net.ConnectException e)
+ {
+ throw new WebException("Unable to connect to the remote server.", e);
+ }
+ catch(java.net.SocketTimeoutException e)
+ {
+ throw new WebException("Timeout exceeded", e);
+ }
+ catch(java.io.IOException e)
+ {
+ throw new WebException("", e);
+ }
+ }
+ return _response;
+ }
+
+ }
+
+ public override void Abort()
+ {
+ _isAborted = true;
+ try
+ {
+ if(_hasResponse)
+ {
+ _response.Close();
+ }
+ }
+ finally
+ {
+ _method.releaseConnection();
+ }
+ }
+
+ public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
+ {
+ lock(this)
+ {
+ if(_asyncWrite != null)
+ {
+ throw new InvalidOperationException ("Cannot re-call start of asynchronous " +
+ "method while a previous call is still in progress.");
+ }
+
+ _asyncWrite = new GHWebAsyncResult (this, callback, state);
+ if (_hasRequest)
+ {
+ if (_writeStream != null)
+ {
+ _asyncWrite.SetCompleted (true, _writeStream);
+ _asyncWrite.DoCallback ();
+ return _asyncWrite;
+ }
+ }
+
+
+ try
+ {
+ this.GetRequestStream();
+ }
+ catch(Exception e)
+ {
+ _asyncWrite.SetCompleted(false, e);
+ }
+
+ _asyncWrite.SetCompleted (true, _writeStream);
+ _asyncWrite.DoCallback ();
+ return _asyncWrite;
+
+ }
+ }
+
+ public override Stream EndGetRequestStream(IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+
+ GHWebAsyncResult result = asyncResult as GHWebAsyncResult;
+ if (result == null)
+ throw new ArgumentException ("Invalid IAsyncResult");
+
+ _asyncWrite = result;
+
+ result.WaitUntilComplete ();
+
+ Exception e = result.Exception;
+
+ if (e != null)
+ throw e;
+
+ return result.WriteStream;
+ }
+
+ public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
+ {
+ lock(this)
+ {
+ if(_asyncRead != null && !_hasResponse)
+ {
+ throw new InvalidOperationException ("Cannot re-call start of asynchronous " +
+ "method while a previous call is still in progress.");
+ }
+
+ _asyncRead = new GHWebAsyncResult (this, callback, state);
+ if (_hasResponse)
+ {
+ if (_response != null)
+ {
+ _asyncRead.SetCompleted (true, _writeStream);
+ _asyncRead.DoCallback ();
+ return _asyncRead;
+ }
+ }
+
+
+ try
+ {
+ GetResponse();
+ }
+ catch(Exception e)
+ {
+ _asyncRead.SetCompleted(false, e);
+ }
+ _asyncRead.SetCompleted (true, _writeStream);
+ _asyncRead.DoCallback ();
+ return _asyncRead;
+
+ }
+ }
+
+ public override WebResponse EndGetResponse(IAsyncResult asyncResult)
+ {
+ if (asyncResult == null)
+ throw new ArgumentNullException ("asyncResult");
+
+ GHWebAsyncResult result = asyncResult as GHWebAsyncResult;
+ if (result == null)
+ throw new ArgumentException ("Invalid IAsyncResult", "asyncResult");
+
+
+ _asyncRead = result;
+ if (!result.WaitUntilComplete (_timeout, false))
+ {
+ Abort ();
+ throw new WebException("The request timed out", WebExceptionStatus.Timeout);
+ }
+
+ return result.Response;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ #region VMWRequestStream class
+ internal class VMWRequestStream : Stream, IDisposable
+ {
+
+ private java.io.OutputStream _javaOutput;
+ private long _len;
+ private long _contentLength;
+
+ internal VMWRequestStream (java.io.OutputStream stream) :
+ this(stream , -1L)
+ {
+ }
+
+ internal VMWRequestStream (java.io.OutputStream stream, long contentLength)
+ {
+ _javaOutput = stream;
+ _contentLength = contentLength;
+ _len = 0;
+ }
+ public override bool CanRead
+ {
+ get {return false;}
+ }
+
+ public override bool CanWrite
+ {
+ get{return true;}
+ }
+
+ public override bool CanSeek
+ {
+ get { return false;}
+ }
+
+ public override long Length
+ {
+ get{ return _len;}
+ }
+
+ public override long Position
+ {
+ get
+ {
+ return _len;
+ }
+
+ set
+ {
+ throw new NotSupportedException();
+ }
+ }
+
+ private volatile bool _closed = false;
+
+ public override void Close()
+ {
+ if(!_closed)
+ {
+ lock(this)
+ {
+ if(!_closed)
+ {
+ _closed = true;
+ _javaOutput.flush();
+ _javaOutput.close();
+ }
+ }
+ }
+ }
+
+ public override void Flush()
+ {
+ _javaOutput.flush();
+ }
+
+ public override int ReadByte()
+ {
+ throw new NotSupportedException();
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ if(_contentLength >= 0)
+ {
+ _len += count;
+ if(_len > _contentLength)
+ {
+ throw new System.Net.ProtocolViolationException(
+ "Bytes to be written to the stream exceed Content-Length bytes size specified.");
+ }
+ }
+ _javaOutput.write(vmw.common.TypeUtils.ToSByteArray(buffer), offset, count);
+
+ if(_contentLength == _len)
+ {
+ _javaOutput.flush();
+ _javaOutput.close();
+ }
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ throw new NotSupportedException();
+ }
+
+ public override void SetLength(long length)
+ {
+ throw new NotSupportedException();
+ }
+
+ void IDisposable.Dispose()
+ {
+ try
+ {
+ Close();
+ }
+ catch(Exception)
+ {
+ }
+ }
+ }
+
+ #endregion
+
+ #region GHWebAsyncResult
+ internal class GHWebAsyncResult : IAsyncResult
+ {
+ private object _state;
+ private AsyncCallback _callback;
+ private ManualResetEvent _handle;
+ private bool _isCompleted = false;
+ private bool _callbackDone;
+ private Stream _writeStream;
+ private HttpProvider _provider;
+
+ private Exception _exception;
+
+ #region Constructors
+
+ public GHWebAsyncResult(HttpProvider provider,
+ AsyncCallback callback, object state) :
+ this(state, callback)
+ {
+ _provider = provider;
+ }
+
+ public GHWebAsyncResult(object state, AsyncCallback callback)
+ {
+ _state = state;
+ _callback = callback;
+ }
+ #endregion
+
+ #region IAsyncResult Members
+
+ public object AsyncState
+ {
+ get
+ {
+ return _state;
+ }
+ }
+
+ public bool CompletedSynchronously
+ {
+ get
+ {
+ // TODO: Add HWebAsyncResult.CompletedSynchronously getter implementation
+ return false;
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle
+ {
+ get
+ {
+ if (_handle == null)
+ {
+ lock (this)
+ {
+ if (_handle == null)
+ _handle = new ManualResetEvent (_isCompleted);
+ }
+ }
+
+ return _handle;
+ }
+ }
+
+ public bool IsCompleted
+ {
+ get
+ {
+ return _isCompleted;
+ }
+ }
+
+ #endregion
+
+ #region Internal Properties
+
+ internal Stream WriteStream
+ {
+ get
+ {
+ return _writeStream;
+ }
+ }
+
+ internal Exception Exception
+ {
+ get
+ {
+ return _exception;
+ }
+ }
+
+ internal HttpWebResponse Response
+ {
+ get
+ {
+ return ((VMWHttpProvider)_provider)._response;
+ }
+ }
+
+ #endregion
+
+ #region Internal Methods
+
+ internal void SetCompleted(bool res, Stream writeStream)
+ {
+ _isCompleted = res;
+ _writeStream = writeStream;
+ ((ManualResetEvent) AsyncWaitHandle).Set ();
+ }
+
+ internal void SetCompleted(bool res, Exception exc)
+ {
+ _isCompleted = res;
+ _exception = exc;
+ ((ManualResetEvent) AsyncWaitHandle).Set ();
+ }
+
+ internal void DoCallback()
+ {
+ if (!_callbackDone && _callback != null)
+ {
+ _callbackDone = true;
+ _callback (this);
+ }
+ }
+
+ internal void WaitUntilComplete()
+ {
+ if(_isCompleted)
+ return;
+ AsyncWaitHandle.WaitOne ();
+ }
+
+ internal bool WaitUntilComplete (int timeout, bool exitContext)
+ {
+ if (_isCompleted)
+ return true;
+
+ return AsyncWaitHandle.WaitOne (timeout, exitContext);
+ }
+ #endregion
+
+ }
+
+ #endregion
+
+ #region OutputStreamRequestEntity
+
+ internal class OutputStreamRequestEntity : java.io.OutputStream, RequestEntity
+ {
+ private long _contentLength;
+ private java.io.ByteArrayOutputStream _out;
+ private sbyte[] _buffer;
+
+ internal OutputStreamRequestEntity(): this(-1)
+ {
+ }
+
+ internal OutputStreamRequestEntity(long length)
+ {
+ _contentLength = length;
+ int tmp = (int) _contentLength;
+
+ if(tmp <=0)
+ tmp = 4096;
+ _out = new java.io.ByteArrayOutputStream(tmp);
+ }
+
+ #region RequestEntity Members
+
+ public bool isRepeatable()
+ {
+ return ((_out != null) || (_buffer != null));
+ }
+
+ public long getContentLength()
+ {
+ if(_out != null)
+ {
+ _buffer = _out.toByteArray();
+ }
+ if(_buffer != null)
+ {
+ _contentLength = _buffer.Length;
+ _out = null;
+ }
+ return _contentLength;
+ }
+
+ public void writeRequest(java.io.OutputStream output)
+ {
+ if(_out != null)
+ _buffer = _out.toByteArray();
+ if(_buffer != null)
+ {
+ output.write(_buffer, 0, _buffer.Length);
+ _out = null;
+ }
+ else throw new ApplicationException();
+ }
+
+ public string getContentType()
+ {
+ return null;
+ }
+
+ #endregion
+
+ public override void write(int i)
+ {
+ _out.write(i);
+ }
+
+ }
+
+ #endregion
+
+
+
+
+
+
+
+ }
+}
diff --git a/mcs/class/System/System.Security.AccessControl/SemaphoreAuditRule.cs b/mcs/class/System/System.Security.AccessControl/SemaphoreAuditRule.cs
index 2bcf8676655..f8344420cb7 100644
--- a/mcs/class/System/System.Security.AccessControl/SemaphoreAuditRule.cs
+++ b/mcs/class/System/System.Security.AccessControl/SemaphoreAuditRule.cs
@@ -43,7 +43,9 @@ namespace System.Security.AccessControl {
public SemaphoreAuditRule (IdentityReference identity,
SemaphoreRights semaphoreRights,
AuditFlags flags)
+#if !TARGET_JVM
: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, flags)
+#endif
{
this.semaphoreRights = semaphoreRights;
}
diff --git a/mcs/class/System/machine.config b/mcs/class/System/machine.config
new file mode 100644
index 00000000000..d1ebe8ae9dc
--- /dev/null
+++ b/mcs/class/System/machine.config
@@ -0,0 +1,445 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+
+ <configSections>
+ <section name="configProtectedData" type="System.Configuration.ProtectedConfigurationSection, System.Configuration" />
+ <section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration" />
+ <section name="connectionStrings" type="System.Configuration.ConnectionStringsSection, System.Configuration" />
+ <section name="mscorlib" type="System.Configuration.IgnoreSection, System.Configuration" />
+ <section name="runtime" type="System.Configuration.IgnoreSection, System.Configuration" />
+ <section name="startup" type="System.Configuration.IgnoreSection, System.Configuration" />
+ <section name="system.data" type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data" />
+ <section name="system.diagnostics" type="System.Diagnostics.DiagnosticsConfigurationHandler, System" />
+ <section name="system.runtime.remoting" type="System.Configuration.IgnoreSection, System.Configuration"/>
+ <section name="strongNames" type="System.Configuration.IgnoreSection, System.Configuration" allowLocation="false"/>
+ <sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web">
+ <section name="anonymousIdentification" type="System.Web.Configuration.AnonymousIdentificationSection, System.Web" />
+ <section name="authentication" type="System.Web.Configuration.AuthenticationSection, System.Web" />
+ <section name="authorization" type="System.Web.Configuration.AuthorizationSection, System.Web" />
+ <section name="clientTarget" type="System.Web.Configuration.ClientTargetSection, System.Web" />
+ <section name="compilation" type="System.Web.Configuration.CompilationSection, System.Web" />
+ <section name="customErrors" type="System.Web.Configuration.CustomErrorsSection, System.Web" />
+ <section name="globalization" type="System.Web.Configuration.GlobalizationSection, System.Web" />
+ <section name="httpHandlers" type="System.Web.Configuration.HttpHandlersSection, System.Web" />
+ <section name="httpModules" type="System.Web.Configuration.HttpModulesSection, System.Web" />
+ <section name="httpRuntime" type="System.Web.Configuration.HttpRuntimeSection, System.Web" />
+ <section name="machineKey" type="System.Web.Configuration.MachineKeySection, System.Web" />
+ <section name="membership" type="System.Web.Configuration.MembershipSection, System.Web" />
+ <section name="pages" type="System.Web.Configuration.PagesSection, System.Web" />
+ <section name="profile" type="System.Web.Configuration.ProfileSection, System.Web" />
+ <section name="roleManager" type="System.Web.Configuration.RoleManagerSection, System.Web" />
+ <section name="sessionState" type="System.Web.Configuration.SessionStateSection, System.Web" />
+ <section name="siteMap" type="System.Web.Configuration.SiteMapSection, System.Web" />
+ <section name="trace" type="System.Web.Configuration.TraceSection, System.Web" />
+ <section name="urlMappings" type="System.Web.Configuration.UrlMappingsSection, System.Web" />
+ <section name="webControls" type="System.Web.Configuration.WebControlsSection, System.Web" />
+ <section name="webServices" type="System.Web.Services.Configuration.WebServicesSection, System.Web.Services" />
+ <section name="xhtmlConformance" type="System.Web.Services.Configuration.XhtmlConformanceSection, System.Web.Services" />
+ <sectionGroup name="caching" type="System.Web.Configuration.SystemWebCachingSectionGroup, System.Web">
+ <section name="cache" type="System.Web.Configuration.CacheSection, System.Web" />
+ <section name="outputCache" type="System.Web.Configuration.OutputCacheSection, System.Web" />
+ <section name="outputCacheSettings" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web" />
+ <section name="sqlCacheDependency" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web" />
+ </sectionGroup>
+ </sectionGroup>
+ <sectionGroup name="system.net">
+ <section name="settings"
+ type="System.Net.Configuration.NetConfigurationHandler, System" />
+ <section name="connectionManagement"
+ type="System.Net.Configuration.ConnectionManagementHandler, System" />
+ <section name="authenticationModules"
+ type="System.Net.Configuration.NetAuthenticationModuleHandler, System" />
+ <section name="defaultProxy"
+ type="System.Net.Configuration.DefaultProxyHandler, System" />
+ <section name="webRequestModules"
+ type="System.Net.Configuration.WebRequestModuleHandler, System" />
+ </sectionGroup>
+ <sectionGroup name="system.drawing">
+ <section name="icons" type="System.Configuration.NameValueSectionHandler" />
+ <section name="codecs" type="System.Configuration.NameValueSectionHandler" />
+ <section name="codecsmetadata" type="Mainsoft.Drawing.Configuration.ResolutionConfigurationHandler" />
+ </sectionGroup>
+ <sectionGroup name="System.DirectoryServices">
+ <section name="Settings" type="System.Configuration.NameValueSectionHandler"/>
+ </sectionGroup>
+ <sectionGroup name="Mainsoft.Data.Configuration">
+ <section name="objectnameresolution"
+ type="System.Data.Configuration.ObjectNameResolutionSectionHandler, System.Data" />
+ <section name="switches"
+ type="System.Configuration.NameValueSectionHandler, System" />
+ <section name="OleDbProviders"
+ type="Mainsoft.Data.Configuration.ProvidersSectionHandler, System.Data" />
+ <section name="SqlClientProviders"
+ type="Mainsoft.Data.Configuration.ProvidersSectionHandler, System.Data" />
+ <section name="OracleClientProviders"
+ type="Mainsoft.Data.Configuration.ProvidersSectionHandler, System.Data" />
+ </sectionGroup>
+ <!--section name="system.drawing" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /-->
+ </configSections>
+ <configProtectedData defaultProvider="RsaProtectedConfigurationProvider">
+ <providers>
+ <!-- add name="RsaProtectedConfigurationProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration"
+ description="" keyContainerName="MonoFrameworkConfigurationKey" cspProviderName="" useMachineContainer="true" useOAEP="false" /-->
+ <add name="DataProtectionConfigurationProvider" type="System.Configuration.DpapiProtectedConfigurationProvider, System.Configuration"
+ description="" useMachineProtection="true" keyEntropy="" />
+ </providers>
+ </configProtectedData>
+ <system.net>
+ <connectionManagement>
+ <add address="*" maxconnection="2" />
+ </connectionManagement>
+ <authenticationModules>
+ <add type="System.Net.BasicClient" />
+ <add type="System.Net.DigestClient" />
+ <!-- <add type="System.Net.NtlmClient" /> -->
+ </authenticationModules>
+ <defaultProxy>
+ <proxy />
+ <!-- bypassonlocal and proxyaddress are ok -->
+ <!-- usessystemdefault is not supported -->
+ </defaultProxy>
+ <webRequestModules>
+ <add prefix="http" type="System.Net.HttpRequestCreator, System" />
+ <add prefix="https" type="System.Net.HttpRequestCreator, System" />
+ <add prefix="file" type="System.Net.FileWebRequestCreator, System" />
+ </webRequestModules>
+ <settings>
+ <ipv6 enabled="false"/>
+ </settings>
+ </system.net>
+ <system.data>
+ <DbProviderFactories>
+ <add name="OleDb Data Provider" support="2" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data" />
+ <add name="OracleClient Data Provider" support="2" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle" type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient" />
+ <add name="SqlClient Data Provider" support="2" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data" />
+ </DbProviderFactories>
+ </system.data>
+ <system.web>
+ <httpHandlers>
+ <add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web" />
+ <add verb="*" path="trace.axd" type="System.Web.Handlers.TraceHandler, System.Web" />
+ <add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web" />
+ <add verb="*" path="*.ashx" type="System.Web.UI.PageHandlerFactory, System.Web" />
+ <add verb="*" path="*.asmx" validate="false"
+ type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services" />
+ <!--<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory, System.Web" />-->
+ <add verb="GET" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web" />
+ add verb="*" path="*.master" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.resources" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.skin" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.browser" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.sitemap" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.webinfo" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.resx" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.Config" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.vb" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.csproj" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.vbproj" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.licx" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.dll" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.jar" type="System.Web.HttpForbiddenHandler, System.Web" />
+ <add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting" validate="false" />
+ <add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting" validate="false" />
+ <add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web" />
+ <add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web" />
+ </httpHandlers>
+ <httpModules>
+ <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
+ <add name="Session" type="System.Web.SessionState.SessionStateModule" />
+ <!--add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" /-->
+ <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
+ <!--add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule" /-->
+ <add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
+ <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
+ <!--add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" /-->
+ <!--add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule" /-->
+ <!--add name="Profile" type="System.Web.Profile.ProfileModule" /-->
+ </httpModules>
+ <machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1" />
+ <membership>
+ <providers>
+ <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
+ </providers>
+ </membership>
+ <profile>
+ <providers>
+ <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web" />
+ </providers>
+ </profile>
+ <roleManager>
+ <providers>
+ <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web" />
+ </providers>
+ </roleManager>
+ <globalization requestEncoding="utf-8"
+ responseEncoding="utf-8"
+ fileEncoding="utf-8"/>
+ <!--
+ culture="en-US"
+ uiculture="en-US" />
+ -->
+ <sessionState mode="InProc" />
+ <webServices>
+ <protocols>
+ <add name="HttpSoap"/>
+ <add name="HttpPost"/>
+ <add name="HttpGet"/>
+ <add name="Documentation"/>
+ </protocols>
+ <wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx" />
+ </webServices>
+ <webControls clientScriptsLocation="/web_scripts" />
+ <compilation debug="false" defaultLanguage="c#">
+ <compilers>
+ <compiler language="cs;c#;csharp" extension=".cs" warningLevel="1" compilerOptions=""
+ type="Microsoft.CSharp.CSharpCodeProvider, System" />
+ <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
+ warningLevel="1" compilerOptions=""
+ type="Microsoft.VisualBasic.VBCodeProvider, System" />
+ </compilers>
+ <assemblies>
+ <!--<add assembly="mscorlib" /> -->
+ <add assembly="System" />
+ <add assembly="System.Xml" />
+ <add assembly="System.Data" />
+ <add assembly="System.Web" />
+ <add assembly="System.Web.Services" />
+ <add assembly="System.Drawing" />
+ <add assembly="*" /> <!-- Add assemblies in bin directory -->
+ </assemblies>
+ </compilation>
+ <httpRuntime executionTimeout="90"
+ maxRequestLength="4096"
+ useFullyQualifiedRedirectUrl="false"
+ minFreeThreads="8"
+ minLocalRequestFreeThreads="4"
+ appRequestQueueLimit="100" />
+ <siteMap>
+ <providers>
+ <add siteMapFile="web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web" />
+ </providers>
+ </siteMap>
+
+ <urlMappings enabled="true" />
+
+ <pages buffer="true"
+ enableSessionState="true"
+ autoEventWireup="true"
+ validateRequest="true" />
+ </system.web>
+
+ <system.runtime.remoting>
+ <application>
+ <channels>
+ <channel ref="http client" displayName="http client (delay loaded)" delayLoadAsClientChannel="true" />
+ <channel ref="tcp client" displayName="tcp client (delay loaded)" delayLoadAsClientChannel="true" />
+ </channels>
+ </application>
+ <channels>
+ <channel id="http" type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting" />
+ <channel id="http client" type="System.Runtime.Remoting.Channels.Http.HttpClientChannel, System.Runtime.Remoting" />
+ <channel id="http server" type="System.Runtime.Remoting.Channels.Http.HttpServerChannel, System.Runtime.Remoting" />
+ <channel id="tcp" type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting" />
+ <channel id="tcp client" type="System.Runtime.Remoting.Channels.Tcp.TcpClientChannel, System.Runtime.Remoting" />
+ <channel id="tcp server" type="System.Runtime.Remoting.Channels.Tcp.TcpServerChannel, System.Runtime.Remoting" />
+ </channels>
+ <channelSinkProviders>
+ <clientProviders>
+ <formatter id="soap" type="System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider, System.Runtime.Remoting" />
+ <formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider, System.Runtime.Remoting" />
+ </clientProviders>
+ <serverProviders>
+ <formatter id="soap" type="System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider, System.Runtime.Remoting" />
+ <formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider, System.Runtime.Remoting" />
+ <provider id="wsdl" type="System.Runtime.Remoting.MetadataServices.SdlChannelSinkProvider, System.Runtime.Remoting" />
+ </serverProviders>
+ </channelSinkProviders>
+ </system.runtime.remoting>
+ <Mainsoft.Data.Configuration>
+ <objectnameresolution>
+ <!-- CATALOG.SCHEMA.NAME-->
+ <!-- "^\s*((((\[\s*(?<CATALOG>(\s*[^\[\]\s])+)\s*\])|(?<CATALOG>(\w|!|\#|\$)*(\s*(\w|!|\#|\$)+)*))\s*\.\s*)?((\[(?<SCHEMA>(\s*[^\[\]\s])+)\s*\])|(?<SCHEMA>(\w|!|\#|\$)*(\s*(\w|!|\#|\$)+)*))\s*\.\s*)?((\[(?<NAME>(\s*[^\[\]\s])+)\s*\])|(?<NAME>(\w|!|\#|\$)+(\s*(\w|!|\#|\$)+)*))\s*$" -->
+ <!-- <add dbname="<name returned by server>" match="^\s*((((\[\s*(?&lt;CATALOG&gt;(\s*[^\[\]\s])+)\s*\])|(?&lt;CATALOG&gt;(\w|!|\#|\$)*(\s*(\w|!|\#|\$)+)*))\s*\.\s*)?((\[(?&lt;SCHEMA&gt;(\s*[^\[\]\s])+)\s*\])|(?&lt;SCHEMA&gt;(\w|!|\#|\$)*(\s*(\w|!|\#|\$)+)*))\s*\.\s*)?((\[(?&lt;NAME&gt;(\s*[^\[\]\s])+)\s*\])|(?&lt;NAME&gt;(\w|!|\#|\$)+(\s*(\w|!|\#|\$)+)*))\s*$" priority="1"/> -->
+ </objectnameresolution>
+ <OleDbProviders>
+
+ <!-- Microsoft SQLServer driver 2000 -->
+ <provider>
+ <add key="url" value = "jdbc:microsoft:sqlserver://${servername}:${port};DatabaseName=${database}" />
+ <add key="driverClassName" value = "com.microsoft.jdbc.sqlserver.SQLServerDriver" />
+ <add key="id" value = "SQLJDBC2000" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbSqlServerProvider2000, System.Data" />
+ <add key="keyMapping" value = "serverName=data source,server,address,addr;user=user id,user,uid;password=password,pwd;database=initial catalog,database;loginTimeout=connect timeout,connection timeout;" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+
+ <!-- Microsoft SQLServer driver 2005 -->
+ <provider>
+ <add key="url" value = "jdbc:sqlserver://${servername}" />
+ <add key="driverClassName" value = "com.microsoft.sqlserver.jdbc.SQLServerDriver" />
+ <add key="id" value = "SQLJDBC2005" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbSqlServerProvider2005, System.Data" />
+ <add key="keyMapping" value = "serverName=data source,server,address,addr;user=user id,user,uid;password=password,pwd;database=initial catalog,database;loginTimeout=connect timeout,connection timeout;" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+
+ <!-- Microsoft SQLServer driver 2005 (default) -->
+ <provider>
+ <add key="url" value = "jdbc:sqlserver://${servername}" />
+ <add key="driverClassName" value = "com.microsoft.sqlserver.jdbc.SQLServerDriver" />
+ <add key="id" value = "SQLOLEDB.1" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbSqlServerProvider2005, System.Data" />
+ <add key="keyMapping" value = "serverName=data source,server,address,addr;user=user id,user,uid;password=password,pwd;database=initial catalog,database;loginTimeout=connect timeout,connection timeout;" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+
+ <!-- Oracle driver -->
+ <provider>
+ <add key="url" value = "jdbc:oracle:thin:@//${servername}:${port}/${servicename}" />
+ <add key="driverClassName" value = "oracle.jdbc.OracleDriver" />
+ <add key="port" value = "1521" />
+ <add key="id" value = "MSDAORA.1" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbOracleProvider, System.Data" />
+ <add key="keyMapping" value = "servername=hostname;user=user id,user,uid;password=password,pwd;servicename=data source,sid;loginTimeout=connect timeout,connection timeout" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+
+ <!-- IMB DB2 driver -->
+ <provider>
+ <add key="url" value = "jdbc:db2://${servername}:${port}/${database}" />
+ <add key="driverClassName" value = "com.ibm.db2.jcc.DB2Driver" />
+ <add key="port" value = "50000" />
+ <add key="id" value = "IBMDADB2.1" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbDB2Provider, System.Data" />
+ <add key="keyMapping" value = "servername=hostname;user=user id,user,uid;password=password,pwd;database=data source;loginTimeout=connect timeout,connection timeout;" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+ </OleDbProviders>
+ <SqlClientProviders>
+
+ <!-- Microsoft SQLServer driver 2000 -->
+ <provider>
+ <add key="url" value = "jdbc:microsoft:sqlserver://${servername}:${port};DatabaseName=${database}" />
+ <add key="driverClassName" value = "com.microsoft.jdbc.sqlserver.SQLServerDriver" />
+ <add key="id" value = "SQLJDBC2000" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbSqlServerProvider2000, System.Data" />
+ <add key="keyMapping" value = "serverName=data source,server,address,addr;user=user id,user,uid;password=password,pwd;database=initial catalog,database;loginTimeout=connect timeout,connection timeout;" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+
+ <!-- Microsoft SQLServer driver 2005 -->
+ <provider>
+ <add key="url" value = "jdbc:sqlserver://${servername}" />
+ <add key="driverClassName" value = "com.microsoft.sqlserver.jdbc.SQLServerDriver" />
+ <add key="id" value = "SQLJDBC2005" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbSqlServerProvider2005, System.Data" />
+ <add key="keyMapping" value = "serverName=data source,server,address,addr;user=user id,user,uid;password=password,pwd;database=initial catalog,database;loginTimeout=connect timeout,connection timeout;" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+
+ <!-- Microsoft SQLServer driver 2005 (default) -->
+ <provider>
+ <add key="url" value = "jdbc:sqlserver://${servername}" />
+ <add key="driverClassName" value = "com.microsoft.sqlserver.jdbc.SQLServerDriver" />
+ <add key="id" value = "SQLCLIENT" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OleDbSqlServerProvider2005, System.Data" />
+ <add key="keyMapping" value = "serverName=data source,server,address,addr;user=user id,user,uid;password=password,pwd;database=initial catalog,database;loginTimeout=connect timeout,connection timeout;" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+ </SqlClientProviders>
+
+ <OracleClientProviders>
+
+ <!-- Oracle driver -->
+ <provider>
+ <add key="url" value = "jdbc:oracle:thin:@//${servername}:${port}/${servicename}" />
+ <add key="driverClassName" value = "oracle.jdbc.OracleDriver" />
+ <add key="port" value = "1521" />
+ <add key="id" value = "ORACLECLIENT" />
+ <add key="type" value = "Mainsoft.Data.Jdbc.Providers.OracleProvider, System.Data.OracleClient" />
+ <add key="keyMapping" value = "servername=hostname;user=user id,user,uid;password=password,pwd;servicename=data source,sid;loginTimeout=connect timeout,connection timeout" />
+ <add key="keyExclude" value="provider,jndi-datasource-name,naming-provider-url,naming-factory-initial,jdbcdriverclassname,jdbcurl" />
+ </provider>
+ </OracleClientProviders>
+ </Mainsoft.Data.Configuration>
+
+ <System.DirectoryServices>
+ <Settings>
+ <add key="servername" value="localhost"/>
+ <add key="port" value="389"/>
+ <add key="securitymech" value="1.2.840.113554.1.2.2"/>
+ <add key="securityappname" value="com.mainsoft.system.directoryservices"/>
+ <add key="authenticationmech" value="GSSAPI"/>
+ </Settings>
+ </System.DirectoryServices>
+
+ <appSettings>
+ <!--<add key="yourkey" value="your value" /> -->
+ <!--<remove key="a key defined higher in the hierarchy" /> -->
+ <!--<clear/> Removes all defined settings -->
+ </appSettings>
+ <system.diagnostics>
+ <trace autoflush="false" indentsize="4" />
+ </system.diagnostics>
+ <system.drawing>
+ <icons>
+ <add key="Application" value="System.Drawing.resources.icons.application.png"/>
+ <add key="Asterisk" value="System.Drawing.resources.icons.asterisk.png"/>
+ <add key="Error" value="System.Drawing.resources.icons.error.png"/>
+ <add key="Exclamation" value="System.Drawing.resources.icons.exclamation.png"/>
+ <add key="Hand" value="System.Drawing.resources.icons.hand.png"/>
+ <add key="Information" value="System.Drawing.resources.icons.information.png"/>
+ <add key="Question" value="System.Drawing.resources.icons.question.png"/>
+ <add key="Warning" value="System.Drawing.resources.icons.warning.png"/>
+ <add key="WinLogo" value="System.Drawing.resources.icons.winlogo.png"/>
+ </icons>
+ <codecs>
+ <!-- This mimetypes are plugin depenand, for now jai_imageio.jar -->
+ <!-- and java built in imageio specified -->
+ <add key="557cf400-1a04-11d3-9a73-0000f81ef32e" value="image/bmp, image/x-bmp, image/x-windows-bmp"/>
+ <add key="557cf406-1a04-11d3-9a73-0000f81ef32e" value="image/png"/>
+ <add key="557cf402-1a04-11d3-9a73-0000f81ef32e" value="image/gif"/>
+ <add key="557cf401-1a04-11d3-9a73-0000f81ef32e" value="image/jpeg"/>
+ <add key="557cf405-1a04-11d3-9a73-0000f81ef32e" value="image/tiff"/>
+ </codecs>
+ <codecsmetadata>
+ <imageformat name="Bmp">
+ <xresolution default="96">//PixelsPerMeter/X</xresolution>
+ <yresolution default="96">//PixelsPerMeter/Y</yresolution>
+ <unitstype default="meter"></unitstype>
+ <unitscale value="meter" name="meter">.0254</unitscale>
+ </imageformat>
+ <imageformat name="Jpeg">
+ <xresolution default="96">//JPEGvariety/app0JFIF/@Xdensity</xresolution>
+ <yresolution default="96">//JPEGvariety/app0JFIF/@Ydensity</yresolution>
+ <unitstype default="1">//JPEGvariety/app0JFIF/@resUnits</unitstype>
+ <unitscale value="0" name="na">1.0</unitscale>
+ <unitscale value="1" name="inch">1.0</unitscale>
+ <unitscale value="2" name="cm">25.4</unitscale>
+ </imageformat>
+ <imageformat name="Png">
+ <xresolution default="96">//pHYs/@pixelsPerUnitXAxis</xresolution>
+ <yresolution default="96">//pHYs/@pixelsPerUnitYAxis</yresolution>
+ <unitstype default="inch">//pHYs/@unitSpecifier</unitstype>
+ <unitscale value="meter" name="meter">.0254</unitscale>
+ <unitscale value="inch" name="inch">1.0</unitscale>
+ <unitscale value="unknown" name="na">1.0</unitscale>
+ </imageformat>
+ <imageformat name="Tiff">
+ <xresolution default="96">//TIFFField[@name='XResolution']/TIFFRationals/TIFFRational/@value</xresolution>
+ <yresolution default="96">//TIFFField[@name='YResolution']/TIFFRationals/TIFFRational/@value</yresolution>
+ <unitstype default="2">//TIFFField[@name='ResolutionUnit']/TIFFShorts/TIFFShort/@value</unitstype>
+ <unitscale value="1" name="na">1.0</unitscale>
+ <unitscale value="2" name="inch">1.0</unitscale>
+ <unitscale value="3" name="cm">25.4</unitscale>
+ </imageformat>
+ </codecsmetadata>
+ </system.drawing>
+</configuration>
+
+