xref: /illumos-gate/usr/src/cmd/smbsrv/smbd/smbd.h (revision 4a16f9a6c1cc74aeed5ff36b4723c3e43bc67666)
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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #ifndef _SMBD_H
27 #define	_SMBD_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 #include <thread.h>
35 #include <synch.h>
36 #include <smbsrv/smb_ioctl.h>
37 #include <smbsrv/smb_token.h>
38 #include <smbsrv/libsmb.h>
39 #include <smbsrv/libmlsvc.h>
40 
41 int smbd_opipe_start(void);
42 void smbd_opipe_stop(void);
43 int smbd_share_start(void);
44 void smbd_share_stop(void);
45 int smbd_nicmon_start(const char *);
46 void smbd_nicmon_stop(void);
47 int smbd_nicmon_refresh(void);
48 boolean_t smbd_set_netlogon_cred(void);
49 int smbd_locate_dc_start(void);
50 smb_token_t *smbd_user_auth_logon(smb_logon_t *);
51 void smbd_user_nonauth_logon(uint32_t);
52 void smbd_user_auth_logoff(uint32_t);
53 uint32_t smbd_join(smb_joininfo_t *);
54 void smbd_set_secmode(int);
55 boolean_t smbd_online(void);
56 
57 int smbd_vss_get_count(const char *, uint32_t *);
58 void smbd_vss_get_snapshots(const char *, uint32_t, uint32_t *,
59     uint32_t *, char **);
60 int smbd_vss_map_gmttoken(const char *, char *, char *);
61 
62 typedef struct smbd {
63 	const char	*s_version;	/* smbd version string */
64 	const char	*s_pname;	/* basename to use for messages */
65 	pid_t		s_pid;		/* process-ID of current daemon */
66 	uid_t		s_uid;		/* UID of current daemon */
67 	gid_t		s_gid;		/* GID of current daemon */
68 	int		s_fg;		/* Run in foreground */
69 	boolean_t	s_initialized;
70 	boolean_t	s_shutting_down; /* shutdown control */
71 	volatile uint_t	s_sigval;
72 	volatile uint_t	s_refreshes;
73 	boolean_t	s_kbound;	/* B_TRUE if bound to kernel */
74 	int		s_door_lmshr;
75 	int		s_door_srv;
76 	int		s_door_opipe;
77 	int		s_secmode;	/* Current security mode */
78 	boolean_t	s_nbt_listener_running;
79 	boolean_t	s_tcp_listener_running;
80 	pthread_t	s_nbt_listener_id;
81 	pthread_t	s_tcp_listener_id;
82 	boolean_t	s_fatal_error;
83 	smb_log_hdl_t	s_loghd;
84 } smbd_t;
85 
86 #define	SMBD_LOGNAME		"smbd"
87 #define	SMBD_LOGSIZE		1024
88 
89 #define	SMBD_DOOR_NAMESZ	16
90 
91 typedef struct smbd_door {
92 	mutex_t		sd_mutex;
93 	cond_t		sd_cv;
94 	uint32_t	sd_ncalls;
95 	char		sd_name[SMBD_DOOR_NAMESZ];
96 } smbd_door_t;
97 
98 int smbd_door_start(void);
99 void smbd_door_stop(void);
100 void smbd_door_init(smbd_door_t *, const char *);
101 void smbd_door_fini(smbd_door_t *);
102 void smbd_door_enter(smbd_door_t *);
103 void smbd_door_return(smbd_door_t *, char *, size_t, door_desc_t *, uint_t);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* _SMBD_H */
110