KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcifs > smb > SmbConstants


1 package jcifs.smb;
2
3 import java.util.LinkedList JavaDoc;
4 import java.net.InetAddress JavaDoc;
5 import java.util.TimeZone JavaDoc;
6 import jcifs.Config;
7
8 interface SmbConstants {
9
10     static final int DEFAULT_PORT = 445;
11
12     static final int DEFAULT_MAX_MPX_COUNT = 10;
13     static final int DEFAULT_RESPONSE_TIMEOUT = 30000;
14     static final int DEFAULT_SO_TIMEOUT = 35000;
15     static final int DEFAULT_RCV_BUF_SIZE = 60416;
16     static final int DEFAULT_SND_BUF_SIZE = 16644;
17     static final int DEFAULT_SSN_LIMIT = 250;
18
19     static final InetAddress JavaDoc LADDR = Config.getLocalHost();
20     static final int LPORT = Config.getInt( "jcifs.smb.client.lport", 0 );
21     static final int MAX_MPX_COUNT = Config.getInt( "jcifs.smb.client.maxMpxCount", DEFAULT_MAX_MPX_COUNT );
22     static final int SND_BUF_SIZE = Config.getInt( "jcifs.smb.client.snd_buf_size", DEFAULT_SND_BUF_SIZE );
23     static final int RCV_BUF_SIZE = Config.getInt( "jcifs.smb.client.rcv_buf_size", DEFAULT_RCV_BUF_SIZE );
24     static final boolean USE_UNICODE = Config.getBoolean( "jcifs.smb.client.useUnicode", true );
25     static final boolean FORCE_UNICODE = Config.getBoolean( "jcifs.smb.client.useUnicode", false );
26     static final boolean USE_NTSTATUS = Config.getBoolean( "jcifs.smb.client.useNtStatus", true );
27     static final boolean SIGNPREF = Config.getBoolean("jcifs.smb.client.signingPreferred", false );
28     static final boolean USE_NTSMBS = Config.getBoolean( "jcifs.smb.client.useNTSmbs", true );
29     static final boolean USE_EXTSEC = Config.getBoolean( "jcifs.smb.client.useExtendedSecurity", false );
30
31     static final String JavaDoc NETBIOS_HOSTNAME = Config.getProperty( "jcifs.netbios.hostname", null );
32
33     static final int FLAGS_NONE = 0x00;
34     static final int FLAGS_LOCK_AND_READ_WRITE_AND_UNLOCK = 0x01;
35     static final int FLAGS_RECEIVE_BUFFER_POSTED = 0x02;
36     static final int FLAGS_PATH_NAMES_CASELESS = 0x08;
37     static final int FLAGS_PATH_NAMES_CANONICALIZED = 0x10;
38     static final int FLAGS_OPLOCK_REQUESTED_OR_GRANTED = 0x20;
39     static final int FLAGS_NOTIFY_OF_MODIFY_ACTION = 0x40;
40     static final int FLAGS_RESPONSE = 0x80;
41
42     static final int FLAGS2_NONE = 0x0000;
43     static final int FLAGS2_LONG_FILENAMES = 0x0001;
44     static final int FLAGS2_EXTENDED_ATTRIBUTES = 0x0002;
45     static final int FLAGS2_SECURITY_SIGNATURES = 0x0004;
46     static final int FLAGS2_EXTENDED_SECURITY_NEGOTIATION = 0x0800;
47     static final int FLAGS2_RESOLVE_PATHS_IN_DFS = 0x1000;
48     static final int FLAGS2_PERMIT_READ_IF_EXECUTE_PERM = 0x2000;
49     static final int FLAGS2_STATUS32 = 0x4000;
50     static final int FLAGS2_UNICODE = 0x8000;
51
52     static final int CAP_NONE = 0x0000;
53     static final int CAP_RAW_MODE = 0x0001;
54     static final int CAP_MPX_MODE = 0x0002;
55     static final int CAP_UNICODE = 0x0004;
56     static final int CAP_LARGE_FILES = 0x0008;
57     static final int CAP_NT_SMBS = 0x0010;
58     static final int CAP_RPC_REMOTE_APIS = 0x0020;
59     static final int CAP_STATUS32 = 0x0040;
60     static final int CAP_LEVEL_II_OPLOCKS = 0x0080;
61     static final int CAP_LOCK_AND_READ = 0x0100;
62     static final int CAP_NT_FIND = 0x0200;
63     static final int CAP_DFS = 0x1000;
64
65     // file attribute encoding
66
static final int ATTR_READONLY = 0x01;
67     static final int ATTR_HIDDEN = 0x02;
68     static final int ATTR_SYSTEM = 0x04;
69     static final int ATTR_VOLUME = 0x08;
70     static final int ATTR_DIRECTORY = 0x10;
71     static final int ATTR_ARCHIVE = 0x20;
72
73     // extended file attribute encoding(others same as above)
74
static final int ATTR_COMPRESSED = 0x800;
75     static final int ATTR_NORMAL = 0x080;
76     static final int ATTR_TEMPORARY = 0x100;
77
78     // access mask encoding
79
static final int FILE_READ_DATA = 0x00000001; // 1
80
static final int FILE_WRITE_DATA = 0x00000002; // 2
81
static final int FILE_APPEND_DATA = 0x00000004; // 3
82
static final int FILE_READ_EA = 0x00000008; // 4
83
static final int FILE_WRITE_EA = 0x00000010; // 5
84
static final int FILE_EXECUTE = 0x00000020; // 6
85
static final int FILE_DELETE = 0x00000040; // 7
86
static final int FILE_READ_ATTRIBUTES = 0x00000080; // 8
87
static final int FILE_WRITE_ATTRIBUTES = 0x00000100; // 9
88
static final int DELETE = 0x00010000; // 16
89
static final int READ_CONTROL = 0x00020000; // 17
90
static final int WRITE_DAC = 0x00040000; // 18
91
static final int WRITE_OWNER = 0x00080000; // 19
92
static final int SYNCHRONIZE = 0x00100000; // 20
93
static final int GENERIC_ALL = 0x10000000; // 28
94
static final int GENERIC_EXECUTE = 0x20000000; // 29
95
static final int GENERIC_WRITE = 0x40000000; // 30
96
static final int GENERIC_READ = 0x80000000; // 31
97

98
99     // flags for move and copy
100
static final int FLAGS_TARGET_MUST_BE_FILE = 0x0001;
101     static final int FLAGS_TARGET_MUST_BE_DIRECTORY = 0x0002;
102     static final int FLAGS_COPY_TARGET_MODE_ASCII = 0x0004;
103     static final int FLAGS_COPY_SOURCE_MODE_ASCII = 0x0008;
104     static final int FLAGS_VERIFY_ALL_WRITES = 0x0010;
105     static final int FLAGS_TREE_COPY = 0x0020;
106
107     // open function
108
static final int OPEN_FUNCTION_FAIL_IF_EXISTS = 0x0000;
109     static final int OPEN_FUNCTION_OVERWRITE_IF_EXISTS = 0x0020;
110
111     static final int PID = (int)( Math.random() * 65536d );
112
113     static final int SECURITY_SHARE = 0x00;
114     static final int SECURITY_USER = 0x01;
115
116     static final int CMD_OFFSET = 4;
117     static final int ERROR_CODE_OFFSET = 5;
118     static final int FLAGS_OFFSET = 9;
119     static final int SIGNATURE_OFFSET = 14;
120     static final int TID_OFFSET = 24;
121     static final int HEADER_LENGTH = 32;
122
123     static final long MILLISECONDS_BETWEEN_1970_AND_1601 = 11644473600000L;
124     static final TimeZone JavaDoc TZ = TimeZone.getDefault();
125
126     static final boolean USE_BATCHING = Config.getBoolean( "jcifs.smb.client.useBatching", true );
127     static final String JavaDoc OEM_ENCODING = Config.getProperty( "jcifs.encoding", Config.DEFAULT_OEM_ENCODING );
128     static final int DEFAULT_FLAGS2 =
129                 FLAGS2_LONG_FILENAMES |
130                 FLAGS2_EXTENDED_ATTRIBUTES |
131                 ( USE_EXTSEC ? FLAGS2_EXTENDED_SECURITY_NEGOTIATION : 0 ) |
132                 ( SIGNPREF ? FLAGS2_SECURITY_SIGNATURES : 0 ) |
133                 ( USE_NTSTATUS ? FLAGS2_STATUS32 : 0 ) |
134                 ( USE_UNICODE ? FLAGS2_UNICODE : 0 );
135     static final int DEFAULT_CAPABILITIES =
136                 ( USE_NTSMBS ? CAP_NT_SMBS : 0 ) |
137                 ( USE_NTSTATUS ? CAP_STATUS32 : 0 ) |
138                 ( USE_UNICODE ? CAP_UNICODE : 0 ) |
139                 CAP_DFS;
140     static final int FLAGS2 = Config.getInt( "jcifs.smb.client.flags2", DEFAULT_FLAGS2 );
141     static final int CAPABILITIES = Config.getInt( "jcifs.smb.client.capabilities", DEFAULT_CAPABILITIES );
142     static final boolean TCP_NODELAY = Config.getBoolean( "jcifs.smb.client.tcpNoDelay", false );
143     static final int RESPONSE_TIMEOUT =
144                 Config.getInt( "jcifs.smb.client.responseTimeout", DEFAULT_RESPONSE_TIMEOUT );
145
146     static final LinkedList JavaDoc CONNECTIONS = new LinkedList JavaDoc();
147
148     static final int SSN_LIMIT =
149             Config.getInt( "jcifs.smb.client.ssnLimit", DEFAULT_SSN_LIMIT );
150     static final int SO_TIMEOUT =
151             Config.getInt( "jcifs.smb.client.soTimeout", DEFAULT_SO_TIMEOUT );
152     static final String JavaDoc NATIVE_OS =
153             Config.getProperty( "jcifs.smb.client.nativeOs", System.getProperty( "os.name" ));
154     static final String JavaDoc NATIVE_LANMAN =
155             Config.getProperty( "jcifs.smb.client.nativeLanMan", "jCIFS" );
156     static final int VC_NUMBER = 1;
157     static final SmbTransport NULL_TRANSPORT = new SmbTransport( null, 0, null, 0 );
158 }
159
Popular Tags