Imported Upstream version 4.4.2.4

Former-commit-id: 92904c9c5915c37244316e42ba99e7b934ed7ee2
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-07-21 09:40:10 +00:00
parent 589d484eee
commit 0b4a830db1
343 changed files with 9849 additions and 688 deletions

View File

@ -63,7 +63,7 @@ namespace System.IO.Pipes
{
}
public AnonymousPipeClientStream (PipeDirection direction,SafePipeHandle safePipeHandle)
public AnonymousPipeClientStream (PipeDirection direction, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
{
/*
@ -73,7 +73,11 @@ namespace System.IO.Pipes
impl = new UnixAnonymousPipeClient (this, safePipeHandle);
*/
#if MOBILE
throw new NotImplementedException ();
#else
InitializeHandle (safePipeHandle, false, false);
#endif
IsConnected = true;
}

View File

@ -59,10 +59,18 @@ namespace System.IO.Pipes
}
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize)
#if MOBILE
: base (direction, bufferSize)
{
throw new NotImplementedException ();
}
#else
: this (direction, inheritability, bufferSize, null)
{
}
#endif
#if !MOBILE
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
: base (direction, bufferSize)
{
@ -77,6 +85,7 @@ namespace System.IO.Pipes
InitializeHandle (impl.Handle, false, false);
IsConnected = true;
}
#endif
[MonoTODO]
public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle)
@ -90,6 +99,9 @@ namespace System.IO.Pipes
if (direction == PipeDirection.InOut)
throw new NotSupportedException ("Anonymous pipe direction can only be either in or out.");
#if MOBILE
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32AnonymousPipeServer (this, serverSafePipeHandle, clientSafePipeHandle);
else
@ -99,6 +111,12 @@ namespace System.IO.Pipes
IsConnected = true;
ClientSafePipeHandle = clientSafePipeHandle;
#endif
}
~AnonymousPipeServerStream ()
{
// To be compatible with .net
}
IAnonymousPipeServer impl;

View File

@ -72,21 +72,33 @@ namespace System.IO.Pipes
}
public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
#if MOBILE
: base (direction, DefaultBufferSize)
{
throw new NotImplementedException ();
}
#else
: this (serverName, pipeName, ToAccessRights (direction), options, impersonationLevel, inheritability)
{
}
#endif
public NamedPipeClientStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
{
#if MOBILE
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32NamedPipeClient (this, safePipeHandle);
else
impl = new UnixNamedPipeClient (this, safePipeHandle);
IsConnected = isConnected;
InitializeHandle (safePipeHandle, true, isAsync);
#endif
}
#if !MOBILE
public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
: base (ToDirection (desiredAccessRights), DefaultBufferSize)
{
@ -99,21 +111,30 @@ namespace System.IO.Pipes
else
impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
}
#endif
INamedPipeClient impl;
public void Connect ()
{
#if MOBILE
throw new NotImplementedException ();
#else
impl.Connect ();
InitializeHandle (impl.Handle, false, impl.IsAsync);
IsConnected = true;
#endif
}
public void Connect (int timeout)
{
#if MOBILE
throw new NotImplementedException ();
#else
impl.Connect (timeout);
InitializeHandle (impl.Handle, false, impl.IsAsync);
IsConnected = true;
#endif
}
public int NumberOfServerInstances {

View File

@ -70,10 +70,18 @@ namespace System.IO.Pipes
}
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize)
#if MOBILE
: base (direction, inBufferSize)
{
throw new NotImplementedException ();
}
#else
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, null)
{
}
#endif
#if !MOBILE
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity)
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, HandleInheritability.None)
{
@ -101,16 +109,26 @@ namespace System.IO.Pipes
InitializeHandle (impl.Handle, false, (options & PipeOptions.Asynchronous) != PipeOptions.None);
}
#endif
public NamedPipeServerStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
{
#if MOBILE
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32NamedPipeServer (this, safePipeHandle);
else
impl = new UnixNamedPipeServer (this, safePipeHandle);
IsConnected = isConnected;
InitializeHandle (safePipeHandle, true, isAsync);
#endif
}
~NamedPipeServerStream ()
{
// To be compatible with .net
}
INamedPipeServer impl;
@ -120,12 +138,14 @@ namespace System.IO.Pipes
impl.Disconnect ();
}
#if !MOBILE
[MonoTODO]
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker)
{
throw new NotImplementedException ();
}
#endif
public void WaitForConnection ()
{
@ -140,6 +160,7 @@ namespace System.IO.Pipes
throw new NotImplementedException ();
}
#if !MOBILE
// async operations
Action wait_connect_delegate;
@ -156,6 +177,7 @@ namespace System.IO.Pipes
{
wait_connect_delegate.EndInvoke (asyncResult);
}
#endif
}
}

View File

@ -46,15 +46,18 @@ namespace System.IO.Pipes
// FIXME: not precise.
internal const int DefaultBufferSize = 0x400;
#if !MOBILE
internal static bool IsWindows {
get { return Win32Marshal.IsWindows; }
}
#endif
internal Exception ThrowACLException ()
{
return new NotImplementedException ("ACL is not supported in Mono");
}
#if !MOBILE
internal static PipeAccessRights ToAccessRights (PipeDirection direction)
{
switch (direction) {
@ -85,6 +88,7 @@ namespace System.IO.Pipes
throw new ArgumentOutOfRangeException ();
}
}
#endif
protected PipeStream (PipeDirection direction, int bufferSize)
: this (direction, PipeTransmissionMode.Byte, bufferSize)
@ -140,7 +144,9 @@ namespace System.IO.Pipes
set { stream = value; }
}
#if !MOBILE
protected bool IsHandleExposed { get; private set; }
#endif
[MonoTODO]
public bool IsMessageComplete { get; private set; }
@ -176,7 +182,19 @@ namespace System.IO.Pipes
}
// initialize/dispose/state check
#if MOBILE
internal static void CheckPipePropertyOperations ()
{
}
static void CheckReadOperations ()
{
}
static void CheckWriteOperations ()
{
}
#else
[MonoTODO]
protected internal virtual void CheckPipePropertyOperations ()
{
@ -206,6 +224,7 @@ namespace System.IO.Pipes
this.IsHandleExposed = isExposed;
this.IsAsync = isAsync;
}
#endif
protected override void Dispose (bool disposing)
{
@ -234,6 +253,7 @@ namespace System.IO.Pipes
throw new NotSupportedException ();
}
#if !MOBILE
public PipeSecurity GetAccessControl ()
{
return new PipeSecurity (SafePipeHandle,
@ -255,6 +275,7 @@ namespace System.IO.Pipes
public void WaitForPipeDrain ()
{
}
#endif
[MonoTODO]
public override int Read ([In] byte [] buffer, int offset, int count)
@ -298,6 +319,7 @@ namespace System.IO.Pipes
// async
#if !MOBILE
Func<byte [],int,int,int> read_delegate;
[HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)]
@ -327,6 +349,7 @@ namespace System.IO.Pipes
{
write_delegate.EndInvoke (asyncResult);
}
#endif
}
}