AccessCheck.h revision ae188c676c681e47a93ade7fdf0144099b470e03
1/*
2 * Copyright (C) 2008 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 * Check access to fields and methods.
18 */
19#ifndef _DALVIK_OO_ACCESSCHECK
20#define _DALVIK_OO_ACCESSCHECK
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/*
27 * Determine whether the "accessFrom" class is allowed to get at "clazz".
28 */
29bool dvmCheckClassAccess(const ClassObject* accessFrom,
30    const ClassObject* clazz);
31
32/*
33 * Determine whether the "accessFrom" class is allowed to get at "method".
34 */
35bool dvmCheckMethodAccess(const ClassObject* accessFrom, const Method* method);
36
37/*
38 * Determine whether the "accessFrom" class is allowed to get at "field".
39 */
40bool dvmCheckFieldAccess(const ClassObject* accessFrom, const Field* field);
41
42/*
43 * Returns "true" if the two classes are in the same runtime package.
44 */
45bool dvmInSamePackage(const ClassObject* class1, const ClassObject* class2);
46
47#ifdef __cplusplus
48}
49#endif
50
51#endif /*_DALVIK_OO_ACCESSCHECK*/
52