KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > snmp > SnmpPduRequest


1 /*
2  * @(#)file SnmpPduRequest.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 4.17
5  * @(#)date 08/02/09
6  *
7  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
8  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
9  *
10  */

11
12
13 package com.sun.jmx.snmp;
14
15
16
17
18 /**
19  * Is used to represent <CODE>get</CODE>, <CODE>get-next</CODE>, <CODE>set</CODE>, <CODE>response</CODE> and <CODE>SNMPv2-trap</CODE> PDUs.
20  * <P>
21  * You will not usually need to use this class, except if you
22  * decide to implement your own
23  * {@link com.sun.jmx.snmp.SnmpPduFactory SnmpPduFactory} object.
24  *
25  * @version 4.17 12/19/03
26  * @author Sun Microsystems, Inc
27  * <p><b>This API is a Sun Microsystems internal API and is subject
28  * to change without notice.</b></p>
29  */

30
31 public class SnmpPduRequest extends SnmpPduPacket
32     implements SnmpPduRequestType {
33
34     /**
35      * Error status. Statuses are defined in
36      * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
37      * @serial
38      */

39     public int errorStatus=0 ;
40
41
42     /**
43      * Error index. Remember that SNMP indices start from 1.
44      * Thus the corresponding <CODE>SnmpVarBind</CODE> is
45      * <CODE>varBindList[errorIndex-1]</CODE>.
46      * @serial
47      */

48     public int errorIndex=0 ;
49     /**
50      * Implements <CODE>SnmpPduRequestType</CODE> interface.
51      *
52      * @since 1.5
53      */

54     public void setErrorIndex(int i) {
55     errorIndex = i;
56     }
57     /**
58      * Implements <CODE>SnmpPduRequestType</CODE> interface.
59      *
60      * @since 1.5
61      */

62     public void setErrorStatus(int i) {
63     errorStatus = i;
64     }
65     /**
66      * Implements <CODE>SnmpPduRequestType</CODE> interface.
67      *
68      * @since 1.5
69      */

70     public int getErrorIndex() { return errorIndex; }
71     /**
72      * Implements <CODE>SnmpPduRequestType</CODE> interface.
73      *
74      * @since 1.5
75      */

76     public int getErrorStatus() { return errorStatus; }
77     /**
78      * Implements <CODE>SnmpAckPdu</CODE> interface.
79      *
80      * @since 1.5
81      */

82     public SnmpPdu getResponsePdu() {
83     SnmpPduRequest result = new SnmpPduRequest();
84     result.address = address;
85     result.port = port;
86     result.version = version;
87     result.community = community;
88     result.type = SnmpDefinitions.pduGetResponsePdu;
89     result.requestId = requestId;
90     result.errorStatus = SnmpDefinitions.snmpRspNoError;
91     result.errorIndex = 0;
92     
93     return result;
94     }
95 }
96
97
98
99
100
101
Popular Tags