hrr_rb_sftp 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -0
  3. data/lib/hrr_rb_sftp.rb +79 -1
  4. data/lib/hrr_rb_sftp/loggable.rb +34 -0
  5. data/lib/hrr_rb_sftp/protocol.rb +39 -33
  6. data/lib/hrr_rb_sftp/protocol/common.rb +6 -3
  7. data/lib/hrr_rb_sftp/protocol/common/data_types.rb +19 -0
  8. data/lib/hrr_rb_sftp/protocol/common/data_types/byte.rb +40 -0
  9. data/lib/hrr_rb_sftp/protocol/common/data_types/extension_pair.rb +41 -0
  10. data/lib/hrr_rb_sftp/protocol/common/data_types/extension_pairs.rb +42 -0
  11. data/lib/hrr_rb_sftp/protocol/common/data_types/string.rb +42 -0
  12. data/lib/hrr_rb_sftp/protocol/common/data_types/uint32.rb +40 -0
  13. data/lib/hrr_rb_sftp/protocol/common/data_types/uint64.rb +40 -0
  14. data/lib/hrr_rb_sftp/protocol/common/packets.rb +16 -0
  15. data/lib/hrr_rb_sftp/protocol/common/packets/001_ssh_fxp_init.rb +27 -0
  16. data/lib/hrr_rb_sftp/protocol/common/packets/002_ssh_fxp_version.rb +28 -0
  17. data/lib/hrr_rb_sftp/protocol/common/packets/packet.rb +96 -0
  18. data/lib/hrr_rb_sftp/protocol/version1.rb +11 -3
  19. data/lib/hrr_rb_sftp/protocol/version1/data_types.rb +15 -0
  20. data/lib/hrr_rb_sftp/protocol/version1/data_types/attrs.rb +91 -0
  21. data/lib/hrr_rb_sftp/protocol/version1/packets.rb +72 -0
  22. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/003_ssh_fxp_open.rb +94 -43
  23. data/lib/hrr_rb_sftp/protocol/version1/packets/004_ssh_fxp_close.rb +61 -0
  24. data/lib/hrr_rb_sftp/protocol/version1/packets/005_ssh_fxp_read.rb +72 -0
  25. data/lib/hrr_rb_sftp/protocol/version1/packets/006_ssh_fxp_write.rb +64 -0
  26. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/007_ssh_fxp_lstat.rb +27 -9
  27. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/008_ssh_fxp_fstat.rb +26 -9
  28. data/lib/hrr_rb_sftp/protocol/version1/packets/009_ssh_fxp_setstat.rb +92 -0
  29. data/lib/hrr_rb_sftp/protocol/version1/packets/010_ssh_fxp_fsetstat.rb +85 -0
  30. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/011_ssh_fxp_opendir.rb +32 -11
  31. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/012_ssh_fxp_readdir.rb +73 -49
  32. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/013_ssh_fxp_remove.rb +27 -9
  33. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/014_ssh_fxp_mkdir.rb +28 -10
  34. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/015_ssh_fxp_rmdir.rb +32 -12
  35. data/lib/hrr_rb_sftp/protocol/version1/packets/016_ssh_fxp_realpath.rb +47 -0
  36. data/lib/hrr_rb_sftp/protocol/version1/{packet → packets}/017_ssh_fxp_stat.rb +27 -9
  37. data/lib/hrr_rb_sftp/protocol/version1/packets/101_ssh_fxp_status.rb +73 -0
  38. data/lib/hrr_rb_sftp/protocol/version1/packets/102_ssh_fxp_handle.rb +28 -0
  39. data/lib/hrr_rb_sftp/protocol/version1/packets/103_ssh_fxp_data.rb +28 -0
  40. data/lib/hrr_rb_sftp/protocol/version1/packets/104_ssh_fxp_name.rb +48 -0
  41. data/lib/hrr_rb_sftp/protocol/version1/packets/105_ssh_fxp_attrs.rb +28 -0
  42. data/lib/hrr_rb_sftp/protocol/version1/packets/packet.rb +57 -0
  43. data/lib/hrr_rb_sftp/protocol/version2.rb +11 -3
  44. data/lib/hrr_rb_sftp/protocol/version2/data_types.rb +13 -0
  45. data/lib/hrr_rb_sftp/protocol/version2/packets.rb +14 -0
  46. data/lib/hrr_rb_sftp/protocol/version2/packets/018_ssh_fxp_rename.rb +91 -0
  47. data/lib/hrr_rb_sftp/protocol/version3.rb +12 -3
  48. data/lib/hrr_rb_sftp/protocol/version3/data_types.rb +13 -0
  49. data/lib/hrr_rb_sftp/protocol/version3/extensions.rb +94 -0
  50. data/lib/hrr_rb_sftp/protocol/version3/extensions/extension.rb +58 -0
  51. data/lib/hrr_rb_sftp/protocol/version3/extensions/fsync_at_openssh_com.rb +59 -0
  52. data/lib/hrr_rb_sftp/protocol/version3/extensions/hardlink_at_openssh_com.rb +84 -0
  53. data/lib/hrr_rb_sftp/protocol/version3/extensions/lsetstat_at_openssh_com.rb +132 -0
  54. data/lib/hrr_rb_sftp/protocol/version3/extensions/posix_rename_at_openssh_com.rb +76 -0
  55. data/lib/hrr_rb_sftp/protocol/version3/packets.rb +19 -0
  56. data/lib/hrr_rb_sftp/protocol/version3/packets/014_ssh_fxp_mkdir.rb +75 -0
  57. data/lib/hrr_rb_sftp/protocol/version3/packets/019_ssh_fxp_readlink.rb +76 -0
  58. data/lib/hrr_rb_sftp/protocol/version3/packets/020_ssh_fxp_symlink.rb +76 -0
  59. data/lib/hrr_rb_sftp/protocol/version3/packets/101_ssh_fxp_status.rb +25 -0
  60. data/lib/hrr_rb_sftp/protocol/version3/packets/200_ssh_fxp_extended.rb +95 -0
  61. data/lib/hrr_rb_sftp/protocol/version3/packets/201_ssh_fxp_extended_reply.rb +60 -0
  62. data/lib/hrr_rb_sftp/receiver.rb +17 -2
  63. data/lib/hrr_rb_sftp/sender.rb +15 -1
  64. data/lib/hrr_rb_sftp/server.rb +43 -12
  65. data/lib/hrr_rb_sftp/version.rb +5 -1
  66. metadata +54 -47
  67. data/lib/hrr_rb_sftp/protocol/common/data_type.rb +0 -15
  68. data/lib/hrr_rb_sftp/protocol/common/data_type/byte.rb +0 -22
  69. data/lib/hrr_rb_sftp/protocol/common/data_type/extension_pair.rb +0 -23
  70. data/lib/hrr_rb_sftp/protocol/common/data_type/extension_pairs.rb +0 -24
  71. data/lib/hrr_rb_sftp/protocol/common/data_type/string.rb +0 -24
  72. data/lib/hrr_rb_sftp/protocol/common/data_type/uint32.rb +0 -22
  73. data/lib/hrr_rb_sftp/protocol/common/data_type/uint64.rb +0 -22
  74. data/lib/hrr_rb_sftp/protocol/common/packet.rb +0 -11
  75. data/lib/hrr_rb_sftp/protocol/common/packet/001_ssh_fxp_init.rb +0 -18
  76. data/lib/hrr_rb_sftp/protocol/common/packet/002_ssh_fxp_version.rb +0 -19
  77. data/lib/hrr_rb_sftp/protocol/common/packetable.rb +0 -72
  78. data/lib/hrr_rb_sftp/protocol/version1/data_type.rb +0 -11
  79. data/lib/hrr_rb_sftp/protocol/version1/data_type/attrs.rb +0 -54
  80. data/lib/hrr_rb_sftp/protocol/version1/packet.rb +0 -29
  81. data/lib/hrr_rb_sftp/protocol/version1/packet/004_ssh_fxp_close.rb +0 -44
  82. data/lib/hrr_rb_sftp/protocol/version1/packet/005_ssh_fxp_read.rb +0 -53
  83. data/lib/hrr_rb_sftp/protocol/version1/packet/006_ssh_fxp_write.rb +0 -46
  84. data/lib/hrr_rb_sftp/protocol/version1/packet/009_ssh_fxp_setstat.rb +0 -63
  85. data/lib/hrr_rb_sftp/protocol/version1/packet/010_ssh_fxp_fsetstat.rb +0 -48
  86. data/lib/hrr_rb_sftp/protocol/version1/packet/016_ssh_fxp_realpath.rb +0 -30
  87. data/lib/hrr_rb_sftp/protocol/version1/packet/101_ssh_fxp_status.rb +0 -29
  88. data/lib/hrr_rb_sftp/protocol/version1/packet/102_ssh_fxp_handle.rb +0 -19
  89. data/lib/hrr_rb_sftp/protocol/version1/packet/103_ssh_fxp_data.rb +0 -19
  90. data/lib/hrr_rb_sftp/protocol/version1/packet/104_ssh_fxp_name.rb +0 -33
  91. data/lib/hrr_rb_sftp/protocol/version1/packet/105_ssh_fxp_attrs.rb +0 -19
  92. data/lib/hrr_rb_sftp/protocol/version2/data_type.rb +0 -9
  93. data/lib/hrr_rb_sftp/protocol/version2/packet.rb +0 -11
  94. data/lib/hrr_rb_sftp/protocol/version2/packet/018_ssh_fxp_rename.rb +0 -70
  95. data/lib/hrr_rb_sftp/protocol/version3/data_type.rb +0 -9
  96. data/lib/hrr_rb_sftp/protocol/version3/packet.rb +0 -16
  97. data/lib/hrr_rb_sftp/protocol/version3/packet/014_ssh_fxp_mkdir.rb +0 -58
  98. data/lib/hrr_rb_sftp/protocol/version3/packet/019_ssh_fxp_readlink.rb +0 -57
  99. data/lib/hrr_rb_sftp/protocol/version3/packet/020_ssh_fxp_symlink.rb +0 -58
  100. data/lib/hrr_rb_sftp/protocol/version3/packet/101_ssh_fxp_status.rb +0 -31
  101. data/lib/hrr_rb_sftp/protocol/version3/packet/200_ssh_fxp_extended.rb +0 -34
  102. data/lib/hrr_rb_sftp/protocol/version3/packet/201_ssh_fxp_extended_reply.rb +0 -23
@@ -1,21 +1,37 @@
1
1
  module HrrRbSftp
2
2
  class Protocol
3
- class Version1
4
- module Packet
5
- class SSH_FXP_MKDIR
6
- include Common::Packetable
3
+ module Version1
4
+ class Packets
7
5
 
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_MKDIR packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_MKDIR < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_MKDIR packet type.
13
+ #
8
14
  TYPE = 14
9
15
 
16
+ #
17
+ # Represents SSH_FXP_MKDIR packet format.
18
+ #
10
19
  FORMAT = [
11
- [DataType::Byte, :"type" ],
12
- [DataType::Uint32, :"request-id"],
13
- [DataType::String, :"path" ],
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::String, :"path" ],
14
23
  ]
15
24
 
25
+ #
26
+ # Responds to SSH_FXP_MKDIR request.
27
+ #
28
+ # @param request [Hash{Symbol=>Object}] SSH_FXP_MKDIR request represented in Hash.
29
+ # @return [Hash{Symbol=>Object}] Response represented in Hash. Its type is SSH_FXP_STATUS.
30
+ #
16
31
  def respond_to request
17
32
  begin
18
- Dir.mkdir request[:"path"]
33
+ log_debug { "Dir.mkdir(#{request[:"path"].inspect})" }
34
+ Dir.mkdir(request[:"path"])
19
35
  {
20
36
  :"type" => SSH_FXP_STATUS::TYPE,
21
37
  :"request-id" => request[:"request-id"],
@@ -23,7 +39,8 @@ module HrrRbSftp
23
39
  :"error message" => "Success",
24
40
  :"language tag" => "",
25
41
  }
26
- rescue Errno::EACCES
42
+ rescue Errno::EACCES => e
43
+ log_debug { e.message }
27
44
  {
28
45
  :"type" => SSH_FXP_STATUS::TYPE,
29
46
  :"request-id" => request[:"request-id"],
@@ -31,7 +48,8 @@ module HrrRbSftp
31
48
  :"error message" => "Permission denied",
32
49
  :"language tag" => "",
33
50
  }
34
- rescue Errno::EEXIST
51
+ rescue Errno::EEXIST => e
52
+ log_debug { e.message }
35
53
  {
36
54
  :"type" => SSH_FXP_STATUS::TYPE,
37
55
  :"request-id" => request[:"request-id"],
@@ -1,21 +1,37 @@
1
1
  module HrrRbSftp
2
2
  class Protocol
3
- class Version1
4
- module Packet
5
- class SSH_FXP_RMDIR
6
- include Common::Packetable
3
+ module Version1
4
+ class Packets
7
5
 
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_RMDIR packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_RMDIR < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_RMDIR packet type.
13
+ #
8
14
  TYPE = 15
9
15
 
16
+ #
17
+ # Represents SSH_FXP_RMDIR packet format.
18
+ #
10
19
  FORMAT = [
11
- [DataType::Byte, :"type" ],
12
- [DataType::Uint32, :"request-id"],
13
- [DataType::String, :"path" ],
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::String, :"path" ],
14
23
  ]
15
24
 
25
+ #
26
+ # Responds to SSH_FXP_RMDIR request.
27
+ #
28
+ # @param request [Hash{Symbol=>Object}] SSH_FXP_RMDIR request represented in Hash.
29
+ # @return [Hash{Symbol=>Object}] Response represented in Hash. Its type is SSH_FXP_STATUS.
30
+ #
16
31
  def respond_to request
17
32
  begin
18
- Dir.rmdir request[:"path"]
33
+ log_debug { "Dir.rmdir(#{request[:"path"].inspect})" }
34
+ Dir.rmdir(request[:"path"])
19
35
  {
20
36
  :"type" => SSH_FXP_STATUS::TYPE,
21
37
  :"request-id" => request[:"request-id"],
@@ -23,7 +39,8 @@ module HrrRbSftp
23
39
  :"error message" => "Success",
24
40
  :"language tag" => "",
25
41
  }
26
- rescue Errno::ENOENT
42
+ rescue Errno::ENOENT => e
43
+ log_debug { e.message }
27
44
  {
28
45
  :"type" => SSH_FXP_STATUS::TYPE,
29
46
  :"request-id" => request[:"request-id"],
@@ -31,7 +48,8 @@ module HrrRbSftp
31
48
  :"error message" => "No such file or directory",
32
49
  :"language tag" => "",
33
50
  }
34
- rescue Errno::EACCES
51
+ rescue Errno::EACCES => e
52
+ log_debug { e.message }
35
53
  {
36
54
  :"type" => SSH_FXP_STATUS::TYPE,
37
55
  :"request-id" => request[:"request-id"],
@@ -39,7 +57,8 @@ module HrrRbSftp
39
57
  :"error message" => "Permission denied",
40
58
  :"language tag" => "",
41
59
  }
42
- rescue Errno::ENOTDIR
60
+ rescue Errno::ENOTDIR => e
61
+ log_debug { e.message }
43
62
  {
44
63
  :"type" => SSH_FXP_STATUS::TYPE,
45
64
  :"request-id" => request[:"request-id"],
@@ -47,7 +66,8 @@ module HrrRbSftp
47
66
  :"error message" => "Not a directory",
48
67
  :"language tag" => "",
49
68
  }
50
- rescue Errno::ENOTEMPTY
69
+ rescue Errno::ENOTEMPTY => e
70
+ log_debug { e.message }
51
71
  {
52
72
  :"type" => SSH_FXP_STATUS::TYPE,
53
73
  :"request-id" => request[:"request-id"],
@@ -0,0 +1,47 @@
1
+ module HrrRbSftp
2
+ class Protocol
3
+ module Version1
4
+ class Packets
5
+
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_REALPATH packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_REALPATH < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_REALPATH packet type.
13
+ #
14
+ TYPE = 16
15
+
16
+ #
17
+ # Represents SSH_FXP_REALPATH packet format.
18
+ #
19
+ FORMAT = [
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::String, :"path" ],
23
+ ]
24
+
25
+ #
26
+ # Responds to SSH_FXP_REALPATH request.
27
+ #
28
+ # @param request [Hash{Symbol=>Object}] SSH_FXP_REALPATH request represented in Hash.
29
+ # @return [Hash{Symbol=>Object}] Response represented in Hash. Its type is SSH_FXP_NAME.
30
+ #
31
+ def respond_to request
32
+ log_debug { "absolute_path = File.absolute_path(#{request[:"path"].inspect})" }
33
+ absolute_path = File.absolute_path(request[:"path"])
34
+ {
35
+ :"type" => SSH_FXP_NAME::TYPE,
36
+ :"request-id" => request[:"request-id"],
37
+ :"count" => 1,
38
+ :"filename[0]" => absolute_path,
39
+ :"longname[0]" => absolute_path,
40
+ :"attrs[0]" => {},
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,20 +1,36 @@
1
1
  module HrrRbSftp
2
2
  class Protocol
3
- class Version1
4
- module Packet
5
- class SSH_FXP_STAT
6
- include Common::Packetable
3
+ module Version1
4
+ class Packets
7
5
 
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_STAT packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_STAT < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_STAT packet type.
13
+ #
8
14
  TYPE = 17
9
15
 
16
+ #
17
+ # Represents SSH_FXP_STAT packet format.
18
+ #
10
19
  FORMAT = [
11
- [DataType::Byte, :"type" ],
12
- [DataType::Uint32, :"request-id"],
13
- [DataType::String, :"path" ],
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::String, :"path" ],
14
23
  ]
15
24
 
25
+ #
26
+ # Responds to SSH_FXP_STAT request.
27
+ #
28
+ # @param request [Hash{Symbol=>Object}] SSH_FXP_STAT request represented in Hash.
29
+ # @return [Hash{Symbol=>Object}] Response represented in Hash. In case of success, its type is SSH_FXP_ATTRS. In other cases, its type is SSH_FXP_STATUS.
30
+ #
16
31
  def respond_to request
17
32
  begin
33
+ log_debug { "File.stat(#{request[:"path"].inspect})" }
18
34
  stat = File.stat(request[:"path"])
19
35
  attrs = Hash.new
20
36
  attrs[:"size"] = stat.size if stat.size
@@ -28,7 +44,8 @@ module HrrRbSftp
28
44
  :"request-id" => request[:"request-id"],
29
45
  :"attrs" => attrs,
30
46
  }
31
- rescue Errno::ENOENT
47
+ rescue Errno::ENOENT => e
48
+ log_debug { e.message }
32
49
  {
33
50
  :"type" => SSH_FXP_STATUS::TYPE,
34
51
  :"request-id" => request[:"request-id"],
@@ -36,7 +53,8 @@ module HrrRbSftp
36
53
  :"error message" => "No such file or directory",
37
54
  :"language tag" => "",
38
55
  }
39
- rescue Errno::EACCES
56
+ rescue Errno::EACCES => e
57
+ log_debug { e.message }
40
58
  {
41
59
  :"type" => SSH_FXP_STATUS::TYPE,
42
60
  :"request-id" => request[:"request-id"],
@@ -0,0 +1,73 @@
1
+ module HrrRbSftp
2
+ class Protocol
3
+ module Version1
4
+ class Packets
5
+
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_STATUS packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_STATUS < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_STATUS packet type.
13
+ #
14
+ TYPE = 101
15
+
16
+ #
17
+ # Represents SSH_FXP_STATUS packet format.
18
+ #
19
+ FORMAT = [
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::Uint32, :"code" ],
23
+ ]
24
+
25
+ #
26
+ # Represents SSH_FX_OK value.
27
+ #
28
+ SSH_FX_OK = 0
29
+
30
+ #
31
+ # Represents SSH_FX_EOF value.
32
+ #
33
+ SSH_FX_EOF = 1
34
+
35
+ #
36
+ # Represents SSH_FX_NO_SUCH_FILE value.
37
+ #
38
+ SSH_FX_NO_SUCH_FILE = 2
39
+
40
+ #
41
+ # Represents SSH_FX_PERMISSION_DENIED value.
42
+ #
43
+ SSH_FX_PERMISSION_DENIED = 3
44
+
45
+ #
46
+ # Represents SSH_FX_FAILURE value.
47
+ #
48
+ SSH_FX_FAILURE = 4
49
+
50
+ #
51
+ # Represents SSH_FX_BAD_MESSAGE value.
52
+ #
53
+ SSH_FX_BAD_MESSAGE = 5
54
+
55
+ #
56
+ # Represents SSH_FX_NO_CONNECTION value.
57
+ #
58
+ SSH_FX_NO_CONNECTION = 6
59
+
60
+ #
61
+ # Represents SSH_FX_CONNECTION_LOST value.
62
+ #
63
+ SSH_FX_CONNECTION_LOST = 7
64
+
65
+ #
66
+ # Represents SSH_FX_OP_UNSUPPORTED value.
67
+ #
68
+ SSH_FX_OP_UNSUPPORTED = 8
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,28 @@
1
+ module HrrRbSftp
2
+ class Protocol
3
+ module Version1
4
+ class Packets
5
+
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_HANDLE packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_HANDLE < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_HANDLE packet type.
13
+ #
14
+ TYPE = 102
15
+
16
+ #
17
+ # Represents SSH_FXP_HANDLE packet format.
18
+ #
19
+ FORMAT = [
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::String, :"handle" ],
23
+ ]
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ module HrrRbSftp
2
+ class Protocol
3
+ module Version1
4
+ class Packets
5
+
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_DATA packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_DATA < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_DATA packet type.
13
+ #
14
+ TYPE = 103
15
+
16
+ #
17
+ # Represents SSH_FXP_DATA packet format.
18
+ #
19
+ FORMAT = [
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::String, :"data" ],
23
+ ]
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,48 @@
1
+ module HrrRbSftp
2
+ class Protocol
3
+ module Version1
4
+ class Packets
5
+
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_NAME packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_NAME < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_NAME packet type.
13
+ #
14
+ TYPE = 104
15
+
16
+ #
17
+ # Represents SSH_FXP_NAME packet format.
18
+ #
19
+ FORMAT = [
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::Uint32, :"count" ],
23
+ ]
24
+
25
+ #
26
+ # Represents SSH_FXP_NAME packet additional format for :"count" => N.
27
+ #
28
+ PER_COUNT_FORMAT = Hash.new{ |hash, key|
29
+ Array.new(key){ |i|
30
+ [
31
+ [DataTypes::String, :"filename[#{i}]"],
32
+ [DataTypes::String, :"longname[#{i}]"],
33
+ [DataTypes::Attrs, :"attrs[#{i}]" ],
34
+ ]
35
+ }.inject(:+)
36
+ }
37
+
38
+ #
39
+ # Represents SSH_FXP_NAME packet conditional format.
40
+ #
41
+ CONDITIONAL_FORMAT = {
42
+ :"count" => PER_COUNT_FORMAT,
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,28 @@
1
+ module HrrRbSftp
2
+ class Protocol
3
+ module Version1
4
+ class Packets
5
+
6
+ #
7
+ # This class implements SFTP protocol version 1 SSH_FXP_ATTRS packet type, format, and responder.
8
+ #
9
+ class SSH_FXP_ATTRS < Packet
10
+
11
+ #
12
+ # Represents SSH_FXP_ATTRS packet type.
13
+ #
14
+ TYPE = 105
15
+
16
+ #
17
+ # Represents SSH_FXP_ATTRS packet format.
18
+ #
19
+ FORMAT = [
20
+ [DataTypes::Byte, :"type" ],
21
+ [DataTypes::Uint32, :"request-id"],
22
+ [DataTypes::Attrs, :"attrs" ],
23
+ ]
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end