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 * https://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 io.netty.channel.ChannelFuture; 19 import io.netty.channel.ChannelPromise; 20 import io.netty.channel.ServerChannel; 21 22 import java.net.InetSocketAddress; 23 import java.net.InetAddress; 24 import java.util.Set; 25 26 /** 27 * A SCTP/IP {@link ServerChannel} which accepts incoming SCTP/IP associations. 28 * 29 * <p> 30 * Multi-homing address binding/unbinding can done through bindAddress/unbindAddress methods. 31 * </p> 32 */ 33 public interface SctpServerChannel extends ServerChannel { 34 35 /** 36 * Returns the {@link SctpServerChannelConfig} configuration of the channel. 37 */ 38 @Override 39 SctpServerChannelConfig config(); 40 41 /** 42 * Return the (primary) local address of the SCTP server channel. 43 * 44 * Please note that, this return the first local address in the underlying SCTP ServerChannel's 45 * local address iterator to support Netty Channel API. In other words, its the application's 46 * responsibility to keep track of it's local primary address. 47 * 48 * (To set a local address as primary, the application can request by calling local SCTP stack, 49 * with SctpStandardSocketOption.SCTP_PRIMARY_ADDR option). 50 */ 51 @Override 52 InetSocketAddress localAddress(); 53 54 /** 55 * Return all local addresses of the SCTP server channel. 56 * Please note that, it will return more than one address if this channel is using multi-homing 57 */ 58 Set<InetSocketAddress> allLocalAddresses(); 59 60 /** 61 * Bind a address to the already bound channel to enable multi-homing. 62 * The Channel must be bound and yet to be connected. 63 */ 64 ChannelFuture bindAddress(InetAddress localAddress); 65 66 /** 67 * Bind a address to the already bound channel to enable multi-homing. 68 * The Channel must be bound and yet to be connected. 69 * 70 * Will notify the given {@link ChannelPromise} and return a {@link ChannelFuture} 71 */ 72 ChannelFuture bindAddress(InetAddress localAddress, ChannelPromise promise); 73 74 /** 75 * Unbind the address from channel's multi-homing address list. 76 * The address should be added already in multi-homing address list. 77 */ 78 ChannelFuture unbindAddress(InetAddress localAddress); 79 80 /** 81 * Unbind the address from channel's multi-homing address list. 82 * The address should be added already in multi-homing address list. 83 * 84 * Will notify the given {@link ChannelPromise} and return a {@link ChannelFuture} 85 */ 86 ChannelFuture unbindAddress(InetAddress localAddress, ChannelPromise promise); 87 }