Difference between revisions of "Truxton C API"

From truxwiki.com
Jump to navigation Jump to search
Line 297: Line 297:
 
Artifacts are pieces of information that are also known as entities.
 
Artifacts are pieces of information that are also known as entities.
  
* [[truxton_artifact_create]]
+
* [[truxton_artifact_create]] - Creates a new artifact object
* [[truxton_artifact_destroy]]
+
* [[truxton_artifact_destroy]] - Destroys an existing artifact object
* [[truxton_artifact_save]]
+
* [[truxton_artifact_save]] - Saves the artifact to the <code><nowiki>[</nowiki>[[Entity Table|Entity]]<nowiki>]</nowiki></code> table in the database
* [[truxton_artifact_get_data_type]]
+
* [[truxton_artifact_get_data_type]] - Retrieves the raw data type
* [[truxton_artifact_set_data_type]]
+
* [[truxton_artifact_set_data_type]] - Sets the raw data type
* [[truxton_artifact_get_file_id]]
+
* [[truxton_artifact_get_file_id]] - Retrieves the identifier of the file the artifact was found in
* [[truxton_artifact_set_file_id]]
+
* [[truxton_artifact_set_file_id]] - Sets the identifier of the file the artifact was found in
* [[truxton_artifact_get_id]]
+
* [[truxton_artifact_get_id]] - After saving, retrieves the identifier of the artifact
* [[truxton_artifact_get_length]]
+
* [[truxton_artifact_get_length]] - Retrieves the number of bytes in the raw data that make up this artifact
* [[truxton_artifact_set_length]]
+
* [[truxton_artifact_set_length]] - Sets the number of bytes in the raw data that make up this artifact
* [[truxton_artifact_get_media_id]]
+
* [[truxton_artifact_get_media_id]] - Retrieves the identifier of the media this artifact is in
* [[truxton_artifact_set_media_id]]
+
* [[truxton_artifact_set_media_id]] - Sets the identifier of the media this artifact is in
* [[truxton_artifact_get_object_id]]
+
* [[truxton_artifact_get_object_id]] - Retrieves the identifier of the object the artifact came from
* [[truxton_artifact_set_object_id]]
+
* [[truxton_artifact_set_object_id]] - Sets the identifier of the object the artifact came from
* [[truxton_artifact_get_object_type]]
+
* [[truxton_artifact_get_object_type]] - Retrieves the type of object the artifact came from
* [[truxton_artifact_set_object_type]]
+
* [[truxton_artifact_set_object_type]] - Sets the type of object the artifact came from
* [[truxton_artifact_get_offset]]
+
* [[truxton_artifact_get_offset]] - Retrieves the offset in the file where the artifact came from
* [[truxton_artifact_set_offset]]
+
* [[truxton_artifact_set_offset]] - Sets the offset in the file where the artifact came from
* [[truxton_artifact_get_value]]
+
* [[truxton_artifact_get_value]] - Retrieves the value of the artifact
* [[truxton_artifact_set_value]]
+
* [[truxton_artifact_set_value]] - Sets the value of the artifact
  
 
==Event==
 
==Event==

Revision as of 04:10, 2 December 2020

Truxton functionality is exposed to the C programming world as a DLL named TruxtonCAPI.dll in the C:\Program Files\Truxton\SDK folder. This DLL can be called from any programming language that has the ability to make operating system calls.

Philosophy

The API is considered to be "flat" in that only sixty-four bit integers and ASCII character strings are used in the interface. This was chosen to make it easy for other languages to call the API. The coding convention is all lower case names with underscores separating words. Truxton is a member of the east const posse.

Creating a lib

Truxton doesn't ship a linker library for TruxtonCAPI.dll in order not to tie the developer to any particular compiler. If you want to link TruxtonCAPI.dll with your own C/C++ code, you will need to generate a linker library.

Generating a Linker Library for Microsoft Compilers

You can download a free Visual Studio from Microsoft. The steps to produce a LIB file from a DLL are:

  1. Generate a module definition (DEF) file from TruxtonCAPI.dll.
  2. Use the DEF file to create the linker library (LIB) file.

Generate a Module Definition File

The following Powershell script will create the DEF file.

$dumpbin = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64\dumpbin.exe"

$lines = (& $dumpbin /exports TruxtonCAPI.dll)

Write-Output "EXPORTS"

foreach ( $line in $lines )
{
   if ( $line.Contains(" = ") -EQ $true )
   {
      Write-Output $line.SubString($line.IndexOf(" = ") + 3)
   }
}

In your SDK folder, execute the script from Powershell:

MakeDef.ps1 >TruxtonCAPI.def

Generate a LIB File

Now that you have the DEF file, you can create the linker library using lib.exe (which is found in the same folder as dumpbin.exe) in the command window:

lib.exe /def:TruxtonCAPI.def /out:TruxtonCAPI.lib /machine:x64

API Groups

The API is broken down into the different areas of Truxton.

Initialization

Functions

ETL Functions

Child Files

A child file is one that you have created and need to save in Truxton.

Creating things related to this file:

File IO

File Record Fields

File Actions

These are things your can do to a file. These are not data items stored in the database.

Create Objects from File

The following APIs are used to create objects with a file as their parent.

Debugging

Media

These are the API's that allow you to add to the Media table in the database.

Message

This is the message sent on the message bus between the ETL processes.

File Export

Artifacts

Artifacts are pieces of information that are also known as entities.

Event

If you need to save a significant place in time, use the following functions. These will create a record in the [Event] table.

EXIF (Camera Information)

File Type

Geographic Location

Options

Truxton "options" are otherwise known as configuration settings, command line options, etc. They are configuration items that your program can use.

Relation

Website Visit

USB Device