xref: /titanic_41/usr/src/lib/libsysevent/llib-lsysevent (revision 6185db853e024a486ff8837e6784dd290d866112)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*LINTLIBRARY*/
23/*PROTOLIB1*/
24/*
25 * Copyright 2000-2003 Sun Microsystems, Inc.  All rights reserved.
26 * Use is subject to license terms.
27 *
28 *  usr/src/lib/libsysevent/llib-lsysevent
29 */
30
31#pragma ident	"%Z%%M%	%I%	%E% SMI"
32
33#include <synch.h>
34#include <thread.h>
35#include "libsysevent.h"
36
37int sysevent_post_event(char *event_class, char *event_subclass, char *vendor,
38	char *pub_name, nvlist_t *attr_list, sysevent_id_t *eid);
39sysevent_t *sysevent_dup(sysevent_t *ev);
40
41void sysevent_free(sysevent_t *ev);
42
43int sysevent_get_attr_list(sysevent_t *ev, nvlist_t **nvlist);
44
45int sysevent_lookup_attr(sysevent_t *ev, char *name, int datatype,
46	sysevent_value_t *se_value);
47
48sysevent_attr_t *sysevent_attr_next(sysevent_t *ev, sysevent_attr_t *attr);
49
50char *sysevent_attr_name(sysevent_attr_t *attr);
51
52int sysevent_attr_value(sysevent_attr_t *attr, sysevent_value_t *se_value);
53
54int sysevent_get_class(sysevent_t *ev);
55
56char *sysevent_get_class_name(sysevent_t *ev);
57
58int sysevent_get_subclass(sysevent_t *ev);
59
60char *sysevent_get_subclass_name(sysevent_t *ev);
61
62char *sysevent_get_pub(sysevent_t *ev);
63
64char *sysevent_get_vendor_name(sysevent_t *ev);
65
66char *sysevent_get_pub_name(sysevent_t *ev);
67
68void sysevent_get_pid(sysevent_t *ev, pid_t *pid);
69
70uint64_t sysevent_get_seq(sysevent_t *ev);
71
72void sysevent_get_time(sysevent_t *ev, hrtime_t *etime);
73
74size_t sysevent_get_size(sysevent_t *ev);
75
76int sysevent_send_event(sysevent_handle_t *sysevent_hdl, sysevent_t *ev);
77
78sysevent_t * sysevent_alloc_event(char *event_class, char *event_subclass,
79	char *vendor, char *pub_name, nvlist_t *attr_list);
80
81sysevent_handle_t * sysevent_open_channel(const char *channel);
82
83sysevent_handle_t * sysevent_open_channel_alt(const char *channel_path);
84
85void sysevent_close_channel(sysevent_handle_t *shp);
86
87int sysevent_bind_subscriber(sysevent_handle_t *shp,
88	void (*callback)(sysevent_t *data));
89
90int sysevent_bind_publisher(sysevent_handle_t *shp);
91
92void sysevent_unbind_subscriber(sysevent_handle_t *shp);
93
94void sysevent_unbind_publisher(sysevent_handle_t *shp);
95
96int sysevent_register_event(sysevent_handle_t *shp, const char *event_class,
97	const char **event_subclass_list, int num_subclasses);
98
99void sysevent_unregister_event(sysevent_handle_t *shp,
100	const char *event_class);
101
102void sysevent_cleanup_publishers(sysevent_handle_t *shp);
103
104void sysevent_cleanup_subscribers(sysevent_handle_t *shp);
105
106sysevent_handle_t *sysevent_bind_handle(void (*event_handler)(sysevent_t *ev));
107
108void sysevent_unbind_handle(sysevent_handle_t *shp);
109
110int sysevent_subscribe_event(sysevent_handle_t *shp, const char *event_class,
111	const char **event_subclass_list, int num_subclasses);
112
113void sysevent_unsubscribe_event(sysevent_handle_t *shp,
114	const char *event_class);
115
116void se_print(FILE *fp, sysevent_t *ev);
117
118int sysevent_evc_bind(const char *channel_path, evchan_t **scpp,
119    uint32_t flags);
120
121void sysevent_evc_unbind(evchan_t *scp);
122
123int sysevent_evc_publish(evchan_t *scp, const char *event_class,
124    const char *event_subclass, const char *vendor, const char *pub_name,
125    nvlist_t *attr_list, uint32_t flags);
126
127int sysevent_evc_subscribe(evchan_t *scp, const char *sid,
128    const char *event_class,
129    int (*event_handler)(sysevent_t *ev, void *cookie),
130    void *cookie, uint32_t flags);
131
132void sysevent_evc_unsubscribe(evchan_t *scp, const char *sid);
133
134int sysevent_evc_control(evchan_t *scp, int cmd, ...);
135