Source Code Cross Referenced for SmbComTransactionResponse.java in  » Groupware » hipergate » com » knowgate » jcifs » smb » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » hipergate » com.knowgate.jcifs.smb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* jcifs smb client library in Java
002:         * Copyright (C) 2000  "Michael B. Allen" <jcifs at samba dot org>
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package com.knowgate.jcifs.smb;
020:
021:        import java.util.Enumeration;
022:
023:        import com.knowgate.debug.*;
024:
025:        abstract class SmbComTransactionResponse extends ServerMessageBlock
026:                implements  Enumeration {
027:
028:            // relative to headerStart
029:            private static final int SETUP_OFFSET = 61;
030:
031:            private static final int DISCONNECT_TID = 0x01;
032:            private static final int ONE_WAY_TRANSACTION = 0x02;
033:
034:            private int totalParameterCount;
035:            private int totalDataCount;
036:            private int parameterCount;
037:            private int parameterOffset;
038:            private int parameterDisplacement;
039:            private int dataOffset;
040:            private int dataDisplacement;
041:            private int setupCount;
042:            private int pad;
043:            private int pad1;
044:            private boolean parametersDone, dataDone;
045:
046:            private int bufParameterStart;
047:            private int bufDataStart;
048:
049:            int dataCount;
050:            byte subCommand;
051:            boolean hasMore = true;
052:            boolean isPrimary = true;
053:            byte[] txn_buf;
054:
055:            /* for doNetEnum and doFindFirstNext */
056:            int status;
057:            int numEntries;
058:            FileEntry[] results;
059:
060:            SmbComTransactionResponse() {
061:                txn_buf = null;
062:            }
063:
064:            public void reset() {
065:                bufDataStart = 0;
066:                isPrimary = hasMore = true;
067:                parametersDone = dataDone = false;
068:            }
069:
070:            public boolean hasMoreElements() {
071:                return hasMore;
072:            }
073:
074:            public Object nextElement() {
075:                if (isPrimary) {
076:                    isPrimary = false;
077:                }
078:                return this ;
079:            }
080:
081:            int writeParameterWordsWireFormat(byte[] dst, int dstIndex) {
082:                return 0;
083:            }
084:
085:            int writeBytesWireFormat(byte[] dst, int dstIndex) {
086:                return 0;
087:            }
088:
089:            int readParameterWordsWireFormat(byte[] buffer, int bufferIndex) {
090:                int start = bufferIndex;
091:
092:                totalParameterCount = readInt2(buffer, bufferIndex);
093:                if (bufDataStart == 0) {
094:                    bufDataStart = totalParameterCount;
095:                }
096:                bufferIndex += 2;
097:                totalDataCount = readInt2(buffer, bufferIndex);
098:                bufferIndex += 4; // Reserved
099:                parameterCount = readInt2(buffer, bufferIndex);
100:                bufferIndex += 2;
101:                parameterOffset = readInt2(buffer, bufferIndex);
102:                bufferIndex += 2;
103:                parameterDisplacement = readInt2(buffer, bufferIndex);
104:                bufferIndex += 2;
105:                dataCount = readInt2(buffer, bufferIndex);
106:                bufferIndex += 2;
107:                dataOffset = readInt2(buffer, bufferIndex);
108:                bufferIndex += 2;
109:                dataDisplacement = readInt2(buffer, bufferIndex);
110:                bufferIndex += 2;
111:                setupCount = buffer[bufferIndex] & 0xFF;
112:                bufferIndex += 2;
113:                if (setupCount != 0) {
114:                    if (DebugFile.trace)
115:                        DebugFile.writeln("setupCount is not zero: "
116:                                + setupCount);
117:                }
118:
119:                return bufferIndex - start;
120:            }
121:
122:            int readBytesWireFormat(byte[] buffer, int bufferIndex) {
123:                pad = pad1 = 0;
124:                int n;
125:
126:                if (parameterCount > 0) {
127:                    bufferIndex += pad = parameterOffset
128:                            - (bufferIndex - headerStart);
129:                    System.arraycopy(buffer, bufferIndex, txn_buf,
130:                            bufParameterStart + parameterDisplacement,
131:                            parameterCount);
132:                    bufferIndex += parameterCount;
133:                }
134:                if (dataCount > 0) {
135:                    bufferIndex += pad1 = dataOffset
136:                            - (bufferIndex - headerStart);
137:                    System.arraycopy(buffer, bufferIndex, txn_buf, bufDataStart
138:                            + dataDisplacement, dataCount);
139:                    bufferIndex += dataCount;
140:                }
141:
142:                /* Check to see if the entire transaction has been
143:                 * read. If so call the read methods.
144:                 */
145:
146:                if (!parametersDone
147:                        && (parameterDisplacement + parameterCount) == totalParameterCount) {
148:                    parametersDone = true;
149:                }
150:
151:                if (!dataDone
152:                        && (dataDisplacement + dataCount) == totalDataCount) {
153:                    dataDone = true;
154:                }
155:
156:                if (parametersDone && dataDone) {
157:                    hasMore = false;
158:                    readParametersWireFormat(txn_buf, bufParameterStart,
159:                            totalParameterCount);
160:                    readDataWireFormat(txn_buf, bufDataStart, totalDataCount);
161:                }
162:
163:                return pad + parameterCount + pad1 + dataCount;
164:            }
165:
166:            abstract int writeSetupWireFormat(byte[] dst, int dstIndex);
167:
168:            abstract int writeParametersWireFormat(byte[] dst, int dstIndex);
169:
170:            abstract int writeDataWireFormat(byte[] dst, int dstIndex);
171:
172:            abstract int readSetupWireFormat(byte[] buffer, int bufferIndex,
173:                    int len);
174:
175:            abstract int readParametersWireFormat(byte[] buffer,
176:                    int bufferIndex, int len);
177:
178:            abstract int readDataWireFormat(byte[] buffer, int bufferIndex,
179:                    int len);
180:
181:            public String toString() {
182:                return new String(super .toString() + ",totalParameterCount="
183:                        + totalParameterCount + ",totalDataCount="
184:                        + totalDataCount + ",parameterCount=" + parameterCount
185:                        + ",parameterOffset=" + parameterOffset
186:                        + ",parameterDisplacement=" + parameterDisplacement
187:                        + ",dataCount=" + dataCount + ",dataOffset="
188:                        + dataOffset + ",dataDisplacement=" + dataDisplacement
189:                        + ",setupCount=" + setupCount + ",pad=" + pad
190:                        + ",pad1=" + pad1);
191:            }
192:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.