/*
* 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 2014 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SMBSRV_SMB_DOOR_H
#define _SMBSRV_SMB_DOOR_H
#include <smbsrv/wintypes.h>
#include <smbsrv/smb_token.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Opcodes for smbd door.
*
* SMB_DR_NULL is the equivalent of the NULL RPC. It ensures that an
* opcode of zero is not misinterpreted as an operational door call
* and it is available as a test interface.
*
* SMB_DR_ASYNC_RESPONSE delivers the response part of an asynchronous
* request and must be processed as a synchronous request.
*
* See also: smb_doorhdr_opname()
*/
typedef enum smb_dopcode {
SMB_DR_NULL = 0,
struct smb_event;
typedef struct smb_doorarg {
void *da_req_data;
void *da_rsp_data;
const char *da_opname;
/*
* Door call return codes.
*/
#define SMB_DOP_SUCCESS 0
#if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
char *smb_string_encode(char *, size_t *);
#endif /* !_KERNEL */
/* libfksmbsrv "kdoor" callback to smbd-d */
/* libfksmbsrv "opipe" callback to smbd-d */
/*
* Legacy door interface
*/
/*
* door operations
*/
/*
* Door server status
*
* SMB_SHARE_DERROR is returned by the door server if there is problem
* with marshalling/unmarshalling. Otherwise, SMB_SHARE_DSUCCESS is
* returned.
*
*/
#define SMB_SHARE_DSUCCESS 0
typedef struct smb_dr_ctx {
char *ptr;
char *start_ptr;
char *end_ptr;
int status;
} smb_dr_ctx_t;
smb_dr_ctx_t *smb_dr_decode_start(char *, int);
int smb_dr_decode_finish(smb_dr_ctx_t *);
smb_dr_ctx_t *smb_dr_encode_start(char *, int);
int smb_dr_encode_finish(smb_dr_ctx_t *, unsigned int *);
unsigned short smb_dr_get_ushort(smb_dr_ctx_t *);
void smb_dr_put_ushort(smb_dr_ctx_t *, unsigned short);
char *smb_dr_get_string(smb_dr_ctx_t *);
void smb_dr_put_string(smb_dr_ctx_t *, const char *);
void smb_dr_free_string(char *);
void smb_dr_put_buf(smb_dr_ctx_t *, unsigned char *, int);
int smb_dr_get_buf(smb_dr_ctx_t *, unsigned char *, int);
void smb_share_door_clnt_init(void);
void smb_share_door_clnt_fini(void);
#ifdef __cplusplus
}
#endif
#endif /* _SMBSRV_SMB_DOOR_H */