diff options
Diffstat (limited to 'src/analysis')
| -rw-r--r-- | src/analysis/content-int.h | 4 | ||||
| -rw-r--r-- | src/analysis/content.c | 24 | ||||
| -rw-r--r-- | src/analysis/content.h | 3 | ||||
| -rw-r--r-- | src/analysis/contents/encapsulated.c | 48 | ||||
| -rw-r--r-- | src/analysis/contents/file.c | 24 | ||||
| -rw-r--r-- | src/analysis/contents/memory.c | 24 | ||||
| -rw-r--r-- | src/analysis/contents/restricted.c | 24 | 
7 files changed, 151 insertions, 0 deletions
diff --git a/src/analysis/content-int.h b/src/analysis/content-int.h index 49d5269..f3d698e 100644 --- a/src/analysis/content-int.h +++ b/src/analysis/content-int.h @@ -44,6 +44,9 @@ typedef void (* compute_checksum_fc) (GBinContent *, GChecksum *);  /* Détermine le nombre d'octets lisibles. */  typedef phys_t (* compute_size_fc) (const GBinContent *); +/* Détermine la position initiale d'un contenu. */ +typedef void (* compute_start_pos_fc) (const GBinContent *, vmpa2t *); +  /* Détermine la position finale d'un contenu. */  typedef void (* compute_end_pos_fc) (const GBinContent *, vmpa2t *); @@ -92,6 +95,7 @@ struct _GBinContentIface      compute_checksum_fc compute_checksum;   /* Calcul de l'empreinte       */      compute_size_fc compute_size;           /* Calcul de la taille totale  */ +    compute_start_pos_fc compute_start_pos; /* Calcul de position initiale */      compute_end_pos_fc compute_end_pos;     /* Calcul de position finale   */      seek_fc seek;                           /* Avancée de tête de lecture  */ diff --git a/src/analysis/content.c b/src/analysis/content.c index 3c394f1..dbece37 100644 --- a/src/analysis/content.c +++ b/src/analysis/content.c @@ -243,6 +243,30 @@ phys_t g_binary_content_compute_size(const GBinContent *content)  /******************************************************************************  *                                                                             *  *  Paramètres  : content = contenu binaire à venir lire.                      * +*                pos     = position initiale. [OUT]                           * +*                                                                             * +*  Description : Détermine la position initiale d'un contenu.                 * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void g_binary_content_compute_start_pos(const GBinContent *content, vmpa2t *pos) +{ +    GBinContentIface *iface;                /* Interface utilisée          */ + +    iface = G_BIN_CONTENT_GET_IFACE(content); + +    return iface->compute_start_pos(content, pos); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : content = contenu binaire à venir lire.                      *  *                pos     = position finale (exclusive). [OUT]                 *  *                                                                             *  *  Description : Détermine la position finale d'un contenu.                   * diff --git a/src/analysis/content.h b/src/analysis/content.h index 3f471f9..f16a164 100644 --- a/src/analysis/content.h +++ b/src/analysis/content.h @@ -72,6 +72,9 @@ const gchar *g_binary_content_get_checksum(GBinContent *);  /* Détermine le nombre d'octets lisibles. */  phys_t g_binary_content_compute_size(const GBinContent *); +/* Détermine la position initiale d'un contenu. */ +void g_binary_content_compute_start_pos(const GBinContent *, vmpa2t *); +  /* Détermine la position finale d'un contenu. */  void g_binary_content_compute_end_pos(const GBinContent *, vmpa2t *); diff --git a/src/analysis/contents/encapsulated.c b/src/analysis/contents/encapsulated.c index 74795ea..8a6ecae 100644 --- a/src/analysis/contents/encapsulated.c +++ b/src/analysis/contents/encapsulated.c @@ -85,6 +85,12 @@ static void g_encaps_content_compute_checksum(GEncapsContent *, GChecksum *);  /* Détermine le nombre d'octets lisibles. */  static phys_t g_encaps_content_compute_size(const GEncapsContent *); +/* Détermine la position initiale d'un contenu. */ +static void g_encaps_content_compute_start_pos(const GEncapsContent *, vmpa2t *); + +/* Détermine la position finale d'un contenu. */ +static void g_encaps_content_compute_end_pos(const GEncapsContent *, vmpa2t *); +  /* Avance la tête de lecture d'une certaine quantité de données. */  static bool g_encaps_content_seek(const GEncapsContent *, vmpa2t *, phys_t); @@ -193,6 +199,8 @@ static void g_encaps_content_interface_init(GBinContentInterface *iface)      iface->compute_checksum = (compute_checksum_fc)g_encaps_content_compute_checksum;      iface->compute_size = (compute_size_fc)g_encaps_content_compute_size; +    iface->compute_start_pos = (compute_start_pos_fc)g_encaps_content_compute_start_pos; +    iface->compute_end_pos = (compute_end_pos_fc)g_encaps_content_compute_end_pos;      iface->seek = (seek_fc)g_encaps_content_seek; @@ -525,6 +533,46 @@ static phys_t g_encaps_content_compute_size(const GEncapsContent *content)  /******************************************************************************  *                                                                             *  *  Paramètres  : content = contenu binaire à venir lire.                      * +*                pos     = position initiale. [OUT]                           * +*                                                                             * +*  Description : Détermine la position initiale d'un contenu.                 * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_encaps_content_compute_start_pos(const GEncapsContent *content, vmpa2t *pos) +{ +    g_binary_content_compute_start_pos(content->endpoint, pos); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : content = contenu binaire à venir lire.                      * +*                pos     = position finale (exclusive). [OUT]                 * +*                                                                             * +*  Description : Détermine la position finale d'un contenu.                   * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_encaps_content_compute_end_pos(const GEncapsContent *content, vmpa2t *pos) +{ +    g_binary_content_compute_end_pos(content->endpoint, pos); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : content = contenu binaire à venir lire.                      *  *                addr    = position de la tête de lecture.                    *  *                length  = quantité d'octets à provisionner.                  *  *                                                                             * diff --git a/src/analysis/contents/file.c b/src/analysis/contents/file.c index 3f256c9..6b55840 100644 --- a/src/analysis/contents/file.c +++ b/src/analysis/contents/file.c @@ -88,6 +88,9 @@ static void g_file_content_compute_checksum(GFileContent *, GChecksum *);  /* Détermine le nombre d'octets lisibles. */  static phys_t g_file_content_compute_size(const GFileContent *); +/* Détermine la position initiale d'un contenu. */ +static void g_file_content_compute_start_pos(const GFileContent *, vmpa2t *); +  /* Détermine la position finale d'un contenu. */  static void g_file_content_compute_end_pos(const GFileContent *, vmpa2t *); @@ -193,6 +196,7 @@ static void g_file_content_interface_init(GBinContentInterface *iface)      iface->compute_checksum = (compute_checksum_fc)g_file_content_compute_checksum;      iface->compute_size = (compute_size_fc)g_file_content_compute_size; +    iface->compute_start_pos = (compute_start_pos_fc)g_file_content_compute_start_pos;      iface->compute_end_pos = (compute_end_pos_fc)g_file_content_compute_end_pos;      iface->seek = (seek_fc)g_file_content_seek; @@ -530,6 +534,26 @@ static phys_t g_file_content_compute_size(const GFileContent *content)  /******************************************************************************  *                                                                             *  *  Paramètres  : content = contenu binaire à venir lire.                      * +*                pos     = position initiale. [OUT]                           * +*                                                                             * +*  Description : Détermine la position initiale d'un contenu.                 * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_file_content_compute_start_pos(const GFileContent *content, vmpa2t *pos) +{ +    copy_vmpa(pos, get_mrange_addr(&content->range)); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : content = contenu binaire à venir lire.                      *  *                pos     = position finale (exclusive). [OUT]                 *  *                                                                             *  *  Description : Détermine la position finale d'un contenu.                   * diff --git a/src/analysis/contents/memory.c b/src/analysis/contents/memory.c index 404481f..7406a3a 100644 --- a/src/analysis/contents/memory.c +++ b/src/analysis/contents/memory.c @@ -88,6 +88,9 @@ static void g_memory_content_compute_checksum(GMemoryContent *, GChecksum *);  /* Détermine le nombre d'octets lisibles. */  static phys_t g_memory_content_compute_size(const GMemoryContent *); +/* Détermine la position initiale d'un contenu. */ +static void g_memory_content_compute_start_pos(const GMemoryContent *, vmpa2t *); +  /* Détermine la position finale d'un contenu. */  static void g_memory_content_compute_end_pos(const GMemoryContent *, vmpa2t *); @@ -195,6 +198,7 @@ static void g_memory_content_interface_init(GBinContentInterface *iface)      iface->compute_checksum = (compute_checksum_fc)g_memory_content_compute_checksum;      iface->compute_size = (compute_size_fc)g_memory_content_compute_size; +    iface->compute_start_pos = (compute_start_pos_fc)g_memory_content_compute_start_pos;      iface->compute_end_pos = (compute_end_pos_fc)g_memory_content_compute_end_pos;      iface->seek = (seek_fc)g_memory_content_seek; @@ -513,6 +517,26 @@ static phys_t g_memory_content_compute_size(const GMemoryContent *content)  /******************************************************************************  *                                                                             *  *  Paramètres  : content = contenu binaire à venir lire.                      * +*                pos     = position initiale. [OUT]                           * +*                                                                             * +*  Description : Détermine la position initiale d'un contenu.                 * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_memory_content_compute_start_pos(const GMemoryContent *content, vmpa2t *pos) +{ +    g_binary_content_compute_start_pos(content->backend, pos); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : content = contenu binaire à venir lire.                      *  *                pos     = position finale (exclusive). [OUT]                 *  *                                                                             *  *  Description : Détermine la position finale d'un contenu.                   * diff --git a/src/analysis/contents/restricted.c b/src/analysis/contents/restricted.c index 647192f..1c0c8e6 100644 --- a/src/analysis/contents/restricted.c +++ b/src/analysis/contents/restricted.c @@ -75,6 +75,9 @@ static void g_restricted_content_compute_checksum(GRestrictedContent *, GChecksu  /* Détermine le nombre d'octets lisibles. */  static phys_t g_restricted_content_compute_size(const GRestrictedContent *); +/* Détermine la position initiale d'un contenu. */ +static void g_restricted_content_compute_start_pos(const GRestrictedContent *, vmpa2t *); +  /* Détermine la position finale d'un contenu. */  static void g_restricted_content_compute_end_pos(const GRestrictedContent *, vmpa2t *); @@ -176,6 +179,7 @@ static void g_restricted_content_interface_init(GBinContentInterface *iface)      iface->compute_checksum = (compute_checksum_fc)g_restricted_content_compute_checksum;      iface->compute_size = (compute_size_fc)g_restricted_content_compute_size; +    iface->compute_start_pos = (compute_start_pos_fc)g_restricted_content_compute_start_pos;      iface->compute_end_pos = (compute_end_pos_fc)g_restricted_content_compute_end_pos;      iface->seek = (seek_fc)g_restricted_content_seek; @@ -379,6 +383,26 @@ static phys_t g_restricted_content_compute_size(const GRestrictedContent *conten  /******************************************************************************  *                                                                             *  *  Paramètres  : content = contenu binaire à venir lire.                      * +*                pos     = position initiale. [OUT]                           * +*                                                                             * +*  Description : Détermine la position initiale d'un contenu.                 * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_restricted_content_compute_start_pos(const GRestrictedContent *content, vmpa2t *pos) +{ +    copy_vmpa(pos, get_mrange_addr(&content->range)); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : content = contenu binaire à venir lire.                      *  *                pos     = position finale (exclusive). [OUT]                 *  *                                                                             *  *  Description : Détermine la position finale d'un contenu.                   *  | 
