KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > snmp > agent > SnmpMibRequest


1 /*
2  * @(#)file SnmpMibRequest.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 1.15
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 package com.sun.jmx.snmp.agent;
11
12 import java.util.Enumeration JavaDoc;
13 import java.util.Vector JavaDoc;
14
15 import com.sun.jmx.snmp.SnmpVarBind;
16 import com.sun.jmx.snmp.SnmpPdu;
17 import com.sun.jmx.snmp.SnmpEngine;
18
19 /**
20  * This interface models the part of a SNMP request that involves
21  * a specific MIB. One object implementing this interface will be created
22  * for every MIB involved in a SNMP request, and that object will be passed
23  * to the SnmpMibAgent in charge of handling that MIB.
24  *
25  * Objects implementing this interface will be allocated by the SNMP engine.
26  * You will never need to implement this interface. You will only use it.
27  *
28  * <p><b>This API is a Sun Microsystems internal API and is subject
29  * to change without notice.</b></p>
30  */

31 public interface SnmpMibRequest {
32     /**
33      * Returns the list of varbind to be handled by the SNMP mib node.
34      *
35      * @return The element of the enumeration are instances of
36      * {@link com.sun.jmx.snmp.SnmpVarBind}
37      */

38     public Enumeration JavaDoc getElements();
39
40     /**
41      * Returns the vector of varbind to be handled by the SNMP mib node.
42      * The caller shall not modify this vector.
43      *
44      * @return The element of the vector are instances of
45      * {@link com.sun.jmx.snmp.SnmpVarBind}
46      */

47     public Vector JavaDoc getSubList();
48
49     /**
50      * Returns the SNMP protocol version of the original request. If SNMP V1 request are received, the version is upgraded to SNMP V2.
51      *
52      * @return The SNMP protocol version of the original request.
53      */

54     public int getVersion();
55
56     /**
57      * Returns the SNMP protocol version of the original request. No translation is done on the version. The actual received request SNMP version is returned.
58      *
59      * @return The SNMP protocol version of the original request.
60      *
61      * @since 1.5
62      */

63     public int getRequestPduVersion();
64
65     /**
66      * Returns the local engine. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
67      * @return the local engine.
68      *
69      * @since 1.5
70      */

71     public SnmpEngine getEngine();
72     /**
73      * Gets the incoming request principal. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
74      * @return The request principal.
75      *
76      * @since 1.5
77      **/

78     public String JavaDoc getPrincipal();
79     /**
80      * Gets the incoming request security level. This level is defined in {@link com.sun.jmx.snmp.SnmpEngine SnmpEngine}. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise -1 is returned.
81      * @return The security level.
82      *
83      * @since 1.5
84      */

85     public int getSecurityLevel();
86     /**
87      * Gets the incoming request security model. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise -1 is returned.
88      * @return The security model.
89      *
90      * @since 1.5
91      */

92     public int getSecurityModel();
93     /**
94      * Gets the incoming request context name. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
95      * @return The context name.
96      *
97      * @since 1.5
98      */

99     public byte[] getContextName();
100     /**
101      * Gets the incoming request context name used by Access Control Model in order to allow or deny the access to OIDs. This parameter is returned only if <CODE> SnmpV3AdaptorServer </CODE> is the adaptor receiving this request. Otherwise null is returned.
102      * @return The checked context name.
103      *
104      * @since 1.5
105      */

106     public byte[] getAccessContextName();
107     
108     /**
109      * Returns a handle on a user allocated contextual object.
110      * This contextual object is allocated through the SnmpUserDataFactory
111      * on a per SNMP request basis, and is handed back to the user via
112      * SnmpMibRequest (and derivative) objects. It is never accessed by
113      * the system, but might be handed back in multiple threads. It is thus
114      * the user responsibility to make sure he handles this object in a
115      * thread safe manner.
116      */

117     public Object JavaDoc getUserData();
118
119     /**
120      * Returns the varbind index that should be embedded in an
121      * SnmpStatusException for this particular varbind.
122      * This does not necessarily correspond to the "real"
123      * index value that will be returned in the result PDU.
124      *
125      * @param varbind The varbind for which the index value is
126      * querried. Note that this varbind <b>must</b> have
127      * been obtained from the enumeration returned by
128      * <CODE>getElements()</CODE>, or from the vector
129      * returned by <CODE>getSublist()</CODE>.
130      *
131      * @return The varbind index that should be embedded in an
132      * SnmpStatusException for this particular varbind.
133      */

134     public int getVarIndex(SnmpVarBind varbind);
135
136     /**
137      * Adds a varbind to this request sublist. This method is used for
138      * internal purposes and you should never need to call it directly.
139      *
140      * @param varbind The varbind to be added in the sublist.
141      *
142      */

143     public void addVarBind(SnmpVarBind varbind);
144
145
146     /**
147      * Returns the number of elements (varbinds) in this request sublist.
148      *
149      * @return The number of elements in the sublist.
150      *
151      **/

152     public int getSize();
153     /**
154      * Returns the SNMP PDU attached to the request.
155      * @return The SNMP PDU.
156      *
157      * @since 1.5
158      **/

159     public SnmpPdu getPdu();
160 }
161
Popular Tags