1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SMBSRV_SVRAPI_H 27 #define _SMBSRV_SVRAPI_H 28 29 /* 30 * This file provides definitions for the SMB Net interface. On Windows 31 * this would be NetAccess, NetConnection, NetFile, NetServer, 32 * NetSession, NetShare and NetSecurity but here things are a limited. 33 * This stuff should be described in Windows 9x LanMan documentation. 34 * 35 * Notes: 36 * Lengths of ASCIIZ strings are given as the maximum strlen() value. 37 * This does not include space for the terminating 0-byte. When 38 * allocating space for such an item, use the form: 39 * 40 * char username[LM20_UNLEN+1]; 41 * 42 * An exception to this is PATHLEN, which does include space for the 43 * terminating 0-byte. 44 * 45 * User names, computer names and share names should be upper-cased 46 * by the caller and drawn from the ANSI character set. 47 */ 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 54 /* 55 * Server Class (NetServerGetInfo, NetServerEnum2) 56 */ 57 58 struct server_info_0 { 59 char sv0_name[CNLEN + 1]; /* Server name */ 60 }; /* server_info_0 */ 61 62 63 struct server_info_1 { 64 char sv1_name[CNLEN + 1]; /* Server name */ 65 unsigned char sv1_version_major; /* Major version # of net */ 66 unsigned char sv1_version_minor; /* Minor version # of net */ 67 uint32_t sv1_type; /* Server type */ 68 char *sv1_comment; /* Exported server comment */ 69 }; /* server_info_1 */ 70 71 72 /* NOTE struct prefix must equal server_info_1 format */ 73 74 struct server_info_50 { 75 char sv50_name[CNLEN + 1]; 76 unsigned char sv50_version_major; /* Major version # of net */ 77 unsigned char sv50_version_minor; /* Minor version # of net */ 78 uint32_t sv50_type; /* Server type */ 79 char *sv50_comment; /* Exported server comment */ 80 unsigned short sv50_security; /* SV_SECURITY_* (see below) */ 81 unsigned short sv50_auditing; /* 0 = no auditing; !0 = auditing */ 82 char *sv50_container; /* Security server/domain */ 83 char *sv50_ab_server; /* Address book server */ 84 char *sv50_ab_dll; /* Address book provider DLL */ 85 }; /* server_info_50 */ 86 87 88 struct server_info_2 { 89 char sv2_name[CNLEN + 1]; 90 unsigned char sv2_version_major; 91 unsigned char sv2_version_minor; 92 uint32_t sv2_type; 93 char *sv2_comment; 94 uint32_t sv2_ulist_mtime; /* User list, last modification time */ 95 uint32_t sv2_glist_mtime; /* Group list, last modification time */ 96 uint32_t sv2_alist_mtime; /* Access list, last modification time */ 97 uint16_t sv2_users; /* max number of users allowed */ 98 uint16_t sv2_disc; /* auto-disconnect timeout(in minutes) */ 99 char *sv2_alerts; /* alert names (semicolon separated) */ 100 uint16_t sv2_security; /* SV_USERSECURITY or SV_SHARESECURITY */ 101 uint16_t sv2_auditing; /* 0 = no auditing; nonzero = auditing */ 102 103 uint16_t sv2_numadmin; /* max number of administrators allowed */ 104 uint16_t sv2_lanmask; /* bit mask representing the srv'd nets */ 105 uint16_t sv2_hidden; /* 0 = visible; nonzero = hidden */ 106 uint16_t sv2_announce; /* visible server announce rate (sec) */ 107 uint16_t sv2_anndelta; /* announce randomize interval (sec) */ 108 /* name of guest account */ 109 char sv2_guestacct[LM20_UNLEN + 1]; 110 unsigned char sv2_pad1; /* Word alignment pad byte */ 111 char *sv2_userpath; /* ASCIIZ path to user directories */ 112 uint16_t sv2_chdevs; /* max # shared character devices */ 113 uint16_t sv2_chdevq; /* max # character device queues */ 114 uint16_t sv2_chdevjobs; /* max # character device jobs */ 115 uint16_t sv2_connections; /* max # of connections */ 116 uint16_t sv2_shares; /* max # of shares */ 117 uint16_t sv2_openfiles; /* max # of open files */ 118 uint16_t sv2_sessopens; /* max # of open files per session */ 119 uint16_t sv2_sessvcs; /* max # of virtual circuits per client */ 120 uint16_t sv2_sessreqs; /* max # of simul. reqs. from a client */ 121 uint16_t sv2_opensearch; /* max # of open searches */ 122 uint16_t sv2_activelocks; /* max # of active file locks */ 123 uint16_t sv2_numreqbuf; /* number of server (standard) buffers */ 124 uint16_t sv2_sizreqbuf; /* size of svr (standard) bufs (bytes) */ 125 uint16_t sv2_numbigbuf; /* number of big (64K) buffers */ 126 uint16_t sv2_numfiletasks; /* number of file worker processes */ 127 uint16_t sv2_alertsched; /* alert counting interval (minutes) */ 128 uint16_t sv2_erroralert; /* error log alerting threshold */ 129 uint16_t sv2_logonalert; /* logon violation alerting threshold */ 130 uint16_t sv2_accessalert; /* access violation alerting threshold */ 131 uint16_t sv2_diskalert; /* low disk space alert threshold (KB) */ 132 uint16_t sv2_netioalert; /* net I/O error ratio alert threshold */ 133 /* (tenths of a percent) */ 134 uint16_t sv2_maxauditsz; /* Maximum audit file size (KB) */ 135 char *sv2_srvheuristics; /* performance related server switches */ 136 }; /* server_info_2 */ 137 138 139 struct server_info_3 { 140 char sv3_name[CNLEN + 1]; 141 unsigned char sv3_version_major; 142 unsigned char sv3_version_minor; 143 uint32_t sv3_type; 144 char *sv3_comment; 145 uint32_t sv3_ulist_mtime; /* User list, last modification time */ 146 uint32_t sv3_glist_mtime; /* Group list, last modification time */ 147 uint32_t sv3_alist_mtime; /* Access list, last modification time */ 148 uint16_t sv3_users; /* max number of users allowed */ 149 uint16_t sv3_disc; /* auto-disconnect timeout(in minutes) */ 150 char *sv3_alerts; /* alert names (semicolon separated) */ 151 uint16_t sv3_security; /* SV_USERSECURITY or SV_SHARESECURITY */ 152 uint16_t sv3_auditing; /* 0 = no auditing; nonzero = auditing */ 153 154 uint16_t sv3_numadmin; /* max number of administrators allowed */ 155 uint16_t sv3_lanmask; /* bit mask representing the srv'd nets */ 156 uint16_t sv3_hidden; /* 0 = visible; nonzero = hidden */ 157 uint16_t sv3_announce; /* visible server announce rate (sec) */ 158 uint16_t sv3_anndelta; /* announce randomize interval (sec) */ 159 /* name of guest account */ 160 char sv3_guestacct[LM20_UNLEN + 1]; 161 unsigned char sv3_pad1; /* Word alignment pad byte */ 162 char *sv3_userpath; /* ASCIIZ path to user directories */ 163 uint16_t sv3_chdevs; /* max # shared character devices */ 164 uint16_t sv3_chdevq; /* max # character device queues */ 165 uint16_t sv3_chdevjobs; /* max # character device jobs */ 166 uint16_t sv3_connections; /* max # of connections */ 167 uint16_t sv3_shares; /* max # of shares */ 168 uint16_t sv3_openfiles; /* max # of open files */ 169 uint16_t sv3_sessopens; /* max # of open files per session */ 170 uint16_t sv3_sessvcs; /* max # of virtual circuits per client */ 171 uint16_t sv3_sessreqs; /* max # of simul. reqs. from a client */ 172 uint16_t sv3_opensearch; /* max # of open searches */ 173 uint16_t sv3_activelocks; /* max # of active file locks */ 174 uint16_t sv3_numreqbuf; /* number of server (standard) buffers */ 175 uint16_t sv3_sizreqbuf; /* size of svr (standard) bufs (bytes) */ 176 uint16_t sv3_numbigbuf; /* number of big (64K) buffers */ 177 uint16_t sv3_numfiletasks; /* number of file worker processes */ 178 uint16_t sv3_alertsched; /* alert counting interval (minutes) */ 179 uint16_t sv3_erroralert; /* error log alerting threshold */ 180 uint16_t sv3_logonalert; /* logon violation alerting threshold */ 181 uint16_t sv3_accessalert; /* access violation alerting threshold */ 182 uint16_t sv3_diskalert; /* low disk space alert threshold (KB) */ 183 uint16_t sv3_netioalert; /* net I/O error ratio alert threshold */ 184 /* (tenths of a percent) */ 185 uint16_t sv3_maxauditsz; /* Maximum audit file size (KB) */ 186 char *sv3_srvheuristics; /* performance related server switches */ 187 uint32_t sv3_auditedevents; /* Audit event control mask */ 188 uint16_t sv3_autoprofile; /* (0,1,2,3) = (NONE,LOAD,SAVE,or BOTH) */ 189 char *sv3_autopath; /* file pathname (where to load & save) */ 190 }; /* server_info_3 */ 191 192 193 /* 194 * Mask to be applied to svX_version_major in order to obtain 195 * the major version number. 196 */ 197 #define MAJOR_VERSION_MASK 0x0F 198 199 200 /* 201 * Bit-mapped values for svX_type fields. X = 1, 2, 3 etc. 202 * 203 * SV_TYPE_WORKSTATION 0x00000001 All workstations 204 * SV_TYPE_SERVER 0x00000002 All servers 205 * SV_TYPE_SQLSERVER 0x00000004 Any server running with SQL 206 * server 207 * SV_TYPE_DOMAIN_CTRL 0x00000008 Primary domain controller 208 * SV_TYPE_DOMAIN_BAKCTRL 0x00000010 Backup domain controller 209 * SV_TYPE_TIME_SOURCE 0x00000020 Server running the timesource 210 * service 211 * SV_TYPE_AFP 0x00000040 Apple File Protocol servers 212 * SV_TYPE_NOVELL 0x00000080 Novell servers 213 * SV_TYPE_DOMAIN_MEMBER 0x00000100 Domain Member 214 * SV_TYPE_PRINTQ_SERVER 0x00000200 Server sharing print queue 215 * SV_TYPE_DIALIN_SERVER 0x00000400 Server running dialin service. 216 * SV_TYPE_XENIX_SERVER 0x00000800 Xenix server 217 * SV_TYPE_NT 0x00001000 NT server 218 * SV_TYPE_WFW 0x00002000 Server running Windows for 219 * Workgroups 220 * SV_TYPE_SERVER_NT 0x00008000 Windows NT non DC server 221 * SV_TYPE_POTENTIAL_BROWSER 0x00010000 Server that can run the browser 222 * service 223 * SV_TYPE_BACKUP_BROWSER 0x00020000 Backup browser server 224 * SV_TYPE_MASTER_BROWSER 0x00040000 Master browser server 225 * SV_TYPE_DOMAIN_MASTER 0x00080000 Domain Master Browser server 226 * SV_TYPE_LOCAL_LIST_ONLY 0x40000000 Enumerate only entries marked 227 * "local" 228 * SV_TYPE_DOMAIN_ENUM 0x80000000 Enumerate Domains. The pszDomain 229 * parameter must be NULL. 230 */ 231 #define SV_TYPE_WORKSTATION 0x00000001 232 #define SV_TYPE_SERVER 0x00000002 233 #define SV_TYPE_SQLSERVER 0x00000004 234 #define SV_TYPE_DOMAIN_CTRL 0x00000008 235 #define SV_TYPE_DOMAIN_BAKCTRL 0x00000010 236 #define SV_TYPE_TIME_SOURCE 0x00000020 237 #define SV_TYPE_AFP 0x00000040 238 /* Also set by Win95 NWSERVER */ 239 #define SV_TYPE_NOVELL 0x00000080 240 #define SV_TYPE_DOMAIN_MEMBER 0x00000100 241 #define SV_TYPE_PRINTQ_SERVER 0x00000200 242 #define SV_TYPE_DIALIN_SERVER 0x00000400 243 #define SV_TYPE_XENIX_SERVER 0x00000800 244 #define SV_TYPE_NT 0x00001000 245 #define SV_TYPE_WFW 0x00002000 246 #define SV_TYPE_SERVER_NT 0x00008000 247 #define SV_TYPE_POTENTIAL_BROWSER 0x00010000 248 #define SV_TYPE_BACKUP_BROWSER 0x00020000 249 #define SV_TYPE_MASTER_BROWSER 0x00040000 250 #define SV_TYPE_DOMAIN_MASTER 0x00080000 251 #define SV_TYPE_LOCAL_LIST_ONLY 0x40000000 252 #define SV_TYPE_DOMAIN_ENUM 0x80000000 253 /* Handy for NetServerEnum2 */ 254 #define SV_TYPE_ALL 0xFFFFFFFF 255 256 257 #ifdef __cplusplus 258 } 259 #endif 260 261 #endif /* _SMBSRV_SVRAPI_H */ 262