1243730Srwatson/*- 2243730Srwatson * Copyright (c) 2012 The FreeBSD Foundation 3243730Srwatson * All rights reserved. 4243730Srwatson * 5243730Srwatson * This software was developed by Pawel Jakub Dawidek under sponsorship from 6243730Srwatson * the FreeBSD Foundation. 7243730Srwatson * 8243730Srwatson * Redistribution and use in source and binary forms, with or without 9243730Srwatson * modification, are permitted provided that the following conditions 10243730Srwatson * are met: 11243730Srwatson * 1. Redistributions of source code must retain the above copyright 12243730Srwatson * notice, this list of conditions and the following disclaimer. 13243730Srwatson * 2. Redistributions in binary form must reproduce the above copyright 14243730Srwatson * notice, this list of conditions and the following disclaimer in the 15243730Srwatson * documentation and/or other materials provided with the distribution. 16243730Srwatson * 17243730Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 18243730Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19243730Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20243730Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 21243730Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22243730Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23243730Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24243730Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25243730Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26243730Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27243730Srwatson * SUCH DAMAGE. 28243730Srwatson * 29243730Srwatson * $P4: //depot/projects/trustedbsd/openbsm/bin/auditdistd/trail.h#1 $ 30243730Srwatson */ 31243730Srwatson 32243730Srwatson#ifndef _AUDITDISTD_TRAIL_H_ 33243730Srwatson#define _AUDITDISTD_TRAIL_H_ 34243730Srwatson 35243730Srwatson#include <stdbool.h> 36243730Srwatson#include <unistd.h> /* off_t */ 37243730Srwatson 38243730Srwatson#define TRAIL_IDENTICAL 0 39243730Srwatson#define TRAIL_RENAMED 1 40243730Srwatson#define TRAIL_OLDER 2 41243730Srwatson#define TRAIL_NEWER 3 42243730Srwatson 43243730Srwatsonstruct trail; 44243730Srwatson 45243730Srwatsonstruct trail *trail_new(const char *dirname, bool create); 46243730Srwatsonvoid trail_free(struct trail *trail); 47243730Srwatsonbool trail_is_not_terminated(const char *filename); 48243730Srwatsonbool trail_is_crash_recovery(const char *filename); 49243730Srwatsonvoid trail_start(struct trail *trail, const char *filename, off_t offset); 50243730Srwatsonvoid trail_next(struct trail *trail); 51243730Srwatsonvoid trail_close(struct trail *trail); 52243730Srwatsonvoid trail_reset(struct trail *trail); 53243730Srwatsonvoid trail_unlink(struct trail *trail, const char *filename); 54243730Srwatsonbool trail_switch(struct trail *trail); 55243730Srwatsonconst char *trail_filename(const struct trail *trail); 56243730Srwatsonint trail_filefd(const struct trail *trail); 57243730Srwatsonint trail_dirfd(const struct trail *trail); 58243730Srwatsonvoid trail_last(DIR *dirfp, char *filename, size_t filenamesize); 59243730Srwatsonbool trail_validate_name(const char *srcname, const char *dstname); 60243730Srwatsonint trail_name_compare(const char *name0, const char *name1); 61243730Srwatson 62243730Srwatson#endif /* !_AUDITDISTD_TRAIL_H_ */ 63