J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | |
| 27 | package com.sun.jmx.snmp.daemon; |
| 28 | |
| 29 | // java import |
| 30 | import java.util.Vector; |
| 31 | import java.io.IOException; |
| 32 | import java.net.InetAddress; |
| 33 | |
| 34 | // jmx imports |
| 35 | // |
| 36 | import com.sun.jmx.snmp.SnmpPduFactory; |
| 37 | import com.sun.jmx.snmp.SnmpStatusException; |
| 38 | import com.sun.jmx.snmp.SnmpVarBindList; |
| 39 | import com.sun.jmx.snmp.SnmpOid; |
| 40 | import com.sun.jmx.snmp.SnmpTimeticks; |
| 41 | import com.sun.jmx.snmp.SnmpIpAddress; |
| 42 | import com.sun.jmx.snmp.SnmpPduPacket; |
| 43 | import com.sun.jmx.snmp.InetAddressAcl; |
| 44 | import com.sun.jmx.snmp.SnmpPeer; |
| 45 | |
| 46 | // SNMP Runtime imports |
| 47 | // |
| 48 | import com.sun.jmx.snmp.agent.SnmpMibAgent; |
| 49 | import com.sun.jmx.snmp.agent.SnmpMibHandler; |
| 50 | import com.sun.jmx.snmp.agent.SnmpUserDataFactory; |
| 51 | |
| 52 | /** |
| 53 | * Exposes the remote management interface of the {@link SnmpAdaptorServer} MBean. |
| 54 | * <p><b>This API is a Sun Microsystems internal API and is subject |
| 55 | * to change without notice.</b></p> |
| 56 | */ |
| 57 | |
| 58 | public interface SnmpAdaptorServerMBean extends CommunicatorServerMBean { |
| 59 | |
| 60 | // GETTERS AND SETTERS |
| 61 | //-------------------- |
| 62 | |
| 63 | /** |
| 64 | * Returns the Ip address based ACL used by this SNMP protocol adaptor. |
| 65 | * @return The <CODE>InetAddressAcl</CODE> implementation. |
| 66 | * |
| 67 | * @since 1.5 |
| 68 | */ |
| 69 | public InetAddressAcl getInetAddressAcl(); |
| 70 | /** |
| 71 | * Returns the port used by this SNMP protocol adaptor for sending traps. |
| 72 | * By default, port 162 is used. |
| 73 | * |
| 74 | * @return The port number for sending SNMP traps. |
| 75 | */ |
| 76 | public Integer getTrapPort(); |
| 77 | |
| 78 | /** |
| 79 | * Sets the port used by this SNMP protocol adaptor for sending traps. |
| 80 | * |
| 81 | * @param port The port number for sending SNMP traps. |
| 82 | */ |
| 83 | public void setTrapPort(Integer port); |
| 84 | |
| 85 | /** |
| 86 | * Returns the port used by this SNMP protocol adaptor for sending inform requests. |
| 87 | * By default, port 162 is used. |
| 88 | * |
| 89 | * @return The port number for sending SNMP inform requests. |
| 90 | */ |
| 91 | public int getInformPort(); |
| 92 | |
| 93 | /** |
| 94 | * Sets the port used by this SNMP protocol adaptor for sending inform requests. |
| 95 | * |
| 96 | * @param port The port number for sending SNMP inform requests. |
| 97 | */ |
| 98 | public void setInformPort(int port); |
| 99 | |
| 100 | /** |
| 101 | * Gets the number of managers that have been processed by this SNMP protocol adaptor |
| 102 | * since its creation. |
| 103 | * |
| 104 | * @return The number of managers handled by this SNMP protocol adaptor |
| 105 | * since its creation. This counter is not reset by the <CODE>stop</CODE> method. |
| 106 | */ |
| 107 | public int getServedClientCount(); |
| 108 | |
| 109 | /** |
| 110 | * Gets the number of managers currently being processed by this |
| 111 | * SNMP protocol adaptor. |
| 112 | * |
| 113 | * @return The number of managers currently being processed by this |
| 114 | * SNMP protocol adaptor. |
| 115 | */ |
| 116 | public int getActiveClientCount(); |
| 117 | |
| 118 | /** |
| 119 | * Gets the maximum number of managers that this SNMP protocol adaptor can |
| 120 | * process concurrently. |
| 121 | * |
| 122 | * @return The maximum number of managers that this SNMP protocol adaptor can |
| 123 | * process concurrently. |
| 124 | */ |
| 125 | public int getMaxActiveClientCount(); |
| 126 | |
| 127 | /** |
| 128 | * Sets the maximum number of managers this SNMP protocol adaptor can |
| 129 | * process concurrently. |
| 130 | * |
| 131 | * @param c The number of managers. |
| 132 | * |
| 133 | * @exception java.lang.IllegalStateException This method has been invoked |
| 134 | * while the communicator was <CODE>ONLINE</CODE> or <CODE>STARTING</CODE>. |
| 135 | */ |
| 136 | public void setMaxActiveClientCount(int c) throws java.lang.IllegalStateException; |
| 137 | |
| 138 | /** |
| 139 | * Returns the protocol of this SNMP protocol adaptor. |
| 140 | * |
| 141 | * @return The string "snmp". |
| 142 | */ |
| 143 | public String getProtocol(); |
| 144 | |
| 145 | /** |
| 146 | * Returns the buffer size of this SNMP protocol adaptor. |
| 147 | * By default, buffer size 1024 is used. |
| 148 | * |
| 149 | * @return The buffer size. |
| 150 | */ |
| 151 | public Integer getBufferSize(); |
| 152 | |
| 153 | /** |
| 154 | * Sets the buffer size of this SNMP protocol adaptor. |
| 155 | * |
| 156 | * @param s The buffer size. |
| 157 | * |
| 158 | * @exception java.lang.IllegalStateException This method has been invoked |
| 159 | * while the communicator was <CODE>ONLINE</CODE> or <CODE>STARTING</CODE>. |
| 160 | */ |
| 161 | public void setBufferSize(Integer s) throws java.lang.IllegalStateException; |
| 162 | |
| 163 | /** |
| 164 | * Gets the number of times to try sending an inform request before giving up. |
| 165 | * @return The maximun number of tries. |
| 166 | */ |
| 167 | public int getMaxTries(); |
| 168 | |
| 169 | /** |
| 170 | * Changes the maximun number of times to try sending an inform request before giving up. |
| 171 | * @param newMaxTries The maximun number of tries. |
| 172 | */ |
| 173 | public void setMaxTries(int newMaxTries); |
| 174 | |
| 175 | /** |
| 176 | * Gets the timeout to wait for an inform response from the manager. |
| 177 | * @return The value of the timeout property. |
| 178 | */ |
| 179 | public int getTimeout(); |
| 180 | |
| 181 | /** |
| 182 | * Changes the timeout to wait for an inform response from the manager. |
| 183 | * @param newTimeout The timeout (in milliseconds). |
| 184 | */ |
| 185 | public void setTimeout(int newTimeout); |
| 186 | |
| 187 | /** |
| 188 | * Returns the message factory of this SNMP protocol adaptor. |
| 189 | * |
| 190 | * @return The factory object. |
| 191 | */ |
| 192 | public SnmpPduFactory getPduFactory(); |
| 193 | |
| 194 | /** |
| 195 | * Sets the message factory of this SNMP protocol adaptor. |
| 196 | * |
| 197 | * @param factory The factory object (null means the default factory). |
| 198 | */ |
| 199 | public void setPduFactory(SnmpPduFactory factory); |
| 200 | |
| 201 | |
| 202 | /** |
| 203 | * Set the user-data factory of this SNMP protocol adaptor. |
| 204 | * |
| 205 | * @param factory The factory object (null means no factory). |
| 206 | * @see com.sun.jmx.snmp.agent.SnmpUserDataFactory |
| 207 | */ |
| 208 | public void setUserDataFactory(SnmpUserDataFactory factory); |
| 209 | |
| 210 | /** |
| 211 | * Get the user-data factory associated with this SNMP protocol adaptor. |
| 212 | * |
| 213 | * @return The factory object (null means no factory). |
| 214 | * @see com.sun.jmx.snmp.agent.SnmpUserDataFactory |
| 215 | */ |
| 216 | public SnmpUserDataFactory getUserDataFactory(); |
| 217 | |
| 218 | /** |
| 219 | * Returns <CODE>true</CODE> if authentication traps are enabled. |
| 220 | * <P> |
| 221 | * When this feature is enabled, the SNMP protocol adaptor sends |
| 222 | * an <CODE>authenticationFailure</CODE> trap each time an authentication fails. |
| 223 | * <P> |
| 224 | * The default behaviour is to send authentication traps. |
| 225 | * |
| 226 | * @return <CODE>true</CODE> if authentication traps are enabled, <CODE>false</CODE> otherwise. |
| 227 | */ |
| 228 | public boolean getAuthTrapEnabled(); |
| 229 | |
| 230 | /** |
| 231 | * Sets the flag indicating if traps need to be sent in case of authentication failure. |
| 232 | * |
| 233 | * @param enabled Flag indicating if traps need to be sent. |
| 234 | */ |
| 235 | public void setAuthTrapEnabled(boolean enabled); |
| 236 | |
| 237 | /** |
| 238 | * Returns <code>true</code> if this SNMP protocol adaptor sends a response in case |
| 239 | * of authentication failure. |
| 240 | * <P> |
| 241 | * When this feature is enabled, the SNMP protocol adaptor sends a response with <CODE>noSuchName</CODE> |
| 242 | * or <CODE>readOnly</CODE> when the authentication failed. If the flag is disabled, the |
| 243 | * SNMP protocol adaptor trashes the PDU silently. |
| 244 | * <P> |
| 245 | * The default behavior is to send responses. |
| 246 | * |
| 247 | * @return <code>true</code> if responses are sent. |
| 248 | */ |
| 249 | public boolean getAuthRespEnabled(); |
| 250 | |
| 251 | /** |
| 252 | * Sets the flag indicating if responses need to be sent in case of authentication failure. |
| 253 | * |
| 254 | * @param enabled Flag indicating if responses need to be sent. |
| 255 | */ |
| 256 | public void setAuthRespEnabled(boolean enabled); |
| 257 | |
| 258 | /** |
| 259 | * Returns the enterprise OID. It is used by {@link #snmpV1Trap snmpV1Trap} to fill |
| 260 | * the 'enterprise' field of the trap request. |
| 261 | * |
| 262 | * @return The OID in string format "x.x.x.x". |
| 263 | */ |
| 264 | public String getEnterpriseOid(); |
| 265 | |
| 266 | /** |
| 267 | * Sets the enterprise OID. |
| 268 | * |
| 269 | * @param oid The OID in string format "x.x.x.x". |
| 270 | * |
| 271 | * @exception IllegalArgumentException The string format is incorrect |
| 272 | */ |
| 273 | public void setEnterpriseOid(String oid) throws IllegalArgumentException; |
| 274 | |
| 275 | /** |
| 276 | * Returns the names of the MIBs available in this SNMP protocol adaptor. |
| 277 | * |
| 278 | * @return An array of MIB names. |
| 279 | */ |
| 280 | public String[] getMibs(); |
| 281 | |
| 282 | // GETTERS FOR SNMP GROUP (MIBII) |
| 283 | //------------------------------- |
| 284 | |
| 285 | /** |
| 286 | * Returns the <CODE>snmpOutTraps</CODE> value defined in MIB-II. |
| 287 | * |
| 288 | * @return The <CODE>snmpOutTraps</CODE> value. |
| 289 | */ |
| 290 | public Long getSnmpOutTraps(); |
| 291 | |
| 292 | /** |
| 293 | * Returns the <CODE>snmpOutGetResponses</CODE> value defined in MIB-II. |
| 294 | * |
| 295 | * @return The <CODE>snmpOutGetResponses</CODE> value. |
| 296 | */ |
| 297 | public Long getSnmpOutGetResponses(); |
| 298 | |
| 299 | /** |
| 300 | * Returns the <CODE>snmpOutGenErrs</CODE> value defined in MIB-II. |
| 301 | * |
| 302 | * @return The <CODE>snmpOutGenErrs</CODE> value. |
| 303 | */ |
| 304 | public Long getSnmpOutGenErrs(); |
| 305 | |
| 306 | /** |
| 307 | * Returns the <CODE>snmpOutBadValues</CODE> value defined in MIB-II. |
| 308 | * |
| 309 | * @return The <CODE>snmpOutBadValues</CODE> value. |
| 310 | */ |
| 311 | public Long getSnmpOutBadValues(); |
| 312 | |
| 313 | /** |
| 314 | * Returns the <CODE>snmpOutNoSuchNames</CODE> value defined in MIB-II. |
| 315 | * |
| 316 | * @return The <CODE>snmpOutNoSuchNames</CODE> value. |
| 317 | */ |
| 318 | public Long getSnmpOutNoSuchNames(); |
| 319 | |
| 320 | /** |
| 321 | * Returns the <CODE>snmpOutTooBigs</CODE> value defined in MIB-II. |
| 322 | * |
| 323 | * @return The <CODE>snmpOutTooBigs</CODE> value. |
| 324 | */ |
| 325 | public Long getSnmpOutTooBigs(); |
| 326 | |
| 327 | /** |
| 328 | * Returns the <CODE>snmpInASNParseErrs</CODE> value defined in MIB-II. |
| 329 | * |
| 330 | * @return The <CODE>snmpInASNParseErrs</CODE> value. |
| 331 | */ |
| 332 | public Long getSnmpInASNParseErrs(); |
| 333 | |
| 334 | /** |
| 335 | * Returns the <CODE>snmpInBadCommunityUses</CODE> value defined in MIB-II. |
| 336 | * |
| 337 | * @return The <CODE>snmpInBadCommunityUses</CODE> value. |
| 338 | */ |
| 339 | public Long getSnmpInBadCommunityUses(); |
| 340 | |
| 341 | /** |
| 342 | * Returns the <CODE>snmpInBadCommunityNames</CODE> value defined in MIB-II. |
| 343 | * |
| 344 | * @return The <CODE>snmpInBadCommunityNames</CODE> value. |
| 345 | */ |
| 346 | public Long getSnmpInBadCommunityNames(); |
| 347 | |
| 348 | /** |
| 349 | * Returns the <CODE>snmpInBadVersions</CODE> value defined in MIB-II. |
| 350 | * |
| 351 | * @return The <CODE>snmpInBadVersions</CODE> value. |
| 352 | */ |
| 353 | public Long getSnmpInBadVersions(); |
| 354 | |
| 355 | /** |
| 356 | * Returns the <CODE>snmpOutPkts</CODE> value defined in MIB-II. |
| 357 | * |
| 358 | * @return The <CODE>snmpOutPkts</CODE> value. |
| 359 | */ |
| 360 | public Long getSnmpOutPkts(); |
| 361 | |
| 362 | /** |
| 363 | * Returns the <CODE>snmpInPkts</CODE> value defined in MIB-II. |
| 364 | * |
| 365 | * @return The <CODE>snmpInPkts</CODE> value. |
| 366 | */ |
| 367 | public Long getSnmpInPkts(); |
| 368 | |
| 369 | /** |
| 370 | * Returns the <CODE>snmpInGetRequests</CODE> value defined in MIB-II. |
| 371 | * |
| 372 | * @return The <CODE>snmpInGetRequests</CODE> value. |
| 373 | */ |
| 374 | public Long getSnmpInGetRequests(); |
| 375 | |
| 376 | /** |
| 377 | * Returns the <CODE>snmpInGetNexts</CODE> value defined in MIB-II. |
| 378 | * |
| 379 | * @return The <CODE>snmpInGetNexts</CODE> value. |
| 380 | */ |
| 381 | public Long getSnmpInGetNexts(); |
| 382 | |
| 383 | /** |
| 384 | * Returns the <CODE>snmpInSetRequests</CODE> value defined in MIB-II. |
| 385 | * |
| 386 | * @return The <CODE>snmpInSetRequests</CODE> value. |
| 387 | */ |
| 388 | public Long getSnmpInSetRequests(); |
| 389 | |
| 390 | /** |
| 391 | * Returns the <CODE>snmpInTotalSetVars</CODE> value defined in MIB-II. |
| 392 | * |
| 393 | * @return The <CODE>snmpInTotalSetVars</CODE> value. |
| 394 | */ |
| 395 | public Long getSnmpInTotalSetVars(); |
| 396 | |
| 397 | /** |
| 398 | * Returns the <CODE>snmpInTotalReqVars</CODE> value defined in MIB-II. |
| 399 | * |
| 400 | * @return The <CODE>snmpInTotalReqVars</CODE> value. |
| 401 | */ |
| 402 | public Long getSnmpInTotalReqVars(); |
| 403 | |
| 404 | /** |
| 405 | * Returns the <CODE>snmpSilentDrops</CODE> value defined in rfc 1907 NMPv2-MIB . |
| 406 | * |
| 407 | * @return The <CODE>snmpSilentDrops</CODE> value. |
| 408 | * |
| 409 | * @since 1.5 |
| 410 | */ |
| 411 | public Long getSnmpSilentDrops(); |
| 412 | |
| 413 | /** |
| 414 | * Returns the <CODE>snmpProxyDrops</CODE> value defined in rfc 1907 NMPv2-MIB . |
| 415 | * |
| 416 | * @return The <CODE>snmpProxyDrops</CODE> value. |
| 417 | * |
| 418 | * @since 1.5 |
| 419 | */ |
| 420 | public Long getSnmpProxyDrops(); |
| 421 | |
| 422 | // PUBLIC METHODS |
| 423 | //--------------- |
| 424 | |
| 425 | /** |
| 426 | * Adds a new MIB in the SNMP MIB handler. |
| 427 | * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} |
| 428 | * and {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} |
| 429 | * and should not be called directly. |
| 430 | * |
| 431 | * @param mib The MIB to add. |
| 432 | * |
| 433 | * @return A reference to the SNMP MIB handler. |
| 434 | * |
| 435 | * @exception IllegalArgumentException If the parameter is null. |
| 436 | */ |
| 437 | public SnmpMibHandler addMib(SnmpMibAgent mib) throws IllegalArgumentException; |
| 438 | |
| 439 | /** |
| 440 | * Adds a new MIB in the SNMP MIB handler. |
| 441 | * |
| 442 | * @param mib The MIB to add. |
| 443 | * @param oids The set of OIDs this agent implements. |
| 444 | * |
| 445 | * @return A reference to the SNMP MIB handler. |
| 446 | * |
| 447 | * @exception IllegalArgumentException If the parameter is null. |
| 448 | * |
| 449 | * @since 1.5 |
| 450 | */ |
| 451 | public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) throws IllegalArgumentException; |
| 452 | |
| 453 | /** |
| 454 | * Removes the specified MIB from the SNMP protocol adaptor. |
| 455 | * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} |
| 456 | * and {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} |
| 457 | * and should not be called directly. |
| 458 | * |
| 459 | * @param mib The MIB to be removed. |
| 460 | * |
| 461 | * @return <code>true</code> if the specified <CODE>mib</CODE> was a MIB included in the SNMP MIB handler, |
| 462 | * <code>false</code> otherwise. |
| 463 | */ |
| 464 | public boolean removeMib(SnmpMibAgent mib); |
| 465 | |
| 466 | /** |
| 467 | * Sends a trap using SNMP V1 trap format. |
| 468 | * <BR>The trap is sent to each destination defined in the ACL file (if available). |
| 469 | * If no ACL file or no destinations are available, the trap is sent to the local host. |
| 470 | * |
| 471 | * @param generic The generic number of the trap. |
| 472 | * @param specific The specific number of the trap. |
| 473 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 474 | * |
| 475 | * @exception IOException An I/O error occured while sending the trap. |
| 476 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 477 | */ |
| 478 | public void snmpV1Trap(int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException; |
| 479 | |
| 480 | |
| 481 | /** |
| 482 | * Sends a trap using SNMP V1 trap format. |
| 483 | * <BR>The trap is sent to the specified <CODE>InetAddress</CODE> destination |
| 484 | * using the specified community string (and the ACL file is not used). |
| 485 | * |
| 486 | * @param address The <CODE>InetAddress</CODE> destination of the trap. |
| 487 | * @param cs The community string to be used for the trap. |
| 488 | * @param generic The generic number of the trap. |
| 489 | * @param specific The specific number of the trap. |
| 490 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 491 | * |
| 492 | * @exception IOException An I/O error occurred while sending the trap. |
| 493 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 494 | */ |
| 495 | public void snmpV1Trap(InetAddress address, String cs, int generic, int specific, SnmpVarBindList varBindList) |
| 496 | throws IOException, SnmpStatusException; |
| 497 | |
| 498 | |
| 499 | /** |
| 500 | * Sends a trap using SNMP V1 trap format. |
| 501 | * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination. |
| 502 | * The community string used is the one located in the <CODE>SnmpPeer</CODE> parameters (<CODE>SnmpParameters.getRdCommunity() </CODE>). |
| 503 | * |
| 504 | * @param peer The <CODE>SnmpPeer</CODE> destination of the trap. |
| 505 | * @param agentAddr The agent address to be used for the trap. |
| 506 | * @param enterpOid The enterprise OID to be used for the trap. |
| 507 | * @param generic The generic number of the trap. |
| 508 | * @param specific The specific number of the trap. |
| 509 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 510 | * @param time The time stamp (overwrite the current time). |
| 511 | * |
| 512 | * @exception IOException An I/O error occurred while sending the trap. |
| 513 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 514 | * |
| 515 | * @since 1.5 |
| 516 | */ |
| 517 | public void snmpV1Trap(SnmpPeer peer, |
| 518 | SnmpIpAddress agentAddr, |
| 519 | SnmpOid enterpOid, |
| 520 | int generic, |
| 521 | int specific, |
| 522 | SnmpVarBindList varBindList, |
| 523 | SnmpTimeticks time) throws IOException, SnmpStatusException; |
| 524 | |
| 525 | /** |
| 526 | * Sends a trap using SNMP V2 trap format. |
| 527 | * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination. |
| 528 | * <BR>The community string used is the one located in the <CODE>SnmpPeer</CODE> parameters (<CODE>SnmpParameters.getRdCommunity() </CODE>). |
| 529 | * <BR>The variable list included in the outgoing trap is composed of the following items: |
| 530 | * <UL> |
| 531 | * <LI><CODE>sysUpTime.0</CODE> with the value specified by <CODE>time</CODE> |
| 532 | * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> |
| 533 | * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> |
| 534 | * </UL> |
| 535 | * |
| 536 | * @param peer The <CODE>SnmpPeer</CODE> destination of the trap. |
| 537 | * @param trapOid The OID identifying the trap. |
| 538 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 539 | * @param time The time stamp (overwrite the current time). |
| 540 | * |
| 541 | * @exception IOException An I/O error occurred while sending the trap. |
| 542 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 543 | * |
| 544 | * @since 1.5 |
| 545 | */ |
| 546 | public void snmpV2Trap(SnmpPeer peer, |
| 547 | SnmpOid trapOid, |
| 548 | SnmpVarBindList varBindList, |
| 549 | SnmpTimeticks time) throws IOException, SnmpStatusException; |
| 550 | |
| 551 | /** |
| 552 | * Sends a trap using SNMP V2 trap format. |
| 553 | * <BR>The trap is sent to each destination defined in the ACL file (if available). |
| 554 | * If no ACL file or no destinations are available, the trap is sent to the local host. |
| 555 | * <BR>The variable list included in the outgoing trap is composed of the following items: |
| 556 | * <UL> |
| 557 | * <LI><CODE>sysUpTime.0</CODE> with its current value |
| 558 | * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> |
| 559 | * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> |
| 560 | * </UL> |
| 561 | * |
| 562 | * @param trapOid The OID identifying the trap. |
| 563 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 564 | * |
| 565 | * @exception IOException An I/O error occured while sending the trap. |
| 566 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 567 | */ |
| 568 | public void snmpV2Trap(SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException; |
| 569 | |
| 570 | |
| 571 | /** |
| 572 | * Sends a trap using SNMP V2 trap format. |
| 573 | * <BR>The trap is sent to the specified <CODE>InetAddress</CODE> destination |
| 574 | * using the specified community string (and the ACL file is not used). |
| 575 | * <BR>The variable list included in the outgoing trap is composed of the following items: |
| 576 | * <UL> |
| 577 | * <LI><CODE>sysUpTime.0</CODE> with its current value |
| 578 | * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> |
| 579 | * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> |
| 580 | * </UL> |
| 581 | * |
| 582 | * @param address The <CODE>InetAddress</CODE> destination of the trap. |
| 583 | * @param cs The community string to be used for the trap. |
| 584 | * @param trapOid The OID identifying the trap. |
| 585 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 586 | * |
| 587 | * @exception IOException An I/O error occurred while sending the trap. |
| 588 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 589 | */ |
| 590 | public void snmpV2Trap(InetAddress address, String cs, SnmpOid trapOid, SnmpVarBindList varBindList) |
| 591 | throws IOException, SnmpStatusException; |
| 592 | |
| 593 | /** |
| 594 | * Send the specified trap PDU to the passed <CODE>InetAddress</CODE>. |
| 595 | * @param address The destination address. |
| 596 | * @param pdu The pdu to send. |
| 597 | * @exception IOException An I/O error occurred while sending the trap. |
| 598 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 599 | * |
| 600 | * @since 1.5 |
| 601 | */ |
| 602 | public void snmpPduTrap(InetAddress address, SnmpPduPacket pdu) |
| 603 | throws IOException, SnmpStatusException; |
| 604 | /** |
| 605 | * Send the specified trap PDU to the passed <CODE>SnmpPeer</CODE>. |
| 606 | * @param peer The destination peer. The Read community string is used of <CODE>SnmpParameters</CODE> is used as the trap community string. |
| 607 | * @param pdu The pdu to send. |
| 608 | * @exception IOException An I/O error occurred while sending the trap. |
| 609 | * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 610 | * @since 1.5 |
| 611 | */ |
| 612 | public void snmpPduTrap(SnmpPeer peer, |
| 613 | SnmpPduPacket pdu) |
| 614 | throws IOException, SnmpStatusException; |
| 615 | |
| 616 | /** |
| 617 | * Sends an inform using SNMP V2 inform request format. |
| 618 | * <BR>The inform request is sent to each destination defined in the ACL file (if available). |
| 619 | * If no ACL file or no destinations are available, the inform request is sent to the local host. |
| 620 | * <BR>The variable list included in the outgoing inform request is composed of the following items: |
| 621 | * <UL> |
| 622 | * <LI><CODE>sysUpTime.0</CODE> with its current value |
| 623 | * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> |
| 624 | * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> |
| 625 | * </UL> |
| 626 | * To send an inform request, the SNMP adaptor server must be active. |
| 627 | * |
| 628 | * @param cb The callback that is invoked when a request is complete. |
| 629 | * @param trapOid The OID identifying the trap. |
| 630 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 631 | * |
| 632 | * @return A vector of {@link com.sun.jmx.snmp.daemon.SnmpInformRequest} objects. |
| 633 | * <P>If there is no destination host for this inform request, the returned vector will be empty. |
| 634 | * |
| 635 | * @exception IllegalStateException This method has been invoked while the SNMP adaptor server was not active. |
| 636 | * @exception IOException An I/O error occurred while sending the inform request. |
| 637 | * @exception SnmpStatusException If the inform request exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 638 | */ |
| 639 | public Vector snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList) |
| 640 | throws IllegalStateException, IOException, SnmpStatusException; |
| 641 | |
| 642 | /** |
| 643 | * Sends an inform using SNMP V2 inform request format. |
| 644 | * <BR>The inform is sent to the specified <CODE>InetAddress</CODE> destination |
| 645 | * using the specified community string. |
| 646 | * <BR>The variable list included in the outgoing inform request is composed of the following items: |
| 647 | * <UL> |
| 648 | * <LI><CODE>sysUpTime.0</CODE> with its current value |
| 649 | * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> |
| 650 | * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> |
| 651 | * </UL> |
| 652 | * To send an inform request, the SNMP adaptor server must be active. |
| 653 | * |
| 654 | * @param address The <CODE>InetAddress</CODE> destination for this inform request. |
| 655 | * @param cs The community string to be used for the inform request. |
| 656 | * @param cb The callback that is invoked when a request is complete. |
| 657 | * @param trapOid The OID identifying the trap. |
| 658 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 659 | * |
| 660 | * @return The inform request object. |
| 661 | * |
| 662 | * @exception IllegalStateException This method has been invoked while the SNMP adaptor server was not active. |
| 663 | * @exception IOException An I/O error occurred while sending the inform request. |
| 664 | * @exception SnmpStatusException If the inform request exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 665 | */ |
| 666 | public SnmpInformRequest snmpInformRequest(InetAddress address, String cs, SnmpInformHandler cb, |
| 667 | SnmpOid trapOid, SnmpVarBindList varBindList) |
| 668 | throws IllegalStateException, IOException, SnmpStatusException; |
| 669 | |
| 670 | |
| 671 | /** |
| 672 | * Sends an inform using SNMP V2 inform request format. |
| 673 | * <BR>The inform is sent to the specified <CODE>SnmpPeer</CODE> destination. |
| 674 | * <BR> The community string used is the one located in the <CODE>SnmpPeer</CODE> parameters (<CODE>SnmpParameters.getInformCommunity() </CODE>). |
| 675 | * <BR>The variable list included in the outgoing inform is composed of the following items: |
| 676 | * <UL> |
| 677 | * <LI><CODE>sysUpTime.0</CODE> with its current value |
| 678 | * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> |
| 679 | * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> |
| 680 | * </UL> |
| 681 | * To send an inform request, the SNMP adaptor server must be active. |
| 682 | * |
| 683 | * @param peer The <CODE>SnmpPeer</CODE> destination for this inform request. |
| 684 | * @param cb The callback that is invoked when a request is complete. |
| 685 | * @param trapOid The OID identifying the trap. |
| 686 | * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. |
| 687 | * |
| 688 | * @return The inform request object. |
| 689 | * |
| 690 | * @exception IllegalStateException This method has been invoked while the SNMP adaptor server was not active. |
| 691 | * @exception IOException An I/O error occurred while sending the inform request. |
| 692 | * @exception SnmpStatusException If the inform request exceeds the limit defined by <CODE>bufferSize</CODE>. |
| 693 | * |
| 694 | * @since 1.5 |
| 695 | */ |
| 696 | public SnmpInformRequest snmpInformRequest(SnmpPeer peer, |
| 697 | SnmpInformHandler cb, |
| 698 | SnmpOid trapOid, |
| 699 | SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException; |
| 700 | } |