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 import io.netty.channel.WriteBufferWaterMark; 25 26 /** 27 * A [email protected] ChannelConfig} for a [email protected] SctpChannel}. 28 * <p/> 29 * <h3>Available options</h3> 30 * <p/> 31 * In addition to the options provided by [email protected] ChannelConfig}, 32 * [email protected] SctpChannelConfig} allows the following options in the option map: 33 * <p/> 34 * <table border="1" cellspacing="0" cellpadding="6"> 35 * <tr> 36 * <th>Name</th><th>Associated setter method</th> 37 * </tr><tr> 38 * <td>[email protected] ChannelOption#SO_RCVBUF}</td><td>[email protected] #setReceiveBufferSize(int)}</td> 39 * </tr><tr> 40 * <td>[email protected] ChannelOption#SO_SNDBUF}</td><td>[email protected] #setSendBufferSize(int)}</td> 41 * </tr><tr> 42 * <td>[email protected] SctpChannelOption#SCTP_NODELAY}</td><td>[email protected] #setSctpNoDelay(boolean)}}</td> 43 * </tr><tr> 44 * <td>[email protected] SctpChannelOption#SCTP_INIT_MAXSTREAMS}</td><td>[email protected] #setInitMaxStreams(InitMaxStreams)}</td> 45 * </tr> 46 * </table> 47 */ 48 public interface SctpChannelConfig extends ChannelConfig { 49 50 /** 51 * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 52 * [email protected] SCTP_NODELAY}</a> option. Please note that the default value of this option is [email protected] true} unlike the 53 * operating system default ([email protected] false}). However, for some buggy platforms, such as Android, that shows erratic 54 * behavior with Nagle's algorithm disabled, the default value remains to be [email protected] false}. 55 */ 56 boolean isSctpNoDelay(); 57 58 /** 59 * Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 60 * [email protected] SCTP_NODELAY}</a> option. Please note that the default value of this option is [email protected] true} unlike the 61 * operating system default ([email protected] false}). However, for some buggy platforms, such as Android, that shows erratic 62 * behavior with Nagle's algorithm disabled, the default value remains to be [email protected] false}. 63 */ 64 SctpChannelConfig setSctpNoDelay(boolean sctpNoDelay); 65 66 /** 67 * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 68 * [email protected] SO_SNDBUF}</a> option. 69 */ 70 int getSendBufferSize(); 71 72 /** 73 * Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 74 * [email protected] SO_SNDBUF}</a> option. 75 */ 76 SctpChannelConfig setSendBufferSize(int sendBufferSize); 77 78 /** 79 * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 80 * [email protected] SO_RCVBUF}</a> option. 81 */ 82 int getReceiveBufferSize(); 83 84 /** 85 * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 86 * [email protected] SO_RCVBUF}</a> option. 87 */ 88 SctpChannelConfig setReceiveBufferSize(int receiveBufferSize); 89 90 /** 91 * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 92 * [email protected] SCTP_INIT_MAXSTREAMS}</a> option. 93 */ 94 InitMaxStreams getInitMaxStreams(); 95 96 /** 97 * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html"> 98 * [email protected] SCTP_INIT_MAXSTREAMS}</a> option. 99 */ 100 SctpChannelConfig setInitMaxStreams(InitMaxStreams initMaxStreams); 101 102 @Override 103 SctpChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis); 104 105 @Override 106 @Deprecated 107 SctpChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead); 108 109 @Override 110 SctpChannelConfig setWriteSpinCount(int writeSpinCount); 111 112 @Override 113 SctpChannelConfig setAllocator(ByteBufAllocator allocator); 114 115 @Override 116 SctpChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator); 117 118 @Override 119 SctpChannelConfig setAutoRead(boolean autoRead); 120 121 @Override 122 SctpChannelConfig setAutoClose(boolean autoClose); 123 124 @Override 125 @Deprecated 126 SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark); 127 128 @Override 129 @Deprecated 130 SctpChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark); 131 132 @Override 133 SctpChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark); 134 135 @Override 136 SctpChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator); 137 }