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