19fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /* 29fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * CDDL HEADER START 39fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * 49fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * The contents of this file are subject to the terms of the 59fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * Common Development and Distribution License (the "License"). 69fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * You may not use this file except in compliance with the License. 79fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * 89fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * or http://www.opensolaris.org/os/licensing. 109fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * See the License for the specific language governing permissions 119fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * and limitations under the License. 129fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * 139fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * When distributing Covered Code, include this CDDL HEADER in each 149fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * If applicable, add the following below this CDDL HEADER, with the 169fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * fields enclosed by brackets "[]" replaced with your own identifying 179fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * information: Portions Copyright [yyyy] [name of copyright owner] 189fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * 199fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * CDDL HEADER END 209fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States */ 219fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /* 22148c5f43SAlan Wright * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 23*a90cf9f2SGordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved. 249fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States */ 259fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 269fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #ifndef _SMBSRV_SMB_DOOR_H 279fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define _SMBSRV_SMB_DOOR_H 289fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 299fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #include <sys/door.h> 309fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #include <smbsrv/wintypes.h> 319fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #include <smbsrv/smb_xdr.h> 329fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #include <smbsrv/smb_token.h> 339fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 349fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #ifdef __cplusplus 359fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States extern "C" { 369fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #endif 379fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 389fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define SMBD_DOOR_NAME "/var/run/smbd_door" 399fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 409fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define SMB_DOOR_CALL_RETRIES 3 419fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 429fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /* 439fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * Opcodes for smbd door. 449fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * 459fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * SMB_DR_NULL is the equivalent of the NULL RPC. It ensures that an 469fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * opcode of zero is not misinterpreted as an operational door call 479fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * and it is available as a test interface. 489fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * 499fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * SMB_DR_ASYNC_RESPONSE delivers the response part of an asynchronous 509fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * request and must be processed as a synchronous request. 51*a90cf9f2SGordon Ross * 52*a90cf9f2SGordon Ross * See also: smb_doorhdr_opname() 539fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States */ 549fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef enum smb_dopcode { 559fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_NULL = 0, 569fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_ASYNC_RESPONSE, 579fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_USER_AUTH_LOGON, 589fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_USER_NONAUTH_LOGON, 599fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_USER_AUTH_LOGOFF, 609fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_LOOKUP_SID, 619fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_LOOKUP_NAME, 629fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_JOIN, 639fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_GET_DCINFO, 649fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_VSS_GET_COUNT, 659fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_VSS_GET_SNAPSHOTS, 669fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_VSS_MAP_GMTTOKEN, 679fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_ADS_FIND_HOST, 689fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_QUOTA_QUERY, 699fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States SMB_DR_QUOTA_SET, 70148c5f43SAlan Wright SMB_DR_DFS_GET_REFERRALS, 71148c5f43SAlan Wright SMB_DR_SHR_HOSTACCESS, 72b3700b07SGordon Ross SMB_DR_SHR_EXEC, 73b3700b07SGordon Ross SMB_DR_NOTIFY_DC_CHANGED 749fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } smb_dopcode_t; 759fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 769fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States struct smb_event; 779fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 789fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef struct smb_doorarg { 799fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_doorhdr_t da_hdr; 809fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States door_arg_t da_arg; 819fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States xdrproc_t da_req_xdr; 829fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States xdrproc_t da_rsp_xdr; 839fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *da_req_data; 849fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void *da_rsp_data; 859fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_dopcode_t da_opcode; 869fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States const char *da_opname; 879fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States struct smb_event *da_event; 889fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t da_flags; 899fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } smb_doorarg_t; 909fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 919fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States /* 929fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States * Door call return codes. 939fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States */ 949fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define SMB_DOP_SUCCESS 0 959fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define SMB_DOP_NOT_CALLED 1 969fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define SMB_DOP_DECODE_ERROR 2 979fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define SMB_DOP_ENCODE_ERROR 3 989fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #define SMB_DOP_EMPTYBUF 4 999fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 100b819cea2SGordon Ross #if !defined(_KERNEL) && !defined(_FAKE_KERNEL) 1019fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States char *smb_common_encode(void *, xdrproc_t, size_t *); 1029fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_common_decode(char *, size_t, xdrproc_t, void *); 1039fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States char *smb_string_encode(char *, size_t *); 1049fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_string_decode(smb_string_t *, char *, size_t); 105b819cea2SGordon Ross #endif /* !_KERNEL */ 106b819cea2SGordon Ross 107b819cea2SGordon Ross /* libfksmbsrv "kdoor" callback to smbd-d */ 108b819cea2SGordon Ross typedef int fksmb_kdoor_disp_func_t(smb_doorarg_t *); 109b819cea2SGordon Ross 110b819cea2SGordon Ross /* libfksmbsrv "opipe" callback to smbd-d */ 111b819cea2SGordon Ross typedef int fksmb_opipe_disp_func_t(door_arg_t *); 1129fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 113148c5f43SAlan Wright /* 114148c5f43SAlan Wright * Legacy door interface 115148c5f43SAlan Wright */ 116148c5f43SAlan Wright #define SMB_SHARE_DNAME "/var/run/smb_share_door" 117148c5f43SAlan Wright #define SMB_SHARE_DSIZE (65 * 1024) 118148c5f43SAlan Wright 119148c5f43SAlan Wright /* 120148c5f43SAlan Wright * door operations 121148c5f43SAlan Wright */ 122148c5f43SAlan Wright #define SMB_SHROP_NUM_SHARES 1 123148c5f43SAlan Wright #define SMB_SHROP_DELETE 2 124148c5f43SAlan Wright #define SMB_SHROP_RENAME 3 125148c5f43SAlan Wright #define SMB_SHROP_ADD 4 126148c5f43SAlan Wright #define SMB_SHROP_MODIFY 5 127148c5f43SAlan Wright #define SMB_SHROP_LIST 6 128148c5f43SAlan Wright 129148c5f43SAlan Wright /* 130148c5f43SAlan Wright * Door server status 131148c5f43SAlan Wright * 132148c5f43SAlan Wright * SMB_SHARE_DERROR is returned by the door server if there is problem 133148c5f43SAlan Wright * with marshalling/unmarshalling. Otherwise, SMB_SHARE_DSUCCESS is 134148c5f43SAlan Wright * returned. 135148c5f43SAlan Wright * 136148c5f43SAlan Wright */ 137148c5f43SAlan Wright #define SMB_SHARE_DSUCCESS 0 138148c5f43SAlan Wright #define SMB_SHARE_DERROR -1 139148c5f43SAlan Wright 1409fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States typedef struct smb_dr_ctx { 1419fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States char *ptr; 1429fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States char *start_ptr; 1439fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States char *end_ptr; 1449fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int status; 1459fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } smb_dr_ctx_t; 1469fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1479fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_dr_ctx_t *smb_dr_decode_start(char *, int); 1489fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_dr_decode_finish(smb_dr_ctx_t *); 1499fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1509fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States smb_dr_ctx_t *smb_dr_encode_start(char *, int); 1519fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_dr_encode_finish(smb_dr_ctx_t *, unsigned int *); 1529fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1539fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int32_t smb_dr_get_int32(smb_dr_ctx_t *); 1549fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States DWORD smb_dr_get_dword(smb_dr_ctx_t *); 1559fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint32_t smb_dr_get_uint32(smb_dr_ctx_t *); 1569fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int64_t smb_dr_get_int64(smb_dr_ctx_t *); 1579fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States uint64_t smb_dr_get_uint64(smb_dr_ctx_t *); 1589fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States unsigned short smb_dr_get_ushort(smb_dr_ctx_t *); 1599fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1609fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_int32(smb_dr_ctx_t *, int32_t); 1619fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_dword(smb_dr_ctx_t *, DWORD); 1629fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_uint32(smb_dr_ctx_t *, uint32_t); 1639fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_int64(smb_dr_ctx_t *, int64_t); 1649fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_uint64(smb_dr_ctx_t *, uint64_t); 1659fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_ushort(smb_dr_ctx_t *, unsigned short); 1669fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1679fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States char *smb_dr_get_string(smb_dr_ctx_t *); 1689fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_string(smb_dr_ctx_t *, const char *); 1699fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_free_string(char *); 1709fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1719fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_word(smb_dr_ctx_t *, WORD); 1729fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States WORD smb_dr_get_word(smb_dr_ctx_t *); 1739fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1749fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_BYTE(smb_dr_ctx_t *, BYTE); 1759fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States BYTE smb_dr_get_BYTE(smb_dr_ctx_t *); 1769fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1779fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States void smb_dr_put_buf(smb_dr_ctx_t *, unsigned char *, int); 1789fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States int smb_dr_get_buf(smb_dr_ctx_t *, unsigned char *, int); 1799fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 180148c5f43SAlan Wright void smb_dr_get_share(smb_dr_ctx_t *, smb_share_t *); 181148c5f43SAlan Wright void smb_dr_put_share(smb_dr_ctx_t *, smb_share_t *); 182148c5f43SAlan Wright 183148c5f43SAlan Wright void smb_share_door_clnt_init(void); 184148c5f43SAlan Wright void smb_share_door_clnt_fini(void); 185148c5f43SAlan Wright 1869fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #ifdef __cplusplus 1879fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States } 1889fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #endif 1899fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States 1909fb67ea3Safshin salek ardakani - Sun Microsystems - Irvine United States #endif /* _SMBSRV_SMB_DOOR_H */ 191