KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)file SnmpMsgProcessingModel.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
14 import com.sun.jmx.snmp.mpm.SnmpMsgTranslator;
15
16 import com.sun.jmx.snmp.SnmpTooBigException;
17 import com.sun.jmx.snmp.SnmpStatusException;
18 import com.sun.jmx.snmp.SnmpPdu;
19 import com.sun.jmx.snmp.SnmpPduFactory;
20 import com.sun.jmx.snmp.SnmpSecurityParameters;
21
22 import com.sun.jmx.snmp.SnmpParams;
23 /**
24  * The message processing model interface. Any message processing model must implement this interface in order to be integrated in the engine framework.
25  * The model is called by the dispatcher when a call is received or when a call is sent.
26  * <p><b>This API is a Sun Microsystems internal API and is subject
27  * to change without notice.</b></p>
28  * @since 1.5
29  */

30 public interface SnmpMsgProcessingModel extends SnmpModel {
31     /**
32      * This method is called when a call is to be sent to the network.
33      * @param factory The pdu factory to use to encode and decode pdu.
34      * @return The object that will handle every steps of the sending (mainly marshalling and security).
35      */

36     public SnmpOutgoingRequest getOutgoingRequest(SnmpPduFactory factory);
37     /**
38      * This method is called when a call is received from the network.
39      * @param factory The pdu factory to use to encode and decode pdu.
40      * @return The object that will handle every steps of the receiving (mainly unmarshalling and security).
41      */

42     public SnmpIncomingRequest getIncomingRequest(SnmpPduFactory factory);
43     
44      /**
45      * This method is called when a response is received from the network.
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 SnmpIncomingResponse getIncomingResponse(SnmpPduFactory factory);
50     /**
51      * This method is called to instantiate a pdu according to the passed pdu type and parameters.
52      * @param p The request parameters.
53      * @param type The pdu type.
54      * @return The pdu.
55      */

56     public SnmpPdu getRequestPdu(SnmpParams p, int type) throws SnmpStatusException;
57
58     /**
59      * This method is called to encode a full scoped pdu that has not been encrypted. <CODE>contextName</CODE>, <CODE>contextEngineID</CODE> and data are known.
60      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
61      * @param version The SNMP protocol version.
62      * @param msgID The SNMP message ID.
63      * @param msgMaxSize The max message size.
64      * @param msgFlags The message flags.
65      * @param msgSecurityModel The message security model.
66      * @param params The security parameters.
67      * @param contextEngineID The context engine ID.
68      * @param contextName The context name.
69      * @param data The encoded data.
70      * @param dataLength The encoded data length.
71      * @param outputBytes The buffer containing the encoded message.
72      * @return The encoded bytes number.
73      */

74     public int encode(int version,
75               int msgID,
76               int msgMaxSize,
77               byte msgFlags,
78               int msgSecurityModel,
79               SnmpSecurityParameters params,
80               byte[] contextEngineID,
81               byte[] contextName,
82               byte[] data,
83               int dataLength,
84               byte[] outputBytes) throws SnmpTooBigException;
85     /**
86      * This method is called to encode a full scoped pdu that as been encrypted. <CODE>contextName</CODE>, <CODE>contextEngineID</CODE> and data are known.
87      * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
88      * @param version The SNMP protocol version.
89      * @param msgID The SNMP message ID.
90      * @param msgMaxSize The max message size.
91      * @param msgFlags The message flags.
92      * @param msgSecurityModel The message security model.
93      * @param params The security parameters.
94      * @param encryptedPdu The encrypted pdu.
95      * @param outputBytes The buffer containing the encoded message.
96      * @return The encoded bytes number.
97      */

98     public int encodePriv(int version,
99               int msgID,
100               int msgMaxSize,
101               byte msgFlags,
102               int msgSecurityModel,
103               SnmpSecurityParameters params,
104               byte[] encryptedPdu,
105               byte[] outputBytes) throws SnmpTooBigException;
106      /**
107      * 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.
108      * @param pdu The encoded pdu.
109      * @return The partialy scoped pdu.
110      */

111     public SnmpDecryptedPdu decode(byte[] pdu) throws SnmpStatusException;
112     
113     /**
114      * This method returns an encoded scoped pdu. This method encode only the <CODE>contextEngineID</CODE>, <CODE>contextName</CODE> and data. It is needed by the <CODE>SnmpSecurityModel</CODE> for decryption.
115      * @param pdu The pdu to encode.
116      * @param outputBytes The partialy scoped pdu.
117      * @return The encoded bytes number.
118      */

119     public int encode(SnmpDecryptedPdu pdu,
120               byte[] outputBytes) throws SnmpTooBigException;
121
122     /**
123      * In order to change the behavior of the translator, set it.
124      * @param translator The translator that will be used.
125      */

126     public void setMsgTranslator(SnmpMsgTranslator translator);
127
128     /**
129      * Returns the current translator.
130      * @return The current translator.
131      */

132     public SnmpMsgTranslator getMsgTranslator();
133 }
134
Popular Tags