1/*
2 * Copyright (c) 2014, 2017, 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
26package jdk.net;
27
28import 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 class="striped"><caption style="display:none">permission target name,
38 *  what the target allows,and associated risks</caption>
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
64public final class NetworkPermission extends BasicPermission {
65
66    private static final long serialVersionUID = -2012939586906722291L;
67
68    /**
69     * Creates a NetworkPermission with the given target name.
70     *
71     * @param name the permission target name
72     * @throws NullPointerException if {@code name} is {@code null}.
73     * @throws IllegalArgumentException if {@code name} is empty.
74     */
75    public NetworkPermission(String name)
76    {
77        super(name);
78    }
79
80    /**
81     * Creates a NetworkPermission with the given target name.
82     *
83     * @param name the permission target name
84     * @param actions should be {@code null}. Is ignored if not.
85     * @throws NullPointerException if {@code name} is {@code null}.
86     * @throws IllegalArgumentException if {@code name} is empty.
87     */
88    public NetworkPermission(String name, String actions)
89    {
90        super(name, actions);
91    }
92}
93