move sctp to netty-contrib
This commit is contained in:
parent
938371e9eb
commit
1b906bf706
42 changed files with 11 additions and 3680 deletions
|
@ -1,3 +1,3 @@
|
|||
group = org.xbib.netty
|
||||
name = netty
|
||||
version = 4.1.105.0
|
||||
version = 4.1.107.0
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
dependencies {
|
||||
api project(':netty-channel')
|
||||
}
|
|
@ -1,245 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import com.sun.nio.sctp.SctpChannel;
|
||||
import com.sun.nio.sctp.SctpStandardSocketOptions;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.DefaultChannelConfig;
|
||||
import io.netty.channel.MessageSizeEstimator;
|
||||
import io.netty.channel.RecvByteBufAllocator;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
import io.netty.util.internal.ObjectUtil;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.netty.channel.ChannelOption.SO_RCVBUF;
|
||||
import static io.netty.channel.ChannelOption.SO_SNDBUF;
|
||||
import static io.netty.channel.sctp.SctpChannelOption.SCTP_INIT_MAXSTREAMS;
|
||||
import static io.netty.channel.sctp.SctpChannelOption.SCTP_NODELAY;
|
||||
|
||||
/**
|
||||
* The default {@link SctpChannelConfig} implementation for SCTP.
|
||||
*/
|
||||
public class DefaultSctpChannelConfig extends DefaultChannelConfig implements SctpChannelConfig {
|
||||
|
||||
private final SctpChannel javaChannel;
|
||||
|
||||
public DefaultSctpChannelConfig(io.netty.channel.sctp.SctpChannel channel, SctpChannel javaChannel) {
|
||||
super(channel);
|
||||
this.javaChannel = ObjectUtil.checkNotNull(javaChannel, "javaChannel");
|
||||
|
||||
// Enable TCP_NODELAY by default if possible.
|
||||
if (PlatformDependent.canEnableTcpNoDelayByDefault()) {
|
||||
try {
|
||||
setSctpNoDelay(true);
|
||||
} catch (Exception e) {
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ChannelOption<?>, Object> getOptions() {
|
||||
return getOptions(
|
||||
super.getOptions(),
|
||||
SO_RCVBUF, SO_SNDBUF, SCTP_NODELAY, SCTP_INIT_MAXSTREAMS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getOption(ChannelOption<T> option) {
|
||||
if (option == SO_RCVBUF) {
|
||||
return (T) Integer.valueOf(getReceiveBufferSize());
|
||||
}
|
||||
if (option == SO_SNDBUF) {
|
||||
return (T) Integer.valueOf(getSendBufferSize());
|
||||
}
|
||||
if (option == SCTP_NODELAY) {
|
||||
return (T) Boolean.valueOf(isSctpNoDelay());
|
||||
}
|
||||
if (option == SCTP_INIT_MAXSTREAMS) {
|
||||
return (T) getInitMaxStreams();
|
||||
}
|
||||
return super.getOption(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean setOption(ChannelOption<T> option, T value) {
|
||||
validate(option, value);
|
||||
|
||||
if (option == SO_RCVBUF) {
|
||||
setReceiveBufferSize((Integer) value);
|
||||
} else if (option == SO_SNDBUF) {
|
||||
setSendBufferSize((Integer) value);
|
||||
} else if (option == SCTP_NODELAY) {
|
||||
setSctpNoDelay((Boolean) value);
|
||||
} else if (option == SCTP_INIT_MAXSTREAMS) {
|
||||
setInitMaxStreams((SctpStandardSocketOptions.InitMaxStreams) value);
|
||||
} else {
|
||||
return super.setOption(option, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSctpNoDelay() {
|
||||
try {
|
||||
return javaChannel.getOption(SctpStandardSocketOptions.SCTP_NODELAY);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setSctpNoDelay(boolean sctpNoDelay) {
|
||||
try {
|
||||
javaChannel.setOption(SctpStandardSocketOptions.SCTP_NODELAY, sctpNoDelay);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSendBufferSize() {
|
||||
try {
|
||||
return javaChannel.getOption(SctpStandardSocketOptions.SO_SNDBUF);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setSendBufferSize(int sendBufferSize) {
|
||||
try {
|
||||
javaChannel.setOption(SctpStandardSocketOptions.SO_SNDBUF, sendBufferSize);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getReceiveBufferSize() {
|
||||
try {
|
||||
return javaChannel.getOption(SctpStandardSocketOptions.SO_RCVBUF);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setReceiveBufferSize(int receiveBufferSize) {
|
||||
try {
|
||||
javaChannel.setOption(SctpStandardSocketOptions.SO_RCVBUF, receiveBufferSize);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpStandardSocketOptions.InitMaxStreams getInitMaxStreams() {
|
||||
try {
|
||||
return javaChannel.getOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setInitMaxStreams(SctpStandardSocketOptions.InitMaxStreams initMaxStreams) {
|
||||
try {
|
||||
javaChannel.setOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS, initMaxStreams);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
|
||||
super.setConnectTimeoutMillis(connectTimeoutMillis);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public SctpChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead) {
|
||||
super.setMaxMessagesPerRead(maxMessagesPerRead);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setWriteSpinCount(int writeSpinCount) {
|
||||
super.setWriteSpinCount(writeSpinCount);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setAllocator(ByteBufAllocator allocator) {
|
||||
super.setAllocator(allocator);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator) {
|
||||
super.setRecvByteBufAllocator(allocator);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setAutoRead(boolean autoRead) {
|
||||
super.setAutoRead(autoRead);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark) {
|
||||
super.setWriteBufferWaterMark(writeBufferWaterMark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator) {
|
||||
super.setMessageSizeEstimator(estimator);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,227 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
|
||||
|
||||
import com.sun.nio.sctp.SctpServerChannel;
|
||||
import com.sun.nio.sctp.SctpStandardSocketOptions;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.DefaultChannelConfig;
|
||||
import io.netty.channel.MessageSizeEstimator;
|
||||
import io.netty.channel.RecvByteBufAllocator;
|
||||
import io.netty.channel.ServerChannelRecvByteBufAllocator;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
import io.netty.util.NetUtil;
|
||||
import io.netty.util.internal.ObjectUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The default {@link SctpServerChannelConfig} implementation for SCTP.
|
||||
*/
|
||||
public class DefaultSctpServerChannelConfig extends DefaultChannelConfig implements SctpServerChannelConfig {
|
||||
|
||||
private final SctpServerChannel javaChannel;
|
||||
private volatile int backlog = NetUtil.SOMAXCONN;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*/
|
||||
public DefaultSctpServerChannelConfig(
|
||||
io.netty.channel.sctp.SctpServerChannel channel, SctpServerChannel javaChannel) {
|
||||
super(channel, new ServerChannelRecvByteBufAllocator());
|
||||
this.javaChannel = ObjectUtil.checkNotNull(javaChannel, "javaChannel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ChannelOption<?>, Object> getOptions() {
|
||||
return getOptions(
|
||||
super.getOptions(),
|
||||
ChannelOption.SO_RCVBUF, ChannelOption.SO_SNDBUF, SctpChannelOption.SCTP_INIT_MAXSTREAMS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getOption(ChannelOption<T> option) {
|
||||
if (option == ChannelOption.SO_RCVBUF) {
|
||||
return (T) Integer.valueOf(getReceiveBufferSize());
|
||||
}
|
||||
if (option == ChannelOption.SO_SNDBUF) {
|
||||
return (T) Integer.valueOf(getSendBufferSize());
|
||||
}
|
||||
if (option == SctpChannelOption.SCTP_INIT_MAXSTREAMS) {
|
||||
return (T) getInitMaxStreams();
|
||||
}
|
||||
return super.getOption(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean setOption(ChannelOption<T> option, T value) {
|
||||
validate(option, value);
|
||||
|
||||
if (option == ChannelOption.SO_RCVBUF) {
|
||||
setReceiveBufferSize((Integer) value);
|
||||
} else if (option == ChannelOption.SO_SNDBUF) {
|
||||
setSendBufferSize((Integer) value);
|
||||
} else if (option == SctpChannelOption.SCTP_INIT_MAXSTREAMS) {
|
||||
setInitMaxStreams((SctpStandardSocketOptions.InitMaxStreams) value);
|
||||
} else {
|
||||
return super.setOption(option, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSendBufferSize() {
|
||||
try {
|
||||
return javaChannel.getOption(SctpStandardSocketOptions.SO_SNDBUF);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setSendBufferSize(int sendBufferSize) {
|
||||
try {
|
||||
javaChannel.setOption(SctpStandardSocketOptions.SO_SNDBUF, sendBufferSize);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getReceiveBufferSize() {
|
||||
try {
|
||||
return javaChannel.getOption(SctpStandardSocketOptions.SO_RCVBUF);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setReceiveBufferSize(int receiveBufferSize) {
|
||||
try {
|
||||
javaChannel.setOption(SctpStandardSocketOptions.SO_RCVBUF, receiveBufferSize);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpStandardSocketOptions.InitMaxStreams getInitMaxStreams() {
|
||||
try {
|
||||
return javaChannel.getOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setInitMaxStreams(SctpStandardSocketOptions.InitMaxStreams initMaxStreams) {
|
||||
try {
|
||||
javaChannel.setOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS, initMaxStreams);
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBacklog() {
|
||||
return backlog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setBacklog(int backlog) {
|
||||
checkPositiveOrZero(backlog, "backlog");
|
||||
this.backlog = backlog;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public SctpServerChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead) {
|
||||
super.setMaxMessagesPerRead(maxMessagesPerRead);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setWriteSpinCount(int writeSpinCount) {
|
||||
super.setWriteSpinCount(writeSpinCount);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) {
|
||||
super.setConnectTimeoutMillis(connectTimeoutMillis);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setAllocator(ByteBufAllocator allocator) {
|
||||
super.setAllocator(allocator);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator) {
|
||||
super.setRecvByteBufAllocator(allocator);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setAutoRead(boolean autoRead) {
|
||||
super.setAutoRead(autoRead);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setAutoClose(boolean autoClose) {
|
||||
super.setAutoClose(autoClose);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark) {
|
||||
super.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark) {
|
||||
super.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark) {
|
||||
super.setWriteBufferWaterMark(writeBufferWaterMark);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpServerChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator) {
|
||||
super.setMessageSizeEstimator(estimator);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import com.sun.nio.sctp.Association;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A SCTP/IP {@link Channel} interface for single SCTP association.
|
||||
*
|
||||
* <p>
|
||||
* The SctpChannel is a message-oriented, connected transport which supports multi-streaming and multi-homing.
|
||||
* </p>
|
||||
*/
|
||||
public interface SctpChannel extends Channel {
|
||||
@Override
|
||||
SctpServerChannel parent();
|
||||
|
||||
/**
|
||||
* Returns the underlying SCTP association.
|
||||
*/
|
||||
Association association();
|
||||
|
||||
/**
|
||||
* Return the (primary) local address of the SCTP channel.
|
||||
*
|
||||
* Please note that, this return the first local address in the underlying SCTP Channel's
|
||||
* local address iterator to support Netty Channel API. In other words, its the application's
|
||||
* responsibility to keep track of it's local primary address.
|
||||
*
|
||||
* (To set a local address as primary, the application can request by calling local SCTP stack,
|
||||
* with SctpStandardSocketOption.SCTP_PRIMARY_ADDR option).
|
||||
*/
|
||||
@Override
|
||||
InetSocketAddress localAddress();
|
||||
|
||||
/**
|
||||
* Return all local addresses of the SCTP channel.
|
||||
* Please note that, it will return more than one address if this channel is using multi-homing
|
||||
*/
|
||||
Set<InetSocketAddress> allLocalAddresses();
|
||||
|
||||
/**
|
||||
* Returns the {@link SctpChannelConfig} configuration of the channel.
|
||||
*/
|
||||
@Override
|
||||
SctpChannelConfig config();
|
||||
|
||||
/**
|
||||
* Return the (primary) remote address of the SCTP channel.
|
||||
*
|
||||
* Please note that, this return the first remote address in the underlying SCTP Channel's
|
||||
* remote address iterator to support Netty Channel API. In other words, its the application's
|
||||
* responsibility to keep track of it's peer's primary address.
|
||||
*
|
||||
* (The application can request it's remote peer to set a specific address as primary by
|
||||
* calling the local SCTP stack with SctpStandardSocketOption.SCTP_SET_PEER_PRIMARY_ADDR option)
|
||||
*/
|
||||
@Override
|
||||
InetSocketAddress remoteAddress();
|
||||
|
||||
/**
|
||||
* Return all remote addresses of the SCTP server channel.
|
||||
* Please note that, it will return more than one address if the remote is using multi-homing.
|
||||
*/
|
||||
Set<InetSocketAddress> allRemoteAddresses();
|
||||
|
||||
/**
|
||||
* Bind a address to the already bound channel to enable multi-homing.
|
||||
* The Channel bust be bound and yet to be connected.
|
||||
*/
|
||||
ChannelFuture bindAddress(InetAddress localAddress);
|
||||
|
||||
/**
|
||||
* Bind a address to the already bound channel to enable multi-homing.
|
||||
* The Channel bust be bound and yet to be connected.
|
||||
*
|
||||
* Will notify the given {@link ChannelPromise} and return a {@link ChannelFuture}
|
||||
*/
|
||||
ChannelFuture bindAddress(InetAddress localAddress, ChannelPromise promise);
|
||||
|
||||
/**
|
||||
* Unbind the address from channel's multi-homing address list.
|
||||
* The address should be added already in multi-homing address list.
|
||||
*/
|
||||
ChannelFuture unbindAddress(InetAddress localAddress);
|
||||
|
||||
/**
|
||||
* Unbind the address from channel's multi-homing address list.
|
||||
* The address should be added already in multi-homing address list.
|
||||
*
|
||||
* Will notify the given {@link ChannelPromise} and return a {@link ChannelFuture}
|
||||
*/
|
||||
ChannelFuture unbindAddress(InetAddress localAddress, ChannelPromise promise);
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import com.sun.nio.sctp.SctpStandardSocketOptions.InitMaxStreams;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelConfig;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.MessageSizeEstimator;
|
||||
import io.netty.channel.RecvByteBufAllocator;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
|
||||
/**
|
||||
* A {@link ChannelConfig} for a {@link SctpChannel}.
|
||||
* <p/>
|
||||
* <h3>Available options</h3>
|
||||
* <p/>
|
||||
* In addition to the options provided by {@link ChannelConfig},
|
||||
* {@link SctpChannelConfig} allows the following options in the option map:
|
||||
* <p/>
|
||||
* <table border="1" cellspacing="0" cellpadding="6">
|
||||
* <tr>
|
||||
* <th>Name</th><th>Associated setter method</th>
|
||||
* </tr><tr>
|
||||
* <td>{@link ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td>
|
||||
* </tr><tr>
|
||||
* <td>{@link ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td>
|
||||
* </tr><tr>
|
||||
* <td>{@link SctpChannelOption#SCTP_NODELAY}</td><td>{@link #setSctpNoDelay(boolean)}}</td>
|
||||
* </tr><tr>
|
||||
* <td>{@link SctpChannelOption#SCTP_INIT_MAXSTREAMS}</td><td>{@link #setInitMaxStreams(InitMaxStreams)}</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*/
|
||||
public interface SctpChannelConfig extends ChannelConfig {
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SCTP_NODELAY}</a> option. Please note that the default value of this option is {@code true} unlike the
|
||||
* operating system default ({@code false}). However, for some buggy platforms, such as Android, that shows erratic
|
||||
* behavior with Nagle's algorithm disabled, the default value remains to be {@code false}.
|
||||
*/
|
||||
boolean isSctpNoDelay();
|
||||
|
||||
/**
|
||||
* Sets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SCTP_NODELAY}</a> option. Please note that the default value of this option is {@code true} unlike the
|
||||
* operating system default ({@code false}). However, for some buggy platforms, such as Android, that shows erratic
|
||||
* behavior with Nagle's algorithm disabled, the default value remains to be {@code false}.
|
||||
*/
|
||||
SctpChannelConfig setSctpNoDelay(boolean sctpNoDelay);
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_SNDBUF}</a> option.
|
||||
*/
|
||||
int getSendBufferSize();
|
||||
|
||||
/**
|
||||
* Sets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_SNDBUF}</a> option.
|
||||
*/
|
||||
SctpChannelConfig setSendBufferSize(int sendBufferSize);
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_RCVBUF}</a> option.
|
||||
*/
|
||||
int getReceiveBufferSize();
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_RCVBUF}</a> option.
|
||||
*/
|
||||
SctpChannelConfig setReceiveBufferSize(int receiveBufferSize);
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
|
||||
*/
|
||||
InitMaxStreams getInitMaxStreams();
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
|
||||
*/
|
||||
SctpChannelConfig setInitMaxStreams(InitMaxStreams initMaxStreams);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
SctpChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setWriteSpinCount(int writeSpinCount);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setAllocator(ByteBufAllocator allocator);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark);
|
||||
|
||||
@Override
|
||||
SctpChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import com.sun.nio.sctp.SctpStandardSocketOptions.InitMaxStreams;
|
||||
import io.netty.channel.ChannelOption;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
|
||||
/**
|
||||
* Option for configuring the SCTP transport
|
||||
*/
|
||||
public final class SctpChannelOption<T> extends ChannelOption<T> {
|
||||
|
||||
public static final ChannelOption<Boolean> SCTP_DISABLE_FRAGMENTS =
|
||||
valueOf(SctpChannelOption.class, "SCTP_DISABLE_FRAGMENTS");
|
||||
public static final ChannelOption<Boolean> SCTP_EXPLICIT_COMPLETE =
|
||||
valueOf(SctpChannelOption.class, "SCTP_EXPLICIT_COMPLETE");
|
||||
public static final ChannelOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
|
||||
valueOf(SctpChannelOption.class, "SCTP_FRAGMENT_INTERLEAVE");
|
||||
public static final ChannelOption<InitMaxStreams> SCTP_INIT_MAXSTREAMS =
|
||||
valueOf(SctpChannelOption.class, "SCTP_INIT_MAXSTREAMS");
|
||||
|
||||
public static final ChannelOption<Boolean> SCTP_NODELAY =
|
||||
valueOf(SctpChannelOption.class, "SCTP_NODELAY");
|
||||
public static final ChannelOption<SocketAddress> SCTP_PRIMARY_ADDR =
|
||||
valueOf(SctpChannelOption.class, "SCTP_PRIMARY_ADDR");
|
||||
public static final ChannelOption<SocketAddress> SCTP_SET_PEER_PRIMARY_ADDR =
|
||||
valueOf(SctpChannelOption.class, "SCTP_SET_PEER_PRIMARY_ADDR");
|
||||
|
||||
@SuppressWarnings({ "unused", "deprecation" })
|
||||
private SctpChannelOption() {
|
||||
super(null);
|
||||
}
|
||||
}
|
|
@ -1,204 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import com.sun.nio.sctp.MessageInfo;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.DefaultByteBufHolder;
|
||||
import io.netty.util.internal.ObjectUtil;
|
||||
|
||||
/**
|
||||
* Representation of SCTP Data Chunk
|
||||
*/
|
||||
public final class SctpMessage extends DefaultByteBufHolder {
|
||||
private final int streamIdentifier;
|
||||
private final int protocolIdentifier;
|
||||
private final boolean unordered;
|
||||
|
||||
private final MessageInfo msgInfo;
|
||||
|
||||
/**
|
||||
* Essential data that is being carried within SCTP Data Chunk
|
||||
* @param protocolIdentifier of payload
|
||||
* @param streamIdentifier that you want to send the payload
|
||||
* @param payloadBuffer channel buffer
|
||||
*/
|
||||
public SctpMessage(int protocolIdentifier, int streamIdentifier, ByteBuf payloadBuffer) {
|
||||
this(protocolIdentifier, streamIdentifier, false, payloadBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Essential data that is being carried within SCTP Data Chunk
|
||||
* @param protocolIdentifier of payload
|
||||
* @param streamIdentifier that you want to send the payload
|
||||
* @param unordered if {@literal true}, the SCTP Data Chunk will be sent with the U (unordered) flag set.
|
||||
* @param payloadBuffer channel buffer
|
||||
*/
|
||||
public SctpMessage(int protocolIdentifier, int streamIdentifier, boolean unordered, ByteBuf payloadBuffer) {
|
||||
super(payloadBuffer);
|
||||
this.protocolIdentifier = protocolIdentifier;
|
||||
this.streamIdentifier = streamIdentifier;
|
||||
this.unordered = unordered;
|
||||
msgInfo = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Essential data that is being carried within SCTP Data Chunk
|
||||
* @param msgInfo the {@link MessageInfo}
|
||||
* @param payloadBuffer channel buffer
|
||||
*/
|
||||
public SctpMessage(MessageInfo msgInfo, ByteBuf payloadBuffer) {
|
||||
super(payloadBuffer);
|
||||
this.msgInfo = ObjectUtil.checkNotNull(msgInfo, "msgInfo");
|
||||
this.streamIdentifier = msgInfo.streamNumber();
|
||||
this.protocolIdentifier = msgInfo.payloadProtocolID();
|
||||
this.unordered = msgInfo.isUnordered();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the stream-identifier
|
||||
*/
|
||||
public int streamIdentifier() {
|
||||
return streamIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the protocol-identifier
|
||||
*/
|
||||
public int protocolIdentifier() {
|
||||
return protocolIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the unordered flag
|
||||
*/
|
||||
public boolean isUnordered() {
|
||||
return unordered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link MessageInfo} for inbound messages or {@code null} for
|
||||
* outbound messages.
|
||||
*/
|
||||
public MessageInfo messageInfo() {
|
||||
return msgInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if this message is complete.
|
||||
*/
|
||||
public boolean isComplete() {
|
||||
if (msgInfo != null) {
|
||||
return msgInfo.isComplete();
|
||||
} else {
|
||||
//all outbound sctp messages are complete
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SctpMessage sctpFrame = (SctpMessage) o;
|
||||
|
||||
if (protocolIdentifier != sctpFrame.protocolIdentifier) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (streamIdentifier != sctpFrame.streamIdentifier) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (unordered != sctpFrame.unordered) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return content().equals(sctpFrame.content());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = streamIdentifier;
|
||||
result = 31 * result + protocolIdentifier;
|
||||
// values 1231 and 1237 are referenced in the javadocs of Boolean#hashCode()
|
||||
result = 31 * result + (unordered ? 1231 : 1237);
|
||||
result = 31 * result + content().hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage copy() {
|
||||
return (SctpMessage) super.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage duplicate() {
|
||||
return (SctpMessage) super.duplicate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage retainedDuplicate() {
|
||||
return (SctpMessage) super.retainedDuplicate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage replace(ByteBuf content) {
|
||||
if (msgInfo == null) {
|
||||
return new SctpMessage(protocolIdentifier, streamIdentifier, unordered, content);
|
||||
} else {
|
||||
return new SctpMessage(msgInfo, content);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage retain() {
|
||||
super.retain();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage retain(int increment) {
|
||||
super.retain(increment);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage touch() {
|
||||
super.touch();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SctpMessage touch(Object hint) {
|
||||
super.touch(hint);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SctpFrame{" +
|
||||
"streamIdentifier=" + streamIdentifier + ", protocolIdentifier=" + protocolIdentifier +
|
||||
", unordered=" + unordered +
|
||||
", data=" + contentToString() + '}';
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import com.sun.nio.sctp.AbstractNotificationHandler;
|
||||
import com.sun.nio.sctp.AssociationChangeNotification;
|
||||
import com.sun.nio.sctp.HandlerResult;
|
||||
import com.sun.nio.sctp.Notification;
|
||||
import com.sun.nio.sctp.PeerAddressChangeNotification;
|
||||
import com.sun.nio.sctp.SendFailedNotification;
|
||||
import com.sun.nio.sctp.ShutdownNotification;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.util.internal.ObjectUtil;
|
||||
|
||||
|
||||
/**
|
||||
* {@link AbstractNotificationHandler} implementation which will handle all {@link Notification}s by trigger a
|
||||
* {@link Notification} user event in the {@link ChannelPipeline} of a {@link SctpChannel}.
|
||||
*/
|
||||
public final class SctpNotificationHandler extends AbstractNotificationHandler<Object> {
|
||||
|
||||
private final SctpChannel sctpChannel;
|
||||
|
||||
public SctpNotificationHandler(SctpChannel sctpChannel) {
|
||||
this.sctpChannel = ObjectUtil.checkNotNull(sctpChannel, "sctpChannel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerResult handleNotification(AssociationChangeNotification notification, Object o) {
|
||||
fireEvent(notification);
|
||||
return HandlerResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerResult handleNotification(PeerAddressChangeNotification notification, Object o) {
|
||||
fireEvent(notification);
|
||||
return HandlerResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerResult handleNotification(SendFailedNotification notification, Object o) {
|
||||
fireEvent(notification);
|
||||
return HandlerResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerResult handleNotification(ShutdownNotification notification, Object o) {
|
||||
fireEvent(notification);
|
||||
sctpChannel.close();
|
||||
return HandlerResult.RETURN;
|
||||
}
|
||||
|
||||
private void fireEvent(Notification notification) {
|
||||
sctpChannel.pipeline().fireUserEventTriggered(notification);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.ServerChannel;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A SCTP/IP {@link ServerChannel} which accepts incoming SCTP/IP associations.
|
||||
*
|
||||
* <p>
|
||||
* Multi-homing address binding/unbinding can done through bindAddress/unbindAddress methods.
|
||||
* </p>
|
||||
*/
|
||||
public interface SctpServerChannel extends ServerChannel {
|
||||
|
||||
/**
|
||||
* Returns the {@link SctpServerChannelConfig} configuration of the channel.
|
||||
*/
|
||||
@Override
|
||||
SctpServerChannelConfig config();
|
||||
|
||||
/**
|
||||
* Return the (primary) local address of the SCTP server channel.
|
||||
*
|
||||
* Please note that, this return the first local address in the underlying SCTP ServerChannel's
|
||||
* local address iterator to support Netty Channel API. In other words, its the application's
|
||||
* responsibility to keep track of it's local primary address.
|
||||
*
|
||||
* (To set a local address as primary, the application can request by calling local SCTP stack,
|
||||
* with SctpStandardSocketOption.SCTP_PRIMARY_ADDR option).
|
||||
*/
|
||||
@Override
|
||||
InetSocketAddress localAddress();
|
||||
|
||||
/**
|
||||
* Return all local addresses of the SCTP server channel.
|
||||
* Please note that, it will return more than one address if this channel is using multi-homing
|
||||
*/
|
||||
Set<InetSocketAddress> allLocalAddresses();
|
||||
|
||||
/**
|
||||
* Bind a address to the already bound channel to enable multi-homing.
|
||||
* The Channel must be bound and yet to be connected.
|
||||
*/
|
||||
ChannelFuture bindAddress(InetAddress localAddress);
|
||||
|
||||
/**
|
||||
* Bind a address to the already bound channel to enable multi-homing.
|
||||
* The Channel must be bound and yet to be connected.
|
||||
*
|
||||
* Will notify the given {@link ChannelPromise} and return a {@link ChannelFuture}
|
||||
*/
|
||||
ChannelFuture bindAddress(InetAddress localAddress, ChannelPromise promise);
|
||||
|
||||
/**
|
||||
* Unbind the address from channel's multi-homing address list.
|
||||
* The address should be added already in multi-homing address list.
|
||||
*/
|
||||
ChannelFuture unbindAddress(InetAddress localAddress);
|
||||
|
||||
/**
|
||||
* Unbind the address from channel's multi-homing address list.
|
||||
* The address should be added already in multi-homing address list.
|
||||
*
|
||||
* Will notify the given {@link ChannelPromise} and return a {@link ChannelFuture}
|
||||
*/
|
||||
ChannelFuture unbindAddress(InetAddress localAddress, ChannelPromise promise);
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp;
|
||||
|
||||
import com.sun.nio.sctp.SctpStandardSocketOptions.InitMaxStreams;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.channel.ChannelConfig;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.MessageSizeEstimator;
|
||||
import io.netty.channel.RecvByteBufAllocator;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
|
||||
/**
|
||||
* A {@link ChannelConfig} for a {@link SctpServerChannelConfig}.
|
||||
* <p/>
|
||||
* <h3>Available options</h3>
|
||||
* <p/>
|
||||
* In addition to the options provided by {@link ChannelConfig},
|
||||
* {@link SctpServerChannelConfig} allows the following options in the
|
||||
* option map:
|
||||
* <p/>
|
||||
* <table border="1" cellspacing="0" cellpadding="6">
|
||||
* <tr>
|
||||
* <th>Name</th><th>Associated setter method</th>
|
||||
* </tr><tr>
|
||||
* <td>{@link ChannelOption#SO_BACKLOG}</td><td>{@link #setBacklog(int)}</td>
|
||||
* </tr><tr>
|
||||
* <td>{@link ChannelOption#SO_RCVBUF}</td><td>{@link #setReceiveBufferSize(int)}</td>
|
||||
* </tr><tr>
|
||||
* <td>{@link ChannelOption#SO_SNDBUF}</td><td>{@link #setSendBufferSize(int)}</td>
|
||||
* </tr><tr>
|
||||
* <td>{@link SctpChannelOption#SCTP_INIT_MAXSTREAMS}</td><td>{@link #setInitMaxStreams(InitMaxStreams)}</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*/
|
||||
public interface SctpServerChannelConfig extends ChannelConfig {
|
||||
|
||||
/**
|
||||
* Gets the backlog value to specify when the channel binds to a local address.
|
||||
*/
|
||||
int getBacklog();
|
||||
|
||||
/**
|
||||
* Sets the backlog value to specify when the channel binds to a local address.
|
||||
*/
|
||||
SctpServerChannelConfig setBacklog(int backlog);
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_SNDBUF}</a> option.
|
||||
*/
|
||||
int getSendBufferSize();
|
||||
|
||||
/**
|
||||
* Sets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_SNDBUF}</a> option.
|
||||
*/
|
||||
SctpServerChannelConfig setSendBufferSize(int sendBufferSize);
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_RCVBUF}</a> option.
|
||||
*/
|
||||
int getReceiveBufferSize();
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SO_RCVBUF}</a> option.
|
||||
*/
|
||||
SctpServerChannelConfig setReceiveBufferSize(int receiveBufferSize);
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
|
||||
*/
|
||||
InitMaxStreams getInitMaxStreams();
|
||||
|
||||
/**
|
||||
* Gets the <a href="https://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
|
||||
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
|
||||
*/
|
||||
SctpServerChannelConfig setInitMaxStreams(InitMaxStreams initMaxStreams);
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
SctpServerChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setWriteSpinCount(int writeSpinCount);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setAllocator(ByteBufAllocator allocator);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setRecvByteBufAllocator(RecvByteBufAllocator allocator);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setAutoRead(boolean autoRead);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setAutoClose(boolean autoClose);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setWriteBufferHighWaterMark(int writeBufferHighWaterMark);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setWriteBufferLowWaterMark(int writeBufferLowWaterMark);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setWriteBufferWaterMark(WriteBufferWaterMark writeBufferWaterMark);
|
||||
|
||||
@Override
|
||||
SctpServerChannelConfig setMessageSizeEstimator(MessageSizeEstimator estimator);
|
||||
}
|
|
@ -1,401 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.sctp.nio;
|
||||