14bff34e3Sthurlow /* 24bff34e3Sthurlow * CDDL HEADER START 34bff34e3Sthurlow * 44bff34e3Sthurlow * The contents of this file are subject to the terms of the 54bff34e3Sthurlow * Common Development and Distribution License (the "License"). 64bff34e3Sthurlow * You may not use this file except in compliance with the License. 74bff34e3Sthurlow * 84bff34e3Sthurlow * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 94bff34e3Sthurlow * or http://www.opensolaris.org/os/licensing. 104bff34e3Sthurlow * See the License for the specific language governing permissions 114bff34e3Sthurlow * and limitations under the License. 124bff34e3Sthurlow * 134bff34e3Sthurlow * When distributing Covered Code, include this CDDL HEADER in each 144bff34e3Sthurlow * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 154bff34e3Sthurlow * If applicable, add the following below this CDDL HEADER, with the 164bff34e3Sthurlow * fields enclosed by brackets "[]" replaced with your own identifying 174bff34e3Sthurlow * information: Portions Copyright [yyyy] [name of copyright owner] 184bff34e3Sthurlow * 194bff34e3Sthurlow * CDDL HEADER END 204bff34e3Sthurlow */ 214bff34e3Sthurlow 224bff34e3Sthurlow /* 234bff34e3Sthurlow * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 244bff34e3Sthurlow * Use is subject to license terms. 25*adee6784SGordon Ross * 26*adee6784SGordon Ross * Copyright 2018 Nexenta Systems, Inc. All rights reserved. 274bff34e3Sthurlow */ 284bff34e3Sthurlow 294bff34e3Sthurlow /* 304bff34e3Sthurlow * basic API declarations for share management 314bff34e3Sthurlow */ 324bff34e3Sthurlow 334bff34e3Sthurlow #ifndef _LIBSHARE_SMBFS_H 344bff34e3Sthurlow #define _LIBSHARE_SMBFS_H 354bff34e3Sthurlow 364bff34e3Sthurlow #ifdef __cplusplus 374bff34e3Sthurlow extern "C" { 384bff34e3Sthurlow #endif 394bff34e3Sthurlow 404bff34e3Sthurlow struct smbclnt_proto_option_defs { 414bff34e3Sthurlow char *name; /* display name -- remove protocol identifier */ 424bff34e3Sthurlow char *value; 434bff34e3Sthurlow int index; 444bff34e3Sthurlow int flags; 454bff34e3Sthurlow int32_t minval; 464bff34e3Sthurlow int32_t maxval; /* In case of length of string this should be max */ 474bff34e3Sthurlow int (*validator)(int, char *, char *); 484bff34e3Sthurlow }; 494bff34e3Sthurlow 504bff34e3Sthurlow extern struct smbclnt_proto_option_defs smbclnt_proto_options[]; 514bff34e3Sthurlow 524bff34e3Sthurlow #define PROTO_OPT_SECTION 0 534bff34e3Sthurlow #define PROTO_OPT_ADDR 1 544bff34e3Sthurlow #define PROTO_OPT_MINAUTH 2 554bff34e3Sthurlow #define PROTO_OPT_NBNS_BROADCAST 3 564bff34e3Sthurlow #define PROTO_OPT_NBNS_ENABLE 4 574bff34e3Sthurlow #define PROTO_OPT_NBNSADDR 5 584bff34e3Sthurlow #define PROTO_OPT_PASSWORD 6 594bff34e3Sthurlow #define PROTO_OPT_TIMEOUT 7 604bff34e3Sthurlow #define PROTO_OPT_USER 8 614bff34e3Sthurlow #define PROTO_OPT_DOMAIN 9 624bff34e3Sthurlow #define PROTO_OPT_WORKGROUP 10 639c9af259SGordon Ross #define PROTO_OPT_SIGNING 11 64*adee6784SGordon Ross #define PROTO_OPT_MIN_PROTOCOL 12 65*adee6784SGordon Ross #define PROTO_OPT_MAX_PROTOCOL 13 664bff34e3Sthurlow 67*adee6784SGordon Ross #define SMBC_OPT_MAX PROTO_OPT_MAX_PROTOCOL 684bff34e3Sthurlow 694bff34e3Sthurlow /* 704bff34e3Sthurlow * Flags values 714bff34e3Sthurlow */ 724bff34e3Sthurlow #define SMBC_MODIFIED 0x01 734bff34e3Sthurlow 744bff34e3Sthurlow /* Max value length of all SMB properties */ 754bff34e3Sthurlow #define MAX_VALUE_BUFLEN 600 764bff34e3Sthurlow 774bff34e3Sthurlow /* 784bff34e3Sthurlow * SMF access 794bff34e3Sthurlow */ 804bff34e3Sthurlow 814bff34e3Sthurlow #define SMBC_FMRI_PREFIX "network/smb/client" 824bff34e3Sthurlow #define SMBC_DEFAULT_INSTANCE_FMRI "svc:/network/smb/client:default" 834bff34e3Sthurlow #define SMBC_PG_PREFIX "S-" 844bff34e3Sthurlow #define SMBC_PG_PREFIX_LEN 2 854bff34e3Sthurlow #define SMBC_PG_INSTANCE "default" 864bff34e3Sthurlow 874bff34e3Sthurlow #define SMBC_SMF_OK 0 884bff34e3Sthurlow #define SMBC_SMF_NO_MEMORY 1 /* no memory for data structures */ 894bff34e3Sthurlow #define SMBC_SMF_SYSTEM_ERR 2 /* system error, use errno */ 904bff34e3Sthurlow #define SMBC_SMF_NO_PERMISSION 3 /* no permission for operation */ 914bff34e3Sthurlow 924bff34e3Sthurlow #define SCH_STATE_UNINIT 0 934bff34e3Sthurlow #define SCH_STATE_INITIALIZING 1 944bff34e3Sthurlow #define SCH_STATE_INIT 2 954bff34e3Sthurlow 964bff34e3Sthurlow typedef struct smb_scfhandle { 974bff34e3Sthurlow scf_handle_t *scf_handle; 984bff34e3Sthurlow int scf_state; 994bff34e3Sthurlow scf_service_t *scf_service; 1004bff34e3Sthurlow scf_scope_t *scf_scope; 1014bff34e3Sthurlow scf_transaction_t *scf_trans; 1024bff34e3Sthurlow scf_transaction_entry_t *scf_entry; 1034bff34e3Sthurlow scf_propertygroup_t *scf_pg; 1044bff34e3Sthurlow scf_instance_t *scf_instance; 1054bff34e3Sthurlow scf_iter_t *scf_inst_iter; 1064bff34e3Sthurlow scf_iter_t *scf_pg_iter; 1074bff34e3Sthurlow } smb_scfhandle_t; 1084bff34e3Sthurlow 1094bff34e3Sthurlow extern void smb_smf_scf_fini(smb_scfhandle_t *); 1104bff34e3Sthurlow extern smb_scfhandle_t *smb_smf_scf_init(char *); 1114bff34e3Sthurlow extern int smb_smf_get_instance(smb_scfhandle_t *, char *); 1124bff34e3Sthurlow extern int smb_smf_create_instance(smb_scfhandle_t *, char *); 1134bff34e3Sthurlow extern int smb_smf_start_transaction(smb_scfhandle_t *); 1144bff34e3Sthurlow extern int smb_smf_end_transaction(smb_scfhandle_t *); 1154bff34e3Sthurlow 1164bff34e3Sthurlow extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *); 1174bff34e3Sthurlow extern int smb_smf_get_string_property(smb_scfhandle_t *, char *, 1184bff34e3Sthurlow char *, size_t); 1194bff34e3Sthurlow extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t); 1204bff34e3Sthurlow extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *); 1214bff34e3Sthurlow extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t); 1224bff34e3Sthurlow extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *); 1234bff34e3Sthurlow extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *, 1244bff34e3Sthurlow void *, size_t); 1254bff34e3Sthurlow extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *, 1264bff34e3Sthurlow void *, size_t); 1274bff34e3Sthurlow 1284bff34e3Sthurlow extern int smb_smf_create_service_pgroup(smb_scfhandle_t *, char *); 1294bff34e3Sthurlow extern int smb_smf_delete_service_pgroup(smb_scfhandle_t *, char *); 1304bff34e3Sthurlow extern int smb_smf_create_instance_pgroup(smb_scfhandle_t *, char *); 1314bff34e3Sthurlow extern int smb_smf_delete_instance_pgroup(smb_scfhandle_t *, char *); 1324bff34e3Sthurlow extern int smb_smf_delete_property(smb_scfhandle_t *, char *); 1334bff34e3Sthurlow extern int smb_smf_instance_exists(smb_scfhandle_t *, char *); 1344bff34e3Sthurlow extern int smb_smf_instance_create(smb_scfhandle_t *, char *, char *); 1354bff34e3Sthurlow extern int smb_smf_instance_delete(smb_scfhandle_t *, char *); 1364bff34e3Sthurlow extern smb_scfhandle_t *smb_smf_get_iterator(char *); 1374bff34e3Sthurlow 1384bff34e3Sthurlow #ifdef __cplusplus 1394bff34e3Sthurlow } 1404bff34e3Sthurlow #endif 1414bff34e3Sthurlow 1424bff34e3Sthurlow #endif /* _LIBSHARE_SMBFS_H */ 143