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