xref: /titanic_41/usr/src/uts/common/smbsrv/nmpipes.h (revision 98c080d502548e68bb9815459ea56e6ae282c430)
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 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SMBSRV_NMPIPES_H
27 #define	_SMBSRV_NMPIPES_H
28 
29 /*
30  * This file defines pre-defined and system common named pipes.
31  *
32  * Named pipes are a simple IPC mechanism supported by Windows 9x, NT
33  * and 2000. The Windows named pipe implementation supports reliable
34  * one-way and two-way transport independent network messaging. The
35  * names follow the universal naming convention (UNC) defined for the
36  * Windows redirector: \\[server]\[share]\[path]name. There is a good
37  * overview of named pipes in Network Programming for Microsoft Windows
38  * Chapter 4. The redirector is described in Chapter 2. UNC names are
39  * case-insensitive.
40  *
41  * Network Programming for Microsoft Windows
42  * Anthony Jones and Jim Ohlund
43  * Microsoft Press, ISBN 0-7356-0560-2
44  *
45  * Microsoft RPC, which is derived from DCE RPC, uses SMB named pipes
46  * as its transport mechanism. In addition to the pipe used to open
47  * each connection, a named pipe also appears in the bind response as
48  * a secondary address port. Sometimes the secondary address port is
49  * the same and sometimes it is different. The following associations
50  * have been observed.
51  *
52  *		LSARPC		lsass
53  *		NETLOGON	lsass
54  *		SAMR		lsass
55  *		SPOOLSS		spoolss
56  *		SRVSVC		ntsvcs
57  *		SVCCTL		ntsvcs
58  *		WINREG		winreg
59  *		WKSSVC		ntsvcs
60  *		EVENTLOG	ntsvcs
61  *		LLSRPC		llsrpc
62  *
63  * Further information on RPC named pipes is available in the following
64  * references.
65  *
66  * RPC for NT
67  * Guy R. Eddon
68  * R&D PUblications, ISBN 0-87930-450-2
69  *
70  * Network Programming in Windows NT
71  * Alok K. Sinha
72  * Addison-Wesley, ISBN 0-201-59056-5
73  *
74  * DCE/RPC over SMB Samba and Windows NT Domain Internals
75  * Luke Kenneth Casson Leighton
76  * Macmillan Technical Publishing, ISBN 1-57870-150-3
77  */
78 
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 
85 /*
86  * Well-known or pre-defined Windows named pipes. Typically used
87  * with SmbNtCreateAndX and/or SmbTransactNmPipe. When passed to
88  * SmbNtCreateAndX the \PIPE prefix is often missing. These names
89  * are presented as observed on the wire but should be treated in
90  * a case-insensitive manner.
91  */
92 #define	PIPE_LANMAN			"\\PIPE\\LANMAN"
93 #define	PIPE_NETLOGON			"\\PIPE\\NETLOGON"
94 #define	PIPE_LSARPC			"\\PIPE\\lsarpc"
95 #define	PIPE_SAMR			"\\PIPE\\samr"
96 #define	PIPE_SPOOLSS			"\\PIPE\\spoolss"
97 #define	PIPE_SRVSVC			"\\PIPE\\srvsvc"
98 #define	PIPE_SVCCTL			"\\PIPE\\svcctl"
99 #define	PIPE_WINREG			"\\PIPE\\winreg"
100 #define	PIPE_WKSSVC			"\\PIPE\\wkssvc"
101 #define	PIPE_EVENTLOG			"\\PIPE\\EVENTLOG"
102 #define	PIPE_LSASS			"\\PIPE\\lsass"
103 #define	PIPE_NTSVCS			"\\PIPE\\ntsvcs"
104 #define	PIPE_ATSVC			"\\PIPE\\atsvc"
105 #define	PIPE_BROWSESS			"\\PIPE\\browsess"
106 #define	PIPE_WINSSVC			"\\PIPE\\winssvc"
107 #define	PIPE_WINSMGR			"\\PIPE\\winsmgr"
108 #define	PIPE_LLSRPC			"\\PIPE\\llsrpc"
109 #define	PIPE_REPL			"\\PIPE\\repl"
110 #define	PIPE_NETDFS			"\\PIPE\\netdfs"
111 
112 /*
113  * Named pipe function codes (NTDDK).
114  */
115 #define	TRANS_SET_NMPIPE_STATE		0x01
116 #define	TRANS_RAW_READ_NMPIPE		0x11
117 #define	TRANS_QUERY_NMPIPE_STATE	0x21
118 #define	TRANS_QUERY_NMPIPE_INFO		0x22
119 #define	TRANS_PEEK_NMPIPE		0x23
120 #define	TRANS_TRANSACT_NMPIPE		0x26
121 #define	TRANS_RAW_WRITE_NMPIPE		0x31
122 #define	TRANS_READ_NMPIPE		0x36
123 #define	TRANS_WRITE_NMPIPE		0x37
124 #define	TRANS_WAIT_NMPIPE		0x53
125 #define	TRANS_CALL_NMPIPE		0x54
126 
127 /*
128  * SMB pipe handle state bits used by Query/SetNamedPipeHandleState.
129  * These numbers are the bit locations of the fields in the handle state.
130  */
131 #define	PIPE_COMPLETION_MODE_BITS	15
132 #define	PIPE_PIPE_END_BITS		14
133 #define	PIPE_PIPE_TYPE_BITS		10
134 #define	PIPE_READ_MODE_BITS		8
135 #define	PIPE_MAXIMUM_INSTANCES_BITS	0
136 
137 /*
138  * DosPeekNmPipe pipe states.
139  */
140 #define	PIPE_STATE_DISCONNECTED		0x0001
141 #define	PIPE_STATE_LISTENING		0x0002
142 #define	PIPE_STATE_CONNECTED		0x0003
143 #define	PIPE_STATE_CLOSING		0x0004
144 
145 /*
146  * DosCreateNPipe and DosQueryNPHState state.
147  */
148 #define	SMB_PIPE_READMODE_BYTE		0x0000
149 #define	SMB_PIPE_READMODE_MESSAGE	0x0100
150 #define	SMB_PIPE_TYPE_BYTE		0x0000
151 #define	SMB_PIPE_TYPE_MESSAGE		0x0400
152 #define	SMB_PIPE_END_CLIENT		0x0000
153 #define	SMB_PIPE_END_SERVER		0x4000
154 #define	SMB_PIPE_WAIT			0x0000
155 #define	SMB_PIPE_NOWAIT			0x8000
156 #define	SMB_PIPE_UNLIMITED_INSTANCES	0x00FF
157 
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 
164 #endif /* _SMBSRV_NMPIPES_H */
165