1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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 
  26 package jdk.net;
  27 
  28 import java.security.BasicPermission;
  29 
  30 /**
  31  * Represents permission to access the extended networking capabilities
  32  * defined in the jdk.net package. These permissions contain a target
  33  * name, but no actions list. Callers either possess the permission or not.
  34  * <p>
  35  * The following targets are defined:
  36  *
  37  * <table border=1 cellpadding=5 summary="permission target name,
  38  *  what the target allows,and associated risks">
  39  * <tr>
  40  *   <th>Permission Target Name</th>
  41  *   <th>What the Permission Allows</th>
  42  *   <th>Risks of Allowing this Permission</th>
  43  * </tr>
  44  * <tr>
  45  *   <td>setOption.SO_FLOW_SLA</td>
  46  *   <td>set the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} option
  47  *       on any socket that supports it</td>
  48  *   <td>allows caller to set a higher priority or bandwidth allocation
  49  *       to sockets it creates, than they might otherwise be allowed.</td>
  50  * </tr>
  51  * <tr>
  52  *   <td>getOption.SO_FLOW_SLA</td>
  53  *   <td>retrieve the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA}
  54  *       setting from any socket that supports the option</td>
  55  *   <td>allows caller access to SLA information that it might not
  56  *       otherwise have</td>
  57  * </tr></table>
  58  *
  59  * @see jdk.net.ExtendedSocketOptions
  60  *
  61  * @since 1.8
  62  */
  63 
  64 @jdk.Exported
  65 public final class NetworkPermission extends BasicPermission {
  66 
  67     private static final long serialVersionUID = -2012939586906722291L;
  68 
  69     /**
  70      * Creates a NetworkPermission with the given target name.
  71      *
  72      * @param name the permission target name
  73      * @throws NullPointerException if {@code name} is {@code null}.
  74      * @throws IllegalArgumentException if {@code name} is empty.
  75      */
  76     public NetworkPermission(String name)
  77     {
  78         super(name);
  79     }
  80 
  81     /**
  82      * Creates a NetworkPermission with the given target name.
  83      *
  84      * @param name the permission target name
  85      * @param actions should be {@code null}. Is ignored if not.
  86      * @throws NullPointerException if {@code name} is {@code null}.
  87      * @throws IllegalArgumentException if {@code name} is empty.
  88      */
  89     public NetworkPermission(String name, String actions)
  90     {
  91         super(name, actions);
  92     }
  93 }