xref: /titanic_44/usr/src/uts/common/smbsrv/nmpipes.h (revision 0dc2366f7b9f9f36e10909b1e95edbf2a261c2ac)
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 2009 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 
111 /*
112  * Named pipe function codes (NTDDK).
113  */
114 #define	TRANS_SET_NMPIPE_STATE		0x01
115 #define	TRANS_RAW_READ_NMPIPE		0x11
116 #define	TRANS_QUERY_NMPIPE_STATE	0x21
117 #define	TRANS_QUERY_NMPIPE_INFO		0x22
118 #define	TRANS_PEEK_NMPIPE		0x23
119 #define	TRANS_TRANSACT_NMPIPE		0x26
120 #define	TRANS_RAW_WRITE_NMPIPE		0x31
121 #define	TRANS_READ_NMPIPE		0x36
122 #define	TRANS_WRITE_NMPIPE		0x37
123 #define	TRANS_WAIT_NMPIPE		0x53
124 #define	TRANS_CALL_NMPIPE		0x54
125 
126 /*
127  * SMB pipe handle state bits used by Query/SetNamedPipeHandleState.
128  * These numbers are the bit locations of the fields in the handle state.
129  */
130 #define	PIPE_COMPLETION_MODE_BITS	15
131 #define	PIPE_PIPE_END_BITS		14
132 #define	PIPE_PIPE_TYPE_BITS		10
133 #define	PIPE_READ_MODE_BITS		8
134 #define	PIPE_MAXIMUM_INSTANCES_BITS	0
135 
136 /*
137  * DosPeekNmPipe pipe states.
138  */
139 #define	PIPE_STATE_DISCONNECTED		0x0001
140 #define	PIPE_STATE_LISTENING		0x0002
141 #define	PIPE_STATE_CONNECTED		0x0003
142 #define	PIPE_STATE_CLOSING		0x0004
143 
144 /*
145  * DosCreateNPipe and DosQueryNPHState state.
146  */
147 #define	SMB_PIPE_READMODE_BYTE		0x0000
148 #define	SMB_PIPE_READMODE_MESSAGE	0x0100
149 #define	SMB_PIPE_TYPE_BYTE		0x0000
150 #define	SMB_PIPE_TYPE_MESSAGE		0x0400
151 #define	SMB_PIPE_END_CLIENT		0x0000
152 #define	SMB_PIPE_END_SERVER		0x4000
153 #define	SMB_PIPE_WAIT			0x0000
154 #define	SMB_PIPE_NOWAIT			0x8000
155 #define	SMB_PIPE_UNLIMITED_INSTANCES	0x00FF
156 
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 
163 #endif /* _SMBSRV_NMPIPES_H */
164