1 /* 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. 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. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * 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 */ getInetAddressAcl()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 */ getTrapPort()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 */ setTrapPort(Integer port)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 */ getInformPort()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 */ setInformPort(int port)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 */ getServedClientCount()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 */ getActiveClientCount()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 */ getMaxActiveClientCount()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 */ setMaxActiveClientCount(int c)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 @Override getProtocol()144 public String getProtocol(); 145 146 /** 147 * Returns the buffer size of this SNMP protocol adaptor. 148 * By default, buffer size 1024 is used. 149 * 150 * @return The buffer size. 151 */ getBufferSize()152 public Integer getBufferSize(); 153 154 /** 155 * Sets the buffer size of this SNMP protocol adaptor. 156 * 157 * @param s The buffer size. 158 * 159 * @exception java.lang.IllegalStateException This method has been invoked 160 * while the communicator was <CODE>ONLINE</CODE> or <CODE>STARTING</CODE>. 161 */ setBufferSize(Integer s)162 public void setBufferSize(Integer s) throws java.lang.IllegalStateException; 163 164 /** 165 * Gets the number of times to try sending an inform request before giving up. 166 * @return The maximun number of tries. 167 */ getMaxTries()168 public int getMaxTries(); 169 170 /** 171 * Changes the maximun number of times to try sending an inform request before giving up. 172 * @param newMaxTries The maximun number of tries. 173 */ setMaxTries(int newMaxTries)174 public void setMaxTries(int newMaxTries); 175 176 /** 177 * Gets the timeout to wait for an inform response from the manager. 178 * @return The value of the timeout property. 179 */ getTimeout()180 public int getTimeout(); 181 182 /** 183 * Changes the timeout to wait for an inform response from the manager. 184 * @param newTimeout The timeout (in milliseconds). 185 */ setTimeout(int newTimeout)186 public void setTimeout(int newTimeout); 187 188 /** 189 * Returns the message factory of this SNMP protocol adaptor. 190 * 191 * @return The factory object. 192 */ getPduFactory()193 public SnmpPduFactory getPduFactory(); 194 195 /** 196 * Sets the message factory of this SNMP protocol adaptor. 197 * 198 * @param factory The factory object (null means the default factory). 199 */ setPduFactory(SnmpPduFactory factory)200 public void setPduFactory(SnmpPduFactory factory); 201 202 203 /** 204 * Set the user-data factory of this SNMP protocol adaptor. 205 * 206 * @param factory The factory object (null means no factory). 207 * @see com.sun.jmx.snmp.agent.SnmpUserDataFactory 208 */ setUserDataFactory(SnmpUserDataFactory factory)209 public void setUserDataFactory(SnmpUserDataFactory factory); 210 211 /** 212 * Get the user-data factory associated with this SNMP protocol adaptor. 213 * 214 * @return The factory object (null means no factory). 215 * @see com.sun.jmx.snmp.agent.SnmpUserDataFactory 216 */ getUserDataFactory()217 public SnmpUserDataFactory getUserDataFactory(); 218 219 /** 220 * Returns <CODE>true</CODE> if authentication traps are enabled. 221 * <P> 222 * When this feature is enabled, the SNMP protocol adaptor sends 223 * an <CODE>authenticationFailure</CODE> trap each time an authentication fails. 224 * <P> 225 * The default behaviour is to send authentication traps. 226 * 227 * @return <CODE>true</CODE> if authentication traps are enabled, <CODE>false</CODE> otherwise. 228 */ getAuthTrapEnabled()229 public boolean getAuthTrapEnabled(); 230 231 /** 232 * Sets the flag indicating if traps need to be sent in case of authentication failure. 233 * 234 * @param enabled Flag indicating if traps need to be sent. 235 */ setAuthTrapEnabled(boolean enabled)236 public void setAuthTrapEnabled(boolean enabled); 237 238 /** 239 * Returns <code>true</code> if this SNMP protocol adaptor sends a response in case 240 * of authentication failure. 241 * <P> 242 * When this feature is enabled, the SNMP protocol adaptor sends a response with <CODE>noSuchName</CODE> 243 * or <CODE>readOnly</CODE> when the authentication failed. If the flag is disabled, the 244 * SNMP protocol adaptor trashes the PDU silently. 245 * <P> 246 * The default behavior is to send responses. 247 * 248 * @return <code>true</code> if responses are sent. 249 */ getAuthRespEnabled()250 public boolean getAuthRespEnabled(); 251 252 /** 253 * Sets the flag indicating if responses need to be sent in case of authentication failure. 254 * 255 * @param enabled Flag indicating if responses need to be sent. 256 */ setAuthRespEnabled(boolean enabled)257 public void setAuthRespEnabled(boolean enabled); 258 259 /** 260 * Returns the enterprise OID. It is used by {@link #snmpV1Trap snmpV1Trap} to fill 261 * the 'enterprise' field of the trap request. 262 * 263 * @return The OID in string format "x.x.x.x". 264 */ getEnterpriseOid()265 public String getEnterpriseOid(); 266 267 /** 268 * Sets the enterprise OID. 269 * 270 * @param oid The OID in string format "x.x.x.x". 271 * 272 * @exception IllegalArgumentException The string format is incorrect 273 */ setEnterpriseOid(String oid)274 public void setEnterpriseOid(String oid) throws IllegalArgumentException; 275 276 /** 277 * Returns the names of the MIBs available in this SNMP protocol adaptor. 278 * 279 * @return An array of MIB names. 280 */ getMibs()281 public String[] getMibs(); 282 283 // GETTERS FOR SNMP GROUP (MIBII) 284 //------------------------------- 285 286 /** 287 * Returns the <CODE>snmpOutTraps</CODE> value defined in MIB-II. 288 * 289 * @return The <CODE>snmpOutTraps</CODE> value. 290 */ getSnmpOutTraps()291 public Long getSnmpOutTraps(); 292 293 /** 294 * Returns the <CODE>snmpOutGetResponses</CODE> value defined in MIB-II. 295 * 296 * @return The <CODE>snmpOutGetResponses</CODE> value. 297 */ getSnmpOutGetResponses()298 public Long getSnmpOutGetResponses(); 299 300 /** 301 * Returns the <CODE>snmpOutGenErrs</CODE> value defined in MIB-II. 302 * 303 * @return The <CODE>snmpOutGenErrs</CODE> value. 304 */ getSnmpOutGenErrs()305 public Long getSnmpOutGenErrs(); 306 307 /** 308 * Returns the <CODE>snmpOutBadValues</CODE> value defined in MIB-II. 309 * 310 * @return The <CODE>snmpOutBadValues</CODE> value. 311 */ getSnmpOutBadValues()312 public Long getSnmpOutBadValues(); 313 314 /** 315 * Returns the <CODE>snmpOutNoSuchNames</CODE> value defined in MIB-II. 316 * 317 * @return The <CODE>snmpOutNoSuchNames</CODE> value. 318 */ getSnmpOutNoSuchNames()319 public Long getSnmpOutNoSuchNames(); 320 321 /** 322 * Returns the <CODE>snmpOutTooBigs</CODE> value defined in MIB-II. 323 * 324 * @return The <CODE>snmpOutTooBigs</CODE> value. 325 */ getSnmpOutTooBigs()326 public Long getSnmpOutTooBigs(); 327 328 /** 329 * Returns the <CODE>snmpInASNParseErrs</CODE> value defined in MIB-II. 330 * 331 * @return The <CODE>snmpInASNParseErrs</CODE> value. 332 */ getSnmpInASNParseErrs()333 public Long getSnmpInASNParseErrs(); 334 335 /** 336 * Returns the <CODE>snmpInBadCommunityUses</CODE> value defined in MIB-II. 337 * 338 * @return The <CODE>snmpInBadCommunityUses</CODE> value. 339 */ getSnmpInBadCommunityUses()340 public Long getSnmpInBadCommunityUses(); 341 342 /** 343 * Returns the <CODE>snmpInBadCommunityNames</CODE> value defined in MIB-II. 344 * 345 * @return The <CODE>snmpInBadCommunityNames</CODE> value. 346 */ getSnmpInBadCommunityNames()347 public Long getSnmpInBadCommunityNames(); 348 349 /** 350 * Returns the <CODE>snmpInBadVersions</CODE> value defined in MIB-II. 351 * 352 * @return The <CODE>snmpInBadVersions</CODE> value. 353 */ getSnmpInBadVersions()354 public Long getSnmpInBadVersions(); 355 356 /** 357 * Returns the <CODE>snmpOutPkts</CODE> value defined in MIB-II. 358 * 359 * @return The <CODE>snmpOutPkts</CODE> value. 360 */ getSnmpOutPkts()361 public Long getSnmpOutPkts(); 362 363 /** 364 * Returns the <CODE>snmpInPkts</CODE> value defined in MIB-II. 365 * 366 * @return The <CODE>snmpInPkts</CODE> value. 367 */ getSnmpInPkts()368 public Long getSnmpInPkts(); 369 370 /** 371 * Returns the <CODE>snmpInGetRequests</CODE> value defined in MIB-II. 372 * 373 * @return The <CODE>snmpInGetRequests</CODE> value. 374 */ getSnmpInGetRequests()375 public Long getSnmpInGetRequests(); 376 377 /** 378 * Returns the <CODE>snmpInGetNexts</CODE> value defined in MIB-II. 379 * 380 * @return The <CODE>snmpInGetNexts</CODE> value. 381 */ getSnmpInGetNexts()382 public Long getSnmpInGetNexts(); 383 384 /** 385 * Returns the <CODE>snmpInSetRequests</CODE> value defined in MIB-II. 386 * 387 * @return The <CODE>snmpInSetRequests</CODE> value. 388 */ getSnmpInSetRequests()389 public Long getSnmpInSetRequests(); 390 391 /** 392 * Returns the <CODE>snmpInTotalSetVars</CODE> value defined in MIB-II. 393 * 394 * @return The <CODE>snmpInTotalSetVars</CODE> value. 395 */ getSnmpInTotalSetVars()396 public Long getSnmpInTotalSetVars(); 397 398 /** 399 * Returns the <CODE>snmpInTotalReqVars</CODE> value defined in MIB-II. 400 * 401 * @return The <CODE>snmpInTotalReqVars</CODE> value. 402 */ getSnmpInTotalReqVars()403 public Long getSnmpInTotalReqVars(); 404 405 /** 406 * Returns the <CODE>snmpSilentDrops</CODE> value defined in rfc 1907 NMPv2-MIB . 407 * 408 * @return The <CODE>snmpSilentDrops</CODE> value. 409 * 410 * @since 1.5 411 */ getSnmpSilentDrops()412 public Long getSnmpSilentDrops(); 413 414 /** 415 * Returns the <CODE>snmpProxyDrops</CODE> value defined in rfc 1907 NMPv2-MIB . 416 * 417 * @return The <CODE>snmpProxyDrops</CODE> value. 418 * 419 * @since 1.5 420 */ getSnmpProxyDrops()421 public Long getSnmpProxyDrops(); 422 423 // PUBLIC METHODS 424 //--------------- 425 426 /** 427 * Adds a new MIB in the SNMP MIB handler. 428 * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} 429 * and {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} 430 * and should not be called directly. 431 * 432 * @param mib The MIB to add. 433 * 434 * @return A reference to the SNMP MIB handler. 435 * 436 * @exception IllegalArgumentException If the parameter is null. 437 */ addMib(SnmpMibAgent mib)438 public SnmpMibHandler addMib(SnmpMibAgent mib) throws IllegalArgumentException; 439 440 /** 441 * Adds a new MIB in the SNMP MIB handler. 442 * 443 * @param mib The MIB to add. 444 * @param oids The set of OIDs this agent implements. 445 * 446 * @return A reference to the SNMP MIB handler. 447 * 448 * @exception IllegalArgumentException If the parameter is null. 449 * 450 * @since 1.5 451 */ addMib(SnmpMibAgent mib, SnmpOid[] oids)452 public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) throws IllegalArgumentException; 453 454 /** 455 * Removes the specified MIB from the SNMP protocol adaptor. 456 * This method is called automatically by {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptor(SnmpMibHandler)} 457 * and {@link com.sun.jmx.snmp.agent.SnmpMibAgent#setSnmpAdaptorName(ObjectName)} 458 * and should not be called directly. 459 * 460 * @param mib The MIB to be removed. 461 * 462 * @return <code>true</code> if the specified <CODE>mib</CODE> was a MIB included in the SNMP MIB handler, 463 * <code>false</code> otherwise. 464 */ removeMib(SnmpMibAgent mib)465 public boolean removeMib(SnmpMibAgent mib); 466 467 /** 468 * Sends a trap using SNMP V1 trap format. 469 * <BR>The trap is sent to each destination defined in the ACL file (if available). 470 * If no ACL file or no destinations are available, the trap is sent to the local host. 471 * 472 * @param generic The generic number of the trap. 473 * @param specific The specific number of the trap. 474 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 475 * 476 * @exception IOException An I/O error occurred while sending the trap. 477 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 478 */ snmpV1Trap(int generic, int specific, SnmpVarBindList varBindList)479 public void snmpV1Trap(int generic, int specific, SnmpVarBindList varBindList) throws IOException, SnmpStatusException; 480 481 482 /** 483 * Sends a trap using SNMP V1 trap format. 484 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE> destination 485 * using the specified community string (and the ACL file is not used). 486 * 487 * @param address The <CODE>InetAddress</CODE> destination of the trap. 488 * @param cs The community string to be used for the trap. 489 * @param generic The generic number of the trap. 490 * @param specific The specific number of the trap. 491 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 492 * 493 * @exception IOException An I/O error occurred while sending the trap. 494 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 495 */ snmpV1Trap(InetAddress address, String cs, int generic, int specific, SnmpVarBindList varBindList)496 public void snmpV1Trap(InetAddress address, String cs, int generic, int specific, SnmpVarBindList varBindList) 497 throws IOException, SnmpStatusException; 498 499 500 /** 501 * Sends a trap using SNMP V1 trap format. 502 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination. 503 * The community string used is the one located in the <CODE>SnmpPeer</CODE> parameters (<CODE>SnmpParameters.getRdCommunity() </CODE>). 504 * 505 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap. 506 * @param agentAddr The agent address to be used for the trap. 507 * @param enterpOid The enterprise OID to be used for the trap. 508 * @param generic The generic number of the trap. 509 * @param specific The specific number of the trap. 510 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 511 * @param time The time stamp (overwrite the current time). 512 * 513 * @exception IOException An I/O error occurred while sending the trap. 514 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 515 * 516 * @since 1.5 517 */ snmpV1Trap(SnmpPeer peer, SnmpIpAddress agentAddr, SnmpOid enterpOid, int generic, int specific, SnmpVarBindList varBindList, SnmpTimeticks time)518 public void snmpV1Trap(SnmpPeer peer, 519 SnmpIpAddress agentAddr, 520 SnmpOid enterpOid, 521 int generic, 522 int specific, 523 SnmpVarBindList varBindList, 524 SnmpTimeticks time) throws IOException, SnmpStatusException; 525 526 /** 527 * Sends a trap using SNMP V2 trap format. 528 * <BR>The trap is sent to the specified <CODE>SnmpPeer</CODE> destination. 529 * <BR>The community string used is the one located in the <CODE>SnmpPeer</CODE> parameters (<CODE>SnmpParameters.getRdCommunity() </CODE>). 530 * <BR>The variable list included in the outgoing trap is composed of the following items: 531 * <UL> 532 * <LI><CODE>sysUpTime.0</CODE> with the value specified by <CODE>time</CODE> 533 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> 534 * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> 535 * </UL> 536 * 537 * @param peer The <CODE>SnmpPeer</CODE> destination of the trap. 538 * @param trapOid The OID identifying the trap. 539 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 540 * @param time The time stamp (overwrite the current time). 541 * 542 * @exception IOException An I/O error occurred while sending the trap. 543 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 544 * 545 * @since 1.5 546 */ snmpV2Trap(SnmpPeer peer, SnmpOid trapOid, SnmpVarBindList varBindList, SnmpTimeticks time)547 public void snmpV2Trap(SnmpPeer peer, 548 SnmpOid trapOid, 549 SnmpVarBindList varBindList, 550 SnmpTimeticks time) throws IOException, SnmpStatusException; 551 552 /** 553 * Sends a trap using SNMP V2 trap format. 554 * <BR>The trap is sent to each destination defined in the ACL file (if available). 555 * If no ACL file or no destinations are available, the trap is sent to the local host. 556 * <BR>The variable list included in the outgoing trap is composed of the following items: 557 * <UL> 558 * <LI><CODE>sysUpTime.0</CODE> with its current value 559 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> 560 * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> 561 * </UL> 562 * 563 * @param trapOid The OID identifying the trap. 564 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 565 * 566 * @exception IOException An I/O error occurred while sending the trap. 567 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 568 */ snmpV2Trap(SnmpOid trapOid, SnmpVarBindList varBindList)569 public void snmpV2Trap(SnmpOid trapOid, SnmpVarBindList varBindList) throws IOException, SnmpStatusException; 570 571 572 /** 573 * Sends a trap using SNMP V2 trap format. 574 * <BR>The trap is sent to the specified <CODE>InetAddress</CODE> destination 575 * using the specified community string (and the ACL file is not used). 576 * <BR>The variable list included in the outgoing trap is composed of the following items: 577 * <UL> 578 * <LI><CODE>sysUpTime.0</CODE> with its current value 579 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> 580 * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> 581 * </UL> 582 * 583 * @param address The <CODE>InetAddress</CODE> destination of the trap. 584 * @param cs The community string to be used for the trap. 585 * @param trapOid The OID identifying the trap. 586 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 587 * 588 * @exception IOException An I/O error occurred while sending the trap. 589 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 590 */ snmpV2Trap(InetAddress address, String cs, SnmpOid trapOid, SnmpVarBindList varBindList)591 public void snmpV2Trap(InetAddress address, String cs, SnmpOid trapOid, SnmpVarBindList varBindList) 592 throws IOException, SnmpStatusException; 593 594 /** 595 * Send the specified trap PDU to the passed <CODE>InetAddress</CODE>. 596 * @param address The destination address. 597 * @param pdu The pdu to send. 598 * @exception IOException An I/O error occurred while sending the trap. 599 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 600 * 601 * @since 1.5 602 */ snmpPduTrap(InetAddress address, SnmpPduPacket pdu)603 public void snmpPduTrap(InetAddress address, SnmpPduPacket pdu) 604 throws IOException, SnmpStatusException; 605 /** 606 * Send the specified trap PDU to the passed <CODE>SnmpPeer</CODE>. 607 * @param peer The destination peer. The Read community string is used of <CODE>SnmpParameters</CODE> is used as the trap community string. 608 * @param pdu The pdu to send. 609 * @exception IOException An I/O error occurred while sending the trap. 610 * @exception SnmpStatusException If the trap exceeds the limit defined by <CODE>bufferSize</CODE>. 611 * @since 1.5 612 */ snmpPduTrap(SnmpPeer peer, SnmpPduPacket pdu)613 public void snmpPduTrap(SnmpPeer peer, 614 SnmpPduPacket pdu) 615 throws IOException, SnmpStatusException; 616 617 /** 618 * Sends an inform using SNMP V2 inform request format. 619 * <BR>The inform request is sent to each destination defined in the ACL file (if available). 620 * If no ACL file or no destinations are available, the inform request is sent to the local host. 621 * <BR>The variable list included in the outgoing inform request is composed of the following items: 622 * <UL> 623 * <LI><CODE>sysUpTime.0</CODE> with its current value 624 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> 625 * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> 626 * </UL> 627 * To send an inform request, the SNMP adaptor server must be active. 628 * 629 * @param cb The callback that is invoked when a request is complete. 630 * @param trapOid The OID identifying the trap. 631 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 632 * 633 * @return A vector of {@link com.sun.jmx.snmp.daemon.SnmpInformRequest} objects. 634 * <P>If there is no destination host for this inform request, the returned vector will be empty. 635 * 636 * @exception IllegalStateException This method has been invoked while the SNMP adaptor server was not active. 637 * @exception IOException An I/O error occurred while sending the inform request. 638 * @exception SnmpStatusException If the inform request exceeds the limit defined by <CODE>bufferSize</CODE>. 639 */ snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList)640 public Vector<?> snmpInformRequest(SnmpInformHandler cb, SnmpOid trapOid, 641 SnmpVarBindList varBindList) 642 throws IllegalStateException, IOException, SnmpStatusException; 643 644 /** 645 * Sends an inform using SNMP V2 inform request format. 646 * <BR>The inform is sent to the specified <CODE>InetAddress</CODE> destination 647 * using the specified community string. 648 * <BR>The variable list included in the outgoing inform request is composed of the following items: 649 * <UL> 650 * <LI><CODE>sysUpTime.0</CODE> with its current value 651 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> 652 * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> 653 * </UL> 654 * To send an inform request, the SNMP adaptor server must be active. 655 * 656 * @param address The <CODE>InetAddress</CODE> destination for this inform request. 657 * @param cs The community string to be used for the inform request. 658 * @param cb The callback that is invoked when a request is complete. 659 * @param trapOid The OID identifying the trap. 660 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 661 * 662 * @return The inform request object. 663 * 664 * @exception IllegalStateException This method has been invoked while the SNMP adaptor server was not active. 665 * @exception IOException An I/O error occurred while sending the inform request. 666 * @exception SnmpStatusException If the inform request exceeds the limit defined by <CODE>bufferSize</CODE>. 667 */ snmpInformRequest(InetAddress address, String cs, SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList)668 public SnmpInformRequest snmpInformRequest(InetAddress address, String cs, SnmpInformHandler cb, 669 SnmpOid trapOid, SnmpVarBindList varBindList) 670 throws IllegalStateException, IOException, SnmpStatusException; 671 672 673 /** 674 * Sends an inform using SNMP V2 inform request format. 675 * <BR>The inform is sent to the specified <CODE>SnmpPeer</CODE> destination. 676 * <BR> The community string used is the one located in the <CODE>SnmpPeer</CODE> parameters (<CODE>SnmpParameters.getInformCommunity() </CODE>). 677 * <BR>The variable list included in the outgoing inform is composed of the following items: 678 * <UL> 679 * <LI><CODE>sysUpTime.0</CODE> with its current value 680 * <LI><CODE>snmpTrapOid.0</CODE> with the value specified by <CODE>trapOid</CODE> 681 * <LI><CODE>all the (oid,values)</CODE> from the specified <CODE>varBindList</CODE> 682 * </UL> 683 * To send an inform request, the SNMP adaptor server must be active. 684 * 685 * @param peer The <CODE>SnmpPeer</CODE> destination for this inform request. 686 * @param cb The callback that is invoked when a request is complete. 687 * @param trapOid The OID identifying the trap. 688 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null. 689 * 690 * @return The inform request object. 691 * 692 * @exception IllegalStateException This method has been invoked while the SNMP adaptor server was not active. 693 * @exception IOException An I/O error occurred while sending the inform request. 694 * @exception SnmpStatusException If the inform request exceeds the limit defined by <CODE>bufferSize</CODE>. 695 * 696 * @since 1.5 697 */ snmpInformRequest(SnmpPeer peer, SnmpInformHandler cb, SnmpOid trapOid, SnmpVarBindList varBindList)698 public SnmpInformRequest snmpInformRequest(SnmpPeer peer, 699 SnmpInformHandler cb, 700 SnmpOid trapOid, 701 SnmpVarBindList varBindList) throws IllegalStateException, IOException, SnmpStatusException; 702 } 703