//+-------------------------------------------------------------------------------+ //| Copyright (c) 2003 Liping Dai. All rights reserved. | //| Web: www.lipingshare.com | //| Email: lipingshare@yahoo.com | //| | //| Copyright and Permission Details: | //| ================================= | //| Permission is hereby granted, free of charge, to any person obtaining a copy | //| of this software and associated documentation files (the "Software"), to deal | //| in the Software without restriction, including without limitation the rights | //| to use, copy, modify, merge, publish, distribute, and/or sell copies of the | //| Software, subject to the following conditions: | //| | //| 1. Redistributions of source code must retain the above copyright notice, this| //| list of conditions and the following disclaimer. | //| | //| 2. Redistributions in binary form must reproduce the above copyright notice, | //| this list of conditions and the following disclaimer in the documentation | //| and/or other materials provided with the distribution. | //| | //| THE SOFTWARE PRODUCT IS PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, | //| EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | //| WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR | //| A PARTICULAR PURPOSE. | //+-------------------------------------------------------------------------------+ using System.IO; namespace LipingShare.LCLib.Asn1Processor { /// /// IAsn1Node interface. /// internal interface IAsn1Node { /// /// Load data from Stream. /// /// /// true:Succeed; false:failed. bool LoadData(Stream xdata); /// /// Save node data into Stream. /// /// Stream. /// true:Succeed; false:failed. bool SaveData(Stream xdata); /// /// Get parent node. /// Asn1Node ParentNode { get; } /// /// Add child node at the end of children list. /// /// Asn1Node void AddChild(Asn1Node xdata); /// /// Insert a node in the children list before the pointed index. /// /// Asn1Node /// 0 based index. int InsertChild(Asn1Node xdata, int index); /// /// Insert a node in the children list before the pointed node. /// /// Asn1Node that will be instered in the children list. /// Index node. /// New node index. int InsertChild(Asn1Node xdata, Asn1Node indexNode); /// /// Insert a node in the children list after the pointed index. /// /// Asn1Node /// 0 based index. /// New node index. int InsertChildAfter(Asn1Node xdata, int index); /// /// Insert a node in the children list after the pointed node. /// /// Asn1Node that will be instered in the children list. /// Index node. /// New node index. int InsertChildAfter(Asn1Node xdata, Asn1Node indexNode); /// /// Remove a child from children node list by index. /// /// 0 based index. /// The Asn1Node just removed from the list. Asn1Node RemoveChild(int index); /// /// Remove the child from children node list. /// /// The node needs to be removed. /// Asn1Node RemoveChild(Asn1Node node); /// /// Get child node count. /// long ChildNodeCount { get; } /// /// Retrieve child node by index. /// /// 0 based index. /// 0 based index. Asn1Node GetChildNode(int index); /// /// Get descendant node by node path. /// /// relative node path that refer to current node. /// Asn1Node GetDescendantNodeByPath(string nodePath); /// /// Get/Set tag value. /// byte Tag { get; set; } byte MaskedTag { get; } /// /// Get tag name. /// string TagName { get; } /// /// Get data length. Not included the unused bits byte for BITSTRING. /// long DataLength { get; } /// /// Get the length field bytes. /// long LengthFieldBytes { get; } /// /// Get data offset. /// long DataOffset { get; } /// /// Get unused bits for BITSTRING. /// byte UnusedBits { get; } /// /// Get/Set node data by byte[], the data length field content and all the /// node in the parent chain will be adjusted. /// byte[] Data { get; set; } /// /// Get/Set parseEncapsulatedData. This property will be inherited by the /// child nodes when loading data. /// bool ParseEncapsulatedData { get; set; } /// /// Get the deepness of the node. /// long Deepness { get; } /// /// Get the path string of the node. /// string Path { get; } /// /// Get the node and all the descendents text description. /// /// starting node. /// line length. /// string GetText(Asn1Node startNode, int lineLen); /// /// Retrieve the node description. /// /// true:Return hex string only; /// false:Convert to more readable string depending on the node tag. /// string string GetDataStr(bool pureHexMode); /// /// Get node label string. /// /// /// /// SHOW_OFFSET /// SHOW_DATA /// USE_HEX_OFFSET /// SHOW_TAG_NUMBER /// SHOW_PATH /// /// string string GetLabel(uint mask); /// /// Clone a new Asn1Node by current node. /// /// new node. Asn1Node Clone(); /// /// Clear data and children list. /// void ClearAll(); } }