Improved documentation in SCTP Transport classes

This commit is contained in:
Jestan Nirojan 2012-05-26 17:34:18 +05:30
parent ff8f80a008
commit e7902e5c99
16 changed files with 101 additions and 83 deletions

View File

@ -27,7 +27,7 @@ import io.netty.logging.InternalLoggerFactory;
import io.netty.util.internal.ConversionUtil; import io.netty.util.internal.ConversionUtil;
/** /**
* The default {@link io.netty.channel.socket.nio.NioSocketChannelConfig} implementation for SCTP. * The default {@link NioSctpChannelConfig} implementation for SCTP.
*/ */
class DefaultNioSctpChannelConfig extends DefaultSctpChannelConfig implements NioSctpChannelConfig { class DefaultNioSctpChannelConfig extends DefaultSctpChannelConfig implements NioSctpChannelConfig {

View File

@ -24,7 +24,7 @@ import io.netty.util.internal.ConversionUtil;
import java.io.IOException; import java.io.IOException;
/** /**
* The default {@link io.netty.channel.socket.ServerSocketChannelConfig} implementation for SCTP. * The default {@link SctpServerChannelConfig} implementation for SCTP.
*/ */
public class DefaultSctpServerChannelConfig extends DefaultServerChannelConfig public class DefaultSctpServerChannelConfig extends DefaultServerChannelConfig
implements SctpServerChannelConfig { implements SctpServerChannelConfig {

View File

@ -17,16 +17,16 @@ package io.netty.channel.sctp;
import io.netty.channel.ReceiveBufferSizePredictor; import io.netty.channel.ReceiveBufferSizePredictor;
import io.netty.channel.ReceiveBufferSizePredictorFactory; import io.netty.channel.ReceiveBufferSizePredictorFactory;
import io.netty.channel.ChannelConfig;
import io.netty.channel.socket.nio.NioChannelConfig; import io.netty.channel.socket.nio.NioChannelConfig;
/** /**
* A {@link io.netty.channel.sctp.SctpChannelConfig} for a NIO SCTP/IP {@link io.netty.channel.sctp.SctpChannel}. * The {@link SctpChannelConfig} for a NIO SCTP/IP {@link SctpChannel}.
* *
* <h3>Available options</h3> * <h3>Available options</h3>
* *
* In addition to the options provided by {@link io.netty.channel.ChannelConfig} and * In addition to the options provided by {@link ChannelConfig} and {@link SctpChannelConfig},
* {@link io.netty.channel.sctp.SctpChannelConfig}, {@link io.netty.channel.sctp.NioSctpChannelConfig} allows the * {@link NioSctpChannelConfig} allows the following options in the option map:
* following options in the option map:
* *
* <table border="1" cellspacing="0" cellpadding="6"> * <table border="1" cellspacing="0" cellpadding="6">
* <tr> * <tr>

View File

@ -24,9 +24,6 @@ import java.net.InetAddress;
public class SctpBindAddressEvent extends DownstreamChannelStateEvent { public class SctpBindAddressEvent extends DownstreamChannelStateEvent {
/**
* Creates a new instance.
*/
public SctpBindAddressEvent(Channel channel, ChannelFuture future, InetAddress localAddress) { public SctpBindAddressEvent(Channel channel, ChannelFuture future, InetAddress localAddress) {
super(channel, future, ChannelState.INTEREST_OPS, localAddress); super(channel, future, ChannelState.INTEREST_OPS, localAddress);
} }

View File

@ -24,51 +24,69 @@ import java.net.InetSocketAddress;
import java.util.Set; import java.util.Set;
/** /**
* A SCTP/IP {@link Channel} which was either accepted by
* {@link SctpServerChannel} or created by {@link SctpClientSocketChannelFactory}.
*/ */
public interface SctpChannel extends Channel { public interface SctpChannel extends Channel {
/** /**
* Return the primary local address of the SCTP channel. * 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);
/**
* 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);
/**
* 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. (this method is implemented to support existing Netty API)
* so application, has to keep track of it's primary address. This can be done by
* requests the local SCTP stack, using the SctpStandardSocketOption.SCTP_PRIMARY_ADDR.
*/ */
@Override @Override
InetSocketAddress getLocalAddress(); InetSocketAddress getLocalAddress();
/** /**
* Return all local addresses of the SCTP channel. * 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> getAllLocalAddresses(); Set<InetSocketAddress> getAllLocalAddresses();
/** /**
* Returns the configuration of this channel. * Returns the {@link SctpChannelConfig} configuration of the channel.
*/ */
@Override @Override
NioSctpChannelConfig getConfig(); NioSctpChannelConfig getConfig();
/** /**
* Return the primary remote address of the SCTP channel. * 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. (this method is implemented to support existing Netty API)
* so application, has to keep track of remote's primary address.
*
* If a peer needs to request the remote to set a specific address as primary, It can
* requests the local SCTP stack, using the SctpStandardSocketOption.SCTP_SET_PEER_PRIMARY_ADDR.
*/ */
@Override @Override
InetSocketAddress getRemoteAddress(); InetSocketAddress getRemoteAddress();
/** /**
* Return all remote addresses of the SCTP channel. * 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> getAllRemoteAddresses(); Set<InetSocketAddress> getAllRemoteAddresses();
/**
* Bind a multi-homing address to the already bound channel
*/
ChannelFuture bindAddress(InetAddress localAddress);
/**
* Unbind a multi-homing address from a already established channel
*/
ChannelFuture unbindAddress(InetAddress localAddress);
/**
* Get the underlying SCTP association
*/
Association association();
} }

View File

@ -19,12 +19,12 @@ import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
/** /**
* A {@link io.netty.channel.ChannelConfig} for a {@link io.netty.channel.sctp.SctpChannel}. * A {@link ChannelConfig} for a {@link SctpChannel}.
* <p/> * <p/>
* <h3>Available options</h3> * <h3>Available options</h3>
* <p/> * <p/>
* In addition to the options provided by {@link io.netty.channel.ChannelConfig}, * In addition to the options provided by {@link ChannelConfig},
* {@link io.netty.channel.sctp.SctpChannelConfig} allows the following options in the option map: * {@link SctpChannelConfig} allows the following options in the option map:
* <p/> * <p/>
* <table border="1" cellspacing="0" cellpadding="6"> * <table border="1" cellspacing="0" cellpadding="6">
* <tr> * <tr>
@ -43,42 +43,50 @@ import io.netty.channel.ChannelConfig;
public interface SctpChannelConfig extends ChannelConfig { public interface SctpChannelConfig extends ChannelConfig {
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SCTP_NODELAY}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SCTP_NODELAY}</a> option.
*/ */
boolean isSctpNoDelay(); boolean isSctpNoDelay();
/** /**
* Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SCTP_NODELAY}</a> option. * Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SCTP_NODELAY}</a> option.
*/ */
void setSctpNoDelay(boolean sctpNoDelay); void setSctpNoDelay(boolean sctpNoDelay);
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_SNDBUF}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_SNDBUF}</a> option.
*/ */
int getSendBufferSize(); int getSendBufferSize();
/** /**
* Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_SNDBUF}</a> option. * Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_SNDBUF}</a> option.
*/ */
void setSendBufferSize(int sendBufferSize); void setSendBufferSize(int sendBufferSize);
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_RCVBUF}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_RCVBUF}</a> option.
*/ */
int getReceiveBufferSize(); int getReceiveBufferSize();
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_RCVBUF}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_RCVBUF}</a> option.
*/ */
void setReceiveBufferSize(int receiveBufferSize); void setReceiveBufferSize(int receiveBufferSize);
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SCTP_INIT_MAXSTREAMS}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
*/ */
InitMaxStreams getInitMaxStreams(); InitMaxStreams getInitMaxStreams();
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SCTP_INIT_MAXSTREAMS}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
*/ */
void setInitMaxStreams(InitMaxStreams initMaxStreams); void setInitMaxStreams(InitMaxStreams initMaxStreams);
} }

View File

@ -82,7 +82,7 @@ public class SctpClientSocketChannelFactory implements ChannelFactory {
/** /**
* Creates a new instance. Calling this constructor is same with calling * Creates a new instance. Calling this constructor is same with calling
* {@link #SctpClientSocketChannelFactory(java.util.concurrent.Executor, java.util.concurrent.Executor, int)} with 2 * * {@link #SctpClientSocketChannelFactory(java.util.concurrent.Executor,int)} with 2 *
* the number of available processors in the machine. The number of * the number of available processors in the machine. The number of
* available processors is obtained by {@link Runtime#availableProcessors()}. * available processors is obtained by {@link Runtime#availableProcessors()}.
* *

View File

@ -20,6 +20,7 @@ import io.netty.buffer.ChannelBuffer;
import io.netty.buffer.ChannelBuffers; import io.netty.buffer.ChannelBuffers;
/** /**
* Representation of SCTP Data Chunk carried with {@link io.netty.channel.MessageEvent}.
*/ */
public final class SctpFrame { public final class SctpFrame {
private final int streamIdentifier; private final int streamIdentifier;

View File

@ -23,46 +23,44 @@ import java.net.InetSocketAddress;
import java.util.Set; import java.util.Set;
/** /**
* A SCTP {@link io.netty.channel.ServerChannel} which accepts incoming SCTP connections. * A SCTP/IP {@link ServerChannel} which accepts incoming SCTP/IP connections.
* The {@link SctpServerChannel} provides the additional operations, available in the
* underlying JDK SCTP Server Channel like multi-homing etc.
*/ */
public interface SctpServerChannel extends ServerChannel { public interface SctpServerChannel extends ServerChannel {
/** /**
* Bind a multi-homing address to the already bound channel * 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); ChannelFuture bindAddress(InetAddress localAddress);
/** /**
* Unbind a multi-homing address from a already established channel * 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); ChannelFuture unbindAddress(InetAddress localAddress);
/** /**
* Returns the configuration of this channel. * Returns the {@link SctpServerChannelConfig} configuration of the channel.
*/ */
@Override @Override
SctpServerChannelConfig getConfig(); SctpServerChannelConfig getConfig();
/** /**
* Return the primary local address of the SCTP server channel. * 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. (this method is implemented to support existing Netty API)
* so application, has to keep track of it's primary address. This can be done by
* requests the local SCTP stack, using the SctpStandardSocketOption.SCTP_PRIMARY_ADDR.
*/ */
@Override @Override
InetSocketAddress getLocalAddress(); InetSocketAddress getLocalAddress();
/** /**
* Return all local addresses of the SCTP server channel. * 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> getAllLocalAddresses(); Set<InetSocketAddress> getAllLocalAddresses();
/**
* Return the primary remote address of the server SCTP channel.
*/
@Override
InetSocketAddress getRemoteAddress();
/**
* Return all remote addresses of the SCTP server channel.
*/
Set<InetSocketAddress> getAllRemoteAddresses();
} }

View File

@ -20,11 +20,11 @@ import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelConfig;
/** /**
* A {@link io.netty.channel.ChannelConfig} for a {@link SctpServerChannelConfig}. * A {@link ChannelConfig} for a {@link SctpServerChannelConfig}.
* <p/> * <p/>
* <h3>Available options</h3> * <h3>Available options</h3>
* <p/> * <p/>
* In addition to the options provided by {@link io.netty.channel.ChannelConfig}, * In addition to the options provided by {@link ChannelConfig},
* {@link SctpServerChannelConfig} allows the following options in the * {@link SctpServerChannelConfig} allows the following options in the
* option map: * option map:
* <p/> * <p/>
@ -45,46 +45,50 @@ import io.netty.channel.ChannelConfig;
public interface SctpServerChannelConfig extends ChannelConfig { public interface SctpServerChannelConfig extends ChannelConfig {
/** /**
* Gets the backlog value to specify when the channel binds to a local * Gets the backlog value to specify when the channel binds to a local address.
* address.
*/ */
int getBacklog(); int getBacklog();
/** /**
* Sets the backlog value to specify when the channel binds to a local * Sets the backlog value to specify when the channel binds to a local address.
* address.
*/ */
void setBacklog(int backlog); void setBacklog(int backlog);
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_SNDBUF}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_SNDBUF}</a> option.
*/ */
int getSendBufferSize(); int getSendBufferSize();
/** /**
* Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_SNDBUF}</a> option. * Sets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_SNDBUF}</a> option.
*/ */
void setSendBufferSize(int sendBufferSize); void setSendBufferSize(int sendBufferSize);
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_RCVBUF}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_RCVBUF}</a> option.
*/ */
int getReceiveBufferSize(); int getReceiveBufferSize();
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SO_RCVBUF}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SO_RCVBUF}</a> option.
*/ */
void setReceiveBufferSize(int receiveBufferSize); void setReceiveBufferSize(int receiveBufferSize);
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SCTP_INIT_MAXSTREAMS}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
*/ */
InitMaxStreams getInitMaxStreams(); InitMaxStreams getInitMaxStreams();
/** /**
* Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">{@code SCTP_INIT_MAXSTREAMS}</a> option. * Gets the <a href="http://openjdk.java.net/projects/sctp/javadoc/com/sun/nio/sctp/SctpStandardSocketOption.html">
* {@code SCTP_INIT_MAXSTREAMS}</a> option.
*/ */
void setInitMaxStreams(InitMaxStreams initMaxStreams); void setInitMaxStreams(InitMaxStreams initMaxStreams);
} }

View File

@ -136,11 +136,6 @@ class SctpServerChannelImpl extends AbstractServerChannel
return null; // not available for server channel return null; // not available for server channel
} }
@Override
public Set<InetSocketAddress> getAllRemoteAddresses() {
return null; // not available for server channel
}
@Override @Override
public boolean isBound() { public boolean isBound() {
return isOpen() && bound; return isOpen() && bound;

View File

@ -84,7 +84,7 @@ public class SctpServerSocketChannelFactory implements ServerChannelFactory {
/** /**
* Creates a new instance. Calling this constructor is same with calling * Creates a new instance. Calling this constructor is same with calling
* {@link #SctpServerSocketChannelFactory(java.util.concurrent.Executor, java.util.concurrent.Executor, int)} with 2 * * {@link #SctpServerSocketChannelFactory(java.util.concurrent.Executor, int)} with 2 *
* the number of available processors in the machine. The number of * the number of available processors in the machine. The number of
* available processors is obtained by {@link Runtime#availableProcessors()}. * available processors is obtained by {@link Runtime#availableProcessors()}.
* *

View File

@ -24,9 +24,6 @@ import java.net.InetAddress;
public class SctpUnbindAddressEvent extends DownstreamChannelStateEvent { public class SctpUnbindAddressEvent extends DownstreamChannelStateEvent {
/**
* Creates a new instance.
*/
public SctpUnbindAddressEvent(Channel channel, ChannelFuture future, InetAddress value) { public SctpUnbindAddressEvent(Channel channel, ChannelFuture future, InetAddress value) {
super(channel, future, ChannelState.INTEREST_OPS, value); super(channel, future, ChannelState.INTEREST_OPS, value);
} }

View File

@ -24,7 +24,7 @@ import io.netty.channel.sctp.SctpFrame;
import io.netty.handler.codec.oneone.OneToOneDecoder; import io.netty.handler.codec.oneone.OneToOneDecoder;
/** /**
* SCTP Frame Decoder which extract payload channel buffer * SCTP Frame Decoder which extract payload channel buffer.
* Note: Supported SCTP Frame Interleave Level - 0 * Note: Supported SCTP Frame Interleave Level - 0
*/ */

View File

@ -21,7 +21,7 @@ import io.netty.channel.SimpleChannelHandler;
import io.netty.channel.sctp.SctpNotificationEvent; import io.netty.channel.sctp.SctpNotificationEvent;
/** /**
* SCTP Channel Handler (upstream + downstream) with SCTP notification handling * SCTP Channel Handler (upstream + downstream) with SCTP notification handling.
*/ */
public class SimpleSctpChannelHandler extends SimpleChannelHandler { public class SimpleSctpChannelHandler extends SimpleChannelHandler {

View File

@ -21,7 +21,7 @@ import io.netty.channel.SimpleChannelUpstreamHandler;
import io.netty.channel.sctp.SctpNotificationEvent; import io.netty.channel.sctp.SctpNotificationEvent;
/** /**
* SCTP Upstream Channel Handler with SCTP notification handling * SCTP Upstream Channel Handler with SCTP notification handling.
*/ */
public class SimpleSctpUpstreamHandler extends SimpleChannelUpstreamHandler { public class SimpleSctpUpstreamHandler extends SimpleChannelUpstreamHandler {