**** Merged from MCS ****
[mono-project.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap.Asn1 / Asn1Encoder.cs
blob87158888118f0aae7cd01f1625da94f4403cb3d3
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.Asn1Encoder.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 encoding each of the ASN.1 types.
38 ///
39 /// Encoders which implement this interface may be used to encode any of the
40 /// Asn1Object data types.
41 ///
42 /// This package also provides the BEREncoder class that can be used to
43 /// BER encode ASN.1 classes. However an application might chose to use
44 /// its own encoder class.
45 ///
46 /// This interface thus allows an application to use this package to
47 /// encode ASN.1 objects using other encoding rules if needed.
48 ///
49 /// Note that Ldap packets are required to be BER encoded. Since this package
50 /// includes a BER encoder no application provided encoder is needed for
51 /// building Ldap packets.
52 /// </summary>
53 [CLSCompliantAttribute(true)]
54 public interface Asn1Encoder : System.Runtime.Serialization.ISerializable
57 /* Encoders for ASN.1 simple types */
59 /// <summary> Encode an Asn1Boolean directly into the provided output stream.
60 ///
61 /// </summary>
62 /// <param name="b">The Asn1Boolean object to encode
63 ///
64 /// </param>
65 /// <param name="out">The output stream onto which the ASN.1 object is
66 /// to be encoded
67 /// </param>
68 void encode(Asn1Boolean b, System.IO.Stream out_Renamed);
70 /// <summary> Encode an Asn1Numeric directly to a stream.
71 ///
72 /// Use a two's complement representation in the fewest number of octets
73 /// possible.
74 ///
75 /// Can be used to encode both INTEGER and ENUMERATED values.
76 ///
77 /// </summary>
78 /// <param name="n">The Asn1Numeric object to encode
79 ///
80 /// </param>
81 /// <param name="out">The output stream onto which the ASN.1 object is
82 /// to be encoded
83 /// </param>
84 void encode(Asn1Numeric n, System.IO.Stream out_Renamed);
86 /* Asn1 TYPE NOT YET SUPPORTED
87 * Encode an Asn1Real directly to a stream.
88 * public void encode(Asn1Real r, OutputStream out)
89 * throws IOException;
92 /// <summary> Encode an Asn1Null directly to a stream.
93 ///
94 /// </summary>
95 /// <param name="n">The Asn1Null object to encode
96 ///
97 /// </param>
98 /// <param name="out">The output stream onto which the ASN.1 object is
99 /// to be encoded
100 /// </param>
101 void encode(Asn1Null n, System.IO.Stream out_Renamed);
103 /* Asn1 TYPE NOT YET SUPPORTED
104 * Encode an Asn1BitString directly to a stream.
105 * public void encode(Asn1BitString bs, OutputStream out)
106 * throws IOException;
109 /// <summary> Encode an Asn1OctetString directly to a stream.
110 ///
111 /// </summary>
112 /// <param name="os">The Asn1OctetString object to encode
113 ///
114 /// </param>
115 /// <param name="out">The output stream onto which the ASN.1 object is
116 /// to be encoded
117 /// </param>
118 void encode(Asn1OctetString os, System.IO.Stream out_Renamed);
120 /* Asn1 TYPE NOT YET SUPPORTED
121 * Encode an Asn1ObjectIdentifier directly to a stream.
122 * public void encode(Asn1ObjectIdentifier oi, OutputStream out)
123 * throws IOException;
126 /* Asn1 TYPE NOT YET SUPPORTED
127 * Encode an Asn1CharacterString directly to a stream.
128 * public void encode(Asn1CharacterString cs, OutputStream out)
129 * throws IOException;
132 /* Encoder for ASN.1 structured types
135 /// <summary> Encode an Asn1Structured directly to a stream.
136 ///
137 /// </summary>
138 /// <param name="c">The Asn1Structured object to encode
139 ///
140 /// </param>
141 /// <param name="out">The output stream onto which the ASN.1 object is
142 /// to be encoded
143 /// </param>
144 void encode(Asn1Structured c, System.IO.Stream out_Renamed);
146 /// <summary> Encode an Asn1Tagged directly to a stream.
147 ///
148 /// </summary>
149 /// <param name="t">The Asn1Tagged object to encode
150 ///
151 /// </param>
152 /// <param name="out">The output stream onto which the ASN.1 object is
153 /// to be encoded
154 /// </param>
155 void encode(Asn1Tagged t, System.IO.Stream out_Renamed);
157 /* Encoders for ASN.1 useful types
160 /* Encoder for ASN.1 Identifier
163 /// <summary> Encode an Asn1Identifier directly to a stream.
164 ///
165 /// </summary>
166 /// <param name="id">The Asn1Identifier object to encode
167 ///
168 /// </param>
169 /// <param name="out">The output stream onto which the ASN.1 object is
170 /// to be encoded
171 /// </param>
172 void encode(Asn1Identifier id, System.IO.Stream out_Renamed);