0
|
1
|
|
2 package com.trilead.ssh2.packets;
|
|
3
|
|
4 /**
|
|
5 * Packets.
|
|
6 *
|
|
7 * @author Christian Plattner, plattner@trilead.com
|
|
8 * @version $Id: Packets.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
|
|
9 */
|
|
10 public class Packets {
|
|
11 public static final int SSH_MSG_DISCONNECT = 1;
|
|
12 public static final int SSH_MSG_IGNORE = 2;
|
|
13 public static final int SSH_MSG_UNIMPLEMENTED = 3;
|
|
14 public static final int SSH_MSG_DEBUG = 4;
|
|
15 public static final int SSH_MSG_SERVICE_REQUEST = 5;
|
|
16 public static final int SSH_MSG_SERVICE_ACCEPT = 6;
|
|
17
|
|
18 public static final int SSH_MSG_KEXINIT = 20;
|
|
19 public static final int SSH_MSG_NEWKEYS = 21;
|
|
20
|
|
21 public static final int SSH_MSG_KEXDH_INIT = 30;
|
|
22 public static final int SSH_MSG_KEXDH_REPLY = 31;
|
|
23
|
|
24 public static final int SSH_MSG_KEX_DH_GEX_REQUEST_OLD = 30;
|
|
25 public static final int SSH_MSG_KEX_DH_GEX_REQUEST = 34;
|
|
26 public static final int SSH_MSG_KEX_DH_GEX_GROUP = 31;
|
|
27 public static final int SSH_MSG_KEX_DH_GEX_INIT = 32;
|
|
28 public static final int SSH_MSG_KEX_DH_GEX_REPLY = 33;
|
|
29
|
|
30 public static final int SSH_MSG_USERAUTH_REQUEST = 50;
|
|
31 public static final int SSH_MSG_USERAUTH_FAILURE = 51;
|
|
32 public static final int SSH_MSG_USERAUTH_SUCCESS = 52;
|
|
33 public static final int SSH_MSG_USERAUTH_BANNER = 53;
|
|
34 public static final int SSH_MSG_USERAUTH_INFO_REQUEST = 60;
|
|
35 public static final int SSH_MSG_USERAUTH_INFO_RESPONSE = 61;
|
|
36
|
|
37 public static final int SSH_MSG_GLOBAL_REQUEST = 80;
|
|
38 public static final int SSH_MSG_REQUEST_SUCCESS = 81;
|
|
39 public static final int SSH_MSG_REQUEST_FAILURE = 82;
|
|
40
|
|
41 public static final int SSH_MSG_CHANNEL_OPEN = 90;
|
|
42 public static final int SSH_MSG_CHANNEL_OPEN_CONFIRMATION = 91;
|
|
43 public static final int SSH_MSG_CHANNEL_OPEN_FAILURE = 92;
|
|
44 public static final int SSH_MSG_CHANNEL_WINDOW_ADJUST = 93;
|
|
45 public static final int SSH_MSG_CHANNEL_DATA = 94;
|
|
46 public static final int SSH_MSG_CHANNEL_EXTENDED_DATA = 95;
|
|
47 public static final int SSH_MSG_CHANNEL_EOF = 96;
|
|
48 public static final int SSH_MSG_CHANNEL_CLOSE = 97;
|
|
49 public static final int SSH_MSG_CHANNEL_REQUEST = 98;
|
|
50 public static final int SSH_MSG_CHANNEL_SUCCESS = 99;
|
|
51 public static final int SSH_MSG_CHANNEL_FAILURE = 100;
|
|
52
|
|
53 public static final int SSH_EXTENDED_DATA_STDERR = 1;
|
|
54
|
|
55 public static final int SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT = 1;
|
|
56 public static final int SSH_DISCONNECT_PROTOCOL_ERROR = 2;
|
|
57 public static final int SSH_DISCONNECT_KEY_EXCHANGE_FAILED = 3;
|
|
58 public static final int SSH_DISCONNECT_RESERVED = 4;
|
|
59 public static final int SSH_DISCONNECT_MAC_ERROR = 5;
|
|
60 public static final int SSH_DISCONNECT_COMPRESSION_ERROR = 6;
|
|
61 public static final int SSH_DISCONNECT_SERVICE_NOT_AVAILABLE = 7;
|
|
62 public static final int SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED = 8;
|
|
63 public static final int SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE = 9;
|
|
64 public static final int SSH_DISCONNECT_CONNECTION_LOST = 10;
|
|
65 public static final int SSH_DISCONNECT_BY_APPLICATION = 11;
|
|
66 public static final int SSH_DISCONNECT_TOO_MANY_CONNECTIONS = 12;
|
|
67 public static final int SSH_DISCONNECT_AUTH_CANCELLED_BY_USER = 13;
|
|
68 public static final int SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14;
|
|
69 public static final int SSH_DISCONNECT_ILLEGAL_USER_NAME = 15;
|
|
70
|
|
71 public static final int SSH_OPEN_ADMINISTRATIVELY_PROHIBITED = 1;
|
|
72 public static final int SSH_OPEN_CONNECT_FAILED = 2;
|
|
73 public static final int SSH_OPEN_UNKNOWN_CHANNEL_TYPE = 3;
|
|
74 public static final int SSH_OPEN_RESOURCE_SHORTAGE = 4;
|
|
75
|
|
76 private static final String[] reverseNames = new String[101];
|
|
77
|
|
78 static {
|
|
79 reverseNames[1] = "SSH_MSG_DISCONNECT";
|
|
80 reverseNames[2] = "SSH_MSG_IGNORE";
|
|
81 reverseNames[3] = "SSH_MSG_UNIMPLEMENTED";
|
|
82 reverseNames[4] = "SSH_MSG_DEBUG";
|
|
83 reverseNames[5] = "SSH_MSG_SERVICE_REQUEST";
|
|
84 reverseNames[6] = "SSH_MSG_SERVICE_ACCEPT";
|
|
85 reverseNames[20] = "SSH_MSG_KEXINIT";
|
|
86 reverseNames[21] = "SSH_MSG_NEWKEYS";
|
|
87 reverseNames[30] = "SSH_MSG_KEXDH_INIT";
|
|
88 reverseNames[31] = "SSH_MSG_KEXDH_REPLY/SSH_MSG_KEX_DH_GEX_GROUP";
|
|
89 reverseNames[32] = "SSH_MSG_KEX_DH_GEX_INIT";
|
|
90 reverseNames[33] = "SSH_MSG_KEX_DH_GEX_REPLY";
|
|
91 reverseNames[34] = "SSH_MSG_KEX_DH_GEX_REQUEST";
|
|
92 reverseNames[50] = "SSH_MSG_USERAUTH_REQUEST";
|
|
93 reverseNames[51] = "SSH_MSG_USERAUTH_FAILURE";
|
|
94 reverseNames[52] = "SSH_MSG_USERAUTH_SUCCESS";
|
|
95 reverseNames[53] = "SSH_MSG_USERAUTH_BANNER";
|
|
96 reverseNames[60] = "SSH_MSG_USERAUTH_INFO_REQUEST";
|
|
97 reverseNames[61] = "SSH_MSG_USERAUTH_INFO_RESPONSE";
|
|
98 reverseNames[80] = "SSH_MSG_GLOBAL_REQUEST";
|
|
99 reverseNames[81] = "SSH_MSG_REQUEST_SUCCESS";
|
|
100 reverseNames[82] = "SSH_MSG_REQUEST_FAILURE";
|
|
101 reverseNames[90] = "SSH_MSG_CHANNEL_OPEN";
|
|
102 reverseNames[91] = "SSH_MSG_CHANNEL_OPEN_CONFIRMATION";
|
|
103 reverseNames[92] = "SSH_MSG_CHANNEL_OPEN_FAILURE";
|
|
104 reverseNames[93] = "SSH_MSG_CHANNEL_WINDOW_ADJUST";
|
|
105 reverseNames[94] = "SSH_MSG_CHANNEL_DATA";
|
|
106 reverseNames[95] = "SSH_MSG_CHANNEL_EXTENDED_DATA";
|
|
107 reverseNames[96] = "SSH_MSG_CHANNEL_EOF";
|
|
108 reverseNames[97] = "SSH_MSG_CHANNEL_CLOSE";
|
|
109 reverseNames[98] = "SSH_MSG_CHANNEL_REQUEST";
|
|
110 reverseNames[99] = "SSH_MSG_CHANNEL_SUCCESS";
|
|
111 reverseNames[100] = "SSH_MSG_CHANNEL_FAILURE";
|
|
112 }
|
|
113
|
|
114 public static final String getMessageName(int type) {
|
|
115 String res = null;
|
|
116
|
|
117 if ((type >= 0) && (type < reverseNames.length)) {
|
|
118 res = reverseNames[type];
|
|
119 }
|
|
120
|
|
121 return (res == null) ? ("UNKNOWN MSG " + type) : res;
|
|
122 }
|
|
123
|
|
124 // public static final void debug(String tag, byte[] msg)
|
|
125 // {
|
|
126 // System.err.println(tag + " Type: " + msg[0] + ", LEN: " + msg.length);
|
|
127 //
|
|
128 // for (int i = 0; i < msg.length; i++)
|
|
129 // {
|
|
130 // if (((msg[i] >= 'a') && (msg[i] <= 'z')) || ((msg[i] >= 'A') && (msg[i] <= 'Z'))
|
|
131 // || ((msg[i] >= '0') && (msg[i] <= '9')) || (msg[i] == ' '))
|
|
132 // System.err.print((char) msg[i]);
|
|
133 // else
|
|
134 // System.err.print(".");
|
|
135 // }
|
|
136 // System.err.println();
|
|
137 // System.err.flush();
|
|
138 // }
|
|
139 }
|