Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduRequest.java
38924 views
/*1* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package com.sun.jmx.snmp;2728293031/**32* Is used to represent <CODE>get</CODE>, <CODE>get-next</CODE>, <CODE>set</CODE>, <CODE>response</CODE> and <CODE>SNMPv2-trap</CODE> PDUs.33* <P>34* You will not usually need to use this class, except if you35* decide to implement your own36* {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.37*38* <p><b>This API is a Sun Microsystems internal API and is subject39* to change without notice.</b></p>40*/4142public class SnmpPduRequest extends SnmpPduPacket43implements SnmpPduRequestType {44private static final long serialVersionUID = 2218754017025258979L;454647/**48* Error status. Statuses are defined in49* {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.50* @serial51*/52public int errorStatus=0 ;535455/**56* Error index. Remember that SNMP indices start from 1.57* Thus the corresponding <CODE>SnmpVarBind</CODE> is58* <CODE>varBindList[errorIndex-1]</CODE>.59* @serial60*/61public int errorIndex=0 ;62/**63* Implements <CODE>SnmpPduRequestType</CODE> interface.64*65* @since 1.566*/67public void setErrorIndex(int i) {68errorIndex = i;69}70/**71* Implements <CODE>SnmpPduRequestType</CODE> interface.72*73* @since 1.574*/75public void setErrorStatus(int i) {76errorStatus = i;77}78/**79* Implements <CODE>SnmpPduRequestType</CODE> interface.80*81* @since 1.582*/83public int getErrorIndex() { return errorIndex; }84/**85* Implements <CODE>SnmpPduRequestType</CODE> interface.86*87* @since 1.588*/89public int getErrorStatus() { return errorStatus; }90/**91* Implements <CODE>SnmpAckPdu</CODE> interface.92*93* @since 1.594*/95public SnmpPdu getResponsePdu() {96SnmpPduRequest result = new SnmpPduRequest();97result.address = address;98result.port = port;99result.version = version;100result.community = community;101result.type = SnmpDefinitions.pduGetResponsePdu;102result.requestId = requestId;103result.errorStatus = SnmpDefinitions.snmpRspNoError;104result.errorIndex = 0;105106return result;107}108}109110111