1 22 23 package org.snmp4j.agent.agentx; 24 25 import java.nio.ByteBuffer ; 26 import java.io.IOException ; 27 import org.snmp4j.agent.MOScope; 28 import org.snmp4j.smi.OctetString; 29 30 public class AgentXGetBulkPDU extends AgentXRequestPDU { 31 32 protected short maxRepetitions; 33 protected short nonRepeaters; 34 35 public AgentXGetBulkPDU(OctetString context, 36 short maxRepetitions, 37 short nonRepeaters, 38 MOScope[] ranges) { 39 super(AGENTX_GETBULK_PDU, context, ranges); 40 this.maxRepetitions = maxRepetitions; 41 this.nonRepeaters = nonRepeaters; 42 } 43 44 public AgentXGetBulkPDU(AgentXMessageHeader header) { 45 super(header); 46 if (header.getType() != AGENTX_GETBULK_PDU) { 47 throw new IllegalArgumentException (); 48 } 49 } 50 51 public short getMaxRepetitions() { 52 return maxRepetitions; 53 } 54 55 public short getNonRepeaters() { 56 return nonRepeaters; 57 } 58 59 public void setMaxRepetitions(short maxRepetitions) { 60 this.maxRepetitions = maxRepetitions; 61 } 62 63 public void setNonRepeaters(short nonRepeaters) { 64 this.nonRepeaters = nonRepeaters; 65 } 66 67 protected void decodeAfterContext(ByteBuffer buf, int length) throws IOException { 68 nonRepeaters = buf.getShort(); 69 maxRepetitions = buf.getShort(); 70 super.decodeAfterContext(buf, length); 71 } 72 73 protected void encodeAfterContext(ByteBuffer buf) { 74 buf.putShort(nonRepeaters); 75 buf.putShort(maxRepetitions); 76 super.encodeAfterContext(buf); 77 } 78 79 protected int getAfterContextLength() { 80 return AgentXProtocol.AGENTX_INT_SIZE + super.getAfterContextLength(); 81 } 82 83 protected String toStringExtMembers() { 84 return super.toStringExtMembers()+",nonRepeaters="+nonRepeaters+ 85 ",maxRepetitions="+maxRepetitions; 86 } 87 88 } 89 | Popular Tags |