1/*
2 *  ncp_fs_sb.h
3 *
4 *  Copyright (C) 1995, 1996 by Volker Lendecke
5 *
6 */
7
8#ifndef _NCP_FS_SB
9#define _NCP_FS_SB
10
11#include <linux/types.h>
12#include <linux/ncp_mount.h>
13
14#ifdef __KERNEL__
15
16#define NCP_DEFAULT_OPTIONS 0		/* 2 for packet signatures */
17
18struct ncp_server {
19
20	struct ncp_mount_data_kernel m;	/* Nearly all of the mount data is of
21					   interest for us later, so we store
22					   it completely. */
23
24	__u8 name_space[NCP_NUMBER_OF_VOLUMES + 2];
25
26	struct file *ncp_filp;	/* File pointer to ncp socket */
27
28	u8 sequence;
29	u8 task;
30	u16 connection;		/* Remote connection number */
31
32	u8 completion;		/* Status message from server */
33	u8 conn_status;		/* Bit 4 = 1 ==> Server going down, no
34				   requests allowed anymore.
35				   Bit 0 = 1 ==> Server is down. */
36
37	int buffer_size;	/* Negotiated bufsize */
38
39	int reply_size;		/* Size of last reply */
40
41	int packet_size;
42	unsigned char *packet;	/* Here we prepare requests and
43				   receive replies */
44
45	int lock;		/* To prevent mismatch in protocols. */
46	struct semaphore sem;
47
48	int current_size;	/* for packet preparation */
49	int has_subfunction;
50	int ncp_reply_size;
51
52	int root_setuped;
53
54	/* info for packet signing */
55	int sign_wanted;	/* 1=Server needs signed packets */
56	int sign_active;	/* 0=don't do signing, 1=do */
57	char sign_root[8];	/* generated from password and encr. key */
58	char sign_last[16];
59
60	/* Authentication info: NDS or BINDERY, username */
61	struct {
62		int	auth_type;
63		size_t	object_name_len;
64		void*	object_name;
65		int	object_type;
66	} auth;
67	/* Password info */
68	struct {
69		size_t	len;
70		void*	data;
71	} priv;
72
73	/* nls info: codepage for volume and charset for I/O */
74	struct nls_table *nls_vol;
75	struct nls_table *nls_io;
76
77	/* maximum age in jiffies */
78	int dentry_ttl;
79
80	/* miscellaneous */
81	unsigned int flags;
82};
83
84#define ncp_sb_info	ncp_server
85
86#define NCP_FLAG_UTF8	1
87
88#define NCP_CLR_FLAG(server, flag)	((server)->flags &= ~(flag))
89#define NCP_SET_FLAG(server, flag)	((server)->flags |= (flag))
90#define NCP_IS_FLAG(server, flag)	((server)->flags & (flag))
91
92static inline int ncp_conn_valid(struct ncp_server *server)
93{
94	return ((server->conn_status & 0x11) == 0);
95}
96
97static inline void ncp_invalidate_conn(struct ncp_server *server)
98{
99	server->conn_status |= 0x01;
100}
101
102#endif				/* __KERNEL__ */
103
104#endif
105
106