當前位置: 首頁>>代碼示例>>Java>>正文


Java SnmpPduRequest類代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:19,代碼來源:JoeSnmpWalker.java

示例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);
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:9,代碼來源:JoeSnmpStrategy.java

示例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);
        }
    }
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:9,代碼來源:JoeSnmpStrategy.java

示例4: reset

import org.opennms.protocols.snmp.SnmpPduRequest; //導入依賴的package包/類
public void reset() {
    m_nextPdu = new SnmpPduRequest(SnmpPduRequest.GETNEXT);
    m_nextPdu.setRequestId(SnmpPduPacket.nextSequence());
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:5,代碼來源:JoeSnmpWalker.java

示例5: JoeSnmpV2TrapBuilder

import org.opennms.protocols.snmp.SnmpPduRequest; //導入依賴的package包/類
public JoeSnmpV2TrapBuilder() {
    m_pdu = new SnmpPduRequest(SnmpPduPacket.V2TRAP);
    m_pdu.setRequestId(SnmpPduPacket.nextSequence());
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:5,代碼來源:JoeSnmpV2TrapBuilder.java

示例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;
}
 
開發者ID:davidrudder23,項目名稱:OpenNotification,代碼行數:17,代碼來源:SNMPLibrary.java

示例7: snmpReceivedSet

import org.opennms.protocols.snmp.SnmpPduRequest; //導入依賴的package包/類
public SnmpPduRequest snmpReceivedSet(SnmpPduPacket arg0) {
	return null;
}
 
開發者ID:davidrudder23,項目名稱:OpenNotification,代碼行數:4,代碼來源:SNMPLibrary.java


注:本文中的org.opennms.protocols.snmp.SnmpPduRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。