Source Code Cross Referenced for RdpAbstractPacket.java in  » Net » Remote-desktop » org » rdesktop » server » rdp » 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 » Net » Remote desktop » org.rdesktop.server.rdp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        ///////////////////////////////////////////////////////////////////////////////
002:        //
003:        //   This program is free software; you can redistribute it and/or modify
004:        //   it under the terms of the GNU General Public License and GNU Library
005:        //   General Public License as published by the Free Software Foundation;
006:        //   either version 2, or (at your option) any later version.
007:        //
008:        //   This program is distributed in the hope that it will be useful,
009:        //   but WITHOUT ANY WARRANTY; without even the implied warranty of
010:        //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011:        //   GNU General Public License and GNU Library General Public License
012:        //   for more details.
013:        //
014:        //   You should have received a copy of the GNU General Public License
015:        //   and GNU Library General Public License along with this program; if
016:        //   not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
017:        //   MA 02139, USA.
018:        //
019:        ///////////////////////////////////////////////////////////////////////////////
020:
021:        package org.rdesktop.server.rdp;
022:
023:        public abstract class RdpAbstractPacket implements  java.io.Serializable {
024:            public static final int MCS_HEADER = 1;
025:            public static final int SECURE_HEADER = 2;
026:            public static final int RDP_HEADER = 3;
027:            public static final int CHANNEL_HEADER = 4;
028:
029:            protected int m_mcs = -1;
030:            protected int m_secure = -1;
031:            protected int m_rdp = -1;
032:            protected int m_channel = -1;
033:            protected int m_start = -1;
034:            protected int m_end = -1;
035:
036:            public abstract int get8();
037:
038:            public abstract int get8(int where);
039:
040:            public abstract void set8(int what);
041:
042:            public abstract void set8(int where, int what);
043:
044:            public abstract int getLittleEndian16();
045:
046:            public abstract int getLittleEndian16(int where);
047:
048:            public abstract void setLittleEndian16(int what);
049:
050:            public abstract void setLittleEndian16(int where, int what);
051:
052:            public abstract int getBigEndian16();
053:
054:            public abstract int getBigEndian16(int where);
055:
056:            public abstract void setBigEndian16(int what);
057:
058:            public abstract void setBigEndian16(int where, int what);
059:
060:            public abstract int getLittleEndian32();
061:
062:            public abstract int getLittleEndian32(int where);
063:
064:            public abstract void setLittleEndian32(int what);
065:
066:            public abstract void setLittleEndian32(int where, int what);
067:
068:            public abstract int getBigEndian32();
069:
070:            public abstract int getBigEndian32(int where);
071:
072:            public abstract void setBigEndian32(int what);
073:
074:            public abstract void setBigEndian32(int where, int what);
075:
076:            public abstract void copyToByteArray(byte[] array,
077:                    int array_offset, int mem_offset, int len);
078:
079:            public abstract void copyFromByteArray(byte[] array,
080:                    int array_offset, int mem_offset, int len);
081:
082:            public abstract void copyToPacket(RdpPacket dst, int srcOffset,
083:                    int dstOffset, int len);
084:
085:            public abstract void copyFromPacket(RdpPacket src, int srcOffset,
086:                    int dstOffset, int len);
087:
088:            public abstract int getSize();
089:
090:            public abstract int getPosition();
091:
092:            public abstract void setPosition(int position);
093:
094:            public abstract void incrementPosition(int length);
095:
096:            public abstract int capacity();
097:
098:            public void markEnd() {
099:                m_end = getPosition();
100:            }
101:
102:            public void markEnd(int position) {
103:                if (position > capacity()) {
104:                    throw new ArrayIndexOutOfBoundsException("Mark > size!");
105:                }
106:
107:                m_end = position;
108:            }
109:
110:            public int getEnd() {
111:                return m_end;
112:            }
113:
114:            public void pushLayer(int header, int increment)
115:                    throws RdpDesktopException {
116:                setHeader(header);
117:                incrementPosition(increment);
118:            }
119:
120:            public void setHeader(int header) throws RdpDesktopException {
121:                switch (header) {
122:                case RdpPacket.MCS_HEADER: {
123:                    m_mcs = getPosition();
124:                    break;
125:                }
126:                case RdpPacket.SECURE_HEADER: {
127:                    m_secure = getPosition();
128:                    break;
129:                }
130:                case RdpPacket.RDP_HEADER: {
131:                    m_rdp = getPosition();
132:                    break;
133:                }
134:                case RdpPacket.CHANNEL_HEADER: {
135:                    m_channel = getPosition();
136:                    break;
137:                }
138:                default: {
139:                    throw new RdpDesktopException("Wrong Header!");
140:                }
141:                }
142:            }
143:
144:            public int getHeader(int header) throws RdpDesktopException {
145:                switch (header) {
146:                case RdpPacket.MCS_HEADER: {
147:                    return m_mcs;
148:                }
149:                case RdpPacket.SECURE_HEADER: {
150:                    return m_secure;
151:                }
152:                case RdpPacket.RDP_HEADER: {
153:                    return m_rdp;
154:                }
155:                case RdpPacket.CHANNEL_HEADER: {
156:                    return m_channel;
157:                }
158:                default: {
159:                    throw new RdpDesktopException("Wrong Header!");
160:                }
161:                }
162:            }
163:
164:            public void setStart(int position) {
165:                m_start = position;
166:            }
167:
168:            public int getStart() {
169:                return m_start;
170:            }
171:
172:            public void outUnicodeString(String str, int len) {
173:                int i = 0, j = 0;
174:
175:                if (str.length() != 0) {
176:                    char[] name = str.toCharArray();
177:                    while (i < len) {
178:                        setLittleEndian16((short) name[j++]);
179:                        i += 2;
180:                    }
181:
182:                    setLittleEndian16(0);
183:                } else {
184:                    setLittleEndian16(0);
185:                }
186:            }
187:
188:            public void out_uint8p(String str, int length) {
189:                byte[] bStr = str.getBytes();
190:                copyFromByteArray(bStr, 0, getPosition(), bStr.length);
191:                incrementPosition(length);
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.