jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduBulk.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package com.sun.jmx.snmp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Represents a <CODE>get-bulk</CODE> PDU as defined in RFC 1448.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * You will not usually need to use this class, except if you
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * decide to implement your own
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * The <CODE>SnmpPduBulk</CODE> extends {@link com.sun.jmx.snmp.SnmpPduPacket SnmpPduPacket}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * and defines attributes specific to the <CODE>get-bulk</CODE> PDU (see RFC 1448).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <p><b>This API is a Sun Microsystems internal API  and is subject
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * to change without notice.</b></p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
public class SnmpPduBulk extends SnmpPduPacket
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    implements SnmpPduBulkType {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private static final long serialVersionUID = -7431306775883371046L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * The <CODE>non-repeaters</CODE> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    public int            nonRepeaters ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * The <CODE>max-repetitions</CODE> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    public int            maxRepetitions ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * Builds a new <CODE>get-bulk</CODE> PDU.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * <BR><CODE>type</CODE> and <CODE>version</CODE> fields are initialized with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * {@link com.sun.jmx.snmp.SnmpDefinitions#pduGetBulkRequestPdu pduGetBulkRequestPdu}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * and {@link com.sun.jmx.snmp.SnmpDefinitions#snmpVersionTwo snmpVersionTwo}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public SnmpPduBulk() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        type = pduGetBulkRequestPdu ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        version = snmpVersionTwo ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * Implements the <CODE>SnmpPduBulkType</CODE> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    public void setMaxRepetitions(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        maxRepetitions = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * Implements the <CODE>SnmpPduBulkType</CODE> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    public void setNonRepeaters(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        nonRepeaters = i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Implements the <CODE>SnmpPduBulkType</CODE> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public int getMaxRepetitions() { return maxRepetitions; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * Implements the <CODE>SnmpPduBulkType</CODE> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    public int getNonRepeaters() { return nonRepeaters; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Implements the <CODE>SnmpAckPdu</CODE> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    public SnmpPdu getResponsePdu() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        SnmpPduRequest result = new SnmpPduRequest();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        result.address = address;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        result.port = port;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        result.version = version;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        result.community = community;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        result.type = SnmpDefinitions.pduGetResponsePdu;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        result.requestId = requestId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        result.errorStatus = SnmpDefinitions.snmpRspNoError;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        result.errorIndex = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
}