1. /*
  2. * @(#)file SnmpPduBulk.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 4.17
  5. * @(#)date 04/09/15
  6. *
  7. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  8. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  9. *
  10. */
  11. package com.sun.jmx.snmp;
  12. /**
  13. * Represents a <CODE>get-bulk</CODE> PDU as defined in RFC 1448.
  14. * <P>
  15. * You will not usually need to use this class, except if you
  16. * decide to implement your own
  17. * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
  18. * <P>
  19. * The <CODE>SnmpPduBulk</CODE> extends {@link com.sun.jmx.snmp.SnmpPduPacket SnmpPduPacket}
  20. * and defines attributes specific to the <CODE>get-bulk</CODE> PDU (see RFC 1448).
  21. *
  22. * <p><b>This API is a Sun Microsystems internal API and is subject
  23. * to change without notice.</b></p>
  24. */
  25. public class SnmpPduBulk extends SnmpPduPacket
  26. implements SnmpPduBulkType {
  27. /**
  28. * The <CODE>non-repeaters</CODE> value.
  29. * @serial
  30. */
  31. public int nonRepeaters ;
  32. /**
  33. * The <CODE>max-repetitions</CODE> value.
  34. * @serial
  35. */
  36. public int maxRepetitions ;
  37. /**
  38. * Builds a new <CODE>get-bulk</CODE> PDU.
  39. * <BR><CODE>type</CODE> and <CODE>version</CODE> fields are initialized with
  40. * {@link com.sun.jmx.snmp.SnmpDefinitions#pduGetBulkRequestPdu pduGetBulkRequestPdu}
  41. * and {@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo}.
  42. */
  43. public SnmpPduBulk() {
  44. type = pduGetBulkRequestPdu ;
  45. version = snmpVersionTwo ;
  46. }
  47. /**
  48. * Implements the <CODE>SnmpPduBulkType</CODE> interface.
  49. *
  50. * @since 1.5
  51. */
  52. public void setMaxRepetitions(int i) {
  53. maxRepetitions = i;
  54. }
  55. /**
  56. * Implements the <CODE>SnmpPduBulkType</CODE> interface.
  57. *
  58. * @since 1.5
  59. */
  60. public void setNonRepeaters(int i) {
  61. nonRepeaters = i;
  62. }
  63. /**
  64. * Implements the <CODE>SnmpPduBulkType</CODE> interface.
  65. *
  66. * @since 1.5
  67. */
  68. public int getMaxRepetitions() { return maxRepetitions; }
  69. /**
  70. * Implements the <CODE>SnmpPduBulkType</CODE> interface.
  71. *
  72. * @since 1.5
  73. */
  74. public int getNonRepeaters() { return nonRepeaters; }
  75. /**
  76. * Implements the <CODE>SnmpAckPdu</CODE> interface.
  77. *
  78. * @since 1.5
  79. */
  80. public SnmpPdu getResponsePdu() {
  81. SnmpPduRequest result = new SnmpPduRequest();
  82. result.address = address;
  83. result.port = port;
  84. result.version = version;
  85. result.community = community;
  86. result.type = SnmpDefinitions.pduGetResponsePdu;
  87. result.requestId = requestId;
  88. result.errorStatus = SnmpDefinitions.snmpRspNoError;
  89. result.errorIndex = 0;
  90. return result;
  91. }
  92. }