You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.142
Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
parent
e52655b4dc
commit
0abdbe5a7d
@ -1,102 +0,0 @@
|
||||
//
|
||||
// AnonymousPipeClientStream.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2009 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.
|
||||
//
|
||||
|
||||
#if !BOOTSTRAP_BASIC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[MonoTODO ("Anonymous pipes are not working even on win32, due to some access authorization issue")]
|
||||
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
public sealed class AnonymousPipeClientStream : PipeStream
|
||||
{
|
||||
static SafePipeHandle ToSafePipeHandle (string pipeHandleAsString)
|
||||
{
|
||||
if (pipeHandleAsString == null)
|
||||
throw new ArgumentNullException ("pipeHandleAsString");
|
||||
// We use int64 for safety
|
||||
return new SafePipeHandle (new IntPtr (long.Parse (pipeHandleAsString, NumberFormatInfo.InvariantInfo)), false);
|
||||
}
|
||||
|
||||
//IAnonymousPipeClient impl;
|
||||
|
||||
public AnonymousPipeClientStream (string pipeHandleAsString)
|
||||
: this (PipeDirection.In, pipeHandleAsString)
|
||||
{
|
||||
}
|
||||
|
||||
public AnonymousPipeClientStream (PipeDirection direction, string pipeHandleAsString)
|
||||
: this (direction, ToSafePipeHandle (pipeHandleAsString))
|
||||
{
|
||||
}
|
||||
|
||||
public AnonymousPipeClientStream (PipeDirection direction, SafePipeHandle safePipeHandle)
|
||||
: base (direction, DefaultBufferSize)
|
||||
{
|
||||
/*
|
||||
if (IsWindows)
|
||||
impl = new Win32AnonymousPipeClient (this, safePipeHandle);
|
||||
else
|
||||
impl = new UnixAnonymousPipeClient (this, safePipeHandle);
|
||||
*/
|
||||
|
||||
#if MOBILE
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
InitializeHandle (safePipeHandle, false, false);
|
||||
IsConnected = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
~AnonymousPipeClientStream ()
|
||||
{
|
||||
// To be compatible with .net
|
||||
}
|
||||
|
||||
public override PipeTransmissionMode ReadMode {
|
||||
set {
|
||||
if (value == PipeTransmissionMode.Message)
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public override PipeTransmissionMode TransmissionMode {
|
||||
get { return PipeTransmissionMode.Byte; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,28 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Diagnostics;
|
||||
using System.Security;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
/// <summary>
|
||||
/// Anonymous pipe server stream
|
||||
/// </summary>
|
||||
public sealed partial class AnonymousPipeServerStream : PipeStream
|
||||
{
|
||||
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
|
||||
: base (PipeDirection.In, 0)
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
|
||||
// Creates the anonymous pipe.
|
||||
private unsafe void Create (PipeDirection direction, HandleInheritability inheritability, int bufferSize)
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
public sealed partial class AnonymousPipeServerStream
|
||||
{
|
||||
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
|
||||
: this (direction, inheritability, bufferSize)
|
||||
{
|
||||
if (pipeSecurity != null) {
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
public sealed partial class AnonymousPipeServerStream
|
||||
{
|
||||
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
|
||||
: base (direction, bufferSize)
|
||||
{
|
||||
if (direction == PipeDirection.InOut) {
|
||||
throw new NotSupportedException(SR.NotSupported_AnonymousPipeUnidirectional);
|
||||
}
|
||||
if (inheritability < HandleInheritability.None || inheritability > HandleInheritability.Inheritable) {
|
||||
throw new ArgumentOutOfRangeException(nameof(inheritability), SR.ArgumentOutOfRange_HandleInheritabilityNoneOrInheritable);
|
||||
}
|
||||
|
||||
Create(direction, inheritability, bufferSize, pipeSecurity);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,154 +0,0 @@
|
||||
//
|
||||
// AnonymousPipeServerStream.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2009 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.
|
||||
//
|
||||
|
||||
#if !BOOTSTRAP_BASIC
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[MonoTODO ("Anonymous pipes are not working even on win32, due to some access authorization issue")]
|
||||
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
public sealed class AnonymousPipeServerStream : PipeStream
|
||||
{
|
||||
public AnonymousPipeServerStream ()
|
||||
: this (PipeDirection.Out)
|
||||
{
|
||||
}
|
||||
|
||||
public AnonymousPipeServerStream (PipeDirection direction)
|
||||
: this (direction, HandleInheritability.None)
|
||||
{
|
||||
}
|
||||
|
||||
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability)
|
||||
: this (direction, inheritability, DefaultBufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize)
|
||||
#if MOBILE
|
||||
: base (direction, bufferSize)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#else
|
||||
: this (direction, inheritability, bufferSize, null)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
|
||||
: base (direction, bufferSize)
|
||||
{
|
||||
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, direction, inheritability, bufferSize, pipeSecurity);
|
||||
else
|
||||
impl = new UnixAnonymousPipeServer (this, direction, inheritability, bufferSize);
|
||||
|
||||
InitializeHandle (impl.Handle, false, false);
|
||||
IsConnected = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle)
|
||||
: base (direction, DefaultBufferSize)
|
||||
{
|
||||
if (serverSafePipeHandle == null)
|
||||
throw new ArgumentNullException ("serverSafePipeHandle");
|
||||
if (clientSafePipeHandle == null)
|
||||
throw new ArgumentNullException ("clientSafePipeHandle");
|
||||
|
||||
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
|
||||
impl = new UnixAnonymousPipeServer (this, serverSafePipeHandle, clientSafePipeHandle);
|
||||
|
||||
InitializeHandle (serverSafePipeHandle, true, false);
|
||||
IsConnected = true;
|
||||
|
||||
ClientSafePipeHandle = clientSafePipeHandle;
|
||||
#endif
|
||||
}
|
||||
|
||||
~AnonymousPipeServerStream ()
|
||||
{
|
||||
// To be compatible with .net
|
||||
}
|
||||
|
||||
IAnonymousPipeServer impl;
|
||||
|
||||
[MonoTODO]
|
||||
public SafePipeHandle ClientSafePipeHandle { get; private set; }
|
||||
|
||||
public override PipeTransmissionMode ReadMode {
|
||||
set {
|
||||
if (value == PipeTransmissionMode.Message)
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public override PipeTransmissionMode TransmissionMode {
|
||||
get { return PipeTransmissionMode.Byte; }
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public void DisposeLocalCopyOfClientHandle ()
|
||||
{
|
||||
impl.DisposeLocalCopyOfClientHandle ();
|
||||
}
|
||||
|
||||
public string GetClientHandleAsString ()
|
||||
{
|
||||
// We use int64 for safety.
|
||||
return impl.Handle.DangerousGetHandle ().ToInt64 ().ToString (NumberFormatInfo.InvariantInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,41 @@
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Sockets;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
/// <summary>
|
||||
/// Named pipe client. Use this to open the client end of a named pipes created with
|
||||
/// NamedPipeServerStream.
|
||||
/// </summary>
|
||||
public sealed partial class NamedPipeClientStream : PipeStream
|
||||
{
|
||||
public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
|
||||
: base (PipeDirection.In, 0)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
private bool TryConnect (int timeout, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public int NumberOfServerInstances
|
||||
{
|
||||
get {
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateRemotePipeUser (SafePipeHandle handle)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
public sealed partial class NamedPipeClientStream
|
||||
{
|
||||
public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
|
||||
: this (serverName, pipeName, (PipeDirection)(desiredAccessRights & (PipeAccessRights.ReadData | PipeAccessRights.WriteData)), options, impersonationLevel, inheritability)
|
||||
{
|
||||
if ((desiredAccessRights & ~(PipeAccessRights.FullControl | PipeAccessRights.AccessSystemSecurity)) != 0) {
|
||||
throw new ArgumentOutOfRangeException(nameof(desiredAccessRights), SR.ArgumentOutOfRange_InvalidPipeAccessRights);
|
||||
}
|
||||
if ((desiredAccessRights & ~(PipeAccessRights.ReadData | PipeAccessRights.WriteData)) != 0) {
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
public sealed partial class NamedPipeClientStream
|
||||
{
|
||||
int _access;
|
||||
|
||||
public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
|
||||
: this (serverName, pipeName, (PipeDirection)(desiredAccessRights & (PipeAccessRights.ReadData | PipeAccessRights.WriteData)), options, impersonationLevel, inheritability)
|
||||
{
|
||||
if ((desiredAccessRights & ~(PipeAccessRights.FullControl | PipeAccessRights.AccessSystemSecurity)) != 0) {
|
||||
throw new ArgumentOutOfRangeException(nameof(desiredAccessRights), SR.ArgumentOutOfRange_InvalidPipeAccessRights);
|
||||
}
|
||||
|
||||
// Referenced from CoreFX code
|
||||
_access = (int)desiredAccessRights;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,187 +0,0 @@
|
||||
//
|
||||
// NamedPipeClientStream.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2009 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.
|
||||
//
|
||||
|
||||
#if !BOOTSTRAP_BASIC
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[MonoTODO ("working only on win32 right now")]
|
||||
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
public sealed class NamedPipeClientStream : PipeStream
|
||||
{
|
||||
public NamedPipeClientStream (string pipeName)
|
||||
: this (".", pipeName)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeClientStream (string serverName, string pipeName)
|
||||
: this (serverName, pipeName, PipeDirection.InOut)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction)
|
||||
: this (serverName, pipeName, direction, PipeOptions.None)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options)
|
||||
: this (serverName, pipeName, direction, options, TokenImpersonationLevel.None)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel)
|
||||
: this (serverName, pipeName, direction, options, impersonationLevel, HandleInheritability.None)
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
|
||||
: base (ToDirection (desiredAccessRights), DefaultBufferSize)
|
||||
{
|
||||
if (impersonationLevel != TokenImpersonationLevel.None ||
|
||||
inheritability != HandleInheritability.None)
|
||||
throw ThrowACLException ();
|
||||
#if MOBILE
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
if (IsWindows)
|
||||
impl = new Win32NamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
|
||||
else
|
||||
impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
~NamedPipeClientStream () {
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
INamedPipeClient impl;
|
||||
#endif
|
||||
|
||||
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 Task ConnectAsync ()
|
||||
{
|
||||
return ConnectAsync (Timeout.Infinite, CancellationToken.None);
|
||||
}
|
||||
|
||||
public Task ConnectAsync (int timeout)
|
||||
{
|
||||
return ConnectAsync (timeout, CancellationToken.None);
|
||||
}
|
||||
|
||||
public Task ConnectAsync (CancellationToken cancellationToken)
|
||||
{
|
||||
return ConnectAsync (Timeout.Infinite, cancellationToken);
|
||||
}
|
||||
|
||||
public Task ConnectAsync (int timeout, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
protected override internal void CheckPipePropertyOperations () {
|
||||
base.CheckPipePropertyOperations();
|
||||
}
|
||||
|
||||
public int NumberOfServerInstances {
|
||||
get {
|
||||
CheckPipePropertyOperations ();
|
||||
#if MOBILE
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
return impl.NumberOfServerInstances;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,71 @@
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
public sealed partial class NamedPipeServerStream : PipeStream
|
||||
{
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity)
|
||||
: base (PipeDirection.In, 0)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability)
|
||||
: base (PipeDirection.In, 0)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights)
|
||||
: base (PipeDirection.In, 0)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
|
||||
public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
private void Create (string pipeName, PipeDirection direction, int maxNumberOfServerInstances,
|
||||
PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize,
|
||||
HandleInheritability inheritability)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public void WaitForConnection ()
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public Task WaitForConnectionAsync (CancellationToken cancellationToken)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
private void HandleAcceptedSocket (Socket acceptedSocket)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public void Disconnect ()
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
|
||||
public string GetImpersonationUserName ()
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Permissions;
|
||||
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
public sealed partial class NamedPipeServerStream
|
||||
{
|
||||
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, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability)
|
||||
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, inheritability, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights)
|
||||
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, inheritability)
|
||||
{
|
||||
if (additionalAccessRights != 0 || pipeSecurity != null) {
|
||||
throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
public sealed partial class NamedPipeServerStream
|
||||
{
|
||||
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, HandleInheritability.None)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability)
|
||||
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, inheritability)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights)
|
||||
: base (direction, transmissionMode, outBufferSize)
|
||||
{
|
||||
if (pipeName == null) {
|
||||
throw new ArgumentNullException (nameof(pipeName));
|
||||
}
|
||||
if (pipeName.Length == 0){
|
||||
throw new ArgumentException (SR.Argument_NeedNonemptyPipeName);
|
||||
}
|
||||
if ((options & ~(PipeOptions.WriteThrough | PipeOptions.Asynchronous)) != 0) {
|
||||
throw new ArgumentOutOfRangeException (nameof(options), SR.ArgumentOutOfRange_OptionsInvalid);
|
||||
}
|
||||
if (inBufferSize < 0) {
|
||||
throw new ArgumentOutOfRangeException (nameof(inBufferSize), SR.ArgumentOutOfRange_NeedNonNegNum);
|
||||
}
|
||||
if ((maxNumberOfServerInstances < 1 || maxNumberOfServerInstances > 254) && (maxNumberOfServerInstances != MaxAllowedServerInstances)) {
|
||||
throw new ArgumentOutOfRangeException (nameof(maxNumberOfServerInstances), SR.ArgumentOutOfRange_MaxNumServerInstances);
|
||||
}
|
||||
if (inheritability < HandleInheritability.None || inheritability > HandleInheritability.Inheritable) {
|
||||
throw new ArgumentOutOfRangeException (nameof(inheritability), SR.ArgumentOutOfRange_HandleInheritabilityNoneOrInheritable);
|
||||
}
|
||||
if ((additionalAccessRights & ~(PipeAccessRights.ChangePermissions | PipeAccessRights.TakeOwnership | PipeAccessRights.AccessSystemSecurity)) != 0) {
|
||||
throw new ArgumentOutOfRangeException (nameof(additionalAccessRights), SR.ArgumentOutOfRange_AdditionalAccessLimited);
|
||||
}
|
||||
|
||||
Create (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, inheritability, additionalAccessRights);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
//
|
||||
// NamedPipeServerStream.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2009 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.
|
||||
//
|
||||
|
||||
#if !BOOTSTRAP_BASIC
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[MonoTODO ("working only on win32 right now")]
|
||||
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
public sealed class NamedPipeServerStream : PipeStream
|
||||
{
|
||||
public const int MaxAllowedServerInstances = -1;
|
||||
|
||||
public NamedPipeServerStream (string pipeName)
|
||||
: this (pipeName, PipeDirection.InOut)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction)
|
||||
: this (pipeName, direction, 1)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances)
|
||||
: this (pipeName, direction, maxNumberOfServerInstances, PipeTransmissionMode.Byte)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode)
|
||||
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, PipeOptions.None)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options)
|
||||
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, DefaultBufferSize, DefaultBufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability)
|
||||
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, inheritability, PipeAccessRights.ReadData | PipeAccessRights.WriteData)
|
||||
{
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights)
|
||||
: base (direction, transmissionMode, outBufferSize)
|
||||
{
|
||||
#if MOBILE
|
||||
throw new NotImplementedException ();
|
||||
#else
|
||||
var rights = ToAccessRights (direction) | additionalAccessRights;
|
||||
// FIXME: reject some rights declarations (for ACL).
|
||||
|
||||
if (IsWindows)
|
||||
impl = new Win32NamedPipeServer (this, pipeName, maxNumberOfServerInstances, transmissionMode,
|
||||
rights, options, inBufferSize, outBufferSize,
|
||||
pipeSecurity, inheritability);
|
||||
else
|
||||
impl = new UnixNamedPipeServer (this, pipeName, maxNumberOfServerInstances, transmissionMode,
|
||||
rights, options, inBufferSize, outBufferSize, inheritability);
|
||||
|
||||
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;
|
||||
|
||||
public void Disconnect ()
|
||||
{
|
||||
impl.Disconnect ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
|
||||
public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void WaitForConnection ()
|
||||
{
|
||||
impl.WaitForConnection ();
|
||||
IsConnected = true;
|
||||
}
|
||||
|
||||
public Task WaitForConnectionAsync ()
|
||||
{
|
||||
return WaitForConnectionAsync (CancellationToken.None);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public Task WaitForConnectionAsync (CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
|
||||
public string GetImpersonationUserName ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
// async operations
|
||||
|
||||
Action wait_connect_delegate;
|
||||
|
||||
[HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)]
|
||||
public IAsyncResult BeginWaitForConnection (AsyncCallback callback, object state)
|
||||
{
|
||||
if (wait_connect_delegate == null)
|
||||
wait_connect_delegate = new Action (WaitForConnection);
|
||||
return wait_connect_delegate.BeginInvoke (callback, state);
|
||||
}
|
||||
|
||||
public void EndWaitForConnection (IAsyncResult asyncResult)
|
||||
{
|
||||
wait_connect_delegate.EndInvoke (asyncResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,55 +0,0 @@
|
||||
//
|
||||
// PipeAccessRights.cs
|
||||
//
|
||||
// Authors:
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright 2011 Xamarin Inc (http://www.xamarin.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.
|
||||
//
|
||||
//
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[Flags]
|
||||
public enum PipeAccessRights
|
||||
{
|
||||
ReadData = 1,
|
||||
WriteData = 1 << 1,
|
||||
CreateNewInstance = 1 << 2,
|
||||
ReadExtendedAttributes = 1 << 3,
|
||||
WriteExtendedAttributes = 1 << 4,
|
||||
ReadAttributes = 1 << 7,
|
||||
WriteAttributes = 1 << 8,
|
||||
|
||||
Delete = 1 << 16,
|
||||
ReadPermissions = 1 << 17,
|
||||
ChangePermissions = 1 << 18,
|
||||
TakeOwnership = 1 << 19,
|
||||
Synchronize = 1 << 20,
|
||||
|
||||
AccessSystemSecurity = 1 << 24,
|
||||
|
||||
Read = ReadData | ReadAttributes | ReadExtendedAttributes | ReadPermissions,
|
||||
Write = WriteData | WriteAttributes | WriteExtendedAttributes,
|
||||
ReadWrite = Read | Write,
|
||||
FullControl = ReadWrite | CreateNewInstance | Delete | ChangePermissions | TakeOwnership | Synchronize
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
//
|
||||
// PipeAccessRule.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2009 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.IO;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
public sealed class PipeAccessRule : AccessRule
|
||||
{
|
||||
public PipeAccessRule (IdentityReference identity, PipeAccessRights rights, AccessControlType type)
|
||||
: base (identity, (int)rights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
public PipeAccessRule (string identity, PipeAccessRights rights, AccessControlType type)
|
||||
: this (new NTAccount (identity), rights, type)
|
||||
{
|
||||
}
|
||||
|
||||
public PipeAccessRights PipeAccessRights {
|
||||
get { return (PipeAccessRights)AccessMask; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
//
|
||||
// PipeAuditRule.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2009 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.IO;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
public sealed class PipeAuditRule : AuditRule
|
||||
{
|
||||
public PipeAuditRule (IdentityReference identity, PipeAccessRights rights, AuditFlags flags)
|
||||
: base (identity, (int)rights, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
}
|
||||
|
||||
public PipeAuditRule (string identity, PipeAccessRights rights, AuditFlags flags)
|
||||
: this (new NTAccount (identity), rights, flags)
|
||||
{
|
||||
}
|
||||
|
||||
public PipeAccessRights PipeAccessRights {
|
||||
get { return (PipeAccessRights)AccessMask; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[Serializable]
|
||||
public enum PipeDirection
|
||||
{
|
||||
In = 1,
|
||||
Out = 2,
|
||||
InOut = 3
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
// Common interfaces
|
||||
|
||||
interface IPipe
|
||||
{
|
||||
SafePipeHandle Handle { get; }
|
||||
void WaitForPipeDrain ();
|
||||
}
|
||||
|
||||
interface IAnonymousPipeClient : IPipe
|
||||
{
|
||||
}
|
||||
|
||||
interface IAnonymousPipeServer : IPipe
|
||||
{
|
||||
SafePipeHandle ClientHandle { get; }
|
||||
void DisposeLocalCopyOfClientHandle ();
|
||||
}
|
||||
|
||||
interface INamedPipeClient : IPipe
|
||||
{
|
||||
void Connect ();
|
||||
void Connect (int timeout);
|
||||
int NumberOfServerInstances { get; }
|
||||
bool IsAsync { get; }
|
||||
}
|
||||
|
||||
interface INamedPipeServer : IPipe
|
||||
{
|
||||
void Disconnect ();
|
||||
void WaitForConnection ();
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
//
|
||||
// PipeAccessRights.cs
|
||||
//
|
||||
// Authors:
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright 2011 Xamarin Inc (http://www.xamarin.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.
|
||||
//
|
||||
//
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[Flags]
|
||||
public enum PipeOptions
|
||||
{
|
||||
None = 0,
|
||||
WriteThrough = int.MinValue,
|
||||
Asynchronous = 1 << 30
|
||||
}
|
||||
}
|
@ -1,153 +0,0 @@
|
||||
//
|
||||
// PipeSecurity.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
// James Bellinger <jfb@zer7.com>
|
||||
//
|
||||
// Copyright (C) 2009 Novell, Inc. http://www.novell.com
|
||||
// Copyright (C) 2012 James Bellinger
|
||||
//
|
||||
// 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.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
|
||||
namespace System.IO.Pipes
|
||||
{
|
||||
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)]
|
||||
public class PipeSecurity : NativeObjectSecurity
|
||||
{
|
||||
public PipeSecurity ()
|
||||
: base (false, ResourceType.FileObject)
|
||||
{
|
||||
}
|
||||
|
||||
internal PipeSecurity (SafeHandle handle, AccessControlSections includeSections)
|
||||
: base (false, ResourceType.FileObject, handle, includeSections)
|
||||
{
|
||||
}
|
||||
|
||||
public override Type AccessRightType {
|
||||
get { return typeof (PipeAccessRights); }
|
||||
}
|
||||
|
||||
public override Type AccessRuleType {
|
||||
get { return typeof (PipeAccessRule); }
|
||||
}
|
||||
|
||||
public override Type AuditRuleType {
|
||||
get { return typeof (PipeAuditRule); }
|
||||
}
|
||||
|
||||
public override AccessRule AccessRuleFactory (IdentityReference identityReference,
|
||||
int accessMask, bool isInherited,
|
||||
InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags,
|
||||
AccessControlType type)
|
||||
{
|
||||
return new PipeAccessRule (identityReference, (PipeAccessRights)accessMask, type);
|
||||
}
|
||||
|
||||
public void AddAccessRule (PipeAccessRule rule)
|
||||
{
|
||||
AddAccessRule ((AccessRule)rule);
|
||||
}
|
||||
|
||||
public void AddAuditRule (PipeAuditRule rule)
|
||||
{
|
||||
AddAuditRule ((AuditRule) rule);
|
||||
}
|
||||
|
||||
public override sealed AuditRule AuditRuleFactory (IdentityReference identityReference,
|
||||
int accessMask, bool isInherited,
|
||||
InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags,
|
||||
AuditFlags flags)
|
||||
{
|
||||
return new PipeAuditRule (identityReference, (PipeAccessRights)accessMask, flags);
|
||||
}
|
||||
|
||||
[SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
|
||||
protected internal void Persist (SafeHandle handle)
|
||||
{
|
||||
WriteLock();
|
||||
try {
|
||||
Persist (handle, AccessControlSectionsModified, null);
|
||||
} finally {
|
||||
WriteUnlock ();
|
||||
}
|
||||
}
|
||||
|
||||
[SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
|
||||
protected internal void Persist (string name)
|
||||
{
|
||||
WriteLock();
|
||||
try {
|
||||
Persist (name, AccessControlSectionsModified, null);
|
||||
} finally {
|
||||
WriteUnlock ();
|
||||
}
|
||||
}
|
||||
|
||||
public bool RemoveAccessRule (PipeAccessRule rule)
|
||||
{
|
||||
return RemoveAccessRule ((AccessRule)rule);
|
||||
}
|
||||
|
||||
public void RemoveAccessRuleSpecific (PipeAccessRule rule)
|
||||
{
|
||||
RemoveAccessRuleSpecific ((AccessRule)rule);
|
||||
}
|
||||
|
||||
public bool RemoveAuditRule (PipeAuditRule rule)
|
||||
{
|
||||
return RemoveAuditRule ((AuditRule)rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleAll (PipeAuditRule rule)
|
||||
{
|
||||
RemoveAuditRuleAll ((AuditRule)rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleSpecific (PipeAuditRule rule)
|
||||
{
|
||||
RemoveAuditRuleSpecific ((AuditRule)rule);
|
||||
}
|
||||
|
||||
public void ResetAccessRule (PipeAccessRule rule)
|
||||
{
|
||||
ResetAccessRule ((AccessRule)rule);
|
||||
}
|
||||
|
||||
public void SetAccessRule (PipeAccessRule rule)
|
||||
{
|
||||
SetAccessRule ((AccessRule)rule);
|
||||
}
|
||||
|
||||
public void SetAuditRule (PipeAuditRule rule)
|
||||
{
|
||||
SetAuditRule ((AuditRule)rule);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user