File: tsk_pool.h

package info (click to toggle)
sleuthkit 4.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,268 kB
  • sloc: ansic: 143,839; cpp: 54,644; java: 39,009; xml: 2,417; python: 1,085; perl: 874; makefile: 451; sh: 196
file content (107 lines) | stat: -rw-r--r-- 3,931 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
 * The Sleuth Kit
 *
 * Brian Carrier [carrier <at> sleuthkit [dot] org]
 * Copyright (c) 2019-2020 Brian Carrier.  All Rights reserved
 * Copyright (c) 2018-2019 BlackBag Technologies.  All Rights reserved
 *
 * This software is distributed under the Common Public License 1.0
 */

/** \@file Public C API */

#pragma once

#include <stdint.h>
#include "../base/tsk_base.h"
#include "../img/tsk_img.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct TSK_FS_ATTR_RUN TSK_FS_ATTR_RUN;

typedef enum {
  TSK_POOL_TYPE_DETECT = 0x0000,  ///< Use autodetection methods
  TSK_POOL_TYPE_APFS = 0x0001,    ///< APFS Pooled Volumes
  TSK_POOL_TYPE_LVM = 0x0002,    ///< Linux LVM volume group
  TSK_POOL_TYPE_UNSUPP = 0xffff,  ///< Unsupported pool container type
} TSK_POOL_TYPE_ENUM;

#define TSK_POOL_INFO_TAG 0x504F4C4C

typedef enum {
  TSK_POOL_VOLUME_FLAG_ENCRYPTED = 0x0001,
  TSK_POOL_VOLUME_FLAG_CASE_SENSITIVE = 0x0002,
} TSK_POOL_VOLUME_FLAGS;

#define TSK_POOL_VOL_INFO_TAG 0x50564F4C

typedef struct TSK_VS_PART_INFO TSK_VS_PART_INFO;
typedef struct TSK_IMG_INFO TSK_IMG_INFO;

typedef struct _TSK_POOL_VOLUME_INFO {
  uint32_t tag;  ///< Set to TSK_POOL_VOLUME_INFO_TAG when struct is alloc
  int index;     ///< Index of Volume
  char *desc;    ///< Description
  char *password_hint;                 ///< Password hint for encrypted volumes
  uint64_t block;                      ///< Starting Block number
  uint64_t num_blocks;                 ///< Number of blocks in the volume
  struct _TSK_POOL_VOLUME_INFO *next;  ///< Next Volume
  struct _TSK_POOL_VOLUME_INFO *prev;  ///< Previous Volume
  TSK_POOL_VOLUME_FLAGS flags;
} TSK_POOL_VOLUME_INFO;

typedef struct _TSK_POOL_INFO {
  uint32_t tag;              ///< Set to TSK_POOL_INFO_TAG when struct is alloc
  TSK_POOL_TYPE_ENUM ctype;  ///< Type of pool container
  uint32_t block_size;       ///< Block size
  uint64_t num_blocks;       ///< Number of blocks
  int num_vols;              ///< Number of volumes
  uint64_t img_offset;       ///< The image offset of the pool
  TSK_POOL_VOLUME_INFO *vol_list;  ///< Linked list of volume info structs

  // Callbacks
  void (*close)(const struct _TSK_POOL_INFO *);  ///< \internal
  uint8_t (*poolstat)(const struct _TSK_POOL_INFO *pool,
                      FILE *hFile);  ///< \internal
  TSK_IMG_INFO* (*get_img_info)(const struct _TSK_POOL_INFO *pool,
      TSK_DADDR_T pvol_block);  ///< \internal

  void *impl;  ///< \internal Implementation specific pointer

} TSK_POOL_INFO;

extern const TSK_POOL_INFO *tsk_pool_open_sing(const TSK_VS_PART_INFO *part,
                                               TSK_POOL_TYPE_ENUM type);

extern const TSK_POOL_INFO *tsk_pool_open(int num_vols,
                                          const TSK_VS_PART_INFO *const parts[],
                                          TSK_POOL_TYPE_ENUM type);

extern const TSK_POOL_INFO *tsk_pool_open_img_sing(TSK_IMG_INFO *img,
                                                   TSK_OFF_T offset,
                                                   TSK_POOL_TYPE_ENUM type);

extern const TSK_POOL_INFO *tsk_pool_open_img(int num_imgs,
                                              TSK_IMG_INFO *const imgs[],
                                              const TSK_OFF_T offsets[],
                                              TSK_POOL_TYPE_ENUM type);

extern void tsk_pool_close(const TSK_POOL_INFO *);

extern ssize_t tsk_pool_read(TSK_POOL_INFO *a_fs, TSK_OFF_T a_off, char *a_buf,
                             size_t a_len);

extern TSK_FS_ATTR_RUN *tsk_pool_unallocated_runs(const TSK_POOL_INFO *);

// Type functions
extern TSK_POOL_TYPE_ENUM tsk_pool_type_toid(const TSK_TCHAR *str);
extern TSK_POOL_TYPE_ENUM tsk_pool_type_toid_utf8(const char *str);
extern void tsk_pool_type_print(FILE *hFile);
extern const char *tsk_pool_type_toname(TSK_POOL_TYPE_ENUM ptype);

#ifdef __cplusplus
}  // extern "C"
#endif