1*6007Sthurlow /* 2*6007Sthurlow * CDDL HEADER START 3*6007Sthurlow * 4*6007Sthurlow * The contents of this file are subject to the terms of the 5*6007Sthurlow * Common Development and Distribution License (the "License"). 6*6007Sthurlow * You may not use this file except in compliance with the License. 7*6007Sthurlow * 8*6007Sthurlow * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*6007Sthurlow * or http://www.opensolaris.org/os/licensing. 10*6007Sthurlow * See the License for the specific language governing permissions 11*6007Sthurlow * and limitations under the License. 12*6007Sthurlow * 13*6007Sthurlow * When distributing Covered Code, include this CDDL HEADER in each 14*6007Sthurlow * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*6007Sthurlow * If applicable, add the following below this CDDL HEADER, with the 16*6007Sthurlow * fields enclosed by brackets "[]" replaced with your own identifying 17*6007Sthurlow * information: Portions Copyright [yyyy] [name of copyright owner] 18*6007Sthurlow * 19*6007Sthurlow * CDDL HEADER END 20*6007Sthurlow */ 21*6007Sthurlow 22*6007Sthurlow /* 23*6007Sthurlow * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24*6007Sthurlow * Use is subject to license terms. 25*6007Sthurlow */ 26*6007Sthurlow 27*6007Sthurlow #pragma ident "%Z%%M% %I% %E% SMI" 28*6007Sthurlow 29*6007Sthurlow /* 30*6007Sthurlow * basic API declarations for share management 31*6007Sthurlow */ 32*6007Sthurlow 33*6007Sthurlow #ifndef _LIBSHARE_SMBFS_H 34*6007Sthurlow #define _LIBSHARE_SMBFS_H 35*6007Sthurlow 36*6007Sthurlow #ifdef __cplusplus 37*6007Sthurlow extern "C" { 38*6007Sthurlow #endif 39*6007Sthurlow 40*6007Sthurlow struct smbclnt_proto_option_defs { 41*6007Sthurlow char *name; /* display name -- remove protocol identifier */ 42*6007Sthurlow char *value; 43*6007Sthurlow int index; 44*6007Sthurlow int flags; 45*6007Sthurlow int32_t minval; 46*6007Sthurlow int32_t maxval; /* In case of length of string this should be max */ 47*6007Sthurlow int (*validator)(int, char *, char *); 48*6007Sthurlow }; 49*6007Sthurlow 50*6007Sthurlow extern struct smbclnt_proto_option_defs smbclnt_proto_options[]; 51*6007Sthurlow 52*6007Sthurlow #define PROTO_OPT_SECTION 0 53*6007Sthurlow #define PROTO_OPT_ADDR 1 54*6007Sthurlow #define PROTO_OPT_MINAUTH 2 55*6007Sthurlow #define PROTO_OPT_NBNS_BROADCAST 3 56*6007Sthurlow #define PROTO_OPT_NBNS_ENABLE 4 57*6007Sthurlow #define PROTO_OPT_NBNSADDR 5 58*6007Sthurlow #define PROTO_OPT_PASSWORD 6 59*6007Sthurlow #define PROTO_OPT_TIMEOUT 7 60*6007Sthurlow #define PROTO_OPT_USER 8 61*6007Sthurlow #define PROTO_OPT_DOMAIN 9 62*6007Sthurlow #define PROTO_OPT_WORKGROUP 10 63*6007Sthurlow 64*6007Sthurlow #ifdef NOT_DEFINED 65*6007Sthurlow #define PROTO_OPT_NBSCOPE 11 66*6007Sthurlow #define PROTO_OPT_NBTIMEOUT 12 67*6007Sthurlow #define PROTO_OPT_RETRY_COUNT 13 68*6007Sthurlow #define PROTO_OPT_USE_NEGPROT_DOMAIN 14 69*6007Sthurlow #define PROTO_OPT_CHARSETS 15 70*6007Sthurlow #endif 71*6007Sthurlow 72*6007Sthurlow #define SMBC_OPT_MAX PROTO_OPT_WORKGROUP 73*6007Sthurlow 74*6007Sthurlow /* 75*6007Sthurlow * Flags values 76*6007Sthurlow */ 77*6007Sthurlow #define SMBC_MODIFIED 0x01 78*6007Sthurlow 79*6007Sthurlow /* Max value length of all SMB properties */ 80*6007Sthurlow #define MAX_VALUE_BUFLEN 600 81*6007Sthurlow 82*6007Sthurlow /* 83*6007Sthurlow * SMF access 84*6007Sthurlow */ 85*6007Sthurlow 86*6007Sthurlow #define SMBC_FMRI_PREFIX "network/smb/client" 87*6007Sthurlow #define SMBC_DEFAULT_INSTANCE_FMRI "svc:/network/smb/client:default" 88*6007Sthurlow #define SMBC_PG_PREFIX "S-" 89*6007Sthurlow #define SMBC_PG_PREFIX_LEN 2 90*6007Sthurlow #define SMBC_PG_INSTANCE "default" 91*6007Sthurlow 92*6007Sthurlow #define SMBC_SMF_OK 0 93*6007Sthurlow #define SMBC_SMF_NO_MEMORY 1 /* no memory for data structures */ 94*6007Sthurlow #define SMBC_SMF_SYSTEM_ERR 2 /* system error, use errno */ 95*6007Sthurlow #define SMBC_SMF_NO_PERMISSION 3 /* no permission for operation */ 96*6007Sthurlow 97*6007Sthurlow #define SCH_STATE_UNINIT 0 98*6007Sthurlow #define SCH_STATE_INITIALIZING 1 99*6007Sthurlow #define SCH_STATE_INIT 2 100*6007Sthurlow 101*6007Sthurlow typedef struct smb_scfhandle { 102*6007Sthurlow scf_handle_t *scf_handle; 103*6007Sthurlow int scf_state; 104*6007Sthurlow scf_service_t *scf_service; 105*6007Sthurlow scf_scope_t *scf_scope; 106*6007Sthurlow scf_transaction_t *scf_trans; 107*6007Sthurlow scf_transaction_entry_t *scf_entry; 108*6007Sthurlow scf_propertygroup_t *scf_pg; 109*6007Sthurlow scf_instance_t *scf_instance; 110*6007Sthurlow scf_iter_t *scf_inst_iter; 111*6007Sthurlow scf_iter_t *scf_pg_iter; 112*6007Sthurlow } smb_scfhandle_t; 113*6007Sthurlow 114*6007Sthurlow extern void smb_smf_scf_fini(smb_scfhandle_t *); 115*6007Sthurlow extern smb_scfhandle_t *smb_smf_scf_init(char *); 116*6007Sthurlow extern int smb_smf_get_instance(smb_scfhandle_t *, char *); 117*6007Sthurlow extern int smb_smf_create_instance(smb_scfhandle_t *, char *); 118*6007Sthurlow extern int smb_smf_start_transaction(smb_scfhandle_t *); 119*6007Sthurlow extern int smb_smf_end_transaction(smb_scfhandle_t *); 120*6007Sthurlow 121*6007Sthurlow extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *); 122*6007Sthurlow extern int smb_smf_get_string_property(smb_scfhandle_t *, char *, 123*6007Sthurlow char *, size_t); 124*6007Sthurlow extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t); 125*6007Sthurlow extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *); 126*6007Sthurlow extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t); 127*6007Sthurlow extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *); 128*6007Sthurlow extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *, 129*6007Sthurlow void *, size_t); 130*6007Sthurlow extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *, 131*6007Sthurlow void *, size_t); 132*6007Sthurlow 133*6007Sthurlow extern int smb_smf_create_service_pgroup(smb_scfhandle_t *, char *); 134*6007Sthurlow extern int smb_smf_delete_service_pgroup(smb_scfhandle_t *, char *); 135*6007Sthurlow extern int smb_smf_create_instance_pgroup(smb_scfhandle_t *, char *); 136*6007Sthurlow extern int smb_smf_delete_instance_pgroup(smb_scfhandle_t *, char *); 137*6007Sthurlow extern int smb_smf_delete_property(smb_scfhandle_t *, char *); 138*6007Sthurlow extern int smb_smf_instance_exists(smb_scfhandle_t *, char *); 139*6007Sthurlow extern int smb_smf_instance_create(smb_scfhandle_t *, char *, char *); 140*6007Sthurlow extern int smb_smf_instance_delete(smb_scfhandle_t *, char *); 141*6007Sthurlow extern smb_scfhandle_t *smb_smf_get_iterator(char *); 142*6007Sthurlow 143*6007Sthurlow #ifdef __cplusplus 144*6007Sthurlow } 145*6007Sthurlow #endif 146*6007Sthurlow 147*6007Sthurlow #endif /* _LIBSHARE_SMBFS_H */ 148