本文整理汇总了Java中com.sun.jmx.snmp.SnmpDefinitions.snmpVersionTwo方法的典型用法代码示例。如果您正苦于以下问题:Java SnmpDefinitions.snmpVersionTwo方法的具体用法?Java SnmpDefinitions.snmpVersionTwo怎么用?Java SnmpDefinitions.snmpVersionTwo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jmx.snmp.SnmpDefinitions
的用法示例。
在下文中一共展示了SnmpDefinitions.snmpVersionTwo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: getBulkWithGetNext
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>getBulk</CODE> operation using call to
* <CODE>getNext</CODE>.
* The method implements the <CODE>getBulk</CODE> operation by calling
* appropriately the <CODE>getNext</CODE> method.
*
* @param req The SnmpMibRequest containing the variable list to be
* retrieved.
*
* @param nonRepeat The number of variables, starting with the first
* variable in the variable-bindings, for which a single lexicographic
* successor is requested.
*
* @param maxRepeat The number of lexicographic successors
* requested for each of the last R variables. R is the number of
* variables following the first nonRepeat variables for which
* multiple lexicographic successors are requested.
*
* @return The variable list containing returned values.
*
* @exception SnmpStatusException An error occurred during the operation.
*/
void getBulkWithGetNext(SnmpMibRequest req, int nonRepeat, int maxRepeat)
throws SnmpStatusException {
final Vector<SnmpVarBind> list = req.getSubList();
// RFC 1905, Section 4.2.3, p14
final int L = list.size() ;
final int N = Math.max(Math.min(nonRepeat, L), 0) ;
final int M = Math.max(maxRepeat, 0) ;
final int R = L - N ;
// Let's build the varBindList for the response pdu
//
// int errorStatus = SnmpDefinitions.snmpRspNoError ;
// int errorIndex = 0 ;
if (L != 0) {
// Non-repeaters and first row of repeaters
//
getNext(req);
// Now the remaining repeaters
//
Vector<SnmpVarBind> repeaters= splitFrom(list, N);
SnmpMibRequestImpl repeatedReq =
new SnmpMibRequestImpl(req.getEngine(),
req.getPdu(),
repeaters,
SnmpDefinitions.snmpVersionTwo,
req.getUserData(),
req.getPrincipal(),
req.getSecurityLevel(),
req.getSecurityModel(),
req.getContextName(),
req.getAccessContextName());
for (int i = 2 ; i <= M ; i++) {
getNext(repeatedReq);
concatVector(req, repeaters);
}
}
}
示例4: getBulkWithGetNext
import com.sun.jmx.snmp.SnmpDefinitions; //导入方法依赖的package包/类
/**
* Processes a <CODE>getBulk</CODE> operation using call to
* <CODE>getNext</CODE>.
* The method implements the <CODE>getBulk</CODE> operation by calling
* appropriately the <CODE>getNext</CODE> method.
*
* @param req The SnmpMibRequest containing the variable list to be
* retrieved.
*
* @param nonRepeat The number of variables, starting with the first
* variable in the variable-bindings, for which a single lexicographic
* successor is requested.
*
* @param maxRepeat The number of lexicographic successors
* requested for each of the last R variables. R is the number of
* variables following the first nonRepeat variables for which
* multiple lexicographic successors are requested.
*
* @return The variable list containing returned values.
*
* @exception SnmpStatusException An error occured during the operation.
*/
void getBulkWithGetNext(SnmpMibRequest req, int nonRepeat, int maxRepeat)
throws SnmpStatusException {
final Vector<SnmpVarBind> list = req.getSubList();
// RFC 1905, Section 4.2.3, p14
final int L = list.size() ;
final int N = Math.max(Math.min(nonRepeat, L), 0) ;
final int M = Math.max(maxRepeat, 0) ;
final int R = L - N ;
// Let's build the varBindList for the response pdu
//
// int errorStatus = SnmpDefinitions.snmpRspNoError ;
// int errorIndex = 0 ;
if (L != 0) {
// Non-repeaters and first row of repeaters
//
getNext(req);
// Now the remaining repeaters
//
Vector<SnmpVarBind> repeaters= splitFrom(list, N);
SnmpMibRequestImpl repeatedReq =
new SnmpMibRequestImpl(req.getEngine(),
req.getPdu(),
repeaters,
SnmpDefinitions.snmpVersionTwo,
req.getUserData(),
req.getPrincipal(),
req.getSecurityLevel(),
req.getSecurityModel(),
req.getContextName(),
req.getAccessContextName());
for (int i = 2 ; i <= M ; i++) {
getNext(repeatedReq);
concatVector(req, repeaters);
}
}
}