本文整理了Java中org.snmp4j.PDU.size()
方法的一些代码示例,展示了PDU.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.size()
方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:size
[英]Gets the number of variable bindings in the PDU.
[中]获取PDU中变量绑定的数量。
代码示例来源:origin: com.rogueai/snmp2bean
protected void checkRequestError(PDU requestPDU) {
if (requestPDU.size() == 0) {
throw new IllegalArgumentException("No declarative mib object.");
}
}
代码示例来源:origin: fbacchella/jrds
public SnmpVars(PDU data) {
super(data.size());
join(data);
}
代码示例来源:origin: OpenNMS/opennms
@Override
public int getPduLength() {
return getPdu().size();
}
代码示例来源:origin: org.opennms.core.snmp/org.opennms.core.snmp.implementations.snmp4j
@Override
public int getPduLength() {
return getPdu().size();
}
代码示例来源:origin: org.opennms.lib.snmp/org.opennms.lib.snmp.snmp4j
protected int getPduLength() {
return getPdu().size();
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public int size() {
return requestEvent.getPDU().size();
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public int size() {
return source.getPDU().size();
}
代码示例来源:origin: org.kaazing/snmp4j
protected static void printVariableBindings(PDU response) {
for (int i=0; i<response.size(); i++) {
VariableBinding vb = response.get(i);
System.out.println(vb.toString());
}
}
代码示例来源:origin: org.snmp4j/snmp4j
protected static void printVariableBindings(PDU response) {
for (int i = 0; i < response.size(); i++) {
VariableBinding vb = response.get(i);
out.println(vb.toString());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
protected static void printVariableBindings(PDU response) {
for (int i=0; i<response.size(); i++) {
VariableBinding vb = response.get(i);
System.out.println(vb.toString());
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public int getRepeaterCount() {
PDU reqPDU = source.getPDU();
return Math.max(reqPDU.size() - reqPDU.getNonRepeaters(), 0);
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public int getRepeaterCount() {
PDU reqPDU = requestEvent.getPDU();
return Math.max(reqPDU.size() - reqPDU.getNonRepeaters(), 0);
}
代码示例来源:origin: fbacchella/jrds
public void join(PDU data) {
for(int i = 0; i < data.size(); i++) {
VariableBinding vb = data.get(i);
addVariable(vb);
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
private void correctRequestValues() {
PDU request = requestEvent.getPDU();
if (!(request instanceof PDUv1)) {
if (request.getMaxRepetitions() < 0) {
request.setMaxRepetitions(0);
}
if (request.getNonRepeaters() < 0) {
request.setNonRepeaters(0);
}
repeaterStartIndex = request.getNonRepeaters();
repeaterRowSize =
Math.max(request.size() - repeaterStartIndex, 0);
}
else {
repeaterStartIndex = 0;
repeaterRowSize = request.size();
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
private SubRequestIterator<? extends SubRequest> repetitions(boolean noAppending) {
initSubRequests();
if (isBulkRequest()) {
int nonRepeaters = source.getPDU().getNonRepeaters();
int repeaters = source.getPDU().size() - nonRepeaters;
if (repeaters > 0) {
SnmpSubRequestIterator it =
new SnmpSubRequestIterator(Math.max(getIndex(), nonRepeaters), repeaters);
it.setNoAppending(noAppending);
return it;
}
}
return new SubRequestIteratorSupport<SubRequest>(Collections.EMPTY_LIST.iterator());
}
代码示例来源:origin: org.snmp4j/snmp4j
@Override
public void onResponse(ResponseEvent event) {
SnmpUriResponse response = new SnmpUriResponse(SnmpUriResponse.Type.TIMEOUT);
PDU responsePDU = event.getResponse();
if (responsePDU != null) {
if (responsePDU.getErrorStatus() != PDU.noError) {
response = new SnmpUriResponse(responsePDU.getErrorStatus());
}
else {
response = new SnmpUriResponse(
Collections.<VariableBinding[]>singletonList(
responsePDU.getVariableBindings().toArray(new VariableBinding[responsePDU.size()])));
}
}
callback.onResponse(response, url , event.getUserObject());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
@Override
public void onResponse(ResponseEvent event) {
SnmpUriResponse response = new SnmpUriResponse(SnmpUriResponse.Type.TIMEOUT);
PDU responsePDU = event.getResponse();
if (responsePDU != null) {
if (responsePDU.getErrorStatus() != PDU.noError) {
response = new SnmpUriResponse(responsePDU.getErrorStatus());
}
else {
response = new SnmpUriResponse(
Collections.<VariableBinding[]>singletonList(
responsePDU.getVariableBindings().toArray(new VariableBinding[responsePDU.size()])));
}
}
callback.onResponse(response, url , event.getUserObject());
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
private SubRequestIterator repetitions(boolean noAppending) {
initSubRequests();
if (isBulkRequest()) {
int repeaters = requestEvent.getPDU().size() -
requestEvent.getPDU().getNonRepeaters();
SnmpSubRequestIterator it =
new SnmpSubRequestIterator(getIndex(), repeaters);
it.setNoAppending(noAppending);
return it;
}
return new SubRequestIteratorSupport(Collections.EMPTY_LIST.iterator());
}
代码示例来源:origin: org.opennms.lib.snmp/org.opennms.lib.snmp.snmp4j
protected void sendNextPdu(WalkerPduBuilder pduBuilder) throws IOException {
Snmp4JPduBuilder snmp4JPduBuilder = (Snmp4JPduBuilder)pduBuilder;
if (m_session == null) {
m_session = m_agentConfig.createSnmpSession();
m_session.listen();
}
if (log().isDebugEnabled()) {
log().debug("Sending tracker pdu of size "+snmp4JPduBuilder.getPdu().size());
}
m_session.send(snmp4JPduBuilder.getPdu(), m_tgt, null, m_listener);
}
代码示例来源:origin: com.rogueai/snmp2bean
public PDU buildGetNextFirstEntryPDU(Class entryClass) {
PDU pdu = new PDU();
pdu.setType(PDU.GETNEXT);
Field[] propFields = SnmpServiceUtil.getPropFields(entryClass);
for (Field propField : propFields) {
MibObjectType mib = propField.getAnnotation(MibObjectType.class);
pdu.add(new VariableBinding(new OID(mib.oid())));
}
if (pdu.size() <= 0) {
Field[] indexFields = SnmpServiceUtil.getIndexFields(entryClass);
if (indexFields.length > 0) {
MibObjectType mot = indexFields[0].getAnnotation(MibObjectType.class);
pdu.add(new VariableBinding(new OID(mot.oid())));
}
}
return pdu;
}
内容来源于网络,如有侵权,请联系作者删除!