Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap / InterThreadException.cs
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:
11
12 * The above copyright notice and this permission notice shall be included in 
13 * all copies or substantial portions of the Software.
14
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 *******************************************************************************/
23 //
24 // Novell.Directory.Ldap.InterThreadException.cs
25 //
26 // Author:
27 //   Sunil Kumar (Sunilk@novell.com)
28 //
29 // (C) 2003 Novell, Inc (http://www.novell.com)
30 //
31
32 using System;
33
34 namespace Novell.Directory.Ldap
35 {
36         
37         /* package */
38         public class InterThreadException:LdapException
39         {
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
47                 {
48                         /* package */
49                         
50                         get
51                         {
52                                 if (request == null)
53                                 {
54                                         return - 1;
55                                 }
56                                 return request.MessageID;
57                         }
58                         
59                 }
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
68                 {
69                         /* package */
70                         
71                         get
72                         {
73                                 if (request == null)
74                                 {
75                                         return - 1;
76                                 }
77                                 int reqType = request.MessageType;
78                                 int responseType = - 1;
79                                 switch (reqType)
80                                 {
81                                         
82                                         case LdapMessage.BIND_REQUEST: 
83                                                 responseType = LdapMessage.BIND_RESPONSE;
84                                                 break;
85                                         
86                                         case LdapMessage.UNBIND_REQUEST: 
87                                                 responseType = - 1;
88                                                 break;
89                                         
90                                         case LdapMessage.SEARCH_REQUEST: 
91                                                 responseType = LdapMessage.SEARCH_RESULT;
92                                                 break;
93                                         
94                                         case LdapMessage.MODIFY_REQUEST: 
95                                                 responseType = LdapMessage.MODIFY_RESPONSE;
96                                                 break;
97                                         
98                                         case LdapMessage.ADD_REQUEST: 
99                                                 responseType = LdapMessage.ADD_RESPONSE;
100                                                 break;
101                                         
102                                         case LdapMessage.DEL_REQUEST: 
103                                                 responseType = LdapMessage.DEL_RESPONSE;
104                                                 break;
105                                         
106                                         case LdapMessage.MODIFY_RDN_REQUEST: 
107                                                 responseType = LdapMessage.MODIFY_RDN_RESPONSE;
108                                                 break;
109                                         
110                                         case LdapMessage.COMPARE_REQUEST: 
111                                                 responseType = LdapMessage.COMPARE_RESPONSE;
112                                                 break;
113                                         
114                                         case LdapMessage.ABANDON_REQUEST: 
115                                                 responseType = - 1;
116                                                 break;
117                                         
118                                         case LdapMessage.EXTENDED_REQUEST: 
119                                                 responseType = LdapMessage.EXTENDED_RESPONSE;
120                                                 break;
121                                                 
122                                         }
123                                 return responseType;
124                         }
125                         
126                 }
127                 private Message request;
128                 
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)
142                 {
143                         this.request = request;
144                         return ;
145                 }
146         }
147 }