**** Merged from MCS ****
[mono-project.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap.Asn1 / Asn1Decoder.cs
blobc9acc73d828bc7c629d4e08e03154b9476477f2f
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.Asn1.Asn1Decoder.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.Asn1
37 /// <summary> This interface defines the methods for decoding each of the ASN.1 types.
38 ///
39 /// Decoders which implement this interface may be used to decode any of the
40 /// Asn1Object data types.
41 ///
42 /// This package also provides the BERDecoder class that can be used to
43 /// BER decode ASN.1 classes. However an application might chose to use
44 /// its own decoder class.
45 ///
46 /// This interface thus allows an application to use this package to
47 /// decode ASN.1 objects using other decoding rules if needed.
48 ///
49 /// Note that Ldap packets are required to be BER encoded. Since this package
50 /// includes a BER decoder no application provided decoder is needed for
51 /// building Ldap packets.
52 /// </summary>
53 [CLSCompliantAttribute(false)]
54 public interface Asn1Decoder : System.Runtime.Serialization.ISerializable
57 /// <summary> Decode an encoded value into an Asn1Object from a byte array.
58 ///
59 /// </summary>
60 /// <param name="value">A byte array that points to the encoded Asn1 data
61 /// </param>
62 Asn1Object decode(sbyte[] value_Renamed);
65 /// <summary> Decode an encoded value into an Asn1Object from an InputStream.
66 ///
67 /// </summary>
68 /// <param name="in">An input stream containig the encoded ASN.1 data.
69 /// </param>
70 Asn1Object decode(System.IO.Stream in_Renamed);
73 /// <summary> Decode an encoded value into an Asn1Object from an InputStream.
74 ///
75 /// </summary>
76 /// <param name="length">The decoded components encoded length. This value is
77 /// handy when decoding structured types. It allows you to accumulate
78 /// the number of bytes decoded, so you know when the structured
79 /// type has decoded all of its components.
80 ///
81 /// </param>
82 /// <param name="in">An input stream containig the encoded ASN.1 data.
83 /// </param>
84 Asn1Object decode(System.IO.Stream in_Renamed, int[] length);
86 /* Decoders for ASN.1 simple types
89 /// <summary> Decode a BOOLEAN directly from a stream. Call this method when you
90 /// know that the next ASN.1 encoded element is a BOOLEAN
91 ///
92 /// </summary>
93 /// <param name="in">An input stream containig the encoded ASN.1 data.
94 ///
95 /// </param>
96 /// <param name="len">Length in bytes
97 /// </param>
98 System.Object decodeBoolean(System.IO.Stream in_Renamed, int len);
100 /// <summary> Decode a Numeric value directly from a stream. Call this method when you
101 /// know that the next ASN.1 encoded element is a Numeric
102 ///
103 /// Can be used to decodes INTEGER and ENUMERATED types.
104 ///
105 /// </summary>
106 /// <param name="in">An input stream containig the encoded ASN.1 data.
107 ///
108 /// </param>
109 /// <param name="len">Length in bytes
110 /// </param>
111 System.Object decodeNumeric(System.IO.Stream in_Renamed, int len);
115 /* Asn1 TYPE NOT YET SUPPORTED
116 * Decode a REAL directly from a stream.
117 * public Object decodeReal(InputStream in, int len)
118 * throws IOException;
120 /* Asn1 TYPE NOT YET SUPPORTED
121 * Decode a BIT_STRING directly from a stream.
122 * public Object decodeBitString(InputStream in, int len)
123 * throws IOException;
128 /// <summary> Decode an OCTET_STRING directly from a stream. Call this method when you
129 /// know that the next ASN.1 encoded element is a OCTET_STRING.
130 ///
131 /// </summary>
132 /// <param name="in">An input stream containig the encoded ASN.1 data.
133 ///
134 /// </param>
135 /// <param name="len">Length in bytes
136 /// </param>
137 System.Object decodeOctetString(System.IO.Stream in_Renamed, int len);
141 /* Asn1 TYPE NOT YET SUPPORTED
142 * Decode an OBJECT_IDENTIFIER directly from a stream.
143 * public Object decodeObjectIdentifier(InputStream in, int len)
144 * throws IOException;
149 /// <summary> Decode a CharacterString directly from a stream.
150 ///
151 /// Decodes any of the specialized character strings.
152 ///
153 /// </summary>
154 /// <param name="in">An input stream containig the encoded ASN.1 data.
155 ///
156 /// </param>
157 /// <param name="len">Length in bytes
158 /// </param>
159 System.Object decodeCharacterString(System.IO.Stream in_Renamed, int len);
161 /* No Decoders for ASN.1 structured types. A structured type's value is a
162 * collection of other types.
166 /* Decoders for ASN.1 useful types
169 /* Asn1 TYPE NOT YET SUPPORTED
170 * Decode a GENERALIZED_TIME directly from a stream.
171 * public Object decodeGeneralizedTime(InputStream in, int len)
172 * throws IOException;
175 /* Asn1 TYPE NOT YET SUPPORTED
176 * Decode a UNIVERSAL_TIME directly from a stream.
177 * public Object decodeUniversalTime(InputStream in, int len)
178 * throws IOException;
181 /* Asn1 TYPE NOT YET SUPPORTED
182 * Decode an EXTERNAL directly from a stream.
183 * public Object decodeExternal(InputStream in, int len)
184 * throws IOException;
188 /* Asn1 TYPE NOT YET SUPPORTED
189 * Decode an OBJECT_DESCRIPTOR directly from a stream.
190 * public Object decodeObjectDescriptor(InputStream in, int len)
191 * throws IOException;