src/solaris/classes/sun/nio/ch/sctp/SctpNet.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package sun.nio.ch;
  26 
  27 import java.io.FileDescriptor;
  28 import java.io.IOException;
  29 import java.net.InetAddress;
  30 import java.net.InetSocketAddress;
  31 import java.net.SocketAddress;
  32 import java.nio.channels.AlreadyBoundException;
  33 import java.util.Set;
  34 import java.util.HashSet;
  35 import java.security.AccessController;
  36 import sun.security.action.GetPropertyAction;


  37 import com.sun.nio.sctp.SctpSocketOption;
  38 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
  39 
  40 public class SctpNet {
  41     static final String osName = AccessController.doPrivileged(
  42                     new GetPropertyAction("os.name"));
  43 
  44     /* -- Miscellaneous SCTP utilities -- */
  45 
  46     private static boolean IPv4MappedAddresses() {
  47         if ("SunOS".equals(osName)) {
  48             /* Solaris supports IPv4Mapped Addresses with bindx */
  49             return true;
  50         } /* else {  //other OS/implementations  */
  51 
  52         /* lksctp/linux requires Ipv4 addresses */
  53         return false;
  54     }
  55 
  56     static boolean throwAlreadyBoundException() throws IOException {




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package sun.nio.ch.sctp;
  26 
  27 import java.io.FileDescriptor;
  28 import java.io.IOException;
  29 import java.net.InetAddress;
  30 import java.net.InetSocketAddress;
  31 import java.net.SocketAddress;
  32 import java.nio.channels.AlreadyBoundException;
  33 import java.util.Set;
  34 import java.util.HashSet;
  35 import java.security.AccessController;
  36 import sun.security.action.GetPropertyAction;
  37 import sun.nio.ch.IOUtil;
  38 import sun.nio.ch.Net;
  39 import com.sun.nio.sctp.SctpSocketOption;
  40 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
  41 
  42 public class SctpNet {
  43     static final String osName = AccessController.doPrivileged(
  44                     new GetPropertyAction("os.name"));
  45 
  46     /* -- Miscellaneous SCTP utilities -- */
  47 
  48     private static boolean IPv4MappedAddresses() {
  49         if ("SunOS".equals(osName)) {
  50             /* Solaris supports IPv4Mapped Addresses with bindx */
  51             return true;
  52         } /* else {  //other OS/implementations  */
  53 
  54         /* lksctp/linux requires Ipv4 addresses */
  55         return false;
  56     }
  57 
  58     static boolean throwAlreadyBoundException() throws IOException {