1 20 21 package org.snmp4j; 22 23 import java.util.EventObject ; 24 import org.snmp4j.mp.StateReference; 25 import org.snmp4j.smi.Address; 26 import org.snmp4j.mp.PduHandle; 27 import org.snmp4j.smi.OctetString; 28 29 37 public class CommandResponderEvent extends EventObject { 38 39 private static final long serialVersionUID = 1969372060103366769L; 40 41 private int securityModel; 42 private int securityLevel; 43 private int maxSizeResponsePDU; 44 private PduHandle pduHandle; 45 private StateReference stateReference; 46 private PDU pdu; 47 private int messageProcessingModel; 48 private byte[] securityName; 49 private boolean processed; 50 private Address peerAddress; 51 private transient TransportMapping transportMapping; 52 53 79 public CommandResponderEvent(MessageDispatcher messageDispatcher, 80 TransportMapping transportMapping, 81 Address sourceAddress, 82 int messageProcessingModel, 83 int securityModel, 84 byte[] securityName, 85 int securityLevel, 86 PduHandle pduHandle, 87 PDU pdu, 88 int maxSizeResponseScopedPDU, 89 StateReference stateReference) { 90 super(messageDispatcher); 91 setTransportMapping(transportMapping); 92 setMessageProcessingModel(messageProcessingModel); 93 setSecurityModel(securityModel); 94 setSecurityName(securityName); 95 setSecurityLevel(securityLevel); 96 setPduHandle(pduHandle); 97 setPDU(pdu); 98 setMaxSizeResponsePDU(maxSizeResponseScopedPDU); 99 setStateReference(stateReference); 100 setPeerAddress(sourceAddress); 101 } 102 103 113 public CommandResponderEvent(Object source, CommandResponderEvent other) { 114 super(source); 115 setTransportMapping(other.transportMapping); 116 setMessageProcessingModel(other.messageProcessingModel); 117 setSecurityModel(other.securityModel); 118 setSecurityName(other.securityName); 119 setSecurityLevel(other.securityLevel); 120 setPduHandle(other.pduHandle); 121 setPDU(other.pdu); 122 setMaxSizeResponsePDU(other.maxSizeResponsePDU); 123 setStateReference(other.stateReference); 124 setPeerAddress(other.getPeerAddress()); 125 } 126 127 133 public MessageDispatcher getMessageDispatcher() { 134 return (MessageDispatcher)super.getSource(); 135 } 136 137 141 public int getSecurityModel() { 142 return securityModel; 143 } 144 public void setSecurityModel(int securityModel) { 145 this.securityModel = securityModel; 146 } 147 public void setSecurityLevel(int securityLevel) { 148 this.securityLevel = securityLevel; 149 } 150 public int getSecurityLevel() { 151 return securityLevel; 152 } 153 public void setMaxSizeResponsePDU(int maxSizeResponsePDU) { 154 this.maxSizeResponsePDU = maxSizeResponsePDU; 155 } 156 public int getMaxSizeResponsePDU() { 157 return maxSizeResponsePDU; 158 } 159 public void setPduHandle(org.snmp4j.mp.PduHandle pduHandle) { 160 this.pduHandle = pduHandle; 161 } 162 public PduHandle getPduHandle() { 163 return pduHandle; 164 } 165 public void setStateReference(org.snmp4j.mp.StateReference stateReference) { 166 this.stateReference = stateReference; 167 } 168 public org.snmp4j.mp.StateReference getStateReference() { 169 return stateReference; 170 } 171 public void setPDU(PDU pdu) { 172 this.pdu = pdu; 173 } 174 public PDU getPDU() { 175 return pdu; 176 } 177 public void setMessageProcessingModel(int messageProcessingModel) { 178 this.messageProcessingModel = messageProcessingModel; 179 } 180 public int getMessageProcessingModel() { 181 return messageProcessingModel; 182 } 183 public void setSecurityName(byte[] securityName) { 184 this.securityName = securityName; 185 } 186 public byte[] getSecurityName() { 187 return securityName; 188 } 189 190 197 public void setProcessed(boolean processed) { 198 this.processed = processed; 199 } 200 201 207 public boolean isProcessed() { 208 return processed; 209 } 210 211 216 public Address getPeerAddress() { 217 return peerAddress; 218 } 219 220 226 public TransportMapping getTransportMapping() { 227 return transportMapping; 228 } 229 230 235 public void setPeerAddress(Address peerAddress) { 236 this.peerAddress = peerAddress; 237 } 238 239 protected void setTransportMapping(TransportMapping transportMapping) { 240 this.transportMapping = transportMapping; 241 } 242 243 public String toString() { 244 StringBuffer buf = new StringBuffer (); 245 buf.append("CommandResponderEvent["); 246 buf.append("transportMapping="); 247 buf.append(transportMapping); 248 buf.append("peerAddress="); 249 buf.append(peerAddress); 250 buf.append(", processed="); 251 buf.append(processed); 252 buf.append(", pdu=["); 253 buf.append(pdu); 254 buf.append("], securityName="); 255 buf.append(new OctetString(securityName)); 256 buf.append(", securityModel="); 257 buf.append(securityModel); 258 buf.append(", securityLevel="); 259 buf.append(securityLevel); 260 buf.append("]"); 261 return buf.toString(); 262 } 263 } 264 265 | Popular Tags |