xref: /titanic_41/usr/src/lib/libreparse/common/rp_plugin.h (revision 82629e3015252bf18319ba3815c773df23e21436)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _RP_PLUGIN_H
28 #define	_RP_PLUGIN_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/types.h>
35 
36 #define	RP_LIB_DIR	"/usr/lib/reparse"
37 #define	RP_PLUGIN_V1	1
38 
39 /*
40  * some error codes
41  */
42 #define	RP_OK			0
43 #define	RP_NO_PLUGIN		ENOENT
44 #define	RP_NO_MEMORY		ENOMEM
45 #define	RP_NO_PLUGIN_DIR	ENOTDIR
46 #define	RP_INVALID_PROTOCOL	EINVAL
47 
48 extern int rp_plugin_init();
49 
50 typedef struct rp_plugin_ops {
51 	int rpo_version;
52 	int (*rpo_init)(void);
53 	int (*rpo_fini)(void);
54 	char *(*rpo_svc_types)(void);
55 	boolean_t (*rpo_supports_svc)(const char *);
56 	int (*rpo_form)(const char *, const char *, char *, size_t *);
57 	int (*rpo_deref)(const char *, const char *, char *, size_t *);
58 } rp_plugin_ops_t;
59 
60 typedef struct rp_proto_plugin {
61 	struct rp_proto_plugin *plugin_next;
62 	rp_plugin_ops_t *plugin_ops;
63 	void *plugin_handle;
64 } rp_proto_plugin_t;
65 
66 typedef struct rp_proto_handle {
67 	int rp_num_proto;
68 	rp_plugin_ops_t **rp_ops;
69 } rp_proto_handle_t;
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif	/* _RP_PLUGIN_H */
76