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



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ftpd/session.rb', line 29

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)
  @data_server_factory = DataServerFactory.make(
    @socket.addr[3],
    config.passive_ports,
  )
  register_commands
  initialize_session
end

Instance Attribute Details

#command_sequence_checkerObject

Returns the value of attribute command_sequence_checker.



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

def command_sequence_checker
  @command_sequence_checker
end

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

#data_channel_protection_levelObject

Returns the value of attribute data_channel_protection_level.



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

def data_channel_protection_level
  @data_channel_protection_level
end

#data_hostnameObject (readonly)

Returns the value of attribute data_hostname.



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

def data_hostname
  @data_hostname
end

#data_portObject (readonly)

Returns the value of attribute data_port.



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

def data_port
  @data_port
end

#data_serverObject

Returns the value of attribute data_server.



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

def data_server
  @data_server
end

#data_server_factoryObject

Returns the value of attribute data_server_factory.



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

def data_server_factory
  @data_server_factory
end

#data_typeObject

Returns the value of attribute data_type.



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

def data_type
  @data_type
end

#epsv_all=(value) ⇒ Object (writeonly)

Sets the attribute epsv_all



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

def epsv_all=(value)
  @epsv_all = value
end

#file_systemObject (readonly)

Returns the value of attribute file_system.



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

def file_system
  @file_system
end

#logged_inObject

Returns the value of attribute logged_in.



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

def logged_in
  @logged_in
end

#mode=(value) ⇒ Object (writeonly)

Sets the attribute mode



23
24
25
# File 'lib/ftpd/session.rb', line 23

def mode=(value)
  @mode = value
end

#name_prefixObject

Returns the value of attribute name_prefix.



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

def name_prefix
  @name_prefix
end

#protection_buffer_size_setObject

Returns the value of attribute protection_buffer_size_set.



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

def protection_buffer_size_set
  @protection_buffer_size_set
end

#socketObject

Returns the value of attribute socket.



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

def socket
  @socket
end

#structure=(value) ⇒ Object (writeonly)

Sets the attribute structure



24
25
26
# File 'lib/ftpd/session.rb', line 24

def structure=(value)
  @structure = value
end

Instance Method Details

#runObject



48
49
50
# File 'lib/ftpd/session.rb', line 48

def run
  @command_loop.read_and_execute_commands
end