4 // Author: Atsushi Enomoto <atsushi@ximian.com>
6 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.ServiceModel.Channels;
30 using System.ServiceModel.Description;
33 namespace System.ServiceModel
35 public class NetMsmqBinding : MsmqBindingBase
37 NetMsmqSecurity security;
39 long max_buffer_pool_size = 0x80000;
40 QueueTransferProtocol queue_tr_protocol;
41 XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas ();
42 EnvelopeVersion envelope_version = EnvelopeVersion.Soap12;
44 public NetMsmqBinding ()
45 : this (NetMsmqSecurityMode.None)
49 public NetMsmqBinding (NetMsmqSecurityMode securityMode)
51 security = new NetMsmqSecurity (securityMode);
55 public NetMsmqBinding (string configurationName)
57 throw new NotImplementedException ();
60 public NetMsmqSecurity Security {
61 get { return security; }
64 public EnvelopeVersion EnvelopeVersion {
65 get { return envelope_version; }
68 public long MaxBufferPoolSize {
69 get { return max_buffer_pool_size; }
70 set { max_buffer_pool_size = value; }
73 public QueueTransferProtocol QueueTransferProtocol {
74 get { return queue_tr_protocol; }
75 set { queue_tr_protocol = value; }
78 public XmlDictionaryReaderQuotas ReaderQuotas {
79 get { return quotas; }
80 set { quotas = value; }
83 public bool UseActiveDirectory {
84 get { return use_ad; }
85 set { use_ad = value; }
88 public override BindingElementCollection CreateBindingElements ()
90 BinaryMessageEncodingBindingElement be =
91 new BinaryMessageEncodingBindingElement ();
92 quotas.CopyTo (be.ReaderQuotas);
93 MsmqTransportBindingElement te =
94 new MsmqTransportBindingElement ();
95 te.MaxPoolSize = (int) MaxBufferPoolSize;
96 te.QueueTransferProtocol = QueueTransferProtocol;
97 te.UseActiveDirectory = UseActiveDirectory;
98 te.CustomDeadLetterQueue = CustomDeadLetterQueue;
99 te.DeadLetterQueue = DeadLetterQueue;
100 te.Durable = Durable;
101 te.ExactlyOnce = ExactlyOnce;
102 te.MaxReceivedMessageSize = MaxReceivedMessageSize;
103 te.MaxRetryCycles = MaxRetryCycles;
104 te.MsmqTransportSecurity.MsmqAuthenticationMode = Security.Transport.MsmqAuthenticationMode;
105 te.MsmqTransportSecurity.MsmqEncryptionAlgorithm = Security.Transport.MsmqEncryptionAlgorithm;
106 te.MsmqTransportSecurity.MsmqProtectionLevel = Security.Transport.MsmqProtectionLevel;
107 te.MsmqTransportSecurity.MsmqSecureHashAlgorithm = Security.Transport.MsmqSecureHashAlgorithm;
108 te.ReceiveErrorHandling = ReceiveErrorHandling;
109 te.ReceiveRetryCount = ReceiveRetryCount;
110 te.RetryCycleDelay = RetryCycleDelay;
111 te.TimeToLive = TimeToLive;
112 te.UseMsmqTracing = UseMsmqTracing;
113 te.UseSourceJournal = UseSourceJournal;
115 return new BindingElementCollection (new BindingElement [] { be, te });