Imported Upstream version 2.4.3
[platform/upstream/audit.git] / docs / ausearch_add_expression.3
1 .TH "AUSEARCH_ADD_expression" "3" "Feb 2008" "Red Hat" "Linux Audit API"
2 .SH NAME
3 ausearch_add_expression \- build up search expression
4 .SH "SYNOPSIS"
5 .B #include <auparse.h>
6
7 \fBint ausearch_add_expression(auparse_state_t *\fIau\fB,
8 const char *\fIexpression\fB, char **\fIerror\fB, ausearch_rule_t \fIhow\fB);\fR
9
10 .SH "DESCRIPTION"
11
12 .B ausearch_add_item
13 adds an expression to the current audit search expression.
14 The search conditions can then be used to scan logs, files, or buffers
15 for something of interest.
16 The
17 .I expression
18 parameter contains an expression, as specified in
19 .BR ausearch\-expression (5).
20
21 The
22 .I how
23 parameter determines
24 how this search expression will affect the existing search expression,
25 if one is already defined.
26 The possible values are:
27 .RS
28 .TP
29 .I AUSEARCH_RULE_CLEAR
30 Clear the current search expression, if any,
31 and use only this search expression.
32 .TP
33 .I AUSEARCH_RULE_OR
34 If a search expression
35 .I E
36 is already configured,
37 replace it by \fB(\fIE\fB || \fIthis_search_expression\fB)\fR.
38 .TP
39 .I AUSEARCH_RULE_AND
40 If a search expression
41 .I E
42 is already configured,
43 replace it by \fB(\fIE\fB && \fIthis_search_expression\fB)\fR.
44 .RE
45
46 .SH "RETURN VALUE"
47
48 If successful, 
49 .B ausearch_add_expression
50 returns 0.
51 Otherwise, it returns \-1, sets
52 .B errno
53 and it may set \fB*\fIerror\fR to an error message;
54 the caller must free the error message using
55 .BR free (3).
56 If an error message is not available or can not be allocated, \fB*\fIerror\fR
57 is set to \fBNULL\fR.
58
59 .SH "SEE ALSO"
60
61 .BR ausearch_add_item (3),
62 .BR ausearch_add_interpreted_item (3),
63 .BR ausearch_add_timestamp_item (3),
64 .BR ausearch_add_regex (3),
65 .BR ausearch_set_stop (3),
66 .BR ausearch_clear (3),
67 .BR ausearch_next_event (3),
68 .BR ausearch\-expression (5).
69
70 .SH AUTHOR
71 Miloslav Trmac