Class: Ftpd::Protocols
Overview
With the commands EPORT and EPSV, the client sends a protocol code to indicate whether it wants an IPV4 or an IPV6 connection. This class contains functions related to that protocol code.
Defined Under Namespace
Modules: Codes
Constant Summary
Constants included from Codes
Instance Method Summary collapse
- 
  
    
      #initialize(socket)  ⇒ Protocols 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Protocols. 
- 
  
    
      #protocol_codes  ⇒ Array<Integer> 
    
    
  
  
  
  
  
  
  
  
  
    What protocol codes does the socket support?. 
- 
  
    
      #supports_protocol?(protocol_code)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Can the socket support a connection in the indicated protocol?. 
Constructor Details
#initialize(socket) ⇒ Protocols
Returns a new instance of Protocols.
| 21 22 23 | # File 'lib/ftpd/protocols.rb', line 21 def initialize(socket) @socket = socket end | 
Instance Method Details
#protocol_codes ⇒ Array<Integer>
What protocol codes does the socket support?
| 37 38 39 40 41 42 | # File 'lib/ftpd/protocols.rb', line 37 def protocol_codes [ (IPV4 if supports_ipv4?), (IPV6 if supports_ipv6?), ].compact end | 
#supports_protocol?(protocol_code) ⇒ Boolean
Can the socket support a connection in the indicated protocol?
| 29 30 31 | # File 'lib/ftpd/protocols.rb', line 29 def supports_protocol?(protocol_code) protocol_codes.include?(protocol_code) end |