View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.mina.transport.tcp;
20  
21  import java.net.Socket;
22  
23  import javax.net.ssl.SSLContext;
24  
25  import org.apache.mina.api.IoSessionConfig;
26  
27  /**
28   *  A {@link IoSessionConfig} for socket based sessions.
29   *
30   * @author <a href="http://mina.apache.org">Apache MINA Project</a>
31   */
32  public interface TcpSessionConfig extends IoSessionConfig {
33      /**
34       * @see Socket#getTcpNoDelay()
35       */
36      Boolean isTcpNoDelay();
37  
38      /**
39       * @see Socket#setTcpNoDelay(boolean)
40       */
41      void setTcpNoDelay(boolean tcpNoDelay);
42  
43      /**
44       * @see Socket#getKeepAlive() 
45       * return <code>null</code> if the default system value is used
46       */
47      Boolean isKeepAlive();
48  
49      /**
50       * @see Socket#setKeepAlive(boolean) 
51       */
52      void setKeepAlive(boolean keepAlive);
53  
54      /**
55       * @see Socket#getOOBInline() 
56       * return <code>null</code> if the default system value is used
57       */
58      Boolean isOobInline();
59  
60      /**
61       * @see Socket#setOOBInline(boolean) 
62       */
63      void setOobInline(boolean oobInline);
64  
65      /**
66       * Please note that enabling <tt>SO_LINGER</tt> in Java NIO can result
67       * in platform-dependent behavior and unexpected blocking of I/O thread.
68       *
69       * @see Socket#getSoLinger()
70       * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6179351">Sun Bug Database</a>
71       * return <code>null</code> if the default system value is used
72       */
73      Integer getSoLinger();
74  
75      /**
76       * Please note that enabling <tt>SO_LINGER</tt> in Java NIO can result
77       * in platform-dependent behavior and unexpected blocking of I/O thread.
78       *
79       * @param soLinger Please specify a negative value to disable <tt>SO_LINGER</tt>.
80       *
81       * @see Socket#setSoLinger(boolean, int)
82       * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6179351">Sun Bug Database</a>
83       */
84      void setSoLinger(int soLinger);
85  
86      /**
87       * Tells if the session provides some encryption (SSL/TLS)
88       * 
89       * @return <code>true</code> if the session is secured
90       */
91      boolean isSecured();
92  
93      /**
94       * @return The {@link SSLContext} instance stored in the configuration.
95       */
96      SSLContext getSslContext();
97  
98      /**
99       * @return The {@link SSLContext} instance stored in the configuration.
100      */
101     void setSslContext(SSLContext sslContext);
102 }