hrr_rb_ssh 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/demo/server.rb +13 -1
  3. data/lib/hrr_rb_ssh/authentication/method/none/context.rb +1 -1
  4. data/lib/hrr_rb_ssh/authentication/method/none.rb +4 -4
  5. data/lib/hrr_rb_ssh/authentication/method/password/context.rb +1 -1
  6. data/lib/hrr_rb_ssh/authentication/method/password.rb +4 -4
  7. data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/codable.rb +5 -5
  8. data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_dss.rb +29 -18
  9. data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_rsa.rb +27 -16
  10. data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm.rb +7 -13
  11. data/lib/hrr_rb_ssh/authentication/method/publickey/context.rb +1 -1
  12. data/lib/hrr_rb_ssh/authentication/method/publickey.rb +5 -5
  13. data/lib/hrr_rb_ssh/authentication/method.rb +6 -12
  14. data/lib/hrr_rb_ssh/authentication.rb +1 -1
  15. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env/context.rb +2 -2
  16. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env.rb +2 -3
  17. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec/context.rb +2 -2
  18. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec.rb +2 -3
  19. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req/context.rb +2 -2
  20. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req.rb +2 -3
  21. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell/context.rb +2 -2
  22. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb +2 -3
  23. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem/context.rb +2 -2
  24. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem.rb +2 -3
  25. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type.rb +16 -11
  26. data/lib/hrr_rb_ssh/connection/channel/channel_type/session.rb +1 -15
  27. data/lib/hrr_rb_ssh/connection/channel/channel_type.rb +15 -10
  28. data/lib/hrr_rb_ssh/connection/channel.rb +1 -1
  29. data/lib/hrr_rb_ssh/data_type.rb +153 -0
  30. data/lib/hrr_rb_ssh/message/001_ssh_msg_disconnect.rb +6 -6
  31. data/lib/hrr_rb_ssh/message/002_ssh_msg_ignore.rb +4 -4
  32. data/lib/hrr_rb_ssh/message/003_ssh_msg_unimplemented.rb +4 -4
  33. data/lib/hrr_rb_ssh/message/004_ssh_msg_debug.rb +6 -6
  34. data/lib/hrr_rb_ssh/message/005_ssh_msg_service_request.rb +4 -4
  35. data/lib/hrr_rb_ssh/message/006_ssh_msg_service_accept.rb +4 -4
  36. data/lib/hrr_rb_ssh/message/020_ssh_msg_kexinit.rb +31 -31
  37. data/lib/hrr_rb_ssh/message/021_ssh_msg_newkeys.rb +3 -3
  38. data/lib/hrr_rb_ssh/message/030_ssh_msg_kexdh_init.rb +4 -4
  39. data/lib/hrr_rb_ssh/message/031_ssh_msg_kexdh_reply.rb +6 -6
  40. data/lib/hrr_rb_ssh/message/050_ssh_msg_userauth_request.rb +18 -18
  41. data/lib/hrr_rb_ssh/message/051_ssh_msg_userauth_failure.rb +5 -5
  42. data/lib/hrr_rb_ssh/message/052_ssh_msg_userauth_success.rb +3 -3
  43. data/lib/hrr_rb_ssh/message/060_ssh_msg_userauth_pk_ok.rb +5 -5
  44. data/lib/hrr_rb_ssh/message/080_ssh_msg_global_request.rb +13 -13
  45. data/lib/hrr_rb_ssh/message/081_ssh_msg_request_success.rb +6 -6
  46. data/lib/hrr_rb_ssh/message/082_ssh_msg_request_failure.rb +3 -3
  47. data/lib/hrr_rb_ssh/message/090_ssh_msg_channel_open.rb +25 -25
  48. data/lib/hrr_rb_ssh/message/091_ssh_msg_channel_open_confirmation.rb +25 -25
  49. data/lib/hrr_rb_ssh/message/092_ssh_msg_channel_open_failure.rb +7 -7
  50. data/lib/hrr_rb_ssh/message/093_ssh_msg_channel_window_adjust.rb +5 -5
  51. data/lib/hrr_rb_ssh/message/094_ssh_msg_channel_data.rb +5 -5
  52. data/lib/hrr_rb_ssh/message/095_ssh_msg_channel_extended_data.rb +6 -6
  53. data/lib/hrr_rb_ssh/message/096_ssh_msg_channel_eof.rb +4 -4
  54. data/lib/hrr_rb_ssh/message/097_ssh_msg_channel_close.rb +4 -4
  55. data/lib/hrr_rb_ssh/message/098_ssh_msg_channel_request.rb +53 -53
  56. data/lib/hrr_rb_ssh/message/099_ssh_msg_channel_success.rb +4 -4
  57. data/lib/hrr_rb_ssh/message/100_ssh_msg_channel_failure.rb +4 -4
  58. data/lib/hrr_rb_ssh/message/codable.rb +2 -3
  59. data/lib/hrr_rb_ssh/subclass_with_preference_listable.rb +29 -0
  60. data/lib/hrr_rb_ssh/transport/compression_algorithm/functionable.rb +4 -4
  61. data/lib/hrr_rb_ssh/transport/compression_algorithm/none.rb +1 -6
  62. data/lib/hrr_rb_ssh/transport/compression_algorithm/unfunctionable.rb +4 -0
  63. data/lib/hrr_rb_ssh/transport/compression_algorithm/zlib.rb +1 -6
  64. data/lib/hrr_rb_ssh/transport/compression_algorithm.rb +5 -11
  65. data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_cbc.rb +1 -2
  66. data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_ctr.rb +1 -2
  67. data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_cbc.rb +1 -2
  68. data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_ctr.rb +1 -2
  69. data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_cbc.rb +1 -2
  70. data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_ctr.rb +1 -2
  71. data/lib/hrr_rb_ssh/transport/encryption_algorithm/arcfour.rb +1 -2
  72. data/lib/hrr_rb_ssh/transport/encryption_algorithm/blowfish_cbc.rb +1 -2
  73. data/lib/hrr_rb_ssh/transport/encryption_algorithm/cast128_cbc.rb +1 -2
  74. data/lib/hrr_rb_ssh/transport/encryption_algorithm/functionable.rb +1 -2
  75. data/lib/hrr_rb_ssh/transport/encryption_algorithm/none.rb +1 -6
  76. data/lib/hrr_rb_ssh/transport/encryption_algorithm/three_des_cbc.rb +1 -2
  77. data/lib/hrr_rb_ssh/transport/encryption_algorithm/unfunctionable.rb +6 -0
  78. data/lib/hrr_rb_ssh/transport/encryption_algorithm.rb +5 -11
  79. data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman.rb +14 -14
  80. data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group14_sha1.rb +2 -5
  81. data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group1_sha1.rb +2 -5
  82. data/lib/hrr_rb_ssh/transport/kex_algorithm.rb +5 -10
  83. data/lib/hrr_rb_ssh/transport/mac_algorithm/functionable.rb +2 -3
  84. data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5.rb +3 -5
  85. data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5_96.rb +3 -5
  86. data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1.rb +3 -5
  87. data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1_96.rb +3 -5
  88. data/lib/hrr_rb_ssh/transport/mac_algorithm/none.rb +2 -8
  89. data/lib/hrr_rb_ssh/transport/mac_algorithm/unfunctionable.rb +4 -0
  90. data/lib/hrr_rb_ssh/transport/mac_algorithm.rb +5 -11
  91. data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_dss.rb +14 -13
  92. data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_rsa.rb +12 -11
  93. data/lib/hrr_rb_ssh/transport/server_host_key_algorithm.rb +5 -10
  94. data/lib/hrr_rb_ssh/transport.rb +147 -108
  95. data/lib/hrr_rb_ssh/version.rb +1 -1
  96. metadata +4 -12
  97. data/lib/hrr_rb_ssh/authentication/method/method.rb +0 -34
  98. data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/algorithm.rb +0 -41
  99. data/lib/hrr_rb_ssh/connection/channel/channel_type/channel_type.rb +0 -30
  100. data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/request_type.rb +0 -34
  101. data/lib/hrr_rb_ssh/transport/compression_algorithm/compression_algorithm.rb +0 -34
  102. data/lib/hrr_rb_ssh/transport/data_type.rb +0 -163
  103. data/lib/hrr_rb_ssh/transport/encryption_algorithm/encryption_algorithm.rb +0 -34
  104. data/lib/hrr_rb_ssh/transport/kex_algorithm/kex_algorithm.rb +0 -34
  105. data/lib/hrr_rb_ssh/transport/mac_algorithm/mac_algorithm.rb +0 -34
  106. data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/server_host_key_algorithm.rb +0 -34
@@ -4,22 +4,27 @@
4
4
  module HrrRbSsh
5
5
  class Connection
6
6
  class Channel
7
- module ChannelType
8
- def self.list
9
- ChannelType.list
10
- end
7
+ class ChannelType
8
+ @subclass_list = Array.new
9
+ class << self
10
+ def inherited klass
11
+ @subclass_list.push klass if @subclass_list
12
+ end
11
13
 
12
- def self.name_list
13
- ChannelType.name_list
14
- end
14
+ def [] key
15
+ __subclass_list__(__method__).find{ |klass| klass::NAME == key }
16
+ end
17
+
18
+ def __subclass_list__ method_name
19
+ send(:method_missing, method_name) unless @subclass_list
20
+ @subclass_list
21
+ end
15
22
 
16
- def self.[] key
17
- ChannelType[key]
23
+ private :__subclass_list__
18
24
  end
19
25
  end
20
26
  end
21
27
  end
22
28
  end
23
29
 
24
- require 'hrr_rb_ssh/connection/channel/channel_type/channel_type'
25
30
  require 'hrr_rb_ssh/connection/channel/channel_type/session'
@@ -209,7 +209,7 @@ module HrrRbSsh
209
209
 
210
210
  def request message, variables
211
211
  request_type = message['request type']
212
- ChannelType[@channel_type][request_type].run @proc_chain, @connection.username, @request_handler_io, variables, message, @connection.options
212
+ ChannelType[@channel_type]::RequestType[request_type].run @proc_chain, @connection.username, @request_handler_io, variables, message, @connection.options
213
213
  end
214
214
 
215
215
  def send_channel_success
@@ -0,0 +1,153 @@
1
+ # coding: utf-8
2
+ # vim: et ts=2 sw=2
3
+
4
+ require 'openssl'
5
+
6
+ module HrrRbSsh
7
+ module DataType
8
+ class Byte
9
+ def self.encode arg
10
+ case arg
11
+ when 0x00..0xff
12
+ [arg].pack("C")
13
+ else
14
+ raise ArgumentError, "must be in #{0x00}..#{0xff}, but got #{arg.inspect}"
15
+ end
16
+ end
17
+
18
+ def self.decode io
19
+ io.read(1).unpack("C")[0]
20
+ end
21
+ end
22
+
23
+ class Boolean
24
+ def self.encode arg
25
+ case arg
26
+ when false
27
+ [0].pack("C")
28
+ when true
29
+ [1].pack("C")
30
+ else
31
+ raise ArgumentError, "must be #{true} or #{false}, but got #{arg.inspect}"
32
+ end
33
+ end
34
+
35
+ def self.decode io
36
+ if 0 == io.read(1).unpack("C")[0]
37
+ false
38
+ else
39
+ true
40
+ end
41
+ end
42
+ end
43
+
44
+ class Uint32
45
+ def self.encode arg
46
+ case arg
47
+ when 0x0000_0000..0xffff_ffff
48
+ [arg].pack("N")
49
+ else
50
+ raise ArgumentError, "must be in #{0x0000_0000}..#{0xffff_ffff}, but got #{arg.inspect}"
51
+ end
52
+ end
53
+
54
+ def self.decode io
55
+ io.read(4).unpack("N")[0]
56
+ end
57
+ end
58
+
59
+ class Uint64
60
+ def self.encode arg
61
+ case arg
62
+ when 0x0000_0000_0000_0000..0xffff_ffff_ffff_ffff
63
+ [arg >> 32].pack("N") + [arg & 0x0000_0000_ffff_ffff].pack("N")
64
+ else
65
+ raise ArgumentError, "must be in #{0x0000_0000_0000_0000}..#{0xffff_ffff_ffff_ffff}, but got #{arg.inspect}"
66
+ end
67
+ end
68
+
69
+ def self.decode io
70
+ (io.read(4).unpack("N")[0] << 32) + (io.read(4).unpack("N")[0])
71
+ end
72
+ end
73
+
74
+ class String
75
+ def self.encode arg
76
+ unless arg.kind_of? ::String
77
+ raise ArgumentError, "must be a kind of String, but got #{arg.inspect}"
78
+ end
79
+ if arg.length > 0xffff_ffff
80
+ raise ArgumentError, "must be shorter than or equal to #{0xffff_ffff}, but got length #{arg.length}"
81
+ end
82
+ [arg.length, arg].pack("Na*")
83
+ end
84
+
85
+ def self.decode io
86
+ length = io.read(4).unpack("N")[0]
87
+ io.read(length).unpack("a*")[0]
88
+ end
89
+ end
90
+
91
+ class Mpint
92
+ def self.encode arg
93
+ unless arg.kind_of? ::Integer
94
+ raise ArgumentError, "must be a kind of Integer, but got #{arg.inspect}"
95
+ end
96
+ if arg.size > 0xffff_ffff
97
+ raise ArgumentError, "must be shorter than or equal to #{0xffff_ffff}, but got length #{arg.size}"
98
+ end
99
+ bn = ::OpenSSL::BN.new(arg)
100
+ if bn < 0
101
+ # get 2's complement
102
+ tc = bn.to_i & ((1 << (bn.num_bytes * 8)) - 1)
103
+ # get hex representation
104
+ hex_str = "%x" % tc
105
+
106
+ if tc[(bn.num_bytes * 8) - 1] == 1
107
+ [bn.num_bytes, hex_str].pack("NH*")
108
+ else
109
+ [bn.num_bytes + 1, "ff" + hex_str].pack("NH*")
110
+ end
111
+ else
112
+ bn.to_s(0)
113
+ end
114
+ end
115
+
116
+ def self.decode io
117
+ length = io.read(4).unpack("N")[0]
118
+ hex_str = io.read(length).unpack("H*")[0]
119
+ # get temporal integer value
120
+ value = hex_str.hex
121
+ if length == 0
122
+ 0
123
+ elsif value[(length * 8) - 1] == 0
124
+ value
125
+ else
126
+ num_bytes = if hex_str.start_with?("ff") then length - 1 else length end
127
+ - (((~ value) & ((1 << (num_bytes * 8)) - 1)) + 1)
128
+ end
129
+ end
130
+ end
131
+
132
+ class NameList
133
+ def self.encode arg
134
+ unless arg.kind_of? Array
135
+ raise ArgumentError, "must be a kind of Array, but got #{arg.inspect}"
136
+ end
137
+ unless (arg.map(&:class) - [::String]).empty?
138
+ raise ArgumentError, "must be with all elements of String, but got #{arg.inspect}"
139
+ end
140
+ joined_arg = arg.join(',')
141
+ if joined_arg.length > 0xffff_ffff
142
+ raise ArgumentError, "must be shorter than or equal to #{0xffff_ffff}, but got length #{joined_arg.length}"
143
+ end
144
+ [joined_arg.length, joined_arg].pack("Na*")
145
+ end
146
+
147
+ def self.decode io
148
+ length = io.read(4).unpack("N")[0]
149
+ io.read(length).unpack("a*")[0].split(',')
150
+ end
151
+ end
152
+ end
153
+ end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -33,11 +33,11 @@ module HrrRbSsh
33
33
  VALUE = 1
34
34
 
35
35
  DEFINITION = [
36
- # [Data Type, Field Name]
37
- ['byte', 'message number'],
38
- ['uint32', 'reason code'],
39
- ['string', 'description'],
40
- ['string', 'language tag'],
36
+ #[DataType, Field Name]
37
+ [DataType::Byte, 'message number'],
38
+ [DataType::Uint32, 'reason code'],
39
+ [DataType::String, 'description'],
40
+ [DataType::String, 'language tag'],
41
41
  ]
42
42
  end
43
43
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,9 +15,9 @@ module HrrRbSsh
15
15
  VALUE = 2
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['string', 'data'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::String, 'data'],
21
21
  ]
22
22
  end
23
23
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,9 +15,9 @@ module HrrRbSsh
15
15
  VALUE = 3
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['uint32', 'packet sequence number of rejected message'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::Uint32, 'packet sequence number of rejected message'],
21
21
  ]
22
22
  end
23
23
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,11 +15,11 @@ module HrrRbSsh
15
15
  VALUE = 4
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['boolean', 'always_display'],
21
- ['string', 'message'],
22
- ['string', 'language tag'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::Boolean, 'always_display'],
21
+ [DataType::String, 'message'],
22
+ [DataType::String, 'language tag'],
23
23
  ]
24
24
  end
25
25
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,9 +15,9 @@ module HrrRbSsh
15
15
  VALUE = 5
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['string', 'service name'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::String, 'service name'],
21
21
  ]
22
22
  end
23
23
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,9 +15,9 @@ module HrrRbSsh
15
15
  VALUE = 6
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['string', 'service name'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::String, 'service name'],
21
21
  ]
22
22
  end
23
23
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,36 +15,36 @@ module HrrRbSsh
15
15
  VALUE = 20
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['byte', 'cookie (random byte)'],
21
- ['byte', 'cookie (random byte)'],
22
- ['byte', 'cookie (random byte)'],
23
- ['byte', 'cookie (random byte)'],
24
- ['byte', 'cookie (random byte)'],
25
- ['byte', 'cookie (random byte)'],
26
- ['byte', 'cookie (random byte)'],
27
- ['byte', 'cookie (random byte)'],
28
- ['byte', 'cookie (random byte)'],
29
- ['byte', 'cookie (random byte)'],
30
- ['byte', 'cookie (random byte)'],
31
- ['byte', 'cookie (random byte)'],
32
- ['byte', 'cookie (random byte)'],
33
- ['byte', 'cookie (random byte)'],
34
- ['byte', 'cookie (random byte)'],
35
- ['byte', 'cookie (random byte)'],
36
- ['name-list', 'kex_algorithms'],
37
- ['name-list', 'server_host_key_algorithms'],
38
- ['name-list', 'encryption_algorithms_client_to_server'],
39
- ['name-list', 'encryption_algorithms_server_to_client'],
40
- ['name-list', 'mac_algorithms_client_to_server'],
41
- ['name-list', 'mac_algorithms_server_to_client'],
42
- ['name-list', 'compression_algorithms_client_to_server'],
43
- ['name-list', 'compression_algorithms_server_to_client'],
44
- ['name-list', 'languages_client_to_server'],
45
- ['name-list', 'languages_server_to_client'],
46
- ['boolean', 'first_kex_packet_follows'],
47
- ['uint32', '0 (reserved for future extension)'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::Byte, 'cookie (random byte)'],
21
+ [DataType::Byte, 'cookie (random byte)'],
22
+ [DataType::Byte, 'cookie (random byte)'],
23
+ [DataType::Byte, 'cookie (random byte)'],
24
+ [DataType::Byte, 'cookie (random byte)'],
25
+ [DataType::Byte, 'cookie (random byte)'],
26
+ [DataType::Byte, 'cookie (random byte)'],
27
+ [DataType::Byte, 'cookie (random byte)'],
28
+ [DataType::Byte, 'cookie (random byte)'],
29
+ [DataType::Byte, 'cookie (random byte)'],
30
+ [DataType::Byte, 'cookie (random byte)'],
31
+ [DataType::Byte, 'cookie (random byte)'],
32
+ [DataType::Byte, 'cookie (random byte)'],
33
+ [DataType::Byte, 'cookie (random byte)'],
34
+ [DataType::Byte, 'cookie (random byte)'],
35
+ [DataType::Byte, 'cookie (random byte)'],
36
+ [DataType::NameList, 'kex_algorithms'],
37
+ [DataType::NameList, 'server_host_key_algorithms'],
38
+ [DataType::NameList, 'encryption_algorithms_client_to_server'],
39
+ [DataType::NameList, 'encryption_algorithms_server_to_client'],
40
+ [DataType::NameList, 'mac_algorithms_client_to_server'],
41
+ [DataType::NameList, 'mac_algorithms_server_to_client'],
42
+ [DataType::NameList, 'compression_algorithms_client_to_server'],
43
+ [DataType::NameList, 'compression_algorithms_server_to_client'],
44
+ [DataType::NameList, 'languages_client_to_server'],
45
+ [DataType::NameList, 'languages_server_to_client'],
46
+ [DataType::Boolean, 'first_kex_packet_follows'],
47
+ [DataType::Uint32, '0 (reserved for future extension)'],
48
48
  ]
49
49
  end
50
50
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,8 +15,8 @@ module HrrRbSsh
15
15
  VALUE = 21
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
20
  ]
21
21
  end
22
22
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,9 +15,9 @@ module HrrRbSsh
15
15
  VALUE = 30
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['mpint', 'e'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::Mpint, 'e'],
21
21
  ]
22
22
  end
23
23
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,11 +15,11 @@ module HrrRbSsh
15
15
  VALUE = 31
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['string', 'server public host key and certificates (K_S)'],
21
- ['mpint', 'f'],
22
- ['string', 'signature of H'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::String, 'server public host key and certificates (K_S)'],
21
+ [DataType::Mpint, 'f'],
22
+ [DataType::String, 'signature of H'],
23
23
  ]
24
24
  end
25
25
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,32 +15,32 @@ module HrrRbSsh
15
15
  VALUE = 50
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['string', 'user name'],
21
- ['string', 'service name'],
22
- ['string', 'method name'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::String, 'user name'],
21
+ [DataType::String, 'service name'],
22
+ [DataType::String, 'method name'],
23
23
  ]
24
24
 
25
25
  PUBLICKEY_DEFINITION = [
26
- # [Data Type, Field Name]
27
- # ['string', 'method name' : "publickey"],
28
- ['boolean', 'with signature'],
29
- ['string', 'public key algorithm name'],
30
- ['string', 'public key blob'],
26
+ #[DataType, Field Name]
27
+ #[DataType::String, 'method name' : "publickey"],
28
+ [DataType::Boolean, 'with signature'],
29
+ [DataType::String, 'public key algorithm name'],
30
+ [DataType::String, 'public key blob'],
31
31
  ]
32
32
 
33
33
  PUBLICKEY_SIGNATURE_DEFINITION = [
34
- # [Data Type, Field Name]
35
- # ['string', 'with signature' : "TRUE"],
36
- ['string', 'signature'],
34
+ #[DataType, Field Name]
35
+ #[DataType::String, 'with signature' : "TRUE"],
36
+ [DataType::String, 'signature'],
37
37
  ]
38
38
 
39
39
  PASSWORD_DEFINITION = [
40
- # [Data Type, Field Name]
41
- # ['string', 'method name' : "password"],
42
- ['boolean', 'FALSE'],
43
- ['string', 'plaintext password'],
40
+ #[DataType, Field Name]
41
+ #[DataType::String, 'method name' : "password"],
42
+ [DataType::Boolean, 'FALSE'],
43
+ [DataType::String, 'plaintext password'],
44
44
  ]
45
45
 
46
46
  CONDITIONAL_DEFINITION = {
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,10 +15,10 @@ module HrrRbSsh
15
15
  VALUE = 51
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['name-list', 'authentications that can continue'],
21
- ['boolean', 'partial success'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::NameList, 'authentications that can continue'],
21
+ [DataType::Boolean, 'partial success'],
22
22
  ]
23
23
  end
24
24
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,8 +15,8 @@ module HrrRbSsh
15
15
  VALUE = 52
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
20
  ]
21
21
  end
22
22
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,10 +15,10 @@ module HrrRbSsh
15
15
  VALUE = 60
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['string', 'public key algorithm name from the request'],
21
- ['string', 'public key blob from the request'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::String, 'public key algorithm name from the request'],
21
+ [DataType::String, 'public key blob from the request'],
22
22
  ]
23
23
  end
24
24
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  # vim: et ts=2 sw=2
3
3
 
4
- require 'hrr_rb_ssh/logger'
4
+ require 'hrr_rb_ssh/data_type'
5
5
  require 'hrr_rb_ssh/message/codable'
6
6
 
7
7
  module HrrRbSsh
@@ -15,24 +15,24 @@ module HrrRbSsh
15
15
  VALUE = 80
16
16
 
17
17
  DEFINITION = [
18
- # [Data Type, Field Name]
19
- ['byte', 'message number'],
20
- ['string', 'request name'],
21
- ['boolean', 'want reply'],
18
+ #[DataType, Field Name]
19
+ [DataType::Byte, 'message number'],
20
+ [DataType::String, 'request name'],
21
+ [DataType::Boolean, 'want reply'],
22
22
  ]
23
23
 
24
24
  TCPIP_FORWARD_DEFINITION = [
25
- # [Data Type, Field Name]
26
- # ['string', 'request name' : "tcpip-forward"],
27
- ['string', 'address to bind'],
28
- ['uint32', 'port number to bind'],
25
+ #[DataType, Field Name]
26
+ #[DataType::String, 'request name' : "tcpip-forward"],
27
+ [DataType::String, 'address to bind'],
28
+ [DataType::Uint32, 'port number to bind'],
29
29
  ]
30
30
 
31
31
  CANCEL_TCPIP_FORWARD_DEFINITION = [
32
- # [Data Type, Field Name]
33
- # ['string', 'request name' : "cancel-tcpip-forward"],
34
- ['string', 'address to bind'],
35
- ['uint32', 'port number to bind'],
32
+ #[DataType, Field Name]
33
+ #[DataType::String, 'request name' : "cancel-tcpip-forward"],
34
+ [DataType::String, 'address to bind'],
35
+ [DataType::Uint32, 'port number to bind'],
36
36
  ]
37
37
 
38
38
  CONDITIONAL_DEFINITION = {