xref: /onnv-gate/usr/src/lib/librdc/common/librdc.h (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM  * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM  *
4*7836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM  *
8*7836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM  * and limitations under the License.
12*7836SJohn.Forte@Sun.COM  *
13*7836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM  *
19*7836SJohn.Forte@Sun.COM  * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM  */
21*7836SJohn.Forte@Sun.COM /*
22*7836SJohn.Forte@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7836SJohn.Forte@Sun.COM  * Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM  */
25*7836SJohn.Forte@Sun.COM 
26*7836SJohn.Forte@Sun.COM #ifndef	_LIBRDC_H
27*7836SJohn.Forte@Sun.COM #define	_LIBRDC_H
28*7836SJohn.Forte@Sun.COM 
29*7836SJohn.Forte@Sun.COM #ifdef	__cplusplus
30*7836SJohn.Forte@Sun.COM extern "C" {
31*7836SJohn.Forte@Sun.COM #endif
32*7836SJohn.Forte@Sun.COM 
33*7836SJohn.Forte@Sun.COM extern int Is_ipv6present(void);
34*7836SJohn.Forte@Sun.COM extern int self_check(char *);
35*7836SJohn.Forte@Sun.COM extern int gethost_netaddrs(char *, char *, char *, char *);
36*7836SJohn.Forte@Sun.COM extern struct hostent *gethost_byname(const char *);
37*7836SJohn.Forte@Sun.COM extern struct netbuf *get_addr(char *, ulong_t, ulong_t, struct netconfig **,
38*7836SJohn.Forte@Sun.COM     char *, char *, struct t_info *, int);
39*7836SJohn.Forte@Sun.COM extern int convert_nconf_to_knconf(struct netconfig *, struct knetconfig *);
40*7836SJohn.Forte@Sun.COM extern int rdc_check_release(char **);
41*7836SJohn.Forte@Sun.COM 
42*7836SJohn.Forte@Sun.COM #if !defined(NSC_MAXPATH)
43*7836SJohn.Forte@Sun.COM #define	NSC_MAXPATH	64
44*7836SJohn.Forte@Sun.COM #endif
45*7836SJohn.Forte@Sun.COM 
46*7836SJohn.Forte@Sun.COM #define	RDC_MAX_THREADS	1024
47*7836SJohn.Forte@Sun.COM /* user interface to sndr */
48*7836SJohn.Forte@Sun.COM typedef struct rdcconfig_s {
49*7836SJohn.Forte@Sun.COM 	char			phost[NSC_MAXPATH];
50*7836SJohn.Forte@Sun.COM 	char			pfile[NSC_MAXPATH];
51*7836SJohn.Forte@Sun.COM 	char			pbmp[NSC_MAXPATH];
52*7836SJohn.Forte@Sun.COM 	char			shost[NSC_MAXPATH];
53*7836SJohn.Forte@Sun.COM 	char			sfile[NSC_MAXPATH];
54*7836SJohn.Forte@Sun.COM 	char			sbmp[NSC_MAXPATH];
55*7836SJohn.Forte@Sun.COM 	char			direct[NSC_MAXPATH];
56*7836SJohn.Forte@Sun.COM 	char			mode[NSC_MAXPATH];
57*7836SJohn.Forte@Sun.COM 	char			group[NSC_MAXPATH];
58*7836SJohn.Forte@Sun.COM 	char			ctag[NSC_MAXPATH];
59*7836SJohn.Forte@Sun.COM 	char			options[NSC_MAXPATH];
60*7836SJohn.Forte@Sun.COM 	int			persist;	/* 0 no, 1 yes */
61*7836SJohn.Forte@Sun.COM 	struct rdcconfig_s	*next;
62*7836SJohn.Forte@Sun.COM } rdcconfig_t;
63*7836SJohn.Forte@Sun.COM 
64*7836SJohn.Forte@Sun.COM #define	RDC_ERR_SIZE	256
65*7836SJohn.Forte@Sun.COM 
66*7836SJohn.Forte@Sun.COM typedef struct rdc_rc_s {
67*7836SJohn.Forte@Sun.COM 	int			rc;
68*7836SJohn.Forte@Sun.COM 	char			msg[RDC_ERR_SIZE];
69*7836SJohn.Forte@Sun.COM 	struct rdc_rc_s		*next;
70*7836SJohn.Forte@Sun.COM 	rdcconfig_t		set;
71*7836SJohn.Forte@Sun.COM } rdc_rc_t;
72*7836SJohn.Forte@Sun.COM 
73*7836SJohn.Forte@Sun.COM #define	RDC_FREEONE	0 /* free one rdcconfig_t* */
74*7836SJohn.Forte@Sun.COM #define	RDC_FREEALL	1 /* free entire chain of rdcconfig_t* */
75*7836SJohn.Forte@Sun.COM 
76*7836SJohn.Forte@Sun.COM /* and it's operations */
77*7836SJohn.Forte@Sun.COM extern rdcconfig_t *rdc_alloc_config(const char *phost, const char *pfile,
78*7836SJohn.Forte@Sun.COM     const char *pbmp, const char *shost, const char *sfile, const char *sbmp,
79*7836SJohn.Forte@Sun.COM     const char *mode, const char *group, const char *ctag, const char *options,
80*7836SJohn.Forte@Sun.COM     int persist);
81*7836SJohn.Forte@Sun.COM extern void rdc_free_config(rdcconfig_t *rdc, int all);
82*7836SJohn.Forte@Sun.COM extern void rdc_free_rclist(rdc_rc_t *rc);
83*7836SJohn.Forte@Sun.COM extern rdc_rc_t *new_rc(void);
84*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_enable(rdcconfig_t *rdc);
85*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_enable_clrbmp(rdcconfig_t *rdc);
86*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_disable(rdcconfig_t *rdc);
87*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_log(rdcconfig_t *rdc);
88*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_usync(rdcconfig_t *rdc);
89*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_fsync(rdcconfig_t *rdc);
90*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_rsync(rdcconfig_t *rdc);
91*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_ursync(rdcconfig_t *rdc);
92*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_wait(rdcconfig_t *rdc);
93*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_set_autosync(rdcconfig_t *rdc, int autosync);
94*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_set_maxqfbas(rdcconfig_t *rdc, int maxqfbas);
95*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_set_maxqitems(rdcconfig_t *rdc, int maxqitems);
96*7836SJohn.Forte@Sun.COM extern int rdc_get_maxqfbas(rdcconfig_t *rdc);
97*7836SJohn.Forte@Sun.COM extern int rdc_get_maxqitems(rdcconfig_t *rdc);
98*7836SJohn.Forte@Sun.COM extern int rdc_get_autosync(rdcconfig_t *rdc);
99*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_reconfig_pbmp(rdcconfig_t *rdc, char *pbmp);
100*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_reconfig_sbmp(rdcconfig_t *rdc, char *sbmp);
101*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_reconfig_group(rdcconfig_t *rdc, char *group);
102*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_reconfig_ctag(rdcconfig_t *rdc, char *ctag);
103*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_set_sync(rdcconfig_t *rdc);
104*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_set_async(rdcconfig_t *rdc);
105*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_health(rdcconfig_t *rdc);
106*7836SJohn.Forte@Sun.COM extern rdc_rc_t *rdc_reverse_role(rdcconfig_t *rdc);
107*7836SJohn.Forte@Sun.COM extern char *rdc_error(int *sev);
108*7836SJohn.Forte@Sun.COM 
109*7836SJohn.Forte@Sun.COM #ifdef	__cplusplus
110*7836SJohn.Forte@Sun.COM }
111*7836SJohn.Forte@Sun.COM #endif
112*7836SJohn.Forte@Sun.COM 
113*7836SJohn.Forte@Sun.COM #endif	/* _LIBRDC_H */
114