audit: Support multiple audit interfaces and interface options
[openafs.git] / src / audit / audit-api.h
1 /*
2  * Copyright 2009, Sine Nomine Associates and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef _AUDIT_API_H
11 #define _AUDIT_API_H
12
13 #define OSI_AUDIT_MAXMSG 2048    /* Max amount of text in auditmsg */
14
15 struct osi_audit_ops {
16     /*
17      * send_msg - send a formatted message to interface output
18      *     Called from osi_audit
19      */
20     void (*send_msg)(void *rock, const char *message, int msglen, int truncated);
21
22     /*
23      * open_file - process file specification parameter
24      *     Called from osi_audit_file during commandline processing
25      */
26     int  (*open_file)(void *rock, const char *fileName);
27
28     /*
29      * print_interface_stats - print stats
30      *     Called from audit_Printstats
31      */
32     void (*print_interface_stats)(void *rock, FILE *out);
33
34     /*
35      * create_interface - create a new instance of the interface
36      *     Called from osi_audit_file during command line processing
37      */
38     void *(*create_interface)(void);
39
40     /*
41      * close_interface - stop the interface and free resources
42      *     Called from osi_audit_close during daemon shutdown
43      */
44     void (*close_interface)(void **rock);
45
46     /* Following are optional functions.  Set to NULL if not implemented */
47
48     /*
49      * set_option - process optional parameter
50      *     Called from osi_audit_file during command line processing
51      */
52     int  (*set_option)(void *rock, char *opt, char *val);
53
54     /*
55      * open_interface - complete interface initialization
56      *     Called from osi_audit_open during daemon initialization
57      *            after command line processing
58      */
59     void (*open_interface)(void *rock);
60 };
61
62 #endif /* _AUDIT_API_H */