当前位置: 首页>>代码示例>>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;未经允许,请勿转载。