KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)file SnmpSecurityModel.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 1.19
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.snmp.SnmpSecurityException;
14 import com.sun.jmx.snmp.SnmpStatusException;
15 import com.sun.jmx.snmp.SnmpTooBigException;
16 import com.sun.jmx.snmp.SnmpSecurityParameters;
17
18 /**
19  * Security model interface. Any security model implementation must implement this interface in order to be integrated in the engine framework. Security models are called when SNMP messages are received or sent. They deal with security (authentication and privacy).
20  * <p><b>This API is a Sun Microsystems internal API and is subject
21  * to change without notice.</b></p>
22  * @since 1.5
23  */

24 public interface SnmpSecurityModel extends SnmpModel {
25     /**
26      * Called when a request is to be sent to the network. It must be securized.
27      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
28      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
29      * @param version The SNMP protocol version.
30      * @param msgID The current request id.
31      * @param msgMaxSize The message max size.
32      * @param msgFlags The message flags (reportable, Auth and Priv).
33      * @param msgSecurityModel This current security model.
34      * @param params The security parameters that contain the model dependant parameters.
35      * @param contextEngineID The context engine ID.
36      * @param contextName The context name.
37      * @param data The marshalled varbind list.
38      * @param dataLength The marshalled varbind list length.
39      * @param outputBytes The buffer to fill with securized request. This is a representation independant marshalled format. This buffer will be sent to the network.
40      * @return The marshalled byte number.
41      */

42     public int generateRequestMsg(SnmpSecurityCache cache,
43                   int version,
44                   int msgID,
45                   int msgMaxSize,
46                   byte msgFlags,
47                   int msgSecurityModel,
48                   SnmpSecurityParameters params,
49                   byte[] contextEngineID,
50                   byte[] contextName,
51                   byte[] data,
52                   int dataLength,
53                   byte[] outputBytes)
54     throws SnmpTooBigException, SnmpStatusException,
55            SnmpSecurityException;
56
57     /**
58      * Called when a response is to be sent to the network. It must be securized.
59      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
60      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
61      * @param version The SNMP protocol version.
62      * @param msgID The current request id.
63      * @param msgMaxSize The message max size.
64      * @param msgFlags The message flags (reportable, Auth and Priv)
65      * @param msgSecurityModel This current security model.
66      * @param params The security parameters that contain the model dependant parameters.
67      * @param contextEngineID The context engine ID.
68      * @param contextName The context name.
69      * @param data The marshalled varbind list.
70      * @param dataLength The marshalled varbind list length.
71      * @param outputBytes The buffer to fill with securized request. This is a representation independant marshalled format. This buffer will be sent to the network.
72      * @return The marshalled byte number.
73      */

74     public int generateResponseMsg(SnmpSecurityCache cache,
75                    int version,
76                    int msgID,
77                    int msgMaxSize,
78                    byte msgFlags,
79                    int msgSecurityModel,
80                    SnmpSecurityParameters params,
81                    byte[] contextEngineID,
82                    byte[] contextName,
83                    byte[] data,
84                    int dataLength,
85                    byte[] outputBytes)
86     throws SnmpTooBigException, SnmpStatusException,
87            SnmpSecurityException;
88     /**
89      * Called when a request is received from the network. It handles authentication and privacy.
90      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
91      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
92      * @param version The SNMP protocol version.
93      * @param msgID The current request id.
94      * @param msgMaxSize The message max size.
95      * @param msgFlags The message flags (reportable, Auth and Priv)
96      * @param msgSecurityModel This current security model.
97      * @param params The security parameters in a marshalled format. The informations contained in this array are model dependant.
98      * @param contextEngineID The context engine ID or null if encrypted.
99      * @param contextName The context name or null if encrypted.
100      * @param data The marshalled varbind list or null if encrypted
101      * @param encryptedPdu The encrypted pdu or null if not encrypted.
102      * @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.
103      * @return The decoded security parameters.
104      
105      */

106     public SnmpSecurityParameters
107     processIncomingRequest(SnmpSecurityCache cache,
108                    int version,
109                    int msgID,
110                    int msgMaxSize,
111                    byte msgFlags,
112                    int msgSecurityModel,
113                    byte[] params,
114                    byte[] contextEngineID,
115                    byte[] contextName,
116                    byte[] data,
117                    byte[] encryptedPdu,
118                    SnmpDecryptedPdu decryptedPdu)
119     throws SnmpStatusException, SnmpSecurityException;
120  /**
121      * Called when a response is received from the network. It handles authentication and privacy.
122      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
123      * @param cache The cache that has been created by calling <CODE>createSecurityCache</CODE> on this model.
124      * @param version The SNMP protocol version.
125      * @param msgID The current request id.
126      * @param msgMaxSize The message max size.
127      * @param msgFlags The message flags (reportable, Auth and Priv)
128      * @param msgSecurityModel This current security model.
129      * @param params The security parameters in a marshalled format. The informations cointained in this array are model dependant.
130      * @param contextEngineID The context engine ID or null if encrypted.
131      * @param contextName The context name or null if encrypted.
132      * @param data The marshalled varbind list or null if encrypted
133      * @param encryptedPdu The encrypted pdu or null if not encrypted.
134      * @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.
135      * @return The security parameters.
136      
137      */

138     public SnmpSecurityParameters processIncomingResponse(SnmpSecurityCache cache,
139                               int version,
140                               int msgID,
141                               int msgMaxSize,
142                               byte msgFlags,
143                               int msgSecurityModel,
144                               byte[] params,
145                               byte[] contextEngineID,
146                               byte[] contextName,
147                               byte[] data,
148                               byte[] encryptedPdu,
149                               SnmpDecryptedPdu decryptedPdu)
150     throws SnmpStatusException, SnmpSecurityException;
151     
152     /**
153      * Instantiate an <CODE>SnmpSecurityCache</CODE> that is dependant to the model implementation.
154      * @return The model dependant security cache.
155      */

156     public SnmpSecurityCache createSecurityCache();
157     /**
158      * Release the previously created cache.
159      * @param cache The security cache to release.
160      */

161     public void releaseSecurityCache(SnmpSecurityCache cache);
162 }
163
Popular Tags