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