summaryrefslogtreecommitdiff
path: root/usr/src/lib/librdc/common/librdc.h
blob: 99ac34afe7474345700342525ee5225addb9e93e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_LIBRDC_H
#define	_LIBRDC_H

#ifdef	__cplusplus
extern "C" {
#endif

extern int Is_ipv6present(void);
extern int self_check(char *);
extern int gethost_netaddrs(char *, char *, char *, char *);
extern struct hostent *gethost_byname(const char *);
extern struct netbuf *get_addr(char *, ulong_t, ulong_t, struct netconfig **,
    char *, char *, struct t_info *, int);
extern int convert_nconf_to_knconf(struct netconfig *, struct knetconfig *);
extern int rdc_check_release(char **);

#if !defined(NSC_MAXPATH)
#define	NSC_MAXPATH	64
#endif

#define	RDC_MAX_THREADS	1024
/* user interface to sndr */
typedef struct rdcconfig_s {
	char			phost[NSC_MAXPATH];
	char			pfile[NSC_MAXPATH];
	char			pbmp[NSC_MAXPATH];
	char			shost[NSC_MAXPATH];
	char			sfile[NSC_MAXPATH];
	char			sbmp[NSC_MAXPATH];
	char			direct[NSC_MAXPATH];
	char			mode[NSC_MAXPATH];
	char			group[NSC_MAXPATH];
	char			ctag[NSC_MAXPATH];
	char			options[NSC_MAXPATH];
	int			persist;	/* 0 no, 1 yes */
	struct rdcconfig_s	*next;
} rdcconfig_t;

#define	RDC_ERR_SIZE	256

typedef struct rdc_rc_s {
	int			rc;
	char			msg[RDC_ERR_SIZE];
	struct rdc_rc_s		*next;
	rdcconfig_t		set;
} rdc_rc_t;

#define	RDC_FREEONE	0 /* free one rdcconfig_t* */
#define	RDC_FREEALL	1 /* free entire chain of rdcconfig_t* */

/* and it's operations */
extern rdcconfig_t *rdc_alloc_config(const char *phost, const char *pfile,
    const char *pbmp, const char *shost, const char *sfile, const char *sbmp,
    const char *mode, const char *group, const char *ctag, const char *options,
    int persist);
extern void rdc_free_config(rdcconfig_t *rdc, int all);
extern void rdc_free_rclist(rdc_rc_t *rc);
extern rdc_rc_t *new_rc(void);
extern rdc_rc_t *rdc_enable(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_enable_clrbmp(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_disable(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_log(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_usync(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_fsync(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_rsync(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_ursync(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_wait(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_set_autosync(rdcconfig_t *rdc, int autosync);
extern rdc_rc_t *rdc_set_maxqfbas(rdcconfig_t *rdc, int maxqfbas);
extern rdc_rc_t *rdc_set_maxqitems(rdcconfig_t *rdc, int maxqitems);
extern int rdc_get_maxqfbas(rdcconfig_t *rdc);
extern int rdc_get_maxqitems(rdcconfig_t *rdc);
extern int rdc_get_autosync(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_reconfig_pbmp(rdcconfig_t *rdc, char *pbmp);
extern rdc_rc_t *rdc_reconfig_sbmp(rdcconfig_t *rdc, char *sbmp);
extern rdc_rc_t *rdc_reconfig_group(rdcconfig_t *rdc, char *group);
extern rdc_rc_t *rdc_reconfig_ctag(rdcconfig_t *rdc, char *ctag);
extern rdc_rc_t *rdc_set_sync(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_set_async(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_health(rdcconfig_t *rdc);
extern rdc_rc_t *rdc_reverse_role(rdcconfig_t *rdc);
extern char *rdc_error(int *sev);

#ifdef	__cplusplus
}
#endif

#endif	/* _LIBRDC_H */