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