Merge pull request #225 from mistoll/master
[mono.git] / mcs / class / System.Runtime.Remoting / System.Runtime.Remoting.Channels.Ipc / IpcClientChannel.cs
1 //\r
2 // System.Runtime.Remoting.Channels.Ipc.IpcClientChannel.cs\r
3 //\r
4 // Author: Robert Jordan (robertj@gmx.net)\r
5 //\r
6 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)\r
7 //\r
8 //\r
9 // Permission is hereby granted, free of charge, to any person obtaining\r
10 // a copy of this software and associated documentation files (the\r
11 // "Software"), to deal in the Software without restriction, including\r
12 // without limitation the rights to use, copy, modify, merge, publish,\r
13 // distribute, sublicense, and/or sell copies of the Software, and to\r
14 // permit persons to whom the Software is furnished to do so, subject to\r
15 // the following conditions:\r
16 // \r
17 // The above copyright notice and this permission notice shall be\r
18 // included in all copies or substantial portions of the Software.\r
19 // \r
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
27 //\r
28 \r
29 #if NET_2_0\r
30 \r
31 using System;\r
32 using System.Collections;\r
33 using System.Runtime.Remoting;\r
34 using System.Runtime.Remoting.Messaging;\r
35 \r
36 using Unix  = System.Runtime.Remoting.Channels.Ipc.Unix;\r
37 using Win32 = System.Runtime.Remoting.Channels.Ipc.Win32;\r
38 \r
39 namespace System.Runtime.Remoting.Channels.Ipc\r
40 {\r
41         public class IpcClientChannel : IChannelSender, IChannel\r
42         {\r
43                 IChannelSender _innerChannel;\r
44 \r
45                 public IpcClientChannel ()\r
46                 {\r
47                         if (IpcChannel.IsUnix)\r
48                                 _innerChannel = new Unix.IpcClientChannel ();\r
49                         else\r
50                                 _innerChannel = new Win32.IpcClientChannel ();\r
51                 }\r
52 \r
53                 public IpcClientChannel (IDictionary properties,\r
54                                          IClientChannelSinkProvider sinkProvider)\r
55                 {\r
56                         if (IpcChannel.IsUnix)\r
57                                 _innerChannel = new Unix.IpcClientChannel (properties, sinkProvider);\r
58                         else\r
59                                 _innerChannel = new Win32.IpcClientChannel (properties, sinkProvider);\r
60                 }\r
61 \r
62                 public IpcClientChannel (string name,\r
63                                          IClientChannelSinkProvider sinkProvider)\r
64                 {\r
65                         if (IpcChannel.IsUnix)\r
66                                 _innerChannel = new Unix.IpcClientChannel (name, sinkProvider);\r
67                         else\r
68                                 _innerChannel = new Win32.IpcClientChannel (name, sinkProvider);\r
69                 }\r
70 \r
71                 public string ChannelName\r
72                 {\r
73                         get { return ((IChannel)_innerChannel).ChannelName; }\r
74                 }\r
75 \r
76                 public int ChannelPriority\r
77                 {\r
78                         get { return ((IChannel)_innerChannel).ChannelPriority; }\r
79                 }\r
80 \r
81                 public string Parse (string url, out string objectURI)\r
82                 {\r
83                         return ((IChannel)_innerChannel).Parse (url, out objectURI);\r
84                 }\r
85 \r
86                 public virtual IMessageSink CreateMessageSink (string url,\r
87                                                        object remoteChannelData,\r
88                                                        out string objectURI)\r
89                 {\r
90                         return _innerChannel.CreateMessageSink (url, remoteChannelData, out objectURI);\r
91                 }\r
92     }\r
93 }\r
94 \r
95 #endif\r