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