blob: a74394bc38b6cf3731901448fbfaa6aff0a07a74 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1998-2006 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
27package com.sun.jmx.snmp;
28
29
30
31/**
32 * Represents a <CODE>get-bulk</CODE> PDU as defined in RFC 1448.
33 * <P>
34 * You will not usually need to use this class, except if you
35 * decide to implement your own
36 * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
37 * <P>
38 * The <CODE>SnmpPduBulk</CODE> extends {@link com.sun.jmx.snmp.SnmpPduPacket SnmpPduPacket}
39 * and defines attributes specific to the <CODE>get-bulk</CODE> PDU (see RFC 1448).
40 *
41 * <p><b>This API is a Sun Microsystems internal API and is subject
42 * to change without notice.</b></p>
43 */
44
45public class SnmpPduBulk extends SnmpPduPacket
46 implements SnmpPduBulkType {
47 private static final long serialVersionUID = -7431306775883371046L;
48
49 /**
50 * The <CODE>non-repeaters</CODE> value.
51 * @serial
52 */
53 public int nonRepeaters ;
54
55
56 /**
57 * The <CODE>max-repetitions</CODE> value.
58 * @serial
59 */
60 public int maxRepetitions ;
61
62
63 /**
64 * Builds a new <CODE>get-bulk</CODE> PDU.
65 * <BR><CODE>type</CODE> and <CODE>version</CODE> fields are initialized with
66 * {@link com.sun.jmx.snmp.SnmpDefinitions#pduGetBulkRequestPdu pduGetBulkRequestPdu}
67 * and {@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo}.
68 */
69 public SnmpPduBulk() {
70 type = pduGetBulkRequestPdu ;
71 version = snmpVersionTwo ;
72 }
73 /**
74 * Implements the <CODE>SnmpPduBulkType</CODE> interface.
75 *
76 * @since 1.5
77 */
78 public void setMaxRepetitions(int i) {
79 maxRepetitions = i;
80 }
81 /**
82 * Implements the <CODE>SnmpPduBulkType</CODE> interface.
83 *
84 * @since 1.5
85 */
86 public void setNonRepeaters(int i) {
87 nonRepeaters = i;
88 }
89 /**
90 * Implements the <CODE>SnmpPduBulkType</CODE> interface.
91 *
92 * @since 1.5
93 */
94 public int getMaxRepetitions() { return maxRepetitions; }
95 /**
96 * Implements the <CODE>SnmpPduBulkType</CODE> interface.
97 *
98 * @since 1.5
99 */
100 public int getNonRepeaters() { return nonRepeaters; }
101 /**
102 * Implements the <CODE>SnmpAckPdu</CODE> interface.
103 *
104 * @since 1.5
105 */
106 public SnmpPdu getResponsePdu() {
107 SnmpPduRequest result = new SnmpPduRequest();
108 result.address = address;
109 result.port = port;
110 result.version = version;
111 result.community = community;
112 result.type = SnmpDefinitions.pduGetResponsePdu;
113 result.requestId = requestId;
114 result.errorStatus = SnmpDefinitions.snmpRspNoError;
115 result.errorIndex = 0;
116
117 return result;
118 }
119}