本文整理汇总了Java中org.opennms.protocols.snmp.SnmpPduRequest类的典型用法代码示例。如果您正苦于以下问题:Java SnmpPduRequest类的具体用法?Java SnmpPduRequest怎么用?Java SnmpPduRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SnmpPduRequest类属于org.opennms.protocols.snmp包,在下文中一共展示了SnmpPduRequest类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: snmpReceivedPdu
import org.opennms.protocols.snmp.SnmpPduRequest; //导入依赖的package包/类
public void snmpReceivedPdu(SnmpSession session, int command, SnmpPduPacket pdu) {
try {
SnmpPduRequest response = (SnmpPduRequest)pdu;
log().debug("Received a tracker pdu from "+getAddress()+" of size "+pdu.getLength()+" errorStatus = "+response.getErrorStatus()+", errorIndex = "+response.getErrorIndex());
if (!processErrors(response.getErrorStatus(), response.getErrorIndex())) {
for(int i = 0; i < response.getLength(); i++) {
SnmpVarBind vb = response.getVarBindAt(i);
SnmpObjId receivedOid = SnmpObjId.get(vb.getName().getIdentifiers());
SnmpValue val = new JoeSnmpValue(vb.getValue());
processResponse(receivedOid, val);
}
}
buildAndSendNextPdu();
} catch (Throwable e) {
handleFatalError(e);
}
}
示例2: send
import org.opennms.protocols.snmp.SnmpPduRequest; //导入依赖的package包/类
public static void send(final String destAddr, final int destPort, final String community, final SnmpPduRequest pdu) throws Exception {
SnmpTrapSession trapSession = getTrapSession();
SnmpPeer peer = new SnmpPeer(InetAddress.getByName(destAddr), destPort);
SnmpParameters parms = new SnmpParameters(community);
parms.setVersion(SnmpSMI.SNMPV2);
peer.setParameters(parms);
trapSession.send(peer, pdu);
}
示例3: sendTest
import org.opennms.protocols.snmp.SnmpPduRequest; //导入依赖的package包/类
public static void sendTest(final String destAddr, final int destPort, final String community, final SnmpPduRequest pdu) throws UnknownHostException {
final InetAddress agentAddress = InetAddressUtils.getInetAddress(destAddr);
for (final RegistrationInfo info : s_registrations.values()) {
if (destPort == info.getPort()) {
info.getHandler().snmpReceivedTrap(info.getSession(), agentAddress, destPort, new SnmpOctetString(community.getBytes()), pdu);
}
}
}
示例4: reset
import org.opennms.protocols.snmp.SnmpPduRequest; //导入依赖的package包/类
public void reset() {
m_nextPdu = new SnmpPduRequest(SnmpPduRequest.GETNEXT);
m_nextPdu.setRequestId(SnmpPduPacket.nextSequence());
}
示例5: JoeSnmpV2TrapBuilder
import org.opennms.protocols.snmp.SnmpPduRequest; //导入依赖的package包/类
public JoeSnmpV2TrapBuilder() {
m_pdu = new SnmpPduRequest(SnmpPduPacket.V2TRAP);
m_pdu.setRequestId(SnmpPduPacket.nextSequence());
}
示例6: snmpReceivedGet
import org.opennms.protocols.snmp.SnmpPduRequest; //导入依赖的package包/类
public SnmpPduRequest snmpReceivedGet(SnmpPduPacket packet, boolean arg1) {
BrokerFactory.getLoggingBroker().logDebug("Got snmp get request = "+packet);
SnmpPduRequest request = new SnmpPduRequest(SnmpPduRequest.RESPONSE);
SnmpVarBind[] returnBinds = BrokerFactory.getSnmpBroker().handleGet(packet);
BrokerFactory.getLoggingBroker().logDebug("Got "+returnBinds.length+" return binds");
if (returnBinds.length == 0) return null;
for (int i = 0; i < returnBinds.length; i++) {
request.addVarBind(returnBinds[i]);
}
return request;
}
示例7: snmpReceivedSet
import org.opennms.protocols.snmp.SnmpPduRequest; //导入依赖的package包/类
public SnmpPduRequest snmpReceivedSet(SnmpPduPacket arg0) {
return null;
}