1 /******************************************************************************
3 * Copyright (c) 2003 Novell Inc. www.novell.com
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
22 *******************************************************************************/
24 // Novell.Directory.Ldap.Asn1.Asn1Encoder.cs
27 // Sunil Kumar (Sunilk@novell.com)
29 // (C) 2003 Novell, Inc (http://www.novell.com)
34 namespace Novell
.Directory
.Ldap
.Asn1
37 /// <summary> This interface defines the methods for encoding each of the ASN.1 types.
39 /// Encoders which implement this interface may be used to encode any of the
40 /// Asn1Object data types.
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.
46 /// This interface thus allows an application to use this package to
47 /// encode ASN.1 objects using other encoding rules if needed.
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.
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.
62 /// <param name="b">The Asn1Boolean object to encode
65 /// <param name="out">The output stream onto which the ASN.1 object is
68 void encode(Asn1Boolean b
, System
.IO
.Stream out_Renamed
);
70 /// <summary> Encode an Asn1Numeric directly to a stream.
72 /// Use a two's complement representation in the fewest number of octets
75 /// Can be used to encode both INTEGER and ENUMERATED values.
78 /// <param name="n">The Asn1Numeric object to encode
81 /// <param name="out">The output stream onto which the ASN.1 object is
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)
92 /// <summary> Encode an Asn1Null directly to a stream.
95 /// <param name="n">The Asn1Null object to encode
98 /// <param name="out">The output stream onto which the ASN.1 object is
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.
112 /// <param name="os">The Asn1OctetString object to encode
115 /// <param name="out">The output stream onto which the ASN.1 object is
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.
138 /// <param name="c">The Asn1Structured object to encode
141 /// <param name="out">The output stream onto which the ASN.1 object is
144 void encode(Asn1Structured c
, System
.IO
.Stream out_Renamed
);
146 /// <summary> Encode an Asn1Tagged directly to a stream.
149 /// <param name="t">The Asn1Tagged object to encode
152 /// <param name="out">The output stream onto which the ASN.1 object is
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.
166 /// <param name="id">The Asn1Identifier object to encode
169 /// <param name="out">The output stream onto which the ASN.1 object is
172 void encode(Asn1Identifier id
, System
.IO
.Stream out_Renamed
);