2008-11-01 Marek Habersack <mhabersack@novell.com>
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel / NetPeerTcpBinding.cs
1 //
2 // NetPeerTcpBinding.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //      Marcos Cobena (marcoscobena@gmail.com)
7 //
8 // Copyright (C) 2005 Novell, Inc.  http://www.novell.com
9 // Copyright 2007 Marcos Cobena (http://www.youcannoteatbits.org/)
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 using System;
31 using System.Collections.Generic;
32 using System.Net.Security;
33 using System.ServiceModel.Channels;
34 using System.ServiceModel.Description;
35 using System.ServiceModel.PeerResolvers;
36 using System.Text;
37 using System.Xml;
38
39 namespace System.ServiceModel
40 {
41         public class NetPeerTcpBinding : Binding,
42                 IBindingDeliveryCapabilities, IBindingMulticastCapabilities,
43                 ISecurityCapabilities, IBindingRuntimePreferences
44         {
45                 string listen_ip_address;
46                 long max_buffer_pool_size = 0x80000;
47                 long max_recv_message_size = 0x10000;
48                 bool msg_auth;
49                 int port;
50                 XmlDictionaryReaderQuotas reader_quotas;
51 //              PeerResolver resolver = new PeerResolverImpl ();
52                 PeerResolverSettings resolver = new PeerResolverSettings ();
53                 PeerSecuritySettings security = new PeerSecuritySettings ();
54
55                 public NetPeerTcpBinding ()
56                 {
57                 }
58
59                 [MonoTODO]
60                 public NetPeerTcpBinding (string configurationName)
61                 {
62                         throw new NotImplementedException ();
63                 }
64
65                 public string ListenIPAddress {
66                         get { return listen_ip_address; }
67                         set { listen_ip_address = value; }
68                 }
69
70                 public long MaxBufferPoolSize {
71                         get { return max_buffer_pool_size; }
72                         set { max_buffer_pool_size = value; }
73                 }
74
75                 public bool MessageAuthentication {
76                         get { return msg_auth; }
77                         set { msg_auth = value; }
78                 }
79
80                 public long MaxReceivedMessageSize {
81                         get { return max_recv_message_size; }
82                         set { max_recv_message_size = value; }
83                 }
84
85                 [MonoTODO]
86                 public int Port {
87                         get { return port; }
88                         set { port = value; }
89                 }
90
91                 [MonoTODO]
92                 public PeerResolverSettings Resolver {
93                         get { return resolver; }
94                         set { resolver = value; }
95                 }
96
97                 public XmlDictionaryReaderQuotas ReaderQuotas {
98                         get { return reader_quotas; }
99                         set { reader_quotas = value; }
100                 }
101
102                 public override string Scheme {
103                         get { return "net.p2p"; }
104                 }
105                 
106                 public PeerSecuritySettings Security {
107                         get { return security; }
108                 }
109
110                 public EnvelopeVersion SoapVersion {
111                         get { return EnvelopeVersion.Soap12; }
112                 }
113
114                 public override BindingElementCollection
115                         CreateBindingElements ()
116                 {
117                         BinaryMessageEncodingBindingElement mbe = 
118                                 new BinaryMessageEncodingBindingElement ();
119                         ReaderQuotas.CopyTo (mbe.ReaderQuotas);
120
121                         PeerTransportBindingElement tbe =
122                                 new PeerTransportBindingElement ();
123                         tbe.ListenIPAddress = ListenIPAddress;
124                         tbe.MaxBufferPoolSize = MaxBufferPoolSize;
125                         tbe.MaxReceivedMessageSize = MaxReceivedMessageSize;
126                         tbe.MessageAuthentication = MessageAuthentication;
127
128                         return new BindingElementCollection (new BindingElement [] { mbe, tbe });
129                 }
130
131                 // explicit interface implementations
132
133                 [MonoTODO]
134                 bool IBindingDeliveryCapabilities.AssuresOrderedDelivery {
135                         get { throw new NotImplementedException (); }
136                 }
137
138                 [MonoTODO]
139                 bool IBindingDeliveryCapabilities.QueuedDelivery {
140                         get { throw new NotImplementedException (); }
141                 }
142
143                 [MonoTODO]
144                 bool IBindingRuntimePreferences.ReceiveSynchronously {
145                         get { throw new NotImplementedException (); }
146                 }
147
148                 bool IBindingMulticastCapabilities.IsMulticast {
149                         get { throw new NotImplementedException (); }
150                 }
151
152                 [MonoTODO]
153                 ProtectionLevel ISecurityCapabilities.SupportedRequestProtectionLevel {
154                         get { throw new NotImplementedException (); }
155                 }
156
157                 [MonoTODO]
158                 ProtectionLevel ISecurityCapabilities.SupportedResponseProtectionLevel {
159                         get { throw new NotImplementedException (); }
160                 }
161
162                 [MonoTODO]
163                 bool ISecurityCapabilities.SupportsClientAuthentication {
164                         get { throw new NotImplementedException (); }
165                 }
166
167                 [MonoTODO]
168                 bool ISecurityCapabilities.SupportsClientWindowsIdentity {
169                         get { throw new NotImplementedException (); }
170                 }
171
172                 [MonoTODO]
173                 bool ISecurityCapabilities.SupportsServerAuthentication {
174                         get { throw new NotImplementedException (); }
175                 }
176         }
177 }