KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)file SnmpMsgProcessingSubSystem.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 java.util.Vector JavaDoc;
14 import com.sun.jmx.snmp.SnmpMsg;
15 import com.sun.jmx.snmp.SnmpParams;
16 import com.sun.jmx.snmp.SnmpPdu;
17 import com.sun.jmx.snmp.SnmpVarBind;
18 import com.sun.jmx.snmp.SnmpStatusException;
19 import com.sun.jmx.snmp.SnmpTooBigException;
20 import com.sun.jmx.snmp.SnmpPduFactory;
21 import com.sun.jmx.snmp.SnmpSecurityParameters;
22
23 import com.sun.jmx.snmp.SnmpUnknownMsgProcModelException;
24
25 /**
26  * Message processing sub system interface. To allow engine integration, a message processing sub system must implement this interface. This sub system is called by the dispatcher when receiving or sending calls.
27  * <p><b>This API is a Sun Microsystems internal API and is subject
28  * to change without notice.</b></p>
29  * @since 1.5
30  */

31 public interface SnmpMsgProcessingSubSystem extends SnmpSubSystem {
32
33     /**
34      * Attaches the security sub system to this sub system. Message processing model are making usage of various security sub systems. This direct attachement avoid the need of accessing the engine to retrieve the Security sub system.
35      * @param security The security sub system.
36      */

37     public void setSecuritySubSystem(SnmpSecuritySubSystem security);
38     /** Gets the attached security sub system.
39      * @return The security sub system.
40      */

41     public SnmpSecuritySubSystem getSecuritySubSystem();
42     
43     /**
44      * This method is called when a call is received from the network.
45      * @param model The model ID.
46      * @param factory The pdu factory to use to encode and decode pdu.
47      * @return The object that will handle every steps of the receiving (mainly unmarshalling and security).
48      */

49     public SnmpIncomingRequest getIncomingRequest(int model,
50                           SnmpPduFactory factory)
51     throws SnmpUnknownMsgProcModelException;
52     /**
53      * This method is called when a call is to be sent to the network. The sub system routes the call to the dedicated model according to the model ID.
54      * @param model The model ID.
55      * @param factory The pdu factory to use to encode and decode pdu.
56      * @return The object that will handle every steps of the sending (mainly marshalling and security).
57      */

58     public SnmpOutgoingRequest getOutgoingRequest(int model,
59                           SnmpPduFactory factory) throws SnmpUnknownMsgProcModelException ;
60     /**
61      * This method is called to instantiate a pdu according to the passed pdu type and parameters. The sub system routes the call to the dedicated model according to the model ID.
62      * @param model The model ID.
63      * @param p The request parameters.
64      * @param type The pdu type.
65      * @return The pdu.
66      */

67     public SnmpPdu getRequestPdu(int model, SnmpParams p, int type) throws SnmpUnknownMsgProcModelException, SnmpStatusException ;
68      /**
69      * This method is called when a call is received from the network. The sub system routes the call to the dedicated model according to the model ID.
70      * @param model The model ID.
71      * @param factory The pdu factory to use to decode pdu.
72      * @return The object that will handle every steps of the receiving (mainly marshalling and security).
73      */

74     public SnmpIncomingResponse getIncomingResponse(int model,
75                             SnmpPduFactory factory) throws SnmpUnknownMsgProcModelException;
76     /**
77      * This method is called to encode a full scoped pdu that as not been encrypted. <CODE>contextName</CODE>, <CODE>contextEngineID</CODE> and data are known. It will be routed to the dedicated model according to the version value.
78      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
79      * @param version The SNMP protocol version.
80      * @param msgID The SNMP message ID.
81      * @param msgMaxSize The max message size.
82      * @param msgFlags The message flags.
83      * @param msgSecurityModel The message security model.
84      * @param params The security parameters.
85      * @param contextEngineID The context engine ID.
86      * @param contextName The context name.
87      * @param data The encoded data.
88      * @param dataLength The encoded data length.
89      * @param outputBytes The buffer containing the encoded message.
90      * @return The encoded bytes number.
91      */

92     public int encode(int version,
93               int msgID,
94               int msgMaxSize,
95               byte msgFlags,
96               int msgSecurityModel,
97               SnmpSecurityParameters params,
98               byte[] contextEngineID,
99               byte[] contextName,
100               byte[] data,
101               int dataLength,
102               byte[] outputBytes)
103     throws SnmpTooBigException,
104            SnmpUnknownMsgProcModelException ;
105     /**
106      * This method is called to encode a full scoped pdu that as been encrypted. <CODE>contextName</CODE>, <CODE>contextEngineID</CODE> and data are not known. It will be routed to the dedicated model according to the version value.
107      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
108      * @param version The SNMP protocol version.
109      * @param msgID The SNMP message ID.
110      * @param msgMaxSize The max message size.
111      * @param msgFlags The message flags.
112      * @param msgSecurityModel The message security model.
113      * @param params The security parameters.
114      * @param encryptedPdu The encrypted pdu.
115      * @param outputBytes The buffer containing the encoded message.
116      * @return The encoded bytes number.
117      */

118     public int encodePriv(int version,
119               int msgID,
120               int msgMaxSize,
121               byte msgFlags,
122               int msgSecurityModel,
123               SnmpSecurityParameters params,
124               byte[] encryptedPdu,
125               byte[] outputBytes) throws SnmpTooBigException, SnmpUnknownMsgProcModelException;
126
127      /**
128      * This method returns a decoded scoped pdu. This method decodes only the <CODE>contextEngineID</CODE>, <CODE>contextName</CODE> and data. It is needed by the <CODE>SnmpSecurityModel</CODE> after decryption. It will be routed to the dedicated model according to the version value.
129      * @param version The SNMP protocol version.
130      * @param pdu The encoded pdu.
131      * @return the partialy scoped pdu.
132      */

133     public SnmpDecryptedPdu decode(int version,
134                    byte[] pdu)
135     throws SnmpStatusException, SnmpUnknownMsgProcModelException;
136
137       /**
138      * This method returns an encoded scoped pdu. This method encodes only the <CODE>contextEngineID</CODE>, <CODE>contextName</CODE> and data. It is needed by the <CODE>SnmpSecurityModel</CODE> for decryption. It will be routed to the dedicated model according to the version value.
139      * @param version The SNMP protocol version.
140      * @param pdu The pdu to encode.
141      * @param outputBytes The partialy scoped pdu.
142      * @return The encoded bytes number.
143      */

144     public int encode(int version,
145               SnmpDecryptedPdu pdu,
146               byte[] outputBytes)
147     throws SnmpTooBigException, SnmpUnknownMsgProcModelException;
148 }
149
150
151
Popular Tags