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