mlsvc.h revision b89a8333f5e1f75ec0c269b22524bd2eccb972ba
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SMBSRV_MLSVC_H
#define _SMBSRV_MLSVC_H
/*
* MLSVC RPC layer public interface definitions.
*/
#include <smbsrv/wintypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* RPC strings
*
* DCE RPC strings (CAE section 14.3.4) are represented as varying or
* varying and conformant one-dimensional arrays. Characters can be
* single-byte or multi-byte as long as all characters conform to a
* fixed element size, i.e. UCS-2 is okay but UTF-8 is not a valid
* DCE RPC string format. The string is terminated by a null character
* of the appropriate element size.
*
* MSRPC strings are always varying and conformant format and not null
* terminated. This format uses the size_is, first_is and length_is
* attributes (CAE section 4.2.18).
*
* typedef struct mlrpc_string {
* DWORD size_is;
* DWORD first_is;
* DWORD length_is;
* wchar_t string[ANY_SIZE_ARRAY];
* } mlrpc_string_t;
*
* The size_is attribute is used to specify the number of data elements
* in each dimension of an array.
*
* The first_is attribute is used to define the lower bound for
* significant elements in each dimension of an array. For strings
* this is always 0.
*
* The length_is attribute is used to define the number of significant
* elements in each dimension of an array. For strings this is typically
* the same as size_is. Although it might be (size_is - 1) if the string
* is null terminated.
*
* In MSRPC, Unicode strings are not null terminated. This means
* that the recipient has to manually null-terminate the string after
* it has been unmarshalled. Note that there is often a wide-char pad
* following a string. Although the padding sometimes contains zero,
* it's not guaranteed.
*
* 4 bytes 4 bytes 4 bytes 2bytes 2bytes 2bytes 2bytes
* +---------+---------+---------+------+------+------+------+
* |size_is |first_is |length_is| char | char | char | char |
* +---------+---------+---------+------+------+------+------+
*
* The problem is that some strings are null terminated. This seems
* to conflict with the statement above that Unicode strings are not
* null terminated, which may be a historical thing from earlier
* implementations or it may be that different services do different
* things. So there is an additional string wrapper with two more
* fields used in some RPC structures as shown below (LPTSTR is
* automatically converted to mlrpc_string by the NDR marshalling).
*
* typedef struct ms_string {
* WORD length;
* WORD maxlen;
* LPTSTR str;
* } ms_string_t;
*
* Here, length is the array length in bytes excluding any terminating
* null bytes and maxlen is the array length in bytes including null
* terminator bytes.
*/
typedef struct mlsvc_string {
/*
* The maximum number of domains (NT limit).
*/
#define MLSVC_DOMAIN_MAX 32
/* 32-byte machine account password (null-terminated) */
/*
* Status code returned from enumeration RPCs to indicate
* that the server has no more data. Normally returned at
* severity level ERROR_SEVERITY_WARNING.
*/
#define MLSVC_NO_MORE_DATA 0x1A
#define MLSVC_ANON_USER "IPC$"
/*
* Passthrough negotiation and authentication interface.
*
* NT supports two forms of password: a Lanman (case-insensitive)
* password and an NT (case-sensitive) password. If either of the
* passwords is not available its pointer and length should be set
* to zero. The session key and vc number are required to validate
* the encrypted passwords.
*/
int outmax);
/*
* RPC request processing interface (mlsvc_server.c).
*/
#define MLSVC_MAX_IOVEC 512
typedef struct mlrpc_frag {
struct mlrpc_frag *next;
} mlrpc_frag_t;
typedef struct mlsvc_stream {
unsigned int nfrag;
typedef struct mlsvc_pipe {
char *pipe_name;
} mlsvc_pipe_t;
#ifdef __cplusplus
}
#endif
#endif /* _SMBSRV_MLSVC_H */