2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.ServiceModel / System.ServiceModel.Configuration / PeerTransportElement.cs
blob7eab194611fe0091de0f6d6f591656c559f56ad5
1 //
2 // PeerTransportElement.cs
3 //
4 // Author:
5 // Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2006 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.
29 using System;
30 using System.Collections;
31 using System.Collections.Generic;
32 using System.Collections.ObjectModel;
33 using System.ComponentModel;
34 using System.Configuration;
35 using System.Net;
36 using System.Net.Security;
37 using System.Reflection;
38 using System.Security.Cryptography.X509Certificates;
39 using System.Security.Principal;
40 using System.IdentityModel.Claims;
41 using System.IdentityModel.Policy;
42 using System.IdentityModel.Tokens;
43 using System.ServiceModel;
44 using System.ServiceModel.Channels;
45 using System.ServiceModel.Description;
46 using System.ServiceModel.Diagnostics;
47 using System.ServiceModel.Dispatcher;
48 using System.ServiceModel.MsmqIntegration;
49 using System.ServiceModel.PeerResolvers;
50 using System.ServiceModel.Security;
51 using System.Runtime.Serialization;
52 using System.Text;
53 using System.Xml;
55 namespace System.ServiceModel.Configuration
57 public class PeerTransportElement
58 : BindingElementExtensionElement
60 ConfigurationPropertyCollection _properties;
62 public PeerTransportElement () {
66 // Properties
68 public override Type BindingElementType {
69 get { return typeof (PeerTransportBindingElement); }
72 [TypeConverter (typeof (IPAddressConverter))]
73 [ConfigurationProperty ("listenIPAddress",
74 Options = ConfigurationPropertyOptions.None,
75 DefaultValue = null)]
76 public IPAddress ListenIPAddress {
77 get { return (IPAddress) base ["listenIPAddress"]; }
78 set { base ["listenIPAddress"] = value; }
81 [LongValidator (MinValue = 1,
82 MaxValue = 9223372036854775807,
83 ExcludeRange = false)]
84 [ConfigurationProperty ("maxBufferPoolSize",
85 Options = ConfigurationPropertyOptions.None,
86 DefaultValue = "524288")]
87 public long MaxBufferPoolSize {
88 get { return (long) base ["maxBufferPoolSize"]; }
89 set { base ["maxBufferPoolSize"] = value; }
92 [LongValidator (MinValue = 1,
93 MaxValue = 9223372036854775807,
94 ExcludeRange = false)]
95 [ConfigurationProperty ("maxReceivedMessageSize",
96 Options = ConfigurationPropertyOptions.None,
97 DefaultValue = "65536")]
98 public long MaxReceivedMessageSize {
99 get { return (long) base ["maxReceivedMessageSize"]; }
100 set { base ["maxReceivedMessageSize"] = value; }
103 [ConfigurationProperty ("port",
104 Options = ConfigurationPropertyOptions.None,
105 DefaultValue = "0")]
106 [IntegerValidator (MinValue = 0,
107 MaxValue = 65535,
108 ExcludeRange = false)]
109 public int Port {
110 get { return (int) base ["port"]; }
111 set { base ["port"] = value; }
114 protected override ConfigurationPropertyCollection Properties {
115 get {
116 if (_properties == null) {
117 _properties = base.Properties;
118 _properties.Add (new ConfigurationProperty ("listenIPAddress", typeof (IPAddress), null, new IPAddressConverter (), null, ConfigurationPropertyOptions.None));
119 _properties.Add (new ConfigurationProperty ("maxBufferPoolSize", typeof (long), "524288", null, new LongValidator (1, 9223372036854775807, false), ConfigurationPropertyOptions.None));
120 _properties.Add (new ConfigurationProperty ("maxReceivedMessageSize", typeof (long), "65536", null, new LongValidator (1, 9223372036854775807, false), ConfigurationPropertyOptions.None));
121 _properties.Add (new ConfigurationProperty ("port", typeof (int), "0", null, new IntegerValidator (0, 65535, false), ConfigurationPropertyOptions.None));
122 _properties.Add (new ConfigurationProperty ("security", typeof (PeerSecurityElement), null, null/* FIXME: get converter for PeerSecurityElement*/, null, ConfigurationPropertyOptions.None));
124 return _properties;
128 [ConfigurationProperty ("security",
129 Options = ConfigurationPropertyOptions.None)]
130 public PeerSecurityElement Security {
131 get { return (PeerSecurityElement) base ["security"]; }
134 [MonoTODO]
135 protected internal override BindingElement CreateBindingElement () {
136 throw new NotImplementedException ();