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