blob: ac9d932f8c8aa170537ebf8147567c16319c6274 [file] [log] [blame]
Namjae Jeon0626e662021-03-16 13:07:11 +09001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2018 Samsung Electronics Co., Ltd.
4 */
5
6#ifndef __SERVER_H__
7#define __SERVER_H__
8
9#include "smbacl.h"
10
Namjae Jeonb9cbfb52021-06-30 09:38:46 +090011/*
12 * Server state type
13 */
14enum {
15 SERVER_STATE_STARTING_UP,
16 SERVER_STATE_RUNNING,
17 SERVER_STATE_RESETTING,
18 SERVER_STATE_SHUTTING_DOWN,
19};
Namjae Jeon0626e662021-03-16 13:07:11 +090020
Namjae Jeonc63ee4a2021-06-30 09:39:15 +090021/*
22 * Server global config string index
23 */
24enum {
25 SERVER_CONF_NETBIOS_NAME,
26 SERVER_CONF_SERVER_STRING,
27 SERVER_CONF_WORK_GROUP,
28};
Namjae Jeon0626e662021-03-16 13:07:11 +090029
Namjae Jeon0626e662021-03-16 13:07:11 +090030struct ksmbd_server_config {
31 unsigned int flags;
32 unsigned int state;
33 short signing;
34 short enforced_signing;
35 short min_protocol;
36 short max_protocol;
37 unsigned short tcp_port;
38 unsigned short ipc_timeout;
39 unsigned long ipc_last_active;
40 unsigned long deadtime;
41 unsigned int share_fake_fscaps;
42 struct smb_sid domain_sid;
43 unsigned int auth_mechs;
44
45 char *conf[SERVER_CONF_WORK_GROUP + 1];
46};
47
48extern struct ksmbd_server_config server_conf;
49
50int ksmbd_set_netbios_name(char *v);
51int ksmbd_set_server_string(char *v);
52int ksmbd_set_work_group(char *v);
53
54char *ksmbd_netbios_name(void);
55char *ksmbd_server_string(void);
56char *ksmbd_work_group(void);
57
58static inline int ksmbd_server_running(void)
59{
60 return READ_ONCE(server_conf.state) == SERVER_STATE_RUNNING;
61}
62
63static inline int ksmbd_server_configurable(void)
64{
65 return READ_ONCE(server_conf.state) < SERVER_STATE_RESETTING;
66}
67
68int server_queue_ctrl_init_work(void);
69int server_queue_ctrl_reset_work(void);
70#endif /* __SERVER_H__ */