author | michaelm |
Thu, 05 Jun 2014 12:13:50 +0100 | |
changeset 24713 | 5451c8499988 |
parent 23879 | 284802a2d355 |
permissions | -rw-r--r-- |
23879
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
1 |
/* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
4 |
* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
10 |
* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
15 |
* accompanied this code). |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
16 |
* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
20 |
* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
23 |
* questions. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
24 |
*/ |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
25 |
|
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
26 |
package jdk.net; |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
27 |
|
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
28 |
import java.security.BasicPermission; |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
29 |
|
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
30 |
/** |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
31 |
* Represents permission to access the extended networking capabilities |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
32 |
* defined in the jdk.net package. These permissions contain a target |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
33 |
* name, but no actions list. Callers either possess the permission or not. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
34 |
* <p> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
35 |
* The following targets are defined: |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
36 |
* <p> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
37 |
* <table border=1 cellpadding=5 summary="permission target name, |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
38 |
* what the target allows,and associated risks"> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
39 |
* <tr> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
40 |
* <th>Permission Target Name</th> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
41 |
* <th>What the Permission Allows</th> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
42 |
* <th>Risks of Allowing this Permission</th> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
43 |
* </tr> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
44 |
* <tr> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
45 |
* <td>setOption.SO_FLOW_SLA</td> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
46 |
* <td>set the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} option |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
47 |
* on any socket that supports it</td> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
48 |
* <td>allows caller to set a higher priority or bandwidth allocation |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
49 |
* to sockets it creates, than they might otherwise be allowed.</td> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
50 |
* </tr> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
51 |
* <tr> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
52 |
* <td>getOption.SO_FLOW_SLA</td> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
53 |
* <td>retrieve the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
54 |
* setting from any socket that supports the option</td> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
55 |
* <td>allows caller access to SLA information that it might not |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
56 |
* otherwise have</td> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
57 |
* </tr></table> |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
58 |
* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
59 |
* @see jdk.net.ExtendedSocketOptions |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
60 |
* |
24713
5451c8499988
8044766: New jdk.net classes have @since 1.9 tags in 8u20
michaelm
parents:
23879
diff
changeset
|
61 |
* @since 1.8 |
23879
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
62 |
*/ |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
63 |
|
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
64 |
@jdk.Exported |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
65 |
public final class NetworkPermission extends BasicPermission { |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
66 |
|
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
67 |
private static final long serialVersionUID = -2012939586906722291L; |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
68 |
|
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
69 |
/** |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
70 |
* Creates a NetworkPermission with the given target name. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
71 |
* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
72 |
* @param name the permission target name |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
73 |
* @throws NullPointerException if {@code name} is {@code null}. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
74 |
* @throws IllegalArgumentException if {@code name} is empty. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
75 |
*/ |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
76 |
public NetworkPermission(String name) |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
77 |
{ |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
78 |
super(name); |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
79 |
} |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
80 |
|
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
81 |
/** |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
82 |
* Creates a NetworkPermission with the given target name. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
83 |
* |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
84 |
* @param name the permission target name |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
85 |
* @param actions should be {@code null}. Is ignored if not. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
86 |
* @throws NullPointerException if {@code name} is {@code null}. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
87 |
* @throws IllegalArgumentException if {@code name} is empty. |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
88 |
*/ |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
89 |
public NetworkPermission(String name, String actions) |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
90 |
{ |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
91 |
super(name, actions); |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
92 |
} |
284802a2d355
8036979: Support java.net.SocketOption<> in java.net socket types
michaelm
parents:
diff
changeset
|
93 |
} |