コード例 #1
0
        public static string GetLengthForSnmpDataType(SnmpDataType dt)
        {
            switch (dt)
            {
            case SnmpDataType.Null:
                return("0");

            case SnmpDataType.Integer:
            case SnmpDataType.Counter:
            case SnmpDataType.IpAddress:
            case SnmpDataType.Gauge:
            case SnmpDataType.TimeTicks:
                return("4");

            case SnmpDataType.Counter64:
                return("8");

            case SnmpDataType.OctetString:
            case SnmpDataType.ObjectIdentifier:
            case SnmpDataType.Bits:
            case SnmpDataType.Opaque:
                return(null);

            default:
                throw new NotSupportedException("Unknown SnmpDataType!");
            }
        }
コード例 #2
0
        public SnmpScalarNodeOctetString(SnmpDataType dataType, SnmpTreeNode parentNode)
            : base(parentNode)
        {
            System.Diagnostics.Debug.Assert(
                (dataType == SnmpDataType.OctetString) ||
                (dataType == SnmpDataType.Opaque) ||
                (dataType == SnmpDataType.IpAddress));

            this.DataType = dataType;
        }
コード例 #3
0
        public SnmpScalarNodeUint(SnmpDataType dataType, SnmpTreeNode parentNode)
            : base(parentNode)
        {
            System.Diagnostics.Debug.Assert(
                (dataType == SnmpDataType.Counter) ||
                (dataType == SnmpDataType.Gauge) ||
                (dataType == SnmpDataType.TimeTicks));

            this.DataType = dataType;
        }
コード例 #4
0
ファイル: SnmpScalarNodeUint.cs プロジェクト: plocklsh/lwip
		public SnmpScalarNodeUint(SnmpDataType dataType, SnmpTreeNode parentNode)
			: base(parentNode)
		{
			System.Diagnostics.Debug.Assert(
				(dataType == SnmpDataType.Counter) || 
				 (dataType == SnmpDataType.Gauge) || 
				 (dataType == SnmpDataType.TimeTicks));

			this.DataType = dataType;
		}
コード例 #5
0
		public SnmpScalarNodeOctetString(SnmpDataType dataType, SnmpTreeNode parentNode)
			: base(parentNode)
		{
			System.Diagnostics.Debug.Assert(
				(dataType == SnmpDataType.OctetString) || 
				 (dataType == SnmpDataType.Opaque) || 
				 (dataType == SnmpDataType.IpAddress));

			this.DataType = dataType;
		}
コード例 #6
0
        public static SnmpScalarNode CreateFromDatatype(SnmpDataType dataType, SnmpTreeNode parentNode)
        {
            switch (dataType)
            {
            case SnmpDataType.Integer:
                return(new SnmpScalarNodeInt(parentNode));

            case SnmpDataType.Gauge:
            case SnmpDataType.Counter:
            case SnmpDataType.TimeTicks:
                return(new SnmpScalarNodeUint(dataType, parentNode));
            }

            return(new SnmpScalarNode(parentNode));
        }
コード例 #7
0
        public static string GetAsn1DefForSnmpDataType(SnmpDataType dt)
        {
            switch (dt)
            {
            // primitive
            case SnmpDataType.Null:
                return("SNMP_ASN1_TYPE_NULL");

            case SnmpDataType.Bits:
            case SnmpDataType.OctetString:
                return("SNMP_ASN1_TYPE_OCTET_STRING");

            case SnmpDataType.ObjectIdentifier:
                return("SNMP_ASN1_TYPE_OBJECT_ID");

            case SnmpDataType.Integer:
                return("SNMP_ASN1_TYPE_INTEGER");

            // application
            case SnmpDataType.IpAddress:
                return("SNMP_ASN1_TYPE_IPADDR");

            case SnmpDataType.Counter:
                return("SNMP_ASN1_TYPE_COUNTER");

            case SnmpDataType.Gauge:
                return("SNMP_ASN1_TYPE_GAUGE");

            case SnmpDataType.TimeTicks:
                return("SNMP_ASN1_TYPE_TIMETICKS");

            case SnmpDataType.Opaque:
                return("SNMP_ASN1_TYPE_OPAQUE");

            case SnmpDataType.Counter64:
                return("SNMP_ASN1_TYPE_COUNTER64");

            default:
                throw new NotSupportedException("Unknown SnmpDataType!");
            }
        }
コード例 #8
0
ファイル: LwipSnmp.cs プロジェクト: plocklsh/lwip
		public static string GetLengthForSnmpDataType(SnmpDataType dt)
		{
			switch (dt)
			{
				case SnmpDataType.Null:
					return "0";

				case SnmpDataType.Integer:
				case SnmpDataType.Counter:
				case SnmpDataType.IpAddress:
				case SnmpDataType.Gauge:
				case SnmpDataType.TimeTicks:
					return "4";

				case SnmpDataType.Counter64:
					return "8";

				case SnmpDataType.OctetString:
				case SnmpDataType.ObjectIdentifier:
				case SnmpDataType.Bits:
				case SnmpDataType.Opaque:
					return null;

				default:
					throw new NotSupportedException("Unknown SnmpDataType!");
			}
		}
コード例 #9
0
ファイル: LwipSnmp.cs プロジェクト: plocklsh/lwip
		public static string GetAsn1DefForSnmpDataType(SnmpDataType dt)
		{
			switch (dt)
			{
				// primitive
				case SnmpDataType.Null:
					return "SNMP_ASN1_TYPE_NULL";
				case SnmpDataType.Bits:
				case SnmpDataType.OctetString:
					return "SNMP_ASN1_TYPE_OCTET_STRING";
				case SnmpDataType.ObjectIdentifier:
					return "SNMP_ASN1_TYPE_OBJECT_ID";				
				case SnmpDataType.Integer:
					return "SNMP_ASN1_TYPE_INTEGER";

				// application
				case SnmpDataType.IpAddress:
					return "SNMP_ASN1_TYPE_IPADDR";
				case SnmpDataType.Counter:
					return "SNMP_ASN1_TYPE_COUNTER";
				case SnmpDataType.Gauge:
					return "SNMP_ASN1_TYPE_GAUGE";
				case SnmpDataType.TimeTicks:
					return "SNMP_ASN1_TYPE_TIMETICKS";
				case SnmpDataType.Opaque:
					return "SNMP_ASN1_TYPE_OPAQUE";
				case SnmpDataType.Counter64:
					return "SNMP_ASN1_TYPE_COUNTER64";
				default:
					throw new NotSupportedException("Unknown SnmpDataType!");
			}
		}
コード例 #10
0
        public static SnmpScalarNode CreateFromDatatype(SnmpDataType dataType, SnmpTreeNode parentNode)
        {
            switch (dataType)
            {
                case SnmpDataType.Integer:
                    return new SnmpScalarNodeInt(parentNode);

                case SnmpDataType.Gauge:
                case SnmpDataType.Counter:
                case SnmpDataType.TimeTicks:
                    return new SnmpScalarNodeUint(dataType, parentNode);
            }

            return new SnmpScalarNode(parentNode);
        }
コード例 #11
0
ファイル: SnmpResult.cs プロジェクト: iZrgsys/SnmpWalk
 public SnmpResult(Oid oid, object data, SnmpDataType dataType)
 {
     _oid = oid;
     _data = data;
     _dataType = dataType;
 }