xref: /onnv-gate/usr/src/uts/common/smbsrv/nmpipes.h (revision 11963:061945695ce1)
15331Samw /*
25331Samw  * CDDL HEADER START
35331Samw  *
45331Samw  * The contents of this file are subject to the terms of the
55331Samw  * Common Development and Distribution License (the "License").
65331Samw  * You may not use this file except in compliance with the License.
75331Samw  *
85331Samw  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95331Samw  * or http://www.opensolaris.org/os/licensing.
105331Samw  * See the License for the specific language governing permissions
115331Samw  * and limitations under the License.
125331Samw  *
135331Samw  * When distributing Covered Code, include this CDDL HEADER in each
145331Samw  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155331Samw  * If applicable, add the following below this CDDL HEADER, with the
165331Samw  * fields enclosed by brackets "[]" replaced with your own identifying
175331Samw  * information: Portions Copyright [yyyy] [name of copyright owner]
185331Samw  *
195331Samw  * CDDL HEADER END
205331Samw  */
215331Samw /*
22*11963SAfshin.Ardakani@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
235331Samw  * Use is subject to license terms.
245331Samw  */
255331Samw 
265331Samw #ifndef _SMBSRV_NMPIPES_H
275331Samw #define	_SMBSRV_NMPIPES_H
285331Samw 
295331Samw /*
305331Samw  * This file defines pre-defined and system common named pipes.
315331Samw  *
325331Samw  * Named pipes are a simple IPC mechanism supported by Windows 9x, NT
335331Samw  * and 2000. The Windows named pipe implementation supports reliable
345331Samw  * one-way and two-way transport independent network messaging. The
355331Samw  * names follow the universal naming convention (UNC) defined for the
365331Samw  * Windows redirector: \\[server]\[share]\[path]name. There is a good
375331Samw  * overview of named pipes in Network Programming for Microsoft Windows
385331Samw  * Chapter 4. The redirector is described in Chapter 2. UNC names are
395331Samw  * case-insensitive.
405331Samw  *
415331Samw  * Network Programming for Microsoft Windows
425331Samw  * Anthony Jones and Jim Ohlund
435331Samw  * Microsoft Press, ISBN 0-7356-0560-2
445331Samw  *
455331Samw  * Microsoft RPC, which is derived from DCE RPC, uses SMB named pipes
465331Samw  * as its transport mechanism. In addition to the pipe used to open
475331Samw  * each connection, a named pipe also appears in the bind response as
485331Samw  * a secondary address port. Sometimes the secondary address port is
495331Samw  * the same and sometimes it is different. The following associations
505331Samw  * have been observed.
515331Samw  *
525331Samw  *		LSARPC		lsass
535331Samw  *		NETLOGON	lsass
545331Samw  *		SAMR		lsass
555331Samw  *		SPOOLSS		spoolss
565331Samw  *		SRVSVC		ntsvcs
575331Samw  *		SVCCTL		ntsvcs
585331Samw  *		WINREG		winreg
595331Samw  *		WKSSVC		ntsvcs
605331Samw  *		EVENTLOG	ntsvcs
615331Samw  *		LLSRPC		llsrpc
625331Samw  *
635331Samw  * Further information on RPC named pipes is available in the following
645331Samw  * references.
655331Samw  *
665331Samw  * RPC for NT
675331Samw  * Guy R. Eddon
685331Samw  * R&D PUblications, ISBN 0-87930-450-2
695331Samw  *
705331Samw  * Network Programming in Windows NT
715331Samw  * Alok K. Sinha
725331Samw  * Addison-Wesley, ISBN 0-201-59056-5
735331Samw  *
745331Samw  * DCE/RPC over SMB Samba and Windows NT Domain Internals
755331Samw  * Luke Kenneth Casson Leighton
765331Samw  * Macmillan Technical Publishing, ISBN 1-57870-150-3
775331Samw  */
785331Samw 
795331Samw 
805331Samw #ifdef __cplusplus
815331Samw extern "C" {
825331Samw #endif
835331Samw 
845331Samw 
855331Samw /*
865331Samw  * Well-known or pre-defined Windows named pipes. Typically used
875331Samw  * with SmbNtCreateAndX and/or SmbTransactNmPipe. When passed to
885331Samw  * SmbNtCreateAndX the \PIPE prefix is often missing. These names
895331Samw  * are presented as observed on the wire but should be treated in
905331Samw  * a case-insensitive manner.
915331Samw  */
925331Samw #define	PIPE_LANMAN			"\\PIPE\\LANMAN"
935331Samw #define	PIPE_NETLOGON			"\\PIPE\\NETLOGON"
945331Samw #define	PIPE_LSARPC			"\\PIPE\\lsarpc"
955331Samw #define	PIPE_SAMR			"\\PIPE\\samr"
965331Samw #define	PIPE_SPOOLSS			"\\PIPE\\spoolss"
975331Samw #define	PIPE_SRVSVC			"\\PIPE\\srvsvc"
985331Samw #define	PIPE_SVCCTL			"\\PIPE\\svcctl"
995331Samw #define	PIPE_WINREG			"\\PIPE\\winreg"
1005331Samw #define	PIPE_WKSSVC			"\\PIPE\\wkssvc"
1015331Samw #define	PIPE_EVENTLOG			"\\PIPE\\EVENTLOG"
1025331Samw #define	PIPE_LSASS			"\\PIPE\\lsass"
1035331Samw #define	PIPE_NTSVCS			"\\PIPE\\ntsvcs"
1045331Samw #define	PIPE_ATSVC			"\\PIPE\\atsvc"
1055331Samw #define	PIPE_BROWSESS			"\\PIPE\\browsess"
1065331Samw #define	PIPE_WINSSVC			"\\PIPE\\winssvc"
1075331Samw #define	PIPE_WINSMGR			"\\PIPE\\winsmgr"
1085331Samw #define	PIPE_LLSRPC			"\\PIPE\\llsrpc"
1095331Samw #define	PIPE_REPL			"\\PIPE\\repl"
110*11963SAfshin.Ardakani@Sun.COM #define	PIPE_NETDFS			"\\PIPE\\netdfs"
1115331Samw 
1125331Samw /*
11310966SJordan.Brown@Sun.COM  * Named pipe function codes (NTDDK).
1145331Samw  */
1155331Samw #define	TRANS_SET_NMPIPE_STATE		0x01
1165331Samw #define	TRANS_RAW_READ_NMPIPE		0x11
1175331Samw #define	TRANS_QUERY_NMPIPE_STATE	0x21
1185331Samw #define	TRANS_QUERY_NMPIPE_INFO		0x22
1195331Samw #define	TRANS_PEEK_NMPIPE		0x23
1205331Samw #define	TRANS_TRANSACT_NMPIPE		0x26
1215331Samw #define	TRANS_RAW_WRITE_NMPIPE		0x31
1225331Samw #define	TRANS_READ_NMPIPE		0x36
1235331Samw #define	TRANS_WRITE_NMPIPE		0x37
1245331Samw #define	TRANS_WAIT_NMPIPE		0x53
1255331Samw #define	TRANS_CALL_NMPIPE		0x54
1265331Samw 
1275331Samw /*
1285331Samw  * SMB pipe handle state bits used by Query/SetNamedPipeHandleState.
1295331Samw  * These numbers are the bit locations of the fields in the handle state.
1305331Samw  */
1315331Samw #define	PIPE_COMPLETION_MODE_BITS	15
1325331Samw #define	PIPE_PIPE_END_BITS		14
1335331Samw #define	PIPE_PIPE_TYPE_BITS		10
1345331Samw #define	PIPE_READ_MODE_BITS		8
1355331Samw #define	PIPE_MAXIMUM_INSTANCES_BITS	0
1365331Samw 
1375331Samw /*
1385331Samw  * DosPeekNmPipe pipe states.
1395331Samw  */
1405331Samw #define	PIPE_STATE_DISCONNECTED		0x0001
1415331Samw #define	PIPE_STATE_LISTENING		0x0002
1425331Samw #define	PIPE_STATE_CONNECTED		0x0003
1435331Samw #define	PIPE_STATE_CLOSING		0x0004
1445331Samw 
1455331Samw /*
1465331Samw  * DosCreateNPipe and DosQueryNPHState state.
1475331Samw  */
1485331Samw #define	SMB_PIPE_READMODE_BYTE		0x0000
1495331Samw #define	SMB_PIPE_READMODE_MESSAGE	0x0100
1505331Samw #define	SMB_PIPE_TYPE_BYTE		0x0000
1515331Samw #define	SMB_PIPE_TYPE_MESSAGE		0x0400
1525331Samw #define	SMB_PIPE_END_CLIENT		0x0000
1535331Samw #define	SMB_PIPE_END_SERVER		0x4000
1545331Samw #define	SMB_PIPE_WAIT			0x0000
1555331Samw #define	SMB_PIPE_NOWAIT			0x8000
1565331Samw #define	SMB_PIPE_UNLIMITED_INSTANCES	0x00FF
1575331Samw 
1585331Samw 
1595331Samw #ifdef __cplusplus
1605331Samw }
1615331Samw #endif
1625331Samw 
1635331Samw 
1645331Samw #endif /* _SMBSRV_NMPIPES_H */
165