Permission.h revision 4d4c8b7e294d845103ecb10f968713717a3e6406
1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef NETD_INCLUDE_PERMISSION_H 18#define NETD_INCLUDE_PERMISSION_H 19 20// This enum represents the permissions we care about for networking. When applied to an app, it's 21// the permission the app (UID) has been granted. When applied to a network, it's the permission an 22// app must hold to be allowed to use the network. PERMISSION_NONE means "no special permission is 23// held by the app" or "no special permission is required to use the network". 24// 25// Permissions are flags that can be OR'ed together to represent combinations of permissions. 26// 27// NOTE: netd doesn't enforce any semantics for the permission values. E.g., while all apps with 28// CONNECTIVITY_INTERNAL may also implicitly or explicitly have CHANGE_NETWORK_STATE, netd doesn't 29// enforce it. It's the responsibility of the caller to set all permissions bits explicitly. I.e., 30// if you set the PERMISSION_CONNECTIVITY_INTERNAL bit, you should probably also set the 31// PERMISSION_CHANGE_NETWORK_STATE bit. 32enum Permission { 33 PERMISSION_NONE = 0x0, 34 PERMISSION_CHANGE_NETWORK_STATE = 0x1, 35 PERMISSION_CONNECTIVITY_INTERNAL = 0x2 36}; 37 38Permission permissionFromString(const char* permission); 39 40#endif // NETD_INCLUDE_PERMISSION_H 41