001: /*
002: * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.jmx.snmp;
027:
028: /**
029: * Represents a <CODE>get-bulk</CODE> PDU as defined in RFC 1448.
030: * <P>
031: * You will not usually need to use this class, except if you
032: * decide to implement your own
033: * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
034: * <P>
035: * The <CODE>SnmpPduBulk</CODE> extends {@link com.sun.jmx.snmp.SnmpPduPacket SnmpPduPacket}
036: * and defines attributes specific to the <CODE>get-bulk</CODE> PDU (see RFC 1448).
037: *
038: * <p><b>This API is a Sun Microsystems internal API and is subject
039: * to change without notice.</b></p>
040: */
041:
042: public class SnmpPduBulk extends SnmpPduPacket implements
043: SnmpPduBulkType {
044: private static final long serialVersionUID = -7431306775883371046L;
045:
046: /**
047: * The <CODE>non-repeaters</CODE> value.
048: * @serial
049: */
050: public int nonRepeaters;
051:
052: /**
053: * The <CODE>max-repetitions</CODE> value.
054: * @serial
055: */
056: public int maxRepetitions;
057:
058: /**
059: * Builds a new <CODE>get-bulk</CODE> PDU.
060: * <BR><CODE>type</CODE> and <CODE>version</CODE> fields are initialized with
061: * {@link com.sun.jmx.snmp.SnmpDefinitions#pduGetBulkRequestPdu pduGetBulkRequestPdu}
062: * and {@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo}.
063: */
064: public SnmpPduBulk() {
065: type = pduGetBulkRequestPdu;
066: version = snmpVersionTwo;
067: }
068:
069: /**
070: * Implements the <CODE>SnmpPduBulkType</CODE> interface.
071: *
072: * @since 1.5
073: */
074: public void setMaxRepetitions(int i) {
075: maxRepetitions = i;
076: }
077:
078: /**
079: * Implements the <CODE>SnmpPduBulkType</CODE> interface.
080: *
081: * @since 1.5
082: */
083: public void setNonRepeaters(int i) {
084: nonRepeaters = i;
085: }
086:
087: /**
088: * Implements the <CODE>SnmpPduBulkType</CODE> interface.
089: *
090: * @since 1.5
091: */
092: public int getMaxRepetitions() {
093: return maxRepetitions;
094: }
095:
096: /**
097: * Implements the <CODE>SnmpPduBulkType</CODE> interface.
098: *
099: * @since 1.5
100: */
101: public int getNonRepeaters() {
102: return nonRepeaters;
103: }
104:
105: /**
106: * Implements the <CODE>SnmpAckPdu</CODE> interface.
107: *
108: * @since 1.5
109: */
110: public SnmpPdu getResponsePdu() {
111: SnmpPduRequest result = new SnmpPduRequest();
112: result.address = address;
113: result.port = port;
114: result.version = version;
115: result.community = community;
116: result.type = SnmpDefinitions.pduGetResponsePdu;
117: result.requestId = requestId;
118: result.errorStatus = SnmpDefinitions.snmpRspNoError;
119: result.errorIndex = 0;
120:
121: return result;
122: }
123: }
|