The Sleuth Kit  4.2
Macros | Functions
tsk_base_i.h File Reference

Contains the general internal TSK type and function definitions. More...

#include "tsk_base.h"
#include <string.h>

Macros

#define rounddown(x, y)
 
#define tsk_gets16(endian, x)   ((int16_t)tsk_getu16(endian, x))
 
#define tsk_gets32(endian, x)   ((int32_t)tsk_getu32(endian, x))
 
#define tsk_gets64(endian, x)   ((int64_t)tsk_getu64(endian, x))
 
#define tsk_getu16(endian, x)
 
#define tsk_getu24(endian, x)
 
#define tsk_getu32(endian, x)
 
#define tsk_getu48(endian, x)
 
#define tsk_getu64(endian, x)
 
#define TSK_IS_CNTRL(x)   (((x) < 0x20) && ((x) >= 0x00))
 

Functions

void tsk_deinit_lock (tsk_lock_t *)
 
uint8_t tsk_guess_end_u16 (TSK_ENDIAN_ENUM *, uint8_t *, uint16_t)
 
uint8_t tsk_guess_end_u32 (TSK_ENDIAN_ENUM *, uint8_t *, uint32_t)
 
void tsk_init_lock (tsk_lock_t *)
 
void * tsk_malloc (size_t)
 
void * tsk_realloc (void *, size_t)
 
void tsk_release_lock (tsk_lock_t *)
 
void tsk_take_lock (tsk_lock_t *)
 

Unicode

enum  TSKConversionResult { TSKconversionOK, TSKsourceExhausted, TSKtargetExhausted, TSKsourceIllegal }
 
enum  TSKConversionFlags { TSKstrictConversion = 0, TSKlenientConversion }
 
typedef unsigned short UTF16
 
typedef unsigned char UTF8
 
typedef unsigned char Boolean
 
TSKConversionResult tsk_UTF8toUTF16 (const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, TSKConversionFlags flags)
 Convert a UTF-8 string to UTF-16 (in local endian ordering). More...
 
TSKConversionResult tsk_UTF8toUTF16W (const UTF8 **sourceStart, const UTF8 *sourceEnd, wchar_t **targetStart, wchar_t *targetEnd, TSKConversionFlags flags)
 
TSKConversionResult tsk_UTF16toUTF8 (TSK_ENDIAN_ENUM, const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, TSKConversionFlags flags)
 Convert a UTF-16 string to UTF-8. More...
 
TSKConversionResult tsk_UTF16toUTF8_lclorder (const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, TSKConversionFlags flags)
 Convert a UTF-16 string in local endian ordering to UTF-8. More...
 
TSKConversionResult tsk_UTF16WtoUTF8_lclorder (const wchar_t **sourceStart, const wchar_t *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, TSKConversionFlags flags)
 
Boolean tsk_isLegalUTF8Sequence (const UTF8 *source, const UTF8 *sourceEnd)
 
void tsk_cleanupUTF8 (char *source, const char replacement)
 Cleans up the passed in string to replace invalid UTF-8 values with the passed in character. More...
 

Detailed Description

Contains the general internal TSK type and function definitions.

This is needed by the library as it is built.

Macro Definition Documentation

#define rounddown (   x,
 
)
Value:
((((x) % (y)) == 0) ? (x) : \
(roundup((x),(y)) - (y)))
#define tsk_getu16 (   endian,
 
)
Value:
(uint16_t)(((endian) == TSK_LIT_ENDIAN) ? \
(((uint8_t *)(x))[0] + (((uint8_t *)(x))[1] << 8)) : \
(((uint8_t *)(x))[1] + (((uint8_t *)(x))[0] << 8)) )
Data is in little endian.
Definition: tsk_base.h:387
#define tsk_getu24 (   endian,
 
)
Value:
(uint32_t)(((endian) == TSK_LIT_ENDIAN) ? \
(((uint8_t *)(x))[0] + (((uint8_t *)(x))[1] << 8) + (((uint8_t *)(x))[2] << 16)) : \
(((uint8_t *)(x))[2] + (((uint8_t *)(x))[1] << 8) + (((uint8_t *)(x))[0] << 16)) )
Data is in little endian.
Definition: tsk_base.h:387
#define tsk_getu32 (   endian,
 
)
Value:
(uint32_t)( ((endian) == TSK_LIT_ENDIAN) ? \
((((uint8_t *)(x))[0] << 0) + \
(((uint8_t *)(x))[1] << 8) + \
(((uint8_t *)(x))[2] << 16) + \
(((uint8_t *)(x))[3] << 24) ) \
: \
((((uint8_t *)(x))[3] << 0) + \
(((uint8_t *)(x))[2] << 8) + \
(((uint8_t *)(x))[1] << 16) + \
(((uint8_t *)(x))[0] << 24) ) )
Data is in little endian.
Definition: tsk_base.h:387
#define tsk_getu48 (   endian,
 
)
Value:
(uint64_t)( ((endian) == TSK_LIT_ENDIAN) ? \
((uint64_t) \
((uint64_t)((uint8_t *)(x))[0] << 0)+ \
((uint64_t)((uint8_t *)(x))[1] << 8) + \
((uint64_t)((uint8_t *)(x))[2] << 16) + \
((uint64_t)((uint8_t *)(x))[3] << 24) + \
((uint64_t)((uint8_t *)(x))[4] << 32) + \
((uint64_t)((uint8_t *)(x))[5] << 40)) \
: \
((uint64_t) \
((uint64_t)((uint8_t *)(x))[5] << 0)+ \
((uint64_t)((uint8_t *)(x))[4] << 8) + \
((uint64_t)((uint8_t *)(x))[3] << 16) + \
((uint64_t)((uint8_t *)(x))[2] << 24) + \
((uint64_t)((uint8_t *)(x))[1] << 32) + \
((uint64_t)((uint8_t *)(x))[0] << 40)) )
Data is in little endian.
Definition: tsk_base.h:387
#define tsk_getu64 (   endian,
 
)
Value:
(uint64_t)( ((endian) == TSK_LIT_ENDIAN) ? \
((uint64_t) \
((uint64_t)((uint8_t *)(x))[0] << 0) + \
((uint64_t)((uint8_t *)(x))[1] << 8) + \
((uint64_t)((uint8_t *)(x))[2] << 16) + \
((uint64_t)((uint8_t *)(x))[3] << 24) + \
((uint64_t)((uint8_t *)(x))[4] << 32) + \
((uint64_t)((uint8_t *)(x))[5] << 40) + \
((uint64_t)((uint8_t *)(x))[6] << 48) + \
((uint64_t)((uint8_t *)(x))[7] << 56)) \
: \
((uint64_t) \
((uint64_t)((uint8_t *)(x))[7] << 0) + \
((uint64_t)((uint8_t *)(x))[6] << 8) + \
((uint64_t)((uint8_t *)(x))[5] << 16) + \
((uint64_t)((uint8_t *)(x))[4] << 24) + \
((uint64_t)((uint8_t *)(x))[3] << 32) + \
((uint64_t)((uint8_t *)(x))[2] << 40) + \
((uint64_t)((uint8_t *)(x))[1] << 48) + \
((uint64_t)((uint8_t *)(x))[0] << 56)) )
Data is in little endian.
Definition: tsk_base.h:387

Enumeration Type Documentation

Enumerator
TSKstrictConversion 

Error if invalid surrogate pairs are found.

TSKlenientConversion 

Ignore invalid surrogate pairs.

Enumerator
TSKconversionOK 

conversion successful

TSKsourceExhausted 

partial character in source, but hit end

TSKtargetExhausted 

insuff. room in target for conversion

TSKsourceIllegal 

source sequence is illegal/malformed

Function Documentation

void tsk_cleanupUTF8 ( char *  source,
const char  replacement 
)

Cleans up the passed in string to replace invalid UTF-8 values with the passed in character.

Parameters
sourceString to be cleaned up
replacementCharacter to insert into source as needed.

Copyright © 2007-2015 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.