smb_kproto.h revision fe1c642d06e14b412cd83ae2179303186ab08972
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Function prototypes for the SMB module.
*/
#ifndef _SMB_KPROTO_H_
#define _SMB_KPROTO_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/socketvar.h>
#include <smbsrv/smb_vops.h>
#include <smbsrv/smb_token.h>
#include <smbsrv/smb_ktypes.h>
#include <smbsrv/smb_ioctl.h>
extern int smb_maxbufsize;
extern int smb_flush_required;
extern int smb_dirsymlink_enable;
extern int smb_oplock_timeout;
extern int smb_sign_debug;
extern uint_t smb_audit_flags;
int fd_dealloc(int);
/* Why? uint32_t inet_addr(char *str); */
int clock_get_uptime(void);
/*
* SMB request handers called from the dispatcher.
*/
#define SMB_SDT_OPS(NAME) \
#define SMB_COM_DECL(NAME) \
#define SMB_NT_TRANSACT_DECL(NAME) \
int smb_notify_init(void);
void smb_notify_fini(void);
/*
* Logging functions
*/
void smb_log_flush(void);
void smb_close_all_connections(void);
int smb_net_id(uint32_t);
/*
* macros used in oplock processing
*
* SMB_ATTR_ONLY_OPEN: Checks to see if this is
* an attribute-only open with no contravening
* dispositions. Such an open cannot effect an
* oplock break. However, a contravening disposition
* of FILE_SUPERSEDE or FILE_OVERWRITE can allow
* an oplock break.
*/
#define SMB_ATTR_ONLY_OPEN(op) \
FILE_WRITE_ATTRIBUTES | SYNCHRONIZE)) == 0) && \
int smb_mangle_name(ino64_t, char *, char *, char *, int);
int smb_maybe_mangled_name(char *);
int smb_maybe_mangled_path(const char *, size_t);
int smb_needs_mangle(char *, char **);
boolean_t smb_is_invalid_filename(const char *);
int smbsr_connect_tree(smb_request_t *);
void smb_convert_wildcards(char *);
boolean_t smb_contains_wildcards(const char *);
int smb_ascii_or_unicode_strlen(smb_request_t *, char *);
int smb_ascii_or_unicode_strlen_null(smb_request_t *, char *);
int smb_search(smb_request_t *);
boolean_t smb_is_stream_name(char *);
void smb_stream_parse_name(char *, char *, char *);
void sshow_distribution_info(char *);
void smbsr_lookup_file(smb_request_t *);
void smbsr_release_file(smb_request_t *);
int smbsr_encode_result(smb_request_t *, int, int, char *, ...);
void smbsr_send_reply(smb_request_t *);
void smbsr_map_errno(int, smb_error_t *);
void smbsr_errno(smb_request_t *, int);
int clock_get_milli_uptime(void);
int smb_mbc_decodef(mbuf_chain_t *, char *, ...);
int smb_mbc_encodef(mbuf_chain_t *, char *, ...);
int smb_mbc_peek(mbuf_chain_t *, int, char *, ...);
int smb_mbc_poke(mbuf_chain_t *, int, char *, ...);
int smb_xlate_dialect_str_to_cd(char *);
char *smb_xlate_com_cd_to_str(int);
char *smb_xlate_dialect_cd_to_str(int);
/*
* Socket functions
*/
int smb_net_init(void);
void smb_net_fini(void);
void smb_net_txl_constructor(smb_txlst_t *);
void smb_net_txl_destructor(smb_txlst_t *);
smb_txreq_t *smb_net_txr_alloc(void);
void smb_net_txr_free(smb_txreq_t *);
/*
* SMB RPC interface
*/
int smb_opipe_open(smb_request_t *);
void smb_opipe_close(smb_ofile_t *);
void smb_opipe_door_init(void);
void smb_opipe_door_fini(void);
int smb_opipe_door_open(int);
void smb_opipe_door_close(void);
/*
* SMB server functions (file smb_server.c)
*/
int smb_server_svc_init(void);
int smb_server_svc_fini(void);
int smb_server_create(void);
int smb_server_delete(void);
int smb_server_configure(smb_ioc_cfg_t *);
int smb_server_start(smb_ioc_start_t *);
int smb_server_nbt_receive(void);
int smb_server_tcp_receive(void);
int smb_server_set_gmtoff(smb_ioc_gmt_t *);
int smb_server_numopen(smb_ioc_opennum_t *);
int smb_server_enum(smb_ioc_svcenum_t *);
/*
* SMB node functions (file smb_node.c)
*/
int smb_node_init(void);
void smb_node_fini(void);
void smb_node_ref(smb_node_t *);
void smb_node_release(smb_node_t *);
void smb_node_end_crit(smb_node_t *);
int smb_node_in_crit(smb_node_t *);
void smb_node_rdlock(smb_node_t *);
void smb_node_wrlock(smb_node_t *);
void smb_node_unlock(smb_node_t *);
void smb_node_inc_open_ofiles(smb_node_t *);
void smb_node_dec_open_ofiles(smb_node_t *);
void smb_node_notify_change(smb_node_t *);
smb_ofile_t *, smb_attr_t *);
void smb_node_reset_delete_on_close(smb_node_t *);
/*
* Pathname functions
*/
/*
* smb_vfs functions
*/
void smb_vfs_rele_all(smb_server_t *);
/* NOTIFY CHANGE */
void smb_fem_fcn_install(smb_node_t *);
void smb_fem_fcn_uninstall(smb_node_t *);
/* FEM */
int smb_fem_init(void);
void smb_fem_fini(void);
unsigned short smb_worker_getnum();
/* SMB signing routines smb_signing.c */
int smb_sign_check_request(smb_request_t *);
int smb_sign_check_secondary(smb_request_t *, unsigned int);
void smb_request_cancel(smb_request_t *);
void smb_request_wait(smb_request_t *);
/*
* session functions (file smb_session.c)
*/
int smb_session_daemon(smb_session_list_t *);
void smb_session_timers(smb_session_list_t *);
smb_request_t *);
void smb_session_disconnect_share(smb_session_list_t *, char *);
#define SMB_SESSION_GET_ID(s) ((s)->s_kid)
void smb_request_free(smb_request_t *);
/*
* ofile functions (file smb_ofile.c)
*/
void smb_ofile_release(smb_ofile_t *);
void smb_ofile_close_all(smb_tree_t *);
void smb_ofile_set_oplock_granted(smb_ofile_t *);
void smb_ofile_set_delete_on_close(smb_ofile_t *);
void smb_delayed_write_timer(smb_llist_t *);
/*
* odir functions (file smb_odir.c)
*/
void smb_odir_close(smb_odir_t *);
void smb_odir_release(smb_odir_t *);
smb_odirent_t *, boolean_t *);
smb_fileinfo_t *, boolean_t *);
smb_streaminfo_t *, boolean_t *);
/*
* SMB user functions (file smb_user.c)
*/
int smb_user_init(void);
void smb_user_fini(void);
void smb_user_logoff(smb_user_t *);
void smb_user_logoff_all(smb_session_t *);
void smb_user_disconnect_share(smb_user_t *, const char *);
void smb_user_release(smb_user_t *);
void smb_user_netinfo_fini(smb_netuserinfo_t *);
/*
* SMB tree functions (file smb_tree.c)
*/
void smb_tree_release(smb_tree_t *);
/*
* SMB user's credential functions
*/
void smb_check_status(void);
void smb_reconnection_check(smb_session_t *);
/*
* Pool ID function prototypes
*/
/*
* SMB thread function prototypes
*/
void smb_session_worker(void *arg);
/*
* SMB locked list function prototypes
*/
void smb_llist_destructor(smb_llist_t *);
/*
* SMB Synchronized list function prototypes
*/
void smb_slist_destructor(smb_slist_t *);
smb_thread_aw_t, void *);
void smb_thread_destroy(smb_thread_t *);
int smb_thread_start(smb_thread_t *);
void smb_thread_stop(smb_thread_t *);
void smb_thread_signal(smb_thread_t *);
/* 100's of ns between 1/1/1970 and 1/1/1601 */
boolean_t smb_ace_is_generic(int);
boolean_t smb_ace_is_access(int);
boolean_t smb_ace_is_audit(int);
char *, smb_node_t **, smb_node_t **);
void smb_panic(char *, const char *, int);
#pragma does_not_return(smb_panic)
#ifdef __cplusplus
}
#endif
#endif /* _SMB_KPROTO_H_ */