From 7ddfd45ff1f78900303579f26bc8b0de16ed4612 Mon Sep 17 00:00:00 2001 From: Richard Cordovano <rcordovano@basistech.com> Date: Mon, 25 Jan 2016 18:06:47 -0500 Subject: [PATCH] Update documentation of data source id --- bindings/java/jni/dataModel_SleuthkitJNI.cpp | 3 +- tsk/auto/auto_db.cpp | 44 +++++++++++++++++++- tsk/auto/db_postgresql.cpp | 13 +++++- tsk/auto/db_sqlite.cpp | 12 ++++++ tsk/auto/tsk_case_db.h | 3 ++ 5 files changed, 71 insertions(+), 4 deletions(-) diff --git a/bindings/java/jni/dataModel_SleuthkitJNI.cpp b/bindings/java/jni/dataModel_SleuthkitJNI.cpp index dd3df9d32..3be922fae 100644 --- a/bindings/java/jni/dataModel_SleuthkitJNI.cpp +++ b/bindings/java/jni/dataModel_SleuthkitJNI.cpp @@ -982,7 +982,7 @@ JNIEXPORT jlong JNICALL * Add an image to a database using a pre-created process, which can be cancelled. * MUST call commitAddImg or revertAddImg afterwards once runAddImg returns. If there is an * error, you do not need to call revert or commit and the 'process' handle will be deleted. - * @return the 0 for success 1 for failure + * * @param env pointer to java environment this was called from * @param obj the java object this was called from * @param process the add-image process created by initAddImgNat @@ -990,6 +990,7 @@ JNIEXPORT jlong JNICALL * @param paths array of strings from java, the paths to the image parts * @param numImgs number of image parts * @param timeZone the timezone the image is from + * @return the 0 for success 1 for failure */ JNIEXPORT void JNICALL Java_org_sleuthkit_datamodel_SleuthkitJNI_runAddImgNat(JNIEnv * env, diff --git a/tsk/auto/auto_db.cpp b/tsk/auto/auto_db.cpp index 3d764dc30..89d8726c5 100644 --- a/tsk/auto/auto_db.cpp +++ b/tsk/auto/auto_db.cpp @@ -106,6 +106,16 @@ void TskAutoDb::setAddUnallocSpace(bool addUnallocSpace, int64_t chunkSize) m_chunkSize = chunkSize; } +/** + * Adds an image to the database. + * + * @param a_num Number of image parts + * @param a_images Array of paths to the image parts + * @param a_type Image type + * @param a_ssize Size of device sector in bytes (or 0 for default) + * @param dataSourceId An ascii-printable identifier for the data source that is unique across multiple cases (e.g., a UUID) + * @return 0 for success 1 for failure + */ uint8_t TskAutoDb::openImageUtf8(int a_num, const char *const a_images[], TSK_IMG_TYPE_ENUM a_type, unsigned int a_ssize, const char* dataSourceId) @@ -122,6 +132,16 @@ uint8_t return 0; } +/** + * Adds an image to the database. + * + * @param a_num Number of image parts + * @param a_images Array of paths to the image parts + * @param a_type Image type + * @param a_ssize Size of device sector in bytes (or 0 for default) + * @param dataSourceId An ascii-printable identifier for the data source that is unique across multiple cases (e.g., a UUID) + * @return 0 for success 1 for failure + */ uint8_t TskAutoDb::openImage(int a_num, const TSK_TCHAR * const a_images[], TSK_IMG_TYPE_ENUM a_type, unsigned int a_ssize, const char* dataSourceId) @@ -187,7 +207,10 @@ uint8_t /** * Adds image details to the existing database tables. + * + * @param dataSrcId An ascii-printable identifier for the data source that is unique across multiple cases (e.g., a UUID) * @param img_ptrs The paths to the image splits + * @param a_num The number of paths * @return Returns 1 on error */ uint8_t @@ -380,7 +403,13 @@ uint8_t TskAutoDb::addFilesInImgToDb() * Same functionality as addFilesInImgToDb(). Reverts * all changes on error. User must call either commitAddImage() to commit the changes, * or revertAddImage() to revert them. - * @returns 1 if critical system error occcured (data does not exist in DB), 2 if error occured while adding files to DB (but it finished), and 0 otherwise. All errors will have been registered. + * + * @param numImg Number of image parts + * @param imagePaths Array of paths to the image parts + * @param imgType Image type + * @param sSize Size of device sector in bytes (or 0 for default) + * @param dataSourceId An ascii-printable identifier for the data source that is unique across multiple cases (e.g., a UUID) + * @return 0 for success 1 for failure */ uint8_t TskAutoDb::startAddImage(int numImg, const TSK_TCHAR * const imagePaths[], @@ -426,6 +455,19 @@ uint8_t #ifdef WIN32 +/** + * Start the process to add image/file metadata to database inside of a transaction. + * Same functionality as addFilesInImgToDb(). Reverts + * all changes on error. User must call either commitAddImage() to commit the changes, + * or revertAddImage() to revert them. + * + * @param numImg Number of image parts + * @param imagePaths Array of paths to the image parts + * @param imgType Image type + * @param sSize Size of device sector in bytes (or 0 for default) + * @param dataSourceId An ascii-printable identifier for the data source that is unique across multiple cases (e.g., a UUID) + * @return 0 for success 1 for failure + */ uint8_t TskAutoDb::startAddImage(int numImg, const char *const imagePaths[], TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* dataSourceId) diff --git a/tsk/auto/db_postgresql.cpp b/tsk/auto/db_postgresql.cpp index 7e670dbe9..36b3eee04 100755 --- a/tsk/auto/db_postgresql.cpp +++ b/tsk/auto/db_postgresql.cpp @@ -696,8 +696,17 @@ int TskDbPostgreSQL::addImageInfo(int type, int ssize, int64_t & objId, const st } /** -* @returns 1 on error, 0 on success -*/ + * Adds image details to the existing database tables. + * + * @param type Image type + * @param ssize Size of device sector in bytes (or 0 for default) + * @param objId The object id assigned to the image (out param) + * @param timeZone The timezone the image is from + * @param size + * @param md5 MD% hash of the image + * @param dataSrcId An ascii-printable identifier for the data source that is unique across multiple cases (e.g., a UUID) + * @returns 1 on error, 0 on success + */ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, const string & timezone, TSK_OFF_T size, const string &md5, const string& dataSourceId) { // Add the data source to the tsk_objects table. diff --git a/tsk/auto/db_sqlite.cpp b/tsk/auto/db_sqlite.cpp index a3baa4c1d..72ec26a28 100755 --- a/tsk/auto/db_sqlite.cpp +++ b/tsk/auto/db_sqlite.cpp @@ -484,6 +484,18 @@ int return ret; } +/** + * Adds image details to the existing database tables. + * + * @param type Image type + * @param ssize Size of device sector in bytes (or 0 for default) + * @param objId The object id assigned to the image (out param) + * @param timeZone The timezone the image is from + * @param size + * @param md5 MD% hash of the image + * @param dataSrcId An ascii-printable identifier for the data source that is unique across multiple cases (e.g., a UUID) + * @returns 1 on error, 0 on success + */ int TskDbSqlite::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, const string & timezone, TSK_OFF_T size, const string &md5, const string& dataSourceId) { // Add the data source to the tsk_objects table. diff --git a/tsk/auto/tsk_case_db.h b/tsk/auto/tsk_case_db.h index 067320171..90655d10f 100644 --- a/tsk/auto/tsk_case_db.h +++ b/tsk/auto/tsk_case_db.h @@ -89,6 +89,9 @@ class TskAutoDb:public TskAuto { uint8_t addFilesInImgToDb(); + /** + * + */ uint8_t startAddImage(int numImg, const TSK_TCHAR * const imagePaths[], TSK_IMG_TYPE_ENUM imgType, unsigned int sSize, const char* dataSourceId = NULL); #ifdef WIN32 -- GitLab