Adding System.IO.Pipes implementation.
[mono.git] / mcs / class / System.Core / System.IO.Pipes / PipeUnix.cs
1 //
2 // PipeUnix.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2009 Novell, Inc.  http://www.novell.com
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 using System;
29 using System.ComponentModel;
30 using System.IO;
31 using System.Linq;
32 using System.Runtime.InteropServices;
33 using System.Security.AccessControl;
34 using System.Security.Permissions;
35 using System.Security.Principal;
36 using System.Text;
37 using Microsoft.Win32;
38 using Microsoft.Win32.SafeHandles;
39
40 namespace System.IO.Pipes
41 {
42         abstract class UnixAnonymousPipe : IPipe
43         {
44                 protected UnixAnonymousPipe ()
45                 {
46                 }
47
48                 public abstract SafePipeHandle Handle { get; }
49
50                 public void WaitForPipeDrain ()
51                 {
52                         throw new NotImplementedException ();
53                 }
54         }
55
56         class UnixAnonymousPipeClient : UnixAnonymousPipe, IAnonymousPipeClient
57         {
58                 // AnonymousPipeClientStream owner;
59
60                 public UnixAnonymousPipeClient (AnonymousPipeClientStream owner, SafePipeHandle handle)
61                 {
62                         // this.owner = owner;
63
64                         this.handle = handle;
65                 }
66
67                 SafePipeHandle handle;
68
69                 public override SafePipeHandle Handle {
70                         get { return handle; }
71                 }
72         }
73
74         class UnixAnonymousPipeServer : UnixAnonymousPipe, IAnonymousPipeServer
75         {
76                 // AnonymousPipeServerStream owner;
77
78                 public UnixAnonymousPipeServer (AnonymousPipeServerStream owner, PipeDirection direction, HandleInheritability inheritability, int bufferSize)
79                 {
80                         // this.owner = owner;
81
82                         throw new NotImplementedException ();
83                 }
84
85                 public UnixAnonymousPipeServer (AnonymousPipeServerStream owner, SafePipeHandle serverHandle, SafePipeHandle clientHandle)
86                 {
87                         // this.owner = owner;
88
89                         this.server_handle = serverHandle;
90                         this.client_handle = clientHandle;
91
92                         throw new NotImplementedException ();
93                 }
94
95                 SafePipeHandle server_handle, client_handle;
96
97                 public override SafePipeHandle Handle {
98                         get { return server_handle; }
99                 }
100
101                 public SafePipeHandle ClientHandle {
102                         get { return client_handle; }
103                 }
104
105                 public void DisposeLocalCopyOfClientHandle ()
106                 {
107                         throw new NotImplementedException ();
108                 }
109         }
110
111         abstract class UnixNamedPipe : IPipe
112         {
113                 public abstract SafePipeHandle Handle { get; }
114
115                 public void WaitForPipeDrain ()
116                 {
117                         throw new NotImplementedException ();
118                 }
119         }
120
121         class UnixNamedPipeClient : UnixNamedPipe, INamedPipeClient
122         {
123                 // .ctor with existing handle
124                 public UnixNamedPipeClient (NamedPipeClientStream owner, SafePipeHandle safePipeHandle)
125                 {
126                         throw new NotImplementedException ();
127                 }
128
129                 // .ctor without handle - create new
130                 public UnixNamedPipeClient (NamedPipeClientStream owner, string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, HandleInheritability inheritability)
131                 {
132                         throw new NotImplementedException ();
133                 }
134
135                 bool is_async;
136                 SafePipeHandle handle;
137
138                 public override SafePipeHandle Handle {
139                         get { return handle; }
140                 }
141
142                 public void Connect ()
143                 {
144                         throw new NotImplementedException ();
145                 }
146
147                 public void Connect (int timeout)
148                 {
149                         throw new NotImplementedException ();
150                 }
151
152                 public bool IsAsync {
153                         get { return is_async; }
154                 }
155
156                 public int NumberOfServerInstances {
157                         get { throw new NotImplementedException (); }
158                 }
159         }
160
161         class UnixNamedPipeServer : UnixNamedPipe, INamedPipeServer
162         {
163                 //NamedPipeServerStream owner;
164
165                 // .ctor with existing handle
166                 public UnixNamedPipeServer (NamedPipeServerStream owner, SafePipeHandle safePipeHandle)
167                 {
168                         this.handle = safePipeHandle;
169                         //this.owner = owner;
170                 }
171
172                 // .ctor without handle - create new
173                 public UnixNamedPipeServer (NamedPipeServerStream owner, string pipeName, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeAccessRights rights, PipeOptions options, int inBufferSize, int outBufferSize, HandleInheritability inheritability)
174                 {
175                         throw new NotImplementedException ();
176                 }
177
178                 SafePipeHandle handle;
179
180                 public override SafePipeHandle Handle {
181                         get { return handle; }
182                 }
183
184                 public void Disconnect ()
185                 {
186                         throw new NotImplementedException ();
187                 }
188
189                 public void WaitForConnection ()
190                 {
191                         throw new NotImplementedException ();
192                 }
193         }
194 }