blob: 2fce06e8b833d83e20e4603396b743652e1c0953 [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
21#define SERVER_CONF_NETBIOS_NAME 0
22#define SERVER_CONF_SERVER_STRING 1
23#define SERVER_CONF_WORK_GROUP 2
24
Namjae Jeon0626e662021-03-16 13:07:11 +090025struct ksmbd_server_config {
26 unsigned int flags;
27 unsigned int state;
28 short signing;
29 short enforced_signing;
30 short min_protocol;
31 short max_protocol;
32 unsigned short tcp_port;
33 unsigned short ipc_timeout;
34 unsigned long ipc_last_active;
35 unsigned long deadtime;
36 unsigned int share_fake_fscaps;
37 struct smb_sid domain_sid;
38 unsigned int auth_mechs;
39
40 char *conf[SERVER_CONF_WORK_GROUP + 1];
41};
42
43extern struct ksmbd_server_config server_conf;
44
45int ksmbd_set_netbios_name(char *v);
46int ksmbd_set_server_string(char *v);
47int ksmbd_set_work_group(char *v);
48
49char *ksmbd_netbios_name(void);
50char *ksmbd_server_string(void);
51char *ksmbd_work_group(void);
52
53static inline int ksmbd_server_running(void)
54{
55 return READ_ONCE(server_conf.state) == SERVER_STATE_RUNNING;
56}
57
58static inline int ksmbd_server_configurable(void)
59{
60 return READ_ONCE(server_conf.state) < SERVER_STATE_RESETTING;
61}
62
63int server_queue_ctrl_init_work(void);
64int server_queue_ctrl_reset_work(void);
65#endif /* __SERVER_H__ */