else if (v instanceof SnmpOid) {
benc.putOid(((SnmpOid)v).longValue()) ;
}
else if (v instanceof SnmpCounter64) {
if (version == snmpVersionOne) {
throw new SnmpStatusException("Invalid value for SNMP v1 : " + v) ;
}
benc.putInteger(((SnmpCounter64)v).longValue(), SnmpValue.Counter64Tag) ;
}
else if (v instanceof SnmpNull) {
int tag = ((SnmpNull)v).getTag() ;
if ((version == snmpVersionOne) && (tag != SnmpValue.NullTag)) {
throw new SnmpStatusException("Invalid value for SNMP v1 : " + v) ;
}
if ((version == snmpVersionTwo) &&
(tag != SnmpValue.NullTag) &&
(tag != SnmpVarBind.errNoSuchObjectTag) &&
(tag != SnmpVarBind.errNoSuchInstanceTag) &&
(tag != SnmpVarBind.errEndOfMibViewTag)) {
throw new SnmpStatusException("Invalid value " + v) ;
}
benc.putNull(tag) ;
}
else {
throw new SnmpStatusException("Invalid value " + v) ;
}
}