📄 snmpproxymib.java
字号:
/*_############################################################################
_##
_## SNMP4J-Agent - SnmpProxyMIB.java
_##
_## Copyright (C) 2005-2008 Frank Fock (SNMP4J.org)
_##
_## Licensed under the Apache License, Version 2.0 (the "License");
_## you may not use this file except in compliance with the License.
_## You may obtain a copy of the License at
_##
_## http://www.apache.org/licenses/LICENSE-2.0
_##
_## Unless required by applicable law or agreed to in writing, software
_## distributed under the License is distributed on an "AS IS" BASIS,
_## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
_## See the License for the specific language governing permissions and
_## limitations under the License.
_##
_##########################################################################*/
package org.snmp4j.agent.mo.snmp;
//--AgentGen BEGIN=_BEGIN
//--AgentGen END
import org.snmp4j.smi.*;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.agent.*;
import org.snmp4j.agent.mo.*;
import org.snmp4j.agent.mo.snmp.*;
import java.util.List;
//--AgentGen BEGIN=_IMPORT
//--AgentGen END
public class SnmpProxyMIB
//--AgentGen BEGIN=_EXTENDS
//--AgentGen END
implements MOGroup
//--AgentGen BEGIN=_IMPLEMENTS
//--AgentGen END
{
// Constants
// Scalars
// Tables
public static final OID oidSnmpProxyEntry =
new OID(new int[] { 1,3,6,1,6,3,14,1,2,1 });
// Column sub-identifer defintions for snmpProxyEntry:
public static final int colSnmpProxyType = 2;
public static final int colSnmpProxyContextEngineID = 3;
public static final int colSnmpProxyContextName = 4;
public static final int colSnmpProxyTargetParamsIn = 5;
public static final int colSnmpProxySingleTargetOut = 6;
public static final int colSnmpProxyMultipleTargetOut = 7;
public static final int colSnmpProxyStorageType = 8;
public static final int colSnmpProxyRowStatus = 9;
// Column index defintions for snmpProxyEntry:
public static final int idxSnmpProxyType = 0;
public static final int idxSnmpProxyContextEngineID = 1;
public static final int idxSnmpProxyContextName = 2;
public static final int idxSnmpProxyTargetParamsIn = 3;
public static final int idxSnmpProxySingleTargetOut = 4;
public static final int idxSnmpProxyMultipleTargetOut = 5;
public static final int idxSnmpProxyStorageType = 6;
public static final int idxSnmpProxyRowStatus = 7;
private static MOTableSubIndex[] snmpProxyEntryIndexes =
new MOTableSubIndex[] {
new MOTableSubIndex(SMIConstants.SYNTAX_OCTET_STRING, 1, 32)
};
private static MOTableIndex snmpProxyEntryIndex =
new MOTableIndex(snmpProxyEntryIndexes, true);
private DefaultMOTable snmpProxyEntry;
private DefaultMOMutableTableModel snmpProxyEntryModel;
//--AgentGen BEGIN=_MEMBERS
//--AgentGen END
public SnmpProxyMIB() {
createSnmpProxyEntry();
}
private void createSnmpProxyEntry() {
MOColumn[] snmpProxyEntryColumns = new MOColumn[8];
snmpProxyEntryColumns[idxSnmpProxyType] =
new Enumerated(colSnmpProxyType,
MOAccessImpl.ACCESS_READ_CREATE,
(Integer32)null,
true,
new int[] { 1, 2, 3, 4 });
snmpProxyEntryColumns[idxSnmpProxyContextEngineID] =
new MOMutableColumn(colSnmpProxyContextEngineID,
SMIConstants.SYNTAX_OCTET_STRING,
MOAccessImpl.ACCESS_READ_CREATE,
null,
true);
((MOMutableColumn)snmpProxyEntryColumns[idxSnmpProxyContextEngineID]).
addMOValueValidationListener(new SnmpProxyContextEngineIDValidator());
snmpProxyEntryColumns[idxSnmpProxyContextName] =
new MOMutableColumn(colSnmpProxyContextName,
SMIConstants.SYNTAX_OCTET_STRING,
MOAccessImpl.ACCESS_READ_CREATE,
null,
true);
((MOMutableColumn)snmpProxyEntryColumns[idxSnmpProxyContextName]).
addMOValueValidationListener(new SnmpProxyContextNameValidator());
snmpProxyEntryColumns[idxSnmpProxyTargetParamsIn] =
new MOMutableColumn(colSnmpProxyTargetParamsIn,
SMIConstants.SYNTAX_OCTET_STRING,
MOAccessImpl.ACCESS_READ_CREATE,
null,
true);
((MOMutableColumn)snmpProxyEntryColumns[idxSnmpProxyTargetParamsIn]).
addMOValueValidationListener(new SnmpProxyTargetParamsInValidator());
snmpProxyEntryColumns[idxSnmpProxySingleTargetOut] =
new MOMutableColumn(colSnmpProxySingleTargetOut,
SMIConstants.SYNTAX_OCTET_STRING,
MOAccessImpl.ACCESS_READ_CREATE,
null,
true);
((MOMutableColumn)snmpProxyEntryColumns[idxSnmpProxySingleTargetOut]).
addMOValueValidationListener(new SnmpProxySingleTargetOutValidator());
snmpProxyEntryColumns[idxSnmpProxyMultipleTargetOut] =
new MOMutableColumn(colSnmpProxyMultipleTargetOut,
SMIConstants.SYNTAX_OCTET_STRING,
MOAccessImpl.ACCESS_READ_CREATE,
null,
true);
((MOMutableColumn)snmpProxyEntryColumns[idxSnmpProxyMultipleTargetOut]).
addMOValueValidationListener(new SnmpProxyMultipleTargetOutValidator());
snmpProxyEntryColumns[idxSnmpProxyStorageType] =
new StorageType(colSnmpProxyStorageType,
MOAccessImpl.ACCESS_READ_CREATE,
new Integer32(3),
true);
snmpProxyEntryColumns[idxSnmpProxyRowStatus] =
new RowStatus(colSnmpProxyRowStatus);
snmpProxyEntry =
new DefaultMOTable(oidSnmpProxyEntry,
snmpProxyEntryIndex,
snmpProxyEntryColumns);
snmpProxyEntryModel = new DefaultMOMutableTableModel();
snmpProxyEntry.setModel(snmpProxyEntryModel);
snmpProxyEntryModel.setRowFactory(new SnmpProxyRowFactory());
}
public void registerMOs(MOServer server, OctetString context)
throws DuplicateRegistrationException
{
// Scalar Objects
server.register(this.snmpProxyEntry, context);
//--AgentGen BEGIN=_registerMOs
//--AgentGen END
}
public void unregisterMOs(MOServer server, OctetString context) {
// Scalar Objects
server.unregister(this.snmpProxyEntry, context);
//--AgentGen BEGIN=_unregisterMOs
//--AgentGen END
}
// Notifications
// Scalars
// Value Validators
/**
* The <code>SnmpProxyContextEngineIDValidator</code> implements the value
* validation for <code>SnmpProxyContextEngineID</code>.
*/
static class SnmpProxyContextEngineIDValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
OctetString os = (OctetString)newValue;
if (!(((os.length() >= 5) && (os.length() <= 32)))) {
validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH);
return;
}
//--AgentGen BEGIN=snmpProxyContextEngineID::validate
//--AgentGen END
}
}
/**
* The <code>SnmpProxyContextNameValidator</code> implements the value
* validation for <code>SnmpProxyContextName</code>.
*/
static class SnmpProxyContextNameValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
OctetString os = (OctetString)newValue;
if (!(((os.length() >= 0) && (os.length() <= 255)))) {
validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH);
return;
}
//--AgentGen BEGIN=snmpProxyContextName::validate
//--AgentGen END
}
}
/**
* The <code>SnmpProxyTargetParamsInValidator</code> implements the value
* validation for <code>SnmpProxyTargetParamsIn</code>.
*/
static class SnmpProxyTargetParamsInValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
OctetString os = (OctetString)newValue;
if (!(((os.length() >= 0) && (os.length() <= 255)))) {
validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH);
return;
}
//--AgentGen BEGIN=snmpProxyTargetParamsIn::validate
//--AgentGen END
}
}
/**
* The <code>SnmpProxySingleTargetOutValidator</code> implements the value
* validation for <code>SnmpProxySingleTargetOut</code>.
*/
static class SnmpProxySingleTargetOutValidator implements MOValueValidationListener {
public void validate(MOValueValidationEvent validationEvent) {
Variable newValue = validationEvent.getNewValue();
OctetString os = (OctetString)newValue;
if (!(((os.length() >= 0) && (os.length() <= 255)))) {
validationEvent.setValidationStatus(SnmpConstants.SNMP_ERROR_WRONG_LENGTH);
return;
}
//--AgentGen BEGIN=snmpProxySingleTargetOut::validate
//--AgentGen END
}
}
/**
* The <code>SnmpProxyMultipleTargetOutValidator</code> implements the value
* validation for <code>SnmpProxyMultipleTargetOut</code>.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -