**** Merged from MCS ****
[mono-project.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap / InterThreadException.cs
blob54e45072d55827a9641192cc2f0b7efb36849df2
1 /******************************************************************************
2 * The MIT License
3 * Copyright (c) 2003 Novell Inc. www.novell.com
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the Software), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *******************************************************************************/
24 // Novell.Directory.Ldap.InterThreadException.cs
26 // Author:
27 // Sunil Kumar (Sunilk@novell.com)
29 // (C) 2003 Novell, Inc (http://www.novell.com)
32 using System;
34 namespace Novell.Directory.Ldap
37 /* package */
38 public class InterThreadException:LdapException
40 /// <summary> Returns the message ID of this message request.
41 ///
42 /// </summary>
43 /// <returns> the message ID. Returns -1 if no message
44 /// is associated with this exception.
45 /// </returns>
46 virtual internal int MessageID
48 /* package */
50 get
52 if (request == null)
54 return - 1;
56 return request.MessageID;
60 /// <summary> Returns the message type expected as a reply to
61 /// the message associated with this message's request type.
62 ///
63 /// </summary>
64 /// <returns> the message type of the expected reply. Returns -1
65 /// if no reply expected.
66 /// </returns>
67 virtual internal int ReplyType
69 /* package */
71 get
73 if (request == null)
75 return - 1;
77 int reqType = request.MessageType;
78 int responseType = - 1;
79 switch (reqType)
82 case LdapMessage.BIND_REQUEST:
83 responseType = LdapMessage.BIND_RESPONSE;
84 break;
86 case LdapMessage.UNBIND_REQUEST:
87 responseType = - 1;
88 break;
90 case LdapMessage.SEARCH_REQUEST:
91 responseType = LdapMessage.SEARCH_RESULT;
92 break;
94 case LdapMessage.MODIFY_REQUEST:
95 responseType = LdapMessage.MODIFY_RESPONSE;
96 break;
98 case LdapMessage.ADD_REQUEST:
99 responseType = LdapMessage.ADD_RESPONSE;
100 break;
102 case LdapMessage.DEL_REQUEST:
103 responseType = LdapMessage.DEL_RESPONSE;
104 break;
106 case LdapMessage.MODIFY_RDN_REQUEST:
107 responseType = LdapMessage.MODIFY_RDN_RESPONSE;
108 break;
110 case LdapMessage.COMPARE_REQUEST:
111 responseType = LdapMessage.COMPARE_RESPONSE;
112 break;
114 case LdapMessage.ABANDON_REQUEST:
115 responseType = - 1;
116 break;
118 case LdapMessage.EXTENDED_REQUEST:
119 responseType = LdapMessage.EXTENDED_RESPONSE;
120 break;
123 return responseType;
127 private Message request;
129 /// <summary> Constructs a InterThreadException with its associated message.
130 ///
131 /// </summary>
132 /// <param name="message"> The text providign additional error information.
133 ///
134 /// </param>
135 /// <param name="resultCode"> The error result code.
136 ///
137 /// </param>
138 /// <param name="request"> The Message class associated with this exception.
139 /// </param>
140 /* package */
141 internal InterThreadException(System.String message, System.Object[] arguments, int resultCode, System.Exception rootException, Message request):base(message, arguments, resultCode, (System.String) null, rootException)
143 this.request = request;
144 return ;