linux/fs/smb/server/ksmbd_netlink.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *   Copyright (C) 2018 Samsung Electronics Co., Ltd.
 *
 *   [email protected]
 */

#ifndef _LINUX_KSMBD_SERVER_H
#define _LINUX_KSMBD_SERVER_H

#include <linux/types.h>

/*
 * This is a userspace ABI to communicate data between ksmbd and user IPC
 * daemon using netlink. This is added to track and cache user account DB
 * and share configuration info from userspace.
 *
 *  - KSMBD_EVENT_HEARTBEAT_REQUEST(ksmbd_heartbeat)
 *    This event is to check whether user IPC daemon is alive. If user IPC
 *    daemon is dead, ksmbd keep existing connection till disconnecting and
 *    new connection will be denied.
 *
 *  - KSMBD_EVENT_STARTING_UP(ksmbd_startup_request)
 *    This event is to receive the information that initializes the ksmbd
 *    server from the user IPC daemon and to start the server. The global
 *    section parameters are given from smb.conf as initialization
 *    information.
 *
 *  - KSMBD_EVENT_SHUTTING_DOWN(ksmbd_shutdown_request)
 *    This event is to shutdown ksmbd server.
 *
 *  - KSMBD_EVENT_LOGIN_REQUEST/RESPONSE(ksmbd_login_request/response)
 *    This event is to get user account info to user IPC daemon.
 *
 *  - KSMBD_EVENT_SHARE_CONFIG_REQUEST/RESPONSE(ksmbd_share_config_request/response)
 *    This event is to get net share configuration info.
 *
 *  - KSMBD_EVENT_TREE_CONNECT_REQUEST/RESPONSE(ksmbd_tree_connect_request/response)
 *    This event is to get session and tree connect info.
 *
 *  - KSMBD_EVENT_TREE_DISCONNECT_REQUEST(ksmbd_tree_disconnect_request)
 *    This event is to send tree disconnect info to user IPC daemon.
 *
 *  - KSMBD_EVENT_LOGOUT_REQUEST(ksmbd_logout_request)
 *    This event is to send logout request to user IPC daemon.
 *
 *  - KSMBD_EVENT_RPC_REQUEST/RESPONSE(ksmbd_rpc_command)
 *    This event is to make DCE/RPC request like srvsvc, wkssvc, lsarpc,
 *    samr to be processed in userspace.
 *
 *  - KSMBD_EVENT_SPNEGO_AUTHEN_REQUEST/RESPONSE(ksmbd_spnego_authen_request/response)
 *    This event is to make kerberos authentication to be processed in
 *    userspace.
 */

#define KSMBD_GENL_NAME
#define KSMBD_GENL_VERSION

#define KSMBD_REQ_MAX_ACCOUNT_NAME_SZ
#define KSMBD_REQ_MAX_HASH_SZ
#define KSMBD_REQ_MAX_SHARE_NAME

/*
 * IPC heartbeat frame to check whether user IPC daemon is alive.
 */
struct ksmbd_heartbeat {};

/*
 * Global config flags.
 */
#define KSMBD_GLOBAL_FLAG_INVALID
#define KSMBD_GLOBAL_FLAG_SMB2_LEASES
#define KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION
#define KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL
#define KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF
#define KSMBD_GLOBAL_FLAG_DURABLE_HANDLE

/*
 * IPC request for ksmbd server startup
 */
struct ksmbd_startup_request {};

#define KSMBD_STARTUP_CONFIG_INTERFACES(s)

/*
 * IPC request to shutdown ksmbd server.
 */
struct ksmbd_shutdown_request {};

/*
 * IPC user login request.
 */
struct ksmbd_login_request {};

/*
 * IPC user login response.
 */
struct ksmbd_login_response {};

/*
 * IPC request to fetch net share config.
 */
struct ksmbd_share_config_request {};

/*
 * IPC response to the net share config request.
 */
struct ksmbd_share_config_response {};

#define KSMBD_SHARE_CONFIG_VETO_LIST(s)

static inline char *
ksmbd_share_config_path(struct ksmbd_share_config_response *sc)
{}

/*
 * IPC request for tree connection. This request include session and tree
 * connect info from client.
 */
struct ksmbd_tree_connect_request {};

/*
 * IPC Response structure for tree connection.
 */
struct ksmbd_tree_connect_response {};

/*
 * IPC Request struture to disconnect tree connection.
 */
struct ksmbd_tree_disconnect_request {};

/*
 * IPC Response structure to logout user account.
 */
struct ksmbd_logout_request {};

/*
 * RPC command structure to send rpc request like srvsvc or wkssvc to
 * IPC user daemon.
 */
struct ksmbd_rpc_command {};

/*
 * IPC Request Kerberos authentication
 */
struct ksmbd_spnego_authen_request {};

/*
 * Response data which includes the GSS token and the session key generated by
 * user daemon.
 */
struct ksmbd_spnego_authen_response {};

/*
 * This also used as NETLINK attribute type value.
 *
 * NOTE:
 * Response message type value should be equal to
 * request message type value + 1.
 */
enum ksmbd_event {};

/*
 * Enumeration for IPC tree connect status.
 */
enum KSMBD_TREE_CONN_STATUS {};

/*
 * User config flags.
 */
#define KSMBD_USER_FLAG_INVALID
#define KSMBD_USER_FLAG_OK
#define KSMBD_USER_FLAG_BAD_PASSWORD
#define KSMBD_USER_FLAG_BAD_UID
#define KSMBD_USER_FLAG_BAD_USER
#define KSMBD_USER_FLAG_GUEST_ACCOUNT
#define KSMBD_USER_FLAG_DELAY_SESSION

/*
 * Share config flags.
 */
#define KSMBD_SHARE_FLAG_INVALID
#define KSMBD_SHARE_FLAG_AVAILABLE
#define KSMBD_SHARE_FLAG_BROWSEABLE
#define KSMBD_SHARE_FLAG_WRITEABLE
#define KSMBD_SHARE_FLAG_READONLY
#define KSMBD_SHARE_FLAG_GUEST_OK
#define KSMBD_SHARE_FLAG_GUEST_ONLY
#define KSMBD_SHARE_FLAG_STORE_DOS_ATTRS
#define KSMBD_SHARE_FLAG_OPLOCKS
#define KSMBD_SHARE_FLAG_PIPE
#define KSMBD_SHARE_FLAG_HIDE_DOT_FILES
#define KSMBD_SHARE_FLAG_INHERIT_OWNER
#define KSMBD_SHARE_FLAG_STREAMS
#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS
#define KSMBD_SHARE_FLAG_ACL_XATTR
#define KSMBD_SHARE_FLAG_UPDATE
#define KSMBD_SHARE_FLAG_CROSSMNT
#define KSMBD_SHARE_FLAG_CONTINUOUS_AVAILABILITY

/*
 * Tree connect request flags.
 */
#define KSMBD_TREE_CONN_FLAG_REQUEST_SMB1
#define KSMBD_TREE_CONN_FLAG_REQUEST_IPV6
#define KSMBD_TREE_CONN_FLAG_REQUEST_SMB2

/*
 * Tree connect flags.
 */
#define KSMBD_TREE_CONN_FLAG_GUEST_ACCOUNT
#define KSMBD_TREE_CONN_FLAG_READ_ONLY
#define KSMBD_TREE_CONN_FLAG_WRITABLE
#define KSMBD_TREE_CONN_FLAG_ADMIN_ACCOUNT
#define KSMBD_TREE_CONN_FLAG_UPDATE

/*
 * RPC over IPC.
 */
#define KSMBD_RPC_METHOD_RETURN
#define KSMBD_RPC_SRVSVC_METHOD_INVOKE
#define KSMBD_RPC_SRVSVC_METHOD_RETURN
#define KSMBD_RPC_WKSSVC_METHOD_INVOKE
#define KSMBD_RPC_WKSSVC_METHOD_RETURN
#define KSMBD_RPC_IOCTL_METHOD
#define KSMBD_RPC_OPEN_METHOD
#define KSMBD_RPC_WRITE_METHOD
#define KSMBD_RPC_READ_METHOD
#define KSMBD_RPC_CLOSE_METHOD
#define KSMBD_RPC_RAP_METHOD
#define KSMBD_RPC_RESTRICTED_CONTEXT
#define KSMBD_RPC_SAMR_METHOD_INVOKE
#define KSMBD_RPC_SAMR_METHOD_RETURN
#define KSMBD_RPC_LSARPC_METHOD_INVOKE
#define KSMBD_RPC_LSARPC_METHOD_RETURN

/*
 * RPC status definitions.
 */
#define KSMBD_RPC_OK
#define KSMBD_RPC_EBAD_FUNC
#define KSMBD_RPC_EACCESS_DENIED
#define KSMBD_RPC_EBAD_FID
#define KSMBD_RPC_ENOMEM
#define KSMBD_RPC_EBAD_DATA
#define KSMBD_RPC_ENOTIMPLEMENTED
#define KSMBD_RPC_EINVALID_PARAMETER
#define KSMBD_RPC_EMORE_DATA
#define KSMBD_RPC_EINVALID_LEVEL
#define KSMBD_RPC_SOME_NOT_MAPPED

#define KSMBD_CONFIG_OPT_DISABLED
#define KSMBD_CONFIG_OPT_ENABLED
#define KSMBD_CONFIG_OPT_AUTO
#define KSMBD_CONFIG_OPT_MANDATORY

#endif /* _LINUX_KSMBD_SERVER_H */