2009-03-11 Zoltan Varga <vargaz@gmail.com>
[mono-debugger.git] / mono / metadata / security-manager.h
blob2548eed80dff826f4736ac48c82c2fb7d66def9a
1 /*
2 * security-manager.h: Security Manager
4 * Author:
5 * Sebastien Pouliot <sebastien@ximian.com>
7 * Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
8 */
10 #ifndef _MONO_METADATA_SECURITY_MANAGER_H_
11 #define _MONO_METADATA_SECURITY_MANAGER_H_
13 #include <string.h>
15 #include "object.h"
16 #include "metadata-internals.h"
17 #include "domain-internals.h"
18 #include "tokentype.h"
19 #include "threads.h"
20 #include "marshal.h"
21 #include "image.h"
22 #include "reflection.h"
23 #include "tabledefs.h"
26 /* Definitions */
28 #define MONO_ECMA_KEY_LENGTH 16
29 #define MONO_PUBLIC_KEY_HEADER_LENGTH 32
30 #define MONO_MINIMUM_PUBLIC_KEY_LENGTH 48
31 #define MONO_DEFAULT_PUBLIC_KEY_LENGTH 128
33 #define MONO_PUBLIC_KEY_BIT_SIZE(x) ((x - MONO_PUBLIC_KEY_HEADER_LENGTH) << 3)
35 enum {
36 MONO_METADATA_SECURITY_OK = 0x00,
37 MONO_METADATA_INHERITANCEDEMAND_CLASS = 0x01,
38 MONO_METADATA_INHERITANCEDEMAND_METHOD = 0x02
41 typedef enum {
42 MONO_SECURITY_MODE_NONE,
43 MONO_SECURITY_MODE_CORE_CLR,
44 MONO_SECURITY_MODE_CAS,
45 MONO_SECURITY_MODE_SMCS_HACK
46 } MonoSecurityMode;
48 /* Structures */
50 typedef struct {
51 MonoClass *securitymanager; /* System.Security.SecurityManager */
52 MonoMethod *demand; /* SecurityManager.InternalDemand */
53 MonoMethod *demandchoice; /* SecurityManager.InternalDemandChoice */
54 MonoMethod *demandunmanaged; /* SecurityManager.DemandUnmanaged */
55 MonoMethod *inheritancedemand; /* SecurityManager.InheritanceDemand */
56 MonoMethod *inheritsecurityexception; /* SecurityManager.InheritanceDemandSecurityException */
57 MonoMethod *linkdemand; /* SecurityManager.LinkDemand */
58 MonoMethod *linkdemandfulltrust; /* SecurityManager.LinkDemandFullTrust */
59 MonoMethod *linkdemandunmanaged; /* SecurityManager.LinkDemandUnmanaged */
60 MonoMethod *linkdemandsecurityexception;/* SecurityManager.LinkDemandSecurityException */
62 MonoClass *allowpartiallytrustedcallers; /* System.Security.AllowPartiallyTrustedCallersAttribute */
63 MonoClass *suppressunmanagedcodesecurity; /* System.Security.SuppressUnmanagedCodeSecurityAttribute */
64 } MonoSecurityManager;
66 /* Initialization/utility functions */
67 void mono_activate_security_manager (void) MONO_INTERNAL;
68 gboolean mono_is_security_manager_active (void) MONO_INTERNAL;
69 MonoSecurityManager* mono_security_manager_get_methods (void) MONO_INTERNAL;
70 gboolean mono_is_ecma_key (const char *publickey, int size) MONO_INTERNAL;
71 MonoMethod* mono_get_context_capture_method (void) MONO_INTERNAL;
73 void mono_secman_inheritancedemand_class (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
74 void mono_secman_inheritancedemand_method (MonoMethod *override, MonoMethod *base) MONO_INTERNAL;
76 /* Security mode */
77 void mono_security_set_mode (MonoSecurityMode mode) MONO_INTERNAL;
78 MonoSecurityMode mono_security_get_mode (void) MONO_INTERNAL;
80 /* internal calls */
81 MonoBoolean ves_icall_System_Security_SecurityManager_get_SecurityEnabled (void) MONO_INTERNAL;
82 void ves_icall_System_Security_SecurityManager_set_SecurityEnabled (MonoBoolean value) MONO_INTERNAL;
83 MonoBoolean ves_icall_System_Security_SecurityManager_get_CheckExecutionRights (void) MONO_INTERNAL;
84 void ves_icall_System_Security_SecurityManager_set_CheckExecutionRights (MonoBoolean value) MONO_INTERNAL;
85 MonoBoolean ves_icall_System_Security_SecurityManager_GetLinkDemandSecurity (MonoReflectionMethod *m, MonoDeclSecurityActions *kactions, MonoDeclSecurityActions *mactions) MONO_INTERNAL;
88 #endif /* _MONO_METADATA_SECURITY_MANAGER_H_ */