2 * //******************************************************************
4 * // Copyright 2015 Intel Corporation.
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 * // Licensed under the Apache License, Version 2.0 (the "License");
9 * // you may not use this file except in compliance with the License.
10 * // You may obtain a copy of the License at
12 * // http://www.apache.org/licenses/LICENSE-2.0
14 * // Unless required by applicable law or agreed to in writing, software
15 * // distributed under the License is distributed on an "AS IS" BASIS,
16 * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * // See the License for the specific language governing permissions and
18 * // limitations under the License.
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 package org.iotivity.base;
25 import java.security.InvalidParameterException;
26 public enum OcConnectivityFlags {
28 // Insecure transport is the default (subject to change)
29 OC_FLAG_SECURE (1 << 4), // secure the transport path
31 // IPv4 & IPv6 autoselection is the default
32 OC_IP_USE_V6 (1 << 5), // IP adapter only
33 OC_IP_USE_V4 (1 << 6), // IP adapter only
35 // Link-Local multicast is the default multicast scope for IPv6.
36 // These are placed here to correspond to the IPv6 address bits.
37 OC_SCOPE_INTERFACE (0x1), // IPv6 Interface-Local scope (loopback)
38 OC_SCOPE_LINK (0x2), // IPv6 Link-Local scope (default)
39 OC_SCOPE_REALM (0x3), // IPv6 Realm-Local scope
40 OC_SCOPE_ADMIN (0x4), // IPv6 Admin-Local scope
41 OC_SCOPE_SITE (0x5), // IPv6 Site-Local scope
42 OC_SCOPE_ORG (0x8), // IPv6 Organization-Local scope
43 OC_SCOPE_GLOBAL (0xE), // IPv6 Global scope
47 private OcConnectivityFlags(int value) {
51 public int getValue() {
55 public static OcConnectivityFlags get(int val) {
56 for (OcConnectivityType v : OcConnectivityType.values()) {
57 for (OcConnectivityFlags f : OcConnectivityFlags.values()) {
58 int value = v.getValue() + f.getValue();
63 throw new InvalidParameterException("Unexpected OcConnectivityFlags value:" + val);