Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.7.3/src/OVAL/probes/oval_fts.h
00001 /*
00002  * Copyright 2010 Red Hat Inc., Durham, North Carolina.
00003  * All Rights Reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  * Authors:
00020  *      "Daniel Kopecek" <dkopecek@redhat.com>
00021  */
00022 #ifndef OVAL_FTS_H
00023 #define OVAL_FTS_H
00024 
00025 #include <sexp.h>
00026 #include <fts.h>
00027 #include <pcre.h>
00028 #include "fsdev.h"
00029 
00030 typedef struct {
00031         FTS    *ofts_fts;
00032 
00033         char   **ofts_st_path;       
00034         uint16_t ofts_st_path_count; 
00035         uint16_t ofts_st_path_index; 
00037         pcre       *ofts_path_regex;
00038         pcre_extra *ofts_path_regex_extra;
00039         uint32_t ofts_path_op;
00040 
00041         SEXP_t *ofts_spath;
00042         SEXP_t *ofts_sfilename;
00043         SEXP_t *ofts_sfilepath;
00044 
00045         int max_depth;
00046         int direction;
00047         int recurse;
00048         int filesystem;
00049 
00050         fsdev_t *localdevs;
00051 } OVAL_FTS;
00052 
00053 #define OVAL_RECURSE_DIRECTION_NONE 0 /* default */
00054 #define OVAL_RECURSE_DIRECTION_DOWN 1
00055 #define OVAL_RECURSE_DIRECTION_UP   2
00056 
00057 #define OVAL_RECURSE_FILES    0x01
00058 #define OVAL_RECURSE_DIRS     0x02
00059 #define OVAL_RECURSE_SYMLINKS 0x04
00060 
00061 #define OVAL_RECURSE_SYMLINKS_AND_DIRS (OVAL_RECURSE_SYMLINKS|OVAL_RECURSE_DIRS) /* default */
00062 #define OVAL_RECURSE_FILES_AND_DIRS    (OVAL_RECURSE_FILES|OVAL_RECURSE_SYMLINKS)
00063 
00064 #define OVAL_RECURSE_FS_LOCAL   0
00065 #define OVAL_RECURSE_FS_DEFINED 1
00066 #define OVAL_RECURSE_FS_ALL     2 /* default */
00067 
00068 typedef struct {
00069         char *file;
00070         size_t file_len;
00071         char *path;
00072         size_t path_len;
00073 } OVAL_FTSENT;
00074 
00075 /*
00076  * OVAL FTS public API
00077  */
00078 OVAL_FTS    *oval_fts_open(SEXP_t *path, SEXP_t *filename, SEXP_t *filepath, SEXP_t *behaviors);
00079 OVAL_FTSENT *oval_fts_read(OVAL_FTS *ofts);
00080 int          oval_fts_close(OVAL_FTS *ofts);
00081 
00082 void oval_ftsent_free(OVAL_FTSENT *ofts_ent);
00083 
00084 #endif /* OVAL_FTS_H */