linux/fs/smb/server/connection.h

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

#ifndef __KSMBD_CONNECTION_H__
#define __KSMBD_CONNECTION_H__

#include <linux/list.h>
#include <linux/ip.h>
#include <net/sock.h>
#include <net/tcp.h>
#include <net/inet_connection_sock.h>
#include <net/request_sock.h>
#include <linux/kthread.h>
#include <linux/nls.h>
#include <linux/unicode.h>

#include "smb_common.h"
#include "ksmbd_work.h"

#define KSMBD_SOCKET_BACKLOG

enum {};

struct ksmbd_stats {};

struct ksmbd_transport;

struct ksmbd_conn {};

struct ksmbd_conn_ops {};

struct ksmbd_transport_ops {};

struct ksmbd_transport {};

#define KSMBD_TCP_RECV_TIMEOUT
#define KSMBD_TCP_SEND_TIMEOUT
#define KSMBD_TCP_PEER_SOCKADDR(c)

extern struct list_head conn_list;
extern struct rw_semaphore conn_list_lock;

bool ksmbd_conn_alive(struct ksmbd_conn *conn);
void ksmbd_conn_wait_idle(struct ksmbd_conn *conn, u64 sess_id);
struct ksmbd_conn *ksmbd_conn_alloc(void);
void ksmbd_conn_free(struct ksmbd_conn *conn);
bool ksmbd_conn_lookup_dialect(struct ksmbd_conn *c);
int ksmbd_conn_write(struct ksmbd_work *work);
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn,
			 void *buf, unsigned int buflen,
			 struct smb2_buffer_desc_v1 *desc,
			 unsigned int desc_len);
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn,
			  void *buf, unsigned int buflen,
			  struct smb2_buffer_desc_v1 *desc,
			  unsigned int desc_len);
void ksmbd_conn_enqueue_request(struct ksmbd_work *work);
void ksmbd_conn_try_dequeue_request(struct ksmbd_work *work);
void ksmbd_conn_init_server_callbacks(struct ksmbd_conn_ops *ops);
int ksmbd_conn_handler_loop(void *p);
int ksmbd_conn_transport_init(void);
void ksmbd_conn_transport_destroy(void);
void ksmbd_conn_lock(struct ksmbd_conn *conn);
void ksmbd_conn_unlock(struct ksmbd_conn *conn);

/*
 * WARNING
 *
 * This is a hack. We will move status to a proper place once we land
 * a multi-sessions support.
 */
static inline bool ksmbd_conn_good(struct ksmbd_conn *conn)
{}

static inline bool ksmbd_conn_need_negotiate(struct ksmbd_conn *conn)
{}

static inline bool ksmbd_conn_need_reconnect(struct ksmbd_conn *conn)
{}

static inline bool ksmbd_conn_exiting(struct ksmbd_conn *conn)
{}

static inline bool ksmbd_conn_releasing(struct ksmbd_conn *conn)
{}

static inline void ksmbd_conn_set_new(struct ksmbd_conn *conn)
{}

static inline void ksmbd_conn_set_good(struct ksmbd_conn *conn)
{}

static inline void ksmbd_conn_set_need_negotiate(struct ksmbd_conn *conn)
{}

static inline void ksmbd_conn_set_need_reconnect(struct ksmbd_conn *conn)
{}

static inline void ksmbd_conn_set_exiting(struct ksmbd_conn *conn)
{}

static inline void ksmbd_conn_set_releasing(struct ksmbd_conn *conn)
{}

void ksmbd_all_conn_set_status(u64 sess_id, u32 status);
#endif /* __CONNECTION_H__ */