smb_kproto.h revision 3a6c5f83d4cb79e49561f3fad2b016450f0e6fec
/*
* 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_announce_quota;
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);
struct smb_xa *);
struct smb_xa *);
struct smb_xa *);
struct smb_xa *);
struct smb_xa *);
struct smb_xa *);
struct smb_xa *);
struct smb_xa *);
/*
* 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_SAME_SESSION: Checks for equivalence
* of session. If an existing oplock is
* request, the oplock is not broken.
*
* 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_maybe_mangled_name(char *name);
boolean_t smb_is_invalid_filename(const char *);
int smbsr_connect_tree(struct smb_request *);
int smb_common_create_directory(struct smb_request *);
int smb_convert_wildcards(char *);
int smb_ascii_or_unicode_strlen(struct smb_request *, char *);
int smb_ascii_or_unicode_strlen_null(struct smb_request *, char *);
int smb_ascii_or_unicode_null_len(struct smb_request *);
int smb_search(struct smb_request *);
void sshow_distribution_info(char *);
void smbsr_disconnect_file(smb_request_t *);
void smbsr_disconnect_dir(smb_request_t *);
int smbsr_encode_empty_result(struct smb_request *);
void smbsr_lookup_file(smb_request_t *);
int smbsr_encode_result(struct smb_request *, int, int, char *, ...);
void smbsr_send_reply(struct smb_request *);
void smbsr_map_errno(int, smb_error_t *);
void smbsr_errno(struct smb_request *, 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);
void smb_user_list_free(smb_dr_ulist_t *);
/*
* 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_start(struct smb_io_start *);
int smb_server_nbt_listen(int);
int smb_server_tcp_listen(int);
int smb_server_nbt_receive(void);
int smb_server_tcp_receive(void);
int smb_server_dr_ulist_get(int, smb_dr_ulist_t *, int);
int smb_server_share_export(char *);
int smb_server_share_unexport(char *, char *);
/*
* SMB node functions (file smb_node.c)
*/
int smb_node_init(void);
void smb_node_fini(void);
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_reset_delete_on_close(smb_node_t *);
/*
* Pathname functions
*/
/*
* smb_vfs functions
*/
void smb_vfs_rele_all(smb_server_t *);
/*
* String manipulation function
*/
char *smb_kstrdup(const char *s, size_t n);
/* NOTIFY CHANGE */
void smb_process_node_notify_change_queue(struct smb_node *);
void smb_reply_specific_cancel_request(struct smb_request *);
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);
/* functions from smb_memory_manager.c */
void *smbsr_realloc(void *, size_t);
void smbsr_free_malloc_list(smb_malloc_list *);
unsigned short smb_worker_getnum();
boolean_t smb_is_stream_name(char *);
uint32_t smb_validate_stream_name(char *);
int smb_stream_parse_name(char *, char *, char *);
/* SMB signing routines smb_signing.c */
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 *);
void smb_session_oplock_released(smb_session_t *);
#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 *);
/*
* 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 *);
/*
* SMB tree functions (file smb_tree.c)
*/
void smb_tree_disconnect(smb_tree_t *);
void smb_tree_release(smb_tree_t *);
/*
* SMB user's credential functions
*/
void smb_check_status(void);
/*
* 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 */
void smb_sd_term(smb_sd_t *);
void smb_fssd_term(smb_fssd_t *);
void smb_acl_sort(smb_acl_t *);
void smb_acl_free(smb_acl_t *);
void smb_fsacl_free(acl_t *);
acl_t *smb_fsacl_alloc(int, int);
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_ */