Update PointConverter.cs
[mono.git] / mono / metadata / security-core-clr.h
1 /*
2  * security-core-clr.h: CoreCLR security
3  *
4  * Author:
5  *      Mark Probst <mark.probst@gmail.com>
6  *
7  * (C) 2007, 2010 Novell, Inc
8  */
9
10 #ifndef _MONO_METADATA_SECURITY_CORE_CLR_H_
11 #define _MONO_METADATA_SECURITY_CORE_CLR_H_
12
13 #include <mono/metadata/reflection.h>
14
15 typedef enum {
16         /* We compare these values as integers, so the order must not
17            be changed. */
18         MONO_SECURITY_CORE_CLR_TRANSPARENT = 0,
19         MONO_SECURITY_CORE_CLR_SAFE_CRITICAL,
20         MONO_SECURITY_CORE_CLR_CRITICAL
21 } MonoSecurityCoreCLRLevel;
22
23 typedef enum {
24         //The following flags can be used in combination, and control specific behaviour of the CoreCLR securit system.
25
26         //Default coreclr behaviour, as used in moonlight.
27         MONO_SECURITY_CORE_CLR_OPTIONS_DEFAULT = 0,
28
29         //Allow transparent code to execute methods and access fields that are not in platformcode,
30         //even if those methods and fields are private or otherwise not visible to the calling code.
31         MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_REFLECTION = 1,
32
33         //Allow delegates to be created that point at methods that are not in platformcode,
34         //even if those methods and fields are private or otherwise not visible to the calling code.
35         MONO_SECURITY_CORE_CLR_OPTIONS_RELAX_DELEGATE = 2
36 } MonoSecurityCoreCLROptions;
37
38 extern gboolean mono_security_core_clr_test;
39
40 extern void mono_security_core_clr_check_inheritance (MonoClass *class) MONO_INTERNAL;
41 extern void mono_security_core_clr_check_override (MonoClass *class, MonoMethod *override, MonoMethod *base) MONO_INTERNAL;
42
43 extern void mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field) MONO_INTERNAL;
44 extern void mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method) MONO_INTERNAL;
45 extern gboolean mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, gboolean throwOnBindFailure) MONO_INTERNAL;
46 extern MonoException* mono_security_core_clr_ensure_dynamic_method_resolved_object (gpointer ref, MonoClass *handle_class) MONO_INTERNAL;
47
48 extern gboolean mono_security_core_clr_can_access_internals (MonoImage *accessing, MonoImage* accessed) MONO_INTERNAL;
49
50 extern MonoException* mono_security_core_clr_is_field_access_allowed (MonoMethod *caller, MonoClassField *field) MONO_INTERNAL;
51 extern MonoException* mono_security_core_clr_is_call_allowed (MonoMethod *caller, MonoMethod *callee) MONO_INTERNAL;
52
53 extern MonoSecurityCoreCLRLevel mono_security_core_clr_class_level (MonoClass *class) MONO_INTERNAL;
54 extern MonoSecurityCoreCLRLevel mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_level) MONO_INTERNAL;
55
56 extern gboolean mono_security_core_clr_is_platform_image (MonoImage *image) MONO_INTERNAL;
57 extern gboolean mono_security_core_clr_determine_platform_image (MonoImage *image) MONO_INTERNAL;
58
59 extern gboolean mono_security_core_clr_require_elevated_permissions (void);
60
61 extern void mono_security_core_clr_set_options (MonoSecurityCoreCLROptions options);
62 extern MonoSecurityCoreCLROptions mono_security_core_clr_get_options (void);
63
64 #endif  /* _MONO_METADATA_SECURITY_CORE_CLR_H_ */