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!"); } }
public SnmpScalarNodeOctetString(SnmpDataType dataType, SnmpTreeNode parentNode) : base(parentNode) { System.Diagnostics.Debug.Assert( (dataType == SnmpDataType.OctetString) || (dataType == SnmpDataType.Opaque) || (dataType == SnmpDataType.IpAddress)); this.DataType = dataType; }
public SnmpScalarNodeUint(SnmpDataType dataType, SnmpTreeNode parentNode) : base(parentNode) { System.Diagnostics.Debug.Assert( (dataType == SnmpDataType.Counter) || (dataType == SnmpDataType.Gauge) || (dataType == SnmpDataType.TimeTicks)); this.DataType = dataType; }
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)); }
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!"); } }
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!"); } }
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!"); } }
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); }
public SnmpResult(Oid oid, object data, SnmpDataType dataType) { _oid = oid; _data = data; _dataType = dataType; }