View Javadoc
1   /*
2    * Copyright 2011 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.channel.sctp;
17  
18  import com.sun.nio.sctp.SctpStandardSocketOptions.InitMaxStreams;
19  import io.netty.buffer.ByteBufAllocator;
20  import io.netty.channel.ChannelConfig;
21  import io.netty.channel.ChannelOption;
22  import io.netty.channel.MessageSizeEstimator;
23  import io.netty.channel.RecvByteBufAllocator;
24  
25  /**
26   * A {@link ChannelConfig} for a {@link SctpChannel}.
27   * <p/>
28   * <h3>Available options</h3>
29   * <p/>
30   * In addition to the options provided by {@link ChannelConfig},
31   * {@link SctpChannelConfig} allows the following options in the option map:
32   * <p/>
33   * <table border="1" cellspacing="0" cellpadding="6">
34   * <tr>
35   * <th>Name</th><th>Associated setter method</th>
36   * </tr><tr>
37   * <td>{@link ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td>
38   * </tr><tr>
39   * <td>{@link ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td>
40   * </tr><tr>
41   * <td>{@link SctpChannelOption#SCTP_NODELAY}</td><td>{@link #setSctpNoDelay(boolean)}}</td>
42   * </tr><tr>
43   * <td>{@link SctpChannelOption#SCTP_INIT_MAXSTREAMS}</td><td>{@link #setInitMaxStreams(InitMaxStreams)}</td>
44   * </tr>
45   * </table>
46   */
47  public interface SctpChannelConfig extends ChannelConfig {
48  
49      /**
50       * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
51       * {@code SCTP_NODELAY}</a> option.  Please note that the default value of this option is {@code true} unlike the
52       * operating system default ({@code false}). However, for some buggy platforms, such as Android, that shows erratic
53       * behavior with Nagle's algorithm disabled, the default value remains to be {@code false}.
54       */
55      boolean isSctpNoDelay();
56  
57      /**
58       * Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
59       * {@code SCTP_NODELAY}</a> option.  Please note that the default value of this option is {@code true} unlike the
60       * operating system default ({@code false}). However, for some buggy platforms, such as Android, that shows erratic
61       * behavior with Nagle's algorithm disabled, the default value remains to be {@code false}.
62       */
63      SctpChannelConfig setSctpNoDelay(boolean sctpNoDelay);
64  
65      /**
66       * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
67       *     {@code SO_SNDBUF}</a> option.
68       */
69      int getSendBufferSize();
70  
71      /**
72       * Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
73       *     {@code SO_SNDBUF}</a> option.
74       */
75      SctpChannelConfig setSendBufferSize(int sendBufferSize);
76  
77      /**
78       * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
79       *     {@code SO_RCVBUF}</a> option.
80       */
81      int getReceiveBufferSize();
82  
83      /**
84       * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
85       *     {@code SO_RCVBUF}</a> option.
86       */
87      SctpChannelConfig setReceiveBufferSize(int receiveBufferSize);
88  
89      /**
90       * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
91       *     {@code SCTP_INIT_MAXSTREAMS}</a> option.
92       */
93      InitMaxStreams getInitMaxStreams();
94  
95      /**
96       * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
97       *     {@code SCTP_INIT_MAXSTREAMS}</a> option.
98       */
99      SctpChannelConfig setInitMaxStreams(InitMaxStreams initMaxStreams);
100 
101     @Override
102     SctpChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
103 
104     @Override
105     SctpChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead);
106 
107     @Override
108     SctpChannelConfig setWriteSpinCount(int writeSpinCount);
109 
110     @Override
111     SctpChannelConfig setAllocator(ByteBufAllocator allocator);
112 
113     @Override
114     SctpChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator);
115 
116     @Override
117     SctpChannelConfig setAutoRead(boolean autoRead);
118 
119     @Override
120     SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
121 
122     @Override
123     SctpChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark);
124 
125     @Override
126     SctpChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
127 }