KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > snmp > internal > SnmpSecuritySubSystem


1 /*
2  * @(#)file SnmpSecuritySubSystem.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 1.18
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.internal;
12
13 import com.sun.jmx.trace.Trace;
14
15 import com.sun.jmx.snmp.SnmpTooBigException;
16 import com.sun.jmx.snmp.SnmpStatusException;
17 import com.sun.jmx.snmp.SnmpUnknownSecModelException;
18 import com.sun.jmx.snmp.SnmpSecurityException;
19 import com.sun.jmx.snmp.SnmpSecurityParameters;
20
21 /**
22  * Security sub system interface. To allow engine integration, a security sub system must implement this interface.
23  * <p><b>This API is a Sun Microsystems internal API and is subject
24  * to change without notice.</b></p>
25  */

26 public interface SnmpSecuritySubSystem extends SnmpSubSystem {
27      /**
28      * Instantiates an <CODE>SnmpSecurityCache</CODE> that is dependant to the model implementation. This call is routed to the dedicated model according to the model ID.
29      * @param id The model ID.
30      * @return The model dependant security cache.
31      */

32     public SnmpSecurityCache createSecurityCache(int id) throws SnmpUnknownSecModelException;
33     /**
34      * To release the previously created cache. This call is routed to the dedicated model according to the model ID.
35      * @param id The model ID.
36      * @param cache The security cache to release.
37      */

38     public void releaseSecurityCache(int id,
39                      SnmpSecurityCache cache) throws SnmpUnknownSecModelException;
40
41      /**
42      * Called when a request is to be sent to the network. It must be securized. This call is routed to the dedicated model according to the model ID.
43      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
44      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
45      * @param version The SNMP protocol version.
46      * @param msgID The current request id.
47      * @param msgMaxSize The message max size.
48      * @param msgFlags The message flags (reportable, Auth and Priv).
49      * @param msgSecurityModel This current security model.
50      * @param params The security parameters that contain the model dependant parameters.
51      * @param contextEngineID The context engine ID.
52      * @param contextName The context name.
53      * @param data The marshalled varbind list
54      * @param dataLength The marshalled varbind list length.
55      * @param outputBytes The buffer to fill with securized request. This is a representation independant marshalled format. This buffer will be sent to the network.
56      * @return The marshalled byte number.
57      */

58     public int generateRequestMsg(SnmpSecurityCache cache,
59                   int version,
60                   int msgID,
61                   int msgMaxSize,
62                   byte msgFlags,
63                   int msgSecurityModel,
64                   SnmpSecurityParameters params,
65                   byte[] contextEngineID,
66                   byte[] contextName,
67                   byte[] data,
68                   int dataLength,
69                   byte[] outputBytes)
70     throws SnmpTooBigException, SnmpStatusException, SnmpSecurityException, SnmpUnknownSecModelException;
71
72     /**
73      * Called when a response is to be sent to the network. It must be securized. This call is routed to the dedicated model according to the model ID.
74      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
75      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
76      * @param version The SNMP protocol version.
77      * @param msgID The current request id.
78      * @param msgMaxSize The message max size.
79      * @param msgFlags The message flags (reportable, Auth and Priv).
80      * @param msgSecurityModel This current security model.
81      * @param params The security parameters that contain the model dependant parameters.
82      * @param contextEngineID The context engine ID.
83      * @param contextName The context name.
84      * @param data The marshalled varbind list
85      * @param dataLength The marshalled varbind list length.
86      * @param outputBytes The buffer to fill with securized request. This is a representation independant marshalled format. This buffer will be sent to the network.
87      * @return The marshalled byte number.
88      */

89     public int generateResponseMsg(SnmpSecurityCache cache,
90                    int version,
91                    int msgID,
92                    int msgMaxSize,
93                    byte msgFlags,
94                    int msgSecurityModel,
95                    SnmpSecurityParameters params,
96                    byte[] contextEngineID,
97                    byte[] contextName,
98                    byte[] data,
99                    int dataLength,
100                    byte[] outputBytes)
101     throws SnmpTooBigException, SnmpStatusException,
102            SnmpSecurityException, SnmpUnknownSecModelException;
103       /**
104      * Called when a request is received from the network. It handles authentication and privacy. This call is routed to the dedicated model according to the model ID.
105      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
106      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
107      * @param version The SNMP protocol version.
108      * @param msgID The current request id.
109      * @param msgMaxSize The message max size.
110      * @param msgFlags The message flags (reportable, Auth and Priv)
111      * @param msgSecurityModel This current security model.
112      * @param params The security parameters in a marshalled format. The informations cointained in this array are model dependant.
113      * @param contextEngineID The context engine ID or null if encrypted.
114      * @param contextName The context name or null if encrypted.
115      * @param data The marshalled varbind list or null if encrypted.
116      * @param encryptedPdu The encrypted pdu or null if not encrypted.
117      * @param decryptedPdu The decrypted pdu. If no decryption is to be done, the passed context engine ID, context name and data could be used to fill this object.
118      * @return The decoded security parameters.
119      
120      */

121     public SnmpSecurityParameters
122     processIncomingRequest(SnmpSecurityCache cache,
123                    int version,
124                    int msgID,
125                    int msgMaxSize,
126                    byte msgFlags,
127                    int msgSecurityModel,
128                    byte[] params,
129                    byte[] contextEngineID,
130                    byte[] contextName,
131                    byte[] data,
132                    byte[] encryptedPdu,
133                    SnmpDecryptedPdu decryptedPdu)
134     throws SnmpStatusException, SnmpSecurityException, SnmpUnknownSecModelException;
135           /**
136      * Called when a response is received from the network. It handles authentication and privacy. This call is routed to the dedicated model according to the model ID.
137      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
138      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
139      * @param version The SNMP protocol version.
140      * @param msgID The current request id.
141      * @param msgMaxSize The message max size.
142      * @param msgFlags The message flags (reportable, Auth and Priv).
143      * @param msgSecurityModel This current security model.
144      * @param params The security parameters in a marshalled format. The informations cointained in this array are model dependant.
145      * @param contextEngineID The context engine ID or null if encrypted.
146      * @param contextName The context name or null if encrypted.
147      * @param data The marshalled varbind list or null if encrypted.
148      * @param encryptedPdu The encrypted pdu or null if not encrypted.
149      * @param decryptedPdu The decrypted pdu. If no decryption is to be done, the passed context engine ID, context name and data could be used to fill this object.
150      * @return The security parameters.
151      
152      */

153     public SnmpSecurityParameters processIncomingResponse(SnmpSecurityCache cache,
154                               int version,
155                               int msgID,
156                               int msgMaxSize,
157                               byte msgFlags,
158                               int msgSecurityModel,
159                               byte[] params,
160                               byte[] contextEngineID,
161                               byte[] contextName,
162                               byte[] data,
163                               byte[] encryptedPdu,
164                               SnmpDecryptedPdu decryptedPdu)
165     throws SnmpStatusException, SnmpSecurityException, SnmpUnknownSecModelException;
166 }
167
Popular Tags