本文整理汇总了Java中com.sun.jmx.snmp.SnmpDefinitions.snmpVersionOne方法的典型用法代码示例。如果您正苦于以下问题:Java SnmpDefinitions.snmpVersionOne方法的具体用法?Java SnmpDefinitions.snmpVersionOne怎么用?Java SnmpDefinitions.snmpVersionOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.snmp.SnmpDefinitions
的用法示例。
在下文中一共展示了SnmpDefinitions.snmpVersionOne方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBulk
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>getBulk</CODE> operation. It will throw an exception if the request is a V1 one or it will set exceptions within the list for V2 ones.
*
* @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
*
* @exception SnmpStatusException An error occurred during the operation.
*/
@Override
public void getBulk(SnmpMibRequest inRequest, int nonRepeat, int maxRepeat)
throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
SnmpErrorHandlerAgent.class.getName(),
"getBulk", "GetBulk in Exception");
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpDefinitions.snmpRspGenErr, 0);
Enumeration<SnmpVarBind> l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = l.nextElement();
varbind.setEndOfMibView();
}
}
示例2: mapErrorStatus
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
static final int mapErrorStatus(int errorStatus,
int protocolVersion,
int reqPduType) {
if (errorStatus == SnmpDefinitions.snmpRspNoError)
return SnmpDefinitions.snmpRspNoError;
// Too bad, an error occurs ... we need to translate it ...
//
if (protocolVersion == SnmpDefinitions.snmpVersionOne)
return mapErrorStatusToV1(errorStatus,reqPduType);
if (protocolVersion == SnmpDefinitions.snmpVersionTwo ||
protocolVersion == SnmpDefinitions.snmpVersionThree)
return mapErrorStatusToV2(errorStatus,reqPduType);
return SnmpDefinitions.snmpRspGenErr;
}
示例3: mapSetException
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
public static int mapSetException(int errorStatus, int version)
throws SnmpStatusException {
final int errorCode = errorStatus;
if (version == SnmpDefinitions.snmpVersionOne)
return errorCode;
int mappedErrorCode = errorCode;
// Now take care of V2 errorCodes that can be stored
// in the varbind itself:
if (errorCode == SnmpStatusException.noSuchObject)
// noSuchObject => notWritable
mappedErrorCode = SnmpStatusException.snmpRspNotWritable;
else if (errorCode == SnmpStatusException.noSuchInstance)
// noSuchInstance => notWritable
mappedErrorCode = SnmpStatusException.snmpRspNotWritable;
return mappedErrorCode;
}
示例4: registerSetException
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
@Override
public void registerSetException(SnmpVarBind var,
SnmpStatusException exception)
throws SnmpStatusException {
// The index in the exception must correspond to
// the SNMP index ...
//
if (version == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(exception, getVarIndex(var)+1);
// Although the first pass of check() did not fail,
// the set() phase could not be carried out correctly.
// Since we don't know how to make an "undo", and some
// assignation may already have been performed, we're going
// to throw an snmpRspUndoFailed.
//
throw new SnmpStatusException(SnmpDefinitions.snmpRspUndoFailed,
getVarIndex(var)+1);
}
示例5: get
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>get</CODE> operation. It will throw an exception for V1 requests or it will set exceptions within the list for V2 requests.
*
* @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
*
* @exception SnmpStatusException An error occurred during the operation.
*/
@Override
public void get(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
SnmpErrorHandlerAgent.class.getName(),
"get", "Get in Exception");
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpStatusException.noSuchName);
Enumeration<SnmpVarBind> l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = l.nextElement();
varbind.setNoSuchObject();
}
}
示例6: skipVariable
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 8:
case 7:
case 6:
case 5:
case 4:
case 2:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
case 1:
return true;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
示例7: skipVariable
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 23:
case 22:
case 21:
case 20:
case 13:
case 12:
case 11:
case 10:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
示例8: getNext
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>getNext</CODE> operation. It will throw an exception for V1 requests or it will set exceptions within the list for V2 requests..
*
* @param inRequest The SnmpMibRequest object holding the list of variables to be retrieved.
*
* @exception SnmpStatusException An error occurred during the operation.
*/
@Override
public void getNext(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
SnmpErrorHandlerAgent.class.getName(),
"getNext", "GetNext in Exception");
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpStatusException.noSuchName);
Enumeration<SnmpVarBind> l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = l.nextElement();
varbind.setEndOfMibView();
}
}
示例9: get
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>get</CODE> operation. It will throw an exception for V1 requests or it will set exceptions within the list for V2 requests.
*
* @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
*
* @exception SnmpStatusException An error occured during the operation.
*/
public void get(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
SnmpErrorHandlerAgent.class.getName(),
"get", "Get in Exception");
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpStatusException.noSuchName);
Enumeration l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = (SnmpVarBind) l.nextElement();
varbind.setNoSuchObject();
}
}
示例10: getNext
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>getNext</CODE> operation. It will throw an exception for V1 requests or it will set exceptions within the list for V2 requests..
*
* @param inRequest The SnmpMibRequest object holding the list of variables to be retrieved.
*
* @exception SnmpStatusException An error occured during the operation.
*/
public void getNext(SnmpMibRequest inRequest) throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
SnmpErrorHandlerAgent.class.getName(),
"getNext", "GetNext in Exception");
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpStatusException.noSuchName);
Enumeration l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = (SnmpVarBind) l.nextElement();
varbind.setEndOfMibView();
}
}
示例11: registerSetException
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
public void registerSetException(SnmpVarBind var,
SnmpStatusException exception)
throws SnmpStatusException {
// The index in the exception must correspond to
// the SNMP index ...
//
if (version == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(exception, getVarIndex(var)+1);
// Although the first pass of check() did not fail,
// the set() phase could not be carried out correctly.
// Since we don't know how to make an "undo", and some
// assignation may already have been performed, we're going
// to throw an snmpRspUndoFailed.
//
throw new SnmpStatusException(SnmpDefinitions.snmpRspUndoFailed,
getVarIndex(var)+1);
}
示例12: getBulk
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>getBulk</CODE> operation. It will throw an exception if the request is a V1 one or it will set exceptions within the list for V2 ones.
*
* @param inRequest The SnmpMibRequest object holding the list of variable to be retrieved.
*
* @exception SnmpStatusException An error occured during the operation.
*/
public void getBulk(SnmpMibRequest inRequest, int nonRepeat, int maxRepeat)
throws SnmpStatusException {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST,
SnmpErrorHandlerAgent.class.getName(),
"getBulk", "GetBulk in Exception");
if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
throw new SnmpStatusException(SnmpDefinitions.snmpRspGenErr, 0);
Enumeration l = inRequest.getElements();
while(l.hasMoreElements()) {
SnmpVarBind varbind = (SnmpVarBind) l.nextElement();
varbind.setEndOfMibView();
}
}
示例13: skipVariable
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 4:
case 7:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
示例14: makeNoMibErrorPdu
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
SnmpPduPacket makeNoMibErrorPdu(SnmpPduRequest req, Object userData) {
// There is no agent registered
//
if (req.version == SnmpDefinitions.snmpVersionOne) {
// Version 1: => NoSuchName
return
newErrorResponsePdu(req,snmpRspNoSuchName,1);
} else if (req.version == SnmpDefinitions.snmpVersionTwo) {
// Version 2: => depends on PDU type
switch (req.type) {
case pduSetRequestPdu :
case pduWalkRequest :
// SET request => NoAccess
return
newErrorResponsePdu(req,snmpRspNoAccess,1);
case pduGetRequestPdu :
// GET request => NoSuchObject
return
makeErrorVarbindPdu(req,SnmpDataTypeEnums.
errNoSuchObjectTag);
case pduGetNextRequestPdu :
case pduGetBulkRequestPdu :
// GET-NEXT or GET-BULK => EndOfMibView
return
makeErrorVarbindPdu(req,SnmpDataTypeEnums.
errEndOfMibViewTag);
default:
}
}
// Something wrong here: => snmpRspGenErr
return newErrorResponsePdu(req,snmpRspGenErr,1);
}
示例15: skipVariable
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 3:
case 2:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}