blob: 6df3b1501559aadda5c5c926bc836431a1e0565a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * smb.h
3 *
4 * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
6 *
7 */
8
9#ifndef _LINUX_SMB_H
10#define _LINUX_SMB_H
11
12#include <linux/types.h>
Jeff Garzike18fa702006-09-24 11:13:19 -040013#include <linux/magic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15enum smb_protocol {
16 SMB_PROTOCOL_NONE,
17 SMB_PROTOCOL_CORE,
18 SMB_PROTOCOL_COREPLUS,
19 SMB_PROTOCOL_LANMAN1,
20 SMB_PROTOCOL_LANMAN2,
21 SMB_PROTOCOL_NT1
22};
23
24enum smb_case_hndl {
25 SMB_CASE_DEFAULT,
26 SMB_CASE_LOWER,
27 SMB_CASE_UPPER
28};
29
30struct smb_dskattr {
31 __u16 total;
32 __u16 allocblocks;
33 __u16 blocksize;
34 __u16 free;
35};
36
37struct smb_conn_opt {
38
39 /* The socket */
40 unsigned int fd;
41
42 enum smb_protocol protocol;
43 enum smb_case_hndl case_handling;
44
45 /* Connection-Options */
46
47 __u32 max_xmit;
48 __u16 server_uid;
49 __u16 tid;
50
51 /* The following are LANMAN 1.0 options */
52 __u16 secmode;
53 __u16 maxmux;
54 __u16 maxvcs;
55 __u16 rawmode;
56 __u32 sesskey;
57
58 /* The following are NT LM 0.12 options */
59 __u32 maxraw;
60 __u32 capabilities;
61 __s16 serverzone;
62};
63
64#ifdef __KERNEL__
65
66#define SMB_NLS_MAXNAMELEN 20
67struct smb_nls_codepage {
68 char local_name[SMB_NLS_MAXNAMELEN];
69 char remote_name[SMB_NLS_MAXNAMELEN];
70};
71
72
73#define SMB_MAXNAMELEN 255
74#define SMB_MAXPATHLEN 1024
75
76/*
77 * Contains all relevant data on a SMB networked file.
78 */
79struct smb_fattr {
80 __u16 attr;
81
82 unsigned long f_ino;
83 umode_t f_mode;
84 nlink_t f_nlink;
85 uid_t f_uid;
86 gid_t f_gid;
87 dev_t f_rdev;
88 loff_t f_size;
89 struct timespec f_atime;
90 struct timespec f_mtime;
91 struct timespec f_ctime;
92 unsigned long f_blksize;
93 unsigned long f_blocks;
94 int f_unix;
95};
96
97enum smb_conn_state {
98 CONN_VALID, /* everything's fine */
99 CONN_INVALID, /* Something went wrong, but did not
100 try to reconnect yet. */
101 CONN_RETRIED, /* Tried a reconnection, but was refused */
102 CONN_RETRYING /* Currently trying to reconnect */
103};
104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105#define SMB_HEADER_LEN 37 /* includes everything up to, but not
106 * including smb_bcc */
107
108#define SMB_INITIAL_PACKET_SIZE 4000
109#define SMB_MAX_PACKET_SIZE 32768
110
111/* reserve this much space for trans2 parameters. Shouldn't have to be more
112 than 10 or so, but OS/2 seems happier like this. */
113#define SMB_TRANS2_MAX_PARAM 64
114
115#endif
116#endif