<commit_before>/* Copyright (C) 2003 Tresys Technology, LLC
 * see file 'COPYING' for use and warranty information */

/*
 * Author: <EMAIL>
 * Date: October 3, 2003
 *
 * This file contains the parsing definitions
 *
 * parse.h
 */

#ifndef LIBAUDIT_PARSE_H
#define LIBAUDIT_PARSE_H


#include "auditlog.h"
#define PARSE_MEMORY_ERROR       -2
#define PARSE_NO_SELINUX_ERROR   -4
#define PARSE_SUCCESS             0
#define PARSE_INVALID_MSG_WARN    2 /* message NOT added to audit log */
#define PARSE_MALFORMED_MSG_WARN  3 /* message added to audit log anyway */
#define PARSE_BOTH_MSG_WARN       4 /* invalid and malformed messages found in log */
#define PARSE_NO_PARSE            5 /* file was eof */


#define PARSE_MEMORY_ERROR_MSG "Memory error while parsing the log!"
#define PARSE_NO_SELINUX_ERROR_MSG "No SELinux messages found in log!"
#define PARSE_SUCCESS_MSG "Parse success!"
#define PARSE_INVALID_MSG_WARN_MSG "Warning! One or more invalid messages found in audit log.  See help file for more information."
#define PARSE_MALFORMED_MSG_WARN_MSG "Warning! One or more malformed messages found in audit log.  See help file for more information."
#define PARSE_BOTH_MSG_WARN_MSG "Warning! Invalid and malformed messages found in audit log.  See help file for more information."

int parse_audit(FILE *syslog, audit_log_t *log);
/* parses the file specified by syslog and puts all selinux audit messages into log 
   it is assumed that log will be created before this function<commit_msg>Ported changes from setools-1.2.<commit_after>/* Copyright (C) 2003 Tresys Technology, LLC
 * see file 'COPYING' for use and warranty information */

/*
 * Author: <EMAIL>
 * Date: October 3, 2003
 *
 * This file contains the parsing definitions
 *
 * parse.h
 */

#ifndef LIBAUDIT_PARSE_H
#define LIBAUDIT_PARSE_H


#include "auditlog.h"
#define	PARSE_RET_SUCCESS		0x00000000	/* success, no warnings nor errors */
#define PARSE_RET_MEMORY_ERROR		0x00000001	/* general error */
#define PARSE_RET_EOF_ERROR            	0x00000002	/* file was eof */
#define PARSE_RET_NO_SELINUX_ERROR   	0x00000004	/* no selinux messages found */
#define PARSE_RET_INVALID_MSG_WARN	0x00000008	/* invalid message, but added to audit log anyway */

#define PARSE_MEMORY_ERROR_MSG "Memory error while parsing the log!"
#define PARSE_NO_SELINUX_ERROR_MSG "No SELinux messages found in log!"
#define PARSE_SUCCESS_MSG "Parse success!"
#define PARSE_INVALID_MSG_WARN_MSG "Warning! One or more invalid messages found in audit log.  See help file for more information."

unsigned int parse_audit(FILE *syslog, audit_log_t *log);
/* parses the file specified by syslog and puts all selinux audit messages into log 
   it is assumed that log will be created before this function
{'fraction_non_alphanumeric': 0.06875227355401964, 'fraction_numerical': 0.0261913423062932, 'mean_word_length': 4.434782608695652, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 5, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1830324', 'n_tokens_mistral': 914, 'n_tokens_neox': 841, 'n_words': 322}