Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

constants.h

Go to the documentation of this file.
00001 /*
00002    rdesktop: A Remote Desktop Protocol client.
00003    Miscellaneous protocol constants
00004    Copyright (C) Matthew Chapman 1999-2002
00005    
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015    
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 /* TCP port for Remote Desktop Protocol */
00022 #define TCP_PORT_RDP 3389
00023 
00024 /* ISO PDU codes */
00025 enum ISO_PDU_CODE
00026 {
00027         ISO_PDU_CR = 0xE0,      /* Connection Request */
00028         ISO_PDU_CC = 0xD0,      /* Connection Confirm */
00029         ISO_PDU_DR = 0x80,      /* Disconnect Request */
00030         ISO_PDU_DT = 0xF0,      /* Data */
00031         ISO_PDU_ER = 0x70       /* Error */
00032 };
00033 
00034 /* MCS PDU codes */
00035 enum MCS_PDU_TYPE
00036 {
00037         MCS_EDRQ = 1,           /* Erect Domain Request */
00038         MCS_DPUM = 8,           /* Disconnect Provider Ultimatum */
00039         MCS_AURQ = 10,          /* Attach User Request */
00040         MCS_AUCF = 11,          /* Attach User Confirm */
00041         MCS_CJRQ = 14,          /* Channel Join Request */
00042         MCS_CJCF = 15,          /* Channel Join Confirm */
00043         MCS_SDRQ = 25,          /* Send Data Request */
00044         MCS_SDIN = 26           /* Send Data Indication */
00045 };
00046 
00047 #define MCS_CONNECT_INITIAL     0x7f65
00048 #define MCS_CONNECT_RESPONSE    0x7f66
00049 
00050 #define BER_TAG_BOOLEAN         1
00051 #define BER_TAG_INTEGER         2
00052 #define BER_TAG_OCTET_STRING    4
00053 #define BER_TAG_RESULT          10
00054 #define MCS_TAG_DOMAIN_PARAMS   0x30
00055 
00056 #define MCS_GLOBAL_CHANNEL      1003
00057 
00058 /* RDP secure transport constants */
00059 #define SEC_RANDOM_SIZE         32
00060 #define SEC_MODULUS_SIZE        64
00061 #define SEC_PADDING_SIZE        8
00062 #define SEC_EXPONENT_SIZE       4
00063 
00064 #define SEC_CLIENT_RANDOM       0x0001
00065 #define SEC_ENCRYPT             0x0008
00066 #define SEC_LOGON_INFO          0x0040
00067 #define SEC_LICENCE_NEG         0x0080
00068 
00069 #define SEC_TAG_SRV_INFO        0x0c01
00070 #define SEC_TAG_SRV_CRYPT       0x0c02
00071 #define SEC_TAG_SRV_3           0x0c03
00072 
00073 #define SEC_TAG_CLI_INFO        0xc001
00074 #define SEC_TAG_CLI_CRYPT       0xc002
00075 
00076 #define SEC_TAG_PUBKEY          0x0006
00077 #define SEC_TAG_KEYSIG          0x0008
00078 
00079 #define SEC_RSA_MAGIC           0x31415352      /* RSA1 */
00080 
00081 /* RDP licensing constants */
00082 #define LICENCE_TOKEN_SIZE      10
00083 #define LICENCE_HWID_SIZE       20
00084 #define LICENCE_SIGNATURE_SIZE  16
00085 
00086 #define LICENCE_TAG_DEMAND      0x0201
00087 #define LICENCE_TAG_AUTHREQ     0x0202
00088 #define LICENCE_TAG_ISSUE       0x0203
00089 #define LICENCE_TAG_REISSUE     0x0204
00090 #define LICENCE_TAG_PRESENT     0x0212
00091 #define LICENCE_TAG_REQUEST     0x0213
00092 #define LICENCE_TAG_AUTHRESP    0x0215
00093 #define LICENCE_TAG_RESULT      0x02ff
00094 
00095 #define LICENCE_TAG_USER        0x000f
00096 #define LICENCE_TAG_HOST        0x0010
00097 
00098 /* RDP PDU codes */
00099 enum RDP_PDU_TYPE
00100 {
00101         RDP_PDU_DEMAND_ACTIVE = 1,
00102         RDP_PDU_CONFIRM_ACTIVE = 3,
00103         RDP_PDU_DEACTIVATE = 6,
00104         RDP_PDU_DATA = 7
00105 };
00106 
00107 enum RDP_DATA_PDU_TYPE
00108 {
00109         RDP_DATA_PDU_UPDATE = 2,
00110         RDP_DATA_PDU_CONTROL = 20,
00111         RDP_DATA_PDU_POINTER = 27,
00112         RDP_DATA_PDU_INPUT = 28,
00113         RDP_DATA_PDU_SYNCHRONISE = 31,
00114         RDP_DATA_PDU_BELL = 34,
00115         RDP_DATA_PDU_LOGON = 38,
00116         RDP_DATA_PDU_FONT2 = 39
00117 };
00118 
00119 enum RDP_CONTROL_PDU_TYPE
00120 {
00121         RDP_CTL_REQUEST_CONTROL = 1,
00122         RDP_CTL_GRANT_CONTROL = 2,
00123         RDP_CTL_DETACH = 3,
00124         RDP_CTL_COOPERATE = 4
00125 };
00126 
00127 enum RDP_UPDATE_PDU_TYPE
00128 {
00129         RDP_UPDATE_ORDERS = 0,
00130         RDP_UPDATE_BITMAP = 1,
00131         RDP_UPDATE_PALETTE = 2,
00132         RDP_UPDATE_SYNCHRONIZE = 3
00133 };
00134 
00135 enum RDP_POINTER_PDU_TYPE
00136 {
00137         RDP_POINTER_MOVE = 3,
00138         RDP_POINTER_COLOR = 6,
00139         RDP_POINTER_CACHED = 7
00140 };
00141 
00142 enum RDP_INPUT_DEVICE
00143 {
00144         RDP_INPUT_SYNCHRONIZE = 0,
00145         RDP_INPUT_CODEPOINT = 1,
00146         RDP_INPUT_VIRTKEY = 2,
00147         RDP_INPUT_SCANCODE = 4,
00148         RDP_INPUT_MOUSE = 0x8001
00149 };
00150 
00151 /* Device flags */
00152 #define KBD_FLAG_RIGHT          0x0001
00153 #define KBD_FLAG_EXT            0x0100
00154 #define KBD_FLAG_QUIET          0x1000
00155 #define KBD_FLAG_DOWN           0x4000
00156 #define KBD_FLAG_UP             0x8000
00157 
00158 /* These are for synchronization; not for keystrokes */
00159 #define KBD_FLAG_SCROLL   0x0001
00160 #define KBD_FLAG_NUMLOCK  0x0002
00161 #define KBD_FLAG_CAPITAL  0x0004
00162 
00163 /* See T.128 */
00164 #define RDP_KEYPRESS 0
00165 #define RDP_KEYRELEASE (KBD_FLAG_DOWN | KBD_FLAG_UP)
00166 
00167 #define MOUSE_FLAG_MOVE         0x0800
00168 #define MOUSE_FLAG_BUTTON1      0x1000
00169 #define MOUSE_FLAG_BUTTON2      0x2000
00170 #define MOUSE_FLAG_BUTTON3      0x4000
00171 #define MOUSE_FLAG_BUTTON4      0x0280
00172 #define MOUSE_FLAG_BUTTON5      0x0380
00173 #define MOUSE_FLAG_DOWN         0x8000
00174 
00175 /* Raster operation masks */
00176 #define ROP2_S(rop3) (rop3 & 0xf)
00177 #define ROP2_P(rop3) ((rop3 & 0x3) | ((rop3 & 0x30) >> 2))
00178 
00179 #define ROP2_COPY       0xc
00180 #define ROP2_XOR        0x6
00181 #define ROP2_AND        0x8
00182 #define ROP2_NXOR       0x9
00183 #define ROP2_OR         0xe
00184 
00185 #define MIX_TRANSPARENT 0
00186 #define MIX_OPAQUE      1
00187 
00188 #define TEXT2_VERTICAL          0x04
00189 #define TEXT2_IMPLICIT_X        0x20
00190 
00191 /* RDP capabilities */
00192 #define RDP_CAPSET_GENERAL      1
00193 #define RDP_CAPLEN_GENERAL      0x18
00194 #define OS_MAJOR_TYPE_UNIX      4
00195 #define OS_MINOR_TYPE_XSERVER   7
00196 
00197 #define RDP_CAPSET_BITMAP       2
00198 #define RDP_CAPLEN_BITMAP       0x1C
00199 
00200 #define RDP_CAPSET_ORDER        3
00201 #define RDP_CAPLEN_ORDER        0x58
00202 #define ORDER_CAP_NEGOTIATE     2
00203 #define ORDER_CAP_NOSUPPORT     4
00204 
00205 #define RDP_CAPSET_BMPCACHE     4
00206 #define RDP_CAPLEN_BMPCACHE     0x28
00207 
00208 #define RDP_CAPSET_CONTROL      5
00209 #define RDP_CAPLEN_CONTROL      0x0C
00210 
00211 #define RDP_CAPSET_ACTIVATE     7
00212 #define RDP_CAPLEN_ACTIVATE     0x0C
00213 
00214 #define RDP_CAPSET_POINTER      8
00215 #define RDP_CAPLEN_POINTER      0x08
00216 
00217 #define RDP_CAPSET_SHARE        9
00218 #define RDP_CAPLEN_SHARE        0x08
00219 
00220 #define RDP_CAPSET_COLCACHE     10
00221 #define RDP_CAPLEN_COLCACHE     0x08
00222 
00223 #define RDP_CAPSET_UNKNOWN      13
00224 #define RDP_CAPLEN_UNKNOWN      0x9C
00225 
00226 #define RDP_SOURCE              "MSTSC"
00227 
00228 /* Logon flags */
00229 #define RDP_LOGON_NORMAL        0x33
00230 #define RDP_LOGON_AUTO          0x8
00231 
00232 /* Keymap flags */
00233 #define MapRightShiftMask   (1<<0)
00234 #define MapLeftShiftMask    (1<<1)
00235 #define MapShiftMask (MapRightShiftMask | MapLeftShiftMask)
00236 
00237 #define MapRightAltMask     (1<<2)
00238 #define MapLeftAltMask      (1<<3)
00239 #define MapAltGrMask MapRightAltMask
00240 
00241 #define MapRightCtrlMask    (1<<4)
00242 #define MapLeftCtrlMask     (1<<5)
00243 #define MapCtrlMask (MapRightCtrlMask | MapLeftCtrlMask)
00244 
00245 #define MapRightWinMask     (1<<6)
00246 #define MapLeftWinMask      (1<<7)
00247 #define MapWinMask (MapRightWinMask | MapLeftWinMask)
00248 
00249 #define MapNumLockMask      (1<<8)
00250 #define MapCapsLockMask     (1<<9)
00251 
00252 #define MapLocalStateMask   (1<<10)
00253 
00254 #define MapInhibitMask      (1<<11)
00255 
00256 #define MASK_ADD_BITS(var, mask) (var |= mask)
00257 #define MASK_REMOVE_BITS(var, mask) (var &= ~mask)
00258 #define MASK_HAS_BITS(var, mask) ((var & mask)>0)
00259 #define MASK_CHANGE_BIT(var, mask, active) (var = ((var & ~mask) | (active ? mask : 0)))

Generated on Sat Nov 5 16:17:24 2005 for OPIE by  doxygen 1.4.2