xref: /titanic_50/usr/src/cmd/smbsrv/smbd/smbd.h (revision a23420cf95f05ac67f2c299116a3225581e519d1)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SMBD_H
28 #define	_SMBD_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/types.h>
35 #include <thread.h>
36 #include <synch.h>
37 #include <smbsrv/smb_ioctl.h>
38 #include <smbsrv/smb_token.h>
39 #include <smbsrv/libsmb.h>
40 #include <smbsrv/libmlsvc.h>
41 
42 int smbd_opipe_start(void);
43 void smbd_opipe_stop(void);
44 int smbd_share_start(void);
45 void smbd_share_stop(void);
46 boolean_t smbd_set_netlogon_cred(void);
47 int smbd_locate_dc_start(void);
48 smb_token_t *smbd_user_auth_logon(smb_logon_t *);
49 void smbd_user_nonauth_logon(uint32_t);
50 void smbd_user_auth_logoff(uint32_t);
51 uint32_t smbd_join(smb_joininfo_t *);
52 void smbd_set_secmode(int);
53 boolean_t smbd_online(void);
54 
55 int smbd_vss_get_count(const char *, uint32_t *);
56 void smbd_vss_get_snapshots(const char *, uint32_t, uint32_t *,
57     uint32_t *, char **);
58 int smbd_vss_map_gmttoken(const char *, char *, char *);
59 
60 typedef struct smbd {
61 	const char	*s_version;	/* smbd version string */
62 	const char	*s_pname;	/* basename to use for messages */
63 	pid_t		s_pid;		/* process-ID of current daemon */
64 	uid_t		s_uid;		/* UID of current daemon */
65 	gid_t		s_gid;		/* GID of current daemon */
66 	int		s_fg;		/* Run in foreground */
67 	boolean_t	s_initialized;
68 	boolean_t	s_shutting_down; /* shutdown control */
69 	volatile uint_t	s_sigval;
70 	volatile uint_t	s_refreshes;
71 	boolean_t	s_kbound;	/* B_TRUE if bound to kernel */
72 	int		s_door_lmshr;
73 	int		s_door_srv;
74 	int		s_door_opipe;
75 	int		s_secmode;	/* Current security mode */
76 	boolean_t	s_nbt_listener_running;
77 	boolean_t	s_tcp_listener_running;
78 	pthread_t	s_nbt_listener_id;
79 	pthread_t	s_tcp_listener_id;
80 	boolean_t	s_fatal_error;
81 } smbd_t;
82 
83 #define	SMBD_DOOR_NAMESZ	16
84 
85 typedef struct smbd_door {
86 	mutex_t		sd_mutex;
87 	cond_t		sd_cv;
88 	uint32_t	sd_ncalls;
89 	char		sd_name[SMBD_DOOR_NAMESZ];
90 } smbd_door_t;
91 
92 int smbd_door_start(void);
93 void smbd_door_stop(void);
94 void smbd_door_init(smbd_door_t *, const char *);
95 void smbd_door_fini(smbd_door_t *);
96 void smbd_door_enter(smbd_door_t *);
97 void smbd_door_return(smbd_door_t *, char *, size_t, door_desc_t *, uint_t);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* _SMBD_H */
104