in mono/mono/mini:
[mono.git] / mono / metadata / reflection.h
index 8ea7ec9e8d7a018d793dd98f583142353137c1aa..28eae48678e7beafdba998f5788a8dd9d1f53192 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <mono/metadata/object.h>
 
+G_BEGIN_DECLS
+
 typedef struct MonoTypeNameParse MonoTypeNameParse;
 
 struct MonoTypeNameParse {
@@ -10,6 +12,7 @@ struct MonoTypeNameParse {
        char *name;
        MonoAssemblyName assembly;
        GList *modifiers; /* 0 -> byref, -1 -> pointer, > 0 -> array rank */
+       GPtrArray *type_arguments;
        GList *nested;
 };
 
@@ -35,6 +38,7 @@ typedef struct {
        MonoMarshalSpec **param_marshall;
        MonoCustomAttrInfo **param_cattr;
        guint8** param_defaults;
+       guint32 *param_default_types;
        char *dllentry, *dll;
 } MonoReflectionMethodAux;
 
@@ -59,11 +63,14 @@ MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass
 MonoReflectionEvent*    mono_event_get_object    (MonoDomain *domain, MonoClass *klass, MonoEvent *event);
 /* note: this one is slightly different: we keep the whole array of params in the cache */
 MonoArray* mono_param_get_objects  (MonoDomain *domain, MonoMethod *method);
+MonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoMethod *method);
 MonoObject* mono_get_dbnull_object (MonoDomain *domain);
-
+MonoArray*  mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass);
 MonoArray*  mono_reflection_get_custom_attrs (MonoObject *obj);
+MonoArray*  mono_reflection_get_custom_attrs_data (MonoObject *obj);
 MonoArray*  mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);
 
+MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj);
 MonoArray*  mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo);
 MonoCustomAttrInfo* mono_custom_attrs_from_index    (MonoImage *image, guint32 idx);
 MonoCustomAttrInfo* mono_custom_attrs_from_method   (MonoMethod *method);
@@ -73,7 +80,62 @@ MonoCustomAttrInfo* mono_custom_attrs_from_property (MonoClass *klass, MonoPrope
 MonoCustomAttrInfo* mono_custom_attrs_from_event    (MonoClass *klass, MonoEvent *event);
 MonoCustomAttrInfo* mono_custom_attrs_from_field    (MonoClass *klass, MonoClassField *field);
 MonoCustomAttrInfo* mono_custom_attrs_from_param    (MonoMethod *method, guint32 param);
+gboolean            mono_custom_attrs_has_attr      (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);
+MonoObject*         mono_custom_attrs_get_attr      (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);
 void                mono_custom_attrs_free          (MonoCustomAttrInfo *ainfo);
 
-#endif /* __METADATA_REFLECTION_H__ */
 
+#define MONO_DECLSEC_ACTION_MIN                0x1
+#define MONO_DECLSEC_ACTION_MAX                0x12
+
+enum {
+       MONO_DECLSEC_FLAG_REQUEST                       = 0x00000001,
+       MONO_DECLSEC_FLAG_DEMAND                        = 0x00000002,
+       MONO_DECLSEC_FLAG_ASSERT                        = 0x00000004,
+       MONO_DECLSEC_FLAG_DENY                          = 0x00000008,
+       MONO_DECLSEC_FLAG_PERMITONLY                    = 0x00000010,
+       MONO_DECLSEC_FLAG_LINKDEMAND                    = 0x00000020,
+       MONO_DECLSEC_FLAG_INHERITANCEDEMAND             = 0x00000040,
+       MONO_DECLSEC_FLAG_REQUEST_MINIMUM               = 0x00000080,
+       MONO_DECLSEC_FLAG_REQUEST_OPTIONAL              = 0x00000100,
+       MONO_DECLSEC_FLAG_REQUEST_REFUSE                = 0x00000200,
+       MONO_DECLSEC_FLAG_PREJIT_GRANT                  = 0x00000400,
+       MONO_DECLSEC_FLAG_PREJIT_DENY                   = 0x00000800,
+       MONO_DECLSEC_FLAG_NONCAS_DEMAND                 = 0x00001000,
+       MONO_DECLSEC_FLAG_NONCAS_LINKDEMAND             = 0x00002000,
+       MONO_DECLSEC_FLAG_NONCAS_INHERITANCEDEMAND      = 0x00004000,
+       MONO_DECLSEC_FLAG_LINKDEMAND_CHOICE             = 0x00008000,
+       MONO_DECLSEC_FLAG_INHERITANCEDEMAND_CHOICE      = 0x00010000,
+       MONO_DECLSEC_FLAG_DEMAND_CHOICE                 = 0x00020000
+};
+
+guint32 mono_declsec_flags_from_method (MonoMethod *method);
+guint32 mono_declsec_flags_from_class (MonoClass *klass);
+guint32 mono_declsec_flags_from_assembly (MonoAssembly *assembly);
+
+/* this structure MUST be kept in synch with RuntimeDeclSecurityEntry
+ * located in /mcs/class/corlib/System.Security/SecurityFrame.cs */
+typedef struct {
+       char *blob;                             /* pointer to metadata blob */
+       guint32 size;                           /* size of the metadata blob */
+       guint32 index;
+} MonoDeclSecurityEntry;
+
+typedef struct {
+       MonoDeclSecurityEntry demand;
+       MonoDeclSecurityEntry noncasdemand;
+       MonoDeclSecurityEntry demandchoice;
+} MonoDeclSecurityActions;
+
+MonoBoolean mono_declsec_get_demands (MonoMethod *callee, MonoDeclSecurityActions* demands);
+MonoBoolean mono_declsec_get_linkdemands (MonoMethod *callee, MonoDeclSecurityActions* klass, MonoDeclSecurityActions* cmethod);
+MonoBoolean mono_declsec_get_inheritdemands_class (MonoClass *klass, MonoDeclSecurityActions* demands);
+MonoBoolean mono_declsec_get_inheritdemands_method (MonoMethod *callee, MonoDeclSecurityActions* demands);
+
+MonoBoolean mono_declsec_get_method_action (MonoMethod *method, guint32 action, MonoDeclSecurityEntry *entry);
+MonoBoolean mono_declsec_get_class_action (MonoClass *klass, guint32 action, MonoDeclSecurityEntry *entry);
+MonoBoolean mono_declsec_get_assembly_action (MonoAssembly *assembly, guint32 action, MonoDeclSecurityEntry *entry);
+
+G_END_DECLS
+
+#endif /* __METADATA_REFLECTION_H__ */