Imported Upstream version 2.4.3
[platform/upstream/audit.git] / docs / auparse_add_callback.3
1 .TH "AUPARSE_ADD_CALLBACK" "3" "May 2007" "Red Hat" "Linux Audit API"
2 .SH NAME
3 auparse_add_callback \- add a callback handler for notifications
4 .SH "SYNOPSIS"
5 .B #include <auparse.h>
6 .sp
7 .nf
8 .B void
9 auparse_add_callback(auparse_state_t *au, auparse_callback_ptr callback,
10                      void *user_data, user_destroy user_destroy_func);
11 .fi
12 .SH "DESCRIPTION"
13 auparse_add_callback adds a callback function to the parse state which is invoked to notify the application of parsing events.
14
15 The signature of the callback is:
16
17 .nf
18 void
19 auparse_callback(auparse_state_t *au, auparse_cb_event_t cb_event_type,
20                  void *user_data);
21 .fi
22
23 When the callback is invoked it is passed:
24
25 .TP
26 .I au
27  a pointer to the parse_state
28 .TP
29 .I cb_event_type
30 enumerated value indicating the reason why the callback was invoked
31 .TP
32 .I user_data
33 pointer to user supplied private data. May be NULL.
34 .
35 .TP
36 .I user_destroy_func
37 pointer to function called when user_data is destroyed. May be NULL.
38 The signature is:
39 .br
40 .sp
41 .nf
42 void destroy(void *user_data);
43 .fi
44 .br
45 .sp
46 The destroy() function should be prepared to accept user_data possibly being NULL.
47 .PP
48 The 
49 .I cb_event_type
50 argument indicates why the callback was invoked. It's possible values are:
51 .br
52 .TP
53 .B AUPARSE_CB_EVENT_READY
54 A complete event has been parsed and is ready to be examined. This is logically equivalent to the parse state immediately following 
55 .I auparse_next_event()
56 .PP
57 See auparse_feed(3) for a complete code example.
58 .
59 .SH "RETURN VALUE"
60
61 Returns the previous callback pointer.
62
63 .SH "SEE ALSO"
64
65 .BR auparse_feed (3), 
66 .BR auparse_flush_feed (3).
67
68 .SH AUTHOR
69 John Dennis