summaryrefslogtreecommitdiffstats
path: root/libseaudit/include/seaudit/parse.h
blob: 385f85576d8f07ffec4503d01df38e18111d64f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
 *  @file
 *  Public interface for parsing an audit log.
 *
 *  @author Meggan Whalen mwhalen@tresys.com
 *  @author Jeremy A. Mowery jmowery@tresys.com
 *  @author Jason Tang jtang@tresys.com
 *
 *  Copyright (C) 2003-2007 Tresys Technology, LLC
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef SEAUDIT_PARSE_H
#define SEAUDIT_PARSE_H

#ifdef  __cplusplus
extern "C"
{
#endif

#include "log.h"
#include <stdio.h>

/**
 * Parse the file specified by syslog and put all selinux audit
 * messages into the log.  It is assumed that log will be created
 * before this function.  If the log already has messages, new
 * messages will be appended to it.  Afterwards all models watching
 * this log will be notified of the changes.
 *
 * @param log Audit log to which append messages.
 * @param syslog Handler to an opened file containing audit messages.
 *
 * @return 0 on success, > 0 on warnings, < 0 on error and errno will
 * be set.
 */
	extern int seaudit_log_parse(seaudit_log_t * log, FILE * syslog);

/**
 * Parse a string buffer representing a syslog (or just lines from it)
 * and put all selinux audit messages into the log.  It is assumed
 * that log will be created before this function.  If the log already
 * has messages, new messages will be appended to it.  Afterwards all
 * models watching this log will be notified of the changes.
 *
 * @param log Audit log to which append messages.
 * @param buffer Buffer containing SELinux audit messages.
 * @param bufsize Number of bytes in the buffer.
 *
 * @return 0 on success, > 0 on warnings, < 0 on error and errno will
 * be set.
 */
	extern int seaudit_log_parse_buffer(seaudit_log_t * log, const char *buffer, const size_t bufsize);

#ifdef  __cplusplus
}
#endif

#endif