/* OpenIDA - Outil d'analyse de fichiers binaires * prototype.h - prototypes pour la manipulation des prototypes de fonctions et de variables * * Copyright (C) 2008 Cyrille Bagard * * This file is part of OpenIDA. * * OpenIDA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * OpenIDA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar. If not, see . */ #ifndef _ANALYSIS_PROTOTYPE_H #define _ANALYSIS_PROTOTYPE_H #include #include #include #include "variable.h" #include "../arch/archbase.h" /* Type de routine traitée */ typedef enum _RoutineType { RTT_CLASSIC, /* Fonction ou méthode */ RTT_CONSTRUCTOR, /* Constructeur */ RTT_DESTRUCTOR /* Destructeur */ } RoutineType; #define G_TYPE_BIN_ROUTINE g_bin_routine_get_type() #define G_BIN_ROUTINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_bin_routine_get_type(), GBinRoutine)) #define G_IS_BIN_ROUTINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_bin_routine_get_type())) #define G_BIN_ROUTINE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_bin_routine_get_type(), GBinRoutineIface)) /* Représentation générique de routine (instance) */ typedef struct _GBinRoutine GBinRoutine; /* Représentation générique de routine (classe) */ typedef struct _GBinRoutineClass GBinRoutineClass; /* Indique le type définit pour une représentation de routine. */ GType g_bin_routine_get_type(void); /* Crée une représentation de routine. */ GBinRoutine *g_binary_routine_new(void); /* Etablit la comparaison ascendante entre deux routines. */ int g_binary_routine_compare(const GBinRoutine **, const GBinRoutine **); /* Etablit la comparaison descendante entre deux routines. */ int g_binary_routine_rcompare(const GBinRoutine **, const GBinRoutine **); /* Définit la position physique / en mémoire d'une routine. */ void g_binary_routine_set_address(GBinRoutine *, vmpa_t); /* Fournit la position physique / en mémoire d'une routine. */ vmpa_t g_binary_routine_get_address(const GBinRoutine *); /* Définit la taille du code d'une routine. */ void g_binary_routine_set_size(GBinRoutine *, off_t); /* Fournit la taille du code associé à une routine. */ off_t g_binary_routine_get_size(const GBinRoutine *); /* Définit le type d'une routine. */ void g_binary_routine_set_type(GBinRoutine *, RoutineType); /* Définit le nom humain d'une routine. */ void g_binary_routine_set_name(GBinRoutine *, char *); /* Désignation humainement lisible ou NULL si non définie. */ const char *g_binary_routine_get_name(const GBinRoutine *); /* Définit le type de retour d'une routine. */ void g_binary_routine_set_return_type(GBinRoutine *, variable *); /* Ajoute un argument à une routine. */ void g_binary_routine_add_arg(GBinRoutine *, variable *); /* Décrit le prototype de la routine sous forme de caractères. */ char *g_binary_routine_to_string(const GBinRoutine *); #endif /* _ANALYSIS_PROTOTYPE_H */