1 /*- 2 *********************************************************************** 3 * 4 * $Id: ftimes.h,v 1.167 2014/07/18 06:40:44 mavrik Exp $ 5 * 6 *********************************************************************** 7 * 8 * Copyright 2000-2014 The FTimes Project, All Rights Reserved. 9 * 10 *********************************************************************** 11 */ 12 #ifndef _FTIMES_H_INCLUDED 13 #define _FTIMES_H_INCLUDED 14 15 /*- 16 *********************************************************************** 17 * 18 * Defines 19 * 20 *********************************************************************** 21 */ 22 #define PROGRAM_NAME "ftimes" 23 24 #define LF "\n" 25 #define CRLF "\r\n" 26 #define NEWLINE_LENGTH 3 27 28 #ifdef WIN32 29 #ifdef MINGW32 30 #define UNIX_EPOCH_IN_NT_TIME 0x019db1ded53e8000LL 31 #define UNIX_LIMIT_IN_NT_TIME 0x01e9fcf4ebcfe180LL 32 #else 33 #define UNIX_EPOCH_IN_NT_TIME 0x019db1ded53e8000 34 #define UNIX_LIMIT_IN_NT_TIME 0x01e9fcf4ebcfe180 35 #endif 36 #define DEFAULT_STREAM_NAME_W L"::$DATA" 37 #define FTIMES_STREAM_INFO_SIZE 0x8000 38 #define FTIMES_MAX_STREAM_INFO_SIZE 0x00100000 39 #define FTIMES_INVALID_STREAM_COUNT 0xffffffff 40 #else 41 #define UNIX_EPOCH_IN_NT_TIME 0x019db1ded53e8000LL 42 #define UNIX_LIMIT_IN_NT_TIME 0x01e9fcf4ebcfe180LL 43 #endif 44 45 #ifdef UNIX 46 #ifdef FALSE 47 #undef FALSE 48 #endif 49 50 #ifdef TRUE 51 #undef TRUE 52 #endif 53 54 typedef enum _BOOL 55 { 56 FALSE = 0, 57 TRUE 58 } BOOL; 59 #endif 60 61 typedef enum _FTIMES_OPTION_IDS 62 { 63 OPT_LogLevel, 64 OPT_MagicFile, 65 OPT_MemoryMapEnable, 66 OPT_NamesAreCaseInsensitive, 67 OPT_StrictTesting, 68 } FTIMES_OPTION_IDS; 69 70 #define N_100ns_UNITS_IN_1s 10000000 71 #define N_100ns_UNITS_IN_1us 10 72 73 #define FTIMES_MAX_32BIT_NUMBER_LENGTH 11 /* 4294967295 */ 74 #define FTIMES_MAX_32BIT_SIZE 36 /* (prefix [+-](0x|0|)) 3 + (binary string) 32 + (NULL) 1 */ 75 #define FTIMES_MAX_64BIT_SIZE 68 /* (prefix [+-](0x|0|)) 3 + (binary string) 64 + (NULL) 1 */ 76 #define FTIMES_DATETIME_SIZE 15 77 #define FTIMES_TIME_SIZE 20 78 #define FTIMES_PID_SIZE 11 79 #define FTIMES_RUNTIME_FORMAT "%H:%M:%S" 80 #define FTIMES_RUNDATE_FORMAT "%Y-%m-%d" 81 #define FTIMES_RUNZONE_FORMAT "%Z" 82 #define FTIMES_SUFFIX_SIZE 64 83 #define FTIMES_ZONE_SIZE 64 84 #ifdef UNIX 85 #define FTIMES_TIME_FORMAT_SIZE 20 86 #define FTIMES_TIME_FORMAT "%Y-%m-%d %H:%M:%S" 87 #endif 88 #ifdef WIN32 89 #define FTIMES_TIME_FORMAT_SIZE 24 90 #define FTIMES_TIME_FORMAT "%04d-%02d-%02d %02d:%02d:%02d|%d" 91 #define FTIMES_OOB_TIME_FORMAT_SIZE 19 92 #define FTIMES_OOB_TIME_FORMAT "%04d%02d%02d%02d%02d%02d|%x" 93 #endif 94 #define FTIMES_YMDHMS_FORMAT_SIZE 20 95 #define FTIMES_YMDHMS_FORMAT "%Y-%m-%d %H:%M:%S" 96 97 #ifdef WIN32 98 #define FTIMES_DOT_W L"." 99 #define FTIMES_DOTDOT_W L".." 100 //THIS CHANGE IS PART OF EXTENDED PREFIX SUPPORT (\\?\) 101 #define FTIMES_EXTENDED_PREFIX_SIZE 4 102 //END (\\?\) 103 #define FTIMES_ROOT_PATH "c:" 104 #define FTIMES_SLASH "\\" 105 #define FTIMES_SLASH_W L"\\" 106 #define FTIMES_SLASHCHAR '\\' 107 #define FTIMES_SLASHCHAR_W L'\\' 108 #define FTIMES_TEMP_DIRECTORY "\\temp" 109 //THIS CHANGE IS PART OF EXTENDED PREFIX SUPPORT (\\?\) 110 //#define FTIMES_MAX_PATH 260 111 #define FTIMES_MAX_PATH 4096 112 //END (\\?\) 113 #define FTIMES_MAX_ACL_SIZE 1024 /* This is an arbitrary limit. An ACL consists of zero or more ACEs, but the output buffer is fixed, so a limit must be imposed. */ 114 #define FTIMES_MAX_SID_SIZE 192 /* S-255-18446744073709551615-4294967295[-4294967295]{0,14} --> 1 + (1 + 3) + (1 + 20) + ((1 + 10) * 15) + 1 */ 115 #else 116 #define FTIMES_ROOT_PATH "/" 117 #define FTIMES_SLASH "/" 118 #define FTIMES_SLASHCHAR '/' 119 #define FTIMES_TEMP_DIRECTORY "/tmp" 120 #define FTIMES_MAX_PATH 4096 121 #endif 122 #define FTIMES_DOT "." 123 #define FTIMES_DOTCHAR '.' 124 #define FTIMES_DOTDOT ".." 125 #define FTIMES_SEPARATOR "=" 126 127 #define FTIMES_MIN_BLOCK_SIZE 1 128 #define FTIMES_MAX_BLOCK_SIZE 1073741824 /* 1 GB */ 129 #define FTIMES_MAX_KBPS 2097152 /* 2^31/1024 */ 130 131 #define FTIMES_MIN_STRING_REPEATS 0 132 #define FTIMES_MAX_STRING_REPEATS 0x7fffffff 133 134 #define FTIMES_MIN_FILE_SIZE_LIMIT 0 135 #define FTIMES_MAX_FILE_SIZE_LIMIT ~0 136 137 #define FTIMES_MIN_MMAP_SIZE 67108864 /* 64 MB */ 138 #define FTIMES_MAX_MMAP_SIZE 1073741824 /* 1 GB */ 139 140 #define FTIMES_MAX_HOSTNAME_LENGTH 256 141 #define FTIMES_MAX_MD5_LENGTH (((MD5_HASH_SIZE)*2)+1) 142 #define FTIMES_MAX_SHA1_LENGTH (((SHA1_HASH_SIZE)*2)+1) 143 #define FTIMES_MAX_SHA256_LENGTH (((SHA256_HASH_SIZE)*2)+1) 144 #define FTIMES_MAX_USERNAME_LENGTH 32 145 #define FTIMES_MAX_PASSWORD_LENGTH 32 146 #define FTIMES_MAX_PRIORITY_LENGTH 64 147 148 #define FTIMES_MAX_LINE 8192 149 150 #define FTIMES_NONCE_SIZE 9 151 152 #define FTIMES_FILETYPE_ERROR 0 153 #define FTIMES_FILETYPE_BLOCK 1 154 #define FTIMES_FILETYPE_CHARACTER 2 155 #define FTIMES_FILETYPE_DIRECTORY 3 156 #define FTIMES_FILETYPE_DOOR 4 157 #define FTIMES_FILETYPE_FIFO 5 158 #define FTIMES_FILETYPE_LINK 6 159 #define FTIMES_FILETYPE_REGULAR 7 160 #define FTIMES_FILETYPE_SOCKET 8 161 #define FTIMES_FILETYPE_WHITEOUT 9 162 #define FTIMES_FILETYPE_UNKNOWN 10 163 164 #ifdef WIN32 165 #ifndef IDLE_PRIORITY_CLASS 166 #define IDLE_PRIORITY_CLASS 0x00000040 167 #endif 168 #ifndef BELOW_NORMAL_PRIORITY_CLASS 169 #define BELOW_NORMAL_PRIORITY_CLASS 0x00004000 170 #endif 171 #ifndef NORMAL_PRIORITY_CLASS 172 #define NORMAL_PRIORITY_CLASS 0x00000020 173 #endif 174 #ifndef ABOVE_NORMAL_PRIORITY_CLASS 175 #define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000 176 #endif 177 #ifndef HIGH_PRIORITY_CLASS 178 #define HIGH_PRIORITY_CLASS 0x00000080 179 #endif 180 #define FTIMES_PRIORITY_LOW IDLE_PRIORITY_CLASS 181 #define FTIMES_PRIORITY_BELOW_NORMAL BELOW_NORMAL_PRIORITY_CLASS 182 #define FTIMES_PRIORITY_NORMAL NORMAL_PRIORITY_CLASS 183 #define FTIMES_PRIORITY_ABOVE_NORMAL ABOVE_NORMAL_PRIORITY_CLASS 184 #define FTIMES_PRIORITY_HIGH HIGH_PRIORITY_CLASS 185 #else 186 #define FTIMES_PRIORITY_LOW 20 187 #define FTIMES_PRIORITY_BELOW_NORMAL 10 188 #define FTIMES_PRIORITY_NORMAL 0 189 #define FTIMES_PRIORITY_ABOVE_NORMAL -10 190 #define FTIMES_PRIORITY_HIGH -20 191 #endif 192 193 #define FTIMES_TEST_NORMAL 0 194 #define FTIMES_TEST_STRICT 1 195 196 #define FTIMES_FILETYPE_BUFSIZE 1280 /* XMAGIC_MAX_LEVEL * XMAGIC_DESCRIPTION_BUFSIZE */ 197 198 typedef struct _FTIMES_HASH_DATA 199 { 200 MD5_CONTEXT sMd5Context; 201 SHA1_CONTEXT sSha1Context; 202 SHA256_CONTEXT sSha256Context; 203 } FTIMES_HASH_DATA; 204 205 #ifdef WINNT 206 typedef struct _FTIMES_FILE_DATA 207 { 208 char acType[FTIMES_FILETYPE_BUFSIZE]; 209 char *pcNeuteredPath; 210 char *pcRawPath; 211 DWORD dwFileAttributes; 212 DWORD dwFileIndexHigh; 213 DWORD dwFileIndexLow; 214 DWORD dwFileSizeHigh; 215 DWORD dwFileSizeLow; 216 DWORD dwVolumeSerialNumber; 217 FILETIME sFTATime; 218 FILETIME sFTCTime; 219 FILETIME sFTChTime; 220 FILETIME sFTMTime; 221 int iFileExists; 222 int iFiltered; 223 int iFSType; 224 int iNeuteredPathLength; 225 int iStreamCount; 226 int iUtf8RawPathLength; 227 int iWideRawPathLength; 228 SECURITY_DESCRIPTOR *psSd; 229 SID *psSidOwner; 230 SID *psSidGroup; 231 unsigned char aucFileMd5[MD5_HASH_SIZE]; 232 unsigned char aucFileSha1[SHA1_HASH_SIZE]; 233 unsigned char aucFileSha256[SHA256_HASH_SIZE]; 234 unsigned char *pucStreamInfo; 235 unsigned long ulAttributeMask; 236 wchar_t *pwcRawPath; 237 struct _FTIMES_FILE_DATA *psParent; 238 } FTIMES_FILE_DATA; 239 #else 240 typedef struct _FTIMES_FILE_DATA 241 { 242 char acType[FTIMES_FILETYPE_BUFSIZE]; 243 char *pcNeuteredPath; 244 char *pcRawPath; 245 int iFileExists; 246 int iFiltered; 247 int iFSType; 248 int iNeuteredPathLength; 249 int iRawPathLength; 250 struct stat sStatEntry; 251 unsigned char aucFileMd5[MD5_HASH_SIZE]; 252 unsigned char aucFileSha1[SHA1_HASH_SIZE]; 253 unsigned char aucFileSha256[SHA256_HASH_SIZE]; 254 unsigned long ulAttributeMask; 255 struct _FTIMES_FILE_DATA *psParent; 256 } FTIMES_FILE_DATA; 257 #endif 258 259 #define FILE_LIST_REGULAR 0 260 #define FILE_LIST_ENCODED 1 261 typedef struct _FILE_LIST 262 { 263 char *pcRegularPath; 264 char *pcEncodedPath; 265 int iLength; 266 int iType; /* FILE_LIST_REGULAR or FILE_LIST_ENCODED */ 267 struct _FILE_LIST *psNext; 268 } FILE_LIST; 269 270 #ifdef USE_PCRE 271 typedef struct _FILTER_LIST 272 { 273 char *pcFilter; 274 pcre *psPcre; 275 pcre_extra *psPcreExtra; 276 struct _FILTER_LIST *psNext; 277 } FILTER_LIST; 278 #endif 279 280 #define FTIMES_CMPDATA "cmp" 281 #define FTIMES_DIGDATA "dig" 282 #define FTIMES_MADDATA "mad" 283 #define FTIMES_MAPDATA "map" 284 #define FTIMES_MAX_DATA_TYPE 4 285 286 #define FTIMES_RECORD_PREFIX_SIZE 5 287 288 #define FTIMES_CFGTEST 0x00000001 289 #define FTIMES_CMPMODE 0x00000002 290 #define FTIMES_DECODER 0x00000004 291 #define FTIMES_DIGAUTO 0x00000008 292 #define FTIMES_DIGMODE 0x00000010 293 #define FTIMES_GETMODE 0x00000040 294 #define FTIMES_MAPAUTO 0x00000080 295 #define FTIMES_MAPMODE 0x00000100 296 #define FTIMES_VERSION 0x00000400 297 #define FTIMES_MADMODE 0x00001000 298 299 #define FTIMES_DIGMADMAP 0x00001110 300 #define FTIMES_DIGMAD 0x00001010 301 #define FTIMES_MADMAP 0x00001100 302 303 #define MODES_AnalyzeBlockSize (FTIMES_DIGMADMAP) 304 #define MODES_AnalyzeByteCount (FTIMES_DIGMADMAP) 305 #define MODES_AnalyzeCarrySize (FTIMES_DIGMAD) 306 #ifdef USE_XMAGIC 307 #define MODES_AnalyzeStepSize (FTIMES_DIGMAD) 308 #endif 309 #define MODES_AnalyzeDeviceFiles (FTIMES_DIGMADMAP) 310 #define MODES_AnalyzeMaxDps (FTIMES_DIGMADMAP) 311 #define MODES_AnalyzeRemoteFiles (FTIMES_DIGMADMAP) 312 #define MODES_AnalyzeStartOffset (FTIMES_DIGMADMAP) 313 #define MODES_BaseName ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 314 #define MODES_BaseNameSuffix (FTIMES_DIGMADMAP) 315 #define MODES_Compress (FTIMES_MADMAP) 316 #define MODES_DigString ((FTIMES_DIGAUTO) | (FTIMES_DIGMAD)) 317 #define MODES_DigStringNoCase ((FTIMES_DIGAUTO) | (FTIMES_DIGMAD)) 318 #define MODES_DigStringNormal ((FTIMES_DIGAUTO) | (FTIMES_DIGMAD)) 319 #ifdef USE_PCRE 320 #define MODES_DigStringRegExp ((FTIMES_DIGAUTO) | (FTIMES_DIGMAD)) 321 #endif 322 #ifdef USE_XMAGIC 323 #define MODES_DigStringXMagic ((FTIMES_DIGAUTO) | (FTIMES_DIGMAD)) 324 #endif 325 #define MODES_EnableRecursion (FTIMES_DIGMADMAP) 326 #define MODES_Exclude ((FTIMES_DIGAUTO) | (FTIMES_MAPAUTO) | (FTIMES_DIGMADMAP)) 327 #ifdef USE_PCRE 328 #define MODES_ExcludeFilter ((FTIMES_DIGAUTO) | (FTIMES_MAPAUTO) | (FTIMES_DIGMADMAP)) 329 #define MODES_ExcludeFilterMd5 ((FTIMES_MAPAUTO) | (FTIMES_MADMAP)) 330 #define MODES_ExcludeFilterSha1 ((FTIMES_MAPAUTO) | (FTIMES_MADMAP)) 331 #define MODES_ExcludeFilterSha256 ((FTIMES_MAPAUTO) | (FTIMES_MADMAP)) 332 #endif 333 #define MODES_ExcludesMustExist (FTIMES_DIGMADMAP) 334 #define MODES_FieldMask ((FTIMES_CMPMODE) | (FTIMES_MAPAUTO) | (FTIMES_MADMAP)) 335 #ifdef USE_FILE_HOOKS 336 #define MODES_FileHook (FTIMES_DIGMADMAP) 337 #endif 338 #define MODES_FileSizeLimit (FTIMES_DIGMADMAP) 339 #define MODES_GetAndExec ((FTIMES_GETMODE)) 340 #define MODES_GetFileName ((FTIMES_GETMODE)) 341 #define MODES_HashDirectories (FTIMES_MADMAP) 342 #define MODES_HashSymbolicLinks (FTIMES_MADMAP) 343 #define MODES_Import ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 344 #define MODES_Include ((FTIMES_DIGAUTO) | (FTIMES_MAPAUTO) | (FTIMES_DIGMADMAP)) 345 #ifdef USE_PCRE 346 #define MODES_IncludeFilter ((FTIMES_DIGAUTO) | (FTIMES_MAPAUTO) | (FTIMES_DIGMADMAP)) 347 #define MODES_IncludeFilterMd5 ((FTIMES_MAPAUTO) | (FTIMES_MADMAP)) 348 #define MODES_IncludeFilterSha1 ((FTIMES_MAPAUTO) | (FTIMES_MADMAP)) 349 #define MODES_IncludeFilterSha256 ((FTIMES_MAPAUTO) | (FTIMES_MADMAP)) 350 #endif 351 #define MODES_IncludesMustExist (FTIMES_DIGMADMAP) 352 #define MODES_LogDigStrings ((FTIMES_DIGAUTO) | (FTIMES_DIGMAD)) 353 #define MODES_LogDir (FTIMES_DIGMADMAP) 354 #define MODES_MagicFile (FTIMES_MADMAP) 355 #define MODES_MatchLimit (FTIMES_DIGMAD) 356 #define MODES_NewLine (FTIMES_DIGMADMAP) 357 #define MODES_OutDir (FTIMES_DIGMADMAP) 358 #define MODES_Priority ((FTIMES_CMPMODE) | (FTIMES_DIGAUTO) | (FTIMES_MAPAUTO) | (FTIMES_DIGMADMAP)) 359 #define MODES_RequirePrivilege (FTIMES_DIGMADMAP) 360 #define MODES_RunType (FTIMES_DIGMADMAP) 361 #define MODES_StrictControls ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 362 #define MODES_URLAuthType ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 363 #define MODES_URLGetRequest ((FTIMES_GETMODE)) 364 #define MODES_URLGetURL ((FTIMES_GETMODE)) 365 #define MODES_URLPassword ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 366 #define MODES_URLPutSnapshot (FTIMES_DIGMADMAP) 367 #define MODES_URLPutURL (FTIMES_DIGMADMAP) 368 #define MODES_URLUnlinkOutput (FTIMES_DIGMADMAP) 369 #define MODES_URLUsername ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 370 #ifdef USE_SSL 371 #define MODES_SSLBundledCAsFile ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 372 #define MODES_SSLExpectedPeerCN ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 373 #define MODES_SSLMaxChainLength ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 374 #define MODES_SSLPassPhrase ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 375 #define MODES_SSLPrivateKeyFile ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 376 #define MODES_SSLPublicCertFile ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 377 #define MODES_SSLUseCertificate ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 378 #define MODES_SSLVerifyPeerCert ((FTIMES_DIGMADMAP) | (FTIMES_GETMODE)) 379 #endif 380 381 #define KEY_AnalyzeBlockSize "AnalyzeBlockSize" 382 #define KEY_AnalyzeByteCount "AnalyzeByteCount" 383 #define KEY_AnalyzeCarrySize "AnalyzeCarrySize" 384 #ifdef USE_XMAGIC 385 #define KEY_AnalyzeStepSize "AnalyzeStepSize" 386 #endif 387 #define KEY_AnalyzeDeviceFiles "AnalyzeDeviceFiles" 388 #define KEY_AnalyzeMaxDps "AnalyzeMaxDps" 389 #define KEY_AnalyzeRemoteFiles "AnalyzeRemoteFiles" 390 #define KEY_AnalyzeStartOffset "AnalyzeStartOffset" 391 #define KEY_BaseName "BaseName" 392 #define KEY_BaseNameSuffix "BaseNameSuffix" 393 #define KEY_Compress "Compress" 394 #define KEY_DigString "DigString" 395 #define KEY_DigStringNoCase "DigStringNoCase" 396 #define KEY_DigStringNormal "DigStringNormal" 397 #ifdef USE_PCRE 398 #define KEY_DigStringRegExp "DigStringRegExp" 399 #endif 400 #ifdef USE_XMAGIC 401 #define KEY_DigStringXMagic "DigStringXMagic" 402 #endif 403 #define KEY_EnableRecursion "EnableRecursion" 404 #define KEY_Exclude "Exclude" 405 #ifdef USE_PCRE 406 #define KEY_ExcludeFilter "ExcludeFilter" 407 #define KEY_ExcludeFilterMd5 "ExcludeFilterMd5" 408 #define KEY_ExcludeFilterSha1 "ExcludeFilterSha1" 409 #define KEY_ExcludeFilterSha256 "ExcludeFilterSha256" 410 #endif 411 #define KEY_ExcludesMustExist "ExcludesMustExist" 412 #define KEY_FieldMask "FieldMask" 413 #ifdef USE_FILE_HOOKS 414 #define KEY_FileHook "FileHook" 415 #endif 416 #define KEY_FileSizeLimit "FileSizeLimit" 417 #define KEY_GetAndExec "GetAndExec" 418 #define KEY_GetFileName "GetFileName" 419 #define KEY_HashDirectories "HashDirectories" 420 #define KEY_HashSymbolicLinks "HashSymbolicLinks" 421 #define KEY_Import "Import" 422 #define KEY_Include "Include" 423 #ifdef USE_PCRE 424 #define KEY_IncludeFilter "IncludeFilter" 425 #define KEY_IncludeFilterMd5 "IncludeFilterMd5" 426 #define KEY_IncludeFilterSha1 "IncludeFilterSha1" 427 #define KEY_IncludeFilterSha256 "IncludeFilterSha256" 428 #endif 429 #define KEY_IncludesMustExist "IncludesMustExist" 430 #define KEY_LogDigStrings "LogDigStrings" 431 #define KEY_LogDir "LogDir" 432 #define KEY_MagicFile "MagicFile" 433 #define KEY_MapRemoteFiles "MapRemoteFiles" 434 #define KEY_MatchLimit "MatchLimit" 435 #define KEY_NewLine "NewLine" 436 #define KEY_OutDir "OutDir" 437 #define KEY_Priority "Priority" 438 #define KEY_RequirePrivilege "RequirePrivilege" 439 #define KEY_RunType "RunType" 440 #define KEY_StrictControls "StrictControls" 441 #define KEY_URLAuthType "URLAuthType" 442 #define KEY_URLGetRequest "URLGetRequest" 443 #define KEY_URLGetURL "URLGetURL" 444 #define KEY_URLPassword "URLPassword" 445 #define KEY_URLPutSnapshot "URLPutSnapshot" 446 #define KEY_URLPutURL "URLPutURL" 447 #define KEY_URLUnlinkOutput "URLUnlinkOutput" 448 #define KEY_URLUsername "URLUsername" 449 #ifdef USE_SSL 450 #define KEY_SSLBundledCAsFile "SSLBundledCAsFile" 451 #define KEY_SSLExpectedPeerCN "SSLExpectedPeerCN" 452 #define KEY_SSLMaxChainLength "SSLMaxChainLength" 453 #define KEY_SSLPassPhrase "SSLPassPhrase" 454 #define KEY_SSLPrivateKeyFile "SSLPrivateKeyFile" 455 #define KEY_SSLPublicCertFile "SSLPublicCertFile" 456 #define KEY_SSLUseCertificate "SSLUseCertificate" 457 #define KEY_SSLVerifyPeerCert "SSLVerifyPeerCert" 458 #endif 459 460 typedef struct _CONTROLS_FOUND 461 { 462 BOOL bAnalyzeBlockSizeFound; 463 BOOL bAnalyzeByteCountFound; 464 BOOL bAnalyzeCarrySizeFound; 465 #ifdef USE_XMAGIC 466 BOOL bAnalyzeStepSizeFound; 467 #endif 468 BOOL bAnalyzeDeviceFilesFound; 469 BOOL bAnalyzeMaxDpsFound; 470 BOOL bAnalyzeRemoteFilesFound; 471 BOOL bAnalyzeStartOffsetFound; 472 BOOL bBaseNameFound; 473 BOOL bBaseNameSuffixFound; 474 BOOL bCompressFound; 475 BOOL bEnableRecursionFound; 476 BOOL bExcludesMustExistFound; 477 BOOL bFieldMaskFound; 478 BOOL bFileSizeLimitFound; 479 BOOL bGetAndExecFound; 480 BOOL bGetFileNameFound; 481 BOOL bHashDirectoriesFound; 482 BOOL bHashSymbolicLinksFound; 483 BOOL bIncludesMustExistFound; 484 BOOL bLogDigStringsFound; 485 BOOL bLogDirFound; 486 BOOL bMagicFileFound; 487 BOOL bMatchLimitFound; 488 BOOL bNewLineFound; 489 BOOL bOutDirFound; 490 BOOL bPriorityFound; 491 BOOL bRequirePrivilegeFound; 492 BOOL bRunTypeFound; 493 BOOL bURLAuthTypeFound; 494 BOOL bURLGetRequestFound; 495 BOOL bURLGetURLFound; 496 BOOL bURLPasswordFound; 497 BOOL bURLPutSnapshotFound; 498 BOOL bURLPutURLFound; 499 BOOL bURLUnlinkOutputFound; 500 BOOL bURLUsernameFound; 501 #ifdef USE_SSL 502 BOOL bSSLBundledCAsFileFound; 503 BOOL bSSLExpectedPeerCNFound; 504 BOOL bSSLMaxChainLengthFound; 505 BOOL bSSLPassPhraseFound; 506 BOOL bSSLPrivateKeyFileFound; 507 BOOL bSSLPublicCertFileFound; 508 BOOL bSSLUseCertificateFound; 509 BOOL bSSLVerifyPeerCertFound; 510 #endif 511 } CONTROLS_FOUND; 512 513 typedef struct _ANALYSIS_STAGES 514 { 515 #define STAGE_DESCRIPTION_SIZE 64 516 char acDescription[STAGE_DESCRIPTION_SIZE]; 517 int iError; 518 int (*piRoutine)(); 519 } ANALYSIS_STAGES; 520 521 typedef struct _RUNMODE_STAGES 522 { 523 char acDescription[STAGE_DESCRIPTION_SIZE]; 524 int iError; 525 int (*piRoutine)(); 526 } RUNMODE_STAGES; 527 528 typedef struct _FTIMES_PROPERTIES 529 { 530 #define MAX_ANALYSIS_STAGES 32 531 ANALYSIS_STAGES asAnalysisStages[MAX_ANALYSIS_STAGES]; 532 BOOL bAnalyzeBlockSize; 533 BOOL bAnalyzeByteCount; 534 BOOL bAnalyzeCarrySize; 535 #ifdef USE_XMAGIC 536 BOOL bAnalyzeStepSize; 537 #endif 538 BOOL bAnalyzeDeviceFiles; 539 BOOL bAnalyzeRemoteFiles; 540 BOOL bCompress; 541 BOOL bEnableRecursion; 542 BOOL bExcludesMustExist; 543 BOOL bGetAndExec; 544 BOOL bHashDirectories; 545 BOOL bHashSymbolicLinks; 546 BOOL bHaveAttributeFilters; 547 BOOL bIncludesMustExist; 548 BOOL bLogDigStrings; 549 BOOL bRequirePrivilege; 550 BOOL bStrictControls; 551 BOOL bURLPutSnapshot; 552 BOOL bURLUnlinkOutput; 553 char acBaseName[FTIMES_MAX_PATH]; 554 char acBaseNameSuffix[FTIMES_SUFFIX_SIZE]; 555 char acCfgFileName[FTIMES_MAX_PATH]; 556 char acConfigFile[FTIMES_MAX_PATH]; 557 char acDataType[FTIMES_MAX_DATA_TYPE]; 558 char acDateTime[FTIMES_TIME_SIZE]; 559 char acDigRecordPrefix[FTIMES_RECORD_PREFIX_SIZE]; 560 char acGetFileName[FTIMES_MAX_PATH]; 561 char acLogDirName[FTIMES_MAX_PATH]; 562 char acLogFileName[FTIMES_MAX_PATH]; 563 char acMagicFileName[FTIMES_MAX_PATH]; 564 char acMagicHash[FTIMES_MAX_MD5_LENGTH]; 565 char acMapRecordPrefix[FTIMES_RECORD_PREFIX_SIZE]; 566 char acNewLine[NEWLINE_LENGTH]; 567 char acOutDirName[FTIMES_MAX_PATH]; 568 char acOutFileName[FTIMES_MAX_PATH]; 569 char acOutFileHash[FTIMES_MAX_MD5_LENGTH]; 570 char acPid[FTIMES_PID_SIZE]; 571 char acPriority[FTIMES_MAX_PRIORITY_LENGTH]; 572 char acRunDateTime[FTIMES_TIME_SIZE]; 573 #define RUNTYPE_BUFSIZE 16 574 char acRunType[RUNTYPE_BUFSIZE]; 575 char acStartDate[FTIMES_TIME_SIZE]; 576 char acStartTime[FTIMES_TIME_SIZE]; 577 char acStartZone[FTIMES_ZONE_SIZE]; 578 char acTempDirectory[FTIMES_MAX_PATH]; 579 #define GET_REQUEST_BUFSIZE 16 580 char acURLGetRequest[GET_REQUEST_BUFSIZE]; 581 char acURLPassword[FTIMES_MAX_PASSWORD_LENGTH]; 582 char acURLUsername[FTIMES_MAX_USERNAME_LENGTH]; 583 char *pcNonce; 584 char *pcProgram; 585 char *pcRunModeArgument; 586 char **ppcMapList; 587 CONTROLS_FOUND sFound; 588 double dStartTime; 589 FILE *pFileLog; 590 FILE *pFileOut; 591 FILE_LIST *psExcludeList; 592 FILE_LIST *psIncludeList; 593 #ifdef USE_PCRE 594 FILTER_LIST *psExcludeFilterList; 595 FILTER_LIST *psIncludeFilterList; 596 FILTER_LIST *psExcludeFilterMd5List; 597 FILTER_LIST *psIncludeFilterMd5List; 598 FILTER_LIST *psExcludeFilterSha1List; 599 FILTER_LIST *psIncludeFilterSha1List; 600 FILTER_LIST *psExcludeFilterSha256List; 601 FILTER_LIST *psIncludeFilterSha256List; 602 #endif 603 #ifdef USE_FILE_HOOKS 604 HOOK_LIST *psFileHookList; 605 #endif 606 #define MAX_RUNMODE_STAGES 32 607 RUNMODE_STAGES sRunModeStages[MAX_RUNMODE_STAGES]; 608 HTTP_URL *psGetURL; 609 HTTP_URL *psPutURL; 610 int iAnalyzeBlockSize; 611 int iAnalyzeCarrySize; 612 int iAnalyzeMaxDps; 613 #ifdef USE_XMAGIC 614 int iAnalyzeStepSize; 615 #endif 616 int iImportRecursionLevel; 617 int iLastAnalysisStage; 618 int iLastRunModeStage; 619 int iLogLevel; 620 int iMatchLimit; 621 int iMemoryMapEnable; 622 int iPriority; 623 int iRunMode; 624 int iNextRunMode; 625 int iTestLevel; 626 int iTestRunMode; 627 int iURLAuthType; 628 int (*piDevelopDigOutput)(); 629 int (*piDevelopMapOutput)(); 630 int (*piRunModeFinalStage)(); 631 APP_UI64 ui64AnalyzeByteCount; 632 APP_UI64 ui64AnalyzeStartOffset; 633 MASK_USS_MASK *psFieldMask; 634 SNAPSHOT_CONTEXT *psSnapshotContext; 635 SNAPSHOT_CONTEXT *psBaselineContext; 636 #ifdef USE_SSL 637 SSL_PROPERTIES *psSslProperties; 638 #endif 639 MD5_CONTEXT sOutFileHashContext; 640 time_t tStartTime; 641 struct timeval tvJobEpoch; 642 struct timeval tvSRGEpoch; 643 unsigned long ulFileSizeLimit; 644 #ifdef USE_XMAGIC 645 XMAGIC *psXMagic; 646 #endif 647 OPTIONS_CONTEXT *psOptionsContext; 648 #ifdef USE_EMBEDDED_PERL 649 PerlInterpreter *psMyPerl; 650 #endif 651 #ifdef USE_EMBEDDED_PYTHON 652 PyObject *psPyGlobals; 653 PyObject *psPythonMain; 654 #endif 655 } FTIMES_PROPERTIES; 656 657 /*- 658 *********************************************************************** 659 * 660 * Function Prototypes (analyze.c) 661 * 662 *********************************************************************** 663 */ 664 int AnalyzeDoDig(unsigned char *pucBuffer, int iBufferLength, int iBlockTag, int iBufferOverhead, FTIMES_FILE_DATA *psFTFileData, char *pcError); 665 int AnalyzeDoMd5Digest(unsigned char *pucBuffer, int iBufferLength, int iBlockTag, int iBufferOverhead, FTIMES_FILE_DATA *psFTFileData, char *pcError); 666 int AnalyzeDoSha1Digest(unsigned char *pucBuffer, int iBufferLength, int iBlockTag, int iBufferOverhead, FTIMES_FILE_DATA *psFTFileData, char *pcError); 667 int AnalyzeDoSha256Digest(unsigned char *pucBuffer, int iBufferLength, int iBlockTag, int iBufferOverhead, FTIMES_FILE_DATA *psFTFileData, char *pcError); 668 int AnalyzeDoXMagic(unsigned char *pucBuffer, int iBufferLength, int iBlockTag, int iBufferOverhead, FTIMES_FILE_DATA *psFTFileData, char *pcError); 669 void AnalyzeEnableDigEngine(FTIMES_PROPERTIES *psProperties); 670 void AnalyzeEnableDigestEngine(FTIMES_PROPERTIES *psProperties); 671 int AnalyzeEnableXMagicEngine(FTIMES_PROPERTIES *psProperties, char *pcError); 672 int AnalyzeFile(FTIMES_PROPERTIES *psProperties, FTIMES_FILE_DATA *psFTFileData, char *pcError); 673 double AnalyzeGetAnalysisTime(void); 674 int AnalyzeGetBlockSize(void); 675 APP_UI64 AnalyzeGetByteCount(void); 676 int AnalyzeGetCarrySize(void); 677 double AnalyzeGetDps(void); 678 unsigned char *AnalyzeGetDigSaveBuffer(int iCarrySize, char *pcError); 679 APP_UI32 AnalyzeGetFileCount(void); 680 APP_UI64 AnalyzeGetStartOffset(void); 681 #ifdef USE_XMAGIC 682 int AnalyzeGetStepSize(void); 683 #endif 684 unsigned char *AnalyzeGetWorkBuffer(int iBlockSize, char *pcError); 685 void *AnalyzeMapMemory(int iMemoryMapSize); 686 void AnalyzeSetBlockSize(int iBlockSize); 687 void AnalyzeSetCarrySize(int iCarrySize); 688 #ifdef USE_XMAGIC 689 void AnalyzeSetStepSize(int iStepSize); 690 #endif 691 void AnalyzeThrottleDps(APP_UI64 ui64Bytes, int iMaxDps); 692 void AnalyzeUnmapMemory(void *pvMemoryMap, int iMemoryMapSize); 693 694 /*- 695 *********************************************************************** 696 * 697 * Function Prototypes (compare.c) 698 * 699 *********************************************************************** 700 */ 701 int CompareDecodeLine(char *pcLine, SNAPSHOT_CONTEXT *psBaseline, char **ppcDecodeFields, char *pcError); 702 int CompareLoadBaselineData(SNAPSHOT_CONTEXT *psBaseline, char *pcError); 703 int CompareEnumerateChanges(SNAPSHOT_CONTEXT *psBaseline, SNAPSHOT_CONTEXT *psSnapshot, char *pcError); 704 705 /*- 706 *********************************************************************** 707 * 708 * Function Prototypes (develop.c) 709 * 710 *********************************************************************** 711 */ 712 int DevelopHaveNothingOutput(FTIMES_PROPERTIES *psProperties, char *pcOutData, int *iWriteCount, FTIMES_FILE_DATA *psFTFileData, char *pcError); 713 int DevelopNoOutput(FTIMES_PROPERTIES *psProperties, char *pcOutData, int *iWriteCount, FTIMES_FILE_DATA *psFTFileData, char *pcError); 714 int DevelopNormalOutput(FTIMES_PROPERTIES *psProperties, char *pcOutData, int *iWriteCount, FTIMES_FILE_DATA *psFTFileData, char *pcError); 715 int DevelopCompressedOutput(FTIMES_PROPERTIES *psProperties, char *pcOutData, int *iWriteCount, FTIMES_FILE_DATA *psFTFileData, char *pcError); 716 int DevelopCompressHex(char *pcData, unsigned long ulHex, unsigned long ulOldHex); 717 int DevelopCountHexDigits(unsigned long ulHex); 718 719 /*- 720 *********************************************************************** 721 * 722 * Function Prototypes (ftimes.c) 723 * 724 *********************************************************************** 725 */ 726 int main(int iArgumentCount, char *ppcArgumentVector[]); 727 int FTimesBootstrap(char *pcError); 728 int FTimesProcessArguments(FTIMES_PROPERTIES *psProperties, int iArgumentCount, char *ppcArgumentVector[], char *pcError); 729 int FTimesFinalize(FTIMES_PROPERTIES *psProperties, char *pcError); 730 int FTimesStagesLoop(FTIMES_PROPERTIES *psProperties, char *pcError); 731 int FTimesFinalStage(FTIMES_PROPERTIES *psProperties, char *pcError); 732 void FTimesDisplayStatistics(FTIMES_PROPERTIES *psProperties); 733 int FTimesOptionHandler(OPTIONS_TABLE *psOption, char *pcValue, FTIMES_PROPERTIES *psProperties, char *pcError); 734 735 void FTimesUsage(void); 736 void FTimesVersion(void); 737 void FTimesSetPropertiesReference(FTIMES_PROPERTIES *psProperties); 738 long FTimesGetEpoch(struct timeval *tvEpoch); 739 FTIMES_PROPERTIES *FTimesGetPropertiesReference(void); 740 FTIMES_PROPERTIES *FTimesNewProperties(char *pcError); 741 void FTimesEraseFiles(FTIMES_PROPERTIES *psProperties, char *pcError); 742 #ifdef USE_SSL 743 int SSLCheckDependencies(SSL_PROPERTIES *psProperties, char *pcError); 744 #endif 745 void FTimesFreeProperties(FTIMES_PROPERTIES *psProperties); 746 char *FTimesGetEnvValue(char *pcName); 747 char *MakeNonce(char *pcError); 748 int SeedRandom(unsigned long ulTime1, unsigned long ulTime2, char *pcError); 749 750 /*- 751 *********************************************************************** 752 * 753 * Function Prototypes (xxxmode.c) 754 * 755 *********************************************************************** 756 */ 757 int CmpModeInitialize(FTIMES_PROPERTIES *psProperties, char *pcError); 758 int DecoderInitialize(FTIMES_PROPERTIES *psProperties, char *pcError); 759 int DigModeInitialize(FTIMES_PROPERTIES *psProperties, char *pcError); 760 int GetModeInitialize(FTIMES_PROPERTIES *psProperties, char *pcError); 761 int MadModeInitialize(FTIMES_PROPERTIES *psProperties, char *pcError); 762 int MapModeInitialize(FTIMES_PROPERTIES *psProperties, char *pcError); 763 764 int CmpModeCheckDependencies(FTIMES_PROPERTIES *psProperties, char *pcError); 765 int DecoderCheckDependencies(FTIMES_PROPERTIES *psProperties, char *pcError); 766 int DigModeCheckDependencies(FTIMES_PROPERTIES *psProperties, char *pcError); 767 int GetModeCheckDependencies(FTIMES_PROPERTIES *psProperties, char *pcError); 768 int MadModeCheckDependencies(FTIMES_PROPERTIES *psProperties, char *pcError); 769 int MapModeCheckDependencies(FTIMES_PROPERTIES *psProperties, char *pcError); 770 771 int CmpModeFinalize(FTIMES_PROPERTIES *psProperties, char *pcError); 772 int DecoderFinalize(FTIMES_PROPERTIES *psProperties, char *pcError); 773 int DigModeFinalize(FTIMES_PROPERTIES *psProperties, char *pcError); 774 int GetModeFinalize(FTIMES_PROPERTIES *psProperties, char *pcError); 775 int MadModeFinalize(FTIMES_PROPERTIES *psProperties, char *pcError); 776 int MapModeFinalize(FTIMES_PROPERTIES *psProperties, char *pcError); 777 778 int CmpModeWorkHorse(FTIMES_PROPERTIES *psProperties, char *pcError); 779 int DecoderWorkHorse(FTIMES_PROPERTIES *psProperties, char *pcError); 780 int DigModeWorkHorse(FTIMES_PROPERTIES *psProperties, char *pcError); 781 int GetModeWorkHorse(FTIMES_PROPERTIES *psProperties, char *pcError); 782 int MadModeWorkHorse(FTIMES_PROPERTIES *psProperties, char *pcError); 783 int MapModeWorkHorse(FTIMES_PROPERTIES *psProperties, char *pcError); 784 785 int CmpModeFinishUp(FTIMES_PROPERTIES *psProperties, char *pcError); 786 int DecoderFinishUp(FTIMES_PROPERTIES *psProperties, char *pcError); 787 int DigModeFinishUp(FTIMES_PROPERTIES *psProperties, char *pcError); 788 int GetModeFinishUp(FTIMES_PROPERTIES *psProperties, char *pcError); 789 int MadModeFinishUp(FTIMES_PROPERTIES *psProperties, char *pcError); 790 int MapModeFinishUp(FTIMES_PROPERTIES *psProperties, char *pcError); 791 792 int CmpModeFinalStage(FTIMES_PROPERTIES *psProperties, char *pcError); 793 int DecoderFinalStage(FTIMES_PROPERTIES *psProperties, char *pcError); 794 int DigModeFinalStage(FTIMES_PROPERTIES *psProperties, char *pcError); 795 int GetModeFinalStage(FTIMES_PROPERTIES *psProperties, char *pcError); 796 int MadModeFinalStage(FTIMES_PROPERTIES *psProperties, char *pcError); 797 int MapModeFinalStage(FTIMES_PROPERTIES *psProperties, char *pcError); 798 799 /*- 800 *********************************************************************** 801 * 802 * Function Prototypes (dig.c) 803 * 804 *********************************************************************** 805 */ 806 int DigDevelopOutput(FTIMES_PROPERTIES *psProperties, DIG_SEARCH_DATA *psSearchData, char *pcError); 807 void DigSetPropertiesReference(FTIMES_PROPERTIES *psProperties); 808 int DigWriteHeader(FTIMES_PROPERTIES *psProperties, char *pcError); 809 810 /*- 811 *********************************************************************** 812 * 813 * Function Prototypes (hook.c) 814 * 815 *********************************************************************** 816 */ 817 #ifdef USE_FILE_HOOKS 818 HOOK_LIST *HookMatchHook(HOOK_LIST *psHookList, FTIMES_FILE_DATA *psFTFileData); 819 #endif 820 821 /*- 822 *********************************************************************** 823 * 824 * Function Prototypes (map.c) 825 * 826 *********************************************************************** 827 */ 828 #ifdef USE_EMBEDDED_PYTHON 829 void MapFreePythonArguments(size_t szArgumentCount, wchar_t **ppwcArgumentVector); 830 wchar_t **MapConvertPythonArguments(size_t tArgumentCount, char **ppcArgumentVector); 831 #endif 832 void MapDirHashAlpha(FTIMES_PROPERTIES *psProperties, FTIMES_HASH_DATA *psFTHashData); 833 void MapDirHashCycle(FTIMES_PROPERTIES *psProperties, FTIMES_HASH_DATA *psFTHashData, FTIMES_FILE_DATA *psFTFileData); 834 void MapDirHashOmega(FTIMES_PROPERTIES *psProperties, FTIMES_HASH_DATA *psFTHashData, FTIMES_FILE_DATA *psFTFileData); 835 char *MapDirname(char *pcPath); 836 #ifdef USE_FILE_HOOKS 837 int MapExecuteHook(FTIMES_PROPERTIES *psProperties, FTIMES_FILE_DATA *psFTFileData, char *pcError); 838 #endif 839 #ifdef USE_EMBEDDED_PYTHON 840 int MapExecutePythonScript(FTIMES_PROPERTIES *psProperties, HOOK_LIST *psHook, KLEL_COMMAND *psCommand, FTIMES_FILE_DATA *psFTFileData, char *pcMessage); 841 #endif 842 int MapFile(FTIMES_PROPERTIES *psProperties, char *pcPath, char *pcError); 843 void MapFreeFTFileData(FTIMES_FILE_DATA *psFTFileData); 844 unsigned long MapGetAttributes(FTIMES_FILE_DATA *psFTFileData); 845 int MapGetDirectoryCount(); 846 int MapGetFileCount(); 847 int MapGetIncompleteRecordCount(); 848 int MapGetRecordCount(); 849 int MapGetSpecialCount(); 850 #ifndef WINNT 851 FTIMES_FILE_DATA *MapNewFTFileData(FTIMES_FILE_DATA *psParentFTFileData, char *pcName, char *pcError); 852 #endif 853 int MapTree(FTIMES_PROPERTIES *psProperties, FTIMES_FILE_DATA *psParentFTData, char *pcError); 854 int MapWriteHeader(FTIMES_PROPERTIES *psProperties, char *pcError); 855 int MapWriteRecord(FTIMES_PROPERTIES *psProperties, FTIMES_FILE_DATA *psFTFileData, char *pcError); 856 #ifdef WINNT 857 int MapCountNamedStreams(HANDLE hFile, int *piStreamCount, unsigned char **ppucStreamInfo, char *pcError); 858 HANDLE MapGetFileHandleW(wchar_t *pwcPath); 859 int MapGetStreamCount(); 860 FTIMES_FILE_DATA *MapNewFTFileDataW(FTIMES_FILE_DATA *psParentFTFileData, wchar_t *pwcName, char *pcError); 861 void MapStream(FTIMES_PROPERTIES *psProperties, FTIMES_FILE_DATA *psFTFileData, FTIMES_HASH_DATA *psDirFTHashData, char *pcError); 862 wchar_t *MapUtf8ToWide(char *pcString, int iUtf8Size, char *pcError); 863 char *MapWideToUtf8(wchar_t *pwcString, int iWideSize, char *pcError); 864 #endif 865 866 /*- 867 *********************************************************************** 868 * 869 * Function Prototypes (properties.c) 870 * 871 *********************************************************************** 872 */ 873 void PropertiesDisplaySettings(FTIMES_PROPERTIES *psProperties); 874 int PropertiesReadFile(char *pcFilename, FTIMES_PROPERTIES *psProperties, char *pcError); 875 int PropertiesReadLine(char *pcLine, FTIMES_PROPERTIES *psProperties, char *pcError); 876 int PropertiesTestFile(FTIMES_PROPERTIES *psProperties, char *pcError); 877 878 /*- 879 *********************************************************************** 880 * 881 * Function Prototypes (support.c) 882 * 883 *********************************************************************** 884 */ 885 FILE_LIST *SupportAddListItem(FILE_LIST *psItem, FILE_LIST *psHead, char *pcError); 886 int SupportAddToList(char *pcPath, FILE_LIST **ppList, char *pcListName, char *pcError); 887 #ifdef WIN32 888 BOOL SupportAdjustPrivileges(LPCTSTR lpcPrivilege); 889 #endif 890 int SupportCheckList(FILE_LIST *psHead, char *pcListName, char *pcError); 891 int SupportChopEOLs(char *pcLine, int iStrict, char *pcError); 892 void SupportDisplayRunStatistics(FTIMES_PROPERTIES *psProperties); 893 FILE_LIST *SupportDropListItem(FILE_LIST *psHead, FILE_LIST *psDrop); 894 int SupportEraseFile(char *pcName, char *pcError); 895 int SupportExpandDirectoryPath(char *pcPath, char *pcFullPath, int iFullPathSize, char *pcError); 896 int SupportExpandPath(char *pcPath, char *pcFullPath, int iFullPathSize, int iForceExpansion, char *pcError); 897 void SupportFreeData(void *pcData); 898 void SupportFreeListItem(FILE_LIST *psItem); 899 FILE *SupportGetFileHandle(char *pcFile, char *pcError); 900 int SupportGetFileType(char *pcPath, char *pcError); 901 char *SupportGetHostname(void); 902 char *SupportGetSystemOS(void); 903 FILE_LIST *SupportIncludeEverything(char *pcError); 904 int SupportMakeName(char *pcPath, char *pcBaseName, char *pcBaseNameSuffix, char *pcExtension, char *pcFilename, char *pcError); 905 FILE_LIST *SupportMatchExclude(FILE_LIST *psHead, char *pcPath); 906 FILE_LIST *SupportMatchSubTree(FILE_LIST *psHead, FILE_LIST *psTarget); 907 char *SupportNeuterString(char *pcData, int iLength, char *pcError); 908 FILE_LIST *SupportNewListItem(char *pcPath, int iType, char *pcError); 909 FILE_LIST *SupportPruneList(FILE_LIST *psList, char *pcListName); 910 int SupportRequirePrivilege(char *pcError); 911 int SupportSetLogLevel(char *pcLevel, int *piLevel, char *pcError); 912 int SupportSetPriority(FTIMES_PROPERTIES *psProperties, char *pcError); 913 #ifdef WIN32 914 int SupportSetPrivileges(char *pcError); 915 #endif 916 int SupportStringToUInt64(char *pcData, APP_UI64 *pui64Value, char *pcError); 917 int SupportWriteData(FILE *pFile, char *pcData, int iLength, char *pcError); 918 919 #ifdef USE_PCRE 920 int SupportAddFilter(char *pcFilter, FILTER_LIST **psHead, char *pcError); 921 void SupportFreeFilter(FILTER_LIST *psFilter); 922 FILTER_LIST *SupportMatchFilter(FILTER_LIST *psFilterList, char *acPath); 923 FILTER_LIST *SupportNewFilter(char *pcFilter, char *pcError); 924 #endif 925 926 /*- 927 *********************************************************************** 928 * 929 * Function Prototypes (time.c) 930 * 931 *********************************************************************** 932 */ 933 int TimeGetTimeValue(struct timeval *psTimeValue); 934 double TimeGetTimeValueAsDouble(void); 935 time_t TimeGetTime(char *pcDate, char *pcTime, char *pcZone, char *pcDateTime); 936 #ifdef WIN32 937 int TimeFormatTime(FILETIME *psFileTime, char *pcTime); 938 int TimeFormatOutOfBandTime(FILETIME *psFileTime, char *pcTime); 939 #endif 940 #ifdef UNIX 941 int TimeFormatTime(time_t *pTimeValue, char *pcTime); 942 #endif 943 944 /*- 945 *********************************************************************** 946 * 947 * Function Prototypes (url.c) 948 * 949 *********************************************************************** 950 */ 951 int URLGetRequest(FTIMES_PROPERTIES *psProperties, char *pcError); 952 int URLPingRequest(FTIMES_PROPERTIES *psProperties, char *pcError); 953 int URLPutRequest(FTIMES_PROPERTIES *psProperties, char *pcError); 954 955 /*- 956 *********************************************************************** 957 * 958 * Macros 959 * 960 *********************************************************************** 961 */ 962 #ifndef MIN 963 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) 964 #endif 965 #ifndef MAX 966 #define MAX(a, b) (((a) > (b)) ? (a) : (b)) 967 #endif 968 969 #define PUTBIT(x, v, p) (x) = ((x) & ~(1 << (p))) | (((v) & 1)<< (p)) 970 #define GETBIT(x, p) ((x) & (1 << (p))) >> (p) 971 #define MEMORY_FREE(pv) if (pv) { free(pv); } 972 #define RUN_MODE_IS_SET(mask, mode) (((mask) & (mode)) == (mode)) 973 974 /*- 975 *********************************************************************** 976 * 977 * External Variables 978 * 979 *********************************************************************** 980 */ 981 #ifdef WINNT 982 extern NQIF NtdllNQIF; 983 #endif 984 985 #endif /* !_FTIMES_H_INCLUDED */ 986