KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > transport > ConnectionOrientedTransportMapping


1 /*_############################################################################
2   _##
3   _## SNMP4J - ConnectionOrientedTransportMapping.java
4   _##
5   _## Copyright 2003-2007 Frank Fock and Jochen Katz (SNMP4J.org)
6   _##
7   _## Licensed under the Apache License, Version 2.0 (the "License");
8   _## you may not use this file except in compliance with the License.
9   _## You may obtain a copy of the License at
10   _##
11   _## http://www.apache.org/licenses/LICENSE-2.0
12   _##
13   _## Unless required by applicable law or agreed to in writing, software
14   _## distributed under the License is distributed on an "AS IS" BASIS,
15   _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   _## See the License for the specific language governing permissions and
17   _## limitations under the License.
18   _##
19   _##########################################################################*/

20
21
22 package org.snmp4j.transport;
23
24 import org.snmp4j.*;
25 import org.snmp4j.smi.Address;
26 import java.io.IOException JavaDoc;
27
28 /**
29  * Transport mappings for connection oriented transport protocols have to
30  * implement this interface.
31  *
32  * @author Frank Fock
33  * @version 1.7.1
34  * @since 1.7
35  */

36 public interface ConnectionOrientedTransportMapping extends TransportMapping {
37
38   /**
39    * Returns the <code>MessageLengthDecoder</code> used by this transport
40    * mapping.
41    * @return
42    * a MessageLengthDecoder instance.
43    */

44   MessageLengthDecoder getMessageLengthDecoder();
45
46   /**
47    * Sets the <code>MessageLengthDecoder</code> that decodes the total
48    * message length from the header of a message.
49    *
50    * @param messageLengthDecoder
51    * a MessageLengthDecoder instance.
52    */

53   void setMessageLengthDecoder(MessageLengthDecoder messageLengthDecoder);
54
55   /**
56    * Sets the connection timeout. This timeout specifies the time a connection
57    * may be idle before it is closed.
58    * @param connectionTimeout
59    * the idle timeout in milliseconds. A zero or negative value will disable
60    * any timeout and connections opened by this transport mapping will stay
61    * opened until they are explicitly closed.
62    */

63   void setConnectionTimeout(long connectionTimeout);
64
65   /**
66    * Adds a transport state listener that is to be informed about connection
67    * state changes.
68    * @param l
69    * a TransportStateListener.
70    */

71   void addTransportStateListener(TransportStateListener l);
72
73   /**
74    * Removes the supplied transport state listener.
75    * @param l
76    * a TransportStateListener.
77    */

78   void removeTransportStateListener(TransportStateListener l);
79
80   /**
81    * Closes the connection to the given remote address (socket).
82    * @param remoteAddress
83    * the address of the remote socket.
84    * @return
85    * <code>true</code> if the connection could be closed and
86    * <code>false</code> if either the connection does not exists.
87    * @since 1.7.1
88    */

89   boolean close(Address remoteAddress) throws IOException JavaDoc;
90
91 }
92
Popular Tags