Merge pull request #2454 from tastywheattasteslikechicken/FixVtableAbort
[mono.git] / mcs / class / System.ServiceModel / System.ServiceModel / NetMsmqBinding.cs
1 //
2 // NetMsmqBinding.cs
3 //
4 // Author: Atsushi Enomoto  <atsushi@ximian.com>
5 //
6 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
7 //
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:
15 // 
16 // The above copyright notice and this permission notice shall be
17 // included in all copies or substantial portions of the Software.
18 // 
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.
26 //
27
28 using System;
29 using System.ServiceModel.Channels;
30 using System.ServiceModel.Description;
31 using System.Xml;
32
33 namespace System.ServiceModel
34 {
35         public class NetMsmqBinding : MsmqBindingBase
36         {
37                 NetMsmqSecurity security;
38                 bool use_ad;
39                 long max_buffer_pool_size = 0x80000;
40                 QueueTransferProtocol queue_tr_protocol;
41                 XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas ();
42                 EnvelopeVersion envelope_version = EnvelopeVersion.Soap12;
43
44                 public NetMsmqBinding ()
45                         : this (NetMsmqSecurityMode.None)
46                 {
47                 }
48
49                 public NetMsmqBinding (NetMsmqSecurityMode securityMode)
50                 {
51                         security = new NetMsmqSecurity (securityMode);
52                 }
53
54                 [MonoTODO]
55                 public NetMsmqBinding (string configurationName)
56                 {
57                         throw new NotImplementedException ();
58                 }
59
60                 public NetMsmqSecurity Security {
61                         get { return security; }
62                 }
63
64                 public EnvelopeVersion EnvelopeVersion {
65                         get { return envelope_version; }
66                 }
67
68                 public long MaxBufferPoolSize {
69                         get { return max_buffer_pool_size; }
70                         set { max_buffer_pool_size = value; }
71                 }
72
73                 public QueueTransferProtocol QueueTransferProtocol {
74                         get { return queue_tr_protocol; }
75                         set { queue_tr_protocol = value; }
76                 }
77
78                 public XmlDictionaryReaderQuotas ReaderQuotas {
79                         get { return quotas; }
80                         set { quotas = value; }
81                 }
82
83                 public bool UseActiveDirectory {
84                         get { return use_ad; }
85                         set { use_ad = value; }
86                 }
87
88                 public override BindingElementCollection CreateBindingElements ()
89                 {
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;
114
115                         return new BindingElementCollection (new BindingElement [] { be, te });
116                 }
117         }
118 }