Class: Net::NATPMP::MappingRequest
- Defined in:
- lib/net/natpmp/requests.rb
Overview
Represents a port mapping request
Constant Summary
Constants included from Constants
Constants::BASE_DELAY, Constants::DEFAULT_INSIDE_PORT, Constants::DEFAULT_LIFETIME, Constants::DEFAULT_OUTSIDE_PORT, Constants::DEFAULT_PROTO, Constants::MAX_WAIT, Constants::OP_CODES, Constants::PROTO_CODES, Constants::RESULT_CODES, Constants::RESULT_CODES_DESC, Constants::VERSION
Instance Attribute Summary
Attributes inherited from Request
Class Method Summary collapse
Methods inherited from Request
#check_reply, #initialize, #send
Constructor Details
This class inherits a constructor from Net::NATPMP::Request
Class Method Details
.req(config, proto:, inside_port:, outside_port:, lifetime:) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/net/natpmp/requests.rb', line 91 def self.req(config, proto:, inside_port:, outside_port:, lifetime:) # TODO: Ensure proto is either :udp or :tcp instance = super(config) msg = [ VERSION, OP_CODES[PROTO_CODES[proto]], 0, inside_port, outside_port, lifetime ].pack('CCnnnN') MappingResponse.new(instance.send(msg, 16), proto: proto) end |