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