summaryrefslogtreecommitdiff
path: root/usr/src/lib/libshare/smbfs/libshare_smbfs.h
blob: 8f95e7de6805e27e9abf351b1b8da900add5778b (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * 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.
 */

/*
 * basic API declarations for share management
 */

#ifndef _LIBSHARE_SMBFS_H
#define	_LIBSHARE_SMBFS_H

#ifdef	__cplusplus
extern "C" {
#endif

struct smbclnt_proto_option_defs {
	char *name;	/* display name -- remove protocol identifier */
	char *value;
	int index;
	int flags;
	int32_t minval;
	int32_t maxval; /* In case of length of string this should be max */
	int (*validator)(int, char *, char *);
};

extern struct smbclnt_proto_option_defs smbclnt_proto_options[];

#define	PROTO_OPT_SECTION		0
#define	PROTO_OPT_ADDR			1
#define	PROTO_OPT_MINAUTH		2
#define	PROTO_OPT_NBNS_BROADCAST	3
#define	PROTO_OPT_NBNS_ENABLE		4
#define	PROTO_OPT_NBNSADDR		5
#define	PROTO_OPT_PASSWORD		6
#define	PROTO_OPT_TIMEOUT		7
#define	PROTO_OPT_USER			8
#define	PROTO_OPT_DOMAIN		9
#define	PROTO_OPT_WORKGROUP		10
#define	PROTO_OPT_SIGNING		11

#define	SMBC_OPT_MAX	PROTO_OPT_SIGNING

/*
 * Flags values
 */
#define	SMBC_MODIFIED			0x01

/* Max value length of all SMB properties */
#define	MAX_VALUE_BUFLEN	600

/*
 * SMF access
 */

#define	SMBC_FMRI_PREFIX		"network/smb/client"
#define	SMBC_DEFAULT_INSTANCE_FMRI	"svc:/network/smb/client:default"
#define	SMBC_PG_PREFIX			"S-"
#define	SMBC_PG_PREFIX_LEN		2
#define	SMBC_PG_INSTANCE		"default"

#define	SMBC_SMF_OK		0
#define	SMBC_SMF_NO_MEMORY	1	/* no memory for data structures */
#define	SMBC_SMF_SYSTEM_ERR	2	/* system error, use errno */
#define	SMBC_SMF_NO_PERMISSION	3	/* no permission for operation */

#define	SCH_STATE_UNINIT	0
#define	SCH_STATE_INITIALIZING	1
#define	SCH_STATE_INIT		2

typedef struct smb_scfhandle {
	scf_handle_t		*scf_handle;
	int			scf_state;
	scf_service_t		*scf_service;
	scf_scope_t		*scf_scope;
	scf_transaction_t	*scf_trans;
	scf_transaction_entry_t	*scf_entry;
	scf_propertygroup_t	*scf_pg;
	scf_instance_t		*scf_instance;
	scf_iter_t		*scf_inst_iter;
	scf_iter_t		*scf_pg_iter;
} smb_scfhandle_t;

extern void smb_smf_scf_fini(smb_scfhandle_t *);
extern smb_scfhandle_t *smb_smf_scf_init(char *);
extern int smb_smf_get_instance(smb_scfhandle_t *, char *);
extern int smb_smf_create_instance(smb_scfhandle_t *, char *);
extern int smb_smf_start_transaction(smb_scfhandle_t *);
extern int smb_smf_end_transaction(smb_scfhandle_t *);

extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *);
extern int smb_smf_get_string_property(smb_scfhandle_t *, char *,
    char *, size_t);
extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t);
extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *);
extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t);
extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *);
extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *,
    void *, size_t);
extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *,
    void *, size_t);

extern int smb_smf_create_service_pgroup(smb_scfhandle_t *, char *);
extern int smb_smf_delete_service_pgroup(smb_scfhandle_t *, char *);
extern int smb_smf_create_instance_pgroup(smb_scfhandle_t *, char *);
extern int smb_smf_delete_instance_pgroup(smb_scfhandle_t *, char *);
extern int smb_smf_delete_property(smb_scfhandle_t *, char *);
extern int smb_smf_instance_exists(smb_scfhandle_t *, char *);
extern int smb_smf_instance_create(smb_scfhandle_t *, char *, char *);
extern int smb_smf_instance_delete(smb_scfhandle_t *, char *);
extern smb_scfhandle_t *smb_smf_get_iterator(char *);

#ifdef	__cplusplus
}
#endif

#endif /* _LIBSHARE_SMBFS_H */