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