Example #1
0
        /// <summary>Used to create correct variable type object for the specified encoded type</summary>
        /// <param name="asnType">ASN.1 type code</param>
        /// <returns>A new object matching type supplied or null if type was not recognized.</returns>
        public static AsnType GetSyntaxObject(SMIDataTypeCode asnType)
        {
            AsnType obj = null;
            if (asnType == SMIDataTypeCode.Integer)
                obj = new Integer32 ();
            else if (asnType == SMIDataTypeCode.Counter32)
                obj = new Counter32 ();
            else if (asnType == SMIDataTypeCode.Gauge32)
                obj = new Gauge32 ();
            else if (asnType == SMIDataTypeCode.Counter64)
                obj = new Counter64 ();
            else if (asnType == SMIDataTypeCode.TimeTicks)
                obj = new TimeTicks ();
            else if (asnType == SMIDataTypeCode.OctetString)
                obj = new OctetString ();
            else if (asnType == SMIDataTypeCode.Opaque)
                obj = new Opaque ();
            else if (asnType == SMIDataTypeCode.IPAddress)
                obj = new IpAddress ();
            else if (asnType == SMIDataTypeCode.ObjectId)
                obj = new Oid ();
            else if (asnType == SMIDataTypeCode.PartyClock)
                obj = new V2PartyClock ();
            else if (asnType == SMIDataTypeCode.NoSuchInstance)
                obj = new NoSuchInstance ();
            else if (asnType == SMIDataTypeCode.NoSuchObject)
                obj = new NoSuchObject ();
            else if (asnType == SMIDataTypeCode.EndOfMibView)
                obj = new EndOfMibView ();
            else if (asnType == SMIDataTypeCode.Null)
            {
                obj = new Null ();
            }

            return obj;
        }
Example #2
0
        /// <summary>Used to create correct variable type object for the specified encoded type</summary>
        /// <param name="asnType">ASN.1 type code</param>
        /// <returns>A new object matching type supplied or null if type was not recognized.</returns>
        public static AsnType GetSyntaxObject(SMIDataTypeCode asnType)
        {
            AsnType obj = null;

            if (asnType == SMIDataTypeCode.Integer)
            {
                obj = new Integer32();
            }
            else if (asnType == SMIDataTypeCode.Counter32)
            {
                obj = new Counter32();
            }
            else if (asnType == SMIDataTypeCode.Gauge32)
            {
                obj = new Gauge32();
            }
            else if (asnType == SMIDataTypeCode.Counter64)
            {
                obj = new Counter64();
            }
            else if (asnType == SMIDataTypeCode.TimeTicks)
            {
                obj = new TimeTicks();
            }
            else if (asnType == SMIDataTypeCode.OctetString)
            {
                obj = new OctetString();
            }
            else if (asnType == SMIDataTypeCode.Opaque)
            {
                obj = new Opaque();
            }
            else if (asnType == SMIDataTypeCode.IPAddress)
            {
                obj = new IpAddress();
            }
            else if (asnType == SMIDataTypeCode.ObjectId)
            {
                obj = new Oid();
            }
            else if (asnType == SMIDataTypeCode.PartyClock)
            {
                obj = new V2PartyClock();
            }
            else if (asnType == SMIDataTypeCode.NoSuchInstance)
            {
                obj = new NoSuchInstance();
            }
            else if (asnType == SMIDataTypeCode.NoSuchObject)
            {
                obj = new NoSuchObject();
            }
            else if (asnType == SMIDataTypeCode.EndOfMibView)
            {
                obj = new EndOfMibView();
            }
            else if (asnType == SMIDataTypeCode.Null)
            {
                obj = new Null();
            }

            return(obj);
        }
Example #3
0
 /// <summary>
 /// Return string representation of the SMI value type.
 /// </summary>
 /// <param name="type">AsnType class Type member function value.</param>
 /// <returns>String formatted name of the SMI type.</returns>
 public static string GetTypeName(SMIDataTypeCode type)
 {
     return SMIDataTypeCode.GetName (typeof(SMIDataTypeCode), type);
 }
Example #4
0
 /// <summary>
 /// Return string representation of the SMI value type.
 /// </summary>
 /// <param name="type">AsnType class Type member function value.</param>
 /// <returns>String formatted name of the SMI type.</returns>
 public static string GetTypeName(SMIDataTypeCode type)
 {
     return(Enum.GetName(typeof(SMIDataTypeCode), type));
 }