5 #ifndef __METADATA_REFLECTION_H__
6 #define __METADATA_REFLECTION_H__
8 #include <mono/utils/mono-publib.h>
9 #include <mono/metadata/object.h>
13 typedef struct MonoTypeNameParse MonoTypeNameParse
;
18 const mono_byte
* data
;
19 } MonoCustomAttrEntry
;
25 MonoCustomAttrEntry attrs
[MONO_ZERO_LEN_ARRAY
];
28 #define MONO_SIZEOF_CUSTOM_ATTR_INFO (offsetof (MonoCustomAttrInfo, attrs))
31 * Information which isn't in the MonoMethod structure is stored here for
36 MonoMarshalSpec
**param_marshall
;
37 MonoCustomAttrInfo
**param_cattr
;
38 uint8_t** param_defaults
;
39 uint32_t *param_default_types
;
41 } MonoReflectionMethodAux
;
44 ResolveTokenError_OutOfRange
,
45 ResolveTokenError_BadTable
,
46 ResolveTokenError_Other
47 } MonoResolveTokenError
;
49 MONO_API
int mono_reflection_parse_type (char *name
, MonoTypeNameParse
*info
);
51 MONO_API MonoType
* mono_reflection_get_type (MonoImage
* image
, MonoTypeNameParse
*info
, mono_bool ignorecase
, mono_bool
*type_resolve
);
52 MONO_API
void mono_reflection_free_type_info (MonoTypeNameParse
*info
);
54 MONO_API MonoType
* mono_reflection_type_from_name (char *name
, MonoImage
*image
);
56 MONO_API
uint32_t mono_reflection_get_token (MonoObject
*obj
);
59 MONO_API MonoReflectionAssembly
* mono_assembly_get_object (MonoDomain
*domain
, MonoAssembly
*assembly
);
61 MONO_API MonoReflectionModule
* mono_module_get_object (MonoDomain
*domain
, MonoImage
*image
);
63 MONO_API MonoReflectionModule
* mono_module_file_get_object (MonoDomain
*domain
, MonoImage
*image
, int table_index
);
64 MONO_API MonoReflectionType
* mono_type_get_object (MonoDomain
*domain
, MonoType
*type
);
66 MONO_API MonoReflectionMethod
* mono_method_get_object (MonoDomain
*domain
, MonoMethod
*method
, MonoClass
*refclass
);
68 MONO_API MonoReflectionField
* mono_field_get_object (MonoDomain
*domain
, MonoClass
*klass
, MonoClassField
*field
);
70 MONO_API MonoReflectionProperty
* mono_property_get_object (MonoDomain
*domain
, MonoClass
*klass
, MonoProperty
*property
);
72 MONO_API MonoReflectionEvent
* mono_event_get_object (MonoDomain
*domain
, MonoClass
*klass
, MonoEvent
*event
);
73 /* note: this one is slightly different: we keep the whole array of params in the cache */
75 MONO_API MonoArray
* mono_param_get_objects (MonoDomain
*domain
, MonoMethod
*method
);
77 MONO_API MonoReflectionMethodBody
* mono_method_body_get_object (MonoDomain
*domain
, MonoMethod
*method
);
79 MONO_API MonoObject
*mono_get_dbnull_object (MonoDomain
*domain
);
81 MONO_API MonoArray
* mono_reflection_get_custom_attrs_by_type (MonoObject
*obj
, MonoClass
*attr_klass
, MonoError
*error
);
82 MONO_API MonoArray
* mono_reflection_get_custom_attrs (MonoObject
*obj
);
84 MONO_API MonoArray
* mono_reflection_get_custom_attrs_data (MonoObject
*obj
);
86 MONO_API MonoArray
* mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly
*assembly
, MonoObject
*ctor
, MonoArray
*ctorArgs
, MonoArray
*properties
, MonoArray
*porpValues
, MonoArray
*fields
, MonoArray
* fieldValues
);
89 MONO_API MonoCustomAttrInfo
* mono_reflection_get_custom_attrs_info (MonoObject
*obj
);
91 MONO_API MonoArray
* mono_custom_attrs_construct (MonoCustomAttrInfo
*cinfo
);
93 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_index (MonoImage
*image
, uint32_t idx
);
95 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_method (MonoMethod
*method
);
97 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_class (MonoClass
*klass
);
99 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_assembly (MonoAssembly
*assembly
);
100 MONO_RT_EXTERNAL_ONLY
101 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_property (MonoClass
*klass
, MonoProperty
*property
);
102 MONO_RT_EXTERNAL_ONLY
103 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_event (MonoClass
*klass
, MonoEvent
*event
);
104 MONO_RT_EXTERNAL_ONLY
105 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_field (MonoClass
*klass
, MonoClassField
*field
);
106 MONO_RT_EXTERNAL_ONLY
107 MONO_API MonoCustomAttrInfo
* mono_custom_attrs_from_param (MonoMethod
*method
, uint32_t param
);
108 MONO_API mono_bool
mono_custom_attrs_has_attr (MonoCustomAttrInfo
*ainfo
, MonoClass
*attr_klass
);
109 MONO_RT_EXTERNAL_ONLY
110 MONO_API MonoObject
* mono_custom_attrs_get_attr (MonoCustomAttrInfo
*ainfo
, MonoClass
*attr_klass
);
111 MONO_API
void mono_custom_attrs_free (MonoCustomAttrInfo
*ainfo
);
114 #define MONO_DECLSEC_ACTION_MIN 0x1
115 #define MONO_DECLSEC_ACTION_MAX 0x12
118 MONO_DECLSEC_FLAG_REQUEST
= 0x00000001,
119 MONO_DECLSEC_FLAG_DEMAND
= 0x00000002,
120 MONO_DECLSEC_FLAG_ASSERT
= 0x00000004,
121 MONO_DECLSEC_FLAG_DENY
= 0x00000008,
122 MONO_DECLSEC_FLAG_PERMITONLY
= 0x00000010,
123 MONO_DECLSEC_FLAG_LINKDEMAND
= 0x00000020,
124 MONO_DECLSEC_FLAG_INHERITANCEDEMAND
= 0x00000040,
125 MONO_DECLSEC_FLAG_REQUEST_MINIMUM
= 0x00000080,
126 MONO_DECLSEC_FLAG_REQUEST_OPTIONAL
= 0x00000100,
127 MONO_DECLSEC_FLAG_REQUEST_REFUSE
= 0x00000200,
128 MONO_DECLSEC_FLAG_PREJIT_GRANT
= 0x00000400,
129 MONO_DECLSEC_FLAG_PREJIT_DENY
= 0x00000800,
130 MONO_DECLSEC_FLAG_NONCAS_DEMAND
= 0x00001000,
131 MONO_DECLSEC_FLAG_NONCAS_LINKDEMAND
= 0x00002000,
132 MONO_DECLSEC_FLAG_NONCAS_INHERITANCEDEMAND
= 0x00004000,
133 MONO_DECLSEC_FLAG_LINKDEMAND_CHOICE
= 0x00008000,
134 MONO_DECLSEC_FLAG_INHERITANCEDEMAND_CHOICE
= 0x00010000,
135 MONO_DECLSEC_FLAG_DEMAND_CHOICE
= 0x00020000
138 MONO_API
uint32_t mono_declsec_flags_from_method (MonoMethod
*method
);
139 MONO_API
uint32_t mono_declsec_flags_from_class (MonoClass
*klass
);
140 MONO_API
uint32_t mono_declsec_flags_from_assembly (MonoAssembly
*assembly
);
142 /* this structure MUST be kept in synch with RuntimeDeclSecurityEntry
143 * located in /mcs/class/corlib/System.Security/SecurityFrame.cs */
145 char *blob
; /* pointer to metadata blob */
146 uint32_t size
; /* size of the metadata blob */
148 } MonoDeclSecurityEntry
;
151 MonoDeclSecurityEntry demand
;
152 MonoDeclSecurityEntry noncasdemand
;
153 MonoDeclSecurityEntry demandchoice
;
154 } MonoDeclSecurityActions
;
156 MONO_API MonoBoolean
mono_declsec_get_demands (MonoMethod
*callee
, MonoDeclSecurityActions
* demands
);
157 MONO_API MonoBoolean
mono_declsec_get_linkdemands (MonoMethod
*callee
, MonoDeclSecurityActions
* klass
, MonoDeclSecurityActions
* cmethod
);
158 MONO_API MonoBoolean
mono_declsec_get_inheritdemands_class (MonoClass
*klass
, MonoDeclSecurityActions
* demands
);
159 MONO_API MonoBoolean
mono_declsec_get_inheritdemands_method (MonoMethod
*callee
, MonoDeclSecurityActions
* demands
);
161 MONO_API MonoBoolean
mono_declsec_get_method_action (MonoMethod
*method
, uint32_t action
, MonoDeclSecurityEntry
*entry
);
162 MONO_API MonoBoolean
mono_declsec_get_class_action (MonoClass
*klass
, uint32_t action
, MonoDeclSecurityEntry
*entry
);
163 MONO_API MonoBoolean
mono_declsec_get_assembly_action (MonoAssembly
*assembly
, uint32_t action
, MonoDeclSecurityEntry
*entry
);
165 MONO_API MonoType
* mono_reflection_type_get_type (MonoReflectionType
*reftype
);
167 MONO_API MonoAssembly
* mono_reflection_assembly_get_assembly (MonoReflectionAssembly
*refassembly
);
171 #endif /* __METADATA_REFLECTION_H__ */