| 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.Asn1.Asn1Encoder.cs |
| 25 |
// |
| 26 |
// Author: |
| 27 |
// Sunil Kumar ([email protected]) |
| 28 |
// |
| 29 |
// (C) 2003 Novell, Inc (http://www.novell.com) |
| 30 |
// |
| 31 |
|
| 32 |
using System; |
| 33 |
|
| 34 |
namespace Novell.Directory.Ldap.Asn1 |
| 35 |
{ |
| 36 |
|
| 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 |
public interface Asn1Encoder : System.Runtime.Serialization.ISerializable |
| 54 |
{ |
| 55 |
|
| 56 |
/* Encoders for ASN.1 simple types */ |
| 57 |
|
| 58 |
/// <summary> Encode an Asn1Boolean directly into the provided output stream. |
| 59 |
/// |
| 60 |
/// </summary> |
| 61 |
/// <param name="b">The Asn1Boolean object to encode |
| 62 |
/// |
| 63 |
/// </param> |
| 64 |
/// <param name="out">The output stream onto which the ASN.1 object is |
| 65 |
/// to be encoded |
| 66 |
/// </param> |
| 67 |
void encode(Asn1Boolean b, System.IO.Stream out_Renamed); |
| 68 |
|
| 69 |
/// <summary> Encode an Asn1Numeric directly to a stream. |
| 70 |
/// |
| 71 |
/// Use a two's complement representation in the fewest number of octets |
| 72 |
/// possible. |
| 73 |
/// |
| 74 |
/// Can be used to encode both INTEGER and ENUMERATED values. |
| 75 |
/// |
| 76 |
/// </summary> |
| 77 |
/// <param name="n">The Asn1Numeric object to encode |
| 78 |
/// |
| 79 |
/// </param> |
| 80 |
/// <param name="out">The output stream onto which the ASN.1 object is |
| 81 |
/// to be encoded |
| 82 |
/// </param> |
| 83 |
void encode(Asn1Numeric n, System.IO.Stream out_Renamed); |
| 84 |
|
| 85 |
/* Asn1 TYPE NOT YET SUPPORTED |
| 86 |
* Encode an Asn1Real directly to a stream. |
| 87 |
* public void encode(Asn1Real r, OutputStream out) |
| 88 |
* throws IOException; |
| 89 |
*/ |
| 90 |
|
| 91 |
/// <summary> Encode an Asn1Null directly to a stream. |
| 92 |
/// |
| 93 |
/// </summary> |
| 94 |
/// <param name="n">The Asn1Null object to encode |
| 95 |
/// |
| 96 |
/// </param> |
| 97 |
/// <param name="out">The output stream onto which the ASN.1 object is |
| 98 |
/// to be encoded |
| 99 |
/// </param> |
| 100 |
void encode(Asn1Null n, System.IO.Stream out_Renamed); |
| 101 |
|
| 102 |
/* Asn1 TYPE NOT YET SUPPORTED |
| 103 |
* Encode an Asn1BitString directly to a stream. |
| 104 |
* public void encode(Asn1BitString bs, OutputStream out) |
| 105 |
* throws IOException; |
| 106 |
*/ |
| 107 |
|
| 108 |
/// <summary> Encode an Asn1OctetString directly to a stream. |
| 109 |
/// |
| 110 |
/// </summary> |
| 111 |
/// <param name="os">The Asn1OctetString object to encode |
| 112 |
/// |
| 113 |
/// </param> |
| 114 |
/// <param name="out">The output stream onto which the ASN.1 object is |
| 115 |
/// to be encoded |
| 116 |
/// </param> |
| 117 |
void encode(Asn1OctetString os, System.IO.Stream out_Renamed); |
| 118 |
|
| 119 |
/* Asn1 TYPE NOT YET SUPPORTED |
| 120 |
* Encode an Asn1ObjectIdentifier directly to a stream. |
| 121 |
* public void encode(Asn1ObjectIdentifier oi, OutputStream out) |
| 122 |
* throws IOException; |
| 123 |
*/ |
| 124 |
|
| 125 |
/* Asn1 TYPE NOT YET SUPPORTED |
| 126 |
* Encode an Asn1CharacterString directly to a stream. |
| 127 |
* public void encode(Asn1CharacterString cs, OutputStream out) |
| 128 |
* throws IOException; |
| 129 |
*/ |
| 130 |
|
| 131 |
/* Encoder for ASN.1 structured types |
| 132 |
*/ |
| 133 |
|
| 134 |
/// <summary> Encode an Asn1Structured directly to a stream. |
| 135 |
/// |
| 136 |
/// </summary> |
| 137 |
/// <param name="c">The Asn1Structured object to encode |
| 138 |
/// |
| 139 |
/// </param> |
| 140 |
/// <param name="out">The output stream onto which the ASN.1 object is |
| 141 |
/// to be encoded |
| 142 |
/// </param> |
| 143 |
void encode(Asn1Structured c, System.IO.Stream out_Renamed); |
| 144 |
|
| 145 |
/// <summary> Encode an Asn1Tagged directly to a stream. |
| 146 |
/// |
| 147 |
/// </summary> |
| 148 |
/// <param name="t">The Asn1Tagged object to encode |
| 149 |
/// |
| 150 |
/// </param> |
| 151 |
/// <param name="out">The output stream onto which the ASN.1 object is |
| 152 |
/// to be encoded |
| 153 |
/// </param> |
| 154 |
void encode(Asn1Tagged t, System.IO.Stream out_Renamed); |
| 155 |
|
| 156 |
/* Encoders for ASN.1 useful types |
| 157 |
*/ |
| 158 |
|
| 159 |
/* Encoder for ASN.1 Identifier |
| 160 |
*/ |
| 161 |
|
| 162 |
/// <summary> Encode an Asn1Identifier directly to a stream. |
| 163 |
/// |
| 164 |
/// </summary> |
| 165 |
/// <param name="id">The Asn1Identifier object to encode |
| 166 |
/// |
| 167 |
/// </param> |
| 168 |
/// <param name="out">The output stream onto which the ASN.1 object is |
| 169 |
/// to be encoded |
| 170 |
/// </param> |
| 171 |
void encode(Asn1Identifier id, System.IO.Stream out_Renamed); |
| 172 |
} |
| 173 |
} |