1. /*
  2. * @(#)file SnmpScopedPduBulk.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 1.14
  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. * <P>
  16. * The <CODE>SnmpSocpedPduBulk</CODE> extends {@link com.sun.jmx.snmp.SnmpScopedPduPacket SnmpScopedPduPacket}
  17. * and defines attributes specific to the <CODE>get-bulk</CODE> PDU (see RFC 1448).
  18. *
  19. * <p><b>This API is a Sun Microsystems internal API and is subject
  20. * to change without notice.</b></p>
  21. * @since 1.5
  22. */
  23. public class SnmpScopedPduBulk extends SnmpScopedPduPacket
  24. implements SnmpPduBulkType {
  25. /**
  26. * The <CODE>non-repeaters</CODE> value.
  27. * @serial
  28. */
  29. int nonRepeaters;
  30. /**
  31. * The <CODE>max-repetitions</CODE> value.
  32. * @serial
  33. */
  34. int maxRepetitions;
  35. public SnmpScopedPduBulk() {
  36. type = pduGetBulkRequestPdu;
  37. version = snmpVersionThree;
  38. }
  39. /**
  40. * The <CODE>max-repetitions</CODE> setter.
  41. * @param max Maximum repetition.
  42. */
  43. public void setMaxRepetitions(int max) {
  44. maxRepetitions = max;
  45. }
  46. /**
  47. * The <CODE>non-repeaters</CODE> setter.
  48. * @param nr Non repeaters.
  49. */
  50. public void setNonRepeaters(int nr) {
  51. nonRepeaters = nr;
  52. }
  53. /**
  54. * The <CODE>max-repetitions</CODE> getter.
  55. * @return Maximum repetition.
  56. */
  57. public int getMaxRepetitions() { return maxRepetitions; }
  58. /**
  59. * The <CODE>non-repeaters</CODE> getter.
  60. * @return Non repeaters.
  61. */
  62. public int getNonRepeaters() { return nonRepeaters; }
  63. /**
  64. * Generates the pdu to use for response.
  65. * @return Response pdu.
  66. */
  67. public SnmpPdu getResponsePdu() {
  68. SnmpScopedPduRequest result = new SnmpScopedPduRequest();
  69. result.address = address ;
  70. result.port = port ;
  71. result.version = version ;
  72. result.requestId = requestId;
  73. result.msgId = msgId;
  74. result.msgMaxSize = msgMaxSize;
  75. result.msgFlags = msgFlags;
  76. result.msgSecurityModel = msgSecurityModel;
  77. result.contextEngineId = contextEngineId;
  78. result.contextName = contextName;
  79. result.securityParameters = securityParameters;
  80. result.type = pduGetResponsePdu ;
  81. result.errorStatus = SnmpDefinitions.snmpRspNoError ;
  82. result.errorIndex = 0 ;
  83. return result;
  84. }
  85. }