| 1 | /* SAMHAIN file system integrity testing                                   */ | 
|---|
| 2 | /* Copyright (C) 2015 Rainer Wichmann                                      */ | 
|---|
| 3 | /*                                                                         */ | 
|---|
| 4 | /*  This program is free software; you can redistribute it                 */ | 
|---|
| 5 | /*  and/or modify                                                          */ | 
|---|
| 6 | /*  it under the terms of the GNU General Public License as                */ | 
|---|
| 7 | /*  published by                                                           */ | 
|---|
| 8 | /*  the Free Software Foundation; either version 2 of the License, or      */ | 
|---|
| 9 | /*  (at your option) any later version.                                    */ | 
|---|
| 10 | /*                                                                         */ | 
|---|
| 11 | /*  This program is distributed in the hope that it will be useful,        */ | 
|---|
| 12 | /*  but WITHOUT ANY WARRANTY; without even the implied warranty of         */ | 
|---|
| 13 | /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */ | 
|---|
| 14 | /*  GNU General Public License for more details.                           */ | 
|---|
| 15 | /*                                                                         */ | 
|---|
| 16 | /*  You should have received a copy of the GNU General Public License      */ | 
|---|
| 17 | /*  along with this program; if not, write to the Free Software            */ | 
|---|
| 18 | /*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              */ | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | #ifndef SH_DBIO_H | 
|---|
| 22 | #define SH_DBIO_H | 
|---|
| 23 |  | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | /* Read one line, trim newline. Return char count, or -1 on error or eof. | 
|---|
| 27 | */ | 
|---|
| 28 | int sh_dbIO_getline (FILE * fd, char * line, const size_t sizeofline); | 
|---|
| 29 |  | 
|---|
| 30 | /* Read given database file for listing | 
|---|
| 31 | */ | 
|---|
| 32 | int sh_dbIO_list_db (const char * db_file); | 
|---|
| 33 |  | 
|---|
| 34 | /* Write single record to database | 
|---|
| 35 | */ | 
|---|
| 36 | void sh_dbIO_data_write (file_type * buf, char * fileHash); | 
|---|
| 37 |  | 
|---|
| 38 | /* Write whole default database | 
|---|
| 39 | */ | 
|---|
| 40 | int sh_dbIO_writeout_update (); | 
|---|
| 41 |  | 
|---|
| 42 | /* write database to given path | 
|---|
| 43 | */ | 
|---|
| 44 | int sh_dbIO_writeout_to_path(const char * path); | 
|---|
| 45 |  | 
|---|
| 46 | /* write database to stdout | 
|---|
| 47 | */ | 
|---|
| 48 | int sh_dbIO_writeout_stdout (const char * str); | 
|---|
| 49 |  | 
|---|
| 50 | /* version string for database | 
|---|
| 51 | */ | 
|---|
| 52 | int sh_dbIO_version_string(const char * str); | 
|---|
| 53 |  | 
|---|
| 54 | /* Load a delta database | 
|---|
| 55 | */ | 
|---|
| 56 | int sh_dbIO_load_delta(); | 
|---|
| 57 |  | 
|---|
| 58 | int sh_dbIO_list_binary (const char * c); | 
|---|
| 59 | int sh_dbIO_list_filter (const char * c); | 
|---|
| 60 |  | 
|---|
| 61 | /* alternative rootfs */ | 
|---|
| 62 |  | 
|---|
| 63 | int sh_dbIO_init_rootfs (const char * rootfs); | 
|---|
| 64 | size_t sh_dbIO_get_rootfs_len(); | 
|---|
| 65 | char * sh_dbIO_rootfs_prepend(char * path); | 
|---|
| 66 | char * sh_dbIO_rootfs_strip(char * path); | 
|---|
| 67 | char * sh_dbIO_rootfs_strip_link(char * path); | 
|---|
| 68 |  | 
|---|
| 69 | #endif | 
|---|