class Net::SFTP::Protocol::Base
provides a way for subclasses to send requests.
SFTP protocol version. It implements general packet parsing logic, and
The abstract superclass of the specific implementations for each supported
def initialize(session)
def initialize(session) @session = session self.logger = session.logger @request_id_counter = -1 end
def parse(packet)
type, an exception will be raised. Returns the parsed data as a hash
Attept to parse the given packet. If the packet is of an unsupported
def parse(packet) case packet.type when FXP_STATUS then parse_status_packet(packet) when FXP_HANDLE then parse_handle_packet(packet) when FXP_DATA then parse_data_packet(packet) when FXP_NAME then parse_name_packet(packet) when FXP_ATTRS then parse_attrs_packet(packet) else raise NotImplementedError, "unknown packet type: #{packet.type}" end end
def send_request(type, *args)
A new request identifier will be allocated to this request, and will
Send a new packet of the given type, and with the given data arguments.
def send_request(type, *args) @request_id_counter += 1 session.send_packet(type, :long, @request_id_counter, *args) return @request_id_counter end