1 /*
2 * smb.h
3 *
4 * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
5 *
6 */
7
8 #ifndef _LINUX_SMB_H
9 #define _LINUX_SMB_H
10
11 #define SMB_PORT 139
12 #define SMB_MAXNAMELEN 255
13 #define SMB_MAXPATHLEN 1024
14
15 #define SMB_DEF_MAX_XMIT 32768
16
17 /* Allocate max. 1 page */
18 #define TRANS2_MAX_TRANSFER (4096-17)
19
20 #include <asm/types.h>
21 #ifdef __KERNEL__
22 typedef u8 byte;
23 typedef u16 word;
24 typedef u32 dword;
25 #else
26 typedef unsigned char byte;
27 typedef unsigned short word;
28 typedef unsigned long dword;
29 #endif
30
31 /*
32 * Set/Get values in SMB-byte order
33 */
34 #define ARCH i386
35 #if (ARCH == i386)
36 #define BVAL(p,off) (*((byte *)(((void *)p)+off)))
37 #define WVAL(p,off) (*((word *)(((void *)p)+off)))
38 #define DVAL(p,off) (*((dword *)(((void *)p)+off)))
39 #define BSET(p,off,new) (*((byte *)(((void *)p)+off))=(new))
40 #define WSET(p,off,new) (*((word *)(((void *)p)+off))=(new))
41 #define DSET(p,off,new) (*((dword *)(((void *)p)+off))=(new))
42
43 /* where to find the base of the SMB packet proper */
44 #define smb_base(buf) ((byte *)(((byte *)(buf))+4))
45
46 #else
47 #error "Currently only on 386, sorry"
48 #endif
49
50
51 #define LANMAN1
52 #define LANMAN2
53 #define NT1
54
55 enum smb_protocol {
56 PROTOCOL_NONE,
57 PROTOCOL_CORE,
58 PROTOCOL_COREPLUS,
59 PROTOCOL_LANMAN1,
60 PROTOCOL_LANMAN2,
61 PROTOCOL_NT1
62 };
63
64 enum smb_case_hndl {
65 CASE_DEFAULT,
66 CASE_LOWER,
67 CASE_UPPER
68 };
69
70 #ifdef __KERNEL__
71
72 enum smb_conn_state {
73 CONN_VALID, /* everything's fine */
74 CONN_INVALID, /* Something went wrong, but did not
75 try to reconnect yet. */
76 CONN_RETRIED /* Tried a reconnection, but was refused */
77 };
78
79 struct smb_dskattr {
80 word total;
81 word allocblocks;
82 word blocksize;
83 word free;
84 };
85
86 /*
87 * Contains all relevant data on a SMB networked file.
88 */
89 struct smb_dirent {
90 int opened; /* is it open on the fileserver? */
91 word fileid; /* What id to handle a file with? */
92 word attr; /* Attribute fields, DOS value */
93
94 time_t atime, mtime, /* Times, as seen by the server, normalized */
95 ctime; /* to UTC. The ugly conversion happens in */
96 /* proc.c */
97
98 unsigned long size; /* File size. */
99 unsigned short access; /* Access bits. */
100 unsigned long f_pos; /* File position. (For readdir.) */
101 char* path; /* Complete path, MS-DOS notation, with '\' */
102 int len; /* Namelength. */
103 };
104
105 #endif /* __KERNEL__ */
106 #endif /* _LINUX_SMB_H */
107
108
109 /*
110 * Overrides for Emacs so that we follow Linus's tabbing style.
111 * Emacs will notice this stuff at the end of the file and automatically
112 * adjust the settings for this buffer only. This must remain at the end
113 * of the file.
114 * ---------------------------------------------------------------------------
115 * Local variables:
116 * c-indent-level: 8
117 * c-brace-imaginary-offset: 0
118 * c-brace-offset: -8
119 * c-argdecl-indent: 8
120 * c-label-offset: -8
121 * c-continued-statement-offset: 8
122 * c-continued-brace-offset: 0
123 * End:
124 */