xref: /titanic_50/usr/src/lib/smbsrv/libsmbns/common/smbns_browser.h (revision 4c56998a4a895e2885b4848d6753357edccb6436)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_BROWSER_H_
27 #define	_BROWSER_H_
28 
29 /*
30  * NetBIOS name types describe the functionality of the registration.
31  * A following list of NetBIOS suffixes (16th Character of the NetBIOS
32  * Name) is detailed in Microsoft knowledge base article Q163409.
33  *
34  * Name                Number(h)  Type  Usage
35  * --------------------------------------------------------------------------
36  * <computername>         00       U    Workstation Service
37  * <computername>         01       U    Messenger Service
38  * <\\--__MSBROWSE__>     01       G    Master Browser
39  * <computername>         03       U    Messenger Service
40  * <computername>         06       U    RAS Server Service
41  * <computername>         1F       U    NetDDE Service
42  * <computername>         20       U    File Server Service
43  * <computername>         21       U    RAS Client Service
44  * <computername>         22       U    Microsoft Exchange Interchange(MSMail
45  *                                      Connector)
46  * <computername>         23       U    Microsoft Exchange Store
47  * <computername>         24       U    Microsoft Exchange Directory
48  * <computername>         30       U    Modem Sharing Server Service
49  * <computername>         31       U    Modem Sharing Client Service
50  * <computername>         43       U    SMS Clients Remote Control
51  * <computername>         44       U    SMS Administrators Remote Control
52  *                                      Tool
53  * <computername>         45       U    SMS Clients Remote Chat
54  * <computername>         46       U    SMS Clients Remote Transfer
55  * <computername>         4C       U    DEC Pathworks TCPIP service on
56  *                                      Windows NT
57  * <computername>         52       U    DEC Pathworks TCPIP service on
58  *                                      Windows NT
59  * <computername>         87       U    Microsoft Exchange Message Transfer
60  *                                      Agent
61  * <computername>         6A       U    Microsoft Exchange IMC
62  * <computername>         BE       U    Network Monitor Agent
63  * <computername>         BF       U    Network Monitor Application
64  * <username>             03       U    Messenger Service
65  * <domain>               00       G    Domain Name
66  * <domain>               1B       U    Domain Master Browser
67  * <domain>               1C       G    Domain Controllers
68  * <domain>               1D       U    Master Browser
69  * <domain>               1E       G    Browser Service Elections
70  * <INet~Services>        1C       G    IIS
71  * <IS~computer name>     00       U    IIS
72  * <computername>         [2B]     U    Lotus Notes Server Service
73  * IRISMULTICAST          [2F]     G    Lotus Notes
74  * IRISNAMESERVER         [33]     G    Lotus Notes
75  * Forte_$ND800ZA         [20]     U    DCA IrmaLan Gateway Server Service
76  *
77  * Unique (U): The name may have only one IP address assigned to it. On
78  * a network device multiple occurrences of a single name may appear to
79  * be registered. The suffix may be the only unique character in the name.
80  *
81  * Group (G): A normal group; the single name may exist with many IP
82  * addresses. WINS responds to a name query on a group name with the
83  * limited broadcast address (255.255.255.255). Because routers block
84  * the transmission of these addresses, the Internet Group was designed
85  * to service communications between subnets.
86  *
87  * Multihomed (M): The name is unique, but due to multiple network
88  * interfaces on the same computer this configuration is necessary to
89  * permit the registration. The maximum number of addresses is 25.
90  *
91  * Internet Group (I): This is a special configuration of the group name
92  * used to manage Windows NT Domain names.
93  *
94  * Domain Name (D): New in Windows NT 4.0.
95  */
96 
97 
98 #ifdef __cplusplus
99 extern "C" {
100 #endif
101 
102 
103 /*
104  * Message flags used when building the SMB transact headers.
105  */
106 #define	TWO_WAY_TRANSACTION			0x00
107 #define	END_SESSION_TRANSACTION			0x01
108 #define	ONE_WAY_TRANSACTION				0x02
109 
110 
111 /*
112  * Browser commands associated with the BROWSE and MSBROWSE mailslots.
113  */
114 #define	HOST_ANNOUNCEMENT			0x01
115 #define	ANNOUNCEMENT_REQUEST			0x02
116 #define	REQUEST_ELECTION			0x08
117 #define	GET_BACKUP_LIST_REQ			0x09
118 #define	GET_BACKUP_LIST_RESP			0x0A
119 #define	BECOME_BACKUP				0x0B
120 #define	DOMAIN_ANNOUNCEMENT			0x0C
121 #define	MASTER_ANNOUNCEMENT			0x0D
122 #define	LOCAL_MASTER_ANNOUNCEMENT		0x0F
123 
124 
125 /*
126  * Opcodes associated with NETLOGON or NTLOGON mailslots (KB 109626).
127  *	LOGON_REQUEST			LM1.0/2.0 LOGON Request from client
128  *	LOGON_RESPONSE			LM1.0 Response to LOGON_REQUEST
129  *	LOGON_CENTRAL_QUERY		LM1.0 QUERY for centralized init
130  *	LOGON_DISTRIB_QUERY		LM1.0 QUERY for non-centralized init
131  *	LOGON_CENTRAL_RESPONSE		LM1.0 response to LOGON_CENTRAL_QUERY
132  *	LOGON_DISTRIB_RESPONSE		LM1.0 resp to LOGON_DISTRIB_QUERY
133  *	LOGON_RESPONSE2			LM2.0 Response to LOGON_REQUEST
134  *	LOGON_PRIMARY_QUERY		QUERY for Primary DC
135  *	LOGON_START_PRIMARY		announce startup of Primary DC
136  *	LOGON_FAIL_PRIMARY		announce failed  Primary DC
137  *	LOGON_UAS_CHANGE		announce change to UAS or SAM
138  *	LOGON_NO_USER			announce no user on machine
139  *	LOGON_PRIMARY_RESPONSE		response to LOGON_PRIMARY_QUERY
140  *	LOGON_RELOGON_RESPONSE		LM1.0/2.0 resp to relogon request
141  *	LOGON_WKSTINFO_RESPONSE		LM1.0/2.0 resp to interrogate request
142  *	LOGON_PAUSE_RESPONSE		LM2.0 resp when NETLOGON is paused
143  *	LOGON_USER_UNKNOWN		LM2.0 response when user is unknown
144  *	LOGON_UPDATE_ACCOUNT		LM2.1 announce account updates
145  *	LOGON_SAM_LOGON_REQUEST		SAM LOGON request from client
146  *	LOGON_SAM_LOGON_RESPONSE	SAM Response to SAM logon request
147  *	LOGON_SAM_PAUSE_RESPONSE	SAM response when NETLOGON is paused
148  *	LOGON_SAM_USER_UNKNOWN		SAM response when user is unknown
149  *	LOGON_SAM_WKSTINFO_RESPONSE	SAM response to interrogate request
150  */
151 #define	LOGON_REQUEST			0
152 #define	LOGON_RESPONSE			1
153 #define	LOGON_CENTRAL_QUERY		2
154 #define	LOGON_DISTRIB_QUERY		3
155 #define	LOGON_CENTRAL_RESPONSE		4
156 #define	LOGON_DISTRIB_RESPONSE		5
157 #define	LOGON_RESPONSE2			6
158 #define	LOGON_PRIMARY_QUERY		7
159 #define	LOGON_START_PRIMARY		8
160 #define	LOGON_FAIL_PRIMARY		9
161 #define	LOGON_UAS_CHANGE		10
162 #define	LOGON_NO_USER			11
163 #define	LOGON_PRIMARY_RESPONSE		12
164 #define	LOGON_RELOGON_RESPONSE		13
165 #define	LOGON_WKSTINFO_RESPONSE		14
166 #define	LOGON_PAUSE_RESPONSE		15
167 #define	LOGON_USER_UNKNOWN		16
168 #define	LOGON_UPDATE_ACCOUNT		17
169 #define	LOGON_SAM_LOGON_REQUEST		18
170 #define	LOGON_SAM_LOGON_RESPONSE	19
171 #define	LOGON_SAM_PAUSE_RESPONSE	20
172 #define	LOGON_SAM_USER_UNKNOWN		21
173 #define	LOGON_SAM_WKSTINFO_RESPONSE	22
174 
175 
176 /*
177  * Local protocol flags used to indicate which version of the
178  * netlogon protocol to use when attempting to find the PDC.
179  */
180 #define	NETLOGON_PROTO_NETLOGON			0x01
181 #define	NETLOGON_PROTO_SAMLOGON			0x02
182 
183 typedef struct smb_ntdomain_t {
184 	char 		n_domain[SMB_PI_MAX_DOMAIN];
185 	char 		n_name[SMB_PI_MAX_DOMAIN];
186 	uint32_t	n_ipaddr;
187 } smb_ntdomain_t;
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 
194 #endif /* _BROWSER_H_ */
195