Class: Ftpd::Session

Inherits:
Object
  • Object
show all
Includes:
Error, ListPath
Defined in:
lib/ftpd/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ListPath

#list_path

Methods included from Error

#error, #sequence_error, #syntax_error, #unimplemented_error

Constructor Details

#initialize(session_config, socket) ⇒ Session

Returns a new instance of Session.

Parameters:

  • socket (TCPSocket, OpenSSL::SSL::SSLSocket)

    The socket



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ftpd/session.rb', line 26

def initialize(session_config, socket)
  @config = session_config
  @socket = socket
  if @config.tls == :implicit
    @socket.encrypt
  end
  @command_sequence_checker = init_command_sequence_checker
  set_socket_options
  @protocols = Protocols.new(@socket)
  @command_handlers = CommandHandlers.new
  @command_loop = CommandLoop.new(self)
  register_commands
  initialize_session
end

Instance Attribute Details

#command_sequence_checkerObject

Returns the value of attribute command_sequence_checker.



7
8
9
# File 'lib/ftpd/session.rb', line 7

def command_sequence_checker
  @command_sequence_checker
end

#configObject (readonly)

Returns the value of attribute config.



15
16
17
# File 'lib/ftpd/session.rb', line 15

def config
  @config
end

#data_channel_protection_levelObject

Returns the value of attribute data_channel_protection_level.



8
9
10
# File 'lib/ftpd/session.rb', line 8

def data_channel_protection_level
  @data_channel_protection_level
end

#data_hostnameObject (readonly)

Returns the value of attribute data_hostname.



16
17
18
# File 'lib/ftpd/session.rb', line 16

def data_hostname
  @data_hostname
end

#data_portObject (readonly)

Returns the value of attribute data_port.



17
18
19
# File 'lib/ftpd/session.rb', line 17

def data_port
  @data_port
end

#data_serverObject

Returns the value of attribute data_server.



9
10
11
# File 'lib/ftpd/session.rb', line 9

def data_server
  @data_server
end

#data_typeObject

Returns the value of attribute data_type.



10
11
12
# File 'lib/ftpd/session.rb', line 10

def data_type
  @data_type
end

#epsv_all=(value) ⇒ Object (writeonly)

Sets the attribute epsv_all

Parameters:

  • value

    the value to set the attribute epsv_all to.



19
20
21
# File 'lib/ftpd/session.rb', line 19

def epsv_all=(value)
  @epsv_all = value
end

#file_systemObject (readonly)

Returns the value of attribute file_system.



18
19
20
# File 'lib/ftpd/session.rb', line 18

def file_system
  @file_system
end

#logged_inObject

Returns the value of attribute logged_in.



11
12
13
# File 'lib/ftpd/session.rb', line 11

def logged_in
  @logged_in
end

#mode=(value) ⇒ Object (writeonly)

Sets the attribute mode

Parameters:

  • value

    the value to set the attribute mode to.



20
21
22
# File 'lib/ftpd/session.rb', line 20

def mode=(value)
  @mode = value
end

#name_prefixObject

Returns the value of attribute name_prefix.



12
13
14
# File 'lib/ftpd/session.rb', line 12

def name_prefix
  @name_prefix
end

#protection_buffer_size_setObject

Returns the value of attribute protection_buffer_size_set.



13
14
15
# File 'lib/ftpd/session.rb', line 13

def protection_buffer_size_set
  @protection_buffer_size_set
end

#socketObject

Returns the value of attribute socket.



14
15
16
# File 'lib/ftpd/session.rb', line 14

def socket
  @socket
end

#structure=(value) ⇒ Object (writeonly)

Sets the attribute structure

Parameters:

  • value

    the value to set the attribute structure to.



21
22
23
# File 'lib/ftpd/session.rb', line 21

def structure=(value)
  @structure = value
end

Instance Method Details

#runObject



41
42
43
# File 'lib/ftpd/session.rb', line 41

def run
  @command_loop.read_and_execute_commands
end