KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)file SnmpScopedPduRequest.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 1.14
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 package com.sun.jmx.snmp;
12 /**
13  * Is used to represent <CODE>get</CODE>, <CODE>get-next</CODE>, <CODE>set</CODE>, <CODE>response</CODE> SNMP V3 scoped PDUs.
14  *
15  * <p><b>This API is a Sun Microsystems internal API and is subject
16  * to change without notice.</b></p>
17  * @since 1.5
18  */

19 public class SnmpScopedPduRequest extends SnmpScopedPduPacket
20     implements SnmpPduRequestType {
21
22     int errorStatus=0 ;
23
24     int errorIndex=0 ;
25     
26     /**
27      * Error index setter. Remember that SNMP indices start from 1.
28      * Thus the corresponding <CODE>SnmpVarBind</CODE> is
29      * <CODE>varBindList[errorIndex-1]</CODE>.
30      * @param i Error index.
31      */

32     public void setErrorIndex(int i) {
33     errorIndex = i;
34     }
35     /**
36      * Error status setter. Statuses are defined in
37      * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
38      * @param s Error status.
39      */

40     public void setErrorStatus(int s) {
41     errorStatus = s;
42     }
43
44     /**
45      * Error index getter. Remember that SNMP indices start from 1.
46      * Thus the corresponding <CODE>SnmpVarBind</CODE> is
47      * <CODE>varBindList[errorIndex-1]</CODE>.
48      * @return Error index.
49      */

50     public int getErrorIndex() { return errorIndex; }
51     /**
52      * Error status getter. Statuses are defined in
53      * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
54      * @return Error status.
55      */

56     public int getErrorStatus() { return errorStatus; }
57     
58     /**
59      * Generates the pdu to use for response.
60      * @return Response pdu.
61      */

62     public SnmpPdu getResponsePdu() {
63     SnmpScopedPduRequest result = new SnmpScopedPduRequest();
64     result.address = address ;
65     result.port = port ;
66     result.version = version ;
67     result.requestId = requestId;
68     result.msgId = msgId;
69     result.msgMaxSize = msgMaxSize;
70     result.msgFlags = msgFlags;
71     result.msgSecurityModel = msgSecurityModel;
72     result.contextEngineId = contextEngineId;
73     result.contextName = contextName;
74     result.securityParameters = securityParameters;
75     result.type = pduGetResponsePdu ;
76     result.errorStatus = SnmpDefinitions.snmpRspNoError ;
77     result.errorIndex = 0 ;
78     return result;
79     }
80 }
81
82
83
84
85
86
Popular Tags