1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
/*
* smb.h
*
* Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
*
*/
#ifndef _LINUX_SMB_H
#define _LINUX_SMB_H
#define SMB_PORT 139
#define SMB_MAXNAMELEN 255
#define SMB_MAXPATHLEN 1024
#define SMB_DEF_MAX_XMIT 32768
/* Allocate max. 1 page */
#define TRANS2_MAX_TRANSFER (4096-17)
#include <asm/types.h>
#ifdef __KERNEL__
typedef u8 byte;
typedef u16 word;
typedef u32 dword;
#else
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
#endif
/* The following macros have been taken directly from Samba. Thanks,
Andrew! */
#undef CAREFUL_ALIGNMENT
/* we know that the 386 can handle misalignment and has the "right"
byteorder */
#if defined(__i386__)
#define CAREFUL_ALIGNMENT 0
#endif
#ifndef CAREFUL_ALIGNMENT
#define CAREFUL_ALIGNMENT 1
#endif
#define BVAL(buf,pos) (((u8 *)(buf))[pos])
#define PVAL(buf,pos) ((unsigned)BVAL(buf,pos))
#define BSET(buf,pos,val) (BVAL(buf,pos) = (val))
#if CAREFUL_ALIGNMENT
#define WVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
#define DVAL(buf,pos) (WVAL(buf,pos)|WVAL(buf,(pos)+2)<<16)
#define SSVALX(buf,pos,val) (BVAL(buf,pos)=(val)&0xFF,BVAL(buf,pos+1)=(val)>>8)
#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
#define WSET(buf,pos,val) { word __val = (val); \
SSVALX((buf),(pos),((word)(__val))); }
#define DSET(buf,pos,val) { dword __val = (val); \
SIVALX((buf),(pos),((dword)(__val))); }
#else
/* this handles things for architectures like the 386 that can handle
alignment errors */
/*
WARNING: This section is dependent on the length of word and dword
being correct
*/
#define WVAL(buf,pos) (*(word *)((char *)(buf) + (pos)))
#define DVAL(buf,pos) (*(dword *)((char *)(buf) + (pos)))
#define WSET(buf,pos,val) WVAL(buf,pos)=((word)(val))
#define DSET(buf,pos,val) DVAL(buf,pos)=((dword)(val))
#endif
/* where to find the base of the SMB packet proper */
#define smb_base(buf) ((byte *)(((byte *)(buf))+4))
#define LANMAN1
#define LANMAN2
#define NT1
enum smb_protocol {
PROTOCOL_NONE,
PROTOCOL_CORE,
PROTOCOL_COREPLUS,
PROTOCOL_LANMAN1,
PROTOCOL_LANMAN2,
PROTOCOL_NT1
};
enum smb_case_hndl {
CASE_DEFAULT,
CASE_LOWER,
CASE_UPPER
};
#ifdef __KERNEL__
enum smb_conn_state {
CONN_VALID, /* everything's fine */
CONN_INVALID, /* Something went wrong, but did not
try to reconnect yet. */
CONN_RETRIED /* Tried a reconnection, but was refused */
};
struct smb_dskattr {
word total;
word allocblocks;
word blocksize;
word free;
};
/*
* Contains all relevant data on a SMB networked file.
*/
struct smb_dirent {
unsigned long f_ino;
umode_t f_mode;
nlink_t f_nlink;
uid_t f_uid;
gid_t f_gid;
kdev_t f_rdev;
off_t f_size;
time_t f_atime;
time_t f_mtime;
time_t f_ctime;
unsigned long f_blksize;
unsigned long f_blocks;
int opened; /* is it open on the fileserver? */
word fileid; /* What id to handle a file with? */
word attr; /* Attribute fields, DOS value */
unsigned short access; /* Access bits. */
unsigned long f_pos; /* File position. (For readdir.) */
unsigned char name[SMB_MAXNAMELEN+1];
int len; /* namelength */
};
#endif /* __KERNEL__ */
#endif /* _LINUX_SMB_H */
|