aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ncp_fs_sb.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/ncp_fs_sb.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/ncp_fs_sb.h')
-rw-r--r--include/linux/ncp_fs_sb.h157
1 files changed, 157 insertions, 0 deletions
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
new file mode 100644
index 000000000000..cf858eb80f0b
--- /dev/null
+++ b/include/linux/ncp_fs_sb.h
@@ -0,0 +1,157 @@
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#include <linux/net.h>
14
15#ifdef __KERNEL__
16
17#include <linux/workqueue.h>
18
19#define NCP_DEFAULT_OPTIONS 0 /* 2 for packet signatures */
20
21struct sock;
22
23struct ncp_server {
24
25 struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of
26 interest for us later, so we store
27 it completely. */
28
29 __u8 name_space[NCP_NUMBER_OF_VOLUMES + 2];
30
31 struct file *ncp_filp; /* File pointer to ncp socket */
32 struct socket *ncp_sock;/* ncp socket */
33 struct file *info_filp;
34 struct socket *info_sock;
35
36 u8 sequence;
37 u8 task;
38 u16 connection; /* Remote connection number */
39
40 u8 completion; /* Status message from server */
41 u8 conn_status; /* Bit 4 = 1 ==> Server going down, no
42 requests allowed anymore.
43 Bit 0 = 1 ==> Server is down. */
44
45 int buffer_size; /* Negotiated bufsize */
46
47 int reply_size; /* Size of last reply */
48
49 int packet_size;
50 unsigned char *packet; /* Here we prepare requests and
51 receive replies */
52
53 int lock; /* To prevent mismatch in protocols. */
54 struct semaphore sem;
55
56 int current_size; /* for packet preparation */
57 int has_subfunction;
58 int ncp_reply_size;
59
60 int root_setuped;
61
62 /* info for packet signing */
63 int sign_wanted; /* 1=Server needs signed packets */
64 int sign_active; /* 0=don't do signing, 1=do */
65 char sign_root[8]; /* generated from password and encr. key */
66 char sign_last[16];
67
68 /* Authentication info: NDS or BINDERY, username */
69 struct {
70 int auth_type;
71 size_t object_name_len;
72 void* object_name;
73 int object_type;
74 } auth;
75 /* Password info */
76 struct {
77 size_t len;
78 void* data;
79 } priv;
80
81 /* nls info: codepage for volume and charset for I/O */
82 struct nls_table *nls_vol;
83 struct nls_table *nls_io;
84
85 /* maximum age in jiffies */
86 int dentry_ttl;
87
88 /* miscellaneous */
89 unsigned int flags;
90
91 spinlock_t requests_lock; /* Lock accesses to tx.requests, tx.creq and rcv.creq when STREAM mode */
92
93 void (*data_ready)(struct sock* sk, int len);
94 void (*error_report)(struct sock* sk);
95 void (*write_space)(struct sock* sk); /* STREAM mode only */
96 struct {
97 struct work_struct tq; /* STREAM/DGRAM: data/error ready */
98 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */
99 struct semaphore creq_sem; /* DGRAM only: lock accesses to rcv.creq */
100
101 unsigned int state; /* STREAM only: receiver state */
102 struct {
103 __u32 magic __attribute__((packed));
104 __u32 len __attribute__((packed));
105 __u16 type __attribute__((packed));
106 __u16 p1 __attribute__((packed));
107 __u16 p2 __attribute__((packed));
108 __u16 p3 __attribute__((packed));
109 __u16 type2 __attribute__((packed));
110 } buf; /* STREAM only: temporary buffer */
111 unsigned char* ptr; /* STREAM only: pointer to data */
112 size_t len; /* STREAM only: length of data to receive */
113 } rcv;
114 struct {
115 struct list_head requests; /* STREAM only: queued requests */
116 struct work_struct tq; /* STREAM only: transmitter ready */
117 struct ncp_request_reply* creq; /* STREAM only: currently transmitted entry */
118 } tx;
119 struct timer_list timeout_tm; /* DGRAM only: timeout timer */
120 struct work_struct timeout_tq; /* DGRAM only: associated queue, we run timers from process context */
121 int timeout_last; /* DGRAM only: current timeout length */
122 int timeout_retries; /* DGRAM only: retries left */
123 struct {
124 size_t len;
125 __u8 data[128];
126 } unexpected_packet;
127};
128
129extern void ncp_tcp_rcv_proc(void *server);
130extern void ncp_tcp_tx_proc(void *server);
131extern void ncpdgram_rcv_proc(void *server);
132extern void ncpdgram_timeout_proc(void *server);
133extern void ncpdgram_timeout_call(unsigned long server);
134extern void ncp_tcp_data_ready(struct sock* sk, int len);
135extern void ncp_tcp_write_space(struct sock* sk);
136extern void ncp_tcp_error_report(struct sock* sk);
137
138#define NCP_FLAG_UTF8 1
139
140#define NCP_CLR_FLAG(server, flag) ((server)->flags &= ~(flag))
141#define NCP_SET_FLAG(server, flag) ((server)->flags |= (flag))
142#define NCP_IS_FLAG(server, flag) ((server)->flags & (flag))
143
144static inline int ncp_conn_valid(struct ncp_server *server)
145{
146 return ((server->conn_status & 0x11) == 0);
147}
148
149static inline void ncp_invalidate_conn(struct ncp_server *server)
150{
151 server->conn_status |= 0x01;
152}
153
154#endif /* __KERNEL__ */
155
156#endif
157