database_file.h revision 13cd4c8960688af11ad23b4c946149015c80d549
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
11struct dbase_file;
12typedef struct dbase_file dbase_file_t;
13
14/* FILE extension to RECORD interface - method table */
15typedef 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 */
30extern int dbase_file_init(semanage_handle_t * handle,
31			   const char *suffix,
32			   record_table_t * rtable,
33			   record_file_table_t * rftable,
34			   dbase_file_t ** dbase);
35
36/* FILE - release */
37extern void dbase_file_release(dbase_file_t * dbase);
38
39/* FILE - method table implementation */
40extern dbase_table_t SEMANAGE_FILE_DTABLE;
41
42#endif
43