1 /* Copyright (C) 2005 Red Hat, Inc. */ 2 3 #ifndef _SEMANAGE_DATABASE_FILE_INTERNAL_H_ 4 #define _SEMANAGE_DATABASE_FILE_INTERNAL_H_ 5 6 #include <stdio.h> 7 #include "database.h" 8 #include "parse_utils.h" 9 #include "handle.h" 10 11 struct dbase_file; 12 typedef struct dbase_file dbase_file_t; 13 14 /* FILE extension to RECORD interface - method table */ 15 typedef struct record_file_table { 16 17 /* Fill record structuure based on supplied parse info. 18 * Parser must return STATUS_NODATA when EOF is encountered. 19 * Parser must handle NULL file stream correctly */ 20 int (*parse) (semanage_handle_t * handle, 21 parse_info_t * info, record_t * record); 22 23 /* Print record to stream */ 24 int (*print) (semanage_handle_t * handle, 25 record_t * record, FILE * str); 26 27 } record_file_table_t; 28 29 /* FILE - initialization */ 30 extern int dbase_file_init(semanage_handle_t * handle, 31 const char *path_ro, 32 const char *path_rw, 33 record_table_t * rtable, 34 record_file_table_t * rftable, 35 dbase_file_t ** dbase); 36 37 /* FILE - release */ 38 extern void dbase_file_release(dbase_file_t * dbase); 39 40 /* FILE - method table implementation */ 41 extern dbase_table_t SEMANAGE_FILE_DTABLE; 42 43 #endif 44