1 /* 2 * The Sleuth Kit 3 * 4 * Contact: Brian Carrier [carrier <at> sleuthkit [dot] org] 5 * Copyright (c) 2010-2012 Basis Technology Corporation. All Rights 6 * reserved. 7 * 8 * This software is distributed under the Common Public License 1.0 9 */ 10 11 #ifndef _OSS_SECTORRUNS_H 12 #define _OSS_SECTORRUNS_H 13 14 #include "tsk/framework/framework_i.h" 15 16 /** 17 * Stores a list of runs (which have a starting sector and length). 18 * Can be used to store information about a file, unused areas of an 19 * image, or ... 20 */ 21 class TSK_FRAMEWORK_API SectorRuns 22 { 23 public: 24 SectorRuns(); 25 virtual ~SectorRuns(); 26 27 int addRun(uint64_t start, uint64_t len, int vol_id); 28 29 int next(); // updates the current run; return -1 if none available 30 void reset(); 31 int getData(uint64_t offset, int len, char * buffer) const; // fills buffer with data from current run 32 // returns the number of bytes written 33 // returns -1 if no further data in the run 34 uint64_t getDataLen() const; 35 uint64_t getDataStart() const; 36 int getVolID() const; 37 38 private: 39 typedef struct { 40 uint64_t start; 41 uint64_t len; 42 int vol_id; 43 } SectorRun; 44 45 SectorRun *m_runs; 46 unsigned int m_numRunsUsed; 47 unsigned int m_numRunsAlloc; 48 unsigned int m_curRun; 49 }; 50 51 #endif 52