本文整理了Java中org.snmp4j.PDU.getType()
方法的一些代码示例,展示了PDU.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.getType()
方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:getType
[英]Gets the PDU type. The default is PDU#GETNEXT.
[中]获取PDU类型。默认值为PDU#GETNEXT。
代码示例来源:origin: org.opennms.core.snmp/org.opennms.core.snmp.implementations.snmp4j
/**
* Constructs a new trap information instance that contains the sending
* agent, the community string, and the Protocol Data Unit.
*
* @param agent
* The sending agent's address
* @param community
* The community string from the SNMP packet.
* @param pdu
* The encapsulated Protocol Data Unit.
*/
public Snmp4JV2TrapInformation(InetAddress agent, String community, PDU pdu) {
super(agent, community);
m_pdu = pdu;
m_pduTypeString = PDU.getTypeString(m_pdu.getType());
}
代码示例来源:origin: OpenNMS/opennms
/**
* @param command
* @return
*/
private boolean isRequestPDU(PDU command) {
return (command.getType() != PDU.TRAP) &&
(command.getType() != PDU.V1TRAP) &&
(command.getType() != PDU.REPORT) &&
(command.getType() != PDU.RESPONSE);
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
protected boolean is2PC() {
return (source.getPDU().getType() == PDU.SET);
}
代码示例来源:origin: OpenNMS/opennms
/**
* Constructs a new trap information instance that contains the sending
* agent, the community string, and the Protocol Data Unit.
*
* @param agent
* The sending agent's address
* @param community
* The community string from the SNMP packet.
* @param pdu
* The encapsulated Protocol Data Unit.
*/
public Snmp4JV2TrapInformation(InetAddress agent, String community, PDU pdu) {
super(agent, community);
m_pdu = pdu;
m_pduTypeString = PDU.getTypeString(m_pdu.getType());
}
代码示例来源:origin: org.kaazing/snmp4j-agent
protected boolean is2PC() {
return (requestEvent.getPDU().getType() == PDU.SET);
}
代码示例来源:origin: org.opennms.lib.snmp/org.opennms.lib.snmp.snmp4j
/**
* Constructs a new trap information instance that contains the sending
* agent, the community string, and the Protocol Data Unit.
*
* @param agent
* The sending agent's address
* @param community
* The community string from the SNMP packet.
* @param pdu
* The encapsulated Protocol Data Unit.
* @param trapProcessor The trap processor used to process the trap data
*
*/
public Snmp4JV2TrapInformation(InetAddress agent, String community, PDU pdu, TrapProcessor trapProcessor) {
super(agent, community, trapProcessor);
m_pdu = pdu;
m_pduTypeString = PDU.getTypeString(m_pdu.getType());
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public boolean isBulkRequest() {
return (source.getPDU().getType() == PDU.GETBULK);
}
代码示例来源:origin: org.jboss.jbossas/jboss-snmp
@Override
public void processPdu(CommandResponderEvent e) {
PDU pdu = e.getPDU();
if (pdu != null){
if (pdu instanceof PDUv1){
processPDUv1((PDUv1)pdu);
}
else if (pdu instanceof ScopedPDU) {
processScopedPDU((ScopedPDU)pdu);
}
else if (pdu instanceof PDU){
processPDUv2c(pdu);
}
else {
log.warn("Unknown PDU type: " + PDU.getTypeString(pdu.getType()));
}
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public boolean isBulkRequest() {
return (requestEvent.getPDU().getType() == PDU.GETBULK);
}
代码示例来源:origin: org.opendaylight.cardinal/cardinal-impl
/**
* This method will be called whenever a pdu is received on the given port
* specified in the listen() method
*/
public synchronized void processPdu(CommandResponderEvent cmdRespEvent) {
System.out.println("Received PDU...");
PDU pdu = cmdRespEvent.getPDU();
if (pdu != null) {
System.out.println("Trap Type = " + pdu.getType());
System.out.println("Variables = " + pdu.getVariableBindings());
}
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public SubRequest nextSubRequest() {
if (!hasNext()) {
throw new NoSuchElementException();
}
if ((requestEvent.getPDU().getType() == PDU.GETBULK) &&
(cursor >= subrequests.size())) {
while (cursor >= subrequests.size()) {
addRepeaterSubRequest();
}
}
SubRequest sreq = (SubRequest) subrequests.get(cursor);
cursor += increment;
return sreq;
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public int getViewType() {
return getViewType(requestEvent.getPDU().getType());
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public int getViewType() {
return getViewType(source.getPDU().getType());
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public SnmpRequest.SnmpSubRequest next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
if ((source.getPDU().getType() == PDU.GETBULK) &&
(cursor >= subrequests.size()) && (source.getPDU().getMaxRepetitions() > 0)) {
while (cursor >= subrequests.size()) {
addRepeaterSubRequest();
}
}
SnmpRequest.SnmpSubRequest sreq = subrequests.get(cursor);
cursor += increment;
return sreq;
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public boolean isPhaseComplete() {
if (errorStatus == SnmpConstants.SNMP_ERROR_SUCCESS) {
initSubRequests();
for (Iterator it = subrequests.iterator(); it.hasNext(); ) {
SubRequest subreq = (SubRequest) it.next();
RequestStatus status = subreq.getStatus();
if (status.getErrorStatus() != SnmpConstants.SNMP_ERROR_SUCCESS) {
return true;
}
else if (!status.isPhaseComplete()) {
return false;
}
}
}
if (requestEvent.getPDU().getType() == PDU.GETBULK) {
SnmpSubRequestIterator it =
new SnmpSubRequestIterator(subrequests.size(), 1);
return !it.hasNext();
}
return true;
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
protected void dispatchCommand(CommandResponderEvent command,
CoexistenceInfo cinfo) {
RequestHandler<SnmpRequest> handler = getHandler(command.getPDU().getType());
if (handler != null) {
processRequest(command, cinfo, handler);
} else {
sendUnknownPDUHandlersReport(command);
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
protected void dispatchCommand(CommandResponderEvent command,
CoexistenceInfo cinfo) {
RequestHandler handler = getHandler(command.getPDU().getType());
if (handler != null) {
processRequest(command, cinfo, handler);
}
else {
sendUnknownPDUHandlersReport(command);
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
protected void reprocessRequest(MOServer server, SnmpRequest req) {
RequestHandler<SnmpRequest> handler =
getHandler(req.getSource().getPDU().getType());
if (handler != null) {
req.resetProcessedStatus();
req.incReprocessCounter();
processRequest(server, handler, req);
} else {
sendUnknownPDUHandlersReport(req.getSource());
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
protected void reprocessRequest(MOServer server, SnmpRequest req) {
RequestHandler handler =
getHandler(req.getInitiatingEvent().getPDU().getType());
if (handler != null) {
req.resetProcessedStatus();
req.incReprocessCounter();
processRequest(server, handler, req);
}
else {
sendUnknownPDUHandlersReport(req.getInitiatingEvent());
}
}
代码示例来源:origin: org.kaazing/snmp4j
private void walk(Target target, OID rootOID,
OID startOID, Object userObject,
TreeListener listener) {
PDU request = pduFactory.createPDU(target);
request.add(new VariableBinding(startOID));
if (target.getVersion() == SnmpConstants.version1) {
request.setType(PDU.GETNEXT);
}
else if (request.getType() != PDU.GETNEXT) {
request.setType(PDU.GETBULK);
request.setMaxRepetitions(maxRepetitions);
}
TreeRequest treeRequest =
new TreeRequest(listener, rootOID, target, userObject, request);
treeRequest.send();
}
内容来源于网络,如有侵权,请联系作者删除!