2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.ServiceModel / System.ServiceModel / NetPeerTcpBinding.cs
bloba59ef1515b73a1bfaf1a50ef53144868692b9daf
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/)
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.
30 using System;
31 using System.Collections.Generic;
32 using System.Net;
33 using System.Net.Security;
34 using System.ServiceModel.Channels;
35 using System.ServiceModel.Description;
36 using System.ServiceModel.PeerResolvers;
37 using System.Text;
38 using System.Xml;
40 namespace System.ServiceModel
42 public class NetPeerTcpBinding : Binding, IBindingRuntimePreferences
44 // We don't support PNRP
45 public static bool IsPnrpAvailable {
46 get { return false; }
49 XmlDictionaryReaderQuotas reader_quotas = new XmlDictionaryReaderQuotas ();
50 PeerResolverSettings resolver = new PeerResolverSettings ();
51 PeerSecuritySettings security = new PeerSecuritySettings ();
52 PeerTransportBindingElement transport = new PeerTransportBindingElement ();
54 public NetPeerTcpBinding ()
58 [MonoTODO]
59 public NetPeerTcpBinding (string configurationName)
61 throw new NotImplementedException ();
64 [MonoTODO]
65 public IPAddress ListenIPAddress {
66 get { return transport.ListenIPAddress; }
67 set { transport.ListenIPAddress = value; }
70 [MonoTODO]
71 public new long MaxBufferPoolSize {
72 get { return transport.MaxBufferPoolSize; }
73 set { transport.MaxBufferPoolSize = value; }
76 [MonoTODO]
77 public long MaxReceivedMessageSize {
78 get { return transport.MaxReceivedMessageSize; }
79 set { transport.MaxReceivedMessageSize = value; }
82 public int Port {
83 get { return transport.Port; }
84 set { transport.Port = value; }
87 public PeerResolverSettings Resolver {
88 get { return resolver; }
91 public XmlDictionaryReaderQuotas ReaderQuotas {
92 get { return reader_quotas; }
93 set {
94 if (value == null)
95 throw new ArgumentNullException ("value");
96 reader_quotas = value;
100 public override string Scheme {
101 get { return "net.p2p"; }
104 public PeerSecuritySettings Security {
105 get { return security; }
108 public EnvelopeVersion EnvelopeVersion {
109 get { return EnvelopeVersion.Soap12; }
112 public override BindingElementCollection
113 CreateBindingElements ()
115 var mbe = new BinaryMessageEncodingBindingElement ();
116 if (ReaderQuotas != null)
117 ReaderQuotas.CopyTo (mbe.ReaderQuotas);
119 var prbe = Resolver.CreateBinding ();
121 return new BindingElementCollection (new BindingElement [] { mbe, prbe, transport.Clone () });
124 // explicit interface implementations
126 bool IBindingRuntimePreferences.ReceiveSynchronously {
127 get { return false; }